我使用以下方法创建了代码证书:
$cert = New-SelfSignedCertificate -CertStoreLocation "Cert:\CurrentUser\My" -dnsname testcert.test.io
$cert
$secPassword = ConvertTo-SecureString -String 'password1234' -Force -AsPlainText
$certPath = "Cert:\CurrentUser\My\$($cert.Thumbprint)"
Export-PfxCertificate -Cert $certPath -FilePath C:\selfcert.pfx -Password $secPassword
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用它来签署我的 .exe 使用:
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86\signtool.exe" sign /debug /f "C:\selfcert.pfx" /p password1234 "A:\mysoft\sign\myexe.EXE"
Run Code Online (Sandbox Code Playgroud)
调试抛出这个:
The following certificates were considered:
Issued to: testcert.test.io
Issued by: testcert.test.io
Expires: Fri Aug 12 15:25:13 2022
SHA1 hash: 0CDA91D628CA855B49FA1CB8DFD0F53C121BEB27
After EKU filter, 0 certs were left.
After expiry filter, 0 certs were left.
After Private Key filter, 0 …
Run Code Online (Sandbox Code Playgroud)