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

NRF52832 Passkey Length setting

hello,

I am using SDK16 ble_app_gls example . I set static passkey with adding this code in  ble_stack_init function.

uint8_t passkey[] = "123456";
ble_opt_t ble_opt;
ble_opt.gap_opt.passkey.p_passkey = &passkey[0];
err_code = sd_ble_opt_set(BLE_GAP_OPT_PASSKEY, &ble_opt);
APP_ERROR_CHECK(err_code); 

 When I write password "123456"  I can connect on nrf connect app but if I write " 123456789" again I can connect . This should not be . How can I set length of passkey?

Can you help me?

Parents
  • The reason it works with "123456789" is that the passkey entry method uses a passkey of consisting of 6 digits, no more or less. So the value(s) you type in the nRF Connect app after the 6'th digit doesn't matter (I have not tested this myself, but it seems like it is the case based on your text). See this ticket for more information

    I would like to know what your underlying issue is? Why does it matter that it works with some extra garbage values at the end? It does not affect the security in any way since the length is fixed at 6 digits.

    If you would like to increase the security of your device and reduce the chance of a MITM attack, take a look at this ticket.

    Best regards,

    Simon

Reply
  • The reason it works with "123456789" is that the passkey entry method uses a passkey of consisting of 6 digits, no more or less. So the value(s) you type in the nRF Connect app after the 6'th digit doesn't matter (I have not tested this myself, but it seems like it is the case based on your text). See this ticket for more information

    I would like to know what your underlying issue is? Why does it matter that it works with some extra garbage values at the end? It does not affect the security in any way since the length is fixed at 6 digits.

    If you would like to increase the security of your device and reduce the chance of a MITM attack, take a look at this ticket.

    Best regards,

    Simon

Children
No Data
Related