mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
* packet.h, getkey.c (merge_selfsigs_main, sig_to_revoke_info), keyid.c
(revokestr_from_pk), keyedit.c (show_key_with_all_names): Show who revoked a key (either the same key or a designated revoker) and when.
This commit is contained in:
parent
f539f3d2b2
commit
b37facc593
@ -1,3 +1,10 @@
|
||||
2004-12-29 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* packet.h, getkey.c (merge_selfsigs_main, sig_to_revoke_info),
|
||||
keyid.c (revokestr_from_pk), keyedit.c (show_key_with_all_names):
|
||||
Show who revoked a key (either the same key or a designated
|
||||
revoker) and when.
|
||||
|
||||
2004-12-28 Werner Koch <wk@g10code.com>
|
||||
|
||||
* ccid-driver.c (find_endpoint): New.
|
||||
|
26
g10/getkey.c
26
g10/getkey.c
@ -1387,7 +1387,16 @@ fixup_uidnode ( KBNODE uidnode, KBNODE signode, u32 keycreated )
|
||||
}
|
||||
|
||||
static void
|
||||
merge_selfsigs_main( KBNODE keyblock, int *r_revoked, u32 *r_revokedate )
|
||||
sig_to_revoke_info(PKT_signature *sig,struct revoke_info *rinfo)
|
||||
{
|
||||
rinfo->date = sig->timestamp;
|
||||
rinfo->algo = sig->pubkey_algo;
|
||||
rinfo->keyid[0] = sig->keyid[0];
|
||||
rinfo->keyid[1] = sig->keyid[1];
|
||||
}
|
||||
|
||||
static void
|
||||
merge_selfsigs_main(KBNODE keyblock, int *r_revoked, struct revoke_info *rinfo)
|
||||
{
|
||||
PKT_public_key *pk = NULL;
|
||||
KBNODE k;
|
||||
@ -1402,7 +1411,8 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked, u32 *r_revokedate )
|
||||
byte sigversion = 0;
|
||||
|
||||
*r_revoked = 0;
|
||||
*r_revokedate = 0;
|
||||
memset(rinfo,0,sizeof(*rinfo));
|
||||
|
||||
if ( keyblock->pkt->pkttype != PKT_PUBLIC_KEY )
|
||||
BUG ();
|
||||
pk = keyblock->pkt->pkt.public_key;
|
||||
@ -1448,7 +1458,7 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked, u32 *r_revokedate )
|
||||
* that key.
|
||||
*/
|
||||
*r_revoked = 1;
|
||||
*r_revokedate = sig->timestamp;
|
||||
sig_to_revoke_info(sig,rinfo);
|
||||
}
|
||||
else if ( IS_KEY_SIG (sig) ) {
|
||||
/* Add any revocation keys onto the pk. This is
|
||||
@ -1558,7 +1568,7 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked, u32 *r_revokedate )
|
||||
if(rc==0)
|
||||
{
|
||||
*r_revoked=2;
|
||||
*r_revokedate=sig->timestamp;
|
||||
sig_to_revoke_info(sig,rinfo);
|
||||
/* don't continue checking since we can't be any
|
||||
more revoked than this */
|
||||
break;
|
||||
@ -1894,7 +1904,7 @@ merge_selfsigs_subkey( KBNODE keyblock, KBNODE subnode )
|
||||
problem is in the distribution. Plus, PGP (7)
|
||||
does this the same way. */
|
||||
subpk->is_revoked = 1;
|
||||
subpk->revokedate = sig->timestamp;
|
||||
sig_to_revoke_info(sig,&subpk->revoked);
|
||||
/* although we could stop now, we continue to
|
||||
* figure out other information like the old expiration
|
||||
* time */
|
||||
@ -2011,7 +2021,7 @@ merge_selfsigs( KBNODE keyblock )
|
||||
{
|
||||
KBNODE k;
|
||||
int revoked;
|
||||
u32 revokedate;
|
||||
struct revoke_info rinfo;
|
||||
PKT_public_key *main_pk;
|
||||
prefitem_t *prefs;
|
||||
int mdc_feature;
|
||||
@ -2028,7 +2038,7 @@ merge_selfsigs( KBNODE keyblock )
|
||||
BUG ();
|
||||
}
|
||||
|
||||
merge_selfsigs_main ( keyblock, &revoked, &revokedate );
|
||||
merge_selfsigs_main ( keyblock, &revoked, &rinfo );
|
||||
|
||||
/* now merge in the data from each of the subkeys */
|
||||
for(k=keyblock; k; k = k->next ) {
|
||||
@ -2051,7 +2061,7 @@ merge_selfsigs( KBNODE keyblock )
|
||||
if(revoked && !pk->is_revoked)
|
||||
{
|
||||
pk->is_revoked = revoked;
|
||||
pk->revokedate = revokedate;
|
||||
memcpy(&pk->revoked,&rinfo,sizeof(rinfo));
|
||||
}
|
||||
if(main_pk->has_expired)
|
||||
pk->has_expired = main_pk->has_expired;
|
||||
|
@ -2317,6 +2317,15 @@ show_key_with_all_names( KBNODE keyblock, int only_marked, int with_revoker,
|
||||
primary=pk;
|
||||
}
|
||||
|
||||
if(pk->is_revoked)
|
||||
{
|
||||
char *user=get_user_id_string_native(pk->revoked.keyid);
|
||||
const char *algo=pubkey_algo_to_string(pk->revoked.algo);
|
||||
tty_printf(_("This key was revoked on %s by %s key %s\n"),
|
||||
revokestr_from_pk(pk),algo?algo:"?",user);
|
||||
m_free(user);
|
||||
}
|
||||
|
||||
if(with_revoker)
|
||||
{
|
||||
if( !pk->revkey && pk->numrevkeys )
|
||||
|
@ -529,9 +529,9 @@ revokestr_from_pk( PKT_public_key *pk )
|
||||
static char buffer[11+5];
|
||||
time_t atime;
|
||||
|
||||
if(!pk->revokedate)
|
||||
if(!pk->revoked.date)
|
||||
return _("never ");
|
||||
atime=pk->revokedate;
|
||||
atime=pk->revoked.date;
|
||||
return mk_datestr (buffer, atime);
|
||||
}
|
||||
|
||||
|
11
g10/packet.h
11
g10/packet.h
@ -186,6 +186,15 @@ typedef struct {
|
||||
char name[1];
|
||||
} PKT_user_id;
|
||||
|
||||
struct revoke_info
|
||||
{
|
||||
/* revoked at this date */
|
||||
u32 date;
|
||||
/* the keyid of the revoking key (selfsig or designated revoker) */
|
||||
u32 keyid[2];
|
||||
/* the algo of the revoking key */
|
||||
byte algo;
|
||||
};
|
||||
|
||||
/****************
|
||||
* Note about the pkey/skey elements: We assume that the secret keys
|
||||
@ -197,7 +206,7 @@ typedef struct {
|
||||
u32 timestamp; /* key made */
|
||||
u32 expiredate; /* expires at this date or 0 if not at all */
|
||||
u32 max_expiredate; /* must not expire past this date */
|
||||
u32 revokedate; /* revoked at this date */
|
||||
struct revoke_info revoked;
|
||||
byte hdrbytes; /* number of header bytes */
|
||||
byte version;
|
||||
byte selfsigversion; /* highest version of all of the self-sigs */
|
||||
|
Loading…
x
Reference in New Issue
Block a user