在以下代码片段中,WinVerifyTrust 为系统上加载并运行的内核驱动程序文件 (.sys) 返回 CERT_E_UNTRUSTEDROOT:
GUID guidAction = DRIVER_ACTION_VERIFY;
WINTRUST_FILE_INFO sWintrustFileInfo = { 0 };
WINTRUST_DATA sWintrustData = { 0 };
HRESULT hr = 0;
sWintrustFileInfo.cbStruct = sizeof(WINTRUST_FILE_INFO);
sWintrustFileInfo.pcwszFilePath = argv[1];
sWintrustFileInfo.hFile = NULL;
sWintrustData.cbStruct = sizeof(WINTRUST_DATA);
sWintrustData.dwUIChoice = WTD_UI_NONE;
sWintrustData.fdwRevocationChecks = WTD_REVOKE_NONE;
sWintrustData.dwUnionChoice = WTD_CHOICE_FILE;
sWintrustData.pFile = &sWintrustFileInfo;
sWintrustData.dwStateAction = WTD_STATEACTION_VERIFY;
hr = WinVerifyTrust((HWND)INVALID_HANDLE_VALUE, &guidAction, &sWintrustData);
一些有趣的点: - 驱动程序使用 SHA-256 使用有效(购买的)证书进行签名。- KB3033929 安装在系统上 (Win7/32) - 从文件属性查看证书时,整个证书链显示为有效
我打电话给 WinVerifyTrust 错了吗?
替代问题:是否有另一种方式知道(通过存在注册表项或类似的东西)基于 SHA-256 的代码签名验证在目标系统上可用?(我需要在安装过程中验证这一点......)
谢谢 :)