Hi Guys,
I am trying to enable LESC Encryption, but I do not understand how to generate keys_own.p_pk and DH keys.
The sequence is the following:
1. I receive BLE_GAP_EVT_SEC_PARAMS_REQUEST with following parameters:
bond = 1, mitm =1, lesc =1, keypress = 0, io_caps = 3, oob = 0, min_key_size = 0, max_ley_size = 16
kdist_own = {
ecn =1, id = 1, sign = 1, link = 0
}
kdist_peer = {
ecn =1, id = 1, sign = 1, link = 0
}
2. I reply with the following params: sd_ble_gap_sec_params_reply(adapter, m_connection_handle, BLE_GAP_SEC_STATUS_SUCCESS, p_sec_params, keyset),
where auto p_sec_params = new ble_gap_sec_params_t();
memset(p_sec_params, 0, sizeof(ble_gap_sec_params_t));
p_sec_params->bond = 1;
p_sec_params->io_caps = BLE_GAP_IO_CAPS_NONE;
p_sec_params->mitm = 1;
p_sec_params->oob = 0;
p_sec_params->lesc = 1;
p_sec_params->max_key_size = 16;
p_sec_params->min_key_size = 7;
p_sec_params->kdist_own.enc = 1;
p_sec_params->kdist_own.id = 0;
p_sec_params->kdist_own.link = 0;
p_sec_params->kdist_own.sign = 0;
p_sec_params->kdist_peer.enc = 1;
p_sec_params->kdist_peer.id = 0;
p_sec_params->kdist_peer.link = 0;
p_sec_params->kdist_peer.sign = 0;
and auto keyset = new ble_gap_sec_keyset_t();
with allocated memories for all keys including p_enc_key, p_id_key, p_sign_key and so on.
Do I need to set keys_own.p_pk? Where I can get this key?
3. 1. I receive BLE_GAP_EVT_LESC_DHKEY_REQUEST with following parameters:
oobd_req = 0 and generated Public Key
Where I can get the DH key to reply in sd_ble_gap_lesc_dhkey_reply?
I will be grateful for any information about key generation. Maybe there is a library that can do this? If so, where can it be found?
Additional information:
SoftDevice: S140 6.1.1