是否可以通过.NET代码签名二进制文件? (没有signtool.exe) [英] Is is possible to sign a binary via .NET code? (no signtool.exe)

查看:91
本文介绍了是否可以通过.NET代码签名二进制文件? (没有signtool.exe)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下要求,用证书签名二进制文件,但没有signtool.exe;

I've the following requirement, sign a binary with a certificate, but without signtool.exe; the idea would be to do it via code.

你知道是否可能?

推荐答案

您需要使用 SignerSign 或从mssign32导出的 SignerSignEx 功能.dll。

You will need to use the SignerSign or SignerSignEx functions that are exported from mssign32.dll.

要使用这些版本,您需要定义 SIGNER_SUBJECT_INFO SIGNER_FILE_INFO SIGNER_CERT SIGNER_SIGNATURE_INFO 等结构,然后正确指定P / Invoke

To use these, you'll need to define managed versions of the SIGNER_SUBJECT_INFO, SIGNER_FILE_INFO, SIGNER_CERT, SIGNER_SIGNATURE_INFO, etc. structs, then correctly specify the P/Invoke signature for the native method.

中途通过本博文,有一个C ++示例调用 SignerSignEx ; Mark 已将其移植到此 StackOverflow answer

Halfway through this blog post, there is a C++ example of calling SignerSignEx; Mark has ported it to C# in this StackOverflow answer.

这篇关于是否可以通过.NET代码签名二进制文件? (没有signtool.exe)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆