[RCD] GnuPG/PGP plugin for roundcube

Jonas Meurer jonas at freesources.org
Sat Aug 29 04:57:17 CEST 2009

hey again,

On 06/08/2009 Jonas Meurer wrote:
> On 29/07/2009 Thomas Bruederli wrote:
> > We would certainly appreciate a plugin-based solution for PGP support. Due 
> > lack of time we didn't start to code one ourselves but you'll get any 
> > support you need. I think some more plugin-hooks are required to make this 
> > work since encrypted message parts are currently just ignored.
> after reading parts of roundcube code (especially rcube_message.php)
> several times and thinking about the possibilities to implement a crypt
> plugin here are my current ideas:
> i guess it will be very hard to implement a plugin that adds full
> support for encrypted and signed messages to roundcube. the reason is,
> that rcube_message.php already does a lot of message/mime parsing, and
> i doubt that there's _one_ best place in parse_structure() where
> potentially encrypted and/or signed message could be given to the
> plugin via hook. that's due to the reason that messages with encrypted
> and/or signed parts could have any possible structure, with or without
> mime parts, with or without attachments and so on.

i spent the whole day working on PGP support for roundcube.
unfortunately i didn't get that far. the code is still in a very early
state and i don't think it's worth being shared in a svn repository yet.
i've yet to figure out lots of implementation details.

as already mentioned earlier, it's not really fun to work with the mime
parsing code in roundcube. implementing a feature (like PGP support)
which needs to access, modify and extend the mime structure of messages
is a pain.

so far i've isolated two major blockers:

the PGP plugin needs access to the raw content of mime parts.
verify_mime() requires the _exact_ raw content, not a stripped down,
parsed or otherwise modified version. this is not possible yet.
$this->get_part_content($mime_id) from rcube_message.php, and even
iil_C_HandlePartBody($this->conn, $this->mailbox, $uid, true, $part)
from rcube_imap.php give back stripped down versions of the content.
i wonder whether it's possible to access the raw content at all.

second, PGP encrypted messages may contain lots of different mime
structures. thus, the mime structure of the decrypted message needs to
be parsed again. in other words, get_structure() from rcube_imap.php
should be invoked for the decrypted message. i guess that needs to be
done within rcube_mail.php, as functions from rcube_imap.php aren't
available in the plugin.

as you can see, implementing PGP support in a plugin is impossible.
large parts of message processing need to be done in the core roundcube
code instead as the plugin api doesn't provide the required functions.

still i intend to keep as much code as possible in the plugin. pgp
configuration, key management and particularly the encryption,
decryption, signation and signature verification functions should reside
in the plugin.

i adapted the idea to support different drivers from the password
plugin. that way it should be easy to write drivers for different pgp
implementations (different php library, direct use of the binary, ...)
and maybe it's even possible to implement different encryption
techniques like s/mime.

i'm fairly new to roundcube, and it's been some time that i last coded
php. if i missed anything, or if you have ideas on how to solve the
problems i mentioned above, please don't hesitate to criticise and/or
comment on my thought. i would highly appreciate that :-)

last but not least: the reason why i didn't commit the code i wrote to
a svn repository so far is merely that i don't consider the code useful
yet. it contains thousands of (mostly commented out) console() calls
which help me to visualize the dataflow. appart from that the only thing
that's working already is verification of signatures for pgp inline
mails :-/

if you would like to help me with implementation (that would be great!),
please contact me. it should be possible to organize an irc meeting or
something similar to discuss the further proceeding.


 --- 8< --- detachments --- 8< ---
 The following attachments have been detached and are available for viewing.
 Only click these links if you trust the sender, as well as this message.
 --- 8< --- detachments --- 8< ---

-------------- next part --------------
List info: http://lists.roundcube.net/dev/

More information about the Dev mailing list