NimBLE-Arduino icon indicating copy to clipboard operation
NimBLE-Arduino copied to clipboard

PIN code on connection

Open marco95thb opened this issue 2 years ago • 1 comments
trafficstars

Hi, I added the PIN protection to a single characteristic thanks to the issue https://github.com/h2zero/NimBLE-Arduino/issues/158 but I want to protect with PIN the entire connection. Now I'm connecting with BLE scanner, and when I try to read the app is asking me for the password. What I want to achieve is that the APP asks me for password when I try to connect. How can I implement the PIN code onConnection and not on characteristic reading?

Thanks, Marco

marco95thb avatar May 16 '23 14:05 marco95thb

You can't. This is just how BLE works. A non encrypted characteristic will not request pin. Only way to pair/bond is to request to read/write an encrypted characteristic.

I think what you really want is not that, rather whitelisting. But I have found that certain devices are ridiculously buggy with regards to that.

sanastasiou avatar Jun 07 '23 17:06 sanastasiou

This can be done by calling NimBLEDevice::startSecurity in the onConnect callback.

h2zero avatar Jun 04 '24 17:06 h2zero