Results 1 to 4 of 4

Thread: How to create encrypted MIME message using basic framrwork classes?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    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

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: How to create encrypted MIME message using basic framrwork classes?

    How are these messages transmitted and received if not via email?
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    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

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    Re: How to create encrypted MIME message using basic framrwork classes?

    Quote Originally Posted by dunfiddlin View Post
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width