简体   繁体   English

如何通过CBCentralManager创建到BLE外设的安全连接?

[英]How can I create a secured connection to BLE peripheral through CBCentralManager?

I am new to iOS and Core Bluetooth. 我是iOS和Core Bluetooth的新手。 What I would like to know is how to create a secured connection to the device. 我想知道的是如何建立与设备的安全连接。

What I understand is: 我的理解是:

[manager connectPeripheral:peripheral options:nil] 

is the API provided to connect to the BLE device. 是提供用于连接BLE设备的API。 From this, how do I establish a secured connection? 由此,如何建立安全连接?

All BT4.0 connections are secured and managed by the device/sensor and iOS, you do not have control over this. 所有BT4.0连接均由设备/传感器和iOS保护和管理,您无法对此进行控制。

BT4.0 devices you also have bounded and unbounded connections. BT4.0设备还具有绑定和无绑定的连接。

Bounded connections are in a way "paired" to the iOS device. 绑定的连接以“配对”的方式连接到iOS设备。 Once bounded they will not communicate to any other device. 一旦绑定,它们将无法与任何其他设备通信。 This ensures the device will always have a secured connection with the bounded iOS device. 这样可以确保设备始终与受限制的iOS设备保持安全连接。 Bounding is controlled by the operating system (iOS). 边界由操作系统(iOS)控制。 When a device that requires a bounded connection communicates with a iOS device, the iOS device will present a alert view asking if you wish to connect to the device. 当需要限制连接的设备与iOS设备通信时,iOS设备将显示一个警报视图,询问您是否要连接到该设备。

Unbounded devices are continually broadcast their services and allows any iOS device to connect to it. 无限制的设备会不断广播其服务,并允许任何iOS设备连接到它。 The operating system will not remember the device information, normally the application would store the UUID so it can establish the connection to the same device next time. 操作系统将不会记住设备信息,通常应用程序会存储UUID,以便下次可以建立与同一设备的连接。 This is the normal/recommended method for most BT4.0 sensors. 这是大多数BT4.0传感器的常规/推荐方法。

NOTE: Although unbounded devices are not "paired" with the iOS device, they will only communicate with a single iOS device at any one time. 注意:尽管未绑定的设备未与iOS设备“配对”,但它们只能在任何时候与一台iOS设备通信。

How can you define "secured connection"? 您如何定义“安全连接”? According to the specification of Bluetooth Low Energy, when one BLE connection is established between two different BLE devices, the connection is secured, and the AccessAddress field in Link-layer packet is generated for this connection. 根据低功耗蓝牙规范,当在两个不同的BLE设备之间建立一个BLE连接时,该连接将得到保护,并为此连接生成链路层数据包中的AccessAddress字段。 The value of the AccessAddress are different from other connection's. AccessAddress的值与其他连接的值不同。 If you want to know about more details, please refer to page 36 of 138, Bluetooth core specification 4.0 [vol. 如果您想了解更多详细信息,请参阅138的第36页,蓝牙核心规范4.0 [vol。 6]. 6]。

If you concerns that someone will sniff the data transmitted through this BLE connection, I have to see it's not easy. 如果您担心有人会嗅探通过此BLE连接传输的数据,我必须看到这并不容易。 Only one BLE slave connecting to the same Master as your BLE sensor can have the ability to sniff your BLE packets, and the functionality is implemented in the Controller side, and only few companies which can access the Controller firmware code can enable the sniffer function. 只能有一个BLE从属设备连接到与BLE传感器相同的主设备,并且可以嗅探BLE数据包,并且该功能是在Controller端实现的,只有少数可以访问Controller固件代码的公司可以启用嗅探器功能。

Furthermore, if you are still worried about your sensor data, Bluetooth Low Energy also provides encryption for BLE packets. 此外,如果您仍然担心传感器数据,Bluetooth Low Energy还为BLE数据包提供加密。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM