1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

scd: Extend KEYPAIRINFO with an algorithm string.

* scd/app-openpgp.c (send_keypair_info): Emit the algo string as part
of a KEYPAIRINFO.
* scd/command.c (do_readkey): Ditto.
* scd/app-piv.c (do_readkey): Ditto.
* scd/app-nks.c (do_learn_status_core): Ditto.
(struct fid_cache_s): Add field algostr.
(flush_fid_cache): Release it.
(keygripstr_from_pk_file): Fill it and add it to the cache.  Use a
single exit label.
* scd/app-help.c (app_help_get_keygrip_string_pk): Add new arg
r_algostr.  Change all callers.
--

This is helpful so that callers do not need to parse the key for this
basic information.  Use "scd readkey --info-only" to return the info
status line instead of the key material; using just --info returns the
info in addition to the key material.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2020-09-21 14:47:53 +02:00
parent babd87f2da
commit 26da47ae53
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
8 changed files with 104 additions and 27 deletions

View file

@ -1538,8 +1538,10 @@ do_readkey (app_t app, ctrl_t ctrl, const char *keyrefstr, unsigned int flags,
char keygripstr[KEYGRIP_LEN*2+1];
char idbuf[50];
const char *usage;
char *algostr;
err = app_help_get_keygrip_string_pk (pk, pklen, keygripstr, NULL, NULL);
err = app_help_get_keygrip_string_pk (pk, pklen, keygripstr,
NULL, NULL, &algostr);
if (err)
{
log_error ("app_help_get_keygrip_string_pk failed: %s\n",
@ -1553,7 +1555,10 @@ do_readkey (app_t app, ctrl_t ctrl, const char *keyrefstr, unsigned int flags,
keygripstr, strlen (keygripstr),
idbuf, strlen (idbuf),
usage, strlen (usage),
"-", (size_t)1,
algostr, strlen (algostr),
NULL, (size_t)0);
xfree (algostr);
}
if (r_pk && r_pklen)