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

  • This code is used in the BLE event handler from the BLE dispatch to get the passkey:

    static void ble_evt_dispatch(ble_evt_t * p_ble_evt)

    {    on_ble_evt(p_ble_evt);

    ... then in the above event handler:

    static void on_ble_evt(ble_evt_t * p_ble_evt)

        switch (p_ble_evt->header.evt_id)
        {

            case BLE_GAP_EVT_PASSKEY_DISPLAY:
            {
                NRF_LOG_INFO("event recd: BLE_GAP_EVT_PASSKEY_DISPLAY\r\n");
                char passkey[PASSKEY_LENGTH+1];
                memcpy(passkey,p_ble_evt->evt.gap_evt.params.passkey_display.passkey,PASSKEY_LENGTH);
                passkey[PASSKEY_LENGTH] = 0;
                // Don't send delayed Security Request if security procedure is already in progress.
                err_code = app_timer_stop(m_sec_req_timer_id);
                APP_ERROR_CHECK(err_code);

                //APP_LOG("Passkey: %s\r\n",passkey);
               //orig: NRF_LOG_INFO(0,"Passkey: '%s'",passkey);
                NRF_LOG_INFO("Passkey: %s\r\n", nrf_log_push(passkey));

            }break;//BLE_GAP_EVT_PASSKEY_DISPLAY

    Hope this helps !

    Donzo

  • If you do not want encryption, then use SSP, found here:

    http://www.fte.com/docs/ssp.pdf

    It says this:

    Simple Pairing Debug Mode
    Simple Pairing Debug Mode uses a different Link Key for encryption
    than is used during
    normal operation. As a component of the
    Host Controller for any 2.1 compliant
    Bluetooth
    device, Simple Pairing Debug Mode can be
    turned on so engineers can analyze
    Bluetooth
    data. Once the analysis is complete, Debug Mode can be switched off so that further
    communication between the devices cannot be
    compromised. The main point here to
    remember is that a different Link Key is
    used when in Simple Pairing Debug Mode,
    thereby maintaining the enhan
    ced 2.1 security process.
    As an additional security feature, the Li
    nk Key generated during debug mode is clearly
    identified as having been created during
    the debug process. This allows the
    Bluetooth
    Host
    to recognize that the current Link Key is not
    secure. The Host can
    choose to initiate the
    pairing process again, which results
    in the generation of a new Link Key.
Related