1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

g13: Improve dump_keyblob.

* g13/g13tuple.c: Include keyblob.h.
(find_tuple_uint): Factor code out to ...
(convert_uint): new.
(all_printable): New.
* g13/mount.c (dump_keyblob: Move and rename to ...
* g13/g13tuple.c (dump_tupledesc): here.  Revamp and pretyy print uint
values.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2016-02-11 13:57:35 +01:00
parent 59fc3507d1
commit 13f745b50d
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
3 changed files with 88 additions and 38 deletions

View file

@ -210,32 +210,6 @@ decrypt_keyblob (ctrl_t ctrl, const void *enckeyblob, size_t enckeybloblen,
}
static void
dump_keyblob (tupledesc_t tuples)
{
size_t n;
unsigned int tag;
const void *value;
log_info ("keyblob dump:\n");
tag = KEYBLOB_TAG_BLOBVERSION;
value = find_tuple (tuples, tag, &n);
while (value)
{
log_info (" tag: %-5u len: %-2u value: ", tag, (unsigned int)n);
if (tag == KEYBLOB_TAG_ENCKEY
|| tag == KEYBLOB_TAG_MACKEY)
log_printf ("[confidential]\n");
else if (!n)
log_printf ("[none]\n");
else
log_printhex ("", value, n);
value = next_tuple (tuples, &tag, &n);
}
}
/* Mount the container with name FILENAME at MOUNTPOINT. */
gpg_error_t
g13_mount_container (ctrl_t ctrl, const char *filename, const char *mountpoint)
@ -323,7 +297,7 @@ g13_mount_container (ctrl_t ctrl, const char *filename, const char *mountpoint)
goto leave;
}
if (opt.verbose)
dump_keyblob (tuples);
dump_tupledesc (tuples);
value = find_tuple (tuples, KEYBLOB_TAG_CONTTYPE, &n);
if (!value || n != 2)