Skip to content

Instantly share code, notes, and snippets.

@martianyi
Last active July 28, 2020 12:05
Show Gist options
  • Save martianyi/c7a1c4379fbd7a50a6301cdc6e1b4260 to your computer and use it in GitHub Desktop.
Save martianyi/c7a1c4379fbd7a50a6301cdc6e1b4260 to your computer and use it in GitHub Desktop.
windows自签发证书

在Powershell中运行以下三个命令.

  1. 创建证书: $cert = New-SelfSignedCertificate -DnsName www.yourwebsite.com -Type CodeSigning -CertStoreLocation Cert:\CurrentUser\My

  2. 设置密码: $CertPassword = ConvertTo-SecureString -String "my_passowrd" -Force –AsPlainText

  3. 导出: Export-PfxCertificate -Cert "cert:\CurrentUser\My\$($cert.Thumbprint)" -FilePath "d:\selfsigncert.pfx" -Password $CertPassword

自签发证书 selfsigncert.pfx 位于 D盘

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment