我定期从 Vagrant
Ubuntu 服务器生成 CRT 证书,并使用 Windows 10 管理证书工具 mmc.exe.
导入它们,目前我正在导入他们一个一个地发送给 Trusted Root Certification Authorities
我想知道有没有办法:
- 将一堆 crt 文件导入到
Trusted Root Certification Authorities
- 动态执行上述过程
谢谢你的建议,
最佳答案
我使用 PowerShell 将 CA 证书导入计算机/机器商店的 Trusted Root Certification Authorities
。
function Add-TrustedRootMachineCertificate($certificate){
$store = get-item Cert:\LocalMachine\Root;
$store.Open("MaxAllowed")
if($store.Certificates.Find(
"FindByThumbprint",
$certificate.Thumbprint, $false).Count -eq 0
){
Write-Host "Add root certificate...";
$certificate
$store.Add($certificate);
}
$store.Close();
}
$currentDir = Split-Path $MyInvocation.MyCommand.Path -Parent;
foreach($file in Get-ChildItem "$($currentDir)\Root" -Filter "*.cer"){
$cert =
New-Object System.Security.Cryptography.X509Certificates.X509Certificate2(
$file.FullName);
Add-TrustedRootMachineCertificate -certificate $cert;
}
关于ssl - 将用户证书导入 windows 10 可信根证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57131236/