<?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>encryption problem</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/9685/encryption-problem</link><description>How to make an encryption on nRF51822?
Does it need to set 
 sd_ble_gap_sec_params_reply(m_conn_handle, BLE_GAP_SEC_STATUS_SUCCESS, &amp;amp;m_sec_params, &amp;amp;sec_keyset) 
 
 the forth parameter in this function ？
what&amp;#39;s the value for this parameter? 
 Thanks</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 30 Oct 2017 12:27:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/9685/encryption-problem" /><item><title>RE: encryption problem</title><link>https://devzone.nordicsemi.com/thread/35818?ContentTypeID=1</link><pubDate>Mon, 30 Oct 2017 12:27:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba9ea880-b684-4d69-b2d0-57913506c879</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Darrew,&lt;/p&gt;
&lt;p&gt;sd_ble_gap_sec_params_reply() is used on both sides, central and peripheral.
p_sec_keyset is provided to the softdevice, so that the softdevice can send the encryption key (LTK, not STK) and id data back to the application.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;STK will be generated depends on the pairing method used, Justwork, passkey or OOB. And it&amp;#39;s the softdevice generates it but based on the information provided by the application , for example passkey or OOB data.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;If you are talking about Legacy pairing then it&amp;#39;s correct. It&amp;#39;s the softdevice taking care of it. On LE secure connection, the application is in charge of generating the DHKey.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Correct. The application call sd_ble_gap_sec_params_reply() and wait for the BLE_GAP_EVT_AUTH_STATUS event to store the key into flash for future use. Have a look &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s132.api.v5.0.0/group___b_l_e___g_a_p___c_e_n_t_r_a_l___b_o_n_d_i_n_g___j_w___m_s_c.html?cp=2_3_1_1_0_2_1_3_5_2_0"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Yes, it&amp;#39;s correct.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: encryption problem</title><link>https://devzone.nordicsemi.com/thread/35817?ContentTypeID=1</link><pubDate>Fri, 27 Oct 2017 08:48:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14f054a7-6d71-4286-8bf3-09d77be81476</guid><dc:creator>Darrew</dc:creator><description>&lt;p&gt;Hi Petter,
can you please elaborate on this answer?&lt;/p&gt;
&lt;p&gt;Precisely,
if a Central wants to bond to a Peripheral, then the Central will provide a p_sec_keyset pointer and set p_sec_params to NULL on ble_gap_sec_params_reply();&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;does the softdevice generate STK (short term key) internally?&lt;/li&gt;
&lt;li&gt;the application does not take care of key generation, correct?&lt;/li&gt;
&lt;li&gt;are Phase 2 (STK Generation) and 3 (key distribution) opaque to the application?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Once bonding is done, an encrypted connection can be established using p_sec_keyset&lt;br /&gt;
according to Message Sequence Chart &amp;gt; Central Security Procedures &amp;gt; Encryption Establishment using stored keys, is this correct?&lt;/p&gt;
&lt;p&gt;thx&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: encryption problem</title><link>https://devzone.nordicsemi.com/thread/35816?ContentTypeID=1</link><pubDate>Tue, 13 Oct 2015 07:24:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8504ddd9-6082-4b46-8549-6451a6abdd4d</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Do you want to pair or bond?&lt;/p&gt;
&lt;p&gt;This is normally an output, so:&lt;/p&gt;
&lt;p&gt;If you want pair you can set the value to NULL.&lt;/p&gt;
&lt;p&gt;If you want to bond you need to provide a pointer to a ble_gap_sec_keyset_t security keyset structure. Any keys distributed as a result of the ongoing security procedure will be stored into the memory referenced by the pointers inside this structure. The keys will be stored and available to the application upon reception of a BLE_GAP_EVT_AUTH_STATUS event.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>