如何使用 certutil -exportPFX 从“证书注册请求”存储中导出证书?

如何使用 certutil -exportPFX 从“证书注册请求”存储中导出证书?

我有 Windows Server 2008。我正在尝试编写一个脚本来导出我的证书请求私钥。我想使用 powershell cmdletExport-PfxCertificate导出我的证书请求的私钥,但似乎 Server 2008 中缺少该 cmdlet。因此我尝试了 certutil 命令,但一直收到错误:

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

我知道特定的序列号和指纹,但似乎我没有[CertificateStoreName]正确指定。在 powershell 中,位置是cert:\LocalMachine\REQUEST,但我无法获取 certutil 的格式。

我已经尝试了很多版本

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

但没有成功。certutil -store -?没有找出正确的格式。

我怎样才能做到这一点?

谢谢!

答案1

证书签名请求与普通证书存储在不同的存储区(名为 REQUEST)。使用方式如下:

certutil -exportPFX -user -p "password" REQUEST $SerialNumber "a.pfx"

相关内容