aboutsummaryrefslogtreecommitdiffstats
path: root/tools/card-call-scd.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'STABLE-BRANCH-2-4'Werner Koch2024-01-261-3/+89
|\ | | | | | | | | | | | | | | -- Fixed conflicts: NEWS configure.ac doc/gpg.texi
| * card: New subcommand "checkkeys".Werner Koch2024-01-221-3/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * agent/command.c (cmd_havekey): Add new option --info. * tools/card-call-scd.c (scd_readkey): Allow using without result arg. (struct havekey_status_parm_s): New. (havekey_status_cb): New. (scd_havekey_info): New. (scd_delete_key): New. * tools/gpg-card.c (print_keygrip): Add arg with_lf. (cmd_checkkeys): New. (cmdCHECKKEYS): New. (cmds): Add command "checkkeys". (dispatch_command, interactive_loop): Call cmd_checkkeys. -- GnuPG-bug-id: 6943
| * gpg,tools: Handle GPG_ERR_PIN_BLOCKED and GPG_ERR_NO_RESET_CODE.NIIBE Yutaka2023-11-081-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | * g10/card-util.c (write_sc_op_status): Emit 3 and 4 in status line. * tools/card-call-scd.c (status_sc_op_failure): Likewise. -- Cherry-pick from master commit of: 64f5f7b74e428b15205f6e8ae14dec84663c3076 GnuPG-bug-id: 6425 Signed-off-by: NIIBE Yutaka <[email protected]>
* | gpg,tools: Handle GPG_ERR_PIN_BLOCKED and GPG_ERR_NO_RESET_CODE.NIIBE Yutaka2023-11-081-0/+6
| | | | | | | | | | | | | | | | | | | | * g10/card-util.c (write_sc_op_status): Emit 3 and 4 in status line. * tools/card-call-scd.c (status_sc_op_failure): Likewise. -- GnuPG-bug-id: 6425 Signed-off-by: NIIBE Yutaka <[email protected]>
* | Merge branch 'STABLE-BRANCH-2-4'Werner Koch2023-11-071-0/+1
|\| | | | | | | | | | | | | * common/b64dec.c (b64decode): Move to ... * common/miscellaneous.c: here. * common/t-b64.c: Re-inroduce and keep only the b64decode test code.
| * scd:openpgp: Return better error codes for the Reset Code.Werner Koch2023-10-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * scd/app-openpgp.c (do_change_pin): Use GPG_ERR_BAD_RESET_CODE where appropriate. * common/util.h: Add error codes missing in gpgrt 1.46. * agent/call-pinentry.c (unlock_pinentry): Handle GPG_ERR_BAD_RESET_CODE. (agent_askpin): Ditlo. Also simply condition. (agent_get_passphrase): Ditto. * g10/call-agent.c (status_sc_op_failure): Handle GPG_ERR_BAD_RESET_CODE. * g10/card-util.c (write_sc_op_status): Ditto. * tools/card-call-scd.c (status_sc_op_failure): Ditto.
* | common: Prepare for more flags in start_new_service.Werner Koch2023-08-291-1/+2
|/ | | | | | | | | | | | | | * common/asshelp.h (ASSHELP_FLAG_AUTOSTART): New. * common/asshelp.c (start_new_service): Rename arg autostart to flags and adjust checks. (start_new_gpg_agent): Likewise. Change all callers. (start_new_keyboxd): Likewise. Change all callers. (start_new_dirmngr): Likewise. Change all callers. -- It is easier to have a generic flags arg instead of adding more and more dedicated args. verbose and debug are kept as they are because they are not boolean.
* card: New option --shadow for command list.Werner Koch2021-04-211-3/+7
| | | | | | | * 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.
* card: New flag --reread for LIST.Werner Koch2021-04-011-3/+5
| | | | | | | | | | * tools/gpg-card.c (cmd_list): Add flag --reread. * tools/card-call-scd.c (scd_learn): New arg reread. * tools/card-call-scd.c (release_card_info): Fix releasing of the new label var. Signed-off-by: Werner Koch <[email protected]>
* card: Print the key's label if available.Werner Koch2021-03-301-0/+35
| | | | | | | | | | | | | | * tools/gpg-card.h (struct key_info_s): Add field 'label'. * tools/card-call-scd.c (learn_status_cb): Parse KEY-LABEL. (scd_learn): Always request KEY-LABEL. * tools/gpg-card.c (nullnone): New. (list_one_kinfo, list_card): Use it. Print the label. -- PKCS#15 defines label which help to understand for what a key is intended. Print them. Signed-off-by: Werner Koch <[email protected]>
* card: Print PIN descriptions and fix number of printed retry counters.Werner Koch2021-03-181-0/+9
| | | | | | | | | | * tools/gpg-card.h (struct card_info_s): Add fields nmaxlen, nchvinfo, and chvlabels. * tools/card-call-scd.c (release_card_info): Free chvlabels. (learn_status_cb): Parse CHV-LABEL. Set nmaxlen and nchvinfo. * tools/gpg-card.c (list_retry_counter): Print CHV labels. Signed-off-by: Werner Koch <[email protected]>
* gpg,card: Allow no version information of Yubikey.NIIBE Yutaka2020-12-071-1/+2
| | | | | | | | | | * g10/call-agent.c (learn_status_cb): Assume >= 2 when no version. * tools/card-call-scd.c (learn_status_cb): Likewise. -- GnuPG-bug-id: 5100 Signed-off-by: NIIBE Yutaka <[email protected]>
* card: Let the APDU command prints a description of the status word.Werner Koch2020-11-271-0/+30
| | | | | | | | * tools/card-call-scd.c (scd_apdu_strerror): New. * tools/gpg-card.c (cmd_apdu): Print a description. -- Pretty convenient to explore smartcards.
* card: Run factory-reset in locked stated also in gpg-card.Werner Koch2020-11-091-3/+30
| | | | | | | | | | | | * tools/card-call-scd.c (scd_apdu): Add more pseudo APDUs. * tools/card-misc.c (send_apdu): Handle them. * tools/gpg-card.c (cmd_factoryreset): Use lock commands. -- This is port of the code used with gpg-card-edit. Note that the command "apdu" now also understands some extra keywords. Signed-off-by: Werner Koch <[email protected]>
* common,agent,dirmngr,g10,tools: Fix split_fields API.NIIBE Yutaka2020-09-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * common/stringhelp.h (split_fields): Use const * for the strings in the ARRAY. (split_fields_colon): Likewise. * common/stringhelp.c (split_fields, split_fields_colon): Fix the implementation. * agent/call-scd.c, agent/command.c: Follow the change. * common/t-stringhelp.c, dirmngr/loadswdb.c: Likewise. * g10/call-agent.c, tools/card-call-scd.c: Likewise. * tools/card-yubikey.c, tools/gpg-card.c: Likewise. * tools/gpg-card.h, tools/gpg-wks-client.c: Likewise. * tools/gpgconf-comp.c, tools/gpgconf.c: Likewise. * tools/wks-util.c: Likewise. -- The strings in the ARRAY don't need to be released by caller, as those are references. It's easier to follow the code when it's explicitly const *. Signed-off-by: NIIBE Yutaka <[email protected]>
* gpg,tools: Add handling of supported algorithms by a card.NIIBE Yutaka2020-09-081-0/+25
| | | | | | | | | | | * g10/call-agent.h (struct agent_card_info_s): Add supported_keyalgo. * g10/call-agent.c (learn_status_cb): Parse KEY-ATTR-INFO. (agent_release_card_info): Release supported_keyalgo. * tools/gpg-card.h (struct card_info_s): Add supported_keyalgo. * tools/card-call-scd.c (learn_status_cb): Parse KEY-ATTR-INFO. (release_card_info): Release supported_keyalgo. Signed-off-by: NIIBE Yutaka <[email protected]>
* Use only one copy of the warn_server_mismatch function.Werner Koch2020-09-011-35/+3
| | | | | | | | | | | | | | | | | * common/asshelp.c (warn_server_version_mismatch): New. Actually a slightly modified version of warn_version_mismatch found in other modules. * common/status.c (gnupg_status_strings): New. * g10/cpr.c (write_status_strings2): New. * g10/call-agent.c (warn_version_mismatch): Use the new unified warn_server_version_mismatch function. * g10/call-dirmngr.c (warn_version_mismatch): Ditto. * g10/call-keyboxd.c (warn_version_mismatch): Ditto. * sm/call-agent.c (warn_version_mismatch): Ditto. * sm/call-dirmngr.c (warn_version_mismatch): Ditto. * tools/card-call-scd.c (warn_version_mismatch): Ditto. Signed-off-by: Werner Koch <[email protected]>
* scd: New option to APDU command to return the ATR as data.Werner Koch2020-08-271-3/+7
| | | | | | | | | | * scd/command.c (cmd_apdu): Add new option --data-atr. * tools/gpg-card.c (cmd_apdu): Use that here. Also fix the --exlen option and do not print the statusword in atr mode. * tools/card-call-scd.c (scd_apdu): Detect atr mode anddon't assume a status word. Signed-off-by: Werner Koch <[email protected]>
* card: Better detect removed cards. Add TCOS PIN menu.Werner Koch2020-06-301-11/+4
| | | | | | | | | | | | | | | | | | | | | | | | | * tools/card-call-scd.c (scd_change_pin): Add arg 'nullpin'. * tools/gpg-card.h (struct card_info_s): Add field 'card_removed'. * tools/gpg-card.c (fixup_scd_errors): New. (maybe_set_card_removed): New. (list_one_kinfo): Change type of first arg to get access to INFO. Set card_removed flag. (list_all_kinfo): Improve label alignment. (cmd_list): Check that the current card is still available. (cmd_passwd): Add option --nullpin and menu to chnage TCOS PINs. (dispatch_command): Handle card_removed flag. (interactive_loop): Ditto. -- Note that that I was not able to change the NullPIN of the standard PIN using a Signature V2 Brainpool test card. Changing the NullPIN of the QES PIN worked, though. I checked the commands send to scdaemon and they were correct - I used the very same command with gpg-connect-agent last week to set a Pin for a production Brainpool Signature card. Thus this might be a problem with this specific test card. Signed-off-by: Werner Koch <[email protected]>
* card: New command "apdu"Werner Koch2020-05-281-4/+6
| | | | | | | | | | | | | | | * tools/card-call-scd.c (scd_apdu): Add optional arg 'options'. * tools/gpg-card.c (cmd_apdu): New. (enum cmdids): Add cmdAPDU. (dispatch_command): Add command "apdu". (interactive_loop): Ditto. -- This command is hidden because it can be used to brick a card. The command is basically the same as sending "scd apdu" in gpg-connect-agent but here we do full decoding and printing in hex. Signed-off-by: Werner Koch <[email protected]>
* card: Implement UID command and print capabilities.Werner Koch2020-05-261-1/+38
| | | | | | | | | | | * tools/card-call-scd.c (learn_status_cb): Return the full value for UIF. Add info about SM, MCL3, and PD. * tools/gpg-card.h (struct card_info_s): Add corresponding fields. * tools/gpg-card.c (list_openpgp): Print capabilities. Print the permanent flag for UIF. (cmd_uif): Implement. Signed-off-by: Werner Koch <[email protected]>
* card: Allow listing of NKS cards.Werner Koch2020-05-071-1/+1
| | | | | | | | | | | | | | * tools/card-call-scd.c (learn_status_cb): Always fill chvinfo. * tools/gpg-card.h (struct card_info_s): Increase size of chvinfo and chvmaxlen. * tools/gpg-card.c (list_nks): New. (print_a_version): Support single part version numbers. (list_card): Call list_nks. -- Note that chvmaxlen is not yet used with NKS. Signed-off-by: Werner Koch <[email protected]>
* gpg,card: Use the new MANUFACTURER attribute.Werner Koch2020-04-031-1/+12
| | | | | | | | | | | | | | | | | | | * tools/gpg-card.h (struct card_info_s): Add manufacturer fields. * tools/card-call-scd.c (release_card_info): Release them. (learn_status_cb): Parse MANUFACTURER attribute. * tools/gpg-card.c (get_manufacturer): Remove. (list_card): Use the new attribute. * g10/call-agent.h (struct agent_card_info_s): Add manufacturer fields. * g10/call-agent.c (agent_release_card_info): Release them. (learn_status_cb): Parse MANUFACTURER attribute. * g10/card-util.c (get_manufacturer): Remove. (current_card_status): Use new attribute. -- This does away with the duplicated OpenPGP vendor tables; they are now at a better place (app-openpgp.c). Signed-off-by: Werner Koch <[email protected]>
* gpg: Use gpgrt's new option parser to provide a global conf file.Werner Koch2020-02-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * common/util.h: Remove argparse.h. * common/argparse.c: Undef GPGRT_ENABLE_ARGPARSE_MACROS. * configure.ac (GPGRT_ENABLE_ARGPARSE_MACROS): Define. * agent/gpg-agent.c: Undef GPGRT_ENABLE_ARGPARSE_MACROS and include argparse.h. Do this also for all main modules which use our option parser except for gpg. Replace calls to strusage by calls to gpgrt_strusage everywhere. * g10/gpg.c (opts): Change type to gpgrt_opt_t. Flag oOptions and oNoOptions with ARGPARSE_conffile and ARGPARSE_no_conffile. (main): Change type of pargs to gpgrt_argparse_t. Rework the option parser to make use of the new gpgrt_argparser. -- This is not yet finished but a make check works. gpg has the most complex and oldest option handling and thus this is the first migration target. SE-Linux checks and version-ed config files are missing and will be added later. GnuPG-bug-id: 4788 Signed-off-by: Werner Koch <[email protected]>
* Spelling cleanup.Daniel Kahn Gillmor2020-02-181-2/+2
| | | | | | | | | | | | | | | | No functional changes, just fixing minor spelling issues. --- Most of these were identified from the command line by running: codespell \ --ignore-words-list fpr,stati,keyserver,keyservers,asign,cas,iff,ifset \ --skip '*.po,ChangeLog*,help.*.txt,*.jpg,*.eps,*.pdf,*.png,*.gpg,*.asc' \ doc g13 g10 kbx agent artwork scd tests tools am common dirmngr sm \ NEWS README README.maint TODO Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* card: Take the key creation time from the KEYPAIRINFOWerner Koch2020-02-131-45/+18
| | | | | | | | | * tools/card-call-scd.c (learn_status_cb): Adjust for recent change. -- This adjusts for the chnage in scdaemon. Signed-off-by: Werner Koch <[email protected]>
* card: Fix parsing of the received card_list.Werner Koch2020-02-121-1/+1
| | | | | | | * tools/card-call-scd.c (scd_cardlist): Allow for SERIALNO without any apps. Signed-off-by: Werner Koch <[email protected]>
* card: Remove command "key-attr" and hack on "generate".Werner Koch2020-02-101-15/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tools/gpg-card.h (struct key_attr): Remove. (struct key_info_s): Remove key_attr. Add keyalgo and keyalgo_id. * tools/card-call-scd.c (learn_status_cb): Rework the key-attr info. * tools/gpg-card.c (list_one_kinfo): Always show the algorithm; if there is no key show the key attributes instead. (list_openpgp): Do not print the "Key attributes". (generate_key): Factor the repalce key pormpt out to ... (ask_replace_keys): new. (generate_openpgp): Rename to generate_all_openpgp_card_keys and add an algo parameter. (generate_generic): Rename to generate_key. Prepare generation of a single OpenPGP key. (cmd_generate): Revamp. (ask_card_rsa_keysize): Remove. (ask_card_keyattr): Remove. (do_change_keyattr): Remove. (cmd_keyattr): Remove. (enum cmdids): Remove cmdKEYATTR. (cmds): Ditto. (dispatch_command): Ditto. (interactive_loop): Ditto. -- This change shows the key attributes of an OpenPGP card instead of the key's algorithm if no key exists. It also remove the key-attr command because for uniformity it is better to do this directly in scd/app-openpgp.c At least for this new gpg-card tool. There a couple of other changes but to the generate command but they are not yet ready. Signed-off-by: Werner Koch <[email protected]>
* card: Allow switching of cards and applications.Werner Koch2020-01-161-4/+91
| | | | | | | | | | | | | | | | | | | | | * tools/card-call-scd.c (struct card_cardlist_parm_s): Add field with_apps. (card_cardlist_cb): Handle the new with_apps flag. (scd_switchcard): New. (scd_switchapp): New. (scd_applist): New. (scd_serialno): Pass --all also in --demand mode. * tools/gpg-card.c (cmd_list): Simplify switching of cards. Add switching of alls. Print a list of apps per card. -- Note that the output format of "list --card" slightly changes: The current card is indicated with an asterisk. That should not harm any robust parsers which might already be in use. It is anyway a development version. Signed-off-by: Werner Koch <[email protected]>
* scd: Make SERIALNO --all work correctly and use it.Werner Koch2020-01-131-2/+2
| | | | | | | | | | | | | | * scd/app.c (maybe_switch_app): Factor reselect code out to ... (run_reselect): new. (app_write_learn_status): Tweak diagnostics. (app_do_with_keygrip): Run reselect if a card has more than one switchable application. * agent/call-scd.c (agent_card_serialno): Ditto. * tools/card-call-scd.c (start_agent): Use option --all with SERIALNO. (scd_serialno): Ditto. Signed-off-by: Werner Koch <[email protected]>
* card: Allow card selection with LIST.Werner Koch2019-04-031-4/+9
| | | | | | | | | | | | * tools/card-call-scd.c (start_agent): Request serialno only whean started. (scd_serialno): Allow NULL for r_serialno. * tools/gpg-card.c (cmd_factoryreset): Use changed scd_serialno. (cmd_list): New. (dispatch_command): Use cmd_list for cmdLIST. (interactive_loop): Ditto. Signed-off-by: Werner Koch <[email protected]>
* card: Print card version. Check for bad Yubikeys.Werner Koch2019-03-051-1/+15
| | | | | | | | | | | | | | | * scd/app.c (app_new_register): Set card version for Yubikeys. (app_write_learn_status): Print CARDVERSION and APPVERSION. * tools/card-call-scd.c (learn_status_cb): Detect them. * tools/gpg-card.h (struct card_info_s): Add appversion and cardversion. * tools/gpg-card.c (list_openpgp): Remove version printing from serial number. (print_a_version): New. (list_card): Print card and app version. (cmd_generate): Do not allow broken Yubikeys. Signed-off-by: Werner Koch <[email protected]>
* scd:piv: Implement import of private keys for Yubikeys.Werner Koch2019-03-051-32/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | * scd/app-piv.c (concat_tlv_list): Add arg 'secure' and adjust callers. (writekey_rsa, writekey_ecc): New. (do_writekey): New. (do_writecert): Provide a better error message for an empty cert. (app_select_piv): Register do_writekey. * scd/iso7816.c (iso7816_send_apdu): New. * scd/app-common.h (APP_WRITEKEY_FLAG_FORCE): New. * agent/command.c (cmd_keytocard): Make the timestamp optional. * tools/card-call-scd.c (inq_writekey_parms): Remove. (scd_writekey): Rewrite. * tools/gpg-card.c (cmd_writekey): New. (enum cmdids): Add cmdWRITEKEY. (dispatch_command, interactive_loop): Call cmd_writekey. -- This has been tested with gpgsm and RSA keys. For ECC keys only partly tested using the sample OpenPGP nistp256 and nistp384 keys because gpgsm does not yet support ECC certificates and thus we can't write the certificates to the cert object after a writekey. Note that they nevertheless show up in "gpgcard list" because gpg-card searches for them in gpg and gpgsm. However, this does not work completely. Signed-off-by: Werner Koch <[email protected]>
* card: Rename gpg-card-tool to gpg-card.Werner Koch2019-02-251-1/+1
| | | | | | | | | | | * 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]>
* card: Print usage info for each key.Werner Koch2019-02-211-9/+40
| | | | | | | | | * 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]>
* card: New command "yubikey".Werner Koch2019-02-131-2/+16
| | | | | | | | | | | | | | | | | | | | * 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]>
* card: Make "generate" work for PIV cards.Werner Koch2019-02-081-6/+9
| | | | | | | | | | | | | | | | | * 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]>
* card: Print the used algorithm of all keys.Werner Koch2019-02-071-0/+39
| | | | | | | | | | | | * 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]>
* scd: Allow standard keyref scheme for app-openpgp.Werner Koch2019-02-051-8/+3
| | | | | | | | | | | | | | * 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]>
* card: Implement non-interactive mode.Werner Koch2019-01-311-1/+2
| | | | | | | | | | | | | | | | | | | | | | * 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]>
* card: Support factory reset for Yubikey PIV application.Werner Koch2019-01-291-13/+28
| | | | | | | | | | | | | | | | | * 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]>
* card: Print keyinfo for PIV cards.Werner Koch2019-01-291-4/+20
| | | | | | | | | | * 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]>
* card: Make printing of key information more flexible.Werner Koch2019-01-291-33/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | * 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]>
* card: Implement the bulk of OpenPGP stuff into gpg-card-tool.Werner Koch2019-01-271-0/+1355
* 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]>