以下皆為「自簽名證書」
先透過 Windows PowerShell去下指令去產生,範例如下
$cert = New-SelfSignedCertificate -Type CodeSigning -Subject "CN=MyCompany" -CertStoreLocation "Cert:\CurrentUser\My" -KeyExportPolicy Exportable -FriendlyName "My Code Signing Cert"
Export-PfxCertificate -Cert $cert -FilePath "C:\path\to\mycert.pfx" -Password (ConvertTo-SecureString -String "YourPassword" -Force -AsPlainText)
再來我們專案 WPF並且發布透過 Publish Folder模式,故找到要簽名的 Exe檔案路徑,透過 Developer PowerShell for VS 2022並使用 signtool進行簽名
signtool sign /f "C:\path\to\mycert.pfx" /p YourPassword /t http://timestamp.digicert.com /fd SHA256 "C:\path\to\app.exe"
發佈留言