我正在尝试用我拥有的pfx文件签署Windows 8 appx包。我使用如下命令:

signtool.exe sign /fd sha256 /f "key.pfx" "app.appx"

由此,我得到:

SignTool错误:没有找到符合所有给定标准的证书。

我没有达到什么“标准”?这仅用于测试,因此这些是自签名证书。我尝试过导入密钥,然后对其进行签名,但它总是导致相同的错误。我怎么解决这个问题?


当前回答

尝试使用/debug。1,2如:

signtool sign /debug /f mypfxfile.pfx /p <password> (mydllexectuable).exe

它将帮助您了解发生了什么。你应该得到这样的输出:

The following certificates were considered:
    Issued to: <issuer>
    Issued by: <certificate authority> Class 2 Primary Intermediate Server CA
    Expires:   Sun Mar 01 14:18:23 2015
    SHA1 hash: DD0000000000000000000000000000000000D93E

    Issued to: <certificate authority> Certification Authority
    Issued by: <certificate authority> Certification Authority
    Expires:   Wed Sep 17 12:46:36 2036
    SHA1 hash: 3E0000000000000000000000000000000000000F

After EKU filter, 2 certs were left.
After expiry filter, 2 certs were left.
After Private Key filter, 0 certs were left.
SignTool Error: No certificates were found that met all the given criteria.

您可以查看是哪个过滤器导致您的证书无法工作,或者是否没有考虑证书。

我改变了哈希值和其他信息,但你应该明白。


1请注意:signtool对/debug选项放置的位置有特殊要求。它需要跟在sign语句后面。 另外注意:/debug选项只适用于某些版本的signtool。WDK版本有这个选项,而Windows SDK版本没有。

其他回答

在我的情况下,我有错误的证书类型,我试图关联。我选择了“服务器认证”而不是“代码签名”。 您应该能够在预期用途部分的Certificate snap中看到这一点。在那之后,它就可以正常工作了。

以防其他人遇到这种情况:我的问题是,在使用signtool.exe应用程序之前,我需要以管理员身份运行命令提示符。然后一切都很好地工作。

我在使用Git Bash时得到了这个错误。 使用PowerShell成功。 如果这对谁有帮助的话。

我使用的数字令牌,必须被识别为“Microsoft usbcid -智能卡- leser (WUDF)”。

如果没有,我得到这个错误消息'没有找到符合所有给定标准的证书…'。 这让我毫不费力地在SignTool选项和证书属性中搜索了很长时间。所以我希望它能帮助到一些人:-)

尝试使用/debug。1,2如:

signtool sign /debug /f mypfxfile.pfx /p <password> (mydllexectuable).exe

它将帮助您了解发生了什么。你应该得到这样的输出:

The following certificates were considered:
    Issued to: <issuer>
    Issued by: <certificate authority> Class 2 Primary Intermediate Server CA
    Expires:   Sun Mar 01 14:18:23 2015
    SHA1 hash: DD0000000000000000000000000000000000D93E

    Issued to: <certificate authority> Certification Authority
    Issued by: <certificate authority> Certification Authority
    Expires:   Wed Sep 17 12:46:36 2036
    SHA1 hash: 3E0000000000000000000000000000000000000F

After EKU filter, 2 certs were left.
After expiry filter, 2 certs were left.
After Private Key filter, 0 certs were left.
SignTool Error: No certificates were found that met all the given criteria.

您可以查看是哪个过滤器导致您的证书无法工作,或者是否没有考虑证书。

我改变了哈希值和其他信息,但你应该明白。


1请注意:signtool对/debug选项放置的位置有特殊要求。它需要跟在sign语句后面。 另外注意:/debug选项只适用于某些版本的signtool。WDK版本有这个选项,而Windows SDK版本没有。