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

gpg: Add option --with-v5-fingerprint

* g10/gpg.c (oWithV5Fingerprint): New.
(opts): Add new option.
(main): Set option.
* g10/options.h (opt): Add with_v5_fingerprint.
* g10/keyid.c (hash_public_key): Factor out to ...
(do_hash_public_key): this.  Add new arg to foce v5 style hashing.
(v5_fingerprint_from_pk): New.
(v5hexfingerprint): New.
* g10/keylist.c (print_fingerprint): Print v5 fingerprint for v4 keys
if the option is set.
--

GnuPG-bug-id: 6705
This commit is contained in:
Werner Koch 2023-09-04 16:34:55 +02:00
parent 776876ce1c
commit 1f76cbca35
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
6 changed files with 102 additions and 9 deletions

View file

@ -203,6 +203,7 @@ enum cmd_and_opt_values
oAskCertLevel,
oNoAskCertLevel,
oFingerprint,
oWithV5Fingerprint,
oWithFingerprint,
oWithSubkeyFingerprint,
oWithICAOSpelling,
@ -816,6 +817,7 @@ static gpgrt_opt_t opts[] = {
ARGPARSE_s_n (oWithKeyData,"with-key-data", "@"),
ARGPARSE_s_n (oWithSigList,"with-sig-list", "@"),
ARGPARSE_s_n (oWithSigCheck,"with-sig-check", "@"),
ARGPARSE_s_n (oWithV5Fingerprint, "with-v5-fingerprint", "@"),
ARGPARSE_s_n (oWithFingerprint, "with-fingerprint", "@"),
ARGPARSE_s_n (oWithSubkeyFingerprint, "with-subkey-fingerprint", "@"),
ARGPARSE_s_n (oWithSubkeyFingerprint, "with-subkey-fingerprints", "@"),
@ -2890,6 +2892,9 @@ main (int argc, char **argv)
opt_log_time = 1;
break;
case oWithV5Fingerprint:
opt.with_v5_fingerprint = 1;
break;
case oWithFingerprint:
opt.with_fingerprint = 1;
opt.fingerprint++;
@ -3794,6 +3799,14 @@ main (int argc, char **argv)
g10_exit(2);
}
/* Set depended fingerprint options. */
if (opt.with_v5_fingerprint && !opt.with_fingerprint)
{
opt.with_fingerprint = 1;
if (!opt.fingerprint)
opt.fingerprint = 1;
}
/* Process common component options. */
if (parse_comopt (GNUPG_MODULE_NAME_GPG, debug_argparser))
{