Skip to content

Instantly share code, notes, and snippets.

@crazyoptimist
Last active August 6, 2024 07:45
Show Gist options
  • Save crazyoptimist/23f4acf6fe183538436d2c5c0b4ba064 to your computer and use it in GitHub Desktop.
Save crazyoptimist/23f4acf6fe183538436d2c5c0b4ba064 to your computer and use it in GitHub Desktop.
Generate a self-signed certificate and sign your windows binaries with it.
; 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment