Validate Authenticode signature on EXE - C++ without CAPICOM(在没有 CAPICOM 的情况下验证 EXE 上的 Authenticode 签名 - C++)
问题描述
我正在为安装程序 DLL 编写一个函数,以验证系统上已安装的 EXE 文件的 Authenticode 签名.
I'm writing a function for an installer DLL to verify the Authenticode signature of EXE files already installed on the system.
函数需要:
A) 验证签名是否有效.
B) 验证签名者是我们的组织.
A) verify that the signature is valid.
B) verify that the signer is our organization.
因为这是在安装程序中,并且因为它需要在较旧的 Win2k 安装上运行,所以我不想依赖 CAPICOM.dll,因为它可能不在目标系统上.
Because this is in an installer, and because this needs to run on older Win2k installations, I don't want to rely on CAPICOM.dll, as it may not be on the target system.
WinVerifyTrust API 可以很好地解决(A).
The WinVerifyTrust API works great to solve (A).
我需要找到一种方法将已知证书(或其中的属性)与签署相关 EXE 的证书进行比较.
I need to find a way to compare a known certificate (or properties therein) to the one that signed the EXE in question.
推荐答案
你应该使用 CryptQueryObject.
这篇 KB 文章演示了用法:如何从 Authenticode 签名的可执行文件中获取信息.
This KB-article demonstrates the use: How To Get Information from Authenticode Signed Executables.
对于询问如何在没有 Windows-API 的情况下执行此操作的评论者,我不知道任何可以执行此操作的库,但此处记录了格式:Windows Authenticode 可移植可执行签名格式
To the commenter that asked about how to do it without the Windows-APIs, I am not aware of any library that can do it, but the format is documented here: Windows Authenticode Portable Executable Signature Format
这篇关于在没有 CAPICOM 的情况下验证 EXE 上的 Authenticode 签名 - C++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在没有 CAPICOM 的情况下验证 EXE 上的 Authenticode 签
基础教程推荐
- 在 C++ 中循环遍历所有 Lua 全局变量 2021-01-01
- 为什么语句不能出现在命名空间范围内? 2021-01-01
- 使用从字符串中提取的参数调用函数 2022-01-01
- 管理共享内存应该分配多少内存?(助推) 2022-12-07
- 为 C/C++ 中的项目的 makefile 生成依赖项 2022-01-01
- 如何“在 Finder 中显示"或“在资源管理器中显 2021-01-01
- 从 std::cin 读取密码 2021-01-01
- 如何使图像调整大小以在 Qt 中缩放? 2021-01-01
- Windows Media Foundation 录制音频 2021-01-01
- 如何在不破坏 vtbl 的情况下做相当于 memset(this, ...) 的操作? 2022-01-01