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

Master emulator pairing, passkey and bonding issue

Hi  Sir/ Miss:

I use master emulator to develop software testing device that dll version is 2.1.13.14.

It's developed on using C#.

And, I use nrf51 dongle (PCA10031) to develop software.

I have two questions about pairing, entering passkey and bonding with peripheral device.

Q1.

When I connect that device don't require to enter passkey, I can get the data on device information service and battery service.

But, I can't get any data on requiring passkey device. The API display " ATT error insufficient authentication " message.

I check the master emulator document of pairing, passkey and bonding in security sections.

It has some topic about these sections.

I can't find how to enter passkey and send to device?

It only mentions that "public int Passkey { set;}". That, I can set value for passkey.

But, I don't understand how to send it to device? Is there having API function for user in MasterEmulator.dll?

Or, should I use "SendData" function to send passkey?

Q2.

I don't understand the SOP of pairing, passkey and bonding.

In my current thoughts, the SOP might be connect -> pairing (STK) -> send passkey -> bonding (LTK).

If it's wrong, please correct me.

Thank you.

  • Hi,

    Q1: Are you writing a Peripheral or Central application? Which example are you basing your application on? The passkey is normally generated and displayed on the Peripheral side (display, terminal, etc.) and then entered on the Central. Please have a look at the Message Sequence Charts in softdevice documentation: 

    Q2: I would recommend that you read the 4 blog posts on Bluetooth SIG that described Pairing.

  • Hi, 

    For Q1:

    I'm writing central GUI application by using MCP firmware "MEFW_nRF51822_0.10.0_firmware_1M.hex".

    I'm basing on nRF UART of master emulator.

    I read blog on SIG. It mentions that SMP should define I/O capability and SC on pairing feature exchange for entering to entry passkey of LE legacy pairing. I found Enumeration name "IoCapabilitiesEnum" on API document, but I couldn't find to associated IoCapabilitiesEnum with method (like PipeStore associate with SetupAddService). And, I also can not  find the SC function on API document.

    In peripheral device notify central (BLE_GAP_EVT_AUTH_KEY_REQUEST) to enter passkey situations, do I follow the API document to create PasskeyRequestEventArgs? And, when I enter passkey on GUI, the API document depicts set a property "public in Passkey { set;}". Doesn't it require to use any API functions to transmit value to central device?

    For Q2:

    This blog is really to let me know it better. Thank you for your information and reply.

  • You should be able to set the IoCapabilities in SecurityParameters Class and pass this as argument to MasterEmulator.Bond Method.

  • I try to create below function.

            void OnSecurityRequest(object sender, SecurityRequestEventArgs arguments)
            {
                SecurityRequestEventArgs securityRequestEventArgs = new SecurityRequestEventArgs(true, true);
                securityParameters.IoCapabilities = IoCapabilitiesEnum.DisplayOnly;
                securityParameters.MaximumEncryptionKeySize = 16;
                securityParameters.OobAvailability = OobAvailibilityEnum.OobNotAvailable;
    
            }
    
            void OnPasskeyRequest(object sender, PasskeyRequestEventArgs eventArgs)
            {
                
                passkeyRequestEventArgs.Passkey = 123456;
            }

    And, these functions add in RegisterEventHandlers()

    But, I can't check whether the setup is working?
    Or, are these setting wrong?

    Thank you.

  • It is correct that you should set the passkey in the OnPasskeyRequest event, when it is being requested. I see you have set iocapabilities to displayonly. This should be set to keyboardonly or keyboarddisplay in order to get a passkey request.

Related