aboutsummaryrefslogtreecommitdiffstats
path: root/scd/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'scd/command.c')
-rw-r--r--scd/command.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/scd/command.c b/scd/command.c
index dfd1ee538..392b678c4 100644
--- a/scd/command.c
+++ b/scd/command.c
@@ -41,6 +41,7 @@
#endif
#include "../common/asshelp.h"
#include "../common/server-help.h"
+#include "../common/ssh-utils.h"
/* Maximum length allowed as a PIN; used for INQUIRE NEEDPIN. That
* length needs to small compared to the maximum Assuan line length. */
@@ -1074,7 +1075,7 @@ cmd_pksign (assuan_context_t ctx, char *line)
static const char hlp_pkauth[] =
- "PKAUTH <hexified_id>";
+ "PKAUTH [--challenge-response] <hexified_id>";
static gpg_error_t
cmd_pkauth (assuan_context_t ctx, char *line)
{
@@ -1085,11 +1086,17 @@ cmd_pkauth (assuan_context_t ctx, char *line)
char *keyidstr;
card_t card;
const char *keygrip = NULL;
+ int challenge_response = 0;
if ((rc = open_card (ctrl)))
return rc;
- /* We have to use a copy of the key ID because the function may use
+ if (has_option (line, "--challenge-response"))
+ challenge_response = 1;
+
+ line = skip_options (line);
+
+ /* We have to use a copy of the key ID because the function may use
the pin_cb which in turn uses the assuan line buffer and thus
overwriting the original line with the keyid */
keyidstr = xtrystrdup (line);
@@ -1101,6 +1108,13 @@ cmd_pkauth (assuan_context_t ctx, char *line)
if (strlen (keyidstr) == 40)
keygrip = keyidstr;
+ if (challenge_response)
+ {
+ xfree (ctrl->in_data.value);
+ ctrl->in_data.value = NULL;
+ ctrl->in_data.valuelen = 0;
+ }
+
card = card_get (ctrl, keygrip);
if (card)
{