I have a very simple circuit which includes a HM-10 that exposes a CC2541 Bluetooth device.
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
- is the data (sent from iOS device to Arduino via Bluetooth) automatically encrypted via BLE?
- Can you offer any way to prove one way or another if the data is
encrypted? Some kind of sniffing software to test with? - Is there some property I need to set on the CBPeripheral to encrypt
the data? - 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;
char c = ' ';
boolean NL = true;
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()) {
c = Serial.read();
if (c!=10 & c!=13){
BT_Serial.write(c);
}
if (NL) {Serial.print("\r\n"); NL = false;}
Serial.write(c);
if (c==10){NL = true;}
}
}
Best Answer
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.
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) :
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](https://i.stack.imgur.com/1kMWw.png)
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.