在Powershell中运行以下三个命令.
-
创建证书:
$cert = New-SelfSignedCertificate -DnsName www.yourwebsite.com -Type CodeSigning -CertStoreLocation Cert:\CurrentUser\My
-
设置密码:
$CertPassword = ConvertTo-SecureString -String "my_passowrd" -Force –AsPlainText
-
导出:
Export-PfxCertificate -Cert "cert:\CurrentUser\My\$($cert.Thumbprint)" -FilePath "d:\selfsigncert.pfx" -Password $CertPassword
自签发证书 selfsigncert.pfx 位于 D盘