Error using certutil -MergePFX - The system cannot find the file specified

1.7k views Asked by At

I have previously used the certutil program to successfully convert a .CER formatted SSL certificate to .PFX format using the syntax

certutil -MergePFX mycert.cer mycert.pfx

as suggested in an answer to the post How to convert .crt cetificate file to .pfx (note that I previously converted the .CRT file to a .CER file).

However, when I tried to do this again with a new SSL certificate, I get the error

CertUtil: -MergePFX command FAILED: 0x80070002 (WIN32: 2 ERROR_FILE_NOT_FOUND)
CertUtil: The system cannot find the file specified.

The mycert.cer is most definitely in the directory - I actually use tab completion to enter the name. In particular, I can run the command

certutil -dump mycert.cer

and the file is dumped to the screen.

I have that people have had similar errors with other uses of CertUtil, so I am thinking it may be a particular quirk of the program where it needs to be prompted to recognise what directory it is in.

I have tried entering the full path of the file but I get the same error.

I would greatly appreciate any help with this as I thought I had found a convenient method of generating PFX files (which turns out to be an unduly complicated process) only to be stumped by this mystery error!

1

There are 1 answers

0
Martin Vaughan On

I just figured out the missing piece to this: one must have the private key in the same folder renamed to mycert.key (where mycert is whatever the name of the CER file is). This was the file that could not be found.

The private key in this case had been downloaded from GoDaddy as a text file.