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

MITM Bond Failure Android 5.0 and nrf51822

I am working on a custom service using and nrf51822 device. SDK7.1 SD7.1

My security parameters are as follows:

#define SEC_PARAM_TIMEOUT                    30                                         /**< Timeout for Pairing Request or Security Request (in seconds). */
#define SEC_PARAM_BOND                       1                                          /**< Perform bonding. */
#define SEC_PARAM_MITM                       1                                          /**< Man In The Middle protection required. */
#define SEC_PARAM_IO_CAPABILITIES            BLE_GAP_IO_CAPS_DISPLAY_ONLY               /**< No I/O capabilities. */
#define SEC_PARAM_OOB                        0                                          /**< Out Of Band data not available. */
#define SEC_PARAM_MIN_KEY_SIZE               7                                          /**< Minimum encryption key size. */
#define SEC_PARAM_MAX_KEY_SIZE               16                                         /**< Maximum encryption key size. */

My initialization is as follows:

void device_manager_init(void) { uint32_t err_code; dm_init_param_t init_data; dm_application_param_t register_param;

// Initialize persistent storage module.
err_code = pstorage_init();
APP_ERROR_CHECK(err_code);

err_code = dm_init(&init_data);
APP_ERROR_CHECK(err_code);

memset(&register_param.sec_param, 0, sizeof(ble_gap_sec_params_t));

register_param.sec_param.timeout      = SEC_PARAM_TIMEOUT;
register_param.sec_param.bond         = SEC_PARAM_BOND;
register_param.sec_param.mitm         = SEC_PARAM_MITM;
register_param.sec_param.io_caps      = SEC_PARAM_IO_CAPABILITIES;
register_param.sec_param.oob          = SEC_PARAM_OOB;
register_param.sec_param.min_key_size = SEC_PARAM_MIN_KEY_SIZE;
register_param.sec_param.max_key_size = SEC_PARAM_MAX_KEY_SIZE;
register_param.evt_handler            = device_manager_evt_handler;
register_param.service_type           = DM_PROTOCOL_CNTXT_GATT_SRVR_ID;

err_code = dm_register(&m_app_handle, &register_param);
APP_ERROR_CHECK(err_code);

}

While using the windows x64 MCP I request a bond and a dialog box pops up and I type in the corresponding passkey. The bond is successfully made and all characteristics are able to be accessed.

However, while using android when I request a bond no dialog box shows up. My assumption is that android thinks a "just works" bond needs to be performed. The results is an insufficient bond. As a result I am unable to access characteristics requiring MITM security.

Parents Reply Children
  • @Petter Is this issue still there?

    I am getting the following error in nRF Toolbox (UART) app

    image description

    My settings are the following

    #define SEC_PARAM_BOND                  0                                           /**< Perform bonding. */
    #define SEC_PARAM_MITM                  1                                           /**< Man In The Middle protection not required. */
    // #define SEC_PARAM_IO_CAPABILITIES       BLE_GAP_IO_CAPS_DISPLAY_ONLY                        /**< No I/O capabilities. */
    #define SEC_PARAM_IO_CAPABILITIES       BLE_GAP_IO_CAPS_DISPLAY_YESNO                        /**< No I/O capabilities. */
    #define SEC_PARAM_OOB                   0                                           /**< Out Of Band data not available. */
    #define SEC_PARAM_MIN_KEY_SIZE          7                                           /**< Minimum encryption key size. */
    #define SEC_PARAM_MAX_KEY_SIZE          16                                          /**< Maximum encryption key size. */
    
    #define START_STRING                    "Start...\n"                                /**< The string that will be sent over the UART when the application starts. */
    
    #define PASSKEY_TXT                     "Passkey:"                                  /**< Message to be displayed together with the pass-key. */
    #define PASSKEY_TXT_LENGTH              8                                           /**< Length of message to be displayed together with the pass-key. */
    #define PASSKEY_LENGTH                  6                                           /**< Length of pass-key received by the stack for display. */
    #define STATIC_PASSKEY					"123456" 									/**< Static pin. */
    
Related