<?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>Bonding. Why ltk changed at every reconnection?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/9388/bonding-why-ltk-changed-at-every-reconnection</link><description>Hi,
I have done the bonding and saving context to flash. As an example I used ble_app_template. I cutted all redundant code and limited to single bond for simplicity.
In my code I save next: 
 - m_connection_table (I changed it a little bit)
 - m_peer_table</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 30 Sep 2015 12:12:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/9388/bonding-why-ltk-changed-at-every-reconnection" /><item><title>RE: Bonding. Why ltk changed at every reconnection?</title><link>https://devzone.nordicsemi.com/thread/34650?ContentTypeID=1</link><pubDate>Wed, 30 Sep 2015 12:12:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51126e6b-2a09-4177-9d70-1ff7933595fa</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;It is a bit strange that you get BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION for the Nexus 7 if you turn off Bluetooth in settings, but I don&amp;#39;t think this is the root of the issue. If you can, please do a sniffer trace.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bonding. Why ltk changed at every reconnection?</title><link>https://devzone.nordicsemi.com/thread/34648?ContentTypeID=1</link><pubDate>Wed, 30 Sep 2015 12:11:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf4aafc2-0179-4267-962f-cce366f7caf6</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;I mean on the air sniffing yes. It would be very helpful, thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bonding. Why ltk changed at every reconnection?</title><link>https://devzone.nordicsemi.com/thread/34649?ContentTypeID=1</link><pubDate>Wed, 30 Sep 2015 11:24:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b203f4e6-92c3-4ed0-a8e7-1aa9833e8ebf</guid><dc:creator>Valer_I</dc:creator><description>&lt;ul&gt;
&lt;li&gt;I tested on Win8.1 and it works, on Nexus7 doesn&amp;#39;t. The test case was the next:&lt;/li&gt;
&lt;/ul&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;bonding&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;disconnection from host by switching off bluetooth or removing the BLE dongle.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;On periperal wthite list become working and after switching on bluetooth on central, it connects and in one case rebonds with new LTK, in other case using previous bond.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;When I receive BLE_GAP_EVT_DISCONNECTED the
ble_evt-&amp;gt;evt.gap_evt.params.disconnected.reason is BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION for Nexus7 and BLE_HCI_CONNECTION_TIMEOUT for Win8.1. Could this parameter be connected with described issue?&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;I think I found.
In Android code each time I connected the method called&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;device.createBond();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now it changed to and seems to work properly, but it not always define bond status correctly(((&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;if (device.getBondState() != BluetoothDevice.BOND_BONDED) {
    device.createBond();
} 
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bonding. Why ltk changed at every reconnection?</title><link>https://devzone.nordicsemi.com/thread/34647?ContentTypeID=1</link><pubDate>Wed, 30 Sep 2015 10:59:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:704feb24-7c03-4109-8ff4-78f2079ae1af</guid><dc:creator>Valer_I</dc:creator><description>&lt;p&gt;Sorry for late responce. I have made some experiments. My issue connected with loss of bond information on master or slave. If bond saved and loaded correctly I receive BLE_GAP_EVT_SEC_INFO_REQUEST. About pairing encryption request, for Windows 8.1 it seems that I can&amp;#39;t make any impact on bonding process so I can&amp;#39;t generate this request.  If you mean air sniffing, I need some data about this request first.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bonding. Why ltk changed at every reconnection?</title><link>https://devzone.nordicsemi.com/thread/34646?ContentTypeID=1</link><pubDate>Fri, 25 Sep 2015 14:15:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c30921c-4313-443a-8a84-9f43ea630b6a</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;The peripheral application will receive the BLE_GAP_EVT_SEC_INFO_REQUEST event if it gets a pairing encryption request, which the central sends if the central application calls sd_ble_gap_encrypt(). Is your central application calling this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bonding. Why ltk changed at every reconnection?</title><link>https://devzone.nordicsemi.com/thread/34645?ContentTypeID=1</link><pubDate>Fri, 25 Sep 2015 08:51:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4cc6b324-17ad-4da4-b13e-d0a0c8e40914</guid><dc:creator>Valer_I</dc:creator><description>&lt;p&gt;Both S110 and S130 were tried on nRF51422QFAAE0. I neither use SDK nor Device manager. I interact with sotdevice only within sd_ble_... functions. What should I see if sniff the air? In debug I ablle to see all BLE events to compare with flowcharts from mentioned above document references. As central do not sent  the BLE_GAP_EVT_SEC_INFO_REQUEST after connection may I suppose that it doesn&amp;#39;t remember the bond?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bonding. Why ltk changed at every reconnection?</title><link>https://devzone.nordicsemi.com/thread/34644?ContentTypeID=1</link><pubDate>Thu, 24 Sep 2015 12:54:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:413a1749-2376-4eda-8574-ee954082b861</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;What SDK and SoftDevice version are you using? Are you using the device manager? What is your central device? Have you tried to sniff to see what is happening on air?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>