mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
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 <gniibe@fsij.org>
This commit is contained in:
parent
64c8786105
commit
5264d3f58e
6 changed files with 103 additions and 71 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue