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

Pairing & Bonding issue with concurrent peripheral + central app

Hi

I am developing a concurrent central + peripheral application, in which central application connects to other external peripheral side, which uses static passkey ,pairing ,bonding and its working fine . The security parameters for peripheral and central+ peripheral side have attached below.

 I am able to connect the peripheral side with the External central(NRF Connect APP).I would like to know Is it possible to achieve the bonding without pairing here using the same parameters which I have been used already for the other side using peer manager?.

Here is the security parameters for the peripheral side

#define SEC_PARAM_BOND                      1                                       /**< Perform bonding. */
#define SEC_PARAM_MITM                      1                                       /**< Man In The Middle protection not required. */
#define SEC_PARAM_LESC                      0                                       /**< LE Secure Connections enabled. */
#define SEC_PARAM_KEYPRESS                  0                                       /**< Keypress notifications not enabled. */
#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. */

Here is the security parameters for the central + peripheral side

#define SEC_PARAM_BOND                  1                                           /**< Perform bonding. */
#define SEC_PARAM_MITM                  1                                           /**< Man In The Middle protection not required. */
#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_KEYBOARD_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 in octets. */
#define SEC_PARAM_MAX_KEY_SIZE          16                                          /**< Maximum encryption key size in octets. */
#define SCAN_DURATION_WITELIST          0     

Here is my peer manager initialization

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

    err_code = pm_init();
    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
  • Hi,

    I would like to know Is it possible to achieve the bonding without pairing here using the same parameters which I have been used already for the other side using peer manager?.

    The peer manager (PM) doesn't support that because PM initiates pairing first, encrypts the link, then bonds (could be optional).

    -Amanda H.

  • Hi

    Thanks for the response.

    Is there any other way to achieve this?

    I want to do the bonding and pairing in concurrent central side with external peripheral(Already done using peer manager) and bonding only with the concurrent peripheral side with external central(like NRF connect ).

  • Hi, 

    I think it should also work in the peripheral. Do you see any issues?  

    -Amanda H.
     
  • Hi 

    Thanks for the response.

    We have 3 devices 

    1) Simultaneous Central + Peripheral  side  name it  as "Device A"

    2)External Peripheral side name it as  "Device B"

    3)External Central Side name it  as "Device C"(like NRF connect APP)

    Yes, When I tried the pairing and static passkey implementation with Device A and Device C .It just displays the  pass key, I can't enter the passkey.( parameters attached below) 

    But for the static passkey implementation with Device A and Device B, I Used the below parameters  and its working fine.

    So how to achieve the bonding , pairing and static passkey implementation with the Device A and Device C using  the same parameters (Attached below) ?

    For the Device A

    #define SEC_PARAM_BOND                  1                                           /**< Perform bonding. */
    #define SEC_PARAM_MITM                  1                                           /**< Man In The Middle protection not required. */
    #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_KEYBOARD_DISPLAY                       /**< 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 in octets. */
    #define SEC_PARAM_MAX_KEY_SIZE          16                                          /**< Maximum encryption key size in octets. */
    #define SCAN_DURATION_WITELIST          0  

    For the Device B

    #define SEC_PARAM_BOND                      1                                       /**< Perform bonding. */
    #define SEC_PARAM_MITM                      1                                       /**< Man In The Middle protection not required. */
    #define SEC_PARAM_LESC                      0                                       /**< LE Secure Connections enabled. */
    #define SEC_PARAM_KEYPRESS                  0                                       /**< Keypress notifications not enabled. */
    #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   

  • Hi, 

    Try to set BLE_GAP_IO_CAPS_DISPLAY_YESNO for For the Device A.

    #define SEC_PARAMS_IO_CAPABILITIES   BLE_GAP_IO_CAPS_DISPLAY_YESNO

    -Amanda H.

  • Hi,

    Thanks for the response.

    When I tried the " #define SEC_PARAMS_IO_CAPABILITIES   BLE_GAP_IO_CAPS_DISPLAY_YESNO"

    the pairing between the Device A and Device C works, but the pairing between the Device A and Device B failed, because I didn't get the BLE_GAP_EVT_AUTH_KEY_REQUEST in Device A.

  • Hi, 

    Seems BLE_GAP_IO_CAPS_KEYBOARD_ONLY or BLE_GAP_IO_CAPS_KEYBOARD_DISPLAY can get the BLE_GAP_EVT_AUTH_KEY_REQUEST event. See this Passkey Entry with static passkey MSC. Then static passkey cannot use the same security parameter for SEC_PARAMS_IO_CAPABILITIES on multirole. If you want to use the same security parameters on multirole, you could take a look at this LE Secure Connections Multirole Example

    -Amanda H.

Reply Children
No Data
Related