login about faq

I've the s/mime encrypted text files.I need to decrypt the given text files and show the orignial content to user. The content look like below. Needs help.

Message-ID: 20631685.1349796827856.abc@def.com Date: Sat, 9 Jan 2013 10:33:47 -0500 (CDT) To: test@abc.com From: test@abc.com Subject: testing MIME-Version: 1.0 Content-Disposition: attachment; filename="smime.p7m" Content-Type: application/x-pkcs7-mime; name="smime.p7m" Content-Transfer-Encoding: base64 Content-Length: 19217

MIAGCSqGSIb3DQEHA6CAMIACAQAxggRRMIIBigIBADCB8jCB3TELMAkGA1UEBhMCVVMxFzAVBgNV BAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMTswOQYD VQQLEzJUZXJtcyBvZiB1c2UgYXQgaHR0cHM6Ly93d3cudmVyaXNpZ24uY29tL3JwYSAoYykwOTEe MBwGA1UECxMVUGVyc29uYSBOb3QgVmFsaWRhdGVkMTcwNQYDVQQDEy5WZXJpU2lnbiBDbGFzcyAx

asked Mar 11 '13 at 06:44

kumar's gravatar image

kumar
1334

edited Mar 11 '13 at 06:56


bool success = false;
string filename = @"c:\temp\ecrypted.txt";
Chilkat.Mime mime = new Chilkat.Mime();
string license = "30 Days Trial Key";
success = mime.UnlockComponent(license);
success = mime.LoadMimeFile(filename);           
success = mime.Decrypt2(objCert, objPrivateKey);
string result = mime.GetMime();
using (StreamWriter writer = new StreamWriter(@"c:\temp\decrypted.txt"))
{
writer.Write(result);

}

o/p : decrypted.txt:

Message-ID: 20631685.1349796827856.abc@def.com Date: Sat, 9 Jan 2013 10:33:47 -0500 (CDT) To: test@abc.com From: test@abc.com Subject: testing MIME-Version: 1.0 Content-Disposition: attachment; filename="smime.p7m" Content-Type: application/x-pkcs7-mime; name="smime.p7m" Content-Transfer-Encoding: base64 Content-Length: 19217

***Decrypted Content stars here**

link

answered Mar 19 '13 at 08:45

kumar's gravatar image

kumar
1334

edited Mar 19 '13 at 08:53

or we can use mailman for decrypt the test file,

 MailMan mailman  = new MailMan();
 success = mailman.UnlockComponent("30daytrial");
 mailman.SetDecryptCert2(objCert, objPrivateKey);
  Email mail = objMailman.LoadEml(filename);
  string resultText = mail.GetMime();
link

answered Mar 21 '13 at 03:01

kumar's gravatar image

kumar
1334

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:

×18
×15
×7
×6

Asked: Mar 11 '13 at 06:44

Seen: 2,386 times

Last updated: Mar 21 '13 at 03:01

powered by OSQA