e2email-org / e2email

E2EMail is a simple Chrome application - a Gmail client that exchanges OpenPGP mail.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Attachments support

koto opened this issue · comments

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.

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

// Case 4: Unidentifiable / unsupported MIME content.

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

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/

This will be addressed in #30.