Converting a SSL Certificate to PKCS#12 Format on Windows

I'm working on configuring a couple of different Java-based servers (SonarQube and TeamCity) to use HTTPS for connectivity, which is fairly easy if you have a PKCS#12 format cert file. In this post, I'll walk through an option (there are others) for converting a .cert, .crt or .cer file into the PKCS#12 format us built-in Windows certificate store.

Note: you'll need to be an administrator on the Windows machine you're using to do the conversion.

In the Windows Start page, type "Manage Computer Certificates" and open the MMC (or run MMC directly and add the cert snap-in). Right-click on the 'Personal' certs folder and choose the Import option from the All Tasks... menu. This will open the Certificate Import Wizard.

Select your certificate file, enter the cert's password and make sure to enable the "Mark this key as exportable" option. Finish the wizard.

Now, in the MMC, find the cert where you imported it and right-click on it. From the All Tasks... menu, choose Export to open the Certificate Export Wizard. If you don't see Export, go back and make sure you enabled "Mark this key as exportable" during the import process.

Walk through the export wizard and choose "Yes, export the private key".

When asked what format to export to, choose PKCS #12 and enable the "Include all certificates in the certification path" option. You'll be asked to set security for the cert -- select the password option and enter a password. Remember this password, you'll need it later when you configure the webservers to use this cert. Finish the export wizard.

You now have a .pfx file with your PKCS #12 formatted cert.