<?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>How to convert private key from text to hex value</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/62834/how-to-convert-private-key-from-text-to-hex-value</link><description>HI Team, 
 
 We have generated the private key from &amp;quot;nrfutil&amp;quot; tool and we want to integrate to our code, how to extract from python generated file &amp;quot;private.key&amp;quot; file to hex value. 
 Eg: 
 -----BEGIN EC PRIVATE KEY----- MHcCAQEEIJX5obLZDyFEMZtW3BrfvreBI90xu9QmcfdkbKxfvMPhoAoGCCqGSM49</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 20 Jun 2020 16:13:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/62834/how-to-convert-private-key-from-text-to-hex-value" /><item><title>RE: How to convert private key from text to hex value</title><link>https://devzone.nordicsemi.com/thread/256040?ContentTypeID=1</link><pubDate>Sat, 20 Jun 2020 16:13:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:921cb3b4-1466-4227-b352-16d3fb06c824</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;Left as excercise for the readers - see the --help command above. Hint: You need to change ONE character in each example...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to convert private key from text to hex value</title><link>https://devzone.nordicsemi.com/thread/256038?ContentTypeID=1</link><pubDate>Sat, 20 Jun 2020 15:17:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e42aec6c-1f9b-4e72-ac50-aedbada7e3bc</guid><dc:creator>Srinivas V</dc:creator><description>&lt;p&gt;Hi Turbo,&lt;/p&gt;
&lt;p&gt;Thanks for your reply, what ever you are showing is public key , but we want to see the private key in hex format the way public key shown here instead of text , why means we are testing ecc functionalities with hard coded keys (private/public) in our test app, for that we need this key pair. Originally we are not disclosing the private key.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Srinivas.V&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to convert private key from text to hex value</title><link>https://devzone.nordicsemi.com/thread/256035?ContentTypeID=1</link><pubDate>Sat, 20 Jun 2020 14:44:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75a903e1-4936-43dd-a342-66af984d54f0</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;Nrfutil knows a --help argument, which can be used for specific usages, too: &amp;quot;nrfutil.exe keys display --help&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;gt;nrfutil.exe keys display --key pk compromized_key.pem --format hex
Public (verification) key pk:
b16873663401d7cf05f51efbf930b8e9f83399da7b0aa4e3b0ee3dbf95eda93c35ce20003938ef63024e9a6a0f39d760b1c87ed21ae4d698e99faa3bd5cf7cb2

&amp;gt;nrfutil.exe keys display --key pk compromized_key.pem --format code

/* This file was automatically generated by nrfutil on 2020-06-20 (YY-MM-DD) at 16:42:01 */

#include &amp;quot;stdint.h&amp;quot;
#include &amp;quot;compiler_abstraction.h&amp;quot;

/** @brief Public key used to verify DFU images */
__ALIGN(4) const uint8_t pk[64] =
{
    0xb1, 0x68, 0x73, 0x66, 0x34, 0x01, 0xd7, 0xcf, 0x05, 0xf5, 0x1e, 0xfb, 0xf9, 0x30, 0xb8, 0xe9, 0xf8, 0x33, 0x99, 0xda, 0x7b, 0x0a, 0xa4, 0xe3, 0xb0, 0xee, 0x3d, 0xbf, 0x95, 0xed, 0xa9, 0x3c,
    0x35, 0xce, 0x20, 0x00, 0x39, 0x38, 0xef, 0x63, 0x02, 0x4e, 0x9a, 0x6a, 0x0f, 0x39, 0xd7, 0x60, 0xb1, 0xc8, 0x7e, 0xd2, 0x1a, 0xe4, 0xd6, 0x98, 0xe9, 0x9f, 0xaa, 0x3b, 0xd5, 0xcf, 0x7c, 0xb2
};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Unfortunately, the &lt;strong&gt;private key&lt;/strong&gt; posted here is now compromized and you must generate a new one. Remember: This forum is &lt;em&gt;public&lt;/em&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>