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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.