diff options
Diffstat (limited to 'g10/call-agent.c')
-rw-r--r-- | g10/call-agent.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/g10/call-agent.c b/g10/call-agent.c index 63919dd1f..cd58b90b3 100644 --- a/g10/call-agent.c +++ b/g10/call-agent.c @@ -488,7 +488,6 @@ agent_scd_writecert (const char *certidstr, } - /* Handle a KEYDATA inquiry. Note, we only send the data, assuan_transact takes care of flushing and writing the end */ @@ -539,7 +538,6 @@ agent_scd_writekey (int keyno, const char *serialno, } - /* Status callback for the SCD GENKEY command. */ static int @@ -765,6 +763,43 @@ agent_scd_pkdecrypt (const char *serialno, } + +/* Send a READCERT command to the SCdaemon. */ +int +agent_scd_readcert (const char *certidstr, + void **r_buf, size_t *r_buflen) +{ + int rc; + char line[ASSUAN_LINELENGTH]; + membuf_t data; + size_t len; + + *r_buf = NULL; + rc = start_agent (); + if (rc) + return rc; + + init_membuf (&data, 2048); + + snprintf (line, DIM(line)-1, "SCD READCERT %s", certidstr); + line[DIM(line)-1] = 0; + rc = assuan_transact (agent_ctx, line, + membuf_data_cb, &data, + default_inq_cb, NULL, NULL, NULL); + if (rc) + { + xfree (get_membuf (&data, &len)); + return rc; + } + *r_buf = get_membuf (&data, r_buflen); + if (!*r_buf) + return gpg_error (GPG_ERR_ENOMEM); + + return 0; +} + + + /* Change the PIN of an OpenPGP card or reset the retry counter. CHVNO 1: Change the PIN 2: For v1 cards: Same as 1. |