Bluetooth Security Manager

一.概念
    The Security Manager defines methods of pairing and key distribution, a protocol for those methods and a security toolbox to be used by those methods and other parts of an LE device.
Bluetooth Security Manager_第1张图片

二.pairing过程
    分为3个phase:
• Phase 1: Pairing Feature Exchange
• Phase 2: Short Term Key (STK) Generation
• Phase 3: Transport Specific Key Distribution
Bluetooth Security Manager_第2张图片
  其中,在phase2生成Short Term Key (STK)的过程,可以用到以下三种方法:
• Just Works
• Passkey Entry
• Out Of Band (OOB)
下面是一些chart,可以具体看三个phase实现的一些动作:
1.总的过程如下

可以看到第二个生成STK的过程有三个方法。

2.先看第一个phase:Pairing Feature Exchange
分为master主动发起和slave要求发起,多了一个slave发起的Security Request (AuthReq)
Bluetooth Security Manager_第3张图片

3.第二个phase:Authenticating and Encrypting
分别对应上面 Just Works, Passkey Entry 和Out Of Band (OOB)三种方法。
Bluetooth Security Manager_第4张图片

Bluetooth Security Manager_第5张图片



我们来比较一下这三种方法,Just Works Pairing Method使用的TK = 0x00,Passkey Entry Pairing Method使用的TK是用户输入的,而OOB Pairing Method使用的TK = OOB TK Value,其余过程都是一样的。我们在phase1中进行Feature Exchange,获得一些参数,通过函数:
c1(TK, Mrand, Pairing Request command, Pairing Response command,initiating device address type, initiating device address, responding device address type, responding device address)
分别在master和slave端计算得到Mconfirm和Sconfirm,通过Pairing Confirm和Pairing Random交换Mconfirm和Sconfirm以及Mrand和Srand,两端再进行Check for confirm value match,通过函数:
STK = s1(TK, Srand, Mrand)
计算出最终的STK。然后用这个STK来对LE link进行encrypted。

3.phase3: Transport Specific Key Distribution
生成STK并对link进行加密后,就可以进行这一步了:
Bluetooth Security Manager_第6张图片

然后可能使用LTK来进行re-establish security,举例如下:


三.错误处理
在这三个phase过程中,可能出错。
例如在phase1中可能出现:
Pairing Failed (“Encryption Key Size”)
Pairing Failed (“Encryption Key Size”)
在phase2中:
Pairing Failed (“Passkey Entry Failed”)
Pairing Failed (“Confirm Value Failed”)等等。

你可能感兴趣的:(Bluetooth Security Manager)