Read signed date from a digitally signed file

chuoitieu

Member
Joined
Sep 16, 2009
Messages
5
Programming Experience
1-3
Hi guys,
I want to extract signed date from a digitally signed file (.dll, .exe) by VB.Net but don't know how. Can someone help with some hints or sample code?

Thank you very much.
CT
 
I am not sure what you mean by extract a signed date. But you should be able to create a project with a reference to the said .DLL and reference the Objects, Properties, Functions, etc. from the file through your code.
 
Hi guy,
Thanks very much for your reply. May be I am not very clear on this. I create a dll for use in several projects. Before releasing, I sign my dll with a digital signature (by tool provided by digital signature provider). What I want is a way to read signed date, then write a routine to do this to determine what file (if same name) is newer based on digitally signed date. Of course, I can do it manually by choosing the file, and do mouse right click and choose property, but an automatic way by VB.Net code is desired.

Thank you very much,
TD
 
Add reference to CAPICOM library (COM tab), and use the SignedCode class.
Dim signed As New CAPICOM.SignedCode
signed.FileName = "C:\file.exe"
Dim cert = signed.Signer.Certificate
Debug.WriteLine("IssuerName " & cert.IssuerName)
Debug.WriteLine("ValidFromDate " & cert.ValidFromDate)
Debug.WriteLine("ValidToDate " & cert.ValidToDate)
For Each att As CAPICOM.Attribute In signed.TimeStamper.AuthenticatedAttributes
    ' one Name here is CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME, its Value is type Date.
    If att.Name = CAPICOM.CAPICOM_ATTRIBUTE.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME Then
        Debug.WriteLine("SIGNING_TIME " & CDate(att.Value).ToShortDateString)
    End If
Next
 
Back
Top