]> granicus.if.org Git - mutt/commitdiff
Currently, mutt uses the OpenPGP key algorithm to determine the
authorDavid Shaw <dshaw@jabberwocky.com>
Tue, 13 May 2003 12:43:45 +0000 (12:43 +0000)
committerDavid Shaw <dshaw@jabberwocky.com>
Tue, 13 May 2003 12:43:45 +0000 (12:43 +0000)
capabilities of the key.  For example, in mutt, a key of type 1 (RSA)
can both encrypt & sign.  This is not correct as per OpenPGP, however,
where the capabilities of the key are determined by both the algorithm
and key capability flags that are set on the key.  This can lead to
user confusion when their RSA encrypt-only or sign-only key is listed
for both signing and encryption in mutt.

GnuPG lists these flags in key listings, so it is easy to take
advantage of them.  Here is a patch to use the flags, as well as
provide the flags in pgpring.  Note that the pgp+pgpring users won't
see any change since the flags there are based on the key algorithm as
they are now, but the GnuPG users will see an improvement.

gnupgparse.c
pgppubring.c

index 3d8e169108e33c2c3106cb0eb2bb95cd6b863d09..47532c9b1618e90112ff2085c7d71e314c31504e 100644 (file)
@@ -211,8 +211,6 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
          k->numalg = atoi (p);
          k->algorithm = pgp_pkalgbytype (atoi (p));
        }
-
-       k->flags |= pgp_get_abilities (atoi (p));
        break;
       }
       case 5:                  /* 16 hex digits with the long keyid. */
@@ -285,13 +283,20 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k)
        
        while(*p)
          {
-           if(*p=='D')
+           switch(*p++)
              {
+             case 'D':
                flags |= KEYFLAG_DISABLED;
                break;
-             }
 
-           p++;
+             case 'e':
+               flags |= KEYFLAG_CANENCRYPT;
+               break;
+
+             case 's':
+               flags |= KEYFLAG_CANSIGN;
+               break;
+             }
          }
 
         if (!is_uid && !(*is_subkey && option (OPTPGPIGNORESUB)))
index b97f910f4cd29cc838d0ef0a36d7801b6e2292e3..878b10af77dce551d77ed2f5f7a48d6811463f5f 100644 (file)
@@ -926,6 +926,11 @@ static void pgpring_dump_keyblock (pgp_key_t p)
        
        print_userid (uid->addr);
        printf ("::");
+
+       if(pgp_canencrypt(p->numalg))
+         putchar ('e');
+       if(pgp_cansign(p->numalg))
+         putchar ('s');
        if (p->flags & KEYFLAG_DISABLED)
          putchar ('D');
        printf (":\n");