[neomutt-users] Support for OpenPGP header field

Jörg Sommer joerg at alea.gnuu.de
Tue Dec 11 21:35:31 CET 2018


Hi,

I've found out about the header field OpenPGP, which might contain a
reference to the senders PGP key and his preference about getting
encrypted or signed mails.

http://josefsson.org/openpgp-header/draft-josefsson-openpgp-mailnews-header.txt

My idea was to use these hooks to support this field, but it doesn't work
as expected. It doesn't clear the pseudo-field after sending the mail and
it fails for mailing lists. Maybe, someone else has a better idea.

reply-hook '~h "openpgp:.*preference=signencrypt"' my_hdr 'PGP: ES'
reply-hook '~h "openpgp:.*preference=sign\b"' my_hdr 'PGP: S'
reply-hook '~h "openpgp:.*preference=encrypt\b"' my_hdr 'PGP: E'

This is my script to import the pgp key:

```
#!/bin/zsh

mail=$(<&0)
ac=$(sed -n '/^autocrypt:/I!d;
  h;
  :next
  n;
  /^[^ ]/! { H; b next; }
  x; s/[ \n]\+//g;
  s/^.*keydata=//I;
  p; q;
' <<<$mail)

if (( $#ac ))
then
    base64 -d <<<$ac |gpg --import -
    exit
fi

key_url=$(sed -n '/^openpgp:/I!d;
  h;
  :next
  n;
  /^[^ ]/! { H; b next; }
  x; s/[ \n]\+//g;
  s/^.*url=//;
  s/;.*//;
  p; q;
' <<<$mail)

if (( $#key_url ))
then
    curl $key_url |gpg --import -
    exit
fi
```

Regards Jörg

-- 
Die NASA brauchte 12 Jahre um einen Kugelschreiber zu entwickeln, der
kopfüber, in der Schwerelosigkeit und unter Wasser schreiben kann.
Die Russen benutzten einfach einen Bleistift …
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://mailman.neomutt.org/pipermail/neomutt-users-neomutt.org/attachments/20181211/694034c8/attachment.sig>


More information about the neomutt-users mailing list