How can I securely pass the certificate password to signtool.exe in Inno Setup?

梦想的初衷 提交于 2020-12-30 03:46:36

问题


How can I securely pass the password to signtool.exe? Here's the code:

[Setup]
SignTool=mysigntool signtool.exe" sign /f <path_to_pfx_certificate> /p <certificate's_password> $f

I know there's a method like GetSHA1OfString, but here I need the opposite.


回答1:


If you are asking how to encrypt the password, it does not make sense. An encryption needs a key (aka a password). So you end up with another password, which you again need to store somewhere in plain text. It's a kind of a chicken or the egg problem.

All you can do is to obfuscate the password.


Consider protecting the certificate by putting it into the Windows certificate store instead of a password-protected file. This is the same question you have, just for MSBuild: How do I securely store a .pfx password to use in MSBuild? The answer is pretty much generic. You just replace the MSBuild's %(SignFiles.Identity) with Inno Setup's $f in the signtool command line:

signtool.exe sign /sha1 <value> /t ... $f

Other related questions:

  • How do I securely configure a CI server to digitally sign binaries?
  • Automated Code Signing - Protecting the private key


来源:https://stackoverflow.com/questions/64785809/how-can-i-securely-pass-the-certificate-password-to-signtool-exe-in-inno-setup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!