mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
card: Print the used algorithm of all keys.
* tools/card-call-scd.c (scd_readkey): New. * tools/card-tool-misc.c (pubkey_algo_string): New. * tools/gpg-card-tool.c (list_one_kinfo): Print the algo. -- It is convenient to see the actual algorithm of keys even if no certificate has yet been created. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
df6ba6dfd2
commit
b79bc877f2
4 changed files with 108 additions and 0 deletions
|
@ -1298,6 +1298,45 @@ scd_readcert (const char *certidstr, void **r_buf, size_t *r_buflen)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/* Send a READKEY command to the SCdaemon. On success a new
|
||||
* s-expression is stored at R_RESULT. */
|
||||
gpg_error_t
|
||||
scd_readkey (const char *keyrefstr, gcry_sexp_t *r_result)
|
||||
{
|
||||
gpg_error_t err;
|
||||
char line[ASSUAN_LINELENGTH];
|
||||
membuf_t data;
|
||||
unsigned char *buf;
|
||||
size_t len, buflen;
|
||||
|
||||
*r_result = NULL;
|
||||
err = start_agent (0);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
init_membuf (&data, 1024);
|
||||
snprintf (line, DIM(line), "SCD READKEY %s", keyrefstr);
|
||||
err = assuan_transact (agent_ctx, line,
|
||||
put_membuf_cb, &data,
|
||||
NULL, NULL,
|
||||
NULL, NULL);
|
||||
if (err)
|
||||
{
|
||||
xfree (get_membuf (&data, &len));
|
||||
return err;
|
||||
}
|
||||
buf = get_membuf (&data, &buflen);
|
||||
if (!buf)
|
||||
return gpg_error_from_syserror ();
|
||||
|
||||
err = gcry_sexp_new (r_result, buf, buflen, 0);
|
||||
xfree (buf);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Callback function for card_cardlist. */
|
||||
static gpg_error_t
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue