【发布时间】:2020-07-28 08:23:28
【问题描述】:
请参考Get-Certificate
我尝试使用 PowerShell 请求证书,它有效,但证书不可导出,这是我的命令:
Get-Certificate -Template "MyComputer" -SubjectName "CN=corey.com" -CertStoreLocation cert:\LocalMachine\My
当我尝试导出证书时,它失败了。
Export-PfxCertificate -Cert cert:\LocalMachine\My\$Thumbprint -FilePath C:\corey.com.pfx -Password $mypwd
错误信息:
Export-PfxCertificate:无法导出不可导出的私钥。
我找不到任何参数,如 Exportable 或属性供我使用 Get-Certificate 命令。有没有办法使用 PowerShell 请求/制作可导出的证书?
【问题讨论】:
-
@Sceptalist 感谢分享,但我的关键问题是如何在使用 PowerShell “请求”时使证书可导出,知道吗?
-
@Corey 安装证书时,必须将其标记为可导出,如果不这样做,则为单向过程。
-
我认为这会给您一个来自注册服务器的子证书,这基本上意味着您需要从注册服务器本身导出 Pfx。另一种选择是使用 New-SelfSignedCertificate 创建一个自签名证书,然后您将能够从您所在的服务器导出 pfx。
标签: windows powershell x509certificate