1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

card: New option --shadow for command list.

* tools/card-call-scd.c (scd_readkey): Add arg create_shadow.
* tools/gpg-card.c (list_one_kinfo): Add arg create_shadow and pass it
down to scd-readkey.  Change all callers to convey this arg.
(cmd_list): Add option --shadow.
This commit is contained in:
Werner Koch 2021-04-21 21:03:57 +02:00
parent 8f2c9cb735
commit 2fce99d73a
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
3 changed files with 50 additions and 29 deletions

View file

@ -1511,9 +1511,10 @@ 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. */
* s-expression is stored at R_RESULT. If CREATE_SHADOW is set stub
* keys will be created if they do not exist. */
gpg_error_t
scd_readkey (const char *keyrefstr, gcry_sexp_t *r_result)
scd_readkey (const char *keyrefstr, int create_shadow, gcry_sexp_t *r_result)
{
gpg_error_t err;
char line[ASSUAN_LINELENGTH];
@ -1527,7 +1528,10 @@ scd_readkey (const char *keyrefstr, gcry_sexp_t *r_result)
return err;
init_membuf (&data, 1024);
snprintf (line, DIM(line), "SCD READKEY %s", keyrefstr);
if (create_shadow)
snprintf (line, DIM(line), "READKEY --card -- %s", keyrefstr);
else
snprintf (line, DIM(line), "SCD READKEY %s", keyrefstr);
err = assuan_transact (agent_ctx, line,
put_membuf_cb, &data,
NULL, NULL,