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

nRF52832 SDK15.3.0 how to force paring/bonding after connection

nRF52832

SDK15.3.0

ble_app_gls

ble_app_gls(SDK15.3.0) works perfectly and I want to port this "request pairing immediately feature" to my own project.

I referred a project from ble_app_uart_bonding_static_passkey_SDK_15.2.0  as my own project.

but this project does not start a pairing request after connection established. I have not found much difference between referred project and ble_app_gls.

Question:

ble_app_gls will start a pairing request with passkey method after connection established.

I want to find out where this paring request starts?

I tried:

1. in services_init(), modify SEC_JUST_WORKS to SEC_OPEN, but it still starts paring request after connection.

    // Here the sec level for the Glucose Service can be changed/increased.
    gls_init.gl_meas_cccd_wr_sec = SEC_JUST_WORKS;
    gls_init.gl_feature_rd_sec   = SEC_JUST_WORKS;
    gls_init.racp_cccd_wr_sec    = SEC_JUST_WORKS;
    gls_init.racp_wr_sec         = SEC_JUST_WORKS;

2. modify SEC_PARAM_LESC from 1 to 0, but it still starts paring request after connection

3. modify ble_app_uart_bonding_static_passkey_SDK_15.2.0 ble_nus_init(), make add_char_params.read_access/write_access/cccd_write_access to SEC_JUST_WORKS(just like ble_app_gls), it still does not start paring

Here I attach my test project on SDK15.2.0

ble_app_uart_bonding_static_passkey_SDK_15.2.0.7z

Parents
  • Hi,

    Reding your question I am a bit confused about what the goal is. At the beginning of the question, it seems like you want to somehow force a rapid pairing/bonding after connection. Reading furhter it looks like you don't want to pair at all. Can you clarify what you want to achieve

    Generally, it is always central who initiates pairing by issuing a pairing request. The peripheral can support pairing or not and support a subset of features (MITM depending on I/O capabilities, LESC, etc.). It can also require pairing for certain characteristics, like when you use SEC_JUST_WORKS or SEC_OPEN. This will limit if the peer can access the characteristics, depending on the security level. However, it is still the central who actually initiates the pairing. (For instance, iOS will only initiate pairing after getting access  denied one a characteristic).

  • Hi Einar, Thank you for your response.

    I think I resolved this request. In short words: I copied all related code from ble_app_gls, including pm_evt_handler() ble_evt_handler() peer_manager_init().

    Now ble_app_uart works just like ble_app_gls, will start a pairing request after connection immediately. And I will look at these handlers deeply.

    Now another question comes out:

    I am working on how to enable SEC_PARAM_LESC 1. If I simply set SEC_PARAM_LESC as 1, pairing result in a fetal error. I think this is about ECDH public key or crypto things. similar ticket

    Do you have any suggestions? or should I open a new ticket?

Reply
  • Hi Einar, Thank you for your response.

    I think I resolved this request. In short words: I copied all related code from ble_app_gls, including pm_evt_handler() ble_evt_handler() peer_manager_init().

    Now ble_app_uart works just like ble_app_gls, will start a pairing request after connection immediately. And I will look at these handlers deeply.

    Now another question comes out:

    I am working on how to enable SEC_PARAM_LESC 1. If I simply set SEC_PARAM_LESC as 1, pairing result in a fetal error. I think this is about ECDH public key or crypto things. similar ticket

    Do you have any suggestions? or should I open a new ticket?

Children
  • Hi,

    I am glad to hear you resolved the original issue.

    You can build with DEBUG defined (for instance by selecting the Debug to build in SES) to see exactly where the error was reported. This should let you know what you need. LESC needs nrf_crypto for the ECDH key exchange, so you definitely need that. I recommend you look at an example that has LESC enabled (such as the GLS example) to see what you need.

Related