e2email-org / e2email

E2EMail is a simple Chrome application - a Gmail client that exchanges OpenPGP mail.
Apache License 2.0
806 stars 62 forks source link

Attachments support #7

Closed koto closed 8 years ago

koto commented 8 years ago

We need to support attachments.

https://www.mailpile.is/blog/2014-11-21_To_PGP_MIME_Or_Not.html

Preferably, this format should be supported:

  |  From: Alice <a1234@wonderland.com>
  |  To: Bob <b9973@builders.com>
  |  Cc: Jar Jar Binks <omgwtf@lucasfilm.com>
  |  Subject: I have a secret
  |  Content-Type: multipart/encrypted;
  |                protocol="application/pgp-encrypted";
  |                boundary="==12345=="
  |
  |  --==12345==
  |  Content-Type: application/pgp-encrypted
  |  Content-Disposition: attachment
  |
  |  Version: 1
  |
  |  --==12345==
  |  Content-Type: application/octet-stream
  |  Content-Disposition: attachment; filename="msg.asc"
  |
  |  -----BEGIN PGP MESSAGE-----
  |  Version: GnuPG v1
  |
  E  Content-Type: multipart/mixed; boundary="==67890=="
  E
  E  --==67890==
  E  Content-Type: text/plain; charset='utf-8'
  E
  E  I am not wearing any socks!!
  E
  E  --==67890==
  E  Content-Type: image/jpeg
  E  Content-Disposition: attachment; filename="my-toes.jpg"
  E
  E  [BASE64 ENCODED PICTURE OF NAUGHTY TOES]
  E  --==67890==--
  |  -----END PGP MESSAGE-----
  |
  |  --==12345==--

where lines marked with E are a decryption of an OpenPGP message, such that the number of attachments, their size and filenames are encrypted.

koto commented 8 years ago

As far as I can tell, parsing those messages would already be supported by modifying this part.

https://github.com/e2email-org/e2email/blob/05a24965c7bd97c75d5eada1857f222acf546ff7/chrome/components/gmail/gmail-service.js#L1910

gmail-service expects the decryption to contain a MIME tree already.

tanx commented 8 years ago

If it's any help, this is how hoodiecrow handels PGP/MIME using the gmail api:

Receiving: https://github.com/tanx/hoodiecrow/blob/master/src/js/email/gmail.js#L315-L423

Sending: https://github.com/tanx/hoodiecrow/blob/master/src/js/email/gmail.js#L451-L487

This does not support the new memoryhole proposal yet though: https://github.com/modernpgp/memoryhole/

koto commented 8 years ago

This will be addressed in #30.