Powershell读取PFX证书


支持所有PS版本

当你使用Get-PfxCertificate读取PFX证书去签名你的脚本,但是它总是会已交互式方式提示用户去输入密码。

下面介绍怎么通过脚本去提交密码:

$PathToPfxFile = 'C:\temp\test.pfx'
$PFXPassword = 'test'

Add-Type -AssemblyName System.Security
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$cert.Import($PathToPfxFile, $PFXPassword, 'Exportable')

$cert  

原文地址:Reading In PFX-Certificate

本文链接: https://www.pstips.net/reading-in-pfx-certificate.html
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!

发表评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注