How to create encrypted MIME message using basic framrwork classes?
Hi!
I ahve been tasked with implementing a library that can create and receive encrypted messages in the S/MIME standard. A message can look like this:
Code:
MIME-Version: 1.0
Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg="sha1"; boundary="----3239E3706D19BB8325856E4D1909EA94"
This is an S/MIME signed message
------3239E3E06D19BB8325856E4D1909FA94
Content-Type: text/plain
eX1W7TiIG4DK4xyx5MRU
------3239E3E06D19BB8325856E4D1909FA94
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smi.p7s"
MIICugYJKoZIhvcNAQcCoIICqzCCAqcCAQExCzAJBgUrDgMCGgUAMAsGCSqGSIb3
DQEHATGCAoYwggKCAgEBMIGDMHoxFzAVBgNVBAsTDnNhZi5kZXYud2lwLnNlMTUw
I have no idea how to do this? I have looked at some examples but they include 3rd part libraries and are heavily focused on sending emails.
I was hoping I could use the HttpWebRequest and manually create the message, but it doesn't seem to work considering I have to encrypt/decrypt the messages.
Anyone with ideas? I have spent 3 Days googling but haven't found anything that could help me.
/S
Re: How to create encrypted MIME message using basic framrwork classes?
How are these messages transmitted and received if not via email?
Re: How to create encrypted MIME message using basic framrwork classes?
Just to give you some more info... we plan to use this in Windows 8/Phone 8 hence we can't use the standard Cryptography libraries, but are forced to use the 3rd party library from Bounce Castle.
But the question is quite generic I guess, how do I build a S/MIME message with an encrypted body? Note, this is NOT for email but for sending messages in a custom xml format.
/S
Re: How to create encrypted MIME message using basic framrwork classes?
Quote:
Originally Posted by
dunfiddlin
How are these messages transmitted and received if not via email?
We use the HttpWebRequest() class
We got this project from the Android team and they used Bounce Castle with built in support for creating S/MIME messages. Sadly, this support is not available in the C# port of the library.
As a last resort, we could try and build the mssage using stringbuilder, and use the cms-classes in Bounce Castle for the encrypt/decrypt of the message body.
/S