AES-128 CMAC:保障嵌入式通信安全的认证算法

请添加图片描述


1. 什么是CMAC?为什么需要它?

CMAC全称为Cipher-based Message Authentication Code(基于密码的消息认证码),是一种基于对称加密算法生成消息认证码的技术。简单来说,它就像数据的"数字指纹",可以验证消息在传输过程中是否被篡改,并确认消息来源的真实性。

与传统的哈希算法(如MD5、SHA)不同,CMAC使用密钥来生成认证码,这意味着只有持有相同密钥的双方才能生成和验证这个"指纹"。在汽车电子、物联网等安全敏感领域,这种特性尤为重要。


2. AES-128 CMAC算法原理

2.1 基本概念

AES-128 CMAC结合了AES加密算法(128位密钥)和CMAC认证模式。它按照NIST SP 800-38B标准构建,提供了高效且安全的认证机制。


2.2 工作原理详解

CMAC的核心过程类似于一场精心设计的接力赛,其中每个数据块都会与前一个加密结果混合后再加密,形成链式结构。这种设计使得即使改变输入中的一个比特,最终结果也会截然不同,提供了强大的安全性。

核心步骤

  1. 子密钥生成 - 算法的"秘密武器"
    CMAC使用两个子密钥K1和K2来处理最后的数据块。生成过程如下:
详细介绍了AES-CMAC算法的原理与实现,附有C语言写的样例程序。 以下是原文的introduction: The National Institute of Standards and Technology (NIST) has recently specified the Cipher-based Message Authentication Code(CMAC). CMAC [NIST-CMAC] is a keyed hash function that is based on a symmetric key block cipher, such as the Advanced Encryption Standard [NIST-AES]. CMAC is equivalent to the One-Key CBC MAC1 (OMAC1) submitted by Iwata and Kurosawa [OMAC1a, OMAC1b]. OMAC1 is an improvement of the eXtended Cipher Block Chaining mode (XCBC) submitted by Black and Rogaway [XCBCa, XCBCb], which itself is an improvement of the basic Cipher Block Chaining-Message Authentication Code (CBC-MAC). XCBC efficiently addresses the security deficiencies of CBC-MAC, and OMAC1 efficiently reduces the key size of XCBC. AES-CMAC provides stronger assurance of data integrity than a checksum or an error-detecting code. The verification of a checksum or an error-detecting code detects only accidental modifications of the data, while CMAC is designed to detect intentional, unauthorized modifications of the data, as well as accidental modifications. AES-CMAC achieves a security goal similar to that of HMAC [RFC-HMAC]. Since AES-CMAC is based on a symmetric key block cipher, AES, and HMAC is based on a hash function, such as SHA-1, AES-CMAC is appropriate for information systems in which AES is more readily available than a hash function. This memo specifies the authentication algorithm based on CMAC with AES-128. This new authentication algorithm is named AES-CMAC.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

智驾

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值