Windows:如何使用Certum颁发的证书签名exe?

我的目标是使用证书在Windows上签名未签名的可执行文件。 根据我的一般知识,我知道我需要一个公钥和一对私钥来进行数字签名。 我还安装了Windows SDK,它提供了signtool.exemakecert.exe

我已经在线获得证书,包括CER,PEM和CRT文件。

我现在的问题是如何使用这些工具和证书文件来签署可执行文件。 据此,CRT文件是私钥。 从我迄今为止学到的内容来看,CER和PEM文件基本相同,但编码不同。 他们有什么用途? 他们是公钥吗? 我如何签署我的可执行文件?

编辑:我已经尝试安装CRT文件到证书存储,然后使用该证书签名:

"C:Program Files (x86)Windows Kits8.1binx64signtool.exe" sign /debug /fd SHA256 /a /n "<Issued_To>" /t http://timestamp.comodoca.com/authenticode <Filename>

这里<Issued_To>被证书中的数据替换, <Filename>是我想签名的文件的名称。 我从signtool获得的输出如下:

The following certificates were considered:
    ...

    Issued to: ...
    Issued by: Certum Code Signing CA SHA2
    Expires:   Thu Oct 12 14:37:04 2017
    SHA1 hash: BA081A67D3F2DDDC9268121DCBA04F43D6CD37FB

    ...

After EKU filter, 1 certs were left.
After expiry filter, 1 certs were left.
After Subject Name filter, 1 certs were left.
After Private Key filter, 0 certs were left.
SignTool Error: No certificates were found that met all the given criteria.

这解决了我的问题:http://www.anse.de/programming/code-signing-for-open-source-executable

我使用Firefox将证书导出为PK2文件。 然后,我将此证书安装在Windows上的“个人”证书存储中。 之后我可以使用上述命令来签署我的可执行文件:

signtool sign /fd SHA256 /a /n "<Issued_To>" /t http://timestamp.comodoca.com/authenticode <Filename>

这里<Issued_To>匹配证书中的值, <Filename>是要签名的文件的名称。 之后对可执行文件进行签名。

链接地址: http://www.djcxy.com/p/67857.html

上一篇: Windows: How to sign exe using certificate issued by Certum?

下一篇: How to sign Microsoft Dynamics CRM Plugin with my own certificate from my CA