Decrypting PGP/MIME on the command line

René Puls rpuls at kcore.de
Thu Mar 5 22:34:14 CET 2015


On Mon, 2 Mar 2015 16:40:11 +0100 René Puls wrote:
> > A tool that transforms an OpenPGP encrypted+signed MIME message into
> > an OpenPGP-signed MIME message while retaining the original
> > signature would be a really nice tool to have.
> 
> I will post here if I manage to come up with something useful. :-)

Here is my first attempt (Python 3.4 and GPGME bindings required):

https://github.com/kianga/pgpmime

Needless to say, this is HIGHLY EXPERIMENTAL – use at your own risk,
and keep backups of your e-mails! However, any feedback, patches or
pull requests are appreciated.

Current limitations:

- Tested against PGP/MIME encrypted messages created by Claws Mail only

- Does not handle inline PGP encrypted messages at all

More details are in the README.

To my surprise, it does seem to preserve signatures, but only if they
are not part of the encrypted message itself, but rather a separate
attachment inside the message.

It also does some strange things with the MIME structure: the resulting
message is a multipart/mixed with a single sub-part. My Claws Mail will
display this like any other message, but I have not tested it with other
mail clients yet.

Again, feedback is welcome, and please make backups. :-)

René



More information about the Gnupg-users mailing list