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

Correct set of security parameters to pair without bonding

I am using ble_app_gls on SDK_11 s130 on nRF51-dk.

This is a follow-up question to the question below.

devzone.nordicsemi.com/.../

After enabling debugging, I discovered that the software encounters an error at pm_sec_params_set(&sec_param); This happens if I set SEC_PARAM_BOND to 0 because I want to do pairing without bonding. What should be the correct set of security parameters if I want to set SEC_PARAM_BOND to 0 without causing error at pm_sec_params_set()?

//#define SEC_PARAM_BOND                 1        /**< Perform bonding. */
#define SEC_PARAM_BOND               0     /**< No bonding. */
#define SEC_PARAM_MITM                 1         /**< Man In The Middle protection required (applicable when display module is detected). */
#define SEC_PARAM_LESC                 0          /**< LE Secure Connections not enabled. */
#define SEC_PARAM_KEYPRESS             0      /**< Keypress notifications not enabled. */
#define SEC_PARAM_IO_CAPABILITIES      BLE_GAP_IO_CAPS_DISPLAY_ONLY /**< Display 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   

static void peer_manager_init(bool erase_bonds) {
    ble_gap_sec_params_t sec_param;
    ret_code_t err_code;

    err_code = pm_init();
    APP_ERROR_CHECK(err_code);

    if (erase_bonds)
    {
        err_code = pm_peers_delete();
        APP_ERROR_CHECK(err_code);
    }

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

    // Security parameters to be used for all security procedures.
    sec_param.bond              = SEC_PARAM_BOND;
    sec_param.mitm              = SEC_PARAM_MITM;
    sec_param.lesc              = SEC_PARAM_LESC;
    sec_param.keypress          = SEC_PARAM_KEYPRESS;
    sec_param.io_caps           = SEC_PARAM_IO_CAPABILITIES;
    sec_param.oob               = SEC_PARAM_OOB;
    sec_param.min_key_size      = SEC_PARAM_MIN_KEY_SIZE;
    sec_param.max_key_size      = SEC_PARAM_MAX_KEY_SIZE;
    sec_param.kdist_own.enc     = 1;
    sec_param.kdist_own.id      = 1;
    sec_param.kdist_peer.enc    = 1;
    sec_param.kdist_peer.id     = 1;

    err_code = pm_sec_params_set(&sec_param);
    APP_ERROR_CHECK(err_code);

    err_code = pm_register(pm_evt_handler);
    APP_ERROR_CHECK(err_code); }
Parents Reply Children
No Data
Related