首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何导出证书路径(.P7B)中的所有证书?

如何导出证书路径(.P7B)中的所有证书?
EN

Stack Overflow用户
提问于 2020-10-16 14:55:17
回答 1查看 1K关注 0票数 0

我正在写一个导出脚本。但是,由于无法通过包括证书路径中的证书来导出我的证书,所以我被塞住了。

我想在我的脚本中复制这个选项。

代码语言:javascript
复制
$ChainCertName = "fooCert"  # name of the certificate to export
$ChainIssuerName = "BarCert"        # certificate issuer

# search for a certificate which contains the requested name and provided by the requested issuer
$ChainCertListToExport = Get-ChildItem -Path cert:\CurrentUser\CA | ?{$_.Subject -Like "*CN=*$ChainCertName*" -and $_.Issuer -Like "CN=$ChainIssuerName*"}

foreach($ChainCertToExport in $ChainCertListToExport | Sort-Object Subject){

    # export P7B certificate
    $ChainCertDestPath = Join-Path -Path $ExportDirectory -ChildPath "Chain_certificate.p7b"
    Export-Certificate -Cert $ChainCertToExport -FilePath $ChainCertDestPath -Type p7b
}

我看到可以用函数Export-PfxCertificate找到一些解决方案,但我还没有找到p7b的任何解决方案。

如果有人有这个问题,你能告诉我你的解决方案吗?

EN

回答 1

Stack Overflow用户

发布于 2021-08-25 00:38:51

如果您只需要以.p7b格式导出证书,请使用以下命令:

代码语言:javascript
复制
Get-ChildItem -Path Cert:\CurrentUser\CA | Export-Certificate -FilePath c:\certs\CA.p7b -Type P7B

更多细节可以在链接上找到。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64391559

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档