<?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>Using %KEYGEN to generate CSR with the ECC private key</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/76619/using-keygen-to-generate-csr-with-the-ecc-private-key</link><description>Hello, 
 as discussed in the email with Joakim T., could you please provide us a sample of how to use AT command %KEYGEN to generate CSR using the ECC private key? If you would provide us the whole process of generation example CA with ECC instead of</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 06 Aug 2021 08:39:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/76619/using-keygen-to-generate-csr-with-the-ecc-private-key" /><item><title>RE: Using %KEYGEN to generate CSR with the ECC private key</title><link>https://devzone.nordicsemi.com/thread/323665?ContentTypeID=1</link><pubDate>Fri, 06 Aug 2021 08:39:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e0f5d801-2aa5-4add-ad6b-8a551759c9eb</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My apologies for the long wait.&lt;/p&gt;
[quote user="LaKy"]Did we do the best or we could do better?[/quote]
&lt;p&gt;I am sorry, but we do not have any suggestions wrt. generating a small footprint cert, unfortunately.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using %KEYGEN to generate CSR with the ECC private key</title><link>https://devzone.nordicsemi.com/thread/323653?ContentTypeID=1</link><pubDate>Fri, 06 Aug 2021 07:43:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:edceb951-c9a5-4dd5-b900-a3c872dd4b56</guid><dc:creator>Luk&amp;#225;š</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;H&amp;aring;kon, any thoughts on this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using %KEYGEN to generate CSR with the ECC private key</title><link>https://devzone.nordicsemi.com/thread/320148?ContentTypeID=1</link><pubDate>Thu, 15 Jul 2021 06:55:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57aca242-7c28-42ac-86d1-6fa74e84cb55</guid><dc:creator>Luk&amp;#225;š</dc:creator><description>&lt;p&gt;To make it even simpler I created an OpenSSL sequence of commands that will get into the final certificate size of ~350 bytes. You have to rename the CA certs and client certificate of course.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;openssl ecparam -name secp256k1 -genkey -noout -out secp256k1_prv.der -outform DER
openssl ec -in secp256k1_prv.der -inform der -pubout -out secp256k1_pub.der -outform DER  
openssl req -key secp256k1_prv.der -keyform der -out CSR.csr -new
python create_ca_cert.py -c CZ
python create_device_credentials.py -ca test_ca.pem -ca_key test_prv.pem -csr CSR.csr -dv 2000
openssl x509 -outform der -in client_crt.pem -out client_crt.der&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using %KEYGEN to generate CSR with the ECC private key</title><link>https://devzone.nordicsemi.com/thread/319952?ContentTypeID=1</link><pubDate>Wed, 14 Jul 2021 08:26:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ab68fa2-7a41-4bd0-b9ac-e2e9de8a2a2c</guid><dc:creator>Luk&amp;#225;š</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;H&amp;aring;kon, thanks for the reply. The keygen now works fine and everything makes sense. I have one more question for you and it is about ECC client certificate sizes because we plan to use them for DTLS.&lt;/p&gt;
&lt;p&gt;Do you have any tips on how to make the ECC client certificate as small as possible? Here is what I did.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Generate the corresponding public and private key pair using ECC&amp;nbsp;secp256k1 curve (either with %KEYGEN or openssl).&lt;/li&gt;
&lt;li&gt;Create the CSR and fill only the CN to reduce the final certificate size.&lt;/li&gt;
&lt;li&gt;Generate the minimum CA cert with python create_ca_cert.py -c CZ&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Create the client certificate with&amp;nbsp;python create_device_credentials.py using CA Cert and CSR&lt;/li&gt;
&lt;li&gt;Convert the client certificate from PEM to DER (binary format) to reduce its final size.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The result:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;Client certificate in DER format - 351 bytes&lt;/strong&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Client certificate in PEM format - 530 bytes&lt;/li&gt;
&lt;li&gt;Client public key size in PEM format - 178 bytes&lt;/li&gt;
&lt;li&gt;Client private key size in PEM format -&amp;nbsp;228 bytes&lt;/li&gt;
&lt;li&gt;Client CSR size - 436 bytes&lt;/li&gt;
&lt;li&gt;CA certificate in PEM format - 576 bytes&lt;/li&gt;
&lt;li&gt;CA certificate private key in PEM format - 241 bytes&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Se the smallest certificate for DTLS we have been able to get is 351 bytes. Did we do the best or we could do better?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Lukas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Using %KEYGEN to generate CSR with the ECC private key</title><link>https://devzone.nordicsemi.com/thread/316602?ContentTypeID=1</link><pubDate>Wed, 23 Jun 2021 07:09:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:519d2238-cb5d-4e29-a0d9-9383bae12247</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]as discussed in the email with Joakim T.,&amp;nbsp;could you please provide us a sample of how to use AT command %KEYGEN to generate CSR using the ECC private key? If you would provide us the whole process of generation example CA with ECC instead of RSA - that would be great.[/quote]
&lt;p&gt;My apologies, this section of the AT commands is not fully documented, which I&amp;#39;ve reported internally.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can generate a key based on the &lt;a href="https://infocenter.nordicsemi.com/topic/ref_at_commands/REF/at_commands/security/keygen_set.html?cp=2_1_11_9_0"&gt;%KEYGEN&lt;/a&gt; at command:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;AT%KEYGEN=&amp;lt;sec_tag&amp;gt;,2,0,&amp;quot;L=&amp;lt;YourLocation&amp;gt;,C=&amp;lt;YourCommonName&amp;gt;,O=&amp;lt;YourOrg&amp;gt;&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;output from this AT command can be converted into a more recognizable format using this python script:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/nRFCloud/utils/tree/master/python/modem-firmware-1.3%2B"&gt;https://github.com/nRFCloud/utils/tree/master/python/modem-firmware-1.3%2B&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The above script(s) also provide example usage.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>