{"id":1820,"date":"2013-01-21T14:41:58","date_gmt":"2013-01-21T06:41:58","guid":{"rendered":"http:\/\/rmohan.com\/?p=1820"},"modified":"2013-01-21T14:41:58","modified_gmt":"2013-01-21T06:41:58","slug":"how-do-i-convert-a-pfx-to-be-used-with-an-apache-server","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=1820","title":{"rendered":"How do I convert a .pfx to be used with an Apache server?"},"content":{"rendered":"<p>How do I convert my .pfx file to be used with an Apache server?<\/p>\n<p><strong>Answer:<\/p>\n<p><\/strong>The Apache server will require the following two files:<\/p>\n<p>1 &#8211; Server.ker : the private key associated with the certificate<br \/>2 &#8211; Server.crt :\u00a0 the public SSL certificate issued by Entrust<\/p>\n<p>Using Open SSL, you can extract the certificate and private key. <\/p>\n<p>To extract the private key from a .pfx file, run the following OpenSSL command:<\/p>\n<p><strong>openssl.exe pkcs12 -in myCert.pfx -nocerts -out privateKey.pem<br \/><\/strong><br \/>The private key that you have extract will be encrypted. To unencrypt the file so that it can be used, you want to run the following command:<\/p>\n<p><strong>openssl.exe rsa -in privateKey.pem -out private.pem<br \/><\/strong><br \/>The resulting <strong>private.pem<\/strong> file should be the key file that you want. Open it up using notepad to make sure there is not additional information showing up as text in the file. There may be some additional lines displaying the DN and Bag Attributes. Remove all of this from the file so that you end up with something like this:<\/p>\n<p>&#8212;&#8211;BEGIN RSA PRIVATE KEY&#8212;&#8211;<br \/>MjQxODIwNTFaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3d3d3<br \/>LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxp<br \/>YWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEG<br \/>A1UEAxMqRW50cnVzdC5uZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgp<br \/>MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArU1LqRKGsuqjIAcVFmQq<br \/>&#8212;&#8211;END RSA PRIVATE KEY&#8212;&#8211;<\/p>\n<p>You can now use this as your Server.key file on your Apache Server. <\/p>\n<p>To get the corresponding Server Certificate, you will run the following OpenSSL command:<\/p>\n<p><strong>openssl.exe pkcs12 -in myCert.pfx -clcerts -nokeys -out EntrustCert.pem<br \/><\/strong><br \/>You can now use the resulting file as your Server.crt file in Apache.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How do I convert my .pfx file to be used with an Apache server?<\/p>\n<p>Answer:<\/p>\n<p>The Apache server will require the following two files:<\/p>\n<p>1 &#8211; Server.ker : the private key associated with the certificate2 &#8211; Server.crt : the public SSL certificate issued by Entrust<\/p>\n<p>Using Open SSL, you can extract the certificate and private [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1820"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1820"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1820\/revisions"}],"predecessor-version":[{"id":1822,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1820\/revisions\/1822"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1820"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1820"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}