<?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>nrf52 data encryption and decryption using ecc</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/60521/nrf52-data-encryption-and-decryption-using-ecc</link><description>Dear All, 
 I need to understand how the Asymmetric Encryption work in BLE. From Nordic, I get to know the following that following are the nrf_crypto frontend modules 
 
 AES - Advanced Encryption Standard 
 AEAD - Authenticated Encryption with Associated</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 29 Apr 2020 07:25:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/60521/nrf52-data-encryption-and-decryption-using-ecc" /><item><title>RE: nrf52 data encryption and decryption using ecc</title><link>https://devzone.nordicsemi.com/thread/247223?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2020 07:25:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95e04a79-b14d-468c-8225-4ab9fd286d04</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It would be good if you clarified what you want to do.&lt;/p&gt;
&lt;p&gt;Dimitry&amp;#39;s answer describes how ECC is used&amp;nbsp;in BLE, and that gives you an encrypted BLE link, meaning that tall data sent over the link is encrypted. This is how it is done in BLE (using LE Secure Connections). So if you&amp;nbsp;just want to encrypt your link in a secure, just use what we provide in the SDK, and make sure you use LESC.&lt;/p&gt;
&lt;p&gt;If you want to encrypt data in an application-specific way, then you can refer to the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/lib_crypto.html"&gt;nrf_crypto library&lt;/a&gt; and &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/crypto_examples_nrf_crypto.html"&gt;nrf_crypto examples&lt;/a&gt;. Please note that actually encrypting the data using ECC is seldom sensible, which is why most crypto systems use ECC (or other asymmetric public-key cryptography algorithms) to generate the shared secret only, and then use AES or some other symmetric algorithm, as that has much better performance.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 data encryption and decryption using ecc</title><link>https://devzone.nordicsemi.com/thread/247196?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2020 04:47:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d5ffc162-0ec4-4f4f-9d11-3a2a03b036c0</guid><dc:creator>Jinesh</dc:creator><description>&lt;p&gt;Hi Dmity,&lt;/p&gt;
&lt;p&gt;Thanks for the support,&lt;/p&gt;
&lt;p&gt;I went to the HMAC example code, there i have&amp;nbsp;found that mechanism to generated the &lt;strong&gt;Secret key&lt;/strong&gt; by the devices using it&amp;#39;s private key and public key of other devices.&lt;/p&gt;
&lt;p&gt;But i am more interested, how can i&amp;nbsp;&lt;span&gt;encrypt and decrypt my data using this&amp;nbsp;&lt;strong&gt;Secret&amp;nbsp;key.&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 data encryption and decryption using ecc</title><link>https://devzone.nordicsemi.com/thread/247193?ContentTypeID=1</link><pubDate>Wed, 29 Apr 2020 04:41:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01cce389-7f9c-4383-bcd0-723b5d71ce93</guid><dc:creator>Jinesh</dc:creator><description>&lt;p&gt;Hi Dmity,&lt;/p&gt;
&lt;p&gt;I am more interested in the example how we can encrypt and decrypt the data.with&amp;nbsp;&lt;strong&gt;ECC - Elliptic Curve Cryptography method.&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf52 data encryption and decryption using ecc</title><link>https://devzone.nordicsemi.com/thread/245999?ContentTypeID=1</link><pubDate>Wed, 22 Apr 2020 10:41:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2dc62753-5e2c-44a6-8812-9b9053313fda</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;Hi Jinesh,&lt;/p&gt;
&lt;p&gt;Are you interesting how asymmetric cryptography is implemented for LESC pairing in BLE, or you just want to encrypt some data with your own code?&lt;/p&gt;
&lt;p&gt;In ECC cryptography, public and private keys are not used directly to encrypt data. Instead, each party generates its own key pair using nrf_crypto_ecc_key_pair_generate(), then both parties exchange with their public keys - that&amp;#39;s called Diffie-Hellman algorithm, ECDH. Function nrf_crypto_ecdh_compute() takes own private key and other party&amp;#39;s public key, the result is a shared secret (ECDH mathematic ensures that it will be the same at both sides). This shared secret is transformed to a session key with key derivation function&lt;span&gt;&amp;nbsp;&lt;/span&gt;(BLE uses HMAC-SHA-256 for this step), then session key is used to encrypt data with symmetric encryption algorithm (AES).&lt;br /&gt;You can find examples for ECDH,&lt;span&gt;&amp;nbsp;&lt;/span&gt;HMAC&lt;span&gt;&amp;nbsp;&lt;/span&gt;and AES in SDK under examples/crypto/nrf_crypto.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>