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

ble_app_uart example with encryption

Hi,

I use proprietary service to transmit data between raspberry pi and nRF52840 DK. The example I referred to is below.

C:\nRF5_SDK_16.0.0_98a08e2\examples\ble_peripheral\ble_app_uart\pca10056\s140\arm5_no_packs

I need the data be encrypted with Security mode 1 and level 2 (Just Work). However, in this example, it seems no 'Peer manager' or 'Device manager' is used and transmitting raw data directly without any security protection. 

The question is:

1. How can I modify the source code to enable encryption with Just Work.

2. If modified, shall UART apps need to modify, too?

Parents
  • Hi,

    1. How can I modify the source code to enable encryption with Just Work.

    You should refer to an example that includes the peer manager and implement support for pairing/bonding as done there. You should also reference the peer manager documentation for that. Lastly, you must adjust the security configuration for the characteristics that you want to protect, so that they are only readable/writable when paired. You can for instance refer to the HRS example (ble_app_hrs), but to require pairing you would set hrs_init.hrm_cccd_wr_sec to SEC_JUST_WORKS instead of SEC_OPEN.

    2. If modified, shall UART apps need to modify, too?

    What do you mean? The application needs to be adjusted to use the Peer manager library as described above. But if you refer to apps on a phone, then most likely not, depending on the app. Most of the pairing/bonding is handled by the OS.

  • Hi,

    Thanks for your kindly help. According to your suggestions, there are at least two adjustments should be done:

    1. Include the peer mannager.

    2. adjust the security configuration for characteristics.

    3. modify the 'sdk_config.h' file to enable these changes. 

    According to my understanding,maybe the crypto frontend and backend should also be included to support encryption.  Is my understanding correct? 

    look forward to your reply.

  • Hi,

    Deeper said:
    According to my understanding,maybe the crypto frontend and backend should also be included to support encryption.  Is my understanding correct? 

    Yes, but that does not require any specific code changes in your code since it is all handled by the peer manager. But you need to add nrf_crypto files and include, in the same way as you need to add other libraries that are used by the peer manager.

Reply
  • Hi,

    Deeper said:
    According to my understanding,maybe the crypto frontend and backend should also be included to support encryption.  Is my understanding correct? 

    Yes, but that does not require any specific code changes in your code since it is all handled by the peer manager. But you need to add nrf_crypto files and include, in the same way as you need to add other libraries that are used by the peer manager.

Children
No Data
Related