diff options
author | NIIBE Yutaka <[email protected]> | 2022-05-26 03:01:16 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2022-05-26 03:01:16 +0000 |
commit | 5264d3f58e8a8362900c3518bdd683ff9a23cccc (patch) | |
tree | d49c9b558c4f2ca4408fcb98910d742c8789f2e8 /scd/command.c | |
parent | scd,piv: Fix status report of KEYPAIRINFO. (diff) | |
download | gnupg-5264d3f58e8a8362900c3518bdd683ff9a23cccc.tar.gz gnupg-5264d3f58e8a8362900c3518bdd683ff9a23cccc.zip |
scd: Return USAGE information for KEYINFO command.
* scd/command.c (hlp_keyinfo): Update.
(send_keyinfo): Add a USAGE argument.
* scd/scdaemon.h (send_keyinfo): Add a USAGE argument.
* scd/app-nks.c (set_usage_string): New.
(do_learn_status_core, do_readkey): Use set_usage_string.
(do_with_keygrip): Add USAGE to call send_keyinfo,
using set_usage_string.
* scd/app-openpgp.c (get_usage_string): New.
(send_keypair_info): Use get_usage_string.
(send_keyinfo_if_available): Add USAGE to call send_keyinfo,
using get_usage_string.
* scd/app-p15.c (set_usage_string): New.
(send_keypairinfo): Use set_usage_string.
(do_with_keygrip): Add USAGE to call send_keyinfo,
using set_usage_string.
* scd/app-piv.c (do_with_keygrip): Add USAGE to call send_keyinfo.
--
Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'scd/command.c')
-rw-r--r-- | scd/command.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/scd/command.c b/scd/command.c index 28fdfcb62..b9303b546 100644 --- a/scd/command.c +++ b/scd/command.c @@ -2235,7 +2235,7 @@ static const char hlp_keyinfo[] = "Unless --data is given, the\n" "information is returned as a status line using the format:\n" "\n" - " KEYINFO <keygrip> T <serialno> <idstr>\n" + " KEYINFO <keygrip> T <serialno> <idstr> <usage>\n" "\n" "KEYGRIP is the keygrip.\n" "\n" @@ -2243,9 +2243,13 @@ static const char hlp_keyinfo[] = " smartcard. If the serial number is not known a single\n" " dash '-' is used instead.\n" "\n" - "IDSTR is the IDSTR used to distinguish keys on a smartcard. If it\n" + "IDSTR is a string used to distinguish keys on a smartcard. If it\n" " is not known a dash is used instead.\n" "\n" + "USAGE is a string of capabilities of the key, 's' for sign, \n" + "'e' for encryption, 'a' for auth, and 'c' for cert. If it is not\n" + "known a dash is used instead.\n" + "\n" "More information may be added in the future."; static gpg_error_t cmd_keyinfo (assuan_context_t ctx, char *line) @@ -2290,14 +2294,15 @@ cmd_keyinfo (assuan_context_t ctx, char *line) * line. */ void send_keyinfo (ctrl_t ctrl, int data, const char *keygrip_str, - const char *serialno, const char *idstr) + const char *serialno, const char *idstr, const char *usage) { char *string; assuan_context_t ctx = ctrl->server_local->assuan_ctx; - string = xtryasprintf ("%s T %s %s%s", keygrip_str, + string = xtryasprintf ("%s T %s %s %s%s", keygrip_str, serialno? serialno : "-", idstr? idstr : "-", + usage? usage : "-", data? "\n" : ""); if (!string) |