{"id":4584,"date":"2025-07-01T17:44:28","date_gmt":"2025-07-01T17:44:28","guid":{"rendered":"https:\/\/geekmungus.co.uk\/?p=4584"},"modified":"2025-07-14T17:44:41","modified_gmt":"2025-07-14T17:44:41","slug":"separate-ssl-certificate","status":"publish","type":"post","link":"https:\/\/geekmungus.co.uk\/?p=4584","title":{"rendered":"Separate SSL Certificate"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Let&#8217;s say you have a certificate bundle in PKCS12 format, where you have the Private Key, the Public Key (Certificate Signed by a CA) and the Chain, and you need to break it down into its individual files for use within an application or the like. You can achieve this with the following set of commands, assuming your certificate bundle has a password which it really should as you have the Private Key in it; you&#8217;ll end up with three files.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Firstly put into a environment variable the certificate bundle password:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export CERTPASS=\"&lt;mypasswordhere>\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To get the Private Key:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>openssl pkcs12 \\\n    -in mycertfile.p12 \\\n    -out mycertfile-key.pem \\\n    -nocerts \\\n    -nodes \\\n    -passin env:CERTPASS<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To get the Public Key (Certificate):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>openssl pkcs12 \\\n    -in mycertfile.p12  \\\n    -out mycertfile-cert.pem \\\n    -clcerts \\\n    -nokeys \\\n    -passin env:CERTPASS<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To get the Chain, so the CA Certificate and any Intermediate Certificates:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>openssl pkcs12 \\\n    -in mycertfile.p12  \\\n    -out mycertfile-chain.pem \\\n    -cacerts \\\n    -nokeys \\\n    -passin env:CERTPASS<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And you&#8217;re done!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s say you have a certificate bundle in PKCS12 format, where you have the Private Key, the Public Key (Certificate Signed by a CA) and the Chain, and you need to break it down into its individual files for use within an application or the like. You can achieve this with the following set of &#8230; <a title=\"Separate SSL Certificate\" class=\"read-more\" href=\"https:\/\/geekmungus.co.uk\/?p=4584\" aria-label=\"Read more about Separate SSL Certificate\">Read more<\/a><\/p>\n","protected":false},"author":4,"featured_media":4299,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"class_list":["post-4584","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-fundamentals"],"_links":{"self":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4584","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4584"}],"version-history":[{"count":1,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4584\/revisions"}],"predecessor-version":[{"id":4585,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4584\/revisions\/4585"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/media\/4299"}],"wp:attachment":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}