如何在根据内核签名策略进行验证时列出所有带有 signtool.exe 的签名

How to list all signatures with signtool.exe while verifying against the kernel signing policy

所以我使用 Windows SDK 8.1 中的 signtool 对二进制文件进行签名:

"C:\Program Files (x86)\Windows Kits.1\bin\x64\signtool.exe" sign /a /i Symantec /ac C:\utils\MSCV-VSClass3.cer /ph /t "http://timestamp.verisign.com/scripts/timstamp.dll" "foo.exe"
Done Adding Additional Store
Successfully signed: foo.exe
"C:\Program Files (x86)\Windows Kits.1\bin\x64\signtool.exe" sign /a /i Symantec /ac C:\utils\MSCV-VSClass3.cer /ph /fd sha256 /tr "http://timestamp.geotrust.com/tsa" /td sha256 /as "foo.exe"
Done Adding Additional Store
Successfully signed: foo.exe

当我在文件属性中查看时,我可以看到正确的结果。

但是,当我将 verify 与这个非常 signtool 一起使用时,根据传递的参数,我得到:

"C:\Program Files (x86)\Windows Kits.1\bin\x64\signtool.exe" verify /all "foo.exe"
File: foo.exe
Index  Algorithm  Timestamp
========================================
SignTool Error: A certificate chain processed, but terminated in a root
        certificate which is not trusted by the trust provider.
SignTool Error: A certificate chain processed, but terminated in a root
        certificate which is not trusted by the trust provider.

使用 /pa/pa /all 我可以看到两个时间戳:

"C:\Program Files (x86)\Windows Kits.1\bin\x64\signtool.exe" verify /pa "foo.exe"
File: foo.exe
Index  Algorithm  Timestamp
========================================
0      sha1       Authenticode

Successfully verified: foo.exe
"C:\Program Files (x86)\Windows Kits.1\bin\x64\signtool.exe" verify /pa /all "foo.exe"
File: foo.exe
Index  Algorithm  Timestamp
========================================
0      sha1       Authenticode
1      sha256     RFC3161

但是当尝试使用 /kp 来验证内核签名策略时,signtool 拒绝 运行 以及 /all:

"C:\Program Files (x86)\Windows Kits.1\bin\x64\signtool.exe" verify /kp /all "foo.exe"
SignTool Error: The /all option is incompatible with the /kp option.

所以我有两个问题:

  1. 这是缺陷吗(/kp/all 不能一起工作)?
  2. 有没有比调用 signtool verify 两次更好的方法,一次用 /pa /all 一次用 /kp 查看 所有时间戳 根据内核签名策略验证?

我最近偶然发现了 /kp/all 的相同问题,完全是偶然发现参数的顺序很重要。如果我指定 /kp /all,我会得到 The /all option is incompatible with the /kp option。但是,如果我通过了 /all /kp,验证就会顺利进行:它会枚举文件中的所有签名并全部检查。