Microsoft 安全目录格式文档和 API 示例
我正在寻找有关使用 Microsoft 安全目录的 API 的任何文档,或者作为替代,有关文件格式的信息,以便我可以编写自己的解析器。
简而言之,我有一些需要使用的 .cat 文件。在十六进制编辑器中查看文件,它们显然有不同的区域,这些区域以某种方式分隔(看起来像典型的二进制保存的结构)。我需要从其中获取某些信息,并忽略其他信息。
我可能可以对格式进行逆向工程并解析出我需要的内容,但我更愿意通过 Win32 API 来做到这一点,或者至少编写我的解析器以使其格式正确,而不是仅仅“能够执行我的操作”需要它来做”。
MSCAT32.DLL 似乎是重要的一个,但我不确定它是否有导出来做我需要的事情......它有点神秘(没有双关语)。
任何信息都会有帮助。
只是在这里多扔几个关键字...
MIME 类型是:application/vnd.ms-pki.seccat 魔术头字节为:30 80 09 06 文件中的字段分隔符似乎是:EOT (04) 和 € (80) 生成它们的程序是:MakeCat.exe
I'm looking for any documentation on the API for working with Microsoft Security Catalogs, or in lieu of that, information on the file format so that I may write my own parser.
In short, I have some .cat files that I need to be able to work with. Looking at the file in a hex editor, they obviously have different regions, which are delimited somehow (looks like typical binary saved structs). I need to get certain information out of them, and ignore other information.
I could probably reverse engineer the format and parse out what I need, but I'd prefer to do that either through the Win32 API, or at least write my parser to be correct for the format, instead of just "able to do what I need it to do".
MSCAT32.DLL seems to be the signficant one, but I'm not sure it has exports to do what I need... It's a bit cryptic (no pun intended).
Any information at all would be helpful.
Just to toss a few more keywords in here...
The MIME type is: application/vnd.ms-pki.seccat
The magic header bytes are: 30 80 09 06
The field delimiters in the file seem to be: EOT (04) and € (80)
A program that generates them is: MakeCat.exe
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Microsoft 安全目录只不过是以 ASN.1 DER 格式编码的二进制文件。文件内包含 PKCS#7 签名数据以及 Microsoft 特定内容的附加字段(使用 Microsoft OID 编码)。
可以在此处找到这些 OID 的列表:https://support.microsoft.com/en -us/kb/287547
如果您想解码 ASN.1 DER,请使用以下基于 JavaScript 的编码器: http://lapo.it/asn1js/
顺便说一句:
30 80 09 06
不是文件魔法,但意味着存在一个构造性的SEQUENCE
从那里开始长度未知。 ASN.1 DER 文件没有任何魔力,但以SEQUENCE
开头(在许多情况下,在 DER 中编码为0x30
)。Microsoft Security Catalogs are nothing more than binary files, coded in ASN.1 DER format. Inside the file is PKCS#7 signed data with additional fields for Microsoft specific stuff (coded with Microsoft OIDs).
A list of these OIDs can be found here: https://support.microsoft.com/en-us/kb/287547
If you want to decode ASN.1 DER, use for example this JavaScript based encoder: http://lapo.it/asn1js/
By the way:
30 80 09 06
is not the file magic, but means there is a constructiveSEQUENCE
with unknown length starting there. ASN.1 DER Files do not have any magic, but start with aSEQUENCE
(which is coded in DER as0x30
in many cases.以下是 makecat 使用的 wintrust 调用的定义
查看目录定义函数目录函数 由证书信任列表 (CTL) 组成 已由受信任实体签名的预定义项目列表。 CTL 可以是任何内容,例如证书哈希列表或文件名列表。列表中的所有项目均由签名实体验证(批准)。
依次由 pkcs#7 blob 组成
Here is a definition of the wintrust calls that are used by makecat
Look under Catalog Definition Functions Catalog Functions which are made up of certificate trust list (CTL) A predefined list of items that have been signed by a trusted entity. A CTL can be anything, such as a list of hashes of certificates, or a list of file names. All the items in the list are authenticated (approved) by the signing entity.
which in turn are composed on pkcs#7 blobs
您好,为了在 Linux(和其他系统)上完全构建 Windows 驱动程序,我编写了一个小型 C 程序,该程序可以在 C99 编译器可用的任何地方生成 cat 文件。该项目是开源的(GPL),可以从 github 获取:
https://github.com/ LINBIT/generate-cat-file
据我所知,现在可以首次在 Linux 上使用开源工具完全构建 Windows 驱动程序(不需要 Windows 机器):)
祝黑客快乐,
Hi in order to build Windows Drivers completely on Linux (and other systems) I wrote a small C program that generates the cat file everywhere a C99 compiler is available. The project is OpenSource (GPL) and can be obtained from github:
https://github.com/LINBIT/generate-cat-file
To my knowledge it is now possible to build Windows Drivers completely with Open Source tools on Linux for the fist time (without requiring a Windows machine) :)
Happy hacking,