Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Created March 14, 2024 17:23
Show Gist options
  • Save unitycoder/3e61459c367d0273b49b83fcf49c17e2 to your computer and use it in GitHub Desktop.
Save unitycoder/3e61459c367d0273b49b83fcf49c17e2 to your computer and use it in GitHub Desktop.
code sign windows application
// https://forum.unity.com/threads/codesign-a-windows-build.1558505/
$password = ConvertTo-SecureString -String \"#{password}\" -Force -AsPlainText
 
$subject_name = (Get-PfxData -FilePath "$filePath" -Password $password | Select-Object -ExpandProperty EndEntityCertificates | Select-Object -ExpandProperty SubjectName).Name
 
$subject_name = $subject_name -replace 'CN=', ''
Import-PfxCertificate -FilePath $filePath -CertStoreLocation Cert:\\LocalMachine\\My -Password $password
 
& signtool.exe sign /a /sm /n $subject_name /fd SHA256 "$fileToSign"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment