gpg: Print modern style key info for non-decryptable keys.

* g10/mainproc.c (print_pkenc_list): Simplify.
--

This changes the output from

# ------------------------ >8 ------------------------
  gpg: encrypted with 2048-bit RSA key, ID D20073D46DF6C97D, created 2019-04-02
        "Test with PIV card"

to

  gpg: encrypted with rsa2048 key, ID D20073D46DF6C97D, created 2019-04-02
        "Test with PIV card"

Signed-off-by: Werner Koch <wk@gnupg.org>
# ------------------------ 8< ------------------------
This commit is contained in:
Werner Koch 2019-04-03 09:04:49 +02:00
parent a480182f9d
commit 2d3392c147
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
2 changed files with 9 additions and 9 deletions

View File

@ -68,7 +68,7 @@ pubkey_letter( int algo )
}
/* Return a string describing the public key algorithm and the
keysize. For elliptic curves the functions prints the name of the
keysize. For elliptic curves the function prints the name of the
curve because the keysize is a property of the curve. The string
is copied to the supplied buffer up a length of BUFSIZE-1.
Examples for the output are:

View File

@ -506,19 +506,18 @@ print_pkenc_list (ctrl_t ctrl, struct pubkey_enc_list *list)
for (; list; list = list->next)
{
PKT_public_key *pk;
const char *algstr;
char pkstrbuf[PUBKEY_STRING_SIZE];
char *p;
algstr = openpgp_pk_algo_name (list->pubkey_algo);
pk = xmalloc_clear (sizeof *pk);
if (!algstr)
algstr = "[?]";
pk->pubkey_algo = list->pubkey_algo;
if (!get_pubkey (ctrl, pk, list->keyid))
{
char *p;
log_info (_("encrypted with %u-bit %s key, ID %s, created %s\n"),
nbits_from_pk (pk), algstr, keystr_from_pk(pk),
pubkey_string (pk, pkstrbuf, sizeof pkstrbuf);
log_info (_("encrypted with %s key, ID %s, created %s\n"),
pkstrbuf, keystr_from_pk (pk),
strtimestamp (pk->timestamp));
p = get_user_id_native (ctrl, list->keyid);
log_printf (_(" \"%s\"\n"), p);
@ -526,7 +525,8 @@ print_pkenc_list (ctrl_t ctrl, struct pubkey_enc_list *list)
}
else
log_info (_("encrypted with %s key, ID %s\n"),
algstr, keystr(list->keyid));
openpgp_pk_algo_name (list->pubkey_algo),
keystr(list->keyid));
free_public_key (pk);
}