<?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>nrf9160: Adding intermediate certificates to the TLS engine</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/55393/nrf9160-adding-intermediate-certificates-to-the-tls-engine</link><description>Hello, 
 I am running into an issue attempting to add certificates to the device in order to facilitate HTTPS calls to our backend directly from the device. 
 Before the LTE modem has been configured I make a call to nrf_inbuilt_key_write in order to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 14 Jan 2020 13:45:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/55393/nrf9160-adding-intermediate-certificates-to-the-tls-engine" /><item><title>RE: nrf9160: Adding intermediate certificates to the TLS engine</title><link>https://devzone.nordicsemi.com/thread/229063?ContentTypeID=1</link><pubDate>Tue, 14 Jan 2020 13:45:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:985d40d7-d73e-4112-b337-eababbeae9f1</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;The chain file is the ordered list of all certificates. If you&amp;#39;re sure it&amp;#39;s under 8kB I&amp;#39;ll double-check with the developers again.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Could you run AT%CMNG=1 to list all storage certificates and keys?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: Adding intermediate certificates to the TLS engine</title><link>https://devzone.nordicsemi.com/thread/228638?ContentTypeID=1</link><pubDate>Fri, 10 Jan 2020 18:09:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7009b65b-6618-4063-a197-2940ddef1db9</guid><dc:creator>Cody</dc:creator><description>&lt;p&gt;Okay, so it sounds like if I have a certificate chain consisting of 3 certificates (which is less than the maximum amount of 4 intermediate certificates) but exceeds 4kB when put all together, this configuration is not supported for now?&lt;br /&gt;&lt;br /&gt;I guess I am just confused by what you mean when you say, &amp;quot;&lt;span&gt;The chain file for certificate chaining must be less than 8kB.&amp;quot; The three certificates that I need to add to the modem is just slightly over 6kB and all of them are well under 4 kB individually.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Can you confirm that this scenario (3 certificates, all under 4kB individually, over 6kB when combined) is unsupported? Note that I am not included the public/private key in this scenario.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: Adding intermediate certificates to the TLS engine</title><link>https://devzone.nordicsemi.com/thread/228585?ContentTypeID=1</link><pubDate>Fri, 10 Jan 2020 14:09:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4df0f86-b989-4f08-b245-f6178a247838</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Hi, there are unfortunately maximum sizes, see &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/56255/nrf_inbuilt_key_write-buffer-length-constraint"&gt;here&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;In release v1.1 of NCS the maximum size for one certificate is 4 kB, the maximum amount of intermediate certificates is 4 and the total flash size reserved for certificates is 7 x 8 kB. The chain file for certificate chaining must be less than 8kB.&lt;/p&gt;
&lt;p&gt;You could try using RSA 2048 keys or by using Elliptical Curve keys which are smaller than RSA.&lt;/p&gt;
&lt;p&gt;The developers have also confirmed that using two separate tags for two certificates chained together is not supported but could be in the future. You can contact your regional sales manager to ask for more information.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: Adding intermediate certificates to the TLS engine</title><link>https://devzone.nordicsemi.com/thread/228458?ContentTypeID=1</link><pubDate>Fri, 10 Jan 2020 03:48:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd5c1045-8a1d-4111-b0dd-7fc2453f8aba</guid><dc:creator>Cody</dc:creator><description>&lt;p&gt;Hey Heidi,&lt;/p&gt;
&lt;p&gt;It doesn&amp;#39;t appear to be working. I used openssl to verify that my private key does indeed match my public certificate using the instructions here:&amp;nbsp;&lt;a href="https://support.comodo.com/index.php?/Knowledgebase/Article/View/684/17/how-do-i-verify-that-a-private-key-matches-a-certificate-openssl"&gt;https://support.comodo.com/index.php?/Knowledgebase/Article/View/684/17/how-do-i-verify-that-a-private-key-matches-a-certificate-openssl&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;When I run&amp;nbsp;openssl s_client -showcerts -connect hostname:443 it shows me three different certificates in the chain.&lt;/p&gt;
&lt;p&gt;Also, if you don&amp;#39;t recommend writing the certificates from the application is there a preferred methodology?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: Adding intermediate certificates to the TLS engine</title><link>https://devzone.nordicsemi.com/thread/226236?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 23:29:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fddc9bc2-90f5-4173-8a43-3f1fb6f74c30</guid><dc:creator>Cody</dc:creator><description>&lt;p&gt;I will try this now.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: Adding intermediate certificates to the TLS engine</title><link>https://devzone.nordicsemi.com/thread/226202?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 15:27:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a3b41fa-cbdc-43fc-9582-9ed6f6196ff3</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Hi, Håkon is on vacation so I took over this case.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think you need to include all the CA certificates in the chain, as long as the root-certificate is approved and all the other certificates are signed.&amp;nbsp;Have you tried not including the&amp;nbsp;&lt;span&gt;additional intermediate certificate?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Side note: we don&amp;#39;t recommend writing certificates from the application.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Heidi&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: Adding intermediate certificates to the TLS engine</title><link>https://devzone.nordicsemi.com/thread/225751?ContentTypeID=1</link><pubDate>Mon, 16 Dec 2019 17:55:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:81f37982-93df-477e-9e8f-0effc80eeef5</guid><dc:creator>Cody</dc:creator><description>&lt;p&gt;Putting all of the certificates into the same certificates.h is what I am currently struggling with right now, if the certificate is too big, nrf_inbuilt_key_write will return me 1&lt;span&gt;05 (NRF_ENOBUFS).&lt;br /&gt;&lt;br /&gt;nrf_inbuilt_key_write appears to return an error code 105 (NRF_ENOBUFS) when the certificate #define is greater than about ~3800 characters. Unfortunately, the combined root CA certificate and the intermediate certificate is over 4100 characters.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: Adding intermediate certificates to the TLS engine</title><link>https://devzone.nordicsemi.com/thread/225697?ContentTypeID=1</link><pubDate>Mon, 16 Dec 2019 14:38:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6062836f-9dcb-4173-9da5-4baef90ba3ae</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Okay, it seems that the sec_tag list hasn&amp;#39;t been implemented properly on our part. There is another way to do it though. You can put all of the certificates in the same certificates.h file, look at the asset_tracker project for reference. If you need more than one CA certificate you should write something like this,&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define NRF_CLOUD_CA_CERTIFICATE \
	&amp;quot;-----BEGIN CERTIFICATE-----\n&amp;quot; \
	&amp;quot;NRF_CLOUD_CA_CERTIFICATE\n&amp;quot; \
	&amp;quot;-----END CERTIFICATE-----\n&amp;quot; \
	&amp;quot;-----BEGIN CERTIFICATE-----\n&amp;quot; \
	&amp;quot;NRF_CLOUD_CA_CERTIFICATE\n&amp;quot; \
	&amp;quot;-----END CERTIFICATE-----\n&amp;quot;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: Adding intermediate certificates to the TLS engine</title><link>https://devzone.nordicsemi.com/thread/225016?ContentTypeID=1</link><pubDate>Wed, 11 Dec 2019 18:30:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da3e5a4f-833c-4516-9673-98d28cde89e4</guid><dc:creator>Cody</dc:creator><description>&lt;p&gt;Hakon,&lt;br /&gt;&lt;br /&gt;I was able to test writing public, private, and the CA certificate to one security tag, and then the intermediate CA certificate to another security tag and adding both security tags to the sec_tag_list when calling setsockopt.&lt;/p&gt;
&lt;p&gt;This was unsuccessful.&lt;br /&gt;&lt;br /&gt;Also, in case you were wondering, I do have HTTPS working if I use a different combination of the public, private, and CA certificate for a different URL so I know it does work, just need to get it working when there is more than one CA certificate (intermediate certificates).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: Adding intermediate certificates to the TLS engine</title><link>https://devzone.nordicsemi.com/thread/225002?ContentTypeID=1</link><pubDate>Wed, 11 Dec 2019 17:04:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24f68336-7bd7-4c82-9bfa-082d6f0ec805</guid><dc:creator>Hakon</dc:creator><description>[quote user="CRSharff"]I suppose I can simply add an additional security tag to the security tag list[/quote]
&lt;p&gt;&amp;nbsp;As far as I know this is the way to do it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: Adding intermediate certificates to the TLS engine</title><link>https://devzone.nordicsemi.com/thread/224812?ContentTypeID=1</link><pubDate>Tue, 10 Dec 2019 18:57:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c974259c-3282-480a-8113-7e58022b55f3</guid><dc:creator>Cody</dc:creator><description>&lt;p&gt;Hakon,&lt;/p&gt;
&lt;p&gt;Thanks for the response. Are you suggesting that I should be able to write additional certificates to a separate security tag (sec_tag) and then when initializing the socket make two separate calls or I suppose I can simply add an additional security tag to the security tag list:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre class="ui-code" data-mode="c_cpp"&gt;err = setsockopt(fd, SOL_TLS, TLS_SEC_TAG_LIST, sec_tag_list,
			 sizeof(sec_tag_t) * ARRAY_SIZE(sec_tag_list));&lt;/pre&gt;
&lt;div&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;Let me try this and I will get back to you.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Thanks,&lt;br /&gt;Cody&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160: Adding intermediate certificates to the TLS engine</title><link>https://devzone.nordicsemi.com/thread/224769?ContentTypeID=1</link><pubDate>Tue, 10 Dec 2019 14:27:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f13c48a5-d7c2-4a48-84e7-6b2b22415d7b</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;if you want to write multiple certificates to the modem you can write them to different tags. Change the sec_tag argument in nrf_inbuilt_key_write() to something new. Be careful not to overwrite other certificates in the modem. You want to avoid writing to existing tags like for instance 16842753, which is being used by nrf_cloud certificates.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>