Hello,

How to store digital sign in received mail and what are different ways to store digital sign

After storing the digital sign and how to use the same sign for encrypt the mail

Thanks Chandru

asked 10 May '11, 05:37

chandrujcet's gravatar image

chandrujcet
15
accept rate: 0%


Public-key of the received signed mail can be stored as follows:

// load a mail or retrieve it using POP3 or IMAP
MailMessage receivedSignedMail = new MailMessage();

// store signer certificate
if (receivedSignedMail.Signers.Count > 0)
{
    // get the first signer certificate
    Certificate signerCert = receivedSignedMail.Signers[0].Certificate;

    // save the certificate to a file
    File.WriteAllBytes("path.cer", signerCert.GetRawCertData());
}

The saved Public-key can be load and used for encryption as follows:

// load certificate
Certificate cert = Certificate.LoadDer("path.cer");

// prepare a mail for encryption
MailMessage encryptedMailToSend = new MailMessage();
// ...

// encrypt the mail
encryptedMailToSend.Encrypt(cert);

For information about certificates, signing and encrypting please visit our blog or Wikipedia.

link

answered 10 May '11, 16:11

Lukas%20Matyska's gravatar image

Lukas Matyska ♦♦
90117
accept rate: 28%

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:

×36

Asked: 10 May '11, 05:37

Seen: 308 times

Last updated: 10 May '11, 16:11