This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to disable the bond and pair?

Hi: Recently, I use the SDK --- "nRF51_SDK_8.1.0", the project is \Nordic\nRF51_SDK_8.1.0_b6ed55f\examples\ble_central, I modified the project to notify the data periodically,and it work well. but when I use sniffer to observe the communication process. I see the data of the notification is "Decrypted", So I want to disable the bond and pair, but don't know how to do it?? I set the define SEC_PARAM_BOND to "0", but it still decrypted, please tell me how to do it, thanks a lot. By the way, in this project, I do not know how this project to do the bond and pair, and I do not find the passkey, and do not know the process of bond and pair. Is the central or the peripheral erupt the bond and pair??

thanks a lot

  • ble_central is just a folder not an example. What example are you using on the central side? What example are you using on the peripheral side? SEC_PARAM_BOND 0 just disables bonding, not pairing. It is with pairing the link gets encrypted, bonding is just saving the encryption keys for later connections.

  • hi petter: Thanks a lot! The example is ...\nRF51_SDK_8.1.0_b6ed55f\examples\ble_central\ble_app_multilink_central and ...\nRF51_SDK_8.1.0_b6ed55f\examples\ble_central\ble_app_multilink_peripheral. I still have some question: 1. In this example, where can I find the passkey?? I can't find the encryption key. 2. How can I disable the link to be encrypted?? I do not need the link to be encrypted. 3. I do not know how this project to do the bond and pair, and I do not find the passkey, and do not know the process of bond and pair. Is the central or the peripheral erupt the bond and pair??

    best regards! Thanks a lot!
    
  • Pairing is the process of creating one or more shared secret keys.

    Bonding is the act of storing the keys created during pairing for use in subsequent connection in order to form a trusted pair.

    If you disable bonding, pairing is still done, i.e. the link gets encrypted.

    The peripheral has a GATT server with a characteristic value and a CCCD that requires the link to be encrypted for them to be written to. In services_init(), please change:

    BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&attr_md.write_perm); to
    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm); and
    BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&cccd_md.write_perm); to
    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.write_perm);
    

    The central has a GATT client that will receive BLE_GATT_STATUS_ATTERR_INSUF_AUTHENTICATION or BLE_GATT_STATUS_ATTERR_INSUF_ENCRYPTION if it tries to write to an attribute (the characteristic value and the CCCD are attributes) that requires encryption for it to be written to. Please see the BLE_GATTC_EVT_WRITE_RSP case in client_handling_ble_evt_handler(). If one of these are received, it will call dm_security_setup_req() which will call initiate_security_request(), which will call sd_ble_gap_authenticate(). sd_ble_gap_authenticate() will initate the pairing process.

    For you it should be suffient to only make the changes in the peripheral to "disable pairing", but I added the central part as well.

  • hi peter: thanks a lot! I have try your suggestion, and it works. but I still have one question. where is the passkey? where can I find the passkey? and how can I change the passkey from central?? Is there any example that have realize the function?? I can not find it in the sdk.

    best regards!

  • Why do you need a passkey if you don't need encrpytion? Passkey is used in the pairing process. Do you plan to have devices that have a display or keyboard so you can display or input a passkey? If not you could use static passkey, please see this question.

Related