Hi Rodrigo, On Fri, Dec 02, 2016 at 12:30:12PM +0100, Rodrigo Lorenzo Leal wrote: > OK so pre shared key is my best option I guess. > > What I don't understand is, if is possible to have pre-shared key, that is > accesible through the cloud, why I cannot generate a key on the cloud and > access it doing a request, from both the app and the device (through GPRS). > > Maybe is not a OOB pairing in the strict Bluetooth protocol definition of > the word, but what I want to do is encrypt the BLE communication with a key > that is not exchange via Bluetooth.
Mynewt does not currently support this. The nimble host only issues an LE Start Encryption HCI command to the controller after a successful pairing or bonding restoration, and the application has no say over the specified key. In other words, there is no way bypass the pairing process and inject a key of your own. That said, I don't think it would be too much work to implement this feature. Sorry if I missed this earlier in the thread, but will iOS really let you use an external key for BLE encryption? Just based on my limited experience with CoreBluetooth, I wouldn't expect this functionality to be exposed. Thanks, Chris