1.概述
在進行藍牙設備的連接時,爲了保護個人隱私和數據保密的需要,需要進行驗證。
2.一些Frame
Frame74:本地發送Authentication
requset command
00010001 00000100 00000010 00001001
00000000
Opcode: 0x0411
Connection Handle: 0x09
= 9
Frame75:Command Status
event
00001111 00000100 00000000 00000010 00010001 00000100
Status: Success
Frame76:Link
Key request event
該Event參數爲BR_ADDR
00010111 00000110 10000000 10011001
00100011 01001100 11100000 00000000
Bluetooth Device Address:
0x00-e0-4c-23-99-80
注:該Event應該是對Authentication requset command的後續迴應,向本地的Host要Link
key。
Frame77:Link
Key Negative request command
00001100 00000100 00000110 10000000
10011001 00100011 01001100 11100000 00000000
Bluetooth Device Address:
0x00-e0-4c-23-99-80
注:迴應遠端slave的Link Key request event,表示本地沒有存儲的Link Key。
Frame78:Link
Key Negative request command---command complete event
Frame79: IO
Capability request event
00110001 00000110 10000000 10011001
00100011 01001100 11100000 00000000
BD_ADDR: 0x00e04c239980
注:該event表示遠端的slave要求本地Host的IO_Capability,這個參數將在pair的過程中用到。
Frame80:IO Capability Request
Reply command
這個command的參數如下:
BD_ADDR,
IO_Capability,
OOB_Data_Present,
Authentication_Requirements
00101011 00000100 00001001 10000000
10011001 00100011 01001100 11100000 00000000 0000000100000000 00000101
Bluetooth Device Address: 0x00-e0-4c-23-99-80
IO Capability: 0x01 DisplayYesNo
OOB Data Present: 0x00
OOB authentication data not present
Authentication_Requirements:0x05 MITM
Protection Required – General Bonding. Use IO capabilities to determine authentication procedure.
注:這是本地的Host迴應遠端的IO Capability request event的,表明本地Host具有的IO
Capability。
Frame81:IO
Capability Request Reply command--command complete
Frame82:IO
Capability response event
該Event參數如下:
BD_ADDR,
IO_Capability,
OOB_Data_Present,
Authentication_Requirements
00110010 00001001 10000000 10011001
00100011 01001100 11100000 00000000 0000000100000000 00000000
BD_ADDR: 0x00e04c239980
IO Capability: DisplayYesNo
OOB Data Present: OOB
authentication data not present
Authentication_Requirements:0x05 MITM
Protection Required – General Bonding. Use IO capabilities to determine authentication procedure.
注:這個event由遠端的Slave產生,用來回復IO Capability Request Reply
command,參數也都基本一樣,作用就是表明你的IO capability我已經收到了,是不是感覺有點多此一舉呢??
Frame83:User
Confirmation Request event
參數如下:
BD_ADDR,
Numeric_Value
00110011 00001010 10000000 10011001
00100011 01001100 11100000 00000000 10110000 10111101 00001000 00000000
BD_ADDR: 0x00e04c239980
Numeric Value: 0x0008bdb0
注:遠端的slave要求一個Numeric value,本地的Host可以用User_Confirmation_Request_Reply
或者the
User_Confirmation_Request_Negative_Reply command來進行迴應。
Frame84:User
Confirmation Request Reply command
00101100 00000100 00000110 10000000
10011001 00100011 01001100 11100000 00000000
Bluetooth Device Address:
0x00-e0-4c-23-99-80
注:響應User Confirmation Request event,表示這個Numeric value實在正確的。
Frame85:User
Confirmation Request Reply command---command complete
Frame86: Simple
Pairing Complete event
00110110 00000111 00000000 10000000
10011001 00100011 01001100 11100000 00000000
BD_ADDR: 0xe04c23998000
status:0x00 success
注:表示配對成功
Frame87:Link
Key Notification Event
該Event參數如下:
BD_ADDR,
BD_ADDR,
Link_Key,
Key_Type
0011000 00010111 10000000 10011001 00100011
01001100 11100000 00000000 00010110 01010001 10001111 00011101 00100101 00110001 01101001 00001000 00000011 10110101 11101101 00011110 11110111 00000010 01001111 10101110 00000101
Bluetooth Device Address:
0x00-e0-4c-23-99-80
Link Key: 0xae 4f 02
f7 1e ed b5 03 08 69 31 25 1d 8f 51 16
Link Key Types: 0x05
Authenticated Combination Key
注:通知Host新的Link Key已經產生用來建立連接。
Frame89:Authentication complete event
00000110 00000011 00000000 00001001
00000000
Status: Success
Connection Handle: 9
注:表示驗證的過程完成。
3.總結
主要總結了設備在Authentication過程中交換的HCI數據包和一些重要的參數,在進行完Authentication過程後將進行Encryption的一些操作,將在下一篇介紹。