From time to time, I participate in PGP/GnuPG key signing parties to strengthen the web of trust. Before joining the last key signing party, the organizer asked to send in the public keys via e-mail. Shortly after sending my public keys, I got a reply from the organizer, stating that the sent public keys are not readable. This happened the second time, so something is broken.

Details about the issue

Here are the steps to reproduce the problem:

  • Export a minimal version of a GnuPG public key:

    $ gpg --export-options export-minimal -a --export <keyid> >pubkey.asc
    
  • Compose a new e-mail in Mutt.

  • Attach the created file: pubkey.asc.

  • Send the e-mail.

The recipient gets an e-mail with the following attachment:

Version: 1

As pointed out by S.N, this seems to be the first multipart of a PGP/MIME message. The second part (containing the content) is missing. See RFC3156 for details.

When attaching the file pubkey.asc, Mutt detects its encoding as application/pgp-encrypted. Mutt even has some special treatment for files of this mime type. It simply replaces its content with the string: Version 1.

Possible solutions

There are multiple possible solutions to this problem:

  • Manually change the mime type of the attachment to application/pgp-keys. This is error prone and at least I will most likely forget it.

  • Remove/comment the relevant line in /etc/mime.types.

    $ grep 'application/pgp-encrypted' /etc/mime.types
    application/pgp-encrypted                  asc pgp
    
  • Fix the special treatment for files with mime type application/pgp-encrypted in Mutt.

Additional reference and credits

Update (2015-01-10)

Mutt provides the function attach-key (mapped to <Esc>k by default) for sending a public key. This function sets the mime type properly. Unfortunately, attach-key is broken, when the gpgme backend is used. See http://dev.mutt.org/trac/ticket/3488 for details.