在 Windows 上使用命令行导入证书

Liv*_*ivy 8 powershell certificate ssl

我需要导入一个证书文件来Trusted Root Certification Authorities存储,以在访问我的本地网站时摆脱 SSL 警告。我目前这样做的方式很长:使用谷歌浏览器?设置?先进的 ?隐私和安全 ? 管理证书 ? 受信任的根证书颁发机构 ? 进口...

在此处输入图片说明

它看起来像是某种 Windows 管理单元,而不是 Chrome 的自定义窗口。执行所有这些步骤只是为了导入 1KiB 证书文件是愚蠢的。我可以在 PowerShell 上执行此操作,以便可以通过脚本自动执行此操作吗?或者至少如何在没有 Google Chrome 的情况下打开上述窗口?

Pet*_*orf 13

如果您使用的是当前版本的 Windows,则可以使用PowerShell cmdlet

Import-Certificate -FilePath "C:\CA-PublicKey.Cer" -CertStoreLocation Cert:\LocalMachine\Root
Run Code Online (Sandbox Code Playgroud)

否则使用certutil

certutil.exe -addstore root c:\capublickey.cer
Run Code Online (Sandbox Code Playgroud)