aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2019-04-03 07:04:49 +0000
committerWerner Koch <[email protected]>2019-04-03 07:04:49 +0000
commit2d3392c147a24e49ee4658d4a50fafd68599fba3 (patch)
tree304d6e5aa033a2cef5c0c554a1f3c9793378a8cf
parentgpg: Allow direct key generation from card with --full-gen-key. (diff)
downloadgnupg-2d3392c147a24e49ee4658d4a50fafd68599fba3.tar.gz
gnupg-2d3392c147a24e49ee4658d4a50fafd68599fba3.zip
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 <[email protected]> # ------------------------ 8< ------------------------
-rw-r--r--g10/keyid.c2
-rw-r--r--g10/mainproc.c16
2 files changed, 9 insertions, 9 deletions
diff --git a/g10/keyid.c b/g10/keyid.c
index aa77b47e2..45454f056 100644
--- a/g10/keyid.c
+++ b/g10/keyid.c
@@ -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:
diff --git a/g10/mainproc.c b/g10/mainproc.c
index 7acf67b1e..d99ac4386 100644
--- a/g10/mainproc.c
+++ b/g10/mainproc.c
@@ -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);
}