说到自签名证书,相信大家应该会经常使用openssl进行申请,但是用powershell的还是比较少的,今天主要介绍使用Powershell来申请一个自签名证书,具体见下:
1.提交申请
$mycert = New-SelfSignedCertificate -DnsName "DomainName" -CertStoreLocation "cert:\CurrentUser\My" -NotAfter (Get-Date).AddYears(5) -KeySpec KeyExchange
2.导出Cer格式的证书文件
$mycert | Export-Certificate -FilePath d:\mycert.cer
3.导出pfx格式的证书文件
因为PFX格式自带证书,所以我们需要指定一个密码;
$mycert | Export-PfxCertificate -FilePath d:\mycert.pfx -Password $(ConvertTo-SecureString -String "123456" -AsPlainText -Force)
本文详细介绍了如何使用Powershell工具高效申请自签名证书,并分别演示了导出CER和PFX格式证书的过程,包括所需命令和注意事项。
2186

被折叠的 条评论
为什么被折叠?



