How to get passkey on bluetooth terminal.

Hello,

I have a question regarding BLE connection with passkey.

In my sample, I have implemented  passkey and it is working fine

When starting connection and pairing process, a  passkey can display on my bluetooth settings .So ,My question is how display passkey on play store application named (Serial bluetooth Terminal).

When the pairing is start and connection with bluetooth and Passkey is display on bluetooth settings and I entered  the passkey that is connected , and in bluetooth  terminal they connected easily without asking passkey.

So, the passkey is not available that is not connected  with bluetooth terminal.

My understand is Enable the CONFIG_BT_SMP_APP_PAIRING_ACCEPT=y ,so they  set in code but they not working.

My question is , I display the  passkey in bluetooth terminal.

This is interface of bluetooth settings asking passkey.

Parents
  • Hi Abhay,

    If you do passkey pairing, the popup window from Bluetooth Setting in Android/iOS is unavoidable. It's not allowed for the app to handle it. It's how it works with Android and iOS. So all the pairing is going through the OS not the app. 

    My suggestion is to do your own encryption and authentication. So basically you will do open connection (or if you want you can do Just work) and then do encryption on the application. You can have a look at this blog:  Simple Application-level Authentication 
    It cover the authentication part, you can implement encryption on top of that. 

    By the way, please note that doing static passkey is strongly not recommended, especially with LESC. It just need a few retrys (only maximum 20 times) to crack that. 

  • My suggestion is to do your own encryption and authentication. So basically you will do open connection (or if you want you can do Just work) and then do encryption on the application. You can have a look at this blog:  Simple Application-level Authentication 

    how  to implement  it.  I didn't know.

    Please suggest any code or sample regarding this problem

    Can't I get the popup for pairing request in the app? even if it supports pairing?

    Note: I am a beginner in zypher os

  • Hi Abhay, 

    abhay_kr said:
    Can't I get the popup for pairing request in the app? even if it supports pairing?

    No, the popup has to be shown by OS. But I don't see a problem with that, most of the BLE application has that behavior. You click pair from the app and then a popup by OS appears and you type the code in. I think it will bring you a lot of work if you want to do encryption in the application. 



    abhay_kr said:

    how  to implement  it.  I didn't know.

    Please suggest any code or sample regarding this problem

    We don't have an example that does exactly what you need. 
    My suggestion is to study the blog I pointed to. The code implemented in the blog was for nRF5 SDK. But you can refer to it and use in nRF Connect. 

    Regarding encryption, you would need to choose a way to encrypt the communication. We have some examples https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/crypto.html

  • Hi  
    I am abhay's co-member and ansering in behalf of him.

    No, the popup has to be shown by OS. But I don't see a problem with that, most of the BLE application has that behavior.

    OS = Android?

    You click pair from the app and then a popup by OS appears and you type the code in.

    Yes, basically I want this, that a popup will appear from the android side to fill the passkey. <-- How to do this?

    My suggestion is to study the blog I pointed to. The code implemented in the blog was for nRF5 SDK. But you can refer to it and use in nRF Connect. 

    I did it, but I don't think so this gigantic knowledge is helpful for us in displaying popup thing.

Reply
  • Hi  
    I am abhay's co-member and ansering in behalf of him.

    No, the popup has to be shown by OS. But I don't see a problem with that, most of the BLE application has that behavior.

    OS = Android?

    You click pair from the app and then a popup by OS appears and you type the code in.

    Yes, basically I want this, that a popup will appear from the android side to fill the passkey. <-- How to do this?

    My suggestion is to study the blog I pointed to. The code implemented in the blog was for nRF5 SDK. But you can refer to it and use in nRF Connect. 

    I did it, but I don't think so this gigantic knowledge is helpful for us in displaying popup thing.

Children
  • Hi Sachin, 

    So your questions is how to pair when you are in the "Serial bluetooth Terminal" and it doesn't matter if it the OS (operating system - Android) displays it or your app displays it ? 

    Please correct me if I'm wrong, the situation here is that in your app you can't pair and you don't see the pairing pop up appear ? 

    To be able to trigger the phone to pair with your device you would need to read/write a characteristic that requires encryption/pairing. 

    My suggestion is to go through our Bluetooth Academy course. By going through the course you would be able to know how to set up a characteristic that requires encryption/pairing. And how in your app you can trigger the pairing. 
    Please take a look at the course here. The security part is at chapter 5. 

  • So your questions is how to pair when you are in the "Serial bluetooth Terminal" and it doesn't matter if it the OS (operating system - Android) displays it or your app displays it ? 

    Correct, now you are going as what I am trying make you understand

    Please correct me if I'm wrong, the situation here is that in your app you can't pair and you don't see the pairing pop up appear ? 

    Yup, I don't see the pairing request in the app (But I can see it in the Android_setting->Bluetooth_setting)

    My suggestion is to go through our Bluetooth Academy course.

    Thanks, I am working accordingly, I will bother you again when stuck somewhere. Slight smile

  • Hi  

    Thanks for your help in this, that course help us in adding the passkey feature.

    I appreciate your effort and time.

    Regards 

    Sachin

Related