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

nRF52832: How to add write protected characteristic by KEY

I am working on SDK-15.2, nRF52832 Dev board. My question is how to add write protected characteristic by KEY? Mean when we want to write something from peer device (smartphone) on "write" characteristic it should ask to enter KEY.

 is there any example code or documentation available?

Any suggestions will be appreciated.

Thanks

Raj

Parents
  • First you need to secure the link, this can be done using the Peer Manager. Then you can set the Security requirement for writing to the characteristic value through the field ble_add_char_params_t.write_access. For example:

    ble_add_char_params_t add_char_params;
    .
    .
    .
    add_char_params.write_access = SEC_MITM;

    If you secure the link using static passkeys, you need to enter a 6 digit key (20 bits) in order to pair/bond the devices, and access the protected characteristics. Another choice for an even more secure protection is OOB, where an 128 bit key is transferred between the devices, using e.g. NFC.

    If anything is unclear, or do you want me to go more into details about anything, please tell me.

    Best regards,

    Simon

Reply
  • First you need to secure the link, this can be done using the Peer Manager. Then you can set the Security requirement for writing to the characteristic value through the field ble_add_char_params_t.write_access. For example:

    ble_add_char_params_t add_char_params;
    .
    .
    .
    add_char_params.write_access = SEC_MITM;

    If you secure the link using static passkeys, you need to enter a 6 digit key (20 bits) in order to pair/bond the devices, and access the protected characteristics. Another choice for an even more secure protection is OOB, where an 128 bit key is transferred between the devices, using e.g. NFC.

    If anything is unclear, or do you want me to go more into details about anything, please tell me.

    Best regards,

    Simon

Children
Related