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, 
    I'm sorry that I don't fully understand what you want to achieve here. 

    When you do passkey pairing, which device is the device that display the passkey, was it on the nRF53 or it's on the phone ? 

    You mentioned that "I have implemented  passkey and it is working fine", so what is the change you want to implement here ? 

    Do you want to display the passkey in your app and then the end user can look at your app to get the key and then enter it into the Bluetooth pairing pop up on the phone? 

    It's possible to do that by modifying your app to send the passkey via BLE to the phone and display that on the phone. However, this remove the advantage of the passkey pairing that the passkey is display in another mean than using BLE. If you do this, an attacker with a sniffer can catch the passkey and can decrypt your encryption. And also it won't be able to give you Man in the middle (MITM) protection as you can't be sure the device you talk to is the device you are looking at. 

Reply
  • Hi Abhay, 
    I'm sorry that I don't fully understand what you want to achieve here. 

    When you do passkey pairing, which device is the device that display the passkey, was it on the nRF53 or it's on the phone ? 

    You mentioned that "I have implemented  passkey and it is working fine", so what is the change you want to implement here ? 

    Do you want to display the passkey in your app and then the end user can look at your app to get the key and then enter it into the Bluetooth pairing pop up on the phone? 

    It's possible to do that by modifying your app to send the passkey via BLE to the phone and display that on the phone. However, this remove the advantage of the passkey pairing that the passkey is display in another mean than using BLE. If you do this, an attacker with a sniffer can catch the passkey and can decrypt your encryption. And also it won't be able to give you Man in the middle (MITM) protection as you can't be sure the device you talk to is the device you are looking at. 

Children
  • When you do passkey pairing, which device is the device that display the passkey, was it on the nRF53 or it's on the phone ?

    I have 2 devices, one is the thingy53 and other is the mobile(having an app names as "Bluetooth serial terminal")..The passkey will be pre-known and already statically set in the thingy53. 
    I want that whenever a user uses the "serial terminal" app to connect to the thingy53, a popup should be shown, which says to enter the passkey in the app itself. As soon as the user enter that static passkey, board will connect to the app else will disconnect automatically.

    Paskey request will be shown on the "Bluetooth serial terminal" app or if any app will try to connect to board, it will be prompted for providing passkey.

    You mentioned that "I have implemented  passkey and it is working fine", so what is the change you want to implement here ? 

    I have added a passkey callback with this function

     bt_conn_auth_cb_register(&auth_cb_display);
        unsigned int passkey=123456;
        err = bt_passkey_set(passkey);
        if (err) {
            printk("set passkey (err %d)\n", err);
            }
    static struct bt_conn_auth_cb auth_cb_display = {
    	 .passkey_display = auth_passkey_display,
    	 .passkey_entry = NULL,
    	  .cancel = auth_cancel,
    	.pairing_confirm = pairing_confirm,
    	.pairing_complete = pairing_complete,
        .pairing_failed = pairing_failed,
    	.pairing_accept= pairing_accept,
    	
    };

    and provided a fixed passskey. Now when I tried to connect to the board from the android bluetooth setting, it asks for passkey, but I not in the case with the app, it simply connect to it.
    Do you want to display the passkey in your app and then the end user can look at your app to get the key and then enter it into the Bluetooth pairing pop up on the phone?
    No, I already explained this, the passkey is pre-set in the board, the end user will have to enter it, only and only then he will be allowed to connect to board.
    NOTE:- Please answer max. question in every reply, so that the issue will be resolved in minimum days.  
Related