【问题标题】:Signtool error The specificed PFX password is not correctSigntool error 指定的PFX密码不正确
【发布时间】:2021-11-18 23:54:02
【问题描述】:

我有一个来自 DigiCert .pfx 文件的新证书,当我尝试使用它进行签名时,会出现错误“指定的 PFX 密码不正确”但是密码在本地安装时可以正常工作。我试过不指定密码但没有成功。证书是给我买的另一个购买它的人。

谢谢

【问题讨论】:

    标签: certificate sign pfx signtool


    【解决方案1】:

    我遇到了同样的问题,但通过从密码中删除 " 解决了它。

    之前:signtool.exe sign /f mycert.pfx /p "password" /v /t http://..."application.exe"

    之后:signtool.exe 签名 /f mycert.pfx /p 密码 /v /t http://... application.exe

    【讨论】:

      【解决方案2】:

      尝试在 Visual Studio 中使用构建后事件对 dll 文件进行签名时,我也遇到了同样的问题。我发现问题在于密码中包含百分号 (%) 和逗号 (,) 等特殊字符。我在设置没有这些特殊字符的新密码后修复了它。

      希望对你有帮助

      【讨论】:

        【解决方案3】:

        另一个可能的问题是 PFX 的加密可能无法识别,例如较新的 SHA256 加密证书不能用于在较旧的 SDK 上签名

        查看相关的 SO 答案: signtool - the specified PFX password is not correct from new machine

        Why I get "The specified PFX password is not correct" when trying to sign application with signtool?

        【讨论】:

          【解决方案4】:

          我在 Azure Devops 中使用命令行任务时遇到了同样的问题:

          "C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x86\signtool.exe" sign /f "D:\Cert\CodeSigning.pfx" /p %_pwd123_% /d "" /du "" /fd sha256 /tr http://timestamp.comodoca.com/?td=sha256 /td sha256 "D:\Build\Installer.msi"
          

          这导致“指定的 PFX 密码不正确”。 但是我能够从失败的管道中获取实际的脚本命令,将其复制到构建机器上的 cmd 提示符中并成功运行它(无需任何更改)。

          我还尝试创建一个管道变量,就像我看到其他人所做的那样,并在像$(pfxPwd) 这样的命令中使用它。这在运行时似乎也能完美翻译,但仍然失败。

          解决方案是使用管道变量,但将其包含在命令中,如下所示:%pfxPwd%

          "C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x86\signtool.exe" sign /f "D:\Cert\CodeSigning.pfx" /p %pfxPwd% /d "" /du "" /fd sha256 /tr http://timestamp.comodoca.com/?td=sha256 /td sha256 "D:\Build\Installer.msi"
          

          也许这个问题是由以% 开头和结尾的密码引起的。 但由于此证书和密码来自 IT,因此没有其他选择。

          注意:我后来发现,如果我将变量类型更改为“秘密”,它就不再起作用了。

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 2016-06-12
            • 2022-12-17
            • 1970-01-01
            • 1970-01-01
            • 2012-01-07
            • 2010-10-28
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多