<?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>SC field in AuthReq pairing response</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/12119/sc-field-in-authreq-pairing-response</link><description>Hi,
I noticed that I can&amp;#39;t bond successfully with my device using iOs 9.1 with Nrf Master control panel iOs app. When I insert the PINCODE, the device immediatly disconnects, and debugging it seems that iOs sends a diconnection command (BLE_GAP_EVT_DISCONNECTED</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 01 Mar 2016 07:59:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/12119/sc-field-in-authreq-pairing-response" /><item><title>RE: SC field in AuthReq pairing response</title><link>https://devzone.nordicsemi.com/thread/45854?ContentTypeID=1</link><pubDate>Tue, 01 Mar 2016 07:59:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18cc23c9-e395-4dc2-9bc8-0a06ef93ed4d</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I&amp;#39;d recommend using the device manager module to handle bonding if you&amp;#39;re not already. This will handle all the necessary pairing events, which means that you can remove all handling in your application if any.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SC field in AuthReq pairing response</title><link>https://devzone.nordicsemi.com/thread/45853?ContentTypeID=1</link><pubDate>Mon, 29 Feb 2016 17:02:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9feeed21-4e64-4bc4-a665-606b5382af4b</guid><dc:creator>Lorens</dc:creator><description>&lt;p&gt;Yes, I&amp;#39;ve always checked the error, since that version of iOs I&amp;#39;ve never had any problem. The connection is not broken from my device, the reason is always remote user.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SC field in AuthReq pairing response</title><link>https://devzone.nordicsemi.com/thread/45852?ContentTypeID=1</link><pubDate>Mon, 29 Feb 2016 16:54:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f858a9c-c1ad-4914-ba1c-c2df3998e8f5</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;do you error-check the result of sd_ble_gap_sec_params_reply()? If you do then it&amp;#39;s probably returning an error telling you that NULL isn&amp;#39;t a valid parameter and you&amp;#39;re going to the error handler and resetting, hence breaking the connection.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SC field in AuthReq pairing response</title><link>https://devzone.nordicsemi.com/thread/45851?ContentTypeID=1</link><pubDate>Mon, 29 Feb 2016 16:42:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3010272-649d-41c4-b799-8566cddf0b1b</guid><dc:creator>Lorens</dc:creator><description>&lt;p&gt;@Ulrich: the disconnection reason is 0x13 REMOTE_USER_TERMINATED_CONNECTION.
@Vidar: I made several tries using LightBlue app or even Master Control Panel. The problem seems to be solved, I mean now iOs is not disconnecting. I changed the parameter in the function:
sd_ble_gap_sec_params_reply; the last one parameter I used to use NULL, now I gave a pointer to the structure ble_gap_sec_keyset_t.
Probably before there was not the need to store the key. With this pointer I suppose the softdevice is storing the key, that wasn&amp;#39;t storing in case of NULL. But Maybe someone could PROVIDE a more precise answer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SC field in AuthReq pairing response</title><link>https://devzone.nordicsemi.com/thread/45850?ContentTypeID=1</link><pubDate>Mon, 29 Feb 2016 14:41:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a933a66-3a18-4fab-91d8-d1fc670708a6</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;@Lorens, have you been able to resolve this? I&amp;#39;ve tried passkey pairing on multiple occasions with ios 9.2.1 and have not experienced that iOS has terminated the link unless the bonding flag was set to false (pairing not supported apparently).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SC field in AuthReq pairing response</title><link>https://devzone.nordicsemi.com/thread/45849?ContentTypeID=1</link><pubDate>Fri, 26 Feb 2016 09:47:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c588305-4539-4a6c-a5c3-7ab17ed2b9a5</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Thanks Ulrich - I thought it was a bit premature for the engineer to leap to that conclusion, and more so for the guy to mark it as the &amp;#39;right answer&amp;#39;. It seemed somewhat unlikely that you&amp;#39;d change the request before using it, more likely you would just ignore the bits you didn&amp;#39;t care about, as you do.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SC field in AuthReq pairing response</title><link>https://devzone.nordicsemi.com/thread/45848?ContentTypeID=1</link><pubDate>Fri, 26 Feb 2016 09:36:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b2ccf35-245e-4c97-b699-86515c368c84</guid><dc:creator>Ulrich Myhre</dc:creator><description>&lt;p&gt;@RK: I don&amp;#39;t have the HW to test this at the moment, but looking at the 8.0.0 code, the whole preq is copied verbatim from the radio. And in the pairing confirm generation, it is again used without modification. There are also conformance tests to verify that we correctly ignore these fields, so I believe this is not the problem. But the tests and the current stack have changed a lot since 8.0.0, so my memory can be fuzzy.&lt;/p&gt;
&lt;p&gt;@Lorens: The disconnection reason was not provided still, and this could quickly solve this. If it&amp;#39;s &amp;quot;MIC Failure&amp;quot;, then something is up with the key generation. But if it&amp;#39;s just &amp;quot;Remote peer disconnected&amp;quot;, then it&amp;#39;s likely that iOS just killed the connection because nothing interesting was happening. I think they operate with a few seconds of timeout before they tear it down. Are you also able to pair without mitm?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SC field in AuthReq pairing response</title><link>https://devzone.nordicsemi.com/thread/45847?ContentTypeID=1</link><pubDate>Fri, 26 Feb 2016 01:41:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:381f81d9-f571-46ba-804f-51cfbd25057a</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;finally found the right piece of the spec, it&amp;#39;s Vol 3, Part H, 2.2.3 in the 4.0 spec and Vol 3, H, 2.3.5.5 in the 4.2 spec. You use the Pairing Request (preq) in the confirm generating function one of the inputs.&lt;/p&gt;
&lt;p&gt;The Apple Engineer in that thread is suggesting that instead of using the paring request which was received, the softdevice is masking out the reserved bits in the AuthReq field of that request, assuming them to be zero (they were reserved previously and only now are used) and using that instead.&lt;/p&gt;
&lt;p&gt;That seems a bit of a stretch, I wonder what evidence he has to support suggesting that. It&amp;#39;s certainly possible but I can&amp;#39;t think he&amp;#39;d put it forward as a hypothesis so strongly unless he&amp;#39;d already come across that exact behavious.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SC field in AuthReq pairing response</title><link>https://devzone.nordicsemi.com/thread/45846?ContentTypeID=1</link><pubDate>Fri, 26 Feb 2016 01:00:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca6f87f6-4463-4cdc-af87-6ebf3a4806d7</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Despite the &amp;#39;SC&amp;#39; answer being marked as correct on that thread, it wasn&amp;#39;t actually clear to me whether it was or not. So I followed up to ask what it was they did on their firmware side to fix it, because they claimed they did.&lt;/p&gt;
&lt;p&gt;Note the suggestion in that thread is not that you need to be able to set the SC bit yourself and use LESC pairing, but that the peer (the nrf51 in this case) assumes that bit is zero and uses zero when it generates the key instead of all the bits actually set in the request. Those bits appear to have two uses, one to express features (which the peer doesn&amp;#39;t have to support) and two, as raw bits used in key generation. The suggestion in the thread is that that reserved bit is masked to zero during key generation (because the peer doesn&amp;#39;t anticipate it being anything apart from zero) and thus generates a bad key.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SC field in AuthReq pairing response</title><link>https://devzone.nordicsemi.com/thread/45845?ContentTypeID=1</link><pubDate>Thu, 25 Feb 2016 22:08:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e56da9a5-385d-4c87-b6e8-778dbf8f59b7</guid><dc:creator>Lorens</dc:creator><description>&lt;p&gt;I also found this topic that maybe could help to find out the solution. The problem seems similar:
&lt;a href="https://forums.developer.apple.com/thread/20585"&gt;forums.developer.apple.com/.../20585&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SC field in AuthReq pairing response</title><link>https://devzone.nordicsemi.com/thread/45844?ContentTypeID=1</link><pubDate>Thu, 25 Feb 2016 16:21:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee39be46-aeef-4017-854d-a09cedb295ed</guid><dc:creator>Lorens</dc:creator><description>&lt;p&gt;Thank you Ulrich. What I see when the BLE_GAP_EVT_AUTH_STATUS event happens is BLE_GAP_SEC_STATUS_SUCCESS in p_ble_evt-&amp;gt;evt.gap_evt.params.auth_status.auth_status.
this should mean that the PIN was right. The reason field on the disconnect event is 0x13 BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION.
About thee OOB answering in evt BLE_GAP_EVT_SEC_PARAMS_REQUEST I use:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sd_ble_gap_sec_params_reply(m_conn_handle , BLE_GAP_SEC_STATUS_SUCCESS , &amp;amp;own_params, NULL);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;where:&lt;/p&gt;
&lt;p&gt;own_params.bond         = 1;
own_params.mitm         = 1;
own_params.io_caps      = BLE_GAP_IO_CAPS_DISPLAY_ONLY;
own_params.oob          = 0;
own_params.min_key_size = 7;
own_params.max_key_size = 16;
Any Ideas?
It seems that iOs doesn&amp;#39;t like some answer I provide??&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SC field in AuthReq pairing response</title><link>https://devzone.nordicsemi.com/thread/45843?ContentTypeID=1</link><pubDate>Thu, 25 Feb 2016 09:35:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6dae99bd-507d-4aa8-8d39-3065847bf441</guid><dc:creator>Ulrich Myhre</dc:creator><description>&lt;p&gt;You cannot set the SC field in S110 8.x, because it does not support LE Secure Connections. It will always be set to 0 in the AuthReq field in the Pairing Response PDU. Both devices need to set this bit to end up doing LESC pairing, so I do not think is the reason. The reason can be that you set the OOB flag though.&lt;/p&gt;
&lt;p&gt;Do you get an BLE_GAP_EVT_AUTH_STATUS event? What&amp;#39;s its status?
What is the &amp;#39;reason&amp;#39; field of the disconnected event?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>