Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27412

How to verify Digital Signature validity of a File by CAPICOM

$
0
0
Greetings,
I am using CAPICOM.dll in vb.net 2010 to check the validity of any digitally signed file's signature.
Following are the codes i'm using :
Code:

        Dim signed As New CAPICOM.SignedCode
        signed.FileName = cFilname
        Try
            Dim cert = signed.Certificates(1)
            cert.IsValid.CheckFlag = CAPICOM_CHECK_FLAG.CAPICOM_CHECK_TRUSTED_ROOT Or _
      CAPICOM_CHECK_FLAG.CAPICOM_CHECK_TIME_VALIDITY Or _
      CAPICOM_CHECK_FLAG.CAPICOM_CHECK_SIGNATURE_VALIDITY Or _
      CAPICOM_CHECK_FLAG.CAPICOM_CHECK_ONLINE_REVOCATION_STATUS
            If cert.IsValid.Result Then
                TextBox2.Text &= "VALID" & vbNewLine
            Else
                TextBox2.Text &= "NOT VALID" & vbNewLine
            End If
        Catch
            TextBox2.Text &= "NOT VALID" & vbNewLine
        End Try

Above code is working fine to check if the file (exe) is containing a digital signature OR not.

Now, the problem is when I am checking this code with a file (which has fake digital signature), it is showing "Valid Signature"

Where I am doing wrong? Please suggest me. How can I check if the exe is containing a valid signature.


Thanks
Regards,

Viewing all articles
Browse latest Browse all 27412

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>