How do I create a self-signed certificate for code signing on Windows?

后端 未结 5 812
抹茶落季
抹茶落季 2020-11-22 17:08

How do I create a self-signed certificate for code signing using tools from the Windows SDK?

5条回答
  •  野性不改
    2020-11-22 17:36

    It's fairly easy using the New-SelfSignedCertificate command in Powershell. Open powershell and run these 3 commands.

    1) Create certificate:
    $cert = New-SelfSignedCertificate -DnsName www.yourwebsite.com -Type CodeSigning -CertStoreLocation Cert:\CurrentUser\My

    2) set the password for it:
    $CertPassword = ConvertTo-SecureString -String "my_passowrd" -Force –AsPlainText

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

    Your certificate selfsigncert.pfx will be located @ D:/


    Optional step: You would also require to add certificate password to system environment variables. do so by entering below in cmd: setx CSC_KEY_PASSWORD "my_password"

提交回复
热议问题