<?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>Provisioning the nRF Cloud Certificate to nrf9160-chip</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/91514/provisioning-the-nrf-cloud-certificate-to-nrf9160-chip</link><description>Is it possible to download the Certificate from a file or memory to chip with the internal SDK function? 
 I intend to automate the installation of the certificate on the device. 
 I am using nRF SDK v2.0.2. 
 I can&amp;#39;t find exact information anywhere about</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 08 Sep 2022 13:01:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/91514/provisioning-the-nrf-cloud-certificate-to-nrf9160-chip" /><item><title>RE: Provisioning the nRF Cloud Certificate to nrf9160-chip</title><link>https://devzone.nordicsemi.com/thread/385299?ContentTypeID=1</link><pubDate>Thu, 08 Sep 2022 13:01:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16321bff-ca13-41fa-b8f5-1b27b2061edd</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Yes, the asset_tracker_v2 that I referred to is a good example for how certificates can be provisioned from a file.&lt;/p&gt;
[quote user="AlpoLe"]Can you give the name of the function?[/quote]
&lt;p&gt;modem_key_mgmt_write(), or you can use the AT%CMNG command to store certificates.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Provisioning the nRF Cloud Certificate to nrf9160-chip</title><link>https://devzone.nordicsemi.com/thread/384501?ContentTypeID=1</link><pubDate>Mon, 05 Sep 2022 08:10:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7a5526e-168c-4678-98e4-c0faae014cc5</guid><dc:creator>Alpo Leinonen</dc:creator><description>&lt;p&gt;I found this code:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/* Provisions root CA certificate using modem_key_mgmt API */
static int nct_provision(void)
{
	static sec_tag_t sec_tag_list[] = { CONFIG_NRF_CLOUD_SEC_TAG };

	nct.tls_config.peer_verify = 2;
	nct.tls_config.cipher_count = 0;
	nct.tls_config.cipher_list = NULL;
	nct.tls_config.sec_tag_count = ARRAY_SIZE(sec_tag_list);
	nct.tls_config.sec_tag_list = sec_tag_list;
	nct.tls_config.hostname = NRF_CLOUD_HOSTNAME;

#if defined(CONFIG_NRF_CLOUD_PROVISION_CERTIFICATES)
#if defined(CONFIG_NRF_MODEM_LIB)
	{
		int err;

		/* Delete certificates */
		nrf_sec_tag_t sec_tag = CONFIG_NRF_CLOUD_SEC_TAG;

		for (enum modem_key_mgmt_cred_type type = 0; type &amp;lt; 5;
		     type++) {
			err = modem_key_mgmt_delete(sec_tag, type);
			LOG_DBG(&amp;quot;modem_key_mgmt_delete(%u, %d) =&amp;gt; result = %d&amp;quot;,
				sec_tag, type, err);
		}

		/* Provision CA Certificate. */
		err = modem_key_mgmt_write(CONFIG_NRF_CLOUD_SEC_TAG,
					   MODEM_KEY_MGMT_CRED_TYPE_CA_CHAIN,
					   ca_certificate,
					   strlen(ca_certificate));
		if (err) {
			LOG_ERR(&amp;quot;ca_certificate err: %d&amp;quot;, err);
			return err;
		}

		/* Provision Private Certificate. */
		err = modem_key_mgmt_write(
			CONFIG_NRF_CLOUD_SEC_TAG,
			MODEM_KEY_MGMT_CRED_TYPE_PRIVATE_CERT,
			private_key,
			strlen(private_key));
		if (err) {
			LOG_ERR(&amp;quot;private_key err: %d&amp;quot;, err);
			return err;
		}

		/* Provision Public Certificate. */
		err = modem_key_mgmt_write(
			CONFIG_NRF_CLOUD_SEC_TAG,
			MODEM_KEY_MGMT_CRED_TYPE_PUBLIC_CERT,
			device_certificate,
			strlen(device_certificate));
		if (err) {
			LOG_ERR(&amp;quot;device_certificate err: %d&amp;quot;,
				err);
			return err;
		}
	}
#else
	{
		int err;

		err = tls_credential_add(CONFIG_NRF_CLOUD_SEC_TAG,
					 TLS_CREDENTIAL_CA_CERTIFICATE,
					 ca_certificate,
					 sizeof(ca_certificate));
		if (err &amp;lt; 0) {
			LOG_ERR(&amp;quot;Failed to register ca certificate: %d&amp;quot;, err);
			return err;
		}
		err = tls_credential_add(CONFIG_NRF_CLOUD_SEC_TAG,
					 TLS_CREDENTIAL_PRIVATE_KEY,
					 private_key,
					 sizeof(private_key));
		if (err &amp;lt; 0) {
			LOG_ERR(&amp;quot;Failed to register private key: %d&amp;quot;, err);
			return err;
		}
		err = tls_credential_add(
			CONFIG_NRF_CLOUD_SEC_TAG,
			TLS_CREDENTIAL_SERVER_CERTIFICATE,
			device_certificate,
			sizeof(device_certificate));
		if (err &amp;lt; 0) {
			LOG_ERR(&amp;quot;Failed to register public certificate: %d&amp;quot;,
				err);
			return err;
		}
	}
#endif /* defined(CONFIG_NRF_MODEM_LIB) */
#endif /* defined(CONFIG_NRF_CLOUD_PROVISION_CERTIFICATES) */

	return 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Could I have an example of how to use this?&lt;/p&gt;
&lt;div id="gtx-trans" style="left:-14px;position:absolute;top:239.159px;"&gt;
&lt;div class="gtx-trans-icon"&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Provisioning the nRF Cloud Certificate to nrf9160-chip</title><link>https://devzone.nordicsemi.com/thread/384337?ContentTypeID=1</link><pubDate>Thu, 01 Sep 2022 12:29:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c09d3545-4280-498b-8ccd-f4e18ab50cdf</guid><dc:creator>Alpo Leinonen</dc:creator><description>&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1662034278185v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;div class="FFpbKc"&gt;&lt;span class="ZTPlmc"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="ZyvIDe"&gt;
&lt;div class="a8FIud X0rvP L6rCcb" data-apply-responsive-style="true" data-classes="" data-initial-translation-length="38" data-saved-translation-limit-reached="false"&gt;
&lt;div data-show-delay-ms="250" data-append-to-body="false" data-propagate-tooltip-mouseover-events="true" data-anchor-corner="bottom-end" data-enable-skip-handler="false" data-popup-corner="top-end"&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class="dePhmb"&gt;
&lt;div class="eyKpYb" data-language="en" data-original-language="fi" data-result-index="0"&gt;
&lt;div class="J0lOec"&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fi" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;I can&amp;#39;t find any solution here!&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="J0lOec"&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fi" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="J0lOec"&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fi" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;Can you give the name of the function?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="J0lOec"&gt;&lt;span class="VIiyi" lang="en"&gt;&lt;span class="JLqJ4b ChMk0b" data-language-for-alternatives="en" data-language-to-translate-into="fi" data-phrase-index="0" data-number-of-phrases="1"&gt;&lt;span class="Q4iAWc"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Provisioning the nRF Cloud Certificate to nrf9160-chip</title><link>https://devzone.nordicsemi.com/thread/384327?ContentTypeID=1</link><pubDate>Thu, 01 Sep 2022 12:00:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7673e922-933f-43da-b074-34a2351293ed</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]Is it possible to download the Certificate from a file or memory to chip with the internal SDK function?[/quote]
&lt;p&gt;Yes, you can see how it is done in asset_tracker_v2/src/cloud-certs.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>