Powershell 创建和导出根证书 PFX

问题描述

如果语法不正确,请提前道歉。这是我第一次创建证书。

我正在尝试使用 Powershell 创建根证书。我正在使用以下代码

$todaydt = Get-Date
$50years = $todaydt.AddYears(50)
$mypwd = ConvertTo-securestring -String "*******" -Force -AsPlainText

$rootCert = New-SelfSignedCertificate -Subject 'CN=127.0.0.1' -KeyExportPolicy Exportable  -KeyUsage CertSign,CRLSign,DigitalSignature -KeyLength 2048 -KeyUsageProperty All -KeyAlgorithm 'RSA'  -HashAlgorithm 'SHA256'  -Provider 'Microsoft Enhanced RSA and AES Cryptographic Provider'  -notafter $50years

Export-PfxCertificate -Cert $rootCert -FilePath c:\temp\my.pfx -Password $mypwd -Chainoption EndEntityCertOnly -noproperties -Verbose

当我运行它时,我得到:Export-PfxCertificate:无法导出不可导出的私钥。

根据处于相同情况的其他人,他们发现它本质上是一个权限问题并通过以下方式解决了:

“我选中了“管理私钥”选项,您就得到了 查看权限 - 所以我添加了我的管理员帐户......”

然后他们就可以出口了。我不确定这意味着什么?有人有想法或其他答案吗?

谢谢。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)