Monday, April 27, 2026

How to create a PFX certificate file using OpenSSL on Windows


Here is how to create a .pfx certificate for use with a webserver be it IIS, Apache tomcat, what ever you happen to be using that can support a .pfx certificate.

I'm working in windows, so if you don't have it installed; install it from https://slproweb.com/products/Win32OpenSSL.html

I installed Open SSL to my C:\Program Files and set my working directory to the \bin directory.

You will need three files for generating the .pfx.
  • Your key file, 
  • the provided domain certificate 
  • intermediate certificate file
Using cmd prompt or powershell go to your working directory in my case

cd "C:\Program Files\OpenSSL-Win64\bin"

The command is pretty simple; below is the command replace the blue text with what you want to generate your PFX File.
  • $Certificate.pfx = what you want your cert name to be
  • $domain_private_key.key = Your domain key for registering SSL Certficates
  • $certficiate.crt = Your certificate file from your register for your domain
  • $intermediate.crt = Your intermediate certificate provided by your registar such as godaddy
openssl pkcs12 -export -out $certificate.pfx -inkey $domain_private_key.key -in $certificate.crt -certfile $intermediate.crt


The certificate will be generate in the \bin directory so don't forget to clean up after yourself and remove your files.  My source files I put into a folder called source and the certs I put into a folder called certs

Error Accessing Active Directory Tools in a Domain

I came across a strange error when trying to connect to active directory users and computers where I could not access the domain tool. The e...