我想检查我正在使用C#的项目中的一个.exe文件的可信度。
我已经推荐了- http://pinvoke.net/default.aspx/wintrust/WinVerifyTrust.html
这是我的代码片段。
WinTrustData wtd = new WinTrustData(filename);
Guid guidAction = new Guid(WINTRUST_ACTION_GENERIC_VERIFY_V2);
WinVerifyTrustResult result = WinVerifyTrust(INVALID_HANDLE_VALUE, guidAction, wtd);
bool valid = (result == WinVerifyTrustResult.Success);filename -只是.exe文件路径。
上面代码中提到的WinVerifyTrust()仅当机器至少连接到互联网一次时才返回"WinVerifyTrustResult.Success“。
然而,在fresh机器上,它返回"0x800b0100“,即- "Trust_e_nosignature”。
这是预期的行为吗?如果是,那么如何解决呢?
我搜索了这个特定的行为,但没有找到任何令人满意的答案。
发布于 2016-07-12 23:16:18
Windows (7+)附带的根证书集非常有限。
这些是按需下载的。这可能是为什么如果计算机以前从未连接到互联网(但我仍然认为仅仅连接到互联网是不够的,但需要浏览https页面或验证authenticode签名才能下载“正确”的根证书),authenticode签名无法被验证的原因。
您可以通过检查/计算连接到internet之前和之后安装在internet explorer中的ca证书来验证这一点。
https://stackoverflow.com/questions/38332814
复制相似问题