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

how to handle BLE_GAP_EVT_SEC_INFO_REQUEST?

after setting BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM, I getting BLE_GAP_EVT_SEC_INFO_REQUEST event, I am using same code as the sample: case BLE_GAP_EVT_SEC_INFO_REQUEST: p_enc_info = &m_auth_status.periph_keys.enc_info; if (p_enc_info->div == p_ble_evt->evt.gap_evt.params.sec_info_request.div) { err_code = sd_ble_gap_sec_info_reply(m_conn_handle, p_enc_info, NULL); APP_ERROR_CHECK(err_code); } else { // No keys found for this device err_code = sd_ble_gap_sec_info_reply(m_conn_handle, NULL, NULL); APP_ERROR_CHECK(err_code); } break;

it hits err_code = sd_ble_gap_sec_info_reply(m_conn_handle, NULL, NULL); the error code is NRF_ERROR_INVALID_STATE

should I set the key somewhere? or system generates key just like https? what went wrong in my case?

Related