Exporting a PFX Cert to Base64 Cer and Key files

Getting the .CER file

Start by exporting the cert nomrally throguh MMC.

On the Certificate Export Wizard, do not export the private key.

Change the encoding to BASE-64 and export cert cert as you normally would.

Getting the .key file

Export the key again from MMC but this time, export the private key. This will give you a .pfx file to work with. Next, we need to get the .pfx file converted to a .pem file.

openssl pkcs12 -in .\yourCert.pfx -out .\yourCert.pem -nodes

Once we have the .pem file, edit it. Remove anything that is not the private key. Then run the below command to generate the RSA Base-64 .key file.

openssl rsa -in .\yourKey.pem -outform PEM -out .\yourKey.key

You’re done! You now have a Certificate and matching Private key file encoded in Base64, which most systems will recognize and be able to import!

Other Helpful OpenSSL commands

OpenSSL: Convert CRT to PEM:

Type the following code into your OpenSSL client:

openssl x509 -in cert.crt -out cert.pem

OpenSSL: Convert CER to PEM

openssl x509 -in cert.cer -out cert.pem

OpenSSL: Convert DER to PEM

openssl x509 -in cert.der -out cert.pem

Sources