从 .exe 中获取签名者姓名的命令

Command to get name of signer from a .exe

我想知道是否有一个命令会列出可以在 .exe 属性的数字签名部分中找到的信息。特别是我希望能够获取签名者的姓名。是否有可以为我生成该信息的命令?

尝试signtool.exe。使用以下关于 signtool 的参考,

https://msdn.microsoft.com/en-us/library/windows/desktop/aa387764(v=vs.85).aspx

要从用于创建 Authenticode 签名的签名者证书中获取使用者名称,您可以使用 Get-AuthenticodeSignature:

PS > $asig = Get-AuthenticodeSignature 'C:\Windows\System32\xcopy.exe'
PS > $asig.SignerCertificate.Subject

CN=Microsoft Windows, O=Microsoft Corporation, L=Redmond, S=Washington, C=US

您可能对公用名 (CN) 感兴趣,也许对组织名 (O) 感兴趣。您可以将主题中的专有名称解析为其组件以获取通用名称:

PS > $asig = Get-AuthenticodeSignature 'C:\Windows\System32\xcopy.exe'
PS > $dnDict = ($asig.SignerCertificate.Subject -split ', ') |
         foreach `
             { $dnDict = @{} } `
             { $item = $_.Split('='); $dnDict[$item[0]] = $item[1] } `
             { $dnDict }

PS > $dnDict['CN']

Microsoft Windows

PS > $dnDict['O']

Microsoft Corporation

Microsoft Windows Sysinternals 的 Sigcheck tool 可以将信息转储出来。使用 -c 命令行选项将输出格式化为 csv 格式,可以通过管道传输到文件以供以后处理。

Sigcheck is a command-line utility that shows file version number, timestamp information, and digital signature details, including certificate chains.