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

encryption problem

How to make an encryption on nRF51822? Does it need to set

 sd_ble_gap_sec_params_reply(m_conn_handle, BLE_GAP_SEC_STATUS_SUCCESS, &m_sec_params, &sec_keyset) 

the forth parameter in this function ? what's the value for this parameter?

Thanks for your kindly reply. Best Regards

Parents
  • Do you want to pair or bond?

    This is normally an output, so:

    If you want pair you can set the value to NULL.

    If you want to bond you need to provide a pointer to a ble_gap_sec_keyset_t security keyset structure. Any keys distributed as a result of the ongoing security procedure will be stored into the memory referenced by the pointers inside this structure. The keys will be stored and available to the application upon reception of a BLE_GAP_EVT_AUTH_STATUS event.

  • Hi Darrew,

    sd_ble_gap_sec_params_reply() is used on both sides, central and peripheral. p_sec_keyset is provided to the softdevice, so that the softdevice can send the encryption key (LTK, not STK) and id data back to the application.

    1. STK will be generated depends on the pairing method used, Justwork, passkey or OOB. And it's the softdevice generates it but based on the information provided by the application , for example passkey or OOB data.

    2. If you are talking about Legacy pairing then it's correct. It's the softdevice taking care of it. On LE secure connection, the application is in charge of generating the DHKey.

    3. Correct. The application call sd_ble_gap_sec_params_reply() and wait for the BLE_GAP_EVT_AUTH_STATUS event to store the key into flash for future use. Have a look here.

    4. Yes, it's correct.

Reply
  • Hi Darrew,

    sd_ble_gap_sec_params_reply() is used on both sides, central and peripheral. p_sec_keyset is provided to the softdevice, so that the softdevice can send the encryption key (LTK, not STK) and id data back to the application.

    1. STK will be generated depends on the pairing method used, Justwork, passkey or OOB. And it's the softdevice generates it but based on the information provided by the application , for example passkey or OOB data.

    2. If you are talking about Legacy pairing then it's correct. It's the softdevice taking care of it. On LE secure connection, the application is in charge of generating the DHKey.

    3. Correct. The application call sd_ble_gap_sec_params_reply() and wait for the BLE_GAP_EVT_AUTH_STATUS event to store the key into flash for future use. Have a look here.

    4. Yes, it's correct.

Children
No Data
Related