Understanding BLE Bonding & Whitelists

  • SDK: 15.2
  • SoftDevice: s140_nrf52_6.1.0
  • FreeRTOS
  • Hardware: nRF52840 (Custom boards)

Hello,

I am having difficulty finding clear and concise information regarding BLE bonding, even on YouTube. I am hoping someone can help me answer some questions. My high-level understanding is that bonding just saves the keys exchanged during the pairing process so that the pairing process doesn't need to occur each time the devices reconnect.

  1. Can you limit the number of Central devices that can bond with a Peripheral? Ideally, I am looking to bond at most 2 Centrals to 1 Peripheral.
  2. Can you enable bonding only on specific links or from specific devices? Ie, if we have Central1, Central2, and Peripheral1, can the link between Central1 and Peripheral1 be bonded, while the link between Central2 and Peripheral1 not be bonded?
  3. Can you enable bonding for only certain BLE services or characteristics, but not all?
  4. Once a Peripheral is bonded to a Central, and the maximum number of bonds have been reached (but bonded devices may not currently be connected), will the Peripheral automatically block connection requests from non-bonded devices, or does a whitelist need to be used?
  5. Once two devices are bonded, but are disconnected, does the Peripheral still send discoverable advertising packets to allow a bonded Central to reconnect? If not, what does the connection process look like for bonded devices?
  6. From the Peripheral side, can you clear bonds for specific devices only, or are you required to clear all bonds?
  7. Do the encryption keys generated during the pairing process ever expire once bonded? Can the same keys be used for the life of the product?

If you have any documentation that covers the topics above in more detail, please feel free to link those here!

Thanks!

Derek

  • From what I have read, most phones periodically change their MAC address. So if I were to use a whitelist and directed advertising on the Nordic MCU with a known phone BLE MAC, this wouldn't work due to the rotating MAC's, correct?

    Is it possible to use and define a static private IRK (Identity Resolving Key) on the nRF52840 and custom phone application to mitigate this and not have to use native BLE pairing/bonding?

    Thanks,

    Derek

  • Hi Derek, 

    droberson said:
    From what I have read, most phones periodically change their MAC address. So if I were to use a whitelist and directed advertising on the Nordic MCU with a known phone BLE MAC, this wouldn't work due to the rotating MAC's, correct?

    Yes correct. That why I mentioned that in many case you need to have the IRK exchanged. 

    droberson said:
    Is it possible to use and define a static private IRK (Identity Resolving Key) on the nRF52840 and custom phone application to mitigate this and not have to use native BLE pairing/bonding?

    I don't really get this. Could you please give more information on what you want to achieve ? a description on how your device work with the phone would be nice.

    Note that the app on the phone can't control the address of the phone. It's handled by the operating system. 

  • Hey Hung,

    I think you answered my question. I was hoping that I could connect a phone to my nRF52840 MCU without pairing / bonding and still use a whitelist and directed advertising on the nRF52840.

    Is pairing the only way to exchange an IRK between the phone and nRF52840? Or can it be written to each device OOB (Out of band) somehow?

    Edit:

    Looks like an IRK can be pre-shared: devzone.nordicsemi.com/.../directed-advertising-with-pre-shared-irk

    Maybe a better question is, can BLE pairing be done with a static pre-shared long term key (128-bit) that is written to MCU flash during manufacturing? I am trying to understand how to secure a BLE connection to a Peripheral device that has no user input and therefore has no way to clear bonds. The only way I know to secure such a device is to have a pre-shared static key. Is there a better way?

    Thanks,

    Derek

  • Hi Derek, 

    If you have control over both side of the connection (for example connection between two nRF52s, not with a phone) then it's possible to do pre-shared LTK or pre-shared IRK. However, I assume in your case you are connecting to a phone ? In that case the Operating System has control over pairing and addressing. So it's not possible to do pre-shared key. 

    If you have NFC it should be possible to do OOB pairing with a phone. Otherwise you may need to think about doing your own encryption.

    Either by doing application encryption on top of an open BLE connection, or you can think of doing encryption over advertising packet, and in that advertising packet you send the passkey you will use when doing normal BLE pairing in the next step. This way you can do a secure bonding without having display or keyboard. Of course the challenge is that you would need to have a common key between the device and the app on the phone (can be done using a serial number and the key on the cloud matches with the serial number).

  • Hey Hung,

    My nRF52840 device supports connections from a phone and other nRF52840's.... So it looks like I have 2 options:

    1. Implement my own AES encryption using an 'open' BLE connection.

    2. Use native BLE pairing with a pre-shared key which will manage the AES encryption stuff for me. This would work for the nRF52840 links, but not the phone link. I may have a workaround for the phone but I will omit this for now as it will overcomplicate things as the system I am working on is complex.

    Not sure I understand the benefit of "think of doing encryption over advertising packet, and in that advertising packet you send the passkey you will use when doing normal BLE pairing in the next step" or how this is secure?

    With the answers to the questions below, hopefully I can figure out the rest.

    Questions:

    1. If I were to do my own encryption over an open BLE link, are there any examples that I could reference?

    I see the AES examples in the SDK, but they require the use of a nonce or initialization vector and MAC. Managing these on my own seems problematic. I am a novice when it comes to security.

    2. Are there any Nordic examples of using a pre-shared static 128-bit key with native BLE pairing? This could be BLE legacy (Using 128-bit TK) or LESC (Using 128-bit LTK).

    3. Does using native BLE security increase the BLE packet size since a MAC (MIC) field is appended?

    https://infocenter.nordicsemi.com/topic/ps_nrf52840/ccm.html?cp=5_0_0_5_3

    My apologies for so many questions. Like I said before I am a novice when it comes to security and the system I am working on is complex.

    Thanks,

    Derek

Related