Reputation: 4018
I've the following requirement, sign a binary with a certificate, but without signtool.exe; the idea would be to do it via code.
Do you know if it's possible?
Upvotes: 3
Views: 1530
Reputation: 28162
You will need to use the SignerSign or SignerSignEx functions that are exported from mssign32.dll.
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.
Halfway through this blog post, there is a C++ example of calling SignerSignEx
; Mark has ported it to C# in this StackOverflow answer.
Upvotes: 4