<?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>Generate Keys with nrfutil</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/49550/generate-keys-with-nrfutil</link><description>Hi, 
 
 Our device is based on nRF52840 + SDK 15.0.0 and we use cc310 backend for crypto tasks 
 Messages and SW packages are signed by Ecdsa. 
 
 I installed nrfutil and try to generate paired keys (see below for the keys). 
 
 I tried to test the key</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 24 Jul 2019 05:57:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/49550/generate-keys-with-nrfutil" /><item><title>RE: Generate Keys with nrfutil</title><link>https://devzone.nordicsemi.com/thread/200179?ContentTypeID=1</link><pubDate>Wed, 24 Jul 2019 05:57:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f4bcdef5-4ed9-45e0-9b66-eaec76d9a685</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;You can try to modify the full cc310 backend&amp;nbsp;using the bl variant as a reference.&amp;nbsp;Search for&amp;nbsp;&amp;nbsp;NRF_CRYPTO_BACKEND_CC310_BL_ECC_LITTLE_ENDIAN_ENABLED and&amp;nbsp;NRF_CRYPTO_BACKEND_CC310_BL_HASH_LITTLE_ENDIAN_DIGEST_ENABLED in the bootloader backend.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Generate Keys with nrfutil</title><link>https://devzone.nordicsemi.com/thread/199807?ContentTypeID=1</link><pubDate>Mon, 22 Jul 2019 13:09:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23f1502b-da9e-4fb6-a48c-fd53cf1791d1</guid><dc:creator>yes</dc:creator><description>&lt;p&gt;We intend to use nrfutil for signing data packet which can&amp;#39;t be transffered over DFU&lt;/p&gt;
&lt;p&gt;As mentioned above nrfutil generates little endian byte order pair key&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It signs package using private key pem file&lt;/p&gt;
&lt;p&gt;We can convert the pem format into hex format and swap key endianness but can&amp;#39;t convert it back to pem format.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As mention above there is the flag &lt;span&gt;NRF_CRYPTO_BACKEND_MICRO_ECC_LITTLE_ENDIAN_ENABLED but it only for CC310 boot loader mode&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Is there a way to force CC310 backend (not BL mode) to use little endianness byte order?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks in advance&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Generate Keys with nrfutil</title><link>https://devzone.nordicsemi.com/thread/198168?ContentTypeID=1</link><pubDate>Fri, 12 Jul 2019 12:41:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e182d60b-085e-4dc8-a8d2-b78c9cf4d1ed</guid><dc:creator>Vidar Berg</dc:creator><description>[quote userid="71582" url="~/f/nordic-q-a/49550/generate-keys-with-nrfutil/198156"]Just to be sure I understand. The keys pairs which are generated by nrfutil should be used as is for signing sw if we use dfu but should be endianness reversed otherwise?[/quote]
&lt;p&gt;Correct. I&amp;#39;m not sure why we are using a different byte order in the bootloader.&amp;nbsp;Excerpt&amp;nbsp;from sdk_config:&lt;/p&gt;
&lt;p&gt;NRF_CRYPTO_BACKEND_MICRO_ECC_LITTLE_ENDIAN_ENABLED - Enable &lt;strong&gt;non-standard little endian&lt;/strong&gt; byte order.&lt;/p&gt;
&lt;p&gt;// &amp;lt;i&amp;gt; This affects parameters for all ECC API (raw keys, signature, digest, shared secret). Only for use in nRF SDK DFU!&lt;/p&gt;
[quote userid="71582" url="~/f/nordic-q-a/49550/generate-keys-with-nrfutil/198156"]Do we need to reverse endianness of both private and public keys?[/quote]
&lt;p&gt;Yes.&lt;/p&gt;
[quote userid="71582" url="~/f/nordic-q-a/49550/generate-keys-with-nrfutil/198156"]For the public key (64 bytes) should we use&amp;nbsp; double swap Nordic&amp;#39;s function?[/quote]
&lt;p&gt;It should work as long as you set the size to 32 bytes.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Generate Keys with nrfutil</title><link>https://devzone.nordicsemi.com/thread/198156?ContentTypeID=1</link><pubDate>Fri, 12 Jul 2019 12:09:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fddb8f03-7ac6-4d80-ad21-6ac15c727697</guid><dc:creator>yes</dc:creator><description>&lt;p&gt;Thanks for the answer.&lt;/p&gt;
&lt;p&gt;Just to be sure I understand. The keys pairs which are generated by nrfutil should be used as is for signing sw if we use dfu but should be endianness reversed otherwise?&lt;/p&gt;
&lt;p&gt;Do we need to reverse endianness of both private and public keys?&lt;/p&gt;
&lt;p&gt;For the public key (64 bytes) should we use&amp;nbsp; double swap Nordic&amp;#39;s function?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks in advance&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Generate Keys with nrfutil</title><link>https://devzone.nordicsemi.com/thread/198140?ContentTypeID=1</link><pubDate>Fri, 12 Jul 2019 11:32:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71f8bbbb-b1f9-45de-b0d3-f05fb61b8196</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The key pair format (endianess) from nrfutil is made to be used with the bootloader. But you can make it work by reversing the endianess (32 bytes at a time).&amp;nbsp;But I didn&amp;#39;t manage to make it work with the key-pair you posted, maybe I copied it in wrong. In any case, here is my private key and converted arrays that I used to verify this here:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;__ALIGN(4) static const uint8_t m_alice_raw_private_key[] =
{
    0x97, 0x36, 0x50, 0x4f, 0xda, 0x46, 0x8d, 0x57, 
    0x4e, 0xd2, 0xe3, 0x2d, 0x8a, 0xa3, 0x8a, 0x21, 
    0x99, 0x0f, 0x4f, 0xe1, 0xd6, 0x45, 0xbd, 0xc0, 
    0x58, 0x17, 0xf7, 0xe4, 0xc4, 0x26, 0x5f, 0xf5
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;__ALIGN(4) static const uint8_t m_alice_raw_public_key[] = 
{
    0x7e, 0x2e, 0x9d, 0xe0, 0x5a, 0x52, 0x1e, 0xfc, 
    0xe6, 0x2d, 0xd4, 0x9c, 0x26, 0xfb, 0x26, 0x5b, 
    0x8f, 0xdd, 0xf0, 0xef, 0xd2, 0x09, 0xe5, 0xce, 
    0xc7, 0x33, 0x44, 0x3f, 0xe5, 0x5e, 0x8c, 0x97,
    /**********************************************/
    0xa8, 0x93, 0x3e, 0xd5, 0x80, 0xdd, 0xb2, 0xfd, 
    0x8d, 0xdf, 0x9e, 0x9d, 0xf5, 0x78, 0xc2, 0xd1,
    0x4c, 0x94, 0x24, 0x85, 0x22, 0xfd, 0xca, 0x3f, 
    0x8d, 0x67, 0x3f, 0xa0, 0x00, 0x1d, 0x2a, 0xc1
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-716e6bceadd94bcbb77e5f5b2f1b9907/private.zip"&gt;devzone.nordicsemi.com/.../private.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Generate Keys with nrfutil</title><link>https://devzone.nordicsemi.com/thread/197401?ContentTypeID=1</link><pubDate>Tue, 09 Jul 2019 13:27:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6744f67d-1325-4810-9d5c-757960a25fd1</guid><dc:creator>yes</dc:creator><description>&lt;p&gt;This is the generated private key&amp;nbsp;as file&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;-----BEGIN EC PRIVATE KEY----- MHcCAQEEIJHbl8Fsig7P/8uyw2vKuKg7mpRtWiiujlPwhHLHTgtVoAoGCCqGSM49 AwEHoUQDQgAERChrfqTcXL9QhbGDLLwl5o6yb/Xvztut0OduaAtwT5H9lW6mgT/r 6hvLlWGGUryr+OtoWk3pKcuQA/RIIexD/Q== -----END EC PRIVATE KEY-----&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>