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

pc-ble-driver binding

Configuration
Serialized Bluetooth application.
Host:
Pc running Linux.
Host application:
    -Custom application linking pc-ble-driver from     github.com/.../pc-ble-driver
    -Implements a peripheral with 3 custom services. Only 1 service requires binding for access.

Ble connectivity chip:
nRF52832  running connectivity_2.0.1_115k2_with_s132_5.0.hex


Problem:I can not do binding. I was looking into the forum and could not find a usefull response to the problem or somebody that was able to do
the binding in this configuration.

When i try from the central to access the service that requires binding:
I get the event BLE_GAP_EVT_SEC_PARAMS_REQUEST, with the following parameters (connection handle, peer security parameters):
BLE_GAP_EVT_SEC_PARAMS_REQUEST:handle[0]current[0]
BLE_GAP_EVT_SEC_PARAMS_REQUEST:request sec params
-bond[1],io_caps[4],keypress[0],lesc[1],max_key_size[16],min_key_size[0],mitm[1],oob[0]
-kdist own enc[1]id[1]link[0]sign[0], peer enc[1]id[1]link[0]sign[0]

Accrding with "Gap peripheral Bonding: Passkey entry, Pripheral displays" i have to use the following function to reply:
    sd_ble_gap_sec_params_reply(adapter_t *adapter, uint16_t conn_handle, uint8_t sec_status, ble_gap_sec_params_t const *p_sec_params,             ble_gap_sec_keyset_t const *p_sec_keyset);
Looking in ble_gap_impl.cpp looks like the keyset will be copied into m_app_keys_table[index].keyset for future use


I can create  the first 4 parameters of the function with no problems as follows:
adapter_t *adapter, uint16_t conn_handle, uint8_t sec_status, ble_gap_sec_params_t const *p_sec_params

I do not know how to create ble_gap_sec_keyset_t const *p_sec_keyset

typedef struct
{
  ble_gap_sec_keys_t            keys_own;     /**< Keys distributed by the local device. For LE Secure Connections the encryption key will be generated locally and will always be stored if bonding. */
  ble_gap_sec_keys_t            keys_peer;    /**< Keys distributed by the remote device. For LE Secure Connections, p_enc_key must always be NULL. */
} ble_gap_sec_keyset_t;

1. Where i can get the keys the peer sent?
2. Is that a API to generate own keys?
3. Are the keys stored in the connectivity chip and are they "power cycle" safe?
4. Is the binding possible in the serialized Bluetooth architecture?

Parents
  • FormerMember
    0 FormerMember

    1. Where i can get the keys the peer sent?

    The parameters to provide to sd_ble_gap_sec_params_reply() is only struct's for where the keys will be stored. And it should not contain the keys. When passing them to sd_ble_gap_sec_params_reply(), the value can be '0'. The p_sec_keyset struct will contain the generated (and shared) key when the bonding process is finished, upon the event BLE_GAP_EVT_AUTH_STATUS(BLEEvtID.gap_evt_auth_status), see sd_ble_gap_sec_params_reply() documentation.


    2. Is that a API to generate own keys?

    Yes, the softdevice will generate the keys.


    3. Are the keys stored in the connectivity chip and are they "power cycle" safe?

    No, the keys are not stored in the connectivity chip. Storing of the keys is something that your application has to take care of.


    4. Is the binding possible in the serialized Bluetooth architecture?

    Yes, to my knowledge, it should be possible to use bonding, the API for doing so is there.

     

    It can also be useful to have a look at this tread regarding sd_ble_gap_sec_params_reply().

Reply
  • FormerMember
    0 FormerMember

    1. Where i can get the keys the peer sent?

    The parameters to provide to sd_ble_gap_sec_params_reply() is only struct's for where the keys will be stored. And it should not contain the keys. When passing them to sd_ble_gap_sec_params_reply(), the value can be '0'. The p_sec_keyset struct will contain the generated (and shared) key when the bonding process is finished, upon the event BLE_GAP_EVT_AUTH_STATUS(BLEEvtID.gap_evt_auth_status), see sd_ble_gap_sec_params_reply() documentation.


    2. Is that a API to generate own keys?

    Yes, the softdevice will generate the keys.


    3. Are the keys stored in the connectivity chip and are they "power cycle" safe?

    No, the keys are not stored in the connectivity chip. Storing of the keys is something that your application has to take care of.


    4. Is the binding possible in the serialized Bluetooth architecture?

    Yes, to my knowledge, it should be possible to use bonding, the API for doing so is there.

     

    It can also be useful to have a look at this tread regarding sd_ble_gap_sec_params_reply().

Children
No Data
Related