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

* command.c (cmd_getattr): New command GETATTR.

* app.c (app_setattr): New.
(do_getattr): New.
(do_learn_status): Reimplemented in terms of do_getattr.

* app-openpgp.c (do_change_pin): Make sure CVH1 and CHV2 are
always synced.
(verify_chv2, verify_chv3): New. Factored out common code.
(do_setattr, do_sign, do_auth, do_decipher): Change the names of
the prompts to match that we have only 2 different PINs.
(app_select_openpgp): Check whether the card enforced CHV1.
(convert_sig_counter_value): New. Factor out code from
get_sig_counter.
This commit is contained in:
Werner Koch 2003-09-30 17:35:05 +00:00
parent 316dc2fd60
commit 59a61b3c93
5 changed files with 329 additions and 238 deletions

View file

@ -702,6 +702,41 @@ cmd_pkdecrypt (ASSUAN_CONTEXT ctx, char *line)
}
/* GETATTR <name>
This command is used to retrieve data from a smartcard. The
allowed names depend on the currently selected smartcard
application. NAME must be percent and '+' escaped. The value is
returned through status message, see the LESRN command for details.
However, the current implementation assumes that Name is not escaped;
this works as long as noone uses arbitrary escaping.
*/
static int
cmd_getattr (ASSUAN_CONTEXT ctx, char *line)
{
CTRL ctrl = assuan_get_pointer (ctx);
int rc;
char *keyword;
if ((rc = open_card (ctrl)))
return rc;
keyword = line;
for (; *line && !spacep (line); line++)
;
if (*line)
*line++ = 0;
/* (We ignore any garbage for now.) */
rc = app_getattr (ctrl->app_ctx, ctrl, keyword);
return map_to_assuan_status (rc);
}
/* SETATTR <name> <value>
This command is used to store data on a a smartcard. The allowed
@ -908,6 +943,7 @@ register_commands (ASSUAN_CONTEXT ctx)
{ "PKDECRYPT", cmd_pkdecrypt },
{ "INPUT", NULL },
{ "OUTPUT", NULL },
{ "GETATTR", cmd_getattr },
{ "SETATTR", cmd_setattr },
{ "GENKEY", cmd_genkey },
{ "RANDOM", cmd_random },