我正在尝试安装 mitmproxy.org 通过Powershell提供的证书,但Windows没有将证书保存在正确的位置。
我尝试运行的命令:
Get-ChildItem -Path c:mitmproxy-ca-cert.p12 | Import-PfxCertificate -CertStoreLocation cert:LocalMachineRoot
它不是将证书插入到受信任的根证书颁发机构中,而是将其放入中间证书颁发机构中。
Get-ChildItem -Path c:mitmproxy-ca-cert.p12 | Import-PfxCertificate -CertStoreLocation cert:CurrentUserRoot
执行与第一个命令相同的操作。
即使将工作位置设置为PS Cert:localmachineRoot>
也无法导入到根位置。Get-ChildItem -Path c:mitmproxy-ca-cert.p12 | Import-PfxCertificate -CertStoreLocation .
没有错误,所有命令都运行了。我以管理员权限运行它们。
但是,手动左键单击mitmproxy-ca-cert.p12
会启动一个导入 GUI,从而成功将其导入根位置。为什么电源外壳不工作?
遵循 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.
谁能说明这里发生了什么?谢谢。
我给你做一个脚本,如果你不明白,告诉我。
$in_cert = "C:UsersMarianDesktopPfx Certificate.pfx";
$password = Read-Host -AsSecureString;
# Read the pfx certificate data:
$pfx = (Get-PfxData -FilePath $in_cert -Password $password -ErrorAction Stop);
# Get the root and publisher certificate:
$root = $pfx.OtherCertificates[0];
$publisher = $pfx.EndEntityCertificates[0];
# Add the root:
$rootStore = Get-Item "Cert:CurrentUserRoot";
$rootStore.Open('ReadWrite');
$rootStore.add($root);
$rootStore.close();
# Add the publisher:
$rootStore = Get-Item "Cert:CurrentUserTrustedPublisher";
$rootStore.Open('ReadWrite');
$rootStore.add($publisher);
$rootStore.close();
Pause;
我也发帖到我的帖子: 我的帖子