aboutsummaryrefslogtreecommitdiffstats
path: root/agent/command.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2013-08-28gpg: Make decryption with the OpenPGP card work.Werner Koch1-2/+10
* scd/app-common.h (APP_DECIPHER_INFO_NOPAD): New. * scd/app-openpgp.c (do_decipher): Add arg R_INFO. * scd/app-nks.c (do_decipher): Add arg R_INFO as a dummy. * scd/app.c (app_decipher): Add arg R_INFO. * scd/command.c (cmd_pkdecrypt): Print status line "PADDING". * agent/call-scd.c (padding_info_cb): New. (agent_card_pkdecrypt): Add arg R_PADDING. * agent/divert-scd.c (divert_pkdecrypt): Ditto. * agent/pkdecrypt.c (agent_pkdecrypt): Ditto. * agent/command.c (cmd_pkdecrypt): Print status line "PADDING". * g10/call-agent.c (padding_info_cb): New. (agent_pkdecrypt): Add arg R_PADDING. * g10/pubkey-enc.c (get_it): Use padding info. -- Decryption using a card never worked in gpg 2.1 because the information whether the pkcs#1 padding needs to be removed was not available. Gpg < 2.1 too this info from the secret sub key but that has gone in 2.1. Signed-off-by: Werner Koch <[email protected]>
2013-08-28agent: Fix two compiler warnings.Werner Koch1-2/+2
* agent/command.c (cmd_preset_passphrase, pinentry_loopback): Use %zu in format string. * scd/ccid-driver.c (ccid_get_atr): Ditto. * agent/command-ssh.c (stream_read_string): Init arg STRING_SIZE to avoid maybe_unitialized warning. -- Actually the first one might have been a problem on big endian machines. Signed-off-by: Werner Koch <[email protected]>
2013-08-08agent: Extend cmd KEYINFO to return data from sshcontrol.Werner Koch1-25/+122
* agent/command-ssh.c (struct control_file_s): Rename to ssh_control_file_s. (ssh_open_control_file, ssh_close_control_file) (ssh_read_control_file, ssh_search_control_file): New. (control_file_t): Rename and move to ... * agent/agent.h (ssh_control_file_t): here. * agent/command.c (do_one_keyinfo): Add args is_ssh, ttl, disabled, and confirm. Rename unknown keytype indicator from '-' to 'X'. Extend output. (cmd_keyinfo): Add options --ssh-list and --with-ssh. -- This extension allows the development of frontends to manage the sshcontrol file. Signed-off-by: Werner Koch <[email protected]>
2013-05-22Implement unattended OpenPGP secret key import.Werner Koch1-4/+18
* agent/command.c (cmd_import_key): Add option --unattended. * agent/cvt-openpgp.c (convert_transfer_key): New. (do_unprotect): Factor some code out to ... (prepare_unprotect): new function. (convert_from_openpgp): Factor all code out to ... (convert_from_openpgp_main): this. Add arg 'passphrase'. Implement openpgp-native protection modes. (convert_from_openpgp_native): New. * agent/t-protect.c (convert_from_openpgp_native): New dummy fucntion * agent/protect-tool.c (convert_from_openpgp_native): Ditto. * agent/protect.c (agent_unprotect): Add arg CTRL. Adjust all callers. Support openpgp-native protection. * g10/call-agent.c (agent_import_key): Add arg 'unattended'. * g10/import.c (transfer_secret_keys): Use unattended in batch mode. -- With the gpg-agent taking care of the secret keys, the user needs to migrate existing keys from secring.gpg to the agent. This and also the standard import of secret keys required the user to unprotect the secret keys first, so that gpg-agent was able to re-protected them using its own scheme. With many secret keys this is quite some usability hurdle. In particular if a passphrase is not instantly available. To make this migration smoother, this patch implements an unattended key import/migration which delays the conversion to the gpg-agent format until the key is actually used. For example: gpg2 --batch --import mysecretkey.gpg works without any user interaction due to the use of --batch. Now if a key is used (e.g. "gpg2 -su USERID_FROM_MYSECRETKEY foo"), gpg-agent has to ask for the passphrase anyway, converts the key from the openpgp format to the internal format, signs, re-encrypts the key and tries to store it in the gpg-agent format to the disk. The next time, the internal format of the key is used. This patch has only been tested with the old demo keys, more tests with other protection formats and no protection are needed. Signed-off-by: Werner Koch <[email protected]>
2013-05-22agent: Fix length detection of canonical formatted openpgp keys.Werner Koch1-1/+1
* agent/command.c (cmd_import_key): Pass 0 instead of KEYLEN to gcry_sexp_canon_len. -- We used to pass KEYLEN to the gcry_sexp_canon_len for no good reason: convert_from_openpgp is guaranteed to return a valid canonical S-expression and KEYLEN would thus act only as an upper limit. This is not a problem because usually the original input key is longer than the returned unprotected key. A future patch may change this assertion and thus we better fix this bug now. Signed-off-by: Werner Koch <[email protected]>
2013-02-22agent: fix two bugs.NIIBE Yutaka1-0/+1
* agent/command.c (cmd_keytocard): Decrement KEYDATALEN. * agent/findkey.c (agent_public_key_from_file): Increment for ELEMS. -- For ECDSA and ECDH, there are 6 elements.
2013-02-12agent: Add KEYTOCARD command.NIIBE Yutaka1-0/+125
* agent/agent.h (divert_writekey, agent_card_writekey): New. * agent/call-scd.c (inq_writekey_parms, agent_card_writekey): New. * agent/command.c (cmd_keytocard, hlp_keytocard): New. (register_commands): Add cmd_keytocard. * agent/divert-scd.c (divert_writekey): New.
2013-02-06agent: Move a typedef to common and provide parse_pinentry_mode.Werner Koch1-14/+6
* common/agent-opt.c: New. * common/shareddefs.h: New. * common/Makefile.am: Add new files. * agent/agent.h: Include shareddefs.h. (pinentry_mode_t): Factor out to shareddefs.h. * agent/command.c (option_handler): Use parse_pinentry_mode.
2012-11-06agent: Use wipememory instead of memset in one place.Werner Koch1-1/+1
* agent/command.c (clear_outbuf): Use wipememory. Suggested by Ben Kibbey.
2012-02-07agent: Add pin length field to the shadowed private key format.Werner Koch1-1/+1
This is not yet fully implemented. It will eventually allow to support pinpad equipped readers which do not support variable length pin lengths. * agent/protect.c (parse_shadow_info): Add optional arg R_PINLEN and parse pinlen info. Change all callers to pass NULL for it.
2012-02-07Use new status printing functions.Werner Koch1-12/+4
* agent/command.c (cmd_geteventcounter): Get rid of static buffers. * scd/command.c (cmd_serialno, cmd_learn): Simplify by using print_assuan_status.
2012-02-07agent: New function agent_print_status.Werner Koch1-0/+16
* common/asshelp2.c (vprint_assuan_status): New. (print_assuan_status): Re-implement using above func. * agent/command.c (agent_print_status): New.
2012-02-06agent: Simplify printing of INQUIRE_MAXLEN.Werner Koch1-12/+5
* agent/command.c: Include asshelp.h. (cmd_pkdecrypt, cmd_genkey, cmd_preset_passphrase) (pinentry_loopback): Use print_assuan_status for INQUIRE_MAXLEN.
2012-02-03Also let GENKEY and PKDECRYPT send the INQUIRE_MAXLEN status message.Ben Kibbey1-3/+11
* agent/command.c (cmd_pkdecrypt): Send the INQUIRE_MAXLEN status message before doing the inquire. (cmd_genkey): Ditto.
2012-02-02Inform the client of the preset passphrase length.Ben Kibbey1-1/+7
* agent/command.c (cmd_preset_passphrase): Send the INQUIRE_MAXLEN status message before inquiring the passphrase.
2012-01-18Add the INQUIRE_MAXLEN status message.Ben Kibbey1-0/+6
This status message is used to inform the client of the maximum length of an inquired passphrase and is used in pinentry-mode=loopback. * agent/command.c (pinentry_loopback): Send the INQUIRE_MAXLEN status message before doing the inquire.
2011-12-20Require Libassuan 2.0.3Werner Koch1-4/+0
* configure.ac: Require Libassuan 2.0.3. * agent/call-scd.c (ASSUAN_CONVEY_COMMENTS): Remove macro replacement. * agent/command.c (cmd_killagent) [ASSUAN_FORCE_CLOSE]: Remove dependency. (cmd_killagent) [ASSUAN_FORCE_CLOSE]: Ditto. * scd/command.c (cmd_killscd) [ASSUAN_FORCE_CLOSE]: Ditto.
2011-12-05Fix last change.Werner Koch1-1/+0
* agent/command.c (start_command_handler): Remove use of removed var.
2011-12-05Amend the agent code with more comments.Werner Koch1-23/+79
* agent/command.c (server_local_s): Remove unused field MESSAGE_FD.
2011-09-12Handle pinentry-mode=loopback.Ben Kibbey1-0/+15
When this mode is set an inquire will be sent to the client to retrieve the passphrase. This adds a new inquire keyword "NEW_PASSPHRASE" that the GENKEY and PASSWD commands use when generating a new key.
2011-08-10Update option s2k-count to match the documentation.Ben Kibbey1-3/+3
The option would previously return an error if its value was < 65536.
2011-08-10Made the KILLAGENT and KILLSCD commands working again.Werner Koch1-0/+5
This requires that GnuPG is build with a newer version of Libassuan (2.0.3).
2011-07-20Allow listing of ssh fingerprint with the agent's KEYINFO command.Werner Koch1-8/+30
2011-06-29Added gpg-agent OPTION "s2k-count".Ben Kibbey1-1/+10
When unset or 0, the calibrated count will be used.
2011-04-21Add OPTION:cache-ttl-opt-preset to gpg-agent.Werner Koch1-3/+7
This option may be used to change the default ttl values use with the --preset option of GENKEY and PASSWD.
2011-04-20Fix gpg-agent secure memory leak in OpenPGP private key import.Marcus Brinkmann1-0/+2
2011-04-20 Marcus Brinkmann <[email protected]> * command.c (cmd_import_key): Release key from failed import before converting openpgp private key in the openpgp-private-key case.
2011-04-18Another PASSWD --preset fix.Ben Kibbey1-1/+1
Check for an error before presetting the passphrase.
2011-04-13Fixed PASSWD --preset.Ben Kibbey1-7/+7
The previous patch required that the keygrip be cached before adding the new passphrase to the cache. No more.
2011-04-12Use macros for the 120 and 900s cache TTLs.Werner Koch1-5/+6
2011-04-12Added PASSWD --preset.Ben Kibbey1-2/+11
2011-04-12Added GENKEY --preset to add the passphrase of the generated key to the cache.Ben Kibbey1-2/+7
2011-04-12Added KEYINFO field to show the protection type of a key. This differs from ↵Ben Kibbey1-10/+21
the second field which shows the location of the key.
2011-03-04Added option --inquire to PRESET_PASSPHRASE. Note that the inquired ↵Ben Kibbey1-4/+26
passphrase will be truncated to the first encountered null byte.
2011-03-03New agent option pinentry-mode.Werner Koch1-0/+18
This provides the framework and implements the ask, cancel and error. loopback will be implemented later.
2011-03-02Add comment to last patch.Werner Koch1-13/+20
2011-03-02Added option --data to KEYINFO to return the result with a data response.Ben Kibbey1-12/+27
2011-03-02Let KEYINFO show the cached status of a key grip.Ben Kibbey1-1/+11
2011-03-02Rename Ben's new option.Werner Koch1-7/+7
2011-03-02Added CLEAR_PASSPHRASE option --agent to search the cache for a cacheid with ↵Ben Kibbey1-3/+10
a mode of CACHE_MODE_NORMAL. These cache modes are created with PKDECRYPT.
2011-02-04Nuked almost all trailing white space.post-nuke-of-trailing-wsWerner Koch1-84/+83
We better do this once and for all instead of cluttering all future commits with diffs of trailing white spaces. In the majority of cases blank or single lines are affected and thus this change won't disturb a git blame too much. For future commits the pre-commit scripts checks that this won't happen again.
2010-10-26Re-implemented GPG's --passwd command and improved it.Werner Koch1-11/+131
2010-10-14All tests work are again workingWerner Koch1-2/+7
2010-10-13More agent support for gpg.Werner Koch1-19/+23
2010-10-01Exporting secret keys via gpg-agent is now basically supported.Werner Koch1-37/+114
A couple of forward ported changes. Doc updates.
2010-09-02Obscure the cached passphrases.Werner Koch1-5/+3
2010-09-01s/CACHE_MODE_IMPGEN/CACHE_MODE_NONCE/.Werner Koch1-7/+18
Prepare for more use cases of the cache nonce.
2010-09-01Use passphrase caching for import and genkey.Werner Koch1-8/+37
2010-08-31Import OpenPGP keys into the agent.Werner Koch1-16/+64
2010-06-21Implement export of pkcs#12 objects using a direct agent connection.Werner Koch1-9/+93
2010-06-17Avoid using the protect-tool to import pkcs#12.Werner Koch1-48/+230