Decrypting GPG/PGP email messages

Paul Rubin http
Thu Sep 1 12:15:58 CEST 2005

Alessandro Bottoni <alessandro.bottoni at> writes:
> 1) What would you use to decrypt the messages? The GPG module created by
> Andrew Kuchling is declared "incomplete" and "no more maintained" on his
> web pages ( so I think it is out of the
> game. 

I think I'd just run gpg as an external command.  I've done that from
perl scripts and it's pretty simple.

> Would you use OpenPGP ( Any
> other module?

Oh hey, I didn't know about that, I'll have to look at it.  I started
writing something similar a long time ago and got as far as being able
to decrypt straightforward messages, and have been meaning to get back
to it.  But it's great if someone else is doing it more seriously.q

> 2) I did not find any mention of _encrypted attachments_ on the Net. Does
> anybody know of a tutorial or a guide that explains how to encrypt (with
> Thunderbird/Enigmail) and decrypt (with Python) the (ANSI text) files
> attached to a email message?

PGP/GPG have their own base64 encoding called "ascii armor" in PGP
lingo.  This stuff predates widespread use of MIME and traditionally,
PGP messages are sent as ascii armored plain text, not attachments.
You'd just send messages like:

    From: alice
    To: bob
    Subject: encrypted message

    -----BEGIN PGP MESSAGE-----
    Version: GnuPG v1.2.1 (GNU/Linux)

    -----END PGP MESSAGE-----

Note the complete absence of mime headers and separators.  As far as
the mail agents are concerned, the message is just text.

I'm not sure how the Thunderbird/Enigmail plugins work.

More information about the Python-list mailing list