2
\$\begingroup\$

I have a very simple circuit which includes a HM-10 that exposes a CC2541 Bluetooth device.

schematic

simulate this circuit – Schematic created using CircuitLab

It's basically just hooked up to power it off the Arduino Nano and then I have a voltage divider on the HM-10 Rx since it is 3.3V. There are no problems there. It works and I can send data and receive data.

I'm running some iOS code that does not bond itself to the device, but instead lets the user tap a button and send data via the FFE1 characteristic.

The data is sent using the CoreBluetooth writeValue function of the CBPeriperhal class. It is sent as a stream of bytes.

Questions

  1. is the data (sent from iOS device to Arduino via Bluetooth) automatically encrypted via BLE?
  2. Can you offer any way to prove one way or another if the data is encrypted? Some kind of sniffing software to test with?
  3. Is there some property I need to set on the CBPeripheral to encrypt the data?
  4. Is data only automatically encrypted after bonding the devices?

Extras

Here's the very basic Arduino code that works great and displays the bytes sent over Bluetooth (from my iPad running my iOS code).

#include <SoftwareSerial.h>

SoftwareSerial BT_Serial(8,9); // RX, TX

bool bytesWereRead = false;
void setup() {
  Serial.begin(9600);
  Serial.println("Enter AT commands:");
  BT_Serial.begin(9600);
}

void loop()
{
  if (BT_Serial.available()) {
    bytesWereRead = true;
    int bytesRead = Serial.write(BT_Serial.read());
  }

  if (Serial.available()) {
    BT_Serial.write(Serial.read());
  }
}
\$\endgroup\$
3
\$\begingroup\$

I found one sentence as part of another answer that seems to indicate that writing data to a characteristic before being bonded means that the data is not encrypted.

"You will not have encrypted characteristic read/write without bonding."*

That wasn't quite definitive however.

Then I finally found the following (at https://www.silabs.com/community/wireless/bluetooth/knowledge-base.entry.html/2015/08/06/_reference_bonding-lnVL) :

In classic Bluetooth (v2.0, v2.1, v3.0), you have to pair with a device before you can connect with it, and then you have to connect with it before you can communicate with it. During pairing, link security keys are generated and stored on each module so that they can communicate with each other again in the future if desired without needing to pair again.

With Bluetooth Smart [aka BLE], however, it quite common to connect and communicate without pairing. You can even send a small amount of user definable data to any listening devices without any connection at all via advertisement packets, somewhat like a super-charged custom INQUIRY response. However, if you connect without pairing, then the connection is not secure, because there are no link security keys that may be used to encrypt the connection.

That's very good info since it compares everything to Bluetooth 2, 2.1., 3 since I know they do force you to pair and then all data transmitted is encrypted and I was wondering about the comparison to BLE.

I also found documentation for the cc2541 via TI(Texas Instruments) which contains the following table and steps for insuring security (my highlights): security details

This all seems to support the fact that data is only encrypted after pairing.

In my case / question I was asking if the data is encrypted even though I am not pairing so I believe this helps create a definitive answer that the data I'm sending that way is not encrypted via BLE.

Also the additional steps that define the "general process to establish security" lead me to the same conclusion -- that encryption is only done when devices are paired.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.