The password needs to be a secure string, not a string.

This commit is contained in:
Robin 2016-08-15 18:34:27 +02:00
commit 8660ee6591

View file

@ -57,8 +57,8 @@ Function PrepareCertificate() {
$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
$psw = ConvertTo-SecureString $env:CertificatePassword -AsPlainText -Force $secureString = ConvertTo-SecureString $env:CertificatePassword -AsPlainText -Force
Import-PfxCertificate -FilePath .\Greenshot.pfx -CertStoreLocation Cert:\CurrentUser\My -Password "$psw" Import-PfxCertificate -FilePath .\Greenshot.pfx -CertStoreLocation Cert:\CurrentUser\My -Password $secureString
} }
# Sign the specify file # Sign the specify file