Sample code for encryption of BLE advertisement (beacon) for secure beacon information

Hi,

I started working on nRF52 series SoCs and have a requirement to develop a BLE Beacon device that information should be understandable to our central device only. So, we want to implement encryption method on beacon side and decryption method on central device.

Please help with the sample code for encryption of the BLE advertising data. Thanks.

  • Hello,

    The data in your advertising will by nature be available to everyone in the vicinity, but you may choose to obfuscate / encrypt this data before you advertise it in any way you would like.
    There is no innate support for encryption of the advertising packets in the BLE specification, but you may just encrypt the advertised data in any way you would like prior to advertising it.
    If you intend for the data to be available to a single central, with a specialized key (i.e no global key/scheme for all your devices) you must should instead initiate a connection to establish this encryption (either by exchanging keys so that future advertisements are decryptable, or by communicating with the encryption offered in the connection).

    You could experiment with this by setting up a Beacon application and encrypting the data in the manufacturer specific datafield with an encryption method of your choice, and then decrypting this data on your central device according to the selected encryption method.

    Best regards,
    Karl

Related