I want to verify file certificate. The signature was generating using sha1 and RSA. When right clicking the file, selecting properties, Digital Signatures, Details I see the following:

I have C++ code that verifies such a signature, using WinVerifyTrust.
However I googled - I just couldn't find C# way of doing it.
I tried to export the certificate to file, and then took from the file properties the Message Digest:
Create X509 Certificate, and verify hash - nothing worked.
Any help will be appreciated.
CLARIFICATION
In short: Given a file, how can I verify it is signed by a trusted certificate?
You are looking for : X509Certificate.CreateFromSignedFile
try
{
X509Certificate theSigner = X509Certificate.CreateFromSignedFile("c:\\r\\1.dll");
Console.Write("certificate info :"+ theSigner.GetCertHashString());
}
catch (Exception ex)
{
Console.WriteLine("No digital signature ");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With