Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Exporting Certificates from the Windows Certificate Store describes how to export a certificate and private key into a single .pfx file. Follow the procedure below to extract separate certificate and private key files from the .pfx file.

Procedure

  1. Start the MMC snap-in certmgr.msc. You will be asked if you want operate on your Personal certificate store, the local machine Personal certificate store, or the store associated with a service account. In most cases you want the local machine store.
  2. In the left pane, navigate to the node that contains the certificate of interest.
  3. Right click on the certificate and select All Tasks > Export
  4. Follow the prompts in the Certificate Export Wizard. Note: you won't be able to export a private key if it wasn't marked as exportable when you originally created the CSR for the certificate.
  5. Take the file you exported (e.g. filename.pfx) and copy it to a system where you have OpenSSL installed. Note: the *.pfx file is in PKCS#12 format and includes both the certificate and the private key.
  6. Run the following OpenSSL command to export the private key: openssl pkcs12 -in certname.pfx -nocerts -out key.pem -nodes
  7. Run the following OpenSSL command to export the certificate: openssl pkcs12 -in certname.pfx -nokeys -out cert.pem
  8. Run the following OpenSSL command to remove the passphrase from the private key: openssl rsa -in key.pem -out server.key 

...