How to implement Rak4631 BLE security

Greetings, I wish to use BLE DFU example but need to ensure only authorized connections can upload new firmware. How can I implement a PIN so user must enter it before being allowed to pair with device and perform DFU?

Note
I am not worried about encrypting the connection. I simply need to ensure device only permits pairing with authorized phones.

Device does not have display screen so it can’t display randomly generated pin. I would need to set a pin manually within the firmware.

Thanks for any pointers.

Hi Ryan,

RUI3 or open source Arduino BSP?

For RUI3, have a look into the BLE API ==> setPin. Encryption is not implemented at the moment.

For open source Arduino, there is an example how to set the pairing pin in the BSP, look for Peripheral ==> pairing_pin.ino

1 Like

Wow, that was easy! For reference I’m using Arduino BSP and it is as simple as:

Bluefruit.Security.setPIN("123456"); before calling bleuart.begin();

See https://github.com/RAKWireless/RAK-nRF52-Arduino/blob/cc4b1bf417541ae4e4b8afb96b4f4e7ff438f355/libraries/Bluefruit52Lib/examples/Hardware/dfu_ota/dfu_ota.ino

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.