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

Update passkey after bonding

Hello,

I would like to know the best practices to update a passkey for bonding.

For the moment, I have a static passkey that I set during ble initialization and I can bond to my device with the default password "123456". I have a characteristic with MITM secure access to save a passkey. After bonding, I can set this characteristic.

I would like to take this value and then set a new passkey. During the initialisation I used this function sd_ble_opt_set(BLE_GAP_OPT_PASSKEY, &sOpt); to set my key.

My question is how update this key with the new value. I need to set the value after disconnect or I can do this during connexion. I test to recall the function sd_ble_opt_set with the new value but doesn't work.

Parents
  • Hi Konova,

    I assume what you plan to do is to have a default static passkey of "123456" initially. Then after the first bond, you have an option to change it to a new passkey, via a BLE command (a write from the phone to the device for example).

    After that the new bond to other centrals should use the new passkey.

    I don't see why this shouldn't work (but as Ulrich mentioned, this won't bring much security).

    Note that there is nothing stored to flash when you call sd_ble_opt_set(). So you need to store the new passkey it in flash and then every time the chip boot up you should call sd_ble_opt_set() to set the passkey to the stored passkey.

Reply
  • Hi Konova,

    I assume what you plan to do is to have a default static passkey of "123456" initially. Then after the first bond, you have an option to change it to a new passkey, via a BLE command (a write from the phone to the device for example).

    After that the new bond to other centrals should use the new passkey.

    I don't see why this shouldn't work (but as Ulrich mentioned, this won't bring much security).

    Note that there is nothing stored to flash when you call sd_ble_opt_set(). So you need to store the new passkey it in flash and then every time the chip boot up you should call sd_ble_opt_set() to set the passkey to the stored passkey.

Children
No Data
Related