ArduinoBLE icon indicating copy to clipboard operation
ArduinoBLE copied to clipboard

Impossible to use secure/encrypted pairing - arduino nano 33 BLE

Open maximouth opened this issue 2 years ago • 3 comments

I want to use the different levels of authentication for a central to connect to a peripheral. I've seen in the EncryptedBatteryMonitor example you provide l38 and 39 the way to declare a characteristic of a service which require encryption to write on it:

https://github.com/arduino-libraries/ArduinoBLE/blob/dff9e414abc20df491b46d0b38b360eb1a3507fb/examples/Peripheral/EncryptedBatteryMonitor/EncryptedBatteryMonitor.ino#L38-L39

I've also seen in the source code that it is possible to have other option for it. https://github.com/arduino-libraries/ArduinoBLE/blob/dff9e414abc20df491b46d0b38b360eb1a3507fb/src/BLEProperty.h#L25-L43

There is also the enum BLE_GATT_PERM_ { (which I don't understand the usage)


So to go back to the example, I don't understand how the callback function for the pairing works. There are functions declared between line 58 and 151 named callbacks, and key management. I don't understand how to use them, and where to declare them.

In the function setEventHandler, the only handler available are the connect and disconnect.

When I try to use this example, every time I try to pair a device to the example running, I got an error, and no evidence of the callback function called, nothing prints on the Serial port.

Can you help me with this please ? To understand how to use the different callback pairing functions, and the different parameters available and the purpose of the different existing enum and all the things I wonder into this field.

Is there documentation about how to use this feature ?

Is there another existing library usable to use secure pairing between two elements ?

Additional context

Additional reports

  • https://github.com/arduino-libraries/ArduinoBLE/issues/295#issuecomment-1718123108

maximouth avatar Mar 28 '23 10:03 maximouth

Hello, Have you managed to use pairing with pass key? Thanks

IDC44 avatar Apr 09 '23 23:04 IDC44

Hello,

No I gave up using the arduino library for that.. like other peope before me with the no responses we get. I've moved to the nrf library. As it's a NRF52840 used into the nano 33 BLE board it's good. https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/boards/arm/arduino_nano_33_ble/doc/index.html

It's a little more complicated to use than the arduino library, but at least it's working. I can pair with a pass key two BLE boards/phone/object...

But if there is an existing solution and a documentation about how to use the arduino library for secure BLE communication I'm up too :)

maximouth avatar Apr 12 '23 12:04 maximouth

Ping, any updates?

secretshardul avatar Sep 13 '23 18:09 secretshardul