From 3832320327bccab580dcef662a918f2e70327fe6 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Mon, 7 Oct 2002 18:20:28 +0000 Subject: [PATCH] * keylist.c (print_capabilities): Properly indicate per-key capabilities of sign&encrypt primary keys that have secret-parts-missing (i.e. no capabilities at all). --- g10/ChangeLog | 6 ++++++ g10/keylist.c | 19 ++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index cd25cdca6..addf73ac4 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,9 @@ +2002-10-07 David Shaw + + * keylist.c (print_capabilities): Properly indicate per-key + capabilities of sign&encrypt primary keys that have + secret-parts-missing (i.e. no capabilities at all). + 2002-10-04 David Shaw * getkey.c (get_pubkey_direct): Don't cache keys retrieved via diff --git a/g10/keylist.c b/g10/keylist.c index 90a8d9d86..a1a0e4c13 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -300,16 +300,21 @@ print_key_data( PKT_public_key *pk, u32 *keyid ) static void print_capabilities (PKT_public_key *pk, PKT_secret_key *sk, KBNODE keyblock) { - unsigned int use = pk? pk->pubkey_usage : sk->pubkey_usage; + if(pk || (sk && sk->protect.s2k.mode!=1001)) + { + unsigned int use = pk? pk->pubkey_usage : sk->pubkey_usage; - if ( use & PUBKEY_USAGE_ENC ) { + if ( use & PUBKEY_USAGE_ENC ) putchar ('e'); + + if ( use & PUBKEY_USAGE_SIG ) + { + putchar ('s'); + if( pk? pk->is_primary : sk->is_primary ) + putchar ('c'); + } } - if ( (use & PUBKEY_USAGE_SIG) && !(sk?(sk->protect.s2k.mode==1001):0) ) { - putchar ('s'); - if( pk? pk->is_primary : sk->is_primary ) - putchar ('c'); - } + if ( keyblock ) { /* figure our the usable capabilities */ KBNODE k; int enc=0, sign=0, cert=0;