mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
* options.h, g10.c (main): Add a more flexible --keyid-format option to
replace the list-option (and eventually verify-option) show-long-keyids. The format can be short, long, 0xshort, and 0xlong. * keydb.h, keyid.c (keystr, keystrlen): New functions to generate a printable keyid. * keyedit.c (print_and_check_one_sig, show_key_with_all_names), keylist.c (list_keyblock_print): Use new keystr() function here to print keyids.
This commit is contained in:
parent
c57262fd57
commit
2d7fe1d3a1
7 changed files with 133 additions and 81 deletions
53
g10/keyid.c
53
g10/keyid.c
|
@ -144,6 +144,59 @@ do_fingerprint_md_sk( PKT_secret_key *sk )
|
|||
return do_fingerprint_md( &pk );
|
||||
}
|
||||
|
||||
size_t
|
||||
keystrlen(void)
|
||||
{
|
||||
switch(opt.keyid_format)
|
||||
{
|
||||
case KF_SHORT:
|
||||
return 8;
|
||||
|
||||
case KF_LONG:
|
||||
return 16;
|
||||
|
||||
case KF_0xSHORT:
|
||||
return 10;
|
||||
|
||||
case KF_0xLONG:
|
||||
return 18;
|
||||
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
}
|
||||
|
||||
const char *
|
||||
keystr(u32 *keyid)
|
||||
{
|
||||
static char keyid_str[19];
|
||||
|
||||
switch(opt.keyid_format)
|
||||
{
|
||||
case KF_SHORT:
|
||||
sprintf(keyid_str,"%08lX",(ulong)keyid[1]);
|
||||
break;
|
||||
|
||||
case KF_LONG:
|
||||
sprintf(keyid_str,"%08lX%08lX",(ulong)keyid[0],(ulong)keyid[1]);
|
||||
break;
|
||||
|
||||
case KF_0xSHORT:
|
||||
sprintf(keyid_str,"0x%08lX",(ulong)keyid[1]);
|
||||
break;
|
||||
|
||||
case KF_0xLONG:
|
||||
sprintf(keyid_str,"0x%08lX%08lX",(ulong)keyid[0],(ulong)keyid[1]);
|
||||
break;
|
||||
|
||||
default:
|
||||
BUG();
|
||||
}
|
||||
|
||||
return keyid_str;
|
||||
}
|
||||
|
||||
|
||||
/****************
|
||||
* Get the keyid from the secret key and put it into keyid
|
||||
* if this is not NULL. Return the 32 low bits of the keyid.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue