How to use certutil -exportPFX to export certificates from "Certifiate Enrollment Requests" store?

1

I have Windows Server 2008. I am trying to write a script to export my certificate request private keys. I wanted to use the powershell cmdlet Export-PfxCertificate to export my certificate request's private keys, but it seems that cmdlet is missing from Server 2008. So I tried the certutil command, but I keep getting the error:

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

I know the particular serial number and thumbprint, but it seems like I am not specifying the [CertificateStoreName] correctly. In powershell, the location is cert:\LocalMachine\REQUEST, but I cannot get the format for certutil.

I have tried many versions of

certutil -f -enterprise -exportpfx 05..hexdigits...0a C:\private.pfx

But no success. certutil -store -? was not in figuring out the correct format.

How can I do this?

Thanks!

certutil
asked on Super User Jul 28, 2015 by Charlweed

1 Answer

0

Certificate Signing Requests are stored in a separate store (named REQUEST) from normal certificates. Use this:

certutil -exportPFX -user -p "password" REQUEST $SerialNumber "a.pfx"
answered on Super User Mar 6, 2018 by Brad

User contributions licensed under CC BY-SA 3.0