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: http://forum.rebex.net/questions/36/is-possible-use-rebex-security-cryptography-pkcs-namespace-for-external-detached, 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.

Grettings

asked 29 Jun '10, 09:12

Sergy's gravatar image

Sergy
161
accept rate: 0%

edited 10 Aug '10, 13:11

Rebex%20KB's gravatar image

Rebex KB ♦♦
256312


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:

C#

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

// load the message from a local disk file 
message.Load("c:\\message.eml");

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

VB.NET

'create an instance of MailMessage 
Dim message As New MailMessage

'load the message from a local disk file 
message.Load("c:\message.eml")

'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.")
    Else 
        Console.WriteLine("The signature is not valid.")
    End If 
Else 
    Console.WriteLine("The message is not signed.")
End If 
link

answered 29 Jun '10, 12:45

Lukas%20Pokorny's gravatar image

Lukas Pokorny ♦♦
2.2k18
accept rate: 32%

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

However, I appreciate your help.

Best regards.

link

answered 29 Jun '10, 14:28

Sergy's gravatar image

Sergy
161
accept rate: 0%

In that case, check out sections 3.4.2 and 3.4.3 of RFC 3851 (http://www.ietf.org/rfc/rfc3851.txt) 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

(30 Jun '10, 08:25) Lukas Pokorny ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×46
×11
×3

Asked: 29 Jun '10, 09:12

Seen: 903 times

Last updated: 04 Apr '11, 20:24