How to prepare a .pfx certificate for use with an Apache server

An Apache server needs the following 2 files:

  1. server.key - the private key
  2. server.crt - the public key

To get these files, we'll need OpenSSL.

Here's how to get the private key:

openssl pkcs12 -in myCert.pfx -nocerts -out privateKey.pem
openssl rsa -in privateKey.pem -out server.key

And here's how to get the public key:

openssl pkcs12 -in myCert.pfx -clcerts -nokeys -out server.crt

Now we have everything we need.

Only registered users can leave a comment.

Sign in or register to leave a comment.