我正在嘗試創建一個自簽名的代碼簽名證書,但是當我嘗試使用它來簽署一個 .exe 時,我收到了這個 SignTool 錯誤SignTool Error: The specified PFX password is not correct.
這是我為創建證書而運行的命令,使用密碼將其匯出到 pfx,然后簽署 .exe
$password = "password"
$certificate = New-SelfSignedCertificate -DnsName "MyCompany, Dev" -Type CodeSigning -CertStoreLocation Cert:\CurrentUser\My
$certificatePassword = ConvertTo-SecureString -String $password -Force –AsPlainText
Export-PfxCertificate -Cert "cert:\CurrentUser\My\$($certificate.Thumbprint)" -FilePath "C:\Users\me\Project\CSCDev.pfx" -Password $certificatePassword
SignTool sign /f "C:\Users\me\Project\CSCDev.pfx" "C:\Users\me\Project\MyCompanyApp.exe" /p $certificatePassword
做錯了什么?
uj5u.com熱心網友回復:
如上所述,我將使用 Powershell cmdlet 而不是匯出代碼簽名證書:
$cert=(dir cert:currentuser\my\ -CodeSigningCert)
$script = Read-Host -Prompt "Please enter (without quotes) the path to the file you are signing `r`n
Example: \\server\my folder\projects.ps1 `r`n"
# Alternative timestamp sources:
#http://timestamp.comodoca.com/authenticode
#http://timestamp.globalsign.com/scripts/timestamp.dll
#http://tsa.starfieldtech.com
#
Try {
Set-AuthenticodeSignature -FilePath $($script) -Certificate $cert -TimestampServer http://timestamp.digicert.com -Verbose -ErrorAction Stop
}
Catch {
$_
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/527292.html
標籤:电源外壳
