Trying with Import-PfxCertificate

This commit is contained in:
Robin 2016-08-15 18:16:43 +02:00
commit f6156b6306
2 changed files with 7 additions and 7 deletions

View file

@ -128,9 +128,9 @@ OutputDir=..\
PrivilegesRequired=none PrivilegesRequired=none
SetupIconFile=..\..\icons\applicationIcon\icon.ico SetupIconFile=..\..\icons\applicationIcon\icon.ico
; Create a SHA1 signature ; Create a SHA1 signature
SignTool=SignTool sign /debug /sm /fd sha1 /tr http://time.certum.pl /td sha1 $f SignTool=SignTool sign /debug /fd sha1 /tr http://time.certum.pl /td sha1 $f
; Append a SHA256 to the previous SHA1 signature (this is what as does) ; Append a SHA256 to the previous SHA1 signature (this is what as does)
SignTool=SignTool sign /debug /as /sm /fd sha256 /tr http://time.certum.pl /td sha256 $f SignTool=SignTool sign /debug /as /fd sha256 /tr http://time.certum.pl /td sha256 $f
SignedUninstaller=yes SignedUninstaller=yes
UninstallDisplayIcon={app}\{#ExeName}.exe UninstallDisplayIcon={app}\{#ExeName}.exe
Uninstallable=true Uninstallable=true

View file

@ -55,17 +55,17 @@ Function MD5($filename) {
Function PrepareCertificate() { Function PrepareCertificate() {
$decodedContentBytes = [System.Convert]::FromBase64String($env:Certificate) $decodedContentBytes = [System.Convert]::FromBase64String($env:Certificate)
$decodedContentBytes | set-content "greenshot.pfx" -encoding byte $decodedContentBytes | set-content "greenshot.pfx" -encoding byte
$certutilArguments = @('-p', $env:CertificatePassword, '-importpfx', "greenshot.pfx") #$certutilArguments = @('-p', $env:CertificatePassword, '-importpfx', "greenshot.pfx")
Start-Process -wait certutil -ArgumentList $certutilArguments -NoNewWindow #Start-Process -wait certutil -ArgumentList $certutilArguments -NoNewWindow
#Import-PfxCertificate FilePath "greenshot.pfx" "cert:\localMachine\my" -Password "$env:CertificatePassword" Import-PfxCertificate FilePath "greenshot.pfx" -CertStoreLocation Cert:\CurrentUser\My -Password $env:CertificatePassword
} }
# Sign the specify file # Sign the specify file
Function SignWithCertificate($filename) { Function SignWithCertificate($filename) {
Write-Host "Signing $filename" Write-Host "Signing $filename"
$signSha1Arguments = @('sign', '/debug', '/sm', '/fd', 'sha1' , '/tr', 'http://time.certum.pl', '/td', 'sha1' , $filename) $signSha1Arguments = @('sign', '/debug', '/fd', 'sha1' , '/tr', 'http://time.certum.pl', '/td', 'sha1' , $filename)
$signSha256Arguments = @('sign', '/debug', '/as', '/sm', '/fd', 'sha256', '/tr', 'http://time.certum.pl', '/td', 'sha256', $filename) $signSha256Arguments = @('sign', '/debug', '/as', '/fd', 'sha256', '/tr', 'http://time.certum.pl', '/td', 'sha256', $filename)
Start-Process -wait $env:SignTool -ArgumentList $signSha1Arguments -NoNewWindow Start-Process -wait $env:SignTool -ArgumentList $signSha1Arguments -NoNewWindow
Start-Process -wait $env:SignTool -ArgumentList $signSha256Arguments -NoNewWindow Start-Process -wait $env:SignTool -ArgumentList $signSha256Arguments -NoNewWindow