01 June 2023

Convert .crt and .key file to .pfx without OpenSSL - CertUtil.exe

OMG, you really do learn everyday đŸ˜„ 

You've been there right, converting a certificate from some format to a pfx file so windows can handle it.Now normally I would turn to OpenSSL, but this is a bit of a hassle with all the commands and not every station you work on has it installed, or you're not allowed to install it.

So there is a standard tool on Windows that is installed by default and always available that does just this.

Certutil.exe

So how do we go from a .crt file and a .key file to a .pfx?

Place the .crt and .key file in the same directory.

Open cmd.exe as an administrator.

Browse to the path with the .crt and .key file and run:

certutil.exe -mergepfx [inputfile.crt] [outputfile.pfx]

You will have to enter a password and confirm it because the private key is inserted into the .pfx.

And there you have it, without OpenSSL.