gpg: Change the way v5 fingerprints are printed.

* g10/gpg.h (MAX_FORMATTED_FINGERPRINT_LEN): Increase by one.
* g10/keyid.c (format_hexfingerprint): Change v5 key formatting.
--

The new format are groups of 5 letters to resemble the CW speed
measurement rules.  Many hams are used to such blocks from their CW
lessons.  Note that there is no double blank in the middle as with the
v4 keys.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2019-11-28 12:02:41 +01:00
parent 7244666926
commit d2ff62dbdf
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
3 changed files with 7 additions and 16 deletions

View File

@ -50,7 +50,7 @@
/* The maximum length of a formatted fingerprint as returned by
* format_hexfingerprint(). */
#define MAX_FORMATTED_FINGERPRINT_LEN 59
#define MAX_FORMATTED_FINGERPRINT_LEN 60
/*

View File

@ -873,10 +873,10 @@ format_hexfingerprint (const char *fingerprint, char *buffer, size_t buflen)
/* The v5 fingerprint is commonly printed truncated to 25
* octets. We accept the truncated as well as the full hex
* version here and format it like this:
* B2CCB6 838332 5D61BA C50F9F 5E CD21A8 0AC8C5 2565C8 C52565
* 19347 BC987 24640 25F99 DF3EC 2E000 0ED98 84892 E1F7B 3EA4C
*/
hexlen = 50;
space = 8 * 6 + 2 + 8 + 1;
space = 10 * 5 + 9 + 1;
}
else /* Other fingerprint versions - print as is. */
{
@ -908,18 +908,9 @@ format_hexfingerprint (const char *fingerprint, char *buffer, size_t buflen)
}
else if (hexlen == 50) /* v5 fingerprint */
{
for (i=j=0; i < 24; i++)
for (i=j=0; i < 50; i++)
{
if (i && !(i % 6))
buffer[j++] = ' ';
buffer[j++] = fingerprint[i];
}
buffer[j++] = ' ';
buffer[j++] = fingerprint[i++];
buffer[j++] = fingerprint[i++];
for (; i < 50; i++)
{
if (!((i-26) % 6))
if (i && !(i % 5))
buffer[j++] = ' ';
buffer[j++] = fingerprint[i];
}

View File

@ -2059,9 +2059,9 @@ print_fingerprint (ctrl_t ctrl, estream_t override_fp,
{
if (!i)
;
else if (!(i%8))
else if (!(i%10))
tty_fprintf (fp, "\n%*s ", (int)strlen(text)+1, "");
else if (!(i%4))
else if (!(i%5))
tty_fprintf (fp, " ");
else
tty_fprintf (fp, " ");