OpenSSL Tips: how to generate a .pfx file from certificate and private key?

Do you need a .pfx file?

You have the single certificate (.cer/.pem/.crt) and the private key (.key), but you need a single .pfx file (a passworded container format that contains both public and private certificate pairs) to install it on IIS Webserver?

The solution is pretty simple, using OpenSSL:

openssl pkcs12 -export -out PFXFILENAME.pfx -inkey PRIVATEKEYFILE.key -in PEMFILE.pem

Just run the command and insert the chosen password:

That’s all!