<?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>Implementing pairing in nRF52832 in nRF Connect SDK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/115623/implementing-pairing-in-nrf52832-in-nrf-connect-sdk</link><description>I want to implement secure connections for a device based on the nRF52832, protected by a PIN/pass key, which I need to be able to configure dynamically, not hardcoded in code. 
 Could you point me to some examples demonstrating how to achieve pairing</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 23 Oct 2024 13:12:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/115623/implementing-pairing-in-nrf52832-in-nrf-connect-sdk" /><item><title>RE: Implementing pairing in nRF52832 in nRF Connect SDK</title><link>https://devzone.nordicsemi.com/thread/507600?ContentTypeID=1</link><pubDate>Wed, 23 Oct 2024 13:12:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c661b2d-129a-449b-8e06-0f522f5c9103</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="V.Lorz"](1) I&amp;#39;ve added the permissions BT_GATT_PERM_WRITE_ENCRYPT and BT_GATT_PERM_READ_ENCRYPT to those characteristics I want to protect, assuming channel encryption is only available after authentication has been completed. Is this assumption correct?&amp;nbsp; Or should I need to do something else/more?[/quote]
&lt;p&gt;You are on the correct path here.&lt;/p&gt;
&lt;p&gt;For some additional security you could always have as a criteria that the entire connection is encrypted, i.e that you demand bonding from the start and not to only have some characteristics encrypted and others not.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span dir="ltr"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;From&amp;nbsp;&lt;span&gt;&lt;span dir="ltr"&gt;...\zephyr\include\zephyr\bluetooth\gatt.h you also have&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;/** @brief Attribute read permission with LE Secure Connection encryption.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;* &amp;nbsp;If set, requires that LE Secure Connections is used for read access.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;nbsp; &amp;nbsp; BT_GATT_PERM_READ_LESC = BIT(7),&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;nbsp;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;nbsp; &amp;nbsp; /** @brief Attribute write permission with LE Secure Connection encryption.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;* &amp;nbsp;If set, requires that LE Secure Connections is used for write access.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;nbsp; &amp;nbsp; BT_GATT_PERM_WRITE_LESC = BIT(8),&lt;/em&gt;&lt;/p&gt;
[quote user="V.Lorz"](2) How can I do for setting the PIN programmatically?[/quote]
&lt;p&gt;You can use&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/kconfig/index.html#CONFIG_BT_FIXED_PASSKEY"&gt;https://docs.nordicsemi.com/bundle/ncs-latest/page/kconfig/index.html#CONFIG_BT_FIXED_PASSKEY&lt;/a&gt;&amp;nbsp;Do note that this gives you no security and can the passkey can be brute forced with relative ease. It&amp;#39;s only &amp;quot;use case&amp;quot; is to ensure that user and it&amp;#39;s device are talking to the correct device since both devices has the same key.&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Implementing pairing in nRF52832 in nRF Connect SDK</title><link>https://devzone.nordicsemi.com/thread/506984?ContentTypeID=1</link><pubDate>Fri, 18 Oct 2024 17:51:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4eddab15-33ab-4b54-a812-10268e83e97d</guid><dc:creator>V.Lorz</dc:creator><description>&lt;p&gt;Thanks for your comment!&lt;/p&gt;
&lt;p&gt;Regarding the &lt;em&gt;central_and_peripheral_hr&lt;/em&gt; sample, it did not provide much of information for this specific case, but the &lt;em&gt;bluetooth-low-energy-fundamentals&lt;/em&gt; lesson did provide more useful insights, especially regarding changes required to &lt;em&gt;prj.conf&lt;/em&gt;, advertisements and the reference to &lt;em&gt;settings_store()&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;This question [&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/114792/increased-ble-security-on-nrf52832" rel="noopener noreferrer" target="_blank"&gt;here&lt;/a&gt;] mentions another function which is required for achieving Level 4, &lt;em&gt;bt_conn_set_security(conn, BT_SECURITY_L4)&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Now my next steps are (1) I want some characteristics to be available exclusively when pairing has been achieved and exchanges go over an encrypted channel, and (2) I want to set the initial PIN programmatically, not random value.&lt;/p&gt;
&lt;p&gt;(1) I&amp;#39;ve added the permissions BT_GATT_PERM_WRITE_ENCRYPT and BT_GATT_PERM_READ_ENCRYPT to those characteristics I want to protect, assuming channel encryption is only available after authentication has been completed. Is this assumption correct?&amp;nbsp; Or should I need to do something else/more?&lt;/p&gt;
&lt;p&gt;(2) How can I do for setting the PIN programmatically?&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;V. Lorz&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Implementing pairing in nRF52832 in nRF Connect SDK</title><link>https://devzone.nordicsemi.com/thread/506927?ContentTypeID=1</link><pubDate>Fri, 18 Oct 2024 12:53:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c11bb251-7b9c-4bf8-af75-5389ed35d907</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi BR,&lt;/p&gt;
&lt;p&gt;For this you can both have a look at the HRS sample as well as the academy fundamentals course on BLE (for the more generic aspect):&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/bluetooth/central_and_peripheral_hr/README.html"&gt;https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/bluetooth/central_and_peripheral_hr/README.html&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/"&gt;https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>