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

card: New command "yubikey".

* tools/card-tool-yubikey.c: New.
* tools/Makefile.am (gpg_card_tool_SOURCES): Add it.
* tools/card-call-scd.c (scd_apdu): Allow returning data.
* tools/card-tool-misc.c (send_apdu): New.  Move from gpg-card-tool.c
and let it return data.  Change all callers.

* tools/gpg-card-tool.c (cmd_writecert): Prepend the certref with the
current application type.
(cmd_yubikey): New.
--

This command allows listing of active applications and to enable or
disable selected applications.  This is in particular useful to
disable the OpenPGP application so that the PIV support can easily be
tested.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2019-02-13 09:46:36 +01:00
parent 43b14b4cc2
commit 7e1cd2cd41
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
6 changed files with 580 additions and 50 deletions

View file

@ -445,12 +445,20 @@ store_serialno (const char *line)
/* Send an APDU to the current card. On success the status word is
* stored at R_SW inless R_SW is NULL. With HEXAPDU being NULL only a
* RESET command is send to scd. With HEXAPDU being the string
* "undefined" the command "SERIALNO undefined" is send to scd. */
* "undefined" the command "SERIALNO undefined" is send to scd. If
* R_DATA is not NULL the data is without the status code is stored
* there. Caller must release it. */
gpg_error_t
scd_apdu (const char *hexapdu, unsigned int *r_sw)
scd_apdu (const char *hexapdu, unsigned int *r_sw,
unsigned char **r_data, size_t *r_datalen)
{
gpg_error_t err;
if (r_data)
*r_data = NULL;
if (r_datalen)
*r_datalen = 0;
err = start_agent (START_AGENT_NO_STARTUP_CMDS);
if (err)
return err;
@ -489,6 +497,12 @@ scd_apdu (const char *hexapdu, unsigned int *r_sw)
{
if (r_sw)
*r_sw = buf16_to_uint (data+datalen-2);
if (r_data && r_datalen)
{
*r_data = data;
*r_datalen = datalen - 2;
data = NULL;
}
}
xfree (data);
}