1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-22 14:57:02 +01:00

* packet.h, parse_packet (parse_key): Add is_primary flag for public keys

(it already exists for secret keys).

* keylist.c (print_capabilities): Only primary signing keys can certify
other keys.
This commit is contained in:
David Shaw 2002-10-03 17:40:10 +00:00
parent 27d526298b
commit 3f2d94179f
4 changed files with 23 additions and 3 deletions

View File

@ -1,3 +1,11 @@
2002-10-03 David Shaw <dshaw@jabberwocky.com>
* packet.h, parse_packet (parse_key): Add is_primary flag for
public keys (it already exists for secret keys).
* keylist.c (print_capabilities): Only primary signing keys can
certify other keys.
2002-10-02 David Shaw <dshaw@jabberwocky.com>
* import.c (import_secret_one): Check for an illegal (>110)

View File

@ -301,13 +301,15 @@ static void
print_capabilities (PKT_public_key *pk, PKT_secret_key *sk, KBNODE keyblock)
{
unsigned int use = pk? pk->pubkey_usage : sk->pubkey_usage;
int primary = pk? pk->is_primary : sk->is_primary;
if ( use & PUBKEY_USAGE_ENC ) {
putchar ('e');
}
if ( use & PUBKEY_USAGE_SIG ) {
putchar ('s');
putchar ('c');
if(primary)
putchar ('c');
}
if ( keyblock ) { /* figure our the usable capabilities */
KBNODE k;
@ -321,7 +323,11 @@ print_capabilities (PKT_public_key *pk, PKT_secret_key *sk, KBNODE keyblock)
if ( pk->pubkey_usage & PUBKEY_USAGE_ENC )
enc = 1;
if ( pk->pubkey_usage & PUBKEY_USAGE_SIG )
sign = cert = 1;
{
sign = 1;
if(primary)
cert = 1;
}
}
}
else if ( k->pkt->pkttype == PKT_SECRET_KEY
@ -331,7 +337,11 @@ print_capabilities (PKT_public_key *pk, PKT_secret_key *sk, KBNODE keyblock)
if ( sk->pubkey_usage & PUBKEY_USAGE_ENC )
enc = 1;
if ( sk->pubkey_usage & PUBKEY_USAGE_SIG )
sign = cert = 1;
{
sign = 1;
if(primary)
cert = 1;
}
}
}
}

View File

@ -202,6 +202,7 @@ typedef struct {
ulong local_id; /* internal use, valid if > 0 */
u32 main_keyid[2]; /* keyid of the primary key */
u32 keyid[2]; /* calculated by keyid_from_pk() */
byte is_primary;
prefitem_t *prefs; /* list of preferences (may be NULL) */
int mdc_feature; /* mdc feature set */
byte *namehash; /* if != NULL: found by this name */

View File

@ -1523,6 +1523,7 @@ parse_key( IOBUF inp, int pkttype, unsigned long pktlen,
pk->max_expiredate = max_expiredate;
pk->hdrbytes = hdrlen;
pk->version = version;
pk->is_primary = pkttype == PKT_PUBLIC_KEY;
pk->pubkey_algo = algorithm;
pk->req_usage = 0;
pk->pubkey_usage = 0; /* not yet used */