On 07/08/2009 Maximilien Cuony [The_Glu] wrote:
I'm for the second solution. As roundcube already handle encrypted mail (to display an error), why not patch the core who, if an encryption plugin is available, use it ?
ok, but i suggest to implement it the following way:
at the very start of parse_structure(), parse the message/mime_part for encrypted/signed content (both mime and inline), if appropriative verify signature or decrypt encrypted data, and send the result back to a new instance of parse_structure() recursively. afterwards stop the functions.
i.e.
function parse_structure($structure, $recursive = false) { $message_ctype_primary = strtolower($structure->ctype_primary); $message_ctype_secondary = strtolower($structure->ctype_secondary); if (is_signed($structure)) { $structure_new = verify($structure); parse_structure($structure_new, true); return; else if (is_encrypted($structure)) { $structure_new = decrypt($structure); parse_structure($structure_new, true); return; }
[ rest of parse_structure() ]
[ handle encrypted attachments later ]
}
in my eyes that is the most elegant way to support wrapped mime parts/signatures etc. inside encrypted messages. i.e. one could receive an encrypted message with the following structure:
Content-Type: multipart/encrypted; protocol="application/pgp-encrypted"; boundary="foobar" Content-Disposition: inline
--foobar Content-Type: application/pgp-encrypted Content-Disposition: attachment
Version: 1
--foobar Content-Type: application/octet-stream Content-Disposition: inline; filename="msg.asc"
-----BEGIN PGP MESSAGE----- Version: GnuPG v1.4.9 (GNU/Linux)
[...] -----END PGP MESSAGE-----
--foobar--
and the encrypted msg.asc then contains the following structure:
Content-Type: multipart/mixed; boundary="barfoo"
--barfoo Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit
[some text message]
--barfoo Content-Type: message/rfc822 MIME-Version: 1.0
[lot's of headers] Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit
[some html message]
--barfoo Content-Type: message/rfc822 MIME-Version: 1.0
[lot's of headers] Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit
[some second text message] --barfoo--
greetings, jonas
--- 8< --- detachments --- 8< --- The following attachments have been detached and are available for viewing. http://detached.gigo.com/rc/r3/jkxEhCoZ/signature.asc Only click these links if you trust the sender, as well as this message. --- 8< --- detachments --- 8< ---
List info: http://lists.roundcube.net/dev/