Device Manager Query?

I have been reading device manager of SDK10.0 for nrf51822. I looked at dm_ble_evt_handler and whole device manager source code but i didn't found where keys like IRK, LTK are passed.

My goal is to write my own device manager. I need access to LTK, IRK so that my own persistent storage can store it.

Please help me.


I have posted some part of the code of the function dm_ble_evt_handler. The part of the code is executed when BLE_GAP_EVT_SEC_PARAMS_REQUEST event is generated.

 ble_gap_sec_keyset_t keys_exchanged;

DM_LOG("[DM]: 0x%02X, 0x%02X, 0x%02X, 0x%02X\r\n",

keys_exchanged.keys_central.p_enc_key  = NULL;
keys_exchanged.keys_central.p_id_key   = &m_peer_table[m_connection_table[index].bonded_dev_id].peer_id; 
keys_exchanged.keys_central.p_sign_key = NULL;
keys_exchanged.keys_periph.p_enc_key   = &m_bond_table[index].peer_enc_key;
keys_exchanged.keys_periph.p_id_key    = NULL;
keys_exchanged.keys_periph.p_sign_key  = NULL;

As it can be seen in the section of the code, the key is being passed from the device manager in a call to a function:

 err_code = sd_ble_gap_sec_params_reply(p_ble_evt->evt.gap_evt.conn_handle,

But I can't found the section of code where this keys are being received/generated (or first received)? Which function should be called on what event to get the keys of LTK and IRK?