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

How to implement the passkey authentication?

Hi,

How to implement the passkey authentication, we are using nF51822 evaluation board. Is it possible to display the passkey using master control panel? And, we also don't know how the passkey authentication is working. If possible give some explanation on the same.

  • Bonding with passkey is shown in ble_app_gls in the SDK, so it might be useful to take a look on it.

    To modify an example not using passkey to do so, you have to change 3 things:

    1. Set MITM in ble_gap_sec_params_t to 1.
    2. Set IO capabilities in ble_gap_sec_params_t to something with either display or keyboard. Refer to table 2.4 in the Core Specification, Volume 3, Part H, section 2.3.5.1 for your possibilities.
    3. Depending on your choice in 2, either, a) if you have a keyboard: Reply to a BLE_GAP_EVT_AUTH_KEY_REQUEST with a call to sd_ble_gap_auth_key_reply(), supplying the key your user entered. b) if you have a display: Show the key contained in the BLE_GAP_EVT_PASSKEY_DISPLAY on your display, so that the user can enter this key on the Central device.
  • Thanks for your reply, actually we require button press related authentication, and we also got one tip from this forum, that is, switching between non connectable to connectable advertising mode if possible tell us how to implement this. Is it possible to show the passkey on the master side and acknowledge it on the slave side by pressing the button?

  • As I state, and as you also can see in the spec section I refer to, you need a display or keyboard to use a passkey.

    Doing non-connectable advertising is just a matter of setting the right advertising type when starting advertising, and should be trivial if you know C and have understood how the softdevice APIs work. See this question for an example of such an application: https://devzone.nordicsemi.com/index.php/broadcaster-mode

Related