aboutsummaryrefslogtreecommitdiffstats
path: root/tools/gpg-card-tool.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2019-02-25card: Rename gpg-card-tool to gpg-card.Werner Koch1-3452/+0
* tools/card-tool-keys.c: Rename to card-keys.c. * tools/card-tool-misc.c: Rename to card-misc.c. * tools/card-tool-yubikey.c: Rename to card-yubikey.c. * tools/card-tool.h: Rename to gpg-card.h. * tools/gpg-card-tool-w32info.rc: Rename to gpg-card-w32info.rc * doc/card-tool.texi: Rename top gpg-card.texi Signed-off-by: Werner Koch <[email protected]>
2019-02-21card: Print usage info for each key.Werner Koch1-1/+19
* tools/card-call-scd.c (learn_status_cb): Handle extended KEYPARIRINFO. * tools/card-tool.h (struct key_info_s): Add field 'usage'. * tools/gpg-card-tool.c (list_one_kinfo): Show usage flags. Signed-off-by: Werner Koch <[email protected]>
2019-02-21card: Print the keyref in the listing.Werner Koch1-0/+1
* tools/gpg-card-tool.c (list_one_kinfo): Print the keyref. -- The named keys are nice but knowing the actual keyref mapping to them is also useful. Signed-off-by: Werner Koch <[email protected]>
2019-02-13card: New command "yubikey".Werner Koch1-47/+84
* tools/card-tool-yubikey.c: New. * tools/Makefile.am (gpg_card_tool_SOURCES): Add it. * tools/card-call-scd.c (scd_apdu): Allow returning data. * tools/card-tool-misc.c (send_apdu): New. Move from gpg-card-tool.c and let it return data. Change all callers. * tools/gpg-card-tool.c (cmd_writecert): Prepend the certref with the current application type. (cmd_yubikey): New. -- This command allows listing of active applications and to enable or disable selected applications. This is in particular useful to disable the OpenPGP application so that the PIV support can easily be tested. Signed-off-by: Werner Koch <[email protected]>
2019-02-08card: Make "generate" work for PIV cards.Werner Koch1-18/+130
* tools/card-call-scd.c (scd_genkey_cb): Make createtime optional. (scd_genkey_cb): Ditto. Add arg algo. * tools/gpg-card-tool.c (cmd_generate): Add options and factor card specific code out to ... (generate_openpgp, generate_generic): new functions. -- This patch keeps the interactive OpenPGP mode but adds a pure command line mode for other cards; in particular PIV cards. What we still need to do is: a) Add an interactive mode for PIV cards b) Add a command line mode for OpenPGP cards. Signed-off-by: Werner Koch <[email protected]>
2019-02-07card: Print the used algorithm of all keys.Werner Koch1-0/+9
* 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 <[email protected]>
2019-02-07card: Fix a NULL-ptr deref in key listings.Werner Koch1-2/+2
* tools/card-tool-keys.c (get_matching_keys): Fix segv. * tools/gpg-card-tool.c (main): Init info. Signed-off-by: Werner Koch <[email protected]>
2019-02-07card: Support reading and writing PIV certificatesWerner Koch1-32/+44
* scd/app-piv.c (add_tlv): New. (put_data): New. (do_writecert): New. (do_setattr): Remove usused special mode 0. * tools/gpg-card-tool.c (cmd_writecert): Allow other cards than OPENPGP. (cmd_readcert): Ditto. Signed-off-by: Werner Koch <[email protected]>
2019-02-07card: Add readline completion for help argumentsWerner Koch1-1/+4
--
2019-02-06scd: Implement PIN changing and unblocking for PIV cards.Werner Koch1-32/+76
* scd/app-piv.c: Some refactoring (do_change_chv): Implement. Signed-off-by: Werner Koch <[email protected]>
2019-02-05scd: Allow standard keyref scheme for app-openpgp.Werner Koch1-6/+6
* scd/app-openpgp.c (do_change_pin): Allow prefixing the CHVNO with "OPENPGP." * tools/card-call-scd.c (scd_change_pin): Change API to use strings. * tools/gpg-card-tool.c (cmd_passwd): Adjust for change. (cmd_unblock): Ditto. -- The generic keyref allows for better error detection in case a keyref is send to a wrong card. Signed-off-by: Werner Koch <[email protected]>
2019-01-31card: Implement non-interactive mode.Werner Koch1-72/+244
* 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]>
2019-01-31card: New command 'authenticate'.Werner Koch1-6/+82
* tools/card-tool-misc.c (hex_to_buffer): New. * tools/gpg-card-tool.c (get_data_from_file): Change to allow returning a string. (cmd_authenticate): New. (cmds): Add command "authenticate". Signed-off-by: Werner Koch <[email protected]>
2019-01-30card: Cache the results from gpg and gpgsm.Werner Koch1-0/+4
* tools/card-tool-keys.c (keyblock_cache): New var. (release_keyblock): Factor code out to a new do_release_keyblock. Add a cache. (flush_keyblock_cache): New. (get_matching_keys): Use the cache. * tools/gpg-card-tool.c (cmds): Add command "reset". (interactive_loop): Implement reset. -- Signed-off-by: Werner Koch <[email protected]>
2019-01-30card: Print matching OpenPGP and X.509 data.Werner Koch1-7/+85
* tools/card-tool-keys.c: New. * tools/Makefile.am (gpg_card_tool_SOURCES): Add file. * tools/card-tool.h (struct pubkey_s, pubkey_t): New. (struct userid_s, userid_t): New. (struct keyblock_s, keyblock_t): New. * common/util.h (GNUPG_PROTOCOL_): New const * tools/gpg-card-tool.c (aTest): Add temporary command. (list_one_kinfo): Print info from gpg and gpgsm. Signed-off-by: Werner Koch <[email protected]>
2019-01-29card: Support factory reset for Yubikey PIV application.Werner Koch1-68/+128
* scd/app-common.h (struct app_ctx_s): Add field cardtype. * scd/app.c (app_new_register): Set cardtype for yubikey. (app_getattr): Add CARDTYPE. (app_write_learn_status): Emit new attribute. * scd/app-piv.c (do_getattr): Add CHV-USAGE. (do_learn_status): Emit it. * tools/card-tool.h (struct card_info_s): Add field cardtype. * tools/card-call-scd.c (learn_status_cb): Parse "CARDTYPE". * tools/gpg-card-tool.c (list_piv): Print PIN usage policy. (list_card): Print card type. (cmd_factoryreset): Implement for Yubikey with PIV. Signed-off-by: Werner Koch <[email protected]>
2019-01-29card: Print keyinfo for PIV cards.Werner Koch1-2/+41
* scd/app-piv.c (do_learn_status): Print CHV-STATUS. * tools/card-tool.h (struct card_info_s): Rename chvretry to chvinfo. * tools/card-call-scd.c (learn_status_cb): Depend CHV-STATUS on app type. * tools/gpg-card-tool.c (list_piv): New. Signed-off-by: Werner Koch <[email protected]>
2019-01-29card: Make printing of key information more flexible.Werner Koch1-41/+99
* tools/card-tool-misc.c: New. * tools/card-tool.h: Rewored data structures for key infos. * tools/gpg-card-tool.c: Ditto. * tools/card-call-scd.c: Ditto. -- Note that this also changes the way the key information is printed. Formerly we printed it like: Signature key ....: <openpgp-fingerprint> created ....: <timestamp> keygrip ... : <keygrip> now we do: Signature key ....: <keygrip> fingerprint : <openpgp-fingerprint> created ....: <timestamp> This is because a keygrip is always available but a fingerprint and the creation date are properties of an OpenPGP card. A standard way of listing keys is better than one depending on the type of card. Signed-off-by: Werner Koch <[email protected]>
2019-01-27card: Implement the bulk of OpenPGP stuff into gpg-card-tool.Werner Koch1-368/+2228
* tools/card-call-scd.c: New. * tools/card-tool.h: new. * tools/gpg-card-tool.c: Largely extended. -- gpg-card-tool will eventually replace the --card-edit command of gpg because it makes more sense to have a multi-protocol aware tool and not just one for OpenPGP cards. Most OpenPGP card things works now but a few, those which require close interaction with gpg, still need to be implemented. And of course the whole planned non-interactive stuff needs to be written. Signed-off-by: Werner Koch <[email protected]>
2019-01-22card-tool: Add skeleton for new toolWerner Koch1-0/+869
* tools/gpg-card-tool.c: New. * tools/gpg-card-tool-w32info.rc: New. * tools/Makefile.am: Add new tool. -- To support more cards than the OpenPGP card it is useful to have a separate tool. It will have have the "gpg --card-edit" style interactive interface as well as direct command line options for all commands. In a first step the OpenPGP card will be supported, to allow its use as an alternative to the gpg command, and the forthcoming PIV card support. The tool can be though as a direct interface to scdaemon. Signed-off-by: Werner Koch <[email protected]>