<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Rsa on Humberto Rocha</title><link>https://humberto.io/tags/rsa/</link><description>Recent content in Rsa on Humberto Rocha</description><generator>Hugo</generator><language>en</language><lastBuildDate>Mon, 10 Jul 2023 17:35:05 -0400</lastBuildDate><atom:link href="https://humberto.io/tags/rsa/index.xml" rel="self" type="application/rss+xml"/><item><title>Extract certificate and key from .pfx file</title><link>https://humberto.io/bits/extract-certificate-and-key-from-pfx-file/</link><pubDate>Mon, 10 Jul 2023 00:00:00 +0000</pubDate><guid>https://humberto.io/bits/extract-certificate-and-key-from-pfx-file/</guid><description>&lt;p&gt;Extract the certificate from the &lt;code&gt;.pfx&lt;/code&gt; file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;openssl pkcs12 -in &amp;lt;DOT_PFX_FILE&amp;gt; -clcerts -nokeys -chain -out certificate.crt
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Extract the private key in &lt;code&gt;.pem&lt;/code&gt; format without encryption from the &lt;code&gt;.pfx&lt;/code&gt; file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;openssl pkcs12 -in &amp;lt;DOT_PFX_FILE&amp;gt; -nocerts -nodes -out private_key.pem
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Convert the &lt;code&gt;.pem&lt;/code&gt; into &lt;code&gt;RSA&lt;/code&gt; key format:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#cdd6f4;background-color:#1e1e2e;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;openssl rsa -in private_key.pem -out id_rsa
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you are using OpenSSL 3 it will default it&amp;rsquo;s output to be in &lt;code&gt;PKCS8&lt;/code&gt; format, that contains encapsulation boundaries like this:&lt;/p&gt;</description></item></channel></rss>