aboutsummaryrefslogtreecommitdiffstats
path: root/scd/command.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2016-11-04 04:45:57 +0000
committerNIIBE Yutaka <[email protected]>2016-11-04 04:45:57 +0000
commitf9da935c3eb302e75a80def51128fb6f669661d7 (patch)
tree85cb84c7aea26666af853cdc71481f5015c75fae /scd/command.c
parentagent: Extend the PINENTRY_LAUNCHED inquiry and status. (diff)
downloadgnupg-f9da935c3eb302e75a80def51128fb6f669661d7.tar.gz
gnupg-f9da935c3eb302e75a80def51128fb6f669661d7.zip
scd: Add --advanced option for READKEY.
* scd/command.c (cmd_readkey) : Support ADVANCED arg. * scd/app.c (app_readcert): Add ADVANCED arg. * scd/app-openpgp.c (do_readkey): Implement ADVANCED arg. * scd/app-nks.c (do_readkey): Error return with GPG_ERR_NOT_SUPPORTED. -- "SCD READKEY --advanced OPENPGP.3" returns key in advanced format. With this suport, poldi-ctrl will be no longer needed. Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'scd/command.c')
-rw-r--r--scd/command.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/scd/command.c b/scd/command.c
index 9d978ab48..edea01c1e 100644
--- a/scd/command.c
+++ b/scd/command.c
@@ -729,17 +729,19 @@ cmd_readcert (assuan_context_t ctx, char *line)
static const char hlp_readkey[] =
- "READKEY <keyid>\n"
+ "READKEY [--advanced] <keyid>\n"
"\n"
"Return the public key for the given cert or key ID as a standard\n"
"S-expression.\n"
+ "In --advanced mode it returns the S-expression in advanced format.\n"
"\n"
- "Note, that this function may even be used on a locked card.";
+ "Note that this function may even be used on a locked card.";
static gpg_error_t
cmd_readkey (assuan_context_t ctx, char *line)
{
ctrl_t ctrl = assuan_get_pointer (ctx);
int rc;
+ int advanced = 0;
unsigned char *cert = NULL;
size_t ncert, n;
ksba_cert_t kc = NULL;
@@ -750,11 +752,16 @@ cmd_readkey (assuan_context_t ctx, char *line)
if ((rc = open_card (ctrl, NULL)))
return rc;
+ if (has_option (line, "--advanced"))
+ advanced = 1;
+
+ line = skip_options (line);
+
line = xstrdup (line); /* Need a copy of the line. */
/* If the application supports the READKEY function we use that.
Otherwise we use the old way by extracting it from the
certificate. */
- rc = app_readkey (ctrl->app_ctx, line, &pk, &pklen);
+ rc = app_readkey (ctrl->app_ctx, advanced, line, &pk, &pklen);
if (!rc)
{ /* Yeah, got that key - send it back. */
rc = assuan_send_data (ctx, pk, pklen);