diff options
author | Werner Koch <[email protected]> | 2019-01-31 17:57:16 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2019-01-31 17:57:16 +0000 |
commit | 1c0fa3e6f74692d5e9b5f08cda523f0fcec305eb (patch) | |
tree | 6f188a78a7c4b39089616132a798558ec9c0335c /tools/card-call-scd.c | |
parent | card: New command 'authenticate'. (diff) | |
download | gnupg-1c0fa3e6f74692d5e9b5f08cda523f0fcec305eb.tar.gz gnupg-1c0fa3e6f74692d5e9b5f08cda523f0fcec305eb.zip |
card: Implement non-interactive mode.
* tools/card-tool.h (opt): Add field 'initialized'.
* tools/card-call-scd.c (scd_learn): Set it.
* tools/gpg-card-tool.c (main): Reworked.
(dispatch_command): New.
--
This work is not yet finished because most commands need some tweaks
for non-interactive work. What you already can do are things like:
$ gpg-card-tool list -- 'auth <oldkey' \
-- auth --setkey --raw 123456781234567812345678 -- help auth
Which will list the current card, authenticate using a hex encoded key
from the file "oldkey", set the new admin key to "123...78", and print
help for the auth command. Note that the -- acts as a delimiter
between commands. To use a double dash as argument to a command the
entire command must be quoted.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'tools/card-call-scd.c')
-rw-r--r-- | tools/card-call-scd.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/card-call-scd.c b/tools/card-call-scd.c index 9a742a728..c51282f14 100644 --- a/tools/card-call-scd.c +++ b/tools/card-call-scd.c @@ -956,6 +956,8 @@ scd_learn (card_info_t info) /* Also try to get some other key attributes. */ if (!err) { + info->initialized = 1; + err = scd_getattr ("KEY-ATTR", info); if (gpg_err_code (err) == GPG_ERR_INV_NAME || gpg_err_code (err) == GPG_ERR_UNSUPPORTED_OPERATION) @@ -964,7 +966,6 @@ scd_learn (card_info_t info) if (gpg_err_code (err) == GPG_ERR_INV_NAME || gpg_err_code (err) == GPG_ERR_UNSUPPORTED_OPERATION) err = 0; /* Not implemented or GETATTR not supported. */ - } if (info == &dummyinfo) |