{"id":1262,"date":"2019-12-31T01:52:21","date_gmt":"2019-12-30T23:52:21","guid":{"rendered":"http:\/\/itsimple.info\/?p=1262"},"modified":"2019-12-31T01:52:21","modified_gmt":"2019-12-30T23:52:21","slug":"how-to-create-a-pfx-file-and-extract-private-key-and-certificate","status":"publish","type":"post","link":"https:\/\/itsimple.info\/?p=1262","title":{"rendered":"HOW TO CREATE A .PFX FILE AND EXTRACT PRIVATE KEY AND CERTIFICATE"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>When installing Certificate on application you will need the certificate in the form of certificate file and private key file separately, here is the stage to do so after you have installed certificate on windows certificate manager and you did so with the private key.<\/p>\n<p>First open MMC and -&gt; File-&gt; Add\/Remove Snap-in&#8230; &gt; Certificates &gt; Computer account &gt; Next &gt; Local computer &gt; Finish &gt; OK).<\/p>\n<p><a href=\"https:\/\/itsimple.info\/wp-content\/uploads\/2019\/12\/CertManager.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1263\" src=\"https:\/\/itsimple.info\/wp-content\/uploads\/2019\/12\/CertManager.png\" alt=\"\" width=\"1172\" height=\"619\" srcset=\"https:\/\/itsimple.info\/wp-content\/uploads\/2019\/12\/CertManager.png 1419w, https:\/\/itsimple.info\/wp-content\/uploads\/2019\/12\/CertManager-300x158.png 300w, https:\/\/itsimple.info\/wp-content\/uploads\/2019\/12\/CertManager-768x405.png 768w, https:\/\/itsimple.info\/wp-content\/uploads\/2019\/12\/CertManager-1024x541.png 1024w\" sizes=\"auto, (max-width: 1172px) 100vw, 1172px\" \/><\/a><\/p>\n<p>Next Choose your certificate and make sure it have The Private key sign on it : <a href=\"https:\/\/itsimple.info\/wp-content\/uploads\/2019\/12\/PrivatekeySign.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1264\" src=\"https:\/\/itsimple.info\/wp-content\/uploads\/2019\/12\/PrivatekeySign.png\" alt=\"\" width=\"19\" height=\"18\" \/><\/a><\/p>\n<p>Right Click on the certificate -&gt;All Tasks-&gt;\u00a0 export -&gt; make sure you choose to export with the private key -&gt; Check the box for &#8220;Include all certificates in the certification if possible&#8221; :<\/p>\n<p><a href=\"https:\/\/itsimple.info\/wp-content\/uploads\/2019\/12\/Privatekeyexport.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1265\" src=\"https:\/\/itsimple.info\/wp-content\/uploads\/2019\/12\/Privatekeyexport.png\" alt=\"\" width=\"528\" height=\"517\" srcset=\"https:\/\/itsimple.info\/wp-content\/uploads\/2019\/12\/Privatekeyexport.png 528w, https:\/\/itsimple.info\/wp-content\/uploads\/2019\/12\/Privatekeyexport-300x294.png 300w\" sizes=\"auto, (max-width: 528px) 100vw, 528px\" \/><\/a><\/p>\n<p>Check the box to &#8220;Export all extended properties&#8221; -&gt; Finish the wizard (you have to give a password for the file) and save the .PFX file .<\/p>\n<p>Now you have a .PFX file to work with, in order to extract the private key you will need to install openssl for windows, you can download it from <a href=\"https:\/\/slproweb.com\/products\/Win32OpenSSL.html\">here :\u00a0 https:\/\/slproweb.com\/products\/Win32OpenSSL.html <\/a><\/p>\n<p>or from<a href=\"http:\/\/gnuwin32.sourceforge.net\/packages\/openssl.htm\"> here : http:\/\/gnuwin32.sourceforge.net\/packages\/openssl.htm<\/a><\/p>\n<p>once installing you are ready to run the extraction command , You can run it from the bin directory of the OPENSSL installation\u00a0 and then just add the full path the the files:<\/p>\n<ol>\n<li>The *.PFX file is in PKCS#12 format and includes both the certificate and the private key.<\/li>\n<li>Run the following command to export the private key: <code>openssl pkcs12 -in certname.pfx -nocerts -out key.pem -nodes<\/code><\/li>\n<li>Run the following command to export the certificate: <code>openssl pkcs12 -in certname.pfx -nokeys -out cert.pem<\/code><\/li>\n<li>Run the following command to remove the passphrase from the private key: <code>openssl rsa -in key.pem -out server.key\u00a0<\/code><\/li>\n<\/ol>\n<p>now you have the private key as key.pem , the certificate only as cert.pem and the server.key as key file without password you had to insert when create the .PFX file<\/p>\n<hr \/>\n<h3>Good Luck<\/h3>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; &nbsp; When installing Certificate on application you will need the certificate in the form of certificate file and private key file separately, here is the stage to do so after you have installed certificate on windows certificate manager and you did so with the private key. First open MMC and -&gt; File-&gt; Add\/Remove Snap-in&#8230; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,21,22,12,14,15],"tags":[],"class_list":["post-1262","post","type-post","status-publish","format-standard","hentry","category-linux","category-operating-systems","category-security","category-tutorials","category-windows","category-windows-server"],"_links":{"self":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts\/1262","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1262"}],"version-history":[{"count":0,"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts\/1262\/revisions"}],"wp:attachment":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1262"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1262"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1262"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}