<?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>SMP Server Sample with CONFIG_MCUMGR_SMP_BT_AUTHEN=y</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/66828/smp-server-sample-with-config_mcumgr_smp_bt_authen-y</link><description>Hello everyone! 
 I have an issue about upgrading firmware over Bluetooth LE with a mandatory pairing of devices. I want only paired devices to have the ability to upgrade firmware over Bluetooth LE, and not all merely connected ones. Thus, I consider</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 09 Oct 2020 01:53:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/66828/smp-server-sample-with-config_mcumgr_smp_bt_authen-y" /><item><title>RE: SMP Server Sample with CONFIG_MCUMGR_SMP_BT_AUTHEN=y</title><link>https://devzone.nordicsemi.com/thread/273892?ContentTypeID=1</link><pubDate>Fri, 09 Oct 2020 01:53:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5e26eae3-ac0a-4115-b766-1a7df5eb541a</guid><dc:creator>RAlexeev</dc:creator><description>&lt;p&gt;Wow, you&amp;#39;re great! Thanks for your quick and informative response! It completely helped me, and now everything works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SMP Server Sample with CONFIG_MCUMGR_SMP_BT_AUTHEN=y</title><link>https://devzone.nordicsemi.com/thread/273840?ContentTypeID=1</link><pubDate>Thu, 08 Oct 2020 15:26:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d552074-edcf-4d00-ae61-b08842ebb5a1</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Roman,&amp;nbsp;&lt;br /&gt;I think I found what could be wrong here.&amp;nbsp;&lt;br /&gt;If you have a look inside&amp;nbsp;smp_bt_attrs[] in smp_bt.c you can find that the characteristic permission is set to&amp;nbsp;BT_GATT_PERM_WRITE_AUTHEN and&amp;nbsp;BT_GATT_PERM_WRITE_AUTHEN when you enable&amp;nbsp;CONFIG_MCUMGR_SMP_BT_AUTHEN.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;This requires the link not only be encrypted but also authenticated. This means the pairing need to be with MITM protection (passkey, OOB , etc)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;But there isn&amp;#39;t a passkey_display function declared in&amp;nbsp;conn_auth_callbacks inside bluetooth.c so there is no MITM protection when you do bonding with the phone. This explains why the phone couldn&amp;#39;t do FOTA.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;So you have 2 options, one is to change the permission of the SMP_SVR characteristic to&amp;nbsp;BT_GATT_PERM_WRITE_ENCRYPT&amp;nbsp;and&amp;nbsp;BT_GATT_PERM_READ_ENCRYPT instead of _AUTHEN. So you&amp;nbsp;only request pairing without MITM.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Or&amp;nbsp; you can add a passkey display call back into bluetooth.c so that you can handle&amp;nbsp;pairing&amp;nbsp;with passkey. For example something like this:&amp;nbsp;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void auth_passkey_display(struct bt_conn *conn, unsigned int passkey)
{
	char addr[BT_ADDR_LE_STR_LEN];

	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));

	printk(&amp;quot;Passkey for %s: %06u\n&amp;quot;, addr, passkey);
}

static struct bt_conn_auth_cb conn_auth_callbacks = {
    .cancel = auth_cancel,
    .pairing_confirm = pairing_confirm,
    .pairing_complete = pairing_complete,
    .pairing_failed = pairing_failed,
    .passkey_display = auth_passkey_display,
};&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>