蓝牙加密(AES-CCM)

目录

AES-CCM

CCM规范加密过程

CCM规范解密认证过程

formatting函数

counter generation函数

蓝牙AES-CCM加密流程

参考文献


AES-CCM

Advanced Encryption Standard-Counter with Cipher Block Chaining-Message Authentication Code

自蓝牙4.1起蓝牙的加密算法开始采用AES-CCM对基带数据进行加密。

AES-CCM使用CBC-MAC(Cipher Block Chaining-Message Authentication Code)消息认证算法和Counter(CTR)加密模式实现。

CBC-MAC:提供数据完整性认证。

CTR:提供数据加密。

 CBC-MAC和CBC有以下区别:

1:CBC使用需要使用到初始化向量IV,CBC-MAC没有使用IV

2:CBC所有的中间值Yi都会作为密文的一部分,CBC-MAC只是输出最终的tag Yr

CCM不支持部分处理和流处理,包含2个过程:generation-encryption 和 decryption-verification

CCM规范加密过程

前提条件:

块加密算法

密钥K

counter generation函数

formatting函数

MAC的长度Tlen

输入参数:

nonce N

长度为Plen的有效负载P

关联数据( associated data) A

输出:

密文C

步骤和流程示意:

CCM规范解密认证过程

前提条件:

块加密算法

密钥K

counter generation函数

formatting函数

MAC的长度Tlen

输入参数:

nonce N

长度为Clen的密位C

关联数据( associated data) A

输出:

负载P(明文)或者无效

流程及示意图:

formatting函数

作用是将输入参数(N, A, P)格式化为块序列B0,B1,...,Br。

N:nonce

A:associated data A

P:需要加密的明文

CCM规范Flags的格式如下:

 t:MAC的字节数

q:payload的字节数

CCM规范B0的格式如下:

B0:nonce

B1:associated data A

Bn+1:验证payload的数据

counter generation函数

Ctri的格式:

Ctri的Flags格式:

蓝牙AES-CCM加密流程

MAC:在蓝牙Core spec中称为Message Integrity Check (MIC),避免和媒体控制的相关术语冲突

Nonce:长度为13个字节,有2种格式。

payload counter format:用于ACL数据包,在加密开始或恢复后每个方向的加密包从0开始。

clock format:用于SCO数据包。

IV:8个字节长,加密开始时IV值来自于加密前最后一次执行h5的ACO输出,在加密前可能会发生多个设备的认证,仅使用最后一个设备的ACO输出。

Associated data A:数据的packet header和payload header。

参考文献

NIST 800-38C

  • 2
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
详细介绍了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.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值