<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>BLE pairing with NFC (LE Secure connection with OOB)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69237/ble-pairing-with-nfc-le-secure-connection-with-oob</link><description>Hi, 
 Our plan is to develop a BLE device (GATT peripheral) and to have all the data coming from this device being encrypted. We want to use OOB pairing with NFC. 
 I read a bit about pairing and bonding, and I&amp;#39;m playing a bit with the various examples</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 09 Dec 2020 12:44:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69237/ble-pairing-with-nfc-le-secure-connection-with-oob" /><item><title>RE: BLE pairing with NFC (LE Secure connection with OOB)</title><link>https://devzone.nordicsemi.com/thread/284042?ContentTypeID=1</link><pubDate>Wed, 09 Dec 2020 12:44:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9bcff0a1-a2e4-414a-ad82-b8e7f912251e</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Just linking to the example here that show use of BLE with NFC pairing:&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/ble_sdk_app_hid_keyboard_pairing_nfc.html"&gt;https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/ble_sdk_app_hid_keyboard_pairing_nfc.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This example support pairing with NFC provided the peer support it, some Android phones should.&lt;/p&gt;
&lt;p&gt;I believe that in the specification by BT SIG regarding HRS service and profile state the required security level for each characteristic:&lt;br /&gt;&lt;a href="https://www.bluetooth.com/specifications/gatt/"&gt;https://www.bluetooth.com/specifications/gatt/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In general you may find this thread useful:&lt;br /&gt;&lt;a href="https://stackoverflow.com/questions/38963836/bluetooth-low-energy-gatt-security-levels"&gt;https://stackoverflow.com/questions/38963836/bluetooth-low-energy-gatt-security-levels&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;There are message sequence charts that describe the softdevice events and api calls, for instance see here for the peripheral security procedures:&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.2.0/group___b_l_e___g_a_p___p_e_r_i_p_h___s_e_c___m_s_c.html"&gt;https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v7.2.0/group___b_l_e___g_a_p___p_e_r_i_p_h___s_e_c___m_s_c.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you include peer manager in your application this module will handle this for you, you just need to configure what you want to support.&lt;/p&gt;
&lt;p&gt;You should be able on the&amp;nbsp;BLE_GAP_EVT_AUTH_STATUS event to read out&amp;nbsp;if bonding is successful and the security level from:&lt;br /&gt;p_ble_evt-&amp;gt;evt.gap_evt.params.auth_status;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**@brief Event structure for @ref BLE_GAP_EVT_AUTH_STATUS. */
typedef struct
{
  uint8_t               auth_status;            /**&amp;lt; Authentication status, see @ref BLE_GAP_SEC_STATUS. */
  uint8_t               error_src : 2;          /**&amp;lt; On error, source that caused the failure, see @ref BLE_GAP_SEC_STATUS_SOURCES. */
  uint8_t               bonded : 1;             /**&amp;lt; Procedure resulted in a bond. */
  uint8_t               lesc : 1;               /**&amp;lt; Procedure resulted in a LE Secure Connection. */
  ble_gap_sec_levels_t  sm1_levels;             /**&amp;lt; Levels supported in Security Mode 1. */
  ble_gap_sec_levels_t  sm2_levels;             /**&amp;lt; Levels supported in Security Mode 2. */
  ble_gap_sec_kdist_t   kdist_own;              /**&amp;lt; Bitmap stating which keys were exchanged (distributed) by the local device. If bonding with LE Secure Connections, the enc bit will be always set. */
  ble_gap_sec_kdist_t   kdist_peer;             /**&amp;lt; Bitmap stating which keys were exchanged (distributed) by the remote device. If bonding with LE Secure Connections, the enc bit will never be set. */
} ble_gap_evt_auth_status_t;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;There is no direct requirement between what security levels that is supported by the peripheral, and the security level you set to access the various characteristics. However you should not set the security level of the characteristics higher than what the&amp;nbsp;peripheral can support.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>