我正在尝试加载使用 MakeCert.exe 生成的证书签名的内核驱动程序。
我按照 Windows Driver Kit 文档中的说明进行操作:
- 使用 MakeCert.exe 对驱动程序进行签名
- 用 验证签名
SignTool verify /v /pa DriverFileName.sys。 - 使用CertMgr.exe将证书安装到测试计算机的 Trusted Root Certification Authorities store 和 Trusted Publishers store
当我SignTool verify /v /pa DriverFileName.sys按照 WDK Microsoft Docs 中所述验证签名时,SignTool 报告签名正常。我已经在开发计算机和应该加载驱动程序的测试机器上完成了这项工作。
但是,驱动程序实际上并没有加载。Windows CodeIntegrity 日志说3004: Windows is unable to verify the image integrity of the file \Device\HarddiskVolume3\path\DriverFileName.sys because file hash could not be found on the system. A recent hardware or software change might have installed a file that is signed incorrectly or damaged, or that might be malicious software from an unknown source.
我看了这个类似的问题。当我运行SignTool verify /v /kp DriverFileName.sys. 它说: SignTool Error: Signing Cert does not chain to a Microsoft Root Cert.
链接问题的解决方法涉及使用真实的非测试证书,并更改签名设置,以便正确链接到 Microsoft 根证书。我还没有到那个阶段;我只想让我的测试基础设施“正常”工作。
我有兴趣让内核加载我的驱动程序,并使用我在测试机器上手动安装的证书验证签名。我知道我可以用来bcdedit -set testsigning yes完全禁用签名验证,但这似乎有点过头了——它允许任何签名的驱动程序运行,即使它没有使用我在机器上安装的测试证书进行签名。是否可以关闭“测试签名”模式(因此驱动程序签名实际上仍根据已安装的证书进行验证),但仍使用我内部自行生成的 MakeCert.exe 测试证书?