mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
kbxutil: Print algo number and fold similar lines.
* kbx/keybox-defs.h (_keybox_openpgp_key_info): Add field ALGO. * kbx/keybox-openpgp.c (parse_key): Store algo. * kbx/kbxutil.c (dump_openpgp_key): Print algo number. * kbx/keybox-dump.c (_keybox_dump_blob): Print identical Sig-Expire value lines with a range of indices.
This commit is contained in:
parent
91e61d5253
commit
f7495f1004
@ -332,7 +332,8 @@ dump_fpr (const unsigned char *buffer, size_t len)
|
||||
static void
|
||||
dump_openpgp_key (keybox_openpgp_info_t info, const unsigned char *image)
|
||||
{
|
||||
printf ("pub %02X%02X%02X%02X",
|
||||
printf ("pub %2d %02X%02X%02X%02X",
|
||||
info->primary.algo,
|
||||
info->primary.keyid[4], info->primary.keyid[5],
|
||||
info->primary.keyid[6], info->primary.keyid[7] );
|
||||
dump_fpr (info->primary.fpr, info->primary.fprlen);
|
||||
@ -344,7 +345,8 @@ dump_openpgp_key (keybox_openpgp_info_t info, const unsigned char *image)
|
||||
k = &info->subkeys;
|
||||
do
|
||||
{
|
||||
printf ("sub %02X%02X%02X%02X",
|
||||
printf ("sub %2d %02X%02X%02X%02X",
|
||||
k->algo,
|
||||
k->keyid[4], k->keyid[5],
|
||||
k->keyid[6], k->keyid[7] );
|
||||
dump_fpr (k->fpr, k->fprlen);
|
||||
|
@ -111,6 +111,7 @@ struct keybox_handle {
|
||||
struct _keybox_openpgp_key_info
|
||||
{
|
||||
struct _keybox_openpgp_key_info *next;
|
||||
int algo;
|
||||
unsigned char keyid[8];
|
||||
int fprlen; /* Either 16 or 20 */
|
||||
unsigned char fpr[20];
|
||||
|
@ -291,27 +291,50 @@ _keybox_dump_blob (KEYBOXBLOB blob, FILE *fp)
|
||||
fprintf (fp, "Sig-Info-Length: %lu\n", siginfolen );
|
||||
/* fixme: check bounds */
|
||||
p += 4;
|
||||
for (n=0; n < nsigs; n++, p += siginfolen)
|
||||
{
|
||||
ulong sflags;
|
||||
{
|
||||
int in_range = 0;
|
||||
ulong first = 0;
|
||||
|
||||
sflags = get32 (p);
|
||||
fprintf (fp, "Sig-Expire[%lu]: ", n );
|
||||
if (!sflags)
|
||||
fputs ("[not checked]", fp);
|
||||
else if (sflags == 1 )
|
||||
fputs ("[missing key]", fp);
|
||||
else if (sflags == 2 )
|
||||
fputs ("[bad signature]", fp);
|
||||
else if (sflags < 0x10000000)
|
||||
fprintf (fp, "[bad flag %0lx]", sflags);
|
||||
else if (sflags == 0xffffffff)
|
||||
fputs ("0", fp );
|
||||
else
|
||||
fputs ("a time"/*strtimestamp( sflags )*/, fp );
|
||||
putc ('\n', fp );
|
||||
}
|
||||
for (n=0; n < nsigs; n++, p += siginfolen)
|
||||
{
|
||||
ulong sflags;
|
||||
|
||||
sflags = get32 (p);
|
||||
if (!in_range && !sflags)
|
||||
{
|
||||
in_range = 1;
|
||||
first = n;
|
||||
continue;
|
||||
}
|
||||
if (in_range && !sflags)
|
||||
continue;
|
||||
if (in_range)
|
||||
{
|
||||
fprintf (fp, "Sig-Expire[%lu-%lu]: [not checked]\n", first, n-1);
|
||||
in_range = 0;
|
||||
}
|
||||
|
||||
fprintf (fp, "Sig-Expire[%lu]: ", n );
|
||||
if (!sflags)
|
||||
fputs ("[not checked]", fp);
|
||||
else if (sflags == 1 )
|
||||
fputs ("[missing key]", fp);
|
||||
else if (sflags == 2 )
|
||||
fputs ("[bad signature]", fp);
|
||||
else if (sflags < 0x10000000)
|
||||
fprintf (fp, "[bad flag %0lx]", sflags);
|
||||
else if (sflags == 0xffffffff)
|
||||
fputs ("0", fp );
|
||||
else
|
||||
fputs ("a time"/*strtimestamp( sflags )*/, fp );
|
||||
putc ('\n', fp );
|
||||
}
|
||||
if (in_range)
|
||||
{
|
||||
fprintf (fp, "Sig-Expire[%lu-%lu]: [not checked]\n", first, n-1);
|
||||
in_range = 0;
|
||||
}
|
||||
}
|
||||
fprintf (fp, "Ownertrust: %d\n", p[0] );
|
||||
fprintf (fp, "All-Validity: %d\n", p[1] );
|
||||
p += 4;
|
||||
|
@ -223,6 +223,8 @@ parse_key (const unsigned char *data, size_t datalen,
|
||||
return gpg_error (GPG_ERR_UNKNOWN_ALGORITHM);
|
||||
}
|
||||
|
||||
ki->algo = algorithm;
|
||||
|
||||
for (i=0; i < npkey; i++ )
|
||||
{
|
||||
unsigned int nbits, nbytes;
|
||||
|
Loading…
x
Reference in New Issue
Block a user