How to get BLE OOB data from BLE stack

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get BLE OOB data from BLE stack

Jump to solution
1,904 Views
nidhintomy
Contributor IV

In gap_interface.h, there is

bleResult_t Gap_ProvideOob
(
    deviceId_t      deviceId,
    const uint8_t*  aOob
);

API to provide OOB data to stack. But it is not clear that where we get this 16 byte OOB data in first place.
Please clarify how to get the 16byte OOB data for BLE OOB pairing.

Best Regards,
Nidhin

Labels (2)
1 Solution
1,814 Views
EduardoZamora
NXP TechSupport
NXP TechSupport

Hi,

For example, you can hardcode/manually set Central OOB own data and store it in an array. This data will be sent Out of Band to the peer device (using SPI, UART, I2C, etc.) and, at the same time, this data will be provided to the stack using Gap_ProvideOob. This data must be common on both Central and Peripheral devices. Gap_ProvideOob should be implemented in response to gConnEvtOobRequest_c event at the BleConnManager_GapCentralEvent function.

static uint8_t gOobOwnTKData[16] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};

On the peripheral side you can, for example, store the data previously received Out of Band from the peer device (using SPI, UART, I2C, etc.) in an array, but the procedure to fill this array with the data received from the peer depends entirely on your application. The received data from the peer should be sent to the stack by executing Gap_ProvideOob.

static uint8_t gOobReceivedTKDataFromPeer[16];

I apologize for insisting, but please refer to KW36 - Enabling Out Of Band Pairing on a Bluetooth LE Central and Peripheral. This guide describes how to enable OOB pairing using either Secure Connections or Legacy Pairing in both Peripheral and Central devices.

Regards,
Eduardo.

View solution in original post

8 Replies
1,223 Views
StephenYeh
Contributor III

Hi Sir,

Does the KW38 could leverage KW36 example code implement OOB feature?

Or any KW38 exampel code about OOB.

1,156 Views
nidhintomy
Contributor IV
Yes. you can use that. I already did.
Thanks!
Nidhin
0 Kudos
1,889 Views
EduardoZamora
NXP TechSupport
NXP TechSupport

Hello @nidhintomy

Hope you are doing well.

bleResult_t Gap_LeScGetLocalOobData(void)

retrieves local OOB data used for LE Secure Connections pairing. This API must be implemented either in response of gConnEvtPairingRequest_c or gConnEvtPairingResponse_c events in BleConnManager_GapPeripheralEvent or BleConnManager_GapCentralEvent functions (depending on the GAP role) to get the local OOB data generated from the controller.

Please, take a look at KW36 - Enabling Out Of Band Pairing on a Bluetooth LE Central and Peripheral, here you can find how to enable OOB pairing on Bluetooth LE connectivity examples, basing on FRDM-KW36 SDK HID Host and HID Device examples.

Regards,
Eduardo.

0 Kudos
1,875 Views
nidhintomy
Contributor IV

Hi @EduardoZamora 

I am doing well. And hope you are doing well.

My question is related to legacy pairing. The "Gap_LeScGetLocalOobData()" api is for LE Secure Connection. In BLE Leagacy pairing how should i get BLE OOB data from BLE stack ?

Best Regards,
Nidhin

 

0 Kudos
1,841 Views
EduardoZamora
NXP TechSupport
NXP TechSupport

Hi,

It will depend on the user implementation. For example, user can hardcode this data (as described in the KW36 - Enabling Out Of Band Pairing on a Bluetooth LE Central and Peripheral).

Please, consult the Bluetooth 5 Spec, Vol. 3, Part H, Section 2.3.5.4 Out Of Band and Vol. 2, Part H, Section 2 Random Number Generation.

Regards,
Eduardo.

0 Kudos
1,821 Views
nidhintomy
Contributor IV

Hi @EduardoZamora 

For LE Secure Connections device1 will get its OOB data from BLE stack using 'Gap_LeScGetLocalOobData' api. And device2 will send this OOB data from device1 to its BLE stack using 'Gap_LeScSetPeerOobData' API. That means 2 BLE stacks have this OOB data.

But for Legacy pairing only 'Gap_ProvideOob' API is in there. So my questions are:

1. Should i call the 'Gap_ProvideOob' twice to set its own OOB data and peer device's OOB data to BLE stack?
If yes, in which connection events i should call this API?

2. Is this OOB data a symmetric key? So only one device (probably center) have to generate this OOB data and send it to peer device(probably peripheral) using a OOB channel. Then the center use 'Gap_ProvideOob' API to set this self generated data to its BLE stack. And peripheral use 'Gap_ProvideOob' API to set this OOB data from central to its BLE stack.

Best Regards,
Nidhin

0 Kudos
1,815 Views
EduardoZamora
NXP TechSupport
NXP TechSupport

Hi,

For example, you can hardcode/manually set Central OOB own data and store it in an array. This data will be sent Out of Band to the peer device (using SPI, UART, I2C, etc.) and, at the same time, this data will be provided to the stack using Gap_ProvideOob. This data must be common on both Central and Peripheral devices. Gap_ProvideOob should be implemented in response to gConnEvtOobRequest_c event at the BleConnManager_GapCentralEvent function.

static uint8_t gOobOwnTKData[16] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};

On the peripheral side you can, for example, store the data previously received Out of Band from the peer device (using SPI, UART, I2C, etc.) in an array, but the procedure to fill this array with the data received from the peer depends entirely on your application. The received data from the peer should be sent to the stack by executing Gap_ProvideOob.

static uint8_t gOobReceivedTKDataFromPeer[16];

I apologize for insisting, but please refer to KW36 - Enabling Out Of Band Pairing on a Bluetooth LE Central and Peripheral. This guide describes how to enable OOB pairing using either Secure Connections or Legacy Pairing in both Peripheral and Central devices.

Regards,
Eduardo.

1,796 Views
nidhintomy
Contributor IV

Hi @EduardoZamora 

Thanks for helping me.

Now its clear that answer is lying on that document. The array name indicates it. But didn't noticed.

Merry Christmas & Happy New Year.
Nidhin

Tags (1)