<?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>Nus client and write to secure characteristic</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/35545/nus-client-and-write-to-secure-characteristic</link><description>Hi, 
 I have modified the nus service and added two new characteristics called txs and rxs which support read and write protection. 
 on the peripheral i have set BLE_GAP_CONN_SEC_MODE_SET_LESC_ENC_WITH_MITM for txs and rxs 
 The service is working as</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 21 Jun 2018 05:47:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/35545/nus-client-and-write-to-secure-characteristic" /><item><title>RE: Nus client and write to secure characteristic</title><link>https://devzone.nordicsemi.com/thread/136999?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 05:47:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f09bb08a-52c4-415e-9e09-dbe98c394314</guid><dc:creator>Raghav Iyer</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;I got it working. I had to call pm_conn_secure and wait for conn secure success event and then send it over the secure characteristic.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nus client and write to secure characteristic</title><link>https://devzone.nordicsemi.com/thread/136953?ContentTypeID=1</link><pubDate>Wed, 20 Jun 2018 16:37:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b15dec03-f8c6-4168-8020-4193a24dd1d6</guid><dc:creator>Raghav Iyer</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have modified the lesc example and added the nus service instead of the hrs.&lt;/p&gt;
&lt;p&gt;I have established the bond between central and peripheral and made sure in the event&amp;nbsp;&lt;a class="elRef" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s140.api.v5.0.0/group___b_l_e___g_a_p___e_n_u_m_e_r_a_t_i_o_n_s.html#ggada486dd3c0cce897b23a887bed284fefa8958220152f7547da3b250b4f724877c"&gt;BLE_GAP_EVT_AUTH_STATUS&lt;/a&gt;,&amp;nbsp;&lt;code&gt;lv4&lt;/code&gt;&lt;span&gt;&amp;nbsp;is set to 1.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I connect to bonded peripheral, start discovery, once discovered I call assign handles on nus_c and then enable notification for txs characteristic and trying to send to rxs&amp;nbsp;&lt;span&gt;characteristic using&amp;nbsp;&lt;/span&gt;ble_nus_c_string_send_secure function.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The function returns NRF_SUCCESS but the message is not received by the peripheral.&lt;/p&gt;
&lt;p&gt;Is there anything else to be done?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nus client and write to secure characteristic</title><link>https://devzone.nordicsemi.com/thread/136931?ContentTypeID=1</link><pubDate>Wed, 20 Jun 2018 13:58:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da7b1683-9d5f-4abf-96c7-72fd7ff70a26</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;You need to handle the encryotion at one point.&lt;/p&gt;
&lt;p&gt;since there are several levels on encryption (MITM is the highest one), it is not enough to bond.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please see this example, which uses LESC:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v13.0.0%2Fble_sdk_app_multirole_lesc.html"&gt;https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v13.0.0%2Fble_sdk_app_multirole_lesc.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nus client and write to secure characteristic</title><link>https://devzone.nordicsemi.com/thread/136898?ContentTypeID=1</link><pubDate>Wed, 20 Jun 2018 12:19:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ec69d30-27b7-4056-9a24-1a100c9b110d</guid><dc:creator>Raghav Iyer</dc:creator><description>&lt;p&gt;I&amp;nbsp;called the&amp;nbsp;BLE_GAP_CONN_SEC_MODE_SET_LESC_ENC_WITH_MITM in the nus_init function in the main.c&lt;/p&gt;
&lt;p&gt;FYI, this is from nRF SDK 15.0.&lt;/p&gt;
&lt;p&gt;I am not sure how I can encrypt the link, Since the peripheral works with nrf connect for android, I am assuming the app takes care of encrypting the link. I was assuming since I am using peer manager and I am connected to a lesc bonded peer, the encryption works automatically.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Can you give me sample of how to encrypt the&amp;nbsp;link on the central device?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nus client and write to secure characteristic</title><link>https://devzone.nordicsemi.com/thread/136896?ContentTypeID=1</link><pubDate>Wed, 20 Jun 2018 12:07:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7abe801a-f844-4b5f-bb28-e124284a6534</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I wasn&amp;#39;t able to compile with your ble_nus_c and ble_nus files, until I moved the BLE_GAP_CONN_SEC_MODE_SET_LESC_ENC_WITH_MITM to inside the ble_nus.c file. Where did you place them?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Did you actually encrypt the link? Does any of the devices initiate encryption, and do you respond to it in the other device?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nus client and write to secure characteristic</title><link>https://devzone.nordicsemi.com/thread/136842?ContentTypeID=1</link><pubDate>Wed, 20 Jun 2018 06:58:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3338745-6b9c-4910-8c0e-6728662376fe</guid><dc:creator>Raghav Iyer</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/0513.ble_5F00_nus_5F00_c.c"&gt;devzone.nordicsemi.com/.../0513.ble_5F00_nus_5F00_c.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nus client and write to secure characteristic</title><link>https://devzone.nordicsemi.com/thread/136841?ContentTypeID=1</link><pubDate>Wed, 20 Jun 2018 06:57:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c70fdca-08f0-48b8-8140-5226e7375c4e</guid><dc:creator>Raghav Iyer</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/4314.ble_5F00_nus.c"&gt;devzone.nordicsemi.com/.../4314.ble_5F00_nus.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nus client and write to secure characteristic</title><link>https://devzone.nordicsemi.com/thread/136840?ContentTypeID=1</link><pubDate>Wed, 20 Jun 2018 06:56:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:82a6feb6-9d51-40ef-81a3-27265825bcbf</guid><dc:creator>Raghav Iyer</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/6403.ble_5F00_nus_5F00_c.h"&gt;devzone.nordicsemi.com/.../6403.ble_5F00_nus_5F00_c.h&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/8880.ble_5F00_nus.h"&gt;devzone.nordicsemi.com/.../8880.ble_5F00_nus.h&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nus client and write to secure characteristic</title><link>https://devzone.nordicsemi.com/thread/136839?ContentTypeID=1</link><pubDate>Wed, 20 Jun 2018 06:55:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4c897e5-281a-4d49-a7d3-33fef23543b3</guid><dc:creator>Raghav Iyer</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;I will attach files that I have changed and this is how I have configured the NUS service on the peripheral&lt;/p&gt;
&lt;pre&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;BLE_GAP_CONN_SEC_MODE_SET_LESC_ENC_WITH_MITM(&amp;amp;nus_init.nus_rxs_attr_md.cccd_write_perm);
BLE_GAP_CONN_SEC_MODE_SET_LESC_ENC_WITH_MITM(&amp;amp;nus_init.nus_rxs_attr_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_LESC_ENC_WITH_MITM(&amp;amp;nus_init.nus_rxs_attr_md.write_perm);

BLE_GAP_CONN_SEC_MODE_SET_LESC_ENC_WITH_MITM(&amp;amp;nus_init.nus_txs_attr_md.cccd_write_perm);
BLE_GAP_CONN_SEC_MODE_SET_LESC_ENC_WITH_MITM(&amp;amp;nus_init.nus_txs_attr_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_LESC_ENC_WITH_MITM(&amp;amp;nus_init.nus_txs_attr_md.write_perm);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Please check the function ble_nus_c_string_send_secure in the nus client&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Nus client and write to secure characteristic</title><link>https://devzone.nordicsemi.com/thread/136835?ContentTypeID=1</link><pubDate>Wed, 20 Jun 2018 06:23:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:302ff0f7-e7f4-4467-ac45-50a452311b66</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;So, what does your implementation look like? What is the difference between ble_nus_c_string_send and ble_nus_c_string_send_secure? Do they write to the same characteristic, or does it write to the new characteristics, rxs? Is the rxs set up properly on the peripheral?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It is a bit difficult to say what the issue may be only with a brief description of your implementation. Could you upload at least the implementation of ble_nus_c_string_send_secure()?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>