<?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>Android application and Passkey</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/44995/android-application-and-passkey</link><description>nrf52832. 
 SDK14.2 
 Segger ES V3.34a 
 
 This question is probably best suited to an android forum (possibly). 
 
 We have a characteristic which is writable. When written to the peripheral asks our in house application to enter the passkey. The setting</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 29 Mar 2019 12:09:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/44995/android-application-and-passkey" /><item><title>RE: Android application and Passkey</title><link>https://devzone.nordicsemi.com/thread/179215?ContentTypeID=1</link><pubDate>Fri, 29 Mar 2019 12:09:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73727b14-57c8-440f-bdd8-35865057d2a0</guid><dc:creator>while(1)</dc:creator><description>&lt;p&gt;Hi Hung Bui,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I used a timeout handler to check a flag set by my password checking routine.&amp;nbsp; If the flag is not set i use this...&lt;/p&gt;
&lt;p&gt;ret_code_t err_code;&lt;/p&gt;
&lt;p&gt;err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);&lt;br /&gt; APP_ERROR_CHECK(err_code);&lt;/p&gt;
&lt;p&gt;Which then closes the connection.&lt;/p&gt;
&lt;p&gt;This is so simple and does exactly what we need,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android application and Passkey</title><link>https://devzone.nordicsemi.com/thread/177661?ContentTypeID=1</link><pubDate>Thu, 21 Mar 2019 15:56:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:808ad42f-a908-4a53-8af2-921c68926239</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Sure no problem. If you need a bit more secure, you can thinking of a public-private key pair.&amp;nbsp;This way you can keep the private key only on the phone or on the cloud and leaving only the public key on the device, making it a little bit safer.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android application and Passkey</title><link>https://devzone.nordicsemi.com/thread/177656?ContentTypeID=1</link><pubDate>Thu, 21 Mar 2019 15:46:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:163918c8-dc9a-4b01-88fb-498944dba761</guid><dc:creator>while(1)</dc:creator><description>&lt;p&gt;Understood.&lt;/p&gt;
&lt;p&gt;I will implement this, and let you know and verify your answer too.&lt;/p&gt;
&lt;p&gt;Thanks Hung Bui&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android application and Passkey</title><link>https://devzone.nordicsemi.com/thread/177644?ContentTypeID=1</link><pubDate>Thu, 21 Mar 2019 15:03:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa142bf5-570b-40d4-80c3-c55c930c0fe7</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;My idea is to implement a mechanism so that right after you connect the app to the device (you can do bonding or not doesn&amp;#39;t really mater), your app need to read the characteristic to get the random value (nounce ) . From that random value, the app need to use the secret key to generate a hash value and send back to the&amp;nbsp;device using a write. If within 10 seconds (or less) , the app failed to do that or the hash value is not correct, the device will drop the connection. Within that 10 seconds, the device won&amp;#39;t operate.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This process will be transparent to the end customer. If you reduce the timeout (instead of 10 seconds) it won&amp;#39;t be noticed by the end customer.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android application and Passkey</title><link>https://devzone.nordicsemi.com/thread/177551?ContentTypeID=1</link><pubDate>Thu, 21 Mar 2019 11:14:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:074846a0-71cf-4791-a6a7-cc0e7285a082</guid><dc:creator>while(1)</dc:creator><description>&lt;p&gt;We don&amp;#39;t want the user to have to enter any codes or even press OK ie no bonding.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I think this idea is good&lt;/p&gt;
[quote userid="2121" url="~/f/nordic-q-a/44995/android-application-and-passkey/177438"]One option you can think of is to have an extra layer of security on top of Bluetooth pairing. For example, after each connection establishment, your characteristic would generate a random value. The app on the phone need to read this and write a correspondent (using a hardcoded secret key and the random value) value back to the characteristic. [/quote]
&lt;p&gt;Not sure what you mean by&amp;nbsp;&lt;/p&gt;
[quote userid="2121" url="~/f/nordic-q-a/44995/android-application-and-passkey/177438"]After that your device start to operate[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But what bout this idea?... if this process is not fulfilled within a timeout, the peripheral&amp;nbsp;drops the connection. But as we don&amp;#39;t want the user interaction on the App (no bonding) we can&amp;#39;t have any security on the writable Characteristics.&amp;nbsp; So we will rely&amp;nbsp;purely on the connection being dropped before anything else can be written.&amp;nbsp; Or am I missing something?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android application and Passkey</title><link>https://devzone.nordicsemi.com/thread/177438?ContentTypeID=1</link><pubDate>Wed, 20 Mar 2019 16:22:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f9259e6f-f7c9-4dbe-a905-8ee3d8426ae2</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Paul,&amp;nbsp;&lt;br /&gt;Please be aware that passkey pairing is not considered secured. It would take much less than a second to decode it (compute&amp;nbsp;all 999999 possibilities).&amp;nbsp;Any sniffer can decode it. I don&amp;#39;t see any benefit for security here, especially when you used a fixed passkey.&amp;nbsp;&lt;br /&gt;If you want something secured you would need to use LE Secure connection instead of legacy pairing (not all old phones support this, requires BLE 4.2)&amp;nbsp;&lt;br /&gt;One option you can think of is to have an extra layer of security on top of Bluetooth pairing. For example, after each connection establishment, your characteristic would generate a random value. The app on the phone need to read this and write a correspondent (using a hardcoded secret key and the random value) value back to the characteristic. After that your device start to operate. This is very simple and there is a chance that if they can crack the code on one device/app, they would be able to crack all other devices. But it&amp;#39;s still beter than the &amp;quot;hidden passkey&amp;quot; approach.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android application and Passkey</title><link>https://devzone.nordicsemi.com/thread/177430?ContentTypeID=1</link><pubDate>Wed, 20 Mar 2019 16:03:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c7db448-a75c-4607-8c75-a719e276b880</guid><dc:creator>while(1)</dc:creator><description>&lt;p&gt;Or, is it possible to have authorisation after connection, where the App has to supply the key without the user knowing, maybe on a time out?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android application and Passkey</title><link>https://devzone.nordicsemi.com/thread/177315?ContentTypeID=1</link><pubDate>Wed, 20 Mar 2019 12:08:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7aa1873d-c038-4278-9580-9028d253bec6</guid><dc:creator>while(1)</dc:creator><description>&lt;p&gt;Hi Hung Bui,&lt;/p&gt;
&lt;p&gt;On some phones we can intercept the pairing request and populate the Passkey, without the user seeing.&amp;nbsp; Although some phones won&amp;#39;t let us do this.&amp;nbsp; It&amp;#39;s an inconsistency in security.&amp;nbsp; This was always possible on older versions, but newer versions seem to be locking down on this.&amp;nbsp;&amp;nbsp;Does this code work in all cases?&amp;nbsp; I&amp;#39;ll get our app expert to&amp;nbsp;take at look at it.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We want a way to prevent anyone just writing to our characteristics and for our app to auto populate the passkey, without the user seeing it, ideally.&amp;nbsp; Keeping the passkey secret would be nice.&lt;/p&gt;
&lt;p&gt;Is there a different way to achieve what we want, i appreciate&amp;nbsp; the above method is not secure as using NFC for example, but it would be a way of preventing someone with &amp;#39;nRFConnect&amp;#39; being a nuisance.&amp;nbsp; The data is not sensitive, it purely to stop &lt;span&gt;nuisance&amp;nbsp;&lt;/span&gt;attacks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android application and Passkey</title><link>https://devzone.nordicsemi.com/thread/177091?ContentTypeID=1</link><pubDate>Tue, 19 Mar 2019 14:35:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6871f20b-7b8f-45a9-8f2a-378d12168307</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Paul,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please correct me if I&amp;#39;m wrong, my understanding is that on some phones you can manage to populate the passkey and there was no dialogue/pop-up&amp;nbsp; ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Or your question is how to deal with different way of showing the text box either in pop-up or taskbar dialogue ?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m unfortunately not Android expert, but in our library we provided this&amp;nbsp;&lt;span&gt;&lt;a href="https://github.com/NordicSemiconductor/Android-BLE-Library/blob/master/ble/src/main/java/no/nordicsemi/android/ble/BleManager.java"&gt;onPairingRequestReceived&lt;/a&gt;() function. That you can use to enter the pin, but I think the end user still need to click OK.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Android application and Passkey</title><link>https://devzone.nordicsemi.com/thread/176756?ContentTypeID=1</link><pubDate>Mon, 18 Mar 2019 14:29:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d000c492-3407-40b6-9768-a37b7f476492</guid><dc:creator>while(1)</dc:creator><description>&lt;p&gt;Also&lt;/p&gt;
&lt;p&gt;The peripheral S132 only has LEDs, no screen or buttons, ideally we don&amp;#39;t want to use NFC.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>