diff options
author | David Shaw <[email protected]> | 2004-09-12 15:27:38 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2004-09-12 15:27:38 +0000 |
commit | e7c94128b212fdd170e25dc11d7f8bfa708c7282 (patch) | |
tree | 20c66804bdfab0549b3a1030fa38b377e28e9634 /g10/keylist.c | |
parent | * card-util.c (fetch_url, card_edit): Use the pubkey URL stored on the (diff) | |
download | gnupg-e7c94128b212fdd170e25dc11d7f8bfa708c7282.tar.gz gnupg-e7c94128b212fdd170e25dc11d7f8bfa708c7282.zip |
* options.h, keylist.c (print_one_subpacket, print_subpackets_colon):
Print a spk record for each request subpacket. (list_keyblock_colon): Call
them here.
* g10.c (parse_subpacket_list, parse_list_options): New. Make the list of
subpackets we are going to print. (main): Call them here.
Diffstat (limited to 'g10/keylist.c')
-rw-r--r-- | g10/keylist.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/g10/keylist.c b/g10/keylist.c index 9c18996d0..34c2920c6 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -551,6 +551,51 @@ print_capabilities (PKT_public_key *pk, PKT_secret_key *sk, KBNODE keyblock) putchar(':'); } +/* Flags = 0x01 hashed 0x02 critical */ +static void +print_one_subpacket(sigsubpkttype_t type,size_t len,int flags,const byte *buf) +{ + size_t i; + + printf("spk:%d:%u:%u:",type,flags,len); + + for(i=0;i<len;i++) + { + /* printable ascii other than : and % */ + if(buf[i]>=32 && buf[i]<=126 && buf[i]!=':' && buf[i]!='%') + printf("%c",buf[i]); + else + printf("%%%02X",buf[i]); + } + + printf("\n"); +} + +static void +print_subpackets_colon(PKT_signature *sig) +{ + byte *i; + + assert(opt.show_subpackets); + + for(i=opt.show_subpackets;*i;i++) + { + const byte *p; + size_t len; + int seq,crit; + + seq=0; + + while((p=enum_sig_subpkt(sig->hashed,*i,&len,&seq,&crit))) + print_one_subpacket(*i,len,0x01|(crit?0x02:0),p); + + seq=0; + + while((p=enum_sig_subpkt(sig->unhashed,*i,&len,&seq,&crit))) + print_one_subpacket(*i,len,0x00|(crit?0x02:0),p); + } +} + void dump_attribs(const PKT_user_id *uid,PKT_public_key *pk,PKT_secret_key *sk) { @@ -1232,6 +1277,9 @@ list_keyblock_colon( KBNODE keyblock, int secret, int fpr ) printf("\n"); + if(opt.show_subpackets) + print_subpackets_colon(sig); + /* fixme: check or list other sigs here */ } } |