Skip to content

Instantly share code, notes, and snippets.

@crazyoptimist
Last active August 6, 2024 07:45
Show Gist options
  • Select an option

  • Save crazyoptimist/23f4acf6fe183538436d2c5c0b4ba064 to your computer and use it in GitHub Desktop.

Select an option

Save crazyoptimist/23f4acf6fe183538436d2c5c0b4ba064 to your computer and use it in GitHub Desktop.

Revisions

  1. crazyoptimist revised this gist Aug 6, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion self-sign.ps1
    Original file line number Diff line number Diff line change
    @@ -10,4 +10,4 @@ $pwd = ConvertTo-SecureString -String "{123456}" -Force -AsPlainText
    Export-PfxCertificate -cert $cert -FilePath {CertName}.pfx -Password $pwd

    ; Sign the executable
    signtool.exe sign /f {CertName.pfx /fd sha256 /p 123456 {Program}.exe
    signtool.exe sign /f {CertName}.pfx /fd sha256 /p 123456 {Program}.exe
  2. crazyoptimist revised this gist Aug 6, 2024. No changes.
  3. crazyoptimist created this gist Aug 6, 2024.
    13 changes: 13 additions & 0 deletions self-sign.ps1
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    ; Credits: https://www.the-automator.com/

    ; Create certificate
    $cert = New-SelfSignedCertificate -Subject "{CertName}" -CertStoreLocation "cert:\CurrentUser\My" -HashAlgorithm sha256 -type CodeSigning

    ; Create password
    $pwd = ConvertTo-SecureString -String "{123456}" -Force -AsPlainText

    ; Export Certificate to a file
    Export-PfxCertificate -cert $cert -FilePath {CertName}.pfx -Password $pwd

    ; Sign the executable
    signtool.exe sign /f {CertName.pfx /fd sha256 /p 123456 {Program}.exe