Verify signed e-mail with VB.NET 2010

0 votes
asked Jun 29, 2010 by Sergy (170 points)
edited Mar 19, 2013

Hi, I´m trying to create and verify an e-mail using VB.NET 2010. I have a problem, I do not know what part of my e-mail is "ContentInfo". I have a smime.p7s file, but looking your C# code on this old post:, I can´t apply to my project in VB.NET 2010.

Could you say me what part of e-mail is "ContentInfo" and if you can, show me the VB.NET code.


Applies to: Rebex Secure Mail

3 Answers

+1 vote
answered Jun 29, 2010 by Lukas Pokorny (128,250 points)
edited Apr 4, 2011

The C# code from that link is only intended for rare occurrences where you don't have any e-mail but have a stand-alone file and its signature (a .p7s file) instead and need to validate that.

Normally, you only need to validate a signed e-mail. In that case, all you need is the code from this tutorial:


// create an instance of MailMessage 
MailMessage message = new MailMessage();

// load the message from a local disk file 

// validate the signature if the message is signed 
if (message.IsSigned)
    MailSignatureValidity result = message.ValidateSignature();
    if (result.Valid)
        Console.WriteLine("The signature is valid.");
        Console.WriteLine("The signature is not valid.");
    Console.WriteLine("The message is not signed.");


'create an instance of MailMessage 
Dim message As New MailMessage

'load the message from a local disk file 

'validate the signature if the message is signed 
If message.IsSigned Then 
    Dim result As MailSignatureValidity = message.ValidateSignature()
    If result.Valid Then 
        Console.WriteLine("The signature is valid.")
        Console.WriteLine("The signature is not valid.")
    End If 
    Console.WriteLine("The message is not signed.")
End If 
0 votes
answered Jun 29, 2010 by Sergy (170 points)
edited Jun 29, 2010

Ok, thanks Lukas, but I have my own library...then this code I can´t use.

However, I appreciate your help.

Best regards.

commented Jun 30, 2010 by Lukas Pokorny (128,250 points)
In that case, check out sections 3.4.2 and 3.4.3 of RFC 3851 ( for more information about this - it describes which part of an e-mail is ContentInfo for two different signed message variants. ContentInfo is the content of the e-mail's multipart/signed
–2 votes
answered Mar 18, 2013 by anonymous
edited Mar 19, 2013

I found this library for verifying email addresses in .net:

commented Mar 19, 2013 by Martin Vobr (12,950 points)
edited Mar 19, 2013

It seems like the product mentioned by you is for completly different kind of validation. Your link is for validation whether email address is valid. The original poster asked for crypto signature validation of email message content.