Joh*_*n R 6 powershell windows-7 batch windows-command-prompt certificate-authority
我想知道是否有一个 cmd 可以将现有证书从一个商店复制到另一个商店。我正在尝试将证书从用户中间证书颁发机构存储 (certutils -user -store ca fqdn-HOST-CA) 复制到机器的受信任根证书颁发机构存储 (certutils -store root fqdn-HOST-CA)。我尝试将 cmds 与 -addstore 一起使用,但没有用!!
certutil.exe -addstore root | certutil.exe -store -user ca fqdn-HOST-CA
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?谢谢
Joh*_*n R 14
我认为使用 PowerShell 可能是要走的路。
$srcStoreScope = "CurrentUser"
$srcStoreName = "CA"
$srcStore = New-Object System.Security.Cryptography.X509Certificates.X509Store $srcStoreName, $srcStoreScope
$srcStore.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::ReadOnly)
$cert = $srcStore.certificates -match "sometext"
$dstStoreScope = "LocalMachine"
$dstStoreName = "root"
$dstStore = New-Object System.Security.Cryptography.X509Certificates.X509Store $dstStoreName, $dstStoreScope
$dstStore.Open([System.Security.Cryptography.X509Certificates.OpenFlags]::ReadWrite)
$dstStore.Add($cert[0])
$srcStore.Close
$dstStore.Close
#Write-Output $cert
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3301 次 |
最近记录: |