VB.NET
VB.NET
Verify and Unwrap PCKS7 Signed MIME
See more MIME Examples
Demonstrates calling the Verify method to verify and unwrap PKCS7 signed MIME. The MIME is restored to the original structure that it would have originally had prior to signing. The Verify method works with both detached signatures, as well as opaque/attached signatures.Chilkat VB.NET Downloads
Dim success As Boolean = False
' This example requires the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
Dim mime As New Chilkat.Mime
' A PKCS7 signature usually embeds both the signing
' certificate with its public key. Therefore, it is usually
' possible to verify a signature without the need to
' already have the certificate installed.
' Load the signed MIME from a file...
success = mime.LoadMimeFile("signedMime.txt")
If (success = False) Then
Debug.WriteLine(mime.LastErrorText)
Exit Sub
End If
' Verify the signed MIME and restore the MIME
' to the structure/content it had prior to signing.
Dim verified As Boolean
verified = mime.Verify()
If (verified = False) Then
Debug.WriteLine(mime.LastErrorText)
Exit Sub
End If
' Examine the MIME after signature verification (i.e. "unwrapping")
Debug.WriteLine(mime.GetMime())