【发布时间】:2020-01-01 18:07:39
【问题描述】:
我正在尝试通过 powershell 安装 mitmproxy.org 提供的证书,但 windows 没有将证书保存在正确的位置。
我尝试运行的命令:
Get-ChildItem -Path c:\mitmproxy-ca-cert.p12 | Import-PfxCertificate -CertStoreLocation cert:\LocalMachine\Root 不是将证书插入受信任的根证书颁发机构,而是将其放入中间证书颁发机构。
Get-ChildItem -Path c:\mitmproxy-ca-cert.p12 | Import-PfxCertificate -CertStoreLocation cert:\CurrentUser\Root 和第一个命令一样。
即使将工作位置设置为PS Cert:\localmachine\Root> 也无法导入到根位置。 Get-ChildItem -Path c:\mitmproxy-ca-cert.p12 | Import-PfxCertificate -CertStoreLocation .
没有错误,所有命令都运行正常。我以管理员权限运行它们。
手动左键单击 mitmproxy-ca-cert.p12 会启动导入 GUI,将其成功导入到 Root 位置。为什么 powershell 不起作用?
按照 mitmproxy.org 自己的命令行安装指南是没有用的,因为它根本不起作用:
如何在 Windows 上安装(自动)
certutil.exe -importpfx Root mitmproxy-ca-cert.p12
C:\>certutil -importpfx Root mitmproxy-ca-cert.p12
Enter PFX password:
CertUtil: -importPFX command FAILED: 0x80092007 (-2146885625 CRYPT_E_SELF_SIGNED)
CertUtil: The specified certificate is self signed.
谁能解释一下这里发生了什么?谢谢。
【问题讨论】:
-
您在“Pfx”中有多个证书?我认为现在不可能。我在这里也有同样的问题:
https://superuser.com/questions/1471833/how-i-make-the-publisher-certificate-to-be-installed-into-trusted-publishers-b. -
要仔细检查存储是否正确,打开 GUI 并找到仅在 Trusted Root 文件夹中的证书。复制指纹(不带空格)并运行命令:dir -Path cert:\ -Recurse |其中 {$_.Thumbprint -eq "thumbprintwithoutspaces"}
-
您需要另一种方法。我知道 Pfx 文件不保存证书路径。检查答案。