<?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>LWM2M Client With X.509 Certificate</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/115127/lwm2m-client-with-x-509-certificate</link><description>Hello, 
 I am trying to run nRF sample of cellular LWM2M client on nRF9151 development kit that communicates with a custom Leshan server over the LTE-M. Security modes of no security and PSK seem to be working without any issues in the provided samples</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 20 Feb 2026 10:22:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/115127/lwm2m-client-with-x-509-certificate" /><item><title>RE: LWM2M Client With X.509 Certificate</title><link>https://devzone.nordicsemi.com/thread/561680?ContentTypeID=1</link><pubDate>Fri, 20 Feb 2026 10:22:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5786538-4edb-4a16-af26-31749b68a067</guid><dc:creator>SeppoTakalo</dc:creator><description>[quote userid="131464" url="~/f/nordic-q-a/115127/lwm2m-client-with-x-509-certificate/561402"]Certificates have a limited validity. How are they to be updated when programmed to the modem memory?[/quote]
&lt;p&gt;The update from LwM2M engine to modem is implemented in our extension to the Zephyr&amp;#39;s LwM2M client here&amp;nbsp;&lt;a id="" href="https://github.com/nrfconnect/sdk-nrf/blob/71ea8751dc421778f3f554e4db0c1c89d07351bc/subsys/net/lib/lwm2m_client_utils/lwm2m/lwm2m_security.c"&gt;https://github.com/nrfconnect/sdk-nrf/blob/71ea8751dc421778f3f554e4db0c1c89d07351bc/subsys/net/lib/lwm2m_client_utils/lwm2m/lwm2m_security.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So if you have&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_LWM2M_CLIENT_UTILS=y
CONFIG_LWM2M_CLIENT_UTILS_SECURITY_OBJ_SUPPORT=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;then certificates that are written into LwM2M engine&amp;#39;s registry, are automatically written to modem when connection is initiated.&lt;/p&gt;
&lt;p&gt;Bootstrap server writes credentials for LwM2M client. So it is used to rotate keys.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M Client With X.509 Certificate</title><link>https://devzone.nordicsemi.com/thread/561402?ContentTypeID=1</link><pubDate>Tue, 17 Feb 2026 19:01:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:212b1df4-1418-4896-a5c9-9a2d1714a1f7</guid><dc:creator>Maarten &amp;amp;quot;merethan&amp;amp;quot;</dc:creator><description>&lt;p&gt;Certificates have a limited validity. How are they to be updated when programmed to the modem memory?&lt;/p&gt;
&lt;p&gt;Same question with anything compiled in as a&amp;nbsp;&lt;code&gt;static const char&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This sounds to me,&amp;nbsp;when certificates are used as authorization &amp;amp; authentication mechanism, a device is essentially bricked after a year or two unless a FOTA update is done in time.&lt;/p&gt;
&lt;p&gt;This biennial FOTA update should then come with a new set of certificates and key. Or, when the certs &amp;amp; key are in the modem memory, somehow at&amp;nbsp;bootup figure which are programmed to it &amp;amp; update them if needed.&lt;/p&gt;
&lt;p&gt;Is my understanding correct here?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M Client With X.509 Certificate</title><link>https://devzone.nordicsemi.com/thread/504971?ContentTypeID=1</link><pubDate>Fri, 04 Oct 2024 10:42:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2eba2304-42d1-4d68-8ca0-7d0a0fc08e10</guid><dc:creator>SeppoTakalo</dc:creator><description>&lt;p&gt;Let me clarify few more things.&lt;br /&gt;&lt;br /&gt;When writing certificates and CA certificates to modem, please note that CA certificate that you write should be the one that is used by the target server. Not your own CA that you used to generate the client certificate.&lt;br /&gt;&lt;br /&gt;So then it depends on the server configuration whether it trust your own CA.&lt;br /&gt;And when you program the CA that server uses, then modem trusts the server.&lt;br /&gt;&lt;br /&gt;If we use Leshan as an example, you can fetch the server certificate with OpenSSL command line and use that as a CA chain that is programmed to the modem&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;openssl s_client -dtls -showcerts -connect leshan.eclipseprojects.io:5684
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Then what comes to&amp;nbsp;&lt;span&gt;&lt;strong&gt;lwm2m_security_set_certificate()&lt;/strong&gt;, it has a same effect as those separate writes in&amp;nbsp;&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/connectivity/networking/api/lwm2m.html#lwm2m_security_modes"&gt;LwM2M security modes&lt;/a&gt;. If you use that it&amp;nbsp;&lt;/span&gt;&lt;span&gt;&lt;span class="ui-provider bib bic gl anc and ane anf ang anh ani anj ank anl anm ann ano anp anq anr ans bid bie anv anw anx any anz aoa aob aoc aod aoe aof aog aoh" dir="ltr"&gt;causes certificates to be provisioned to the modem every time the client boots, which might not be wanted behaviour.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span class="ui-provider bib bic gl anc and ane anf ang anh ani anj ank anl anm ann ano anp anq anr ans bid bie anv anw anx any anz aoa aob aoc aod aoe aof aog aoh" dir="ltr"&gt;But anyhow, here is an example how to use it. Modify the&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/2ff9430caa1dcb226e6531f0f21fcba877e5cb27/samples/cellular/lwm2m_client/src/main.c#L261"&gt;lwm2m_setup&lt;/a&gt;() to look like this:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static int lwm2m_setup(void)
{
	/* Save power by not updating timestamp on device object */
	lwm2m_update_device_service_period(0);

	/* Manufacturer dependent */
	/* use IMEI as serial number */
	lwm2m_app_init_device(imei_buf);
	lwm2m_init_security(&amp;amp;client, endpoint_name, NULL);

	/* Security Mode */
	static const char certificate[] =
		&amp;quot;-----BEGIN CERTIFICATE-----\n&amp;quot;
		&amp;quot;...clip...&amp;quot;
		&amp;quot;-----END CERTIFICATE-----&amp;quot;;

	static const char key[] =
		&amp;quot;-----BEGIN EC PRIVATE KEY-----\n&amp;quot;
		&amp;quot;...clip...&amp;quot;
		&amp;quot;-----END EC PRIVATE KEY-----&amp;quot;;

	static const char root_ca[] =
		&amp;quot;-----BEGIN CERTIFICATE-----\n&amp;quot;
		&amp;quot;...clip...&amp;quot;
		&amp;quot;-----END CERTIFICATE-----&amp;quot;;

	lwm2m_set_string(&amp;amp;LWM2M_OBJ(LWM2M_OBJECT_SECURITY_ID, 0, 0), &amp;quot;coaps://leshan.eclipseprojects.io:5684&amp;quot;);
	lwm2m_security_set_certificate(0, certificate, sizeof(certificate), key, sizeof(key),
				       root_ca, sizeof(root_ca));
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M Client With X.509 Certificate</title><link>https://devzone.nordicsemi.com/thread/504887?ContentTypeID=1</link><pubDate>Thu, 03 Oct 2024 16:03:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c98f59a0-bd19-41ef-b815-b84083870703</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;The easiest way to run LwM2M client in X.509 mode is to write certificates to the modem before application starts.&lt;br /&gt;1. create own root CA certificate&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;## Generate private CA certificate
 
You only need to generate these once.
On a commercial operations, you don&amp;#39;t do this, but instead rely on real CA authority.
 
openssl ecparam -genkey -name prime256v1 -out ca.key
openssl req -x509 -new -SHA256 -nodes -key ca.key -days 3650 -subj &amp;#39;/O=My Company/CN=My root CA/&amp;#39; -out ca.crt

 &lt;/pre&gt;&lt;br /&gt;2. generate certificate and private key for your client device&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;## Generate certificate and private key for the client
 
openssl ecparam -genkey -name prime256v1 -out client.key
openssl req -x509 -new -SHA256 -nodes -key client.key -CA ca.crt -CAkey ca.key -subj &amp;#39;/CN=urn:imei:&amp;lt;your_15_digit_imei_goes_here&amp;gt;/&amp;#39; -out client.crt&lt;/pre&gt;&lt;br /&gt;3. flash the device with AT client sample and write certificates to the modem using nRF Cellular Monitor -&amp;gt; Certification Manager.&lt;br /&gt;4. build LwM2M application without default PSK key so that it uses whatever has been already provisioned&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;west build -b nrf9151dk/nrf9151/ns -- -DCONFIG_APP_LWM2M_PSK=&amp;quot;\&amp;quot;\&amp;quot;&amp;quot;&lt;/pre&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M Client With X.509 Certificate</title><link>https://devzone.nordicsemi.com/thread/504799?ContentTypeID=1</link><pubDate>Thu, 03 Oct 2024 09:36:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66c14b5a-b7e1-4ad9-b61f-d029d48a8a80</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;I have asked internally for more specific information with regard to your question. We will look into this. I will get back to you probably during next week.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M Client With X.509 Certificate</title><link>https://devzone.nordicsemi.com/thread/504545?ContentTypeID=1</link><pubDate>Tue, 01 Oct 2024 13:43:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b13b2d5-4a0a-4bd4-b9cb-eb310cae9c41</guid><dc:creator>tomgud</dc:creator><description>&lt;p&gt;I have seen the reference you provided, but it is not clear on how to implement it in the&amp;nbsp;&lt;span&gt;SDK v2.7.0 sample&amp;nbsp;&lt;/span&gt;&lt;strong&gt;&amp;quot;Cellular: LwM2M Client&amp;quot;&lt;/strong&gt;. Is&amp;nbsp;&lt;span&gt;&lt;span style="background-color:#999999;"&gt;lwm2m_security_set_certificate&lt;/span&gt; still needed when &lt;span style="background-color:#999999;"&gt;lwm2m_security_object_ids&lt;/span&gt; are being set? Could you please provide exact instructions on how to set up X.509 security object in the scope of the&amp;nbsp;&lt;strong&gt;&amp;quot;Cellular: LwM2M Client&amp;quot;&lt;/strong&gt; sample.&lt;br /&gt;&lt;br /&gt;Thanks!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: LWM2M Client With X.509 Certificate</title><link>https://devzone.nordicsemi.com/thread/504505?ContentTypeID=1</link><pubDate>Tue, 01 Oct 2024 10:56:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecf561ef-d4c6-4295-af75-0a8cced4a185</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;When X.509 certificates are used, it is necessary to set up security object for X.509 certificate mode. There are several lwm2m_security_object_ids that need to be set.&amp;nbsp;You can have a look at&amp;nbsp;&lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/connectivity/networking/api/lwm2m.html#lwm2m_security_modes"&gt;LwM2M security modes&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>