December 20, 2008

Why you should not use old-style PGP encrypted / signed messages

Category: Sysadmin.

Just received another mail signed in the the old-style way:

Hash: SHA1 ②


- -- ③
Membre de l'April - « promouvoir et défendre le logiciel libre » -

Version: GnuPG v1.4.9 (GNU/Linux) ⑤
Comment: Using GnuPG with Mozilla -


First, it is really painful since a lot a junk prevent the mail from being read easily:

Well, most mail user agents will however be able to handle this kind of old-style signed messages. For example, in mutt, the <Esc>P command will process the message through GnuPG.

However, things are still not perfect: the original old-style signed message has the Content-Type set to text/plain; charset="iso-8859-1" and Content-Transfer-Encoding set to quoted-printable. As a consequence, reading the message as raw text displays accents like this:

Membre de l'April - =AB promouvoir et d=E9fendre le logiciel libre =BB -

This is exactly what GnuPG reads when it processes the message. So it basically reads ASCII and output ASCII, the iso-8859-1 charset information being only used by the mail user agent after the message is unquoted. The problem is that the mail part that replaced the original one is of type application/pgp, that is without charset specification. As a consequence, when the mail user agent unquote the message, as no charset is provided, it assumes the message is written in ASCII which is the default (for details, please refer to RFC822).

This results in invalid characters written to the terminal:

Membre de l'April - \253 promouvoir et d\351fendre le logiciel libre \273 -

The message is still painful to read. This is definitively a bug in the sender's mail user agent: it should not be possible to send old-style PGP signed/encrypted messages in a charset different form ASCII since there is no way for the recipient's mail user agent to know the charset of the mail (some user agents will do assumptions though).

There is another way to sign/encrypt messages using MIME types as detail in RFC2015. While some bogus user agents will not handle this very cleanly (under some circumstances, Outlook Express will only display the message as an attachment), the different pieces of the message (message, signature) are different parts of the mail (MIME multipart).

To sum up, I copy/paste here the configuration option of mutt to set the behavior of the user agent regarding old-style signing/encrypting:

              Type: quadoption
              Default: no

              This  option  controls  whether  Mutt  generates  old-style  PGP
              encrypted or signed messages under certain circumstances.

              Note that PGP/MIME will be used automatically for messages which
              have a character set different from us-ascii, or  which  consist
              of more than a single MIME part.

              Also  note  that  using  the  old-style  PGP  message  format is
              strongly deprecated.

So, please, configure your mail user agent correctly and use MIME attachments for PGP signed/encrypted messages.

No Comments Yet

Comments RSS feed | Leave a Reply…