<?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>LE Secure Connection Info and crypto</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/46081/le-secure-connection-info-and-crypto</link><description>I am trying to just find what is this LE Secure Connection but can&amp;#39;t seem to find anything basic. When i look at the lesc example, it look slike they simply turn the bit on as a parameter and if you want MITM prevention turn that param bit on also. Is</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 12 Apr 2019 11:48:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/46081/le-secure-connection-info-and-crypto" /><item><title>RE: LE Secure Connection Info and crypto</title><link>https://devzone.nordicsemi.com/thread/181834?ContentTypeID=1</link><pubDate>Fri, 12 Apr 2019 11:48:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d523b1e-0aab-4114-85af-fb279e8a75b6</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="dmleone"]What is a good example of peer management? right now this is what i do. I am new to both nRF and BLE.&amp;nbsp;[/quote]
&lt;p&gt;The SDK contains a number of &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/examples_ble_peripheral.html?cp=5_0_4_2_2"&gt;BLE peripheral examples&lt;/a&gt; that implements bonding, all using the peer manager. Which example you should refer to depend on your requirements. For instance, do you need MITM? Do you need LESC?&lt;/p&gt;
[quote user="dmleone"]Advertiser only accepts connections from a MAC address it knows stored flash memory. If the MAC address is not stored it just disconnects.[/quote]
&lt;p&gt;In this case you can use whitelisting. That way the SoftDevice will only&amp;nbsp;allow connections from that specific MAC. Please note though that this approach will not work if the peer device is a modern device (phone, tablet etc.), as these use a random resolvable MAC address based on the identity resolving key (IRK). This can only be obtained by pairing with the device, which exchanges some data, including the IRK and long term key (LTK).&lt;/p&gt;
&lt;p&gt;(Generally I advice against using custom &amp;quot;smart&amp;quot; methods, as it is usually better to stick with standard BLE procedures. There are well tested, properly implemented in the SDK.)&lt;/p&gt;
[quote user="dmleone"]The scanner before connecting looks for a specific UUID and then if it finds that UUID it checks its list of accepted MAC addresses. If the MAC address is stored, it will establish a connection with the advertiser. If it doesnt recognize the MAC address, it will check the manufacturer data to see if the devices is in MAC storing mode. if it is, it will go ahead and remember the MAC of the advertiser and establish a connection.[/quote]
&lt;p&gt;&amp;nbsp;This is easy to implement. I recommend you take a look at some of the &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/examples_ble_central.html?cp=5_0_4_2_0"&gt;BLE central examples&lt;/a&gt; in the SDK, and look at how you can use &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/lib_ble_scan.html?cp=5_0_3_2_11_3#scan_filters"&gt;filters&lt;/a&gt;.&lt;/p&gt;
[quote user="dmleone"]Is this considered bonding? pairing? or what function of peer manager would give me the same results?[/quote]
&lt;p&gt;&amp;nbsp;Pairing means that the peer devices establish a encrypted link. This can be done in several ways defined by the Bluetooth specification (LESC, MITM etc.). Bonding means that the encryption keys etc. are stored (in flash) and used the next time the same two devices connect. It is possible for two peer devices to connect and communicate without pairing if there is no need for an encrypted link.&lt;/p&gt;
[quote user="dmleone"]ll the examples of peer manager i have looked at it doesnt have a function to put the system into pair/bonding mode.[/quote]
&lt;p&gt;There is no pairing/bonding mode per se. The peripheral can advertise in a connectable way, and then the peer can connect. Once in a connection either the central or peripheral can initiate pairing. Typically the nRF peripheral will just support pairing, and accept it when it is initiated by the central. On the central side you can for instance refer to &amp;lt;SDK&amp;gt;\examples\ble_central\ble_app_hrs_c\main.c, where you can see that pairing is initiated by a call to&amp;nbsp;pm_conn_secure().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LE Secure Connection Info and crypto</title><link>https://devzone.nordicsemi.com/thread/181824?ContentTypeID=1</link><pubDate>Fri, 12 Apr 2019 11:21:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff38ac96-7455-4b9d-921b-6e3e07858c7e</guid><dc:creator>dmleone</dc:creator><description>&lt;p&gt;What is a good example of peer management? right now this is what i do. I am new to both nRF and BLE.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Advertiser only accepts connections from a MAC address it knows stored flash memory. If the MAC address is not stored it just disconnects.&lt;/p&gt;
&lt;p&gt;In order to add a MAC to the storage you have to put the advertiser into add MAC mode which modifies the manufacturer data to advertise that it is in MAC storing mode. Then if it doesnt recognize the connected MAC, it will add it to its list of accepted MAC devices.&lt;/p&gt;
&lt;p&gt;The scanner before connecting looks for a specific UUID and then if it finds that UUID it checks its list of accepted MAC addresses. If the MAC address is stored, it will establish a connection with the advertiser. If it doesnt recognize the MAC address, it will check the manufacturer data to see if the devices is in MAC storing mode. if it is, it will go ahead and remember the MAC of the advertiser and establish a connection.&lt;/p&gt;
&lt;p&gt;Is this considered bonding? pairing? or what function of peer manager would give me the same results?&lt;/p&gt;
&lt;p&gt;All the examples of peer manager i have looked at it doesnt have a function to put the system into pair/bonding mode. nor does it have an add_peer function call of sorts in the code. so not sure right now how to implement peer manager. Only thing i know how to do is delete peers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LE Secure Connection Info and crypto</title><link>https://devzone.nordicsemi.com/thread/181765?ContentTypeID=1</link><pubDate>Fri, 12 Apr 2019 07:04:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4d2cc40-39aa-43e4-97e6-78764f22a138</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I did not understand this question. Can you elaborate?&lt;/p&gt;
&lt;p&gt;However, I would like to stay that I strongly recommend using the peer manager library to handle pairing/bonding. This is quite complex, so making a good implementation from scratch will be very time consuming and probably error-prone.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LE Secure Connection Info and crypto</title><link>https://devzone.nordicsemi.com/thread/181712?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2019 17:42:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c30adcbc-7022-4e34-9646-d400417ccbb6</guid><dc:creator>dmleone</dc:creator><description>&lt;p&gt;If i am not using peer manager as a means to handle connections, maybe i should, would the LESC bit turned on work same way.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LE Secure Connection Info and crypto</title><link>https://devzone.nordicsemi.com/thread/181590?ContentTypeID=1</link><pubDate>Thu, 11 Apr 2019 12:28:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e9bc329-39dc-4299-96a9-d6a28a5a2e03</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]I am trying to just find what is this LE Secure Connection but can&amp;#39;t seem to find anything basic.[/quote]
&lt;p&gt;LE Secure Connection use a &lt;a href="https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange"&gt;Diffie–Hellman key exchange&lt;/a&gt;&amp;nbsp;method to obtain a shared secret (encryption key) used to encrypt the link in a way that is safe even though there are eavesdroppers. In legacy pairing the encryption key is transmitted in clear text on air so that any eavesdropper could obtain the key.&lt;/p&gt;
[quote user=""]and if you want MITM prevention turn that param bit on also.[/quote]
&lt;p&gt;This is not the same as MITM protection, so LE Secure connections also supports MITM protection. This includes numeric comparison which is only sensible for LESC, since it would be useless in legacy pairing where an attacker could anyway eavesdrop on the communication and display the correct number.&lt;/p&gt;
[quote user=""]Is that all there is to it to make a secure&amp;nbsp; connection?[/quote]
&lt;p&gt;&amp;nbsp;In short: yes.&lt;/p&gt;
[quote user=""]I dont need ot make a private and public key or anything? or what is a good example which shows public private key useage for LE secure conenction i can look at[/quote]
&lt;p&gt;&amp;nbsp;No. the key pair is generated automatically by the&amp;nbsp;peer manager library for every bonding, so you do not need to think of it as long as you have enabled LESC when you configured the Peer manager.&lt;/p&gt;
[quote user=""]I am looking also in the aes-ctr cryptoi library to encrypt and decrypt on either side of the BLE conneciton as a possibility and just send encrypted data over unsecure BLE if need be[/quote]
&lt;p&gt;&amp;nbsp;I do not see any need for adding another layer of encryption on the link if you use LESC. It is usually better to go with the standardized way of doing things, unless you have a very good reason not to.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>