androidraspberry-pibluetoothbluetooth-lowenergyandroid-ble

Can I have an encrypted BLE connection without bonding? / Pairing BLE devices without bonding


So far I am able to do things two different ways.

I can advertise a service on the Pi, connect from an Android app, and read/write characteristics. From my understanding, this communication is not encrypted.

I have been able to do the same thing adding pairing and bonding to the mix. I advertise a service on the Pi with an agent, connect from an Android app, and as soon as I try to read/write a characteristic I get a prompt on my phone asking to pair. From my understanding, after pairing is succesful the communication is encrypted.

That last part is great. However, I am looking to pair without bonding, mainly because I don't want to end up with a huge list of devices on my bluetooth settings. Android seems to use this term interchangeably, which just makes everything more confusing.

I know it's possible to do it as per this video. I just haven't figured out how to actually do it myself.

Any help is appreciated.


Solution

  • This is totally possible according to the Bluetooth protocol specification. If at least one device sets "bonding flags" to "no bonding" in the AuthReq field of the Pairing Request or Pairing Response, no bonding information shall be permanently stored.

    If you're using BlueZ, I'm not sure if it allows you to configure this though.

    For Android, people report that Android does not respect this flag and creates a bond anyway (Why does Android bond even when asked not to bond?).