<?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>Passkey activation</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16846/passkey-activation</link><description>Hello, 
 we try to use static passkey protection on our devices.
we use nrf51 sdk12 with s130.
We read a few threads for setting a static passkey like here , here and some other threads..
But we dont find any information or some routines for init</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 11 Oct 2016 15:03:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16846/passkey-activation" /><item><title>RE: Passkey activation</title><link>https://devzone.nordicsemi.com/thread/64500?ContentTypeID=1</link><pubDate>Tue, 11 Oct 2016 15:03:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c3749b9-d4ed-498e-b5c4-c9b5107ed5b8</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;When in the peripheral role kdist_own defines which keys it shall distribute to the central, while kdist_peer defines which keys the central shall distribute to you.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/** @brief Keys that can be exchanged during a bonding procedure. */
typedef struct
{
  uint8_t enc     : 1;                        /**&amp;lt; Long Term Key and Master Identification. */
  uint8_t id      : 1;                        /**&amp;lt; Identity Resolving Key and Identity Address Information. */
  uint8_t sign    : 1;                        /**&amp;lt; Connection Signature Resolving Key. */
  uint8_t link    : 1;                        /**&amp;lt; Derive the Link Key from the LTK. */
} ble_gap_sec_kdist_t;
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Passkey activation</title><link>https://devzone.nordicsemi.com/thread/64499?ContentTypeID=1</link><pubDate>Tue, 11 Oct 2016 12:32:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b15b6be6-4be0-4fd7-844b-c35f4ae427bf</guid><dc:creator>Sascha</dc:creator><description>&lt;p&gt;I think we found the reason, why it didnt work.
Our steps to set static passkey.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;in main.c.:&lt;/p&gt;
&lt;p&gt;// Standard defines
#define SEC_PARAM_BOND                  1
#define SEC_PARAM_MITM                  0
#define SEC_PARAM_LESC                  0
#define SEC_PARAM_KEYPRESS              0
#define SEC_PARAM_IO_CAPABILITIES       BLE_GAP_IO_CAPS_DISPLAY_ONLY
// passkey defines
#define STATIC_PASSKEY        &amp;quot;111111&amp;quot;
uint8_t passkey[] =           STATIC_PASSKEY;
ble_opt_t                     static_pin_option;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;in gap_params_init():&lt;/p&gt;
&lt;p&gt;static_pin_option.gap_opt.passkey.p_passkey = passkey;
err_code = sd_ble_opt_set(BLE_GAP_OPT_PASSKEY, &amp;amp;static_pin_option);
APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;With this the passkey entry didnt work: it abort after key was typed in.
So we compared our project with the ble_app_gls example line by line.
I dont know exactly why, perhaps for some testing, in our peer_manager_init() the sec_param were set to:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sec_param.kdist_own.enc  = 0;
sec_param.kdist_own.id   = 0;
sec_param.kdist_peer.enc = 0;
sec_param.kdist_peer.id  = 0;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and in gls example is set to 1. We changed it, and now it works as required.
But, can anyone explane us why it is now working and what is the reason why it didnt work?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Passkey activation</title><link>https://devzone.nordicsemi.com/thread/64497?ContentTypeID=1</link><pubDate>Mon, 10 Oct 2016 14:29:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:194fd5e8-3c4d-42e8-b469-52fc68566013</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Maybe you can edit your question and upload your complete project so we can test it here? What SDK and SoftDevice version are you using?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Passkey activation</title><link>https://devzone.nordicsemi.com/thread/64494?ContentTypeID=1</link><pubDate>Mon, 10 Oct 2016 12:45:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2bcf689-1c38-41bc-9eb1-7b234c38c197</guid><dc:creator>Sascha</dc:creator><description>&lt;p&gt;The reason: 0x13 BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION
Direct after i press OK, when i typed in the key.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Passkey activation</title><link>https://devzone.nordicsemi.com/thread/64496?ContentTypeID=1</link><pubDate>Mon, 10 Oct 2016 12:19:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16c64b06-c2f5-4cb6-a30c-2fe4ae40202c</guid><dc:creator>Alex</dc:creator><description>&lt;p&gt;First of all look at log of nRF Connect application. Also put break point at BLE_GAP_EVT_DISCONNECTED event and see what is in p_ble_evt-&amp;gt;evt.gap_evt.params.disconnected.reason&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Passkey activation</title><link>https://devzone.nordicsemi.com/thread/64495?ContentTypeID=1</link><pubDate>Mon, 10 Oct 2016 12:14:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5dd77b9b-a030-4b06-b2d2-8b1af72cda4b</guid><dc:creator>Sascha</dc:creator><description>&lt;p&gt;It do not run into the app_error_handler(). Otherwise, we dont know a point to view at, where it could break up or check the key, we typed in.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Passkey activation</title><link>https://devzone.nordicsemi.com/thread/64498?ContentTypeID=1</link><pubDate>Mon, 10 Oct 2016 07:46:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14d8e556-2a61-401c-874b-fb0d27c6f213</guid><dc:creator>Alex</dc:creator><description>&lt;p&gt;Most likely connection aborted due to reset at app_error_handler(). Can you run in debug mode and see where your code fails?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Passkey activation</title><link>https://devzone.nordicsemi.com/thread/64493?ContentTypeID=1</link><pubDate>Mon, 10 Oct 2016 07:40:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9fd2a485-ec1a-4b59-9ee9-7de4627dd258</guid><dc:creator>Sascha</dc:creator><description>&lt;p&gt;Hey Alex and Petter, sorry, but we dont get it.&lt;br /&gt;
We tried different things.&lt;br /&gt;
We took the ble_app_template example with 2 new Characteristics.&lt;br /&gt;
In main:&lt;br /&gt;
&amp;quot;#define SEC_PARAM_IO_CAPABILITIES       BLE_GAP_IO_CAPS_DISPLAY_ONLY&amp;quot;&lt;br /&gt;
&amp;quot;#define STATIC_PASSKEY        &amp;quot;111111&amp;quot;&lt;br /&gt;
uint8_t passkey[] = STATIC_PASSKEY;&lt;/p&gt;
&lt;p&gt;in gap_params_init():&lt;br /&gt;
err_code = sd_ble_gap_ppcp_set(&amp;amp;gap_conn_params);&lt;/p&gt;
&lt;p&gt;in our characteristic_add() for the secure characteristic:&lt;br /&gt;
BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM(&amp;amp;attr_md.read_perm);&lt;/p&gt;
&lt;p&gt;Now, when we are connected, we can see our characteristics. When we try to read out, there is the pin request. If i type in, the connection abort. There is no uart communication for mitm protection, so i think the static passkey is set correct!?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Passkey activation</title><link>https://devzone.nordicsemi.com/thread/64492?ContentTypeID=1</link><pubDate>Wed, 05 Oct 2016 08:42:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d949d1f-ccd1-463c-a5f8-c48ad06a1136</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;If you have trouble with ble_app_gls you should add another question. Please have a look at &lt;a href="https://devzone.nordicsemi.com/question/92105/static-passkey-demo-code-for-s110-stackv80sdk10-of-nrf51822/"&gt;this&lt;/a&gt;, it may explain why you don&amp;#39;t get a passkey request. And Alex you are correct, Passkey Entry and OOB is used to protect against MITM attacks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Passkey activation</title><link>https://devzone.nordicsemi.com/thread/64491?ContentTypeID=1</link><pubDate>Wed, 05 Oct 2016 08:36:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b4df4ae-7e37-448a-bc09-3600b48a1081</guid><dc:creator>Alex</dc:creator><description>&lt;p&gt;Passkey will be asked as soon as you try to read encrypted characteristic. Just connection doesn&amp;#39;t require it. Also look at &lt;a href="https://devzone.nordicsemi.com/question/43973/static-passkey-and-mitm/"&gt;this thread&lt;/a&gt; . Some old Android don&amp;#39;t ask passkey on connection. We have ASUS with Android 5.0.2 which doesn&amp;#39;t work. By the way, I&amp;#39;m not good expert in BLE security I always thought that passkey is for MITM.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Passkey activation</title><link>https://devzone.nordicsemi.com/thread/64490?ContentTypeID=1</link><pubDate>Wed, 05 Oct 2016 08:25:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b95c7f4e-f221-45b1-888e-706f254a6e2c</guid><dc:creator>Sascha</dc:creator><description>&lt;p&gt;Hi Alex, thanks for your answer. I tried that. But i have no passkey request on my smartphone. I connect with iphone and android phones and it connects without any message, to type in any key. While testing, i had another problem with the passkey: i took the ble_app_gls example for testing. I dont know why, but when i try to connect to it with an android device, i dont get any connection, it abort direct after pushing connect. when i try with iphone, the passkey request appears on the phone. Does anybody know what is the problem here? thx&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Passkey activation</title><link>https://devzone.nordicsemi.com/thread/64489?ContentTypeID=1</link><pubDate>Tue, 04 Oct 2016 14:35:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:497f430e-9258-4f42-9e5e-52de33885818</guid><dc:creator>Alex</dc:creator><description>&lt;p&gt;Put it at the end of gap_params_init(). Make sure you set &lt;code&gt;SEC_PARAM_IO_CAPABILITIES BLE_GAP_IO_CAPS_DISPLAY_ONLY&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>