{"id":2614,"date":"2013-10-29T15:36:44","date_gmt":"2013-10-29T07:36:44","guid":{"rendered":"http:\/\/rmohan.com\/?p=2614"},"modified":"2013-10-29T15:37:03","modified_gmt":"2013-10-29T07:37:03","slug":"2614","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=2614","title":{"rendered":"PFX Certificate"},"content":{"rendered":"<p>What is a PFX Certificate<\/p>\n<p>PKCS #12 is one of the family of standards called Public-Key Cryptography Standards (PKCS), published by RSA Laboratories. It defines a file format commonly used to store X.509 private keys with accompanying public key certificates,<br \/>\n protected with a password-based symmetric key PFX Certificate?<\/p>\n<p>In practice .pfx is just another file extension for a PKCS#12 or .p12 type certificate.<\/p>\n<p>Convert PFX to PEM<\/p>\n<p>This command will convert a pfx certificate to a X509 pem encoded certificate. The use of the -nodes flag will give the option to password protect the private key in the new pem encoded certificate.<br \/>\n For information on converting pem to der encoded certificates.<br \/>\nExport ALL: Public Certificates, Private Keys, and CA Chain as single certificate<\/p>\n<p>Encrypt private key with a password<\/p>\n<p>openssl pkcs12 -in Certificate.pfx -out NewCertificate.pem<\/p>\n<p>openssl pkcs12 -in Certificate.pfx -out NewCertificate.pem<\/p>\n<p>Do not encrypt private key<\/p>\n<p>openssl pkcs12 -in Certificate.pfx -out NewCertificate.pem -nodes<\/p>\n<p>openssl pkcs12 -in Certificate.pfx -out NewCertificate.pem -nodes<\/p>\n<p>Export Public Certificate from pfx<\/p>\n<p>openssl pkcs12 -in Certificate.pfx -out NewCertificate.pem -nokeys -clcerts<\/p>\n<p>openssl pkcs12 -in Certificate.pfx -out NewCertificate.pem -nokeys -clcerts<\/p>\n<p>Export Private Key from pfx<\/p>\n<p>openssl pkcs12 -in certificate.pfx -out certificate.key -nocerts -nodes<\/p>\n<p>openssl pkcs12 -in certificate.pfx -out certificate.key -nocerts -nodes<\/p>\n<p>Export Certificate Authority (CA) Chain from pfx<\/p>\n<p>openssl pkcs12 -in certificate.pfx -out ca-chain.pem -nokeys -cacerts<\/p>\n<p>openssl pkcs12 -in certificate.pfx -out ca-chain.pem -nokeys -cacerts<\/p>\n<p>Convert PFX to JKS ( Java Keystore )<\/p>\n<p>If you do have Keytool application and your PKCS#12 file, launch the one-line command:<\/p>\n<p>If you do have Keytool application and your PKCS#12 file, launch the one-line command:<\/p>\n<p>keytool -importkeystore -srckeystore source.p12 -srcstoretype pkcs12 -srcalias Alias -destkeystore target.jks -deststoretype jks -deststorepass password -destalias Alias<\/p>\n<p>keytool -importkeystore -srckeystore source.p12 -srcstoretype pkcs12  -srcalias Alias -destkeystore target.jks -deststoretype jks -deststorepass password -destalias Alias<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is a PFX Certificate<\/p>\n<p>PKCS #12 is one of the family of standards called Public-Key Cryptography Standards (PKCS), published by RSA Laboratories. It defines a file format commonly used to store X.509 private keys with accompanying public key certificates, protected with a password-based symmetric key PFX Certificate?<\/p>\n<p>In practice .pfx is just another file [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2614"}],"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=2614"}],"version-history":[{"count":2,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2614\/revisions"}],"predecessor-version":[{"id":2616,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/2614\/revisions\/2616"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2614"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}