mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
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 <gniibe@fsij.org>
This commit is contained in:
parent
c1ea0b577a
commit
f9da935c3e
5 changed files with 99 additions and 61 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue