在我的用例中,BLE外设没有任何实际的IO功能,但需要MITM保护。
作为解决方案,使用Passkey Entry配对方法,并通过其他通道交换6位数字的引脚。与带外配对的原理相同,但iOS不支持OOB,因此,下一个最好的方法是以与OOB相同的方式使用“密码输入”-区别在于使用6位密码而不是128位密码(总比没有好。 )。
问题是,要使此情况按预期工作,中央和外围设备都需要将其IO上限设置为KeyboardOnly
,这将导致PasskeyEntry: initiator and responder inputs
配对方法。
[可能的组合,从BT Core Specification [Vol 3] H部分,第2.3.5.1节,表2.8:IO功能到密钥生成方法的映射中复制:
/--------------------------------------------------------------------\
/-----------\ / Initiator (iOS/Android) \
/ Responder \ |-------------+--------------+---------------------+---------------------|
/ (Peripheral) \| DisplayOnly | DisplayYesNo | KeyboardOnly | KeyboardDisplay |
|-----------------|-------------+--------------+---------------------+---------------------+
| DisplayOnly | M1 | M3 |
+-----------------+ Just Works | Passkey Entry: |
| DisplayYesNo | | Responder displays, initiator inputs |
+-----------------+----------------------------+---------------------+---------------------+
| | | M4 | |
| KeyboardOnly | | Passkey Entry: | |
| | M2 | initiator and | M2 |
| | Passkey Entry: | responder inputs | Passkey Entry: |
+-----------------+ Initiator displays, +---------------------+ Initiator displays, |
| | responder inputs | M3 | responder inputs |
| KeyboardDisplay | | Passkey Entry: | |
| | | Responder displays, | |
| | | initiator inputs | |
+-----------------+----------------------------+---------------------+---------------------+
M1:不适合,因为它不提供身份验证,不提供窃听保护,不提供MITM保护。M2:不可能,因为Initiator显示的密码是iOS / Android堆栈中生成的随机数,无法手动设置。M3:与M2相同,但是从理论上讲,外围设备上的BT堆栈最终可以打补丁以生成“特定random编号”。M4:在两个设备上都可以输入自定义密码的唯一方法。
Android为此具有BluetoothConfigManager::setLeIoCapability方法
import com.google.android.things.bluetooth.BluetoothConfigManager
val manager = BluetoothConfigManager.getInstance()
// Report that this device can accept keyboard user input only
manager.leIoCapability = BluetoothConfigManager.IO_CAPABILITY_IN
// TODO: Adapter needs to be restarted using BluetoothAdapter::disable() and enable()!
是否有可能在iOS(核心蓝牙)上执行此操作?
感谢您提供任何帮助!
您已经回答了自己的问题。我认为M3可以满足您的需求(在您的从站上生成一个随机数,然后使用OOB将该随机数传送给用户,以便他/她可以在iOS设备上输入密码)。除此之外,您无法更改iOS行为。不幸的是,Apple在iOS上没有提供任何配对/绑定/安全性API,这很糟糕,因此您永远无法知道BLE操作是否“安全”。
如果您确实想要iOS / BLE上的安全性,那么您应该在BLE之上拥有自己的安全层(然后认为BLE不安全)。