<?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 RSA keys from .pem to .der and vice versa by using psa in nrf52840</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/118931/how-to-convert-rsa-keys-from-pem-to-der-and-vice-versa-by-using-psa-in-nrf52840</link><description>Hello, 
 
 I am trying to convert .pem RSA keys which we are getting externally into .der and vice versa, because in &amp;quot;psa_import_key&amp;quot; function we can only use in keys .der format. 
 I am using ncs- 2.6.0 version 
 Board: nrf52840 
 Please guide us how</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 20 Feb 2025 09:00:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/118931/how-to-convert-rsa-keys-from-pem-to-der-and-vice-versa-by-using-psa-in-nrf52840" /><item><title>RE: How to Convert RSA keys from .pem to .der and vice versa by using psa in nrf52840</title><link>https://devzone.nordicsemi.com/thread/523826?ContentTypeID=1</link><pubDate>Thu, 20 Feb 2025 09:00:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12c6676c-22b4-4424-826d-bd296060af99</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I have checked this a bi tmore, and this is unfortunately far from staright-forward. If possible, it would be better and much simpler to do conversion to/from PEM externally and only import raw keys to the nRF (and the same if you need to export keys).&lt;/p&gt;
&lt;p&gt;For instance, if you have a private key in PEM format, you can convert it to a raw key like this using openssl:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;openssl rsa -inform PEM -outform DER -in &amp;lt;infilename&amp;gt; -out &amp;lt;outfilename&amp;gt;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Convert RSA keys from .pem to .der and vice versa by using psa in nrf52840</title><link>https://devzone.nordicsemi.com/thread/523168?ContentTypeID=1</link><pubDate>Mon, 17 Feb 2025 06:48:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29498b8a-cc3c-417f-a443-34bbf488ff10</guid><dc:creator>Sakshi_0806</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am using &amp;quot;mbedtls_pk_parse_public_key&amp;quot; function and then &amp;quot;mbedtls_pk_write_pubkey_der&amp;quot; this function but how can i enable these two function definition in my target? by enabling which macro we can do that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to Convert RSA keys from .pem to .der and vice versa by using psa in nrf52840</title><link>https://devzone.nordicsemi.com/thread/522905?ContentTypeID=1</link><pubDate>Thu, 13 Feb 2025 14:49:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88f4db54-398a-4a72-a0c4-68eaf8d747c2</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Do you need to do it on target, or can you do it using&amp;nbsp;&lt;code&gt;openssl x509 &lt;/code&gt;or similar? On target, it could be done using&amp;nbsp;&lt;code&gt;mbedtls_pk_parse_key()&lt;/code&gt; and then &lt;code&gt;mbedtls_pk_import_into_psa()&lt;/code&gt; for newer SDK versions, but not 2.6 (as described &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/108824/importing-ecc-private-key-from-pem-to-psa-and-error-using-mbedtls-helper-functions/473294"&gt;here&lt;/a&gt;).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>