<?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>Accept only security level 4 and bonding attempt</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/102786/accept-only-security-level-4-and-bonding-attempt</link><description>Hello, 
 Im looking at the example of Pheriferical_NFC_Pairing, and I have some doubt i cant find answer on the forum. 
 - no advertisement on startup 
 - at NRF scan, a direct advertisement is done. this always go in timeout for me after ~400ms 
 - after</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 24 Oct 2023 11:52:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/102786/accept-only-security-level-4-and-bonding-attempt" /><item><title>RE: Accept only security level 4 and bonding attempt</title><link>https://devzone.nordicsemi.com/thread/451952?ContentTypeID=1</link><pubDate>Tue, 24 Oct 2023 11:52:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68a04247-9e37-42e0-af53-8814d9ced515</guid><dc:creator>Maria Gilje</dc:creator><description>&lt;p&gt;Enabling CONFIG_BT_NUS_AUTHEN will configure the security level to be level 3. To ensure level 4 security, you need to configure the _perm field of BT_GATT_CHARACTERISTIC to be &lt;span&gt;&lt;/span&gt;&lt;span&gt;BT_GATT_PERM_WRITE_LESC. &lt;/span&gt;&lt;/p&gt;
[quote user="mmm"]Do you think this is a proper solution, or is better to copy the code and add proper auth level, that in my case level 4 should be `&lt;span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;BT_GATT_PERM_WRITE_LESC`, correct?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;[/quote]
&lt;p&gt;&lt;span&gt;It is up to you, but I recommend that you set up the service with the security level you need instead of using an if statement in security_changed(). &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Accept only security level 4 and bonding attempt</title><link>https://devzone.nordicsemi.com/thread/451275?ContentTypeID=1</link><pubDate>Thu, 19 Oct 2023 11:42:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1173c46c-7c62-41b7-b28c-9ac9cb612c78</guid><dc:creator>mmm</dc:creator><description>&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;I got the time to look into the examples and I saw it is changing directly the GATT, that i have no access as i am using a &amp;quot;premade&amp;quot; BT_NUS GETT service.&lt;/p&gt;
&lt;p&gt;But looking at the code i noticed it has the option CONFIG_BT_NUS_AUTHEN (&lt;a id="" href="https://github.com/nrfconnect/sdk-nrf/blob/main/subsys/bluetooth/services/nus.c"&gt;https://github.com/nrfconnect/sdk-nrf/blob/main/subsys/bluetooth/services/nus.c&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;and that seems to enable required AUTHEN, so that together with an if in `security_changed` that log out anything that is not level 4 seems to do the trick.&lt;/p&gt;
&lt;p&gt;Do you think this is a proper solution, or is better to copy the code and add proper auth level, that in my case level 4 should be `&lt;span class="w"&gt;&lt;/span&gt;&lt;span class="sig-name descname"&gt;&lt;span class="n"&gt;&lt;span class="pre"&gt;BT_GATT_PERM_WRITE_LESC`, correct?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Accept only security level 4 and bonding attempt</title><link>https://devzone.nordicsemi.com/thread/447239?ContentTypeID=1</link><pubDate>Fri, 22 Sep 2023 11:33:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da64e58c-419a-437d-a217-ef827e176afe</guid><dc:creator>Maria Gilje</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Thank you for your patience.&lt;/p&gt;
[quote user="mmm"]Thanks, I read the lesson but it does not explain how to secure from connection that are not encrypted.[/quote]
&lt;p&gt;A new connection will always start at level 1, and a pairing procedure will upgrade the connection to the security level related to the pairing method. Exercise 1 covers how to implement level 4 security from step 8. Make sure that you have done the changes in steps 4 and 5 as well.&lt;/p&gt;
[quote user=""]Is there a better way to handle this?[/quote]
&lt;p&gt;You can add a security requirement to the Permissions field of an attribute. Connections with a lower security level than the _perm parameter of &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/connectivity/bluetooth/api/gatt.html#c.BT_GATT_CHARACTERISTIC"&gt;BT_GATT_CHARACTERISTIC&lt;/a&gt; will not be able to access the attribute.&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Maria&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Accept only security level 4 and bonding attempt</title><link>https://devzone.nordicsemi.com/thread/444908?ContentTypeID=1</link><pubDate>Thu, 07 Sep 2023 11:41:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b57da0de-afa6-4bc3-a411-11a8c157363e</guid><dc:creator>mmm</dc:creator><description>&lt;p&gt;Hi Maria,&lt;/p&gt;
&lt;p&gt;Thanks, I read the lesson but it does not explain how to secure from connection that are not encrypted.&lt;/p&gt;
&lt;p&gt;There is a reference to the white list system, the problem with that is, from my understanding, such list cannot be updated while the BT is already in advertising, so it would not be possible to add a new Central; also if it would be possible, how to deal if the new client connect but then does not exchange key and update to security level 4&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Accept only security level 4 and bonding attempt</title><link>https://devzone.nordicsemi.com/thread/444646?ContentTypeID=1</link><pubDate>Wed, 06 Sep 2023 08:07:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cc97aafd-35c8-4515-a7fa-db1c0383ed33</guid><dc:creator>Maria Gilje</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am very sorry for the delay.&lt;/p&gt;
&lt;p&gt;Have you been able to resolve your issue in the meantime?&lt;/p&gt;
&lt;p&gt;If not, &lt;a href="https://academy.nordicsemi.com/courses/bluetooth-low-energy-fundamentals/lessons/lesson-5-bluetooth-le-security-fundamentals/"&gt;lesson 5&lt;/a&gt; of the Bluetooth Low Energy Fundamentals course covers security in Bluetooth LE communication. Pairing, bonding and Filter Accept lists are amongst the covered topics.&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Maria&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Accept only security level 4 and bonding attempt</title><link>https://devzone.nordicsemi.com/thread/441425?ContentTypeID=1</link><pubDate>Tue, 15 Aug 2023 14:44:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ddebc8cb-ccf3-4227-82d5-0200d3044bf7</guid><dc:creator>Maria Gilje</dc:creator><description>&lt;p&gt;Hello mmm,&lt;/p&gt;
&lt;p&gt;I have been assigned your ticket, and I will get back to you soon with more information.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Maria&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>