aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine-gpg.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* core: Add gpgme_op_query_swdb and helper.Werner Koch2016-11-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_query_swdb_result_t): New. (gpgme_op_query_swdb): New. (gpgme_op_query_swdb_result): New. * src/libgpgme.vers, src/gpgme.def: Add the two new functions. * src/queryswdb.c: New. * src/Makefile.am (main_sources): Add new file. * src/context.h (OPDATA_QUERY_SWDB): New. * src/engine-backend.h (struct engine_ops): Add field 'query_swdb'. Adjust all initializer. * src/engine.c (_gpgme_engine_op_query_swdb): New. * src/engine-gpgconf.c (parse_swdb_line): New. (gpgconf_query_swdb): New. (_gpgme_engine_ops_gpgconf): Register that function. * src/util.h (GPG_ERR_TOO_OLD): Define for older libgpg-error. (GPG_ERR_ENGINE_TOO_OLD): Ditto. * tests/run-swdb.c: New. * tests/Makefile.am (noinst_PROGRAMS): Add new debug tool. Signed-off-by: Werner Koch <[email protected]>
* core: New API functions gpgme_set_sender, gpgme_get_sender.Werner Koch2016-10-251-3/+28
| | | | | | | | | | | | | | | | | | | | | | | * src/context.h (struct gpgme_context): Add field 'sender'. * src/gpgme.c: Include mbox-util.h. (gpgme_release): Free SENDER. (gpgme_set_sender): New. (gpgme_get_sender): New. * src/gpgme.def, src/libgpgme.vers: Add new functions. * src/engine-gpg.c (append_args_from_sender): New. (gpg_encrypt_sign, gpg_sign): Call append_args_from_sender. (gpg_verify): Add arg CTX. Call append_args_from_sender/ * src/engine-gpgsm.c (gpgsm_verify): Add dummy arg CTX. * src/engine-uiserver.c (uiserver_verify): Ditto. * src/engine.c (_gpgme_engine_op_verify): Add arg CTX. * src/verify.c (verify_start): Pass CTX to engine function. * tests/gpg/t-verify.c (main): Add some checks for new functions. * tests/run-sign.c (main): Add option --sender. * tests/run-verify.c (main): Ditto. Signed-off-by: Werner Koch <[email protected]>
* Fix spellingDaniel Kahn Gillmor2016-09-231-1/+1
| | | | | | | | | * lang/cpp/src/context.h, lang/qt/src/protocol.h, lang/qt/src/wkspublishjob.h, src/data-identify.c, src/engine-gpg.c: minor spelling cleanup. -- Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* gpg: Add option --exit-on-status-write-errorDaiki Ueno2016-09-221-0/+2
| | | | | | | | | | | | | | * src/engine-gpg.c (gpg_new): Add --exit-on-status-write-error if the engine version is latest enough to expect progress output from gpg. -- GnuPG-bug-id: 1415 Signed-off-by: Daiki Ueno <[email protected]> Changed the version test from the patch to use the newer have_gpg_version. Signed-off-by: Werner Koch <[email protected]>
* core: Check for GPG_TTY as well as DISPLAY.Ben Kibbey2016-09-191-3/+13
| | | | | | | | | | | | | | * src/engine-assuan.c (llass_new): Update --ttyname from GPG_TTY. * src/engine-g13.c (g13_new): Ditto. * src/engine-gpg.c (gpg_new): Ditto. * src/engine-uiserver.c (uiserver_new): Ditto. * src/engine-gpgsm.c (gpgsm_new): Ditto. -- Useful when no DISPLAY is set and there is no attached terminal to the current process. Signed-off-by: Ben Kibbey <[email protected]>
* core: Map GPGME_STATUS_EOF to the empty string.Werner Koch2016-09-161-2/+1
| | | | | | | | * src/status-table.c (_gpgme_status_to_string): Return "" for EOF. * src/engine-gpg.c (read_status): Ditto. The old code accidently used GPGME_STATUS_EOF which is the integer 0 and neiteyr NULL nor a string. Signed-off-by: Werner Koch <[email protected]>
* core: Remove stub to try implementing gpg < 2.1 support for createkey.Werner Koch2016-09-161-27/+2
| | | | | | | * src/engine-gpg.c (gpg_createkey_legacy): Remove. (gpg_genkey): Remove call. Signed-off-by: Werner Koch <[email protected]>
* core: Minor change of the gpgme_op_edit semantics.Werner Koch2016-09-151-0/+4
| | | | | | | | | | | | | | | | | | * src/edit.c (command_handler): Handle special error code. * src/engine-gpg.c (read_status): Ditto. * src/engine-gpgsm.c (status_handler): Ditto. * src/engine-uiserver.c (status_handler): Ditto. * src/util.h (GPG_ERR_FALSE): Define for older libgpg-error versions. -- An edit callback may now simply return GPG_ERR_FALSE to indicate that it did not handled the status code. GPGME will the do the appropriate action, which is to send an empty line. Note that it is highly unlikely that GPG_ERR_FALSE has ever been used by an application as return value from an edit interactor. Signed-off-by: Werner Koch <[email protected]>
* core: New function gpgme_op_tofu_policyWerner Koch2016-09-141-0/+41
| | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_op_tofu_policy_start): New function. (gpgme_op_tofu_policy): New function. * src/libgpgme.vers, src/gpgme.def: Add new functions. * src/tofupolicy.c: New. * src/Makefile.am (main_sources): Add that file. * src/context.h (ctx_op_data_id_t): Add OPDATA_TOFU_POLICY. * src/engine.c (_gpgme_engine_op_tofu_policy): New. * src/engine-backend.h (engine_ops): Add funcptr 'tofu_policy'. Adjust all engine initializations. * src/engine-gpg.c (gpg_tofu_policy): New. (_gpgme_engine_ops_gpg): Register this function. * tests/run-tofu.c: New. * tests/Makefile.am (noinst_PROGRAMS): Add it. Signed-off-by: Werner Koch <[email protected]>
* core: Defer implementation of gpgme_op_createkey with gpg < 2.1Werner Koch2016-09-141-0/+6
| | | | | | * src/engine-gpg.c (gpg_createkey_legacy): Mark unused variables. Signed-off-by: Werner Koch <[email protected]>
* core: New function gpgme_op_keysign.Werner Koch2016-09-141-9/+93
| | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_op_keysign_start, gpgme_op_keysign): New. (GPGME_KEYSIGN_LOCAL): New. (GPGME_KEYSIGN_LFSEP): New. (GPGME_KEYSIGN_NOEXPIRE): New. * src/context.h (ctx_op_data_id_t): Add OPDATA_KEYSIGN. * src/keysign.c: New. * src/Makefile.am (main_sources): Add keysig. * src/libgpgme.vers, src/gpgme.def: Add gpgme_op_keysign_start. * src/engine.c (_gpgme_engine_op_keysign): New. * src/engine-backend.h (engine_ops): Add 'keysign' and adjust all engine initializers. * src/engine-gpg.c (_add_arg): Add args PREFIX and ARGLEN and change callers to set them. (add_arg_pfx): New. (add_arg_len): New. (gpg_keysign): New. (_gpgme_engine_ops_gpg): Set keysign to gpg_keysign. * tests/run-keysign.c: New. * tests/Makefile.am (noinst_PROGRAMS): Add run-keysign. Signed-off-by: Werner Koch <[email protected]>
* core: New function gpgme_op_revuid.Werner Koch2016-09-141-3/+8
| | | | | | | | | | | | | * src/engine.h (GENKEY_EXTRAFLAG_REVOKE): New. * src/genkey.c (adduid_start): Rename to addrevuid_start. Add arg REVOKE and pass it as extraflags. Remove useless ARMOR extraflag. Adjust callers. (gpgme_op_revuid_start, gpgme_op_revuid): New. * src/gpgme.def, src/libgpgme.vers: Add them. * tests/run-genkey.c: Add option --revuid. Signed-off-by: Werner Koch <[email protected]>
* core: Change a parameter for the engine's genkey function.Werner Koch2016-09-141-12/+12
| | | | | | | | | | | | | | | * src/engine.h (GENKEY_EXTRAFLAG_ARMOR): New. * src/engine-backend.h (engine_ops): Rename USE_ARMOR in genkey to EXTRAFLAGS. * src/engine.c (_gpgme_engine_op_genkey): Ditto. * src/engine-gpg.c (gpg_createkey_from_param): Ditto and test the flags. (gpg_createkey_legacy): Ditto. (gpg_createkey): Ditto. (gpg_addkey): Ditto. (gpg_genkey): Ditto. Signed-off-by: Werner Koch <[email protected]>
* core: New function gpgme_op_adduid.Werner Koch2016-09-141-5/+19
| | | | | | | | | | | | | * src/genkey.c: Replace most error codes GPG_ERR_INV_VALUE by GPG_ERR_INV_ARG. (struct op_data_t): Add field UIDMODE. (genkey_status_handler): Use UIDMODE. (adduid_start): New. (gpgme_op_adduid_start, gpgme_op_adduid): New. * src/gpgme.def, src/libgpgme.vers: Add them. * tests/run-genkey.c: Add option --adduid. Signed-off-by: Werner Koch <[email protected]>
* core: New function gpgme_op_createsubkey.Werner Koch2016-09-141-27/+68
| | | | | | | | | | | | * src/genkey.c (createsubkey_start): New. (gpgme_op_createsubkey_start, gpgme_op_createsubkey): New. * src/gpgme.def, src/libgpgme.vers: Add them. * src/engine-gpg.c (gpg_createkey): Factor some code out to ... (gpg_add_algo_usage_expire): new. (gpg_addkey): Implement. * tests/run-genkey.c: Add option --addkey. Signed-off-by: Werner Koch <[email protected]>
* core: Use const char * where appropriate.Werner Koch2016-09-131-0/+2
| | | | Signed-off-by: Werner Koch <[email protected]>
* core: Mark unused function args.Werner Koch2016-09-131-0/+6
| | | | Signed-off-by: Werner Koch <[email protected]>
* core: Do not pass const char* to functions taking a char*.Werner Koch2016-09-131-1/+5
| | | | Signed-off-by: Werner Koch <[email protected]>
* core: New function gpgme_op_create_key.Werner Koch2016-09-131-13/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/engine-backend.h (engine_ops): Change prototype of genkey. * src/engine-gpgsm.c (gpgsm_genkey): Change accordingly. * src/engine-gpg.c (gpg_genkey): Change it to a dispatcher. (gpg_createkey_from_param): New for the old functionality. (gpg_createkey_legacy): New. Stub for now. (gpg_createkey): New. (gpg_addkey): New. Stub for now. (gpg_adduid): New. Stub for now. * src/engine.c (_gpgme_engine_op_genkey): Add new args. * src/genkey.c (op_data_t): Add field ERROR_CODE. (parse_error): New. (genkey_status_handler): Parse ERROR status line. (genkey_start): Use NULL/0 for the new args. (createkey_start): New. (gpgme_op_createkey_start, gpgme_op_createkey): New. * src/gpgme.def, src/libgpgme.vers: Add gpgme_op_createkey_start and gpgme_op_createkey. * src/gpgme.h.in (_gpgme_op_genkey_result): Add fields PUBKEY and SECKEY. (GPGME_CREATE_SIGN): New. (GPGME_CREATE_ENCR): New. (GPGME_CREATE_CERT): New. (GPGME_CREATE_AUTH): New. (GPGME_CREATE_NOPASSWD): New. (GPGME_CREATE_SELFSIGNED): New. (GPGME_CREATE_NOSTORE): New. (GPGME_CREATE_WANTPUB): New. (GPGME_CREATE_WANTSEC): New. (GPGME_CREATE_FORCE): New. * tests/run-genkey.c: New. * tests/Makefile.am (noinst_PROGRAMS): Add it. -- This function uses the new --quick-gen-key API of gpg. A limited compatibility mode to use older gpg versions and gpgsm will eventually be provided. Not all flags are currently implemented. ./run-genkey --unprotected --force [email protected] Create a new standard key with the given user id. --force is used to allow creating more than one key with that user id in the keyring. ./run-genkey --unprotected --force \ [email protected] default default 2145826800 Creates a new standard key with an expiration date of 2037-12-31. ./run-genkey --unprotected --force \ [email protected] future-default default 2145826800 Create a standard key using the fugure default algorithms. Signed-off-by: Werner Koch <[email protected]>
* core: Check for gpg version for loopback modeAndre Heinecke2016-09-061-1/+1
| | | | | | | | | | * src/engine-gpg.c (build_argv): Check for version 2.1.0 before adding pinentry-mode. -- This is a compatibility fix for older versions that don't support this flag which would otherwise result in an invalid argument error.
* core: Add GPGME_KEYLIST_MODE_WITH_TOFU.Werner Koch2016-08-251-0/+7
| | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_KEYLIST_MODE_WITH_TOFU): New. * src/engine-gpg.c (gpg_keylist_build_options): Use that. * src/keylist.c: Include limits.h. (parse_tfs_record): New. (keylist_colon_handler): Support TFS record. * tests/run-keylist.c: Include time.h. (isotimestr): New. (main): Add option --tofu. Print TOFU info. * tests/run-verify.c: Include time.h. (isotimestr): New. (print_result): Use isotimestr for TOFU dates. Signed-off-by: Werner Koch <[email protected]>
* core: Make use of the "size-hint" in engine-gpg.Werner Koch2016-08-121-2/+43
| | | | | | | | | | | | | | * src/engine-gpg.c: Include data.h. (add_input_size_hint): New. (gpg_decrypt, gpg_encrypt, gpg_encrypt_sign, gpg_sign) (gpg_verify): Call new function, * tests/run-encrypt.c (status_cb): Print to stderr. (progress_cb): New.o (main): Add option --progress. Print full-status lines. Provide a size for the input data. Signed-off-by: Werner Koch <[email protected]>
* core: Handle ENCRYPT_SYMMETRIC also for sig & encAndre Heinecke2016-08-101-4/+7
| | | | | * src/engine-gpg.c (gpg_encrypt_sign): Handle ENCRYPT_SYMMETRIC flag.
* core: Ensure err is initalized in gpg_encryptAndre Heinecke2016-08-101-1/+1
| | | | * src/engine-gpg.c (gpg_encrypt): Initialize err.
* core: Add support for mixed symmetric and asym encAndre Heinecke2016-08-091-3/+6
| | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_encrypt_flags_t): New flag GPGME_ENCRYPT_SYMMETRIC. * src/engine-gpg.c (gpg_encrypt): Also add --symmetric if the flag is given. * NEWS: Mention new flag. * tests/run-encrypt.c (show_usage): Extend for --symmetric. (main): Handle --symmetric. (main): Set passphrase_cb in loopback mode. (main): Fix encrypt call if no recipients are given. * tests/gpg/t-encrypt-mixed.c: New. * tests/gpg/Makefile.am (c_tests): Add new test. * doc/gpgme.texi: Document new flag.
* core: Extend gpgme_subkey_t to carry the keygrip.Werner Koch2016-08-041-6/+13
| | | | | | | | | | | | * src/gpgme.h.in (struct _gpgme_subkey): Add file 'keygrip'. * src/key.c (gpgme_key_unref): Free KEYGRIP. * src/keylist.c (keylist_colon_handler): Parse GRP records. * src/engine-gpg.c (gpg_keylist_build_options): Do not use --with-fingerprint options for gpg versions >= 2.1.15. * tests/run-keylist.c (main): Print subkeys and keygrips. Signed-off-by: Werner Koch <[email protected]>
* core: New GPGME_DATA_ENCODING_MIME.Werner Koch2016-07-131-2/+25
| | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_DATA_ENCODING_MIME): New. * src/data.c (gpgme_data_set_encoding): Adjust check. * src/engine-gpg.c (have_gpg_version): New. (gpg_encrypt, gpg_encrypt_sign): Pass flag '--mimemode'. (gpg_sign): Ditto. * lang/cpp/src/data.h (GpgME): Add MimeEncoding. * lang/cpp/src/data.cpp (encoding, setEncoding): Support MimeEncoding. * src/gpgme-tool.c (server_data_encoding): Add flag --mime. -- This feature allows an application to declare that the encrypted or signed data is a valid MIME part. What is missing is a way to return that information to the application after decryption/verification. This can be done by setting the encoding of the output data object; however this requires some internal additions to our processing model. Signed-off-by: Werner Koch <[email protected]>
* core: Pass the engine's version string to the engine's new function.Werner Koch2016-07-131-1/+15
| | | | | | | | | | | | | | | | | * src/engine-backend.h (engine_ops): Add arg 'version' to NEW. * src/engine-assuan.c (llass_new): Add dummy arg 'version'. * src/engine-g13.c (g13_new): Ditto. * src/engine-gpgconf.c (gpgconf_new): Ditto. * src/engine-gpgsm.c (gpgsm_new): Ditto. * src/engine-spawn.c (engspawn_new): Ditto. * src/engine-uiserver.c (uiserver_new): Ditto. * src/engine.c (_gpgme_engine_new): Pass version string to the new function. * src/engine-gpg.c (struct engine_gpg): Add field 'version'. (gpg_new): Add arg 'version'. (gpg_release): Free VERSION. Signed-off-by: Werner Koch <[email protected]>
* api: Add new function gpgme_set_ctx_flag.Werner Koch2016-05-191-8/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_set_ctx_flag): New prototype. * src/gpgme.c (gpgme_set_ctx_flag): New. * src/gpgme.def, src/libgpgme.vers: Add new function. * src/context.h (struct gpgme_context): Add FULL_STATUS. * src/decrypt.c (_gpgme_decrypt_status_handler): Do not call the status callback if FULL_STATUS is set. * src/genkey.c (genkey_status_handler): Ditto. * src/passphrase.c (_gpgme_passphrase_status_handler): Ditto. * src/sign.c (_gpgme_sign_status_handler): Ditto. * src/engine-backend.h (struct engine_ops): Add SET_STATUS_CB and add adjust all definitions of that variable. * src/engine.c (_gpgme_engine_set_status_cb): New. * src/op-support.c (_gpgme_op_reset): Call this function. * src/engine-gpg.c (struct engine_gpg): Add fields MON_CB and MON_CB_VALUE. (gpg_set_status_cb): New. (_gpgme_engine_ops_gpg): Register that function. (read_status): Call the monitor callback. * src/engine-gpgsm.c (struct engine_gpgsm): Add fields MON_CB and MON_CB_VALUE. (_gpgme_engine_ops_gpgsm): Register that function. (gpgsm_assuan_simple_command): Change first arg to be an engine context and adjust call callers. Call the monitor callback. * src/engine-uiserver.c (struct engine_uiserver): Add fields MON_CB and MON_CB_VALUE. (_gpgme_engine_ops_uiserver): Register that function. (uiserver_assuan_simple_command): Change first arg to be an engine context and adjust call callers. Call the monitor callback. * tests/run-verify.c (status_cb): New. (print_result): Print algo names. (main): Add option --status. -- This new feature is mainly intended for bug tracking. Having access to the raw status lines might also be useful for applications, though. Signed-off-by: Werner Koch <[email protected]>
* Relax ttyname_r error checksDaiki Ueno2015-08-251-5/+8
| | | | | | | | | | | | | | | | | * src/engine-assuan.c (llass_new): Don't treat ttyname_r error as fatal. * src/engine-g13.c (g13_new): Likewise. * src/engine-gpg.c (gpg_new): Likewise. * src/engine-gpgsm.c (gpgsm_new): Likewise. * src/engine-uiserver.c (uiserver_new): Likewise. -- Even though isatty() returns 1, ttyname_r() may fail in many ways, e.g., when /dev/pts is not accessible under chroot. Since all our uses of ttyname_r() require that the function works, we can treat the failure as if isatty() fails. Signed-off-by: Daiki Ueno <[email protected]>
* Add an export secret key feature.Werner Koch2015-08-241-2/+6
| | | | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_EXPORT_MODE_SECRET): New. (GPGME_EXPORT_MODE_RAW): New. (GPGME_EXPORT_MODE_PKCS12): New. * src/export.c (export_start, export_ext_start): Allow new flags. * src/engine-gpg.c (export_common): Support secret key export. * src/engine-gpgsm.c (gpgsm_export, gpgsm_export_ext): Ditto. * src/gpgme-tool.c (cmd_export): Add options --secret, --raw, and --pkcs12. * tests/run-export.c (main): Likewise. -- Note that exporting secret X.509 keys requires GnuPG 2.1.8. Signed-off-by: Werner Koch <[email protected]>
* Also check the return code in gpg_sign().Ben Kibbey2015-08-121-1/+1
| | | | * src/engine-gpg.c (gpg_sign): Check return value from start().
* Check the return value when starting gpg.Ben Kibbey2015-08-111-3/+3
| | | | | * src/engine-gpg.c (gpg_decrypt, gpg_delete, gpg_passwd): Check return value of start().
* Add offline mode support for CMS keylistingAndre Heinecke2015-07-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/gpgme.texi: Document offline mode. * src/context.h (gpgme_context): Add offline. * src/engine-backend.h (keylist, keylist_ext): Add engine_flags. * src/engine.c, src/engine.h (_gpgme_engine_op_keylist): Ditto. (_gpgme_engine_op_keylist_ext): Ditto. * src/engine.h (GPGME_ENGINE_FLAG_OFFLINE): New. * src/engine-gpg.c (gpg_keylist, gpg_keylist_ext): Ditto. * src/engine-gpgsm.c (gpgsm_keylist): Handle engine_flags. (gpgsm_keylist_ext): Ditto. * src/gpgme.c (gpgme_set_offline, gpgme_get_offline): New. * src/gpgme.def (gpgme_set_offline, gpgme_get_offline): New. * src/gpgme.h.in (gpgme_set_offline, gpgme_get_offline): New. * src/libgpgme.vers (gpgme_set_offline, gpgme_get_offline): New. * src/keylist.c (gpgme_op_keylist_start): Set offline flag. (gpgme_op_keylist_ext_start): Ditto. * tests/run-keylist.c (show_usage, main): Add offline argument. -- The offline engine option was introduced with gpgsm 2.1.6 it is mainly useful for a full keylisting that includes the certificate validation but does not depend on external information that could take an indefinite amount of time to collect. Signed-off-by: Andre Heinecke <[email protected]>
* Fix segv for userids with a backslash.Werner Koch2015-06-051-0/+1
| | | | | | | | | | | * src/engine-gpg.c (gpg_keylist_preprocess): Increment SRC for a backslash. -- This bug is not exploitable because this bug fills up .data with backslashes and thus causes the segv. Signed-off-by: Werner Koch <[email protected]>
* Fix potential crash in trace macro.Werner Koch2015-03-161-2/+1
| | | | | | | | | * src/signers.c (gpgme_signers_add): Avoid deref of a NULL KEY in the trace macro. * src/engine-spawn.c (engspawn_release): Remove always true condition. * src/engine-gpg.c (gpg_release): Ditto. Signed-off-by: Werner Koch <[email protected]>
* Use --no-sk-comments, not --no-sk-comment.Daniel Kahn Gillmor2014-10-021-2/+2
| | | | | | | -- The --no-sk-comments flag is (or should be) a no-op in modern versions of gnupg, but gpgme should still use its full form rather than the (slightly) abbreviated --no-sk-comment
* Handle modern keyserver output which may emit the fingerprint.Werner Koch2014-08-121-9/+44
| | | | | * src/engine-gpg.c (read_colon_line): Split preprocessed lines. (gpg_keylist_preprocess): Limit keyid field and print fingerprint.
* Add new keylist mode GPGME_KEYLIST_MODE_WITH_SECRET.Werner Koch2014-06-041-0/+2
| | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_KEYLIST_MODE_WITH_SECRET): New. * src/engine-gpg.c (gpg_keylist_build_options): Handle new mode. * src/engine-gpgsm.c (gpgsm_keylist, gpgsm_keylist_ext): Ditto. * src/keylist.c (parse_sec_field15): Add arg key and take care of --with-secret output. * src/gpgme-tool.c (gt_get_keylist_mode, cmd_keylist_mode): Add "with_secret". Print card info and and secret flag for subkeys. -- Note: This mode may only be used with GnuPG >= 2.1.
* Add GPGME_ENCRYPT_NO_COMPRESS flag.Werner Koch2014-05-081-0/+6
| | | | | | * src/gpgme.h.in (GPGME_ENCRYPT_NO_COMPRESS): New. * src/engine-gpg.c (gpg_encrypt, gpg_encrypt_sign): Implement it. * src/gpgme-tool.c (_cmd_sign_encrypt): Add option --no-compress.
* w32: Fix another memleak on error.Werner Koch2014-04-161-0/+4
| | | | | | | * src/w32-io.c (create_reader): free CTX. -- Found by Hans-Christoph Steiner with cppcheck.
* Add GPGME_PROTOCOL_SPAWN and gpgme_op_spawn.Werner Koch2014-04-101-1/+2
| | | | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_PROTOCOL_SPAWN): New. (GPGME_SPAWN_DETACHED, GPGME_SPAWN_ALLOW_SET_FG): New. * src/gpgme.c (gpgme_set_protocol): Add new protocol. (gpgme_get_protocol_name): Ditto. * src/spawn.c: New. * src/libgpgme.vers, src/gpgme.def: Add new public functions. * src/engine-spawn.c: New. * src/Makefile.am: Add new files. * src/engine-backend.h (struct engine_ops): Add OPSPAWN. * src/engine.c (engine_ops): Add _gpgme_engine_ops_spawn. (gpgme_get_engine_info): Add Spawn to the list of protocols. (_gpgme_engine_op_spawn): New. * src/gpgme-tool.c (gt_protocol_from_name): Add new protocol. (gt_spawn, cmd_spawn): New.
* Make use of internal iospawn flags more flexible.Werner Koch2014-04-101-1/+1
| | | | | | | | | | | | | * src/priv-io.h (IOSPAWN_FLAG_DETACHED): New. Renumber the others. * src/w32-io.c (_gpgme_io_spawn): Use DETACHED_PROCESS process only if IOSPAWN_FLAG_DETACHED is given. * src/w32-qt-io.cpp (_gpgme_io_spawn): Ditto. * src/w32-glib-io.c (_gpgme_io_spawn): Ditto. * src/assuan-support.c (my_spawn): Pass IOSPAWN_FLAG_DETACHED flags. * src/dirinfo.c (read_gpgconf_dirs): Ditto. * src/engine-gpg.c (start): Ditto. * src/engine-gpgconf.c (gpgconf_read, gpgconf_write): Ditto. * src/version.c (_gpgme_get_program_version): Ditto.
* Always pass correct name to argv[0]. Ignore GPG_AGENT_INFO for gpg2.Werner Koch2014-02-211-14/+20
| | | | | | | | | | | | | | | * src/dirinfo.c (WANT_GPG_ONE_MODE): New. (struct dirinfo): Add field "gpg_one_mode". (get_gpgconf_item): Set that field and return it if requested. (_gpgme_in_gpg_one_mode): New. * src/engine-gpg.c (build_argv): Check GPG_AGENT_INFO only in gpg-1 mode. * src/dirinfo.c (_gpgme_get_basename): New. * src/engine-g13.c (g13_new): Take argv[0] from the pgmname. * src/engine-gpgsm.c (gpgsm_new): Ditto. * src/engine-gpg.c (build_argv): Ditto. Add arg PGMNAME. (start): Pass PGMNAME to buildargv.
* Locate engine names only at runtime and prefer GnuPG-2.Werner Koch2013-12-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac (NEED_GPG_VERSION, NEED_GPGSM_VERSION) (NEED_G13_VERSION, NEED_GPGCONF_VERSION): Remove vars and all related checks. Do not check for any engine version. (HAVE_ASSUAN): Remove AM conditional. * src/Makefile.am: Remove separate component vars and always build all engines but uiserver. * src/dirinfo.c (WANT_GPGCONF_NAME): New. (struct dirinfo): Add field gpgconf_name. (_gpgme_get_default_gpgconf_name): Use WANT_GPGCONF_NAME. (get_gpgconf_item): Set gpgconf name and adjust for _gpgme_get_*_path now returning a malloced string. * src/engine.c (engine_ops): Always init all engines except for uiserver. * src/posix-util.c (_gpgme_get_gpgsm_path, _gpgme_get_g13_path): Remove unused functions. (walk_path): New. (_gpgme_get_gpg_path, _gpgme_get_gpgconf_path ): Re-implement using walk_path. * src/w32-util.c (_gpgme_get_gpgsm_path, _gpgme_get_g13_path): Remove unused functions. (_gpgme_get_gpg_path, _gpgme_get_gpgconf_path): Return a malloced string. * src/engine-g13.c (g13_get_req_version): Use a hardwired string with the required version. This info belongs into this file. * src/engine-gpg.c (gpg_get_req_version): Ditto. * src/engine-gpgconf.c (gpgconf_get_req_version): Ditto. * src/engine-gpgsm.c (gpgsm_get_req_version): Ditto. * tests/t-engine-info.c: Replace now useless test by an info output. * tests/gpg/Makefile.am (GPG, GPG_AGENT): Hardwire gpg and gpg-agent. * tests/gpgsm/Makefile.am (GPGSM): Hardwire gpgsm. Signed-off-by: Werner Koch <[email protected]>
* Prefer GnuPG-2 engines over GnuPG-1.Werner Koch2013-08-021-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/util.h: Move some prototypes to ... * src/sys-util.h: New. * src/Makefile.am (main_sources): Add sys-util.h. * configure.ac (AH_VERBATIM): Add DIRSEP_C and DIRSEP_S. * src/dirinfo.c: Include sys-util.h. (WANT_GPG_NAME, WANT_GPGSM_NAME, WANT_G13_NAME) (WANT_UISRV_SOCKET): New. (dirinfo): Add corresponding fields. (parse_output): Add arg COMPONENTS and set new fields. (read_gpgconf_dirs): Add arg components and act upon it. (get_gpgconf_item): Call read_gpgconf_dirs two times. Add debug output. (_gpgme_get_default_gpg_name): New. (_gpgme_get_default_gpgsm_name): New. (_gpgme_get_default_g13_name): New. (_gpgme_get_default_gpgconf_name): New. (_gpgme_get_default_uisrv_socket): New. * src/engine-gpg.c, src/engine-g13.c, src/engine-gpgconf.c * src/engine-gpgsm.c, src/engine-uiserver.c: Change to use _gpgme_get_default_ instead of those from sys-util.h. * src/posix-util.c (_gpgme_get_gpg_path): Include sys-util.h. (_gpgme_get_uiserver_socket_path): Remove. * src/w32-util.c (_gpgme_get_gpg_path): Include sys-util.h. (_gpgme_get_uiserver_socket_path): Remove. -- The default engines names are now taken from the output of gpgconf. If gpgconf is not installed gpg 1 is assumed and locate the same was as gpgconf.
* Support --no-encrypt-to also with gpgme_op_encrypt_sign.Werner Koch2013-05-221-0/+3
| | | | | * src/engine-gpg.c (gpg_encrypt_sign): Support the GPGME_ENCRYPT_NO_ENCRYPT_TO flag.
* Allow symmetric encryption with gpgme_op_encrypt_sign.Werner Koch2013-05-221-7/+13
| | | | | | | | | | | * src/encrypt-sign.c (encrypt_sym_status_handler): New. (encrypt_sign_start): Handle recp == NULL case. * src/engine-gpg.c (gpg_encrypt_sign): Implement symmetric encryption. * tests/gpg/t-encrypt-sign.c (main): Add a test case for this. -- Co-authored-by: Kyle L. Huff <[email protected]> GnuPG-bug-id: 1440
* Add public function gpgme_set_pinentry_mode.Werner Koch2013-02-071-1/+42
| | | | | | | | | | | | | | | | | * src/gpgme.c (gpgme_set_pinentry_mode): New. * src/gpgme.h.in (gpgme_pinentry_t): New. (gpgme_set_pinentry_mode): New. * src/context.h (struct gpgme_context): Add field pinentry_mode. * src/engine-backend.h (struct engine_ops): Add field set_pinentry_mode. * src/engine-gpg.c (struct engine_gpg): Add field pinentry_mode. (build_argv): Implement pinentry_mode. (gpg_set_pinentry_mode): New. (_gpgme_engine_ops_gpg): Register gpg_set_pinentry_mode. -- Note that this new fucntion may only be used with gpg 2.1.
* Use gpg_error_from_syserror instead of directly accessing errno.Werner Koch2013-02-061-43/+43
| | | | | | | | -- Also fixed a couple of minor thing; e.g. save the error before calling cleanup functions. Do not save the errno if only free is called in between.