* On 2002.04.12, in <[EMAIL PROTECTED]>,
*       "Norbert Preining" <[EMAIL PROTECTED]> wrote:
> Hi!
> 
> I have another question: Is the automatic encryption of emails
> if a key is available possible? I think about somethink

Not really: mutt won't know whether the key is available until it tries
to encrypt. You could probably rig up some macros to check for the key
ID before sending, but that might be more trouble than it's worth.

You could perhaps approximate this behavior with a shell script:
$ cat pgp-hooks.sh
#!/bin/sh
gpg --list-keys --with-colons 2>/dev/unll \
| awk -F: '
        /^pub/                          {id=$5;}
        /^(pub|uid)/ && $10 ~ "<" {
                split($10, a, "<");
                split(a[2], b, ">");
                print "pgp-hook", b[1], "0x"id;
        }'

Then call this from your .muttrc:
source "pgp-hooks.sh |"


I have to question whether you really want this, though. If you have
multiple recipients, this will make mutt select a key for encryption and
default to encrypting it, so the other recipients will get encrypted
mail that they can't read. Note that this will happen on group replies,
for example. But maybe you could work around this somehow with some
send-hooks that check recipients....


> So every email is encrypted if the keys are available, and if
> there is a DSA and a RSA key the former is used.

I suspect that you can achieve this in pgp-hooks.sh, but I don't know
how to read the flags in gnupg's --with-colons list.

-- 
 -D.    [EMAIL PROTECTED]        NSIT    University of Chicago

Reply via email to