<?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>Zephyr BLE static passkey between central and peripheral on two nrf52840s</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69202/zephyr-ble-static-passkey-between-central-and-peripheral-on-two-nrf52840s</link><description>Hi! 
 
 I am trying to develop a way for a Bluetooth Central and Bluetooth Peripheral using Secure Connections (security mode 1 level 2 if I&amp;#39;m not mistaken) using a static passkey. Both the Central and the Peripheral are nrf52840s, using the Connect SDK</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 20 Jan 2022 13:00:40 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69202/zephyr-ble-static-passkey-between-central-and-peripheral-on-two-nrf52840s" /><item><title>RE: Zephyr BLE static passkey between central and peripheral on two nrf52840s</title><link>https://devzone.nordicsemi.com/thread/348707?ContentTypeID=1</link><pubDate>Thu, 20 Jan 2022 13:00:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a871067-4b3f-4fa9-bbdf-12b7b8ee48ff</guid><dc:creator>ErDarshan</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/smohan"&gt;smohan&lt;/a&gt;,&lt;br /&gt;&lt;br /&gt;I would like to have the same functionality as you described in the ticket. I can connect using static pass-key and nrf connect applications yet our goal is to have two nrf52840 (one as peripheral and one as central). Have you implemented central side code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr BLE static passkey between central and peripheral on two nrf52840s</title><link>https://devzone.nordicsemi.com/thread/310815?ContentTypeID=1</link><pubDate>Thu, 20 May 2021 14:45:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75524440-e2b4-40a6-a42f-b5bac5af45d2</guid><dc:creator>Kenneth</dc:creator><description>[quote user="smohan"]I find a security breach here , as the example is set to connect with peers only via passkey method , but&amp;nbsp; if the peer device finds a way to manipulate its IO capabilities as&amp;nbsp;&lt;span&gt;nokeyboard-nodisplay then, it could make connect via just works. So what&amp;nbsp;the use in having passkey secure pairing implementation.&lt;/span&gt;[/quote]
&lt;p&gt;When you configure the GATT database, then you set the security level required to access these characteristics, so if the bond is established with lower than the intended security level, then the peer will not be able to write or read to these characteristics.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr BLE static passkey between central and peripheral on two nrf52840s</title><link>https://devzone.nordicsemi.com/thread/310763?ContentTypeID=1</link><pubDate>Thu, 20 May 2021 13:07:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6cfa05e3-2f93-4bba-a48d-a3afc9d57006</guid><dc:creator>smohan</dc:creator><description>&lt;p&gt;Thanks a ton Kenneth for your reply! .&lt;/p&gt;
&lt;p&gt;I am going through the tutorials .&amp;nbsp; Btw,&amp;nbsp;I understood setting MITM .What really confuses me is the logic behind the security implementation from SIG. While&amp;nbsp;I used&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.5.0/nrf/samples/bluetooth/peripheral_uart/README.html"&gt;this&lt;/a&gt;&amp;nbsp;example for testing the passkey pairing,&amp;nbsp;I found that , when the peer device ( another nRF kit connected to windows lap nRF Connect BLE app loaded with connectivity firmware) changed its I/O capabilities to nokeyboard-nodisplay, the pairing happens though and it follows Just works(Level 2), I further came to conclusion that this dynamic changing of security pairing method happens as described in&amp;nbsp;&lt;a href="https://www.bluetooth.com/blog/bluetooth-pairing-part-2-key-generation-methods/"&gt;here&lt;/a&gt;&amp;nbsp;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I find a security breach here , as the example is set to connect with peers only via passkey method , but&amp;nbsp; if the peer device finds a way to manipulate its IO capabilities as&amp;nbsp;&lt;span&gt;nokeyboard-nodisplay then, it could make connect via just works. So what&amp;nbsp;the use in having passkey secure pairing implementation.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Later I read here that we can force to a security level&amp;nbsp;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/bluetooth/bluetooth-arch.html#security"&gt;here&lt;/a&gt;&amp;nbsp;.through bt_conn_security(), as it was not implicitly provided by any GATT service. I am going to test this now.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;It would be great if you could get back and comment on my understanding.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Regards/Mohan&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr BLE static passkey between central and peripheral on two nrf52840s</title><link>https://devzone.nordicsemi.com/thread/310667?ContentTypeID=1</link><pubDate>Thu, 20 May 2021 09:39:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5393cc89-6ab9-4c1c-8170-116e5852d914</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Maybe check out:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/nordic/nrf-connect-sdk-guides/b/software/posts/building-a-ble-application-on-ncs-comparing-and-contrasting-to-softdevice-based-ble-applications"&gt;https://devzone.nordicsemi.com/nordic/nrf-connect-sdk-guides/b/software/posts/building-a-ble-application-on-ncs-comparing-and-contrasting-to-softdevice-based-ble-applications&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/nordic/nrf-connect-sdk-guides/b/software/posts/building-a-ble-application-on-ncs-sdk---contrasting-to-softdevice-based-ble-applications---part-2-central-role"&gt;https://devzone.nordicsemi.com/nordic/nrf-connect-sdk-guides/b/software/posts/building-a-ble-application-on-ncs-sdk---contrasting-to-softdevice-based-ble-applications---part-2-central-role&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr BLE static passkey between central and peripheral on two nrf52840s</title><link>https://devzone.nordicsemi.com/thread/310598?ContentTypeID=1</link><pubDate>Thu, 20 May 2021 04:44:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:063a4f77-344a-4c94-bd8c-788f01b3c739</guid><dc:creator>smohan</dc:creator><description>&lt;p&gt;Hi Jonas,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am working on a similar one, can you help me understand, how to update the IO capabilities on the peripheral device? and How to update the MITM flag?I could not find any api calls to be used from application layer&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr BLE static passkey between central and peripheral on two nrf52840s</title><link>https://devzone.nordicsemi.com/thread/285036?ContentTypeID=1</link><pubDate>Tue, 15 Dec 2020 11:42:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fde6535d-508a-4a97-920c-5e090f19471c</guid><dc:creator>Jonas G L</dc:creator><description>&lt;p&gt;Thanks a lot for your input, @Kenneth. Peripheral seems to work as intended as of now. However, I still struggle to grapple with the Central part. Do you have a good reference/link with regards to how a central connects and communicates with a peripheral in Zephyr? There is a sea of UUIDs, Handles and callbacks and I cannot find a clear explanation how to:&lt;/p&gt;
&lt;p&gt;- Scan for connectable advertising peripherals&lt;/p&gt;
&lt;p&gt;- Connect to a certain peripheral&lt;/p&gt;
&lt;p&gt;- Perform service discovery and be prompted with what is found&lt;/p&gt;
&lt;p&gt;- Perform read and writes to the peripheral from the&amp;nbsp; central.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The first two points I can infer from existing code, but the last two I don&amp;#39;t see yet how to perform. Hope you can help.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR, Jonas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr BLE static passkey between central and peripheral on two nrf52840s</title><link>https://devzone.nordicsemi.com/thread/284187?ContentTypeID=1</link><pubDate>Wed, 09 Dec 2020 19:24:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2832788b-6fff-4dd7-bbd4-fce2cf289ea4</guid><dc:creator>Kenneth</dc:creator><description>&lt;div&gt;Hi,&lt;/div&gt;
&lt;div&gt;You need to add to prj.conf:&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BT_SMP=y
CONFIG_BT_FIXED_PASSKEY=y&lt;/pre&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;In main.c make sure that .pairing_confirm callback is NULL like this:&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;static struct bt_conn_auth_cb conn_auth_callbacks = {
.passkey_display = auth_passkey_display,
.cancel = auth_cancel,
.pairing_confirm = NULL,
.pairing_complete = pairing_complete,
.pairing_failed = pairing_failed
};&lt;/pre&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Make sure to add to main():&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;unsigned int passkey = 123456;
bt_passkey_set(passkey);&lt;/pre&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Then it should work out of the box for a device to fake a display with 123456. Also see attachment where I have modified&amp;nbsp;peripheral_lbs.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;For the device with passkey entry you will need to register a .passkey_entry callback in&amp;nbsp;conn_auth_callbacks, make sure to call&amp;nbsp;bt_conn_auth_passkey_entry(with 123456) in the callback.&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;Kenneth&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/8304.peripheral_5F00_lbs_5F00_fixed_5F00_passkey_5F00_ncs_5F00_1.4.0.zip"&gt;devzone.nordicsemi.com/.../8304.peripheral_5F00_lbs_5F00_fixed_5F00_passkey_5F00_ncs_5F00_1.4.0.zip&lt;/a&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Zephyr BLE static passkey between central and peripheral on two nrf52840s</title><link>https://devzone.nordicsemi.com/thread/283661?ContentTypeID=1</link><pubDate>Mon, 07 Dec 2020 18:37:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3ad5f6d-1659-4664-a340-5365e5ad0ca0</guid><dc:creator>Jonas G L</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/haakonsh"&gt;haakonsh&lt;/a&gt; &lt;a href="https://devzone.nordicsemi.com/members/hungbui"&gt;Hung Bui&lt;/a&gt; I&amp;#39;m not sure if it is uncustomary to selectively ping support engineers, and I apologise if it is, but ive read some of your great guides on Zephyr BLE on other topics and thought you might have just the skill set to aid in this specific inquiry? :)&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>