1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-10 13:04:23 +01:00

* keylist.c (print_capabilities): Secret-parts-missing keys should show

that fact in the capabilities.
This commit is contained in:
David Shaw 2002-10-03 19:17:02 +00:00
parent 3f2d94179f
commit 09fe2195bc
2 changed files with 9 additions and 6 deletions

View File

@ -1,5 +1,8 @@
2002-10-03 David Shaw <dshaw@jabberwocky.com> 2002-10-03 David Shaw <dshaw@jabberwocky.com>
* keylist.c (print_capabilities): Secret-parts-missing keys should
show that fact in the capabilities.
* packet.h, parse_packet (parse_key): Add is_primary flag for * packet.h, parse_packet (parse_key): Add is_primary flag for
public keys (it already exists for secret keys). public keys (it already exists for secret keys).

View File

@ -301,14 +301,13 @@ static void
print_capabilities (PKT_public_key *pk, PKT_secret_key *sk, KBNODE keyblock) print_capabilities (PKT_public_key *pk, PKT_secret_key *sk, KBNODE keyblock)
{ {
unsigned int use = pk? pk->pubkey_usage : sk->pubkey_usage; unsigned int use = pk? pk->pubkey_usage : sk->pubkey_usage;
int primary = pk? pk->is_primary : sk->is_primary;
if ( use & PUBKEY_USAGE_ENC ) { if ( use & PUBKEY_USAGE_ENC ) {
putchar ('e'); putchar ('e');
} }
if ( use & PUBKEY_USAGE_SIG ) { if ( (use & PUBKEY_USAGE_SIG) && !(sk?(sk->protect.s2k.mode==1001):0) ) {
putchar ('s'); putchar ('s');
if(primary) if( pk? pk->is_primary : sk->is_primary )
putchar ('c'); putchar ('c');
} }
if ( keyblock ) { /* figure our the usable capabilities */ if ( keyblock ) { /* figure our the usable capabilities */
@ -325,7 +324,7 @@ print_capabilities (PKT_public_key *pk, PKT_secret_key *sk, KBNODE keyblock)
if ( pk->pubkey_usage & PUBKEY_USAGE_SIG ) if ( pk->pubkey_usage & PUBKEY_USAGE_SIG )
{ {
sign = 1; sign = 1;
if(primary) if(pk->is_primary)
cert = 1; cert = 1;
} }
} }
@ -333,13 +332,14 @@ print_capabilities (PKT_public_key *pk, PKT_secret_key *sk, KBNODE keyblock)
else if ( k->pkt->pkttype == PKT_SECRET_KEY else if ( k->pkt->pkttype == PKT_SECRET_KEY
|| k->pkt->pkttype == PKT_SECRET_SUBKEY ) { || k->pkt->pkttype == PKT_SECRET_SUBKEY ) {
sk = k->pkt->pkt.secret_key; sk = k->pkt->pkt.secret_key;
if ( sk->is_valid && !sk->is_revoked && !sk->has_expired ) { if ( sk->is_valid && !sk->is_revoked && !sk->has_expired
&& sk->protect.s2k.mode!=1001 ) {
if ( sk->pubkey_usage & PUBKEY_USAGE_ENC ) if ( sk->pubkey_usage & PUBKEY_USAGE_ENC )
enc = 1; enc = 1;
if ( sk->pubkey_usage & PUBKEY_USAGE_SIG ) if ( sk->pubkey_usage & PUBKEY_USAGE_SIG )
{ {
sign = 1; sign = 1;
if(primary) if(sk->is_primary)
cert = 1; cert = 1;
} }
} }