* keyedit.c (print_and_check_one_sig, show_key_and_fingerprint,

menu_addrevoker), keylist.c (list_keyblock_print, print_fingerprint): Show
"T" or the trust depth for trust signatures, and add spaces to some
strings to make room for it.

* packet.h, parse-packet.c (dump_sig_subpkt, parse_one_sig_subpkt,
parse_signature): Parse trust signature values.

* tdbio.h, tdbio.c (tdbio_read_record, tdbio_write_record): Reserve a byte
for the minimum ownertrust value (for use with trust signatures).
This commit is contained in:
David Shaw 2002-10-29 18:00:07 +00:00
parent e4021a4c95
commit 809b8b031a
7 changed files with 56 additions and 11 deletions

View File

@ -1,3 +1,17 @@
2002-10-29 David Shaw <dshaw@jabberwocky.com>
* keyedit.c (print_and_check_one_sig, show_key_and_fingerprint,
menu_addrevoker), keylist.c (list_keyblock_print,
print_fingerprint): Show "T" or the trust depth for trust
signatures, and add spaces to some strings to make room for it.
* packet.h, parse-packet.c (dump_sig_subpkt, parse_one_sig_subpkt,
parse_signature): Parse trust signature values.
* tdbio.h, tdbio.c (tdbio_read_record, tdbio_write_record):
Reserve a byte for the minimum ownertrust value (for use with
trust signatures).
2002-10-29 Stefan Bellon <sbellon@sbellon.de>
* build-packet.c (calc_plaintext, do_plaintext): Removed RISC OS

View File

@ -129,7 +129,7 @@ print_and_check_one_sig( KBNODE keyblock, KBNODE node,
break;
}
if( sigrc != '?' || print_without_key ) {
tty_printf("%s%c%c %c%c%c%c%c %08lX %s ",
tty_printf("%s%c%c %c%c%c%c%c%c %08lX %s ",
is_rev? "rev":"sig",sigrc,
(sig->sig_class-0x10>0 &&
sig->sig_class-0x10<4)?'0'+sig->sig_class-0x10:' ',
@ -138,6 +138,8 @@ print_and_check_one_sig( KBNODE keyblock, KBNODE node,
sig->flags.policy_url?'P':' ',
sig->flags.notation?'N':' ',
sig->flags.expired?'X':' ',
(sig->trust_depth>9)?'T':
(sig->trust_depth>0)?'0'+sig->trust_depth:' ',
(ulong)sig->keyid[1], datestr_from_sig(sig));
if( sigrc == '%' )
tty_printf("[%s] ", g10_errstr(rc) );
@ -1925,7 +1927,7 @@ show_key_and_fingerprint( KBNODE keyblock )
for( node = keyblock; node; node = node->next ) {
if( node->pkt->pkttype == PKT_PUBLIC_KEY ) {
pk = node->pkt->pkt.public_key;
tty_printf("pub %4u%c/%08lX %s ",
tty_printf("pub %4u%c/%08lX %s ",
nbits_from_pk( pk ),
pubkey_letter( pk->pubkey_algo ),
(ulong)keyid_from_pk(pk,NULL),
@ -2375,7 +2377,7 @@ menu_addrevoker( KBNODE pub_keyblock, KBNODE sec_keyblock, int sensitive )
keyid_from_pk(revoker_pk,keyid);
tty_printf("\npub %4u%c/%08lX %s ",
tty_printf("\npub %4u%c/%08lX %s ",
nbits_from_pk( revoker_pk ),
pubkey_letter( revoker_pk->pubkey_algo ),
(ulong)keyid[1], datestr_from_pk(pk) );

View File

@ -476,7 +476,7 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
pk = node->pkt->pkt.public_key;
sk = NULL;
keyid_from_pk( pk, keyid );
printf("pub %4u%c/%08lX %s ", nbits_from_pk( pk ),
printf("pub %4u%c/%08lX %s ", nbits_from_pk( pk ),
pubkey_letter( pk->pubkey_algo ),
(ulong)keyid[1],
datestr_from_pk( pk ) );
@ -528,7 +528,7 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
}
keyid_from_pk( pk2, keyid2 );
printf("sub %4u%c/%08lX %s", nbits_from_pk( pk2 ),
printf("sub %4u%c/%08lX %s", nbits_from_pk( pk2 ),
pubkey_letter( pk2->pubkey_algo ),
(ulong)keyid2[1],
datestr_from_pk( pk2 ) );
@ -620,7 +620,7 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
}
fputs( sigstr, stdout );
printf("%c%c %c%c%c%c%c %08lX %s ",
printf("%c%c %c%c%c%c%c%c %08lX %s ",
sigrc,(sig->sig_class-0x10>0 &&
sig->sig_class-0x10<4)?'0'+sig->sig_class-0x10:' ',
sig->flags.exportable?' ':'L',
@ -628,6 +628,8 @@ list_keyblock_print ( KBNODE keyblock, int secret, int fpr, void *opaque )
sig->flags.policy_url?'P':' ',
sig->flags.notation?'N':' ',
sig->flags.expired?'X':' ',
(sig->trust_depth>9)?'T':
(sig->trust_depth>0)?'0'+sig->trust_depth:' ',
(ulong)sig->keyid[1], datestr_from_sig(sig));
if( sigrc == '%' )
printf("[%s] ", g10_errstr(rc) );
@ -1073,11 +1075,11 @@ print_fingerprint (PKT_public_key *pk, PKT_secret_key *sk, int mode )
}
else if (mode == 3) {
fp = NULL; /* use tty */
text = _(" Key fingerprint =");
text = _(" Key fingerprint =");
}
else {
fp = stdout;
text = _(" Key fingerprint =");
text = _(" Key fingerprint =");
}
if (sk)

View File

@ -140,6 +140,9 @@ typedef struct {
byte pubkey_algo; /* algorithm used for public key scheme */
/* (PUBKEY_ALGO_xxx) */
byte digest_algo; /* algorithm used for digest (DIGEST_ALGO_xxxx) */
byte trust_depth;
byte trust_value;
const byte *trust_regexp;
struct revocation_key **revkey;
int numrevkeys;
subpktarea_t *hashed; /* all subpackets with hashed data (v4 only) */

View File

@ -778,13 +778,13 @@ dump_sig_subpkt( int hashed, int type, int critical,
break;
case SIGSUBPKT_TRUST:
if(length!=2)
p="[invalid trust signature]";
p="[invalid trust subpacket]";
else
printf("trust signature of level %d, amount %d",buffer[0],buffer[1]);
printf("trust signature of depth %d, amount %d",buffer[0],buffer[1]);
break;
case SIGSUBPKT_REGEXP:
if(!length)
p="[invalid regexp]";
p="[invalid regexp subpacket]";
else
printf("regular expression: \"%s\"",buffer);
break;
@ -933,6 +933,7 @@ parse_one_sig_subpkt( const byte *buffer, size_t n, int type )
case SIGSUBPKT_PREF_COMPR:
case SIGSUBPKT_POLICY:
case SIGSUBPKT_FEATURES:
case SIGSUBPKT_REGEXP:
return 0;
case SIGSUBPKT_EXPORTABLE:
case SIGSUBPKT_REVOCABLE:
@ -955,6 +956,10 @@ parse_one_sig_subpkt( const byte *buffer, size_t n, int type )
if ( n != 1 )
break;
return 0;
case SIGSUBPKT_TRUST:
if ( n != 2 )
break;
return 0;
case SIGSUBPKT_PRIV_VERIFY_CACHE:
/* We used this in gpg 1.0.5 and 1.0.6 to cache signature
* verification results - it is no longer used.
@ -1247,6 +1252,7 @@ parse_signature( IOBUF inp, int pkttype, unsigned long pktlen,
if( is_v4 && sig->pubkey_algo ) { /*extract required information */
const byte *p;
size_t len;
/* set sig->flags.unknown_critical if there is a
* critical bit set for packets which we do not understand */
@ -1288,6 +1294,21 @@ parse_signature( IOBUF inp, int pkttype, unsigned long pktlen,
if(p && *p==0)
sig->flags.revocable=0;
p=parse_sig_subpkt(sig->hashed,SIGSUBPKT_TRUST,&len);
if(p && len==2)
{
sig->trust_depth=p[0];
sig->trust_value=p[1];
sig->trust_regexp=
parse_sig_subpkt(sig->hashed,SIGSUBPKT_REGEXP,&len);
/* If the regular expression is of 0 length, there is no
regular expression. */
if(len==0)
sig->trust_regexp=NULL;
}
/* We accept the exportable subpacket from either the hashed
or unhashed areas as older versions of gpg put it in the
unhashed area. In theory, anyway, we should never see this

View File

@ -1197,6 +1197,7 @@ tdbio_read_record( ulong recnum, TRUSTREC *rec, int expected )
rec->r.trust.depth = *p++;
p += 2;
rec->r.trust.validlist = buftoulong(p); p += 4;
rec->r.trust.min_ownertrust = *p++;
break;
case RECTYPE_VALID:
memcpy( rec->r.valid.namehash, p, 20); p+=20;
@ -1275,6 +1276,7 @@ tdbio_write_record( TRUSTREC *rec )
*p++ = rec->r.trust.depth;
p += 2;
ulongtobuf( p, rec->r.trust.validlist); p += 4;
*p++ = rec->r.trust.min_ownertrust;
break;
case RECTYPE_VALID:

View File

@ -77,6 +77,7 @@ struct trust_record {
byte ownertrust;
byte depth;
ulong validlist;
byte min_ownertrust;
} trust;
struct {
byte namehash[20];