aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2023-09-04 15:03:01 +0000
committerWerner Koch <[email protected]>2023-09-04 15:03:52 +0000
commite36b2d1bce4bb6281e18f53d06d7831e6d6f5a09 (patch)
tree0bb1000300dbd0370f2d4b60605a35f88e6adcfd /tests
parentbuild: Change the default for --with-libtool-modification. (diff)
downloadgpgme-e36b2d1bce4bb6281e18f53d06d7831e6d6f5a09.tar.gz
gpgme-e36b2d1bce4bb6281e18f53d06d7831e6d6f5a09.zip
New mode to list a v5 fingerprint for v4 packets.
* src/gpgme.h.in (GPGME_KEYLIST_MODE_WITH_V5FPR): New. (struct _gpgme_subkey): Add field v5fpr. * src/engine-gpg.c (gpg_keylist_build_options): Pass new option to gpg. * src/key.c (gpgme_key_unref): Free new field. * src/keylist.c (op_data_t): Parse and add "fp2" line. * tests/run-keylist.c (show_usage): Add option --v5fpr. * src/keylist.c (op_data_t): Add field failure_code. (keylist_status_handler): Handle special value. (gpgme_op_keylist_end): Return an error if a FAILURE line has been seen. -- Note that the failure code part has been added to better diagnose problems if a wrong gpg version is used. If verything works right we should not get this because we check that the gnupg version sis either >= 2.4.4 or less than 2.3 and >= 2.2.42. Note further that the v5fpr field may also be used to get the SHA-256 fingerprint of X.509 certificates (even without passing the new mode flag). GnuPG-bug-id: 6705
Diffstat (limited to 'tests')
-rw-r--r--tests/run-keylist.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/run-keylist.c b/tests/run-keylist.c
index c662e902..d517cac5 100644
--- a/tests/run-keylist.c
+++ b/tests/run-keylist.c
@@ -55,6 +55,7 @@ show_usage (int ex)
" --tofu use GPGME_KEYLIST_MODE_TOFU\n"
" --sig-notations use GPGME_KEYLIST_MODE_SIG_NOTATIONS\n"
" --ephemeral use GPGME_KEYLIST_MODE_EPHEMERAL\n"
+ " --v5fpr use GPGME_KEYLIST_MODE_V5FPR\n"
" --validate use GPGME_KEYLIST_MODE_VALIDATE\n"
" --import import all keys\n"
" --offline use offline mode\n"
@@ -179,9 +180,14 @@ main (int argc, char **argv)
mode |= GPGME_KEYLIST_MODE_VALIDATE;
argc--; argv++;
}
- else if (!strcmp (*argv, "--with-secret"))
+ else if (!strcmp (*argv, "--validate"))
+ {
+ mode |= GPGME_KEYLIST_MODE_VALIDATE;
+ argc--; argv++;
+ }
+ else if (!strcmp (*argv, "--v5fpr"))
{
- mode |= GPGME_KEYLIST_MODE_WITH_SECRET;
+ mode |= GPGME_KEYLIST_MODE_WITH_V5FPR;
argc--; argv++;
}
else if (!strcmp (*argv, "--import"))
@@ -305,6 +311,8 @@ main (int argc, char **argv)
for (nsub=0; subkey; subkey = subkey->next, nsub++)
{
printf ("fpr %2d: %s\n", nsub, nonnull (subkey->fpr));
+ if (subkey->v5fpr)
+ printf ("v5fpr %2d: %s\n", nsub, nonnull (subkey->v5fpr));
if (subkey->keygrip)
printf ("grip %2d: %s\n", nsub, subkey->keygrip);
if (subkey->curve)