aboutsummaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* New decrypt flags GPGME_DECRYPT_LISTONLY.HEADmasterWerner Koch2025-03-185-6/+16
| | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_DECRYPT_LISTONLY): New. * src/decrypt.c (op_data_t): Add member list_only. (_gpgme_decrypt_status_handler): Do not return NO_DATA in list_only mode. (_gpgme_op_decrypt_init_result): Add arg flags and set the list_only flag. (_gpgme_decrypt_start): Pss flags to the init function. * src/decrypt-verify.c (decrypt_verify_start): Ditto. * src/engine-gpg.c (gpg_decrypt): Add --list-only if flag is set. * tests/run-decrypt.c (main): Add option --list-only.
* Add API gpgme_op_random_value.Werner Koch2025-03-144-1/+91
| | | | | | | | | | | | | | | | | | * src/genrandom.c (getrandom_size_t): New. (gpgme_op_random_value): New. * src/gpgme.def: Add new function. * src/libgpgme.vers: Ditto. * src/gpgme.h.in: Add prototype. * tests/run-genrandom.c: Add an option to use the new function. -- The implementation is not optimized but sufficient for our use case. Possible improvements for this and gpgme_op_random_bytes are a cache for random bytes in the context so that we do not need to get out to gpgme for just a few random bytes. GnuPG-bug-id: 6694
* Add API gpgme_op_random_bytes.Werner Koch2025-02-2615-1/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/genrandom.c: New. * src/Makefile.am: Add new file. * src/engine-backend.h (struct engine_ops): Add func ptr getdirect. Adjust all engine_ops. * src/engine-gpg.c (gpg_getdirect): New. (_gpgme_engine_ops_gpg): Connect new handler. * src/gpgme.h.in (gpgme_random_mode_t): New. (GPGME_RANDOM_MODE_NORMAL): New. (GPGME_RANDOM_MODE_ZBASE32): New. (gpgme_op_random_bytes): New public function * src/libgpgme.vers: Add function. * src/gpgme.def: Add function. * tests/run-genrandom.c: New. * tests/Makefile.am: Add new file. -- This is a first take on this the mode parameter allows to extend the function if ever needed. Due to the gpg calling and fd setup overhead this function is not yet very fast but its purpose is to get "approved" random bytes. We might eventually extend it to keep a small internal cache of random numbers and get for example 128 random bytes directly from gpg and deliver only the few required. GnuPG-bug-id: 6694
* Remove now unused functions.Werner Koch2025-02-214-116/+1
| | | | | | | | | | | | * src/engine.c (_gpgme_engine_op_trustlist): Remove. * src/libgpgme.vers (gpgme_op_trustlist_end) (gpgme_op_trustlist_next) (gpgme_op_trustlist_start): Remove. * src/gpgme.def: Ditto. * src/key.c (otrust_to_string) (validity_to_string) (capabilities_to_string) (get_keysig): Remove
* Remove the long deprecated and never working trust list functions.Werner Koch2025-02-219-446/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/trust-item.c: Remove file. * src/trustlist.c: Remove file. * src/Makefile.am (main_sources): Remove those files. * src/gpgme.h.in (GPGME_EVENT_NEXT_TRUSTITEM): Remove. (gpgme_trust_item_t, GpgmeTrustItem): Remove. (gpgme_op_trustlist_start): Remove. (gpgme_op_trustlist_next): Remove. (gpgme_op_trustlist_end): Remove. (gpgme_trust_item_ref): Remove. (gpgme_trust_item_unref, gpgme_trust_item_release): Remove. * src/gpgme.def: Remove removed functions. * src/libgpgme.vers: Ditto. -- The GPGME_ATTR_foo based functions are deprecated since 2003 and it is time to remove them now. The trustlist functions never worked: This never worked in reality because the required feature has been removed from GnuPG version 1.3.2 soon after introduction of this feature in gpgme in 2003. It was anyway marked as experimental. They even returned GPG_ERR_NOT_IMPLEMENTED since gpgme 1.14.0 (summer 2000) instead of failing with a incomprehensible error code. GnuPG-bug-id: 4834
* Remove long deprecated functions.Werner Koch2025-02-216-541/+0
| | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_EXPORT_MODE_NOUID): Remove. This was a left-over from an experiment. (gpgme_attr_t,_gpgme_attr_t) Remove. Deprecated sinze 2003. (gpgme_get_sig_ulong_attr): Ditto. (gpgme_get_sig_string_attr): Ditto. (gpgme_key_get_string_attr): Ditto. (gpgme_key_get_ulong_attr): Ditto. (gpgme_key_sig_get_string_attr): Ditto. (gpgme_key_sig_get_ulong_attr): Ditto. (gpgme_trust_item_get_string_attr): Ditto. (gpgme_trust_item_get_int_attr): Ditto. * src/gpgme.def: Remove them here too. * src/libgpgme.vers: Ditto. * src/trust-item.c: Remove corresponding implementations. * src/verify.c: Ditto. * src/key.c: Ditto.
* Update copyright notices.Werner Koch2025-02-041-1/+1
| | | | --
* core: Fix regression for RSA in gpgme_pubkey_algo_string.Werner Koch2025-02-031-1/+1
| | | | | | | | * src/gpgme.c (gpgme_pubkey_algo_string): Consider all RSA variants. -- Fixes-commit: 62b6c1f16ae0ed7b0eb1b095ee383aa0910314bb GnuPG-bug-id: 7508
* Add a configure test for gettid.Werner Koch2024-12-041-2/+9
| | | | | | | | | | | | * configure.ac (HAVE_GETTID,HAVE_SYS_GETTID): New test. * src/debug.c: Include syscall.h if needed. (tid_log_callback) [HAVE_SYS_GETTID]: Use SYS_gettid -- Linux introduced the gettid syscall with 2.4.11 but glibc only with its version 2.30. This patch allows building on older platforms. Co-authored-by: lgh1
* Support the Kyber algorithm in key listings.Werner Koch2024-11-143-3/+11
| | | | | | | * src/gpgme.h.in (GPGME_PK_KYBER): New. * src/conversion.c (_gpgme_map_pk_algo): Handle Kyber. * src/gpgme.c (gpgme_pubkey_algo_string): Support Kyber. (gpgme_pubkey_algo_name): Add Kyber.
* Release 1.24.0gpgme-1.24.0Werner Koch2024-11-061-1/+1
|
* Include the full commit id.Werner Koch2024-11-051-1/+1
| | | | | | * autogen.sh: Update to version 2024-07-04 from libgpg-error. * configure.ac (BUILD_COMMITID): New. Append to VERSION file. * src/version.c (cright_blurb): Use BUILD_COMMITID here.
* core: New context flags "known-notations".Werner Koch2024-10-293-0/+54
| | | | | | | | | | | | | | | | | | | * src/gpgme.c (gpgme_set_ctx_flag): Add "known-notations". (gpgme_get_ctx_flag): Ditto. (gpgme_release): Free variable. * src/context.h (struct gpgme_context): Add "known_notations". * src/engine-gpg.c (struct engine_gpg): Add "known_notations". (gpg_release): Free variable. (gpg_set_engine_flags): Set variable. (add_known_notations): New. (gpg_decrypt, gpg_verify): Call function. * tests/run-decrypt.c (main): Add option --known-notations. * tests/run-verify.c (main): Ditto. -- GnuPG-bug-id: 4060
* core: Add new helper _gpgme_strtokenize.Werner Koch2024-10-292-0/+80
| | | | | | | | | * src/conversion.c (spacep): New. (_gpgme_strtokenize): New. -- Function taken from GnuPG and license changed to LGPL 2.1. The version in GnuPG was entirely written by the author.
* core: fix passing --proc-all-sigs to gpgtarTobias Fella2024-10-091-0/+12
| | | | | | | | * src/engine-gpg.c: Pass --gpg-args before passing --proc-all-sigs if using gpgtar -- GnuPG-Bug-ID: 7320
* core: New flag fields beta_compliance.Werner Koch2024-10-072-3/+13
| | | | | | | | | | | | | * src/gpgme.h.in (struct _gpgme_subkey): Add field beta_compliance. (struct _gpgme_op_decrypt_result): Ditto. (struct _gpgme_signature): Ditto. * src/util.h (PARSE_COMPLIANCE_FLAGS): Handle the new 2023 value. * tests/run-decrypt.c: Append a "(beta)" to the vs-de compliance. * tests/run-keylist.c: Ditto. * tests/run-verify.c: Ditto. -- See GnuPG commit b287fb577587655559fefb90f7ed90c9a15dc6a3
* core: Allow GPGME_CREATE_ADSK also for gnupg 2.2.45Werner Koch2024-09-261-1/+6
| | | | * src/engine-gpg.c (gpg_addadsk): Extend the version check.
* core: Report failed encryption/signing if gpgtar didn't emit SUCCESSIngo Klöcker2024-09-204-10/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | src/encrypt-sign.c (encrypt_sym_status_handler): Add call of _gpgme_encrypt_status_handler. (encrypt_sign_start): Call _gpgme_op_encrypt_init_result with success_required=1 if archive is created. Always call _gpgme_op_sign_init_result with success_required=0 because the encrypt status handler already checks for SUCCESS. src/encrypt.c (op_data_t): Add success_seen flag. (_gpgme_encrypt_status_handler): Return error if we didn't see a required SUCCESS on GPGME_STATUS_EOF. Set success_seen flag on GPGME_STATUS_SUCCESS. (encrypt_sym_status_handler): Add call of _gpgme_encrypt_status_handler. (_gpgme_op_encrypt_init_result): Add argument success_required. Set success_seen flag if SUCCESS is not required. (encrypt_start): Call _gpgme_op_encrypt_init_result with success_required=1 if archive is created. src/ops.h (_gpgme_op_sign_init_result, _gpgme_op_encrypt_init_result): Add argument success_required to prototypes. src/sign.c (op_data_t): Add success_seen flag. (_gpgme_sign_status_handler): Return error if we didn't see a required SUCCESS on GPGME_STATUS_EOF. Set success_seen flag on GPGME_STATUS_SUCCESS. (sign_init_result): Add argument success_required. Set success_seen flag if SUCCESS is not required. (_gpgme_op_sign_init_result): Add argument success_required and forward it to sign_init_result. (sign_start): Call sign_init_result with success_required=1 if archive is created. -- gpgtar emits a SUCCESS status just before successful termination. If the process terminates unexpectedly (e.g. because it's killed) then gpgme now reports GPG_ERR_EOF. The SUCCESS status is only required if a signed and/or encrypted archive is created which is only supported for OpenPGP. The other engines reject the GPGME_ENCRYPT_ARCHIVE flag so that we don't need to check the protocol in the generic code. This change also adds handling of invalid recipients in case symmetric encryption is used which makes sense because one can combine symmetric and public key encryption. GnuPG-bug-id: 6554
* core: New encryption flags GPGME_ENCRYPT_ADD_RECP and _CHG_RECP.Werner Koch2024-09-092-3/+42
| | | | | | | | | | | | | * src/gpgme.h.in (GPGME_ENCRYPT_ADD_RECP, GPGME_ENCRYPT_CHG_RECP): New flag values. * src/engine-gpg.c (have_cmd_modify_recipients): New. (gpg_encrypt): Check availability of the feature and prepare command. * tests/run-encrypt.c (main): New options --add-recipients and --change-recipients. -- GnuPG-bug-id: 1825
* core: Treat email-only user IDs with upper case letters as email addressIngo Klöcker2024-09-041-5/+17
| | | | | | | | | | | | | | | | | | | | * src/key.c (_gpgme_key_append_name): Support email-only user IDs with upper case letters. * tests/gpg/t-keylist.c (struct key_info_s): Add algo, length, sec_algo, sec_length. (keys): Add expected algo and length for primary and secondary subkeys. (main): Factor out code for checking a key and the code for the keylist test. Call the factored out test function and a new test function. (check_key, test_keylist, key_with_email_only_user_id, key_info_email_only_user_id, test_email_only_user_id_with_upper_case_letters): New. -- Email-only user IDs with upper case letters are now also parsed as a user ID with empty name and the complete user ID as email. GnuPG-bug-id: 7280
* New context flag "proc-all-sigs".Werner Koch2024-08-233-1/+44
| | | | | | | | | | | | | * src/context.h (struct gpgme_context): Add proc_all_sigs. * src/gpgme.c (gpgme_set_ctx_flag): Add flag "proc-all-sigs". (gpgme_get_ctx_flag): Ditto. * src/engine-gpg.c (engine.gpg): Add flags.proc_all_sigs. (have_option_proc_all_sigs): New. (gpg_set_engine_flags): Set flag from context. (build_argv): Add --proc-all-sigs if requested and supported. -- GnuPG-bug-id: 7261
* core: New function gpgme_op_setownertrustIngo Klöcker2024-08-0616-3/+252
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/Makefile.am (main_sources): Add new file. * src/context.h (ctx_op_data_id_t): Add OPDATA_SETOWNERTRUST. * src/engine.c, src/engine.h (_gpgme_engine_op_setownertrust): New. * src/engine-backend.h (engine_ops): Add 'setownertrust' and adjust all engine initializers. * src/engine-gpg.c (gpg_setownertrust): New. (_gpgme_engine_ops_gpg): Set setownertrust to gpg_setownertrust. * src/gpgme.h.in (gpgme_op_setownertrust_start, gpgme_op_setownertrust): New. * src/gpgme.def, src/libgpgme.vers: Add new functions. * src/setownertrust.c: New. * doc/gpgme.texi: Document new functions. * tests/Makefile.am (noinst_PROGRAMS): Add new test program. * tests/run-setownertrust.c: New. * tests/gpg/Makefile.am (c_tests): Add new file. (LDADD): Add @GPG_ERROR_LIBS@. * tests/gpg/t-setownertrust.c: New. * tests/gpg/t-support.h (have_gpg_version): New. -- This extends GPGME to support the --quick-set-ownertrust command added by GnuPG 2.4.6. This allows changing the owner trust of keys and enabling/disabling keys without using the editinteractor interface. GnuPG-bug-id: 7239
* w32: Use UTF-8 for localized error descriptions for all threadsIngo Klöcker2024-08-051-0/+4
| | | | | | | | | | | | | * src/version.c (do_subsystem_inits) [W32]: Switch gettext to UTF-8 for current thread and all new threads. -- We did already enable UTF-8, but it was only effective for the main thread. Now we enable it also for all new threads (if supported by libgpg-error). This way debug output in background threads now also uses UTF-8. GnuPG-bug-id: 7188
* core: Remove obsolete source filesIngo Klöcker2024-07-182-59/+0
| | | | | | | | * src/isascii.c, src/putc_unlocked.c: Remove. -- I noticed those files when I compared the content of the dist tarball with the repo.
* core: Support all keylist modes and fix possible overrunIngo Klöcker2024-07-151-3/+17
| | | | | | | | | | | | | | * src/gpgme-tool.c (gt_get_keylist_mode): Increase NR_KEYLIST_MODES to number of keylist modes. Add support for GPGME_KEYLIST_MODE_WITH_TOFU, GPGME_KEYLIST_MODE_WITH_KEYGRIP, GPGME_KEYLIST_MODE_WITH_V5FPR. Write all modes. (hlp_keylist_mode): List all supported keylist modes. (cmd_keylist_mode): Add support for GPGME_KEYLIST_MODE_WITH_TOFU, GPGME_KEYLIST_MODE_WITH_KEYGRIP, GPGME_KEYLIST_MODE_WITH_V5FPR. -- This fixes the possible overrun reported by Michal Hlavinka and adds support for all keylist modes.
* Fix calling CancelSynchronousIo.NIIBE Yutaka2024-07-051-2/+2
| | | | | | | | | * src/w32-util.c (_gpgme_w32_cancel_synchronous_io): Use HANDLE. -- GnuPG-bug-id: 6634 Signed-off-by: NIIBE Yutaka <[email protected]>
* Fix printing size_t and off_t value for LLP64 Windows.NIIBE Yutaka2024-07-052-5/+5
| | | | | | | | | | | * src/debug.h (_trace_sysres_off_t): Use 'z' length specifier. * src/w32-io.c (_gpgme_io_read): Likewise. (writer, _gpgme_io_write): Likewise. -- GnuPG-bug-id: 7187 Signed-off-by: NIIBE Yutaka <[email protected]>
* Remove ath.h and ath.c.NIIBE Yutaka2024-07-053-252/+2
| | | | | | | | | * src/Makefile.am (system_components): We don't use ath.h any more. (main_sources): Remove ath.h and ath.c. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* Don't use ath_self, but get thread ID directly.NIIBE Yutaka2024-07-052-6/+22
| | | | | | | | | | | * src/debug.c [HAVE_W32_SYSTEM or __linux] (tid_log_callback): Use native thread ID call for Windows and Linux, ifdef-out-ed. (debug_init): Only call gpgrt_log_set_pid_suffix_cb for relevant systems. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* Use gpgrt_b64dec in libgpg-error.NIIBE Yutaka2024-07-013-259/+6
| | | | | | | | | | | | | | | * src/b64dec.c: Remove. * src/Makefile.am (main_sources): Remove b64dec.c. * src/data-identify.c (pgp_binary_detection): Use gpgrt_b64dec in libgpg-error. -- gpgrt_b64dec is available in libgpg-error 1.27 and it is already in use by JSON support. GnuPG-bug-id: 7180 Signed-off-by: NIIBE Yutaka <[email protected]>
* gpgme.m4: Fix setting/using GPG_ERROR_CONFIG.NIIBE Yutaka2024-06-131-8/+7
| | | | | | | | | gpgm4.m4 (_AM_PATH_GPGRT_CONFIG): Don't set GPG_ERROR_CONFIG and gpg_error_config_version. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* core: Allow setting import options when importing keysIngo Klöcker2024-06-128-7/+53
| | | | | | | | | | | | | | | | | | | | | | | | | * src/context.h (struct gpgme_context): New field import_options. * src/engine-backend.h (struct engine_ops): Add arg import_options to field 'import'. * src/engine-gpg.c (gpg_import): Add arg import_options and pass option --import-options with argument value to gpg. * src/engine-gpgsm.c (gpgsm_import): Add dummy arg import_options. * src/engine.c (_gpgme_engine_op_import): Add arg import_options and pass option to import function of engine. * src/engine.h (_gpgme_engine_op_import): Add arg import_options. * src/gpgme.c (gpgme_release): Free 'import_options'. (gpgme_set_ctx_flag, gpgme_get_ctx_flag): New flag "import-options". * src/import.c (_gpgme_op_import_start, _gpgme_op_import_keys_start, _gpgme_op_receive_keys_start): Pass import options stored in context to _gpgme_engine_op_import. * tests/run-import.c (show_usage, main): Add option --import-options. -- This makes the --import-options option available in the GPGME API for key imports. GnuPG-bug-id: 7152
* core,w32: Pass file names with forward slashes to gpg and gpgtarIngo Klöcker2024-06-043-29/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | src/conversion.c, src/util.h (_gpgme_replace_backslashes): New. src/engine-gpg.c (_add_arg): Add argument file_name. On Windows, replace backslashes in file name arguments with forward slashes. (add_arg_ext, add_arg_with_locp, add_arg, add_arg_pfx, add_gpg_arg, add_gpg_arg_with_value, add_arg_len): Adjust call of _add_arg. (add_file_name_arg, add_file_name_arg_len, add_gpg_arg_with_file_name): New. (add_file_name_arg_or_data): Call add_file_name_arg for file name. (gpg_new): Call add_gpg_arg_with_file_name for home directory. (gpg_decrypt): Call add_file_name_arg for output directory and output file name. (append_args_from_recipients_string): Call add_file_name_arg_len for recipients file name. (gpg_encrypt): Call add_file_name_arg for output file name, base directory and input file name. Call add_gpg_arg_with_file_name to set file name stored in message. (gpg_encrypt_sign): Call add_file_name_arg for output file name, base directory and input file name. Call add_gpg_arg_with_file_name to set file name stored in message. (gpg_sign): Call add_file_name_arg for output file name, base directory and input file name. Call add_gpg_arg_with_file_name to set file name stored in message. (gpg_verify): Call add_file_name_arg for output directory and output file name. -- By passing all file names with forward slashes to gpg and gpgtar we avoid problems caused by the quoting of backslashes. GnuPG-bug-id: 7141
* Merge branch 'ikloecker/t7118-revkeys'Ingo Klöcker2024-05-245-1/+131
|\
| * json: Add information about revocation keys to key list resultIngo Klöcker2024-05-211-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme-json.c (revocation_key_to_json): New. (key_to_json): Add list of revocation keys. * tests/json/Makefile.am (pubring-stamp): Import new pub key. * tests/json/key-with-revokers.asc: New. * tests/json/t-json.c (tests): Add "t-keylist-revokers". * tests/json/t-keylist-revokers.in.json, tests/json/t-keylist-revokers.in.json: New. -- GnuPG-bug-id: 7118
| * core: Add information about revocation keys to keysIngo Klöcker2024-05-214-1/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (struct _gpgme_revocation_key, gpgme_revocation_key_t): New. (struct _gpgme_key): Add fields 'revkeys', '_last_revkey'. * src/key.c (_gpgme_key_add_rev_key): New. (gpgme_key_unref): Free revkeys. * src/keylist.c (keylist_colon_handler): Parse rvk lines. * src/ops.h (_gpgme_key_add_rev_key): New. * tests/run-keylist.c (main): Print revocation key info. -- GnuPG-bug-id: 7118
* | core: Implement adding ADSKs through gpgme_createsubkeyTobias Fella2024-05-223-2/+40
|/ | | | | | | | | | | | | | | * src/engine-gpg.c: Add and use function for adding ADSKs. * src/genkey.c: Prevent error due to no status line. * src/gpgme.h.in: Add flag GPGME_CREATE_ADSK * doc/gpgme.texi: Add documentation for ADSKs * tests/run-genkey.c: Add test for adding ADSKs -- This adds the ability to add ADSKs through the gpgme_createsubkey interface. The function must be called with NULL userid, the ADSK fingerprint in algo and the GPGME_CREATE_ADSK flag.
* core: speedup gpgme_get_keyWerner Koch2024-05-211-1/+8
| | | | | | | * src/engine.c (_gpgme_set_engine_info): Change engine_get_version. -- GnuPG-bug-id: 6369
* gpgme.m4: Set $host correctly always.NIIBE Yutaka2024-05-161-2/+3
| | | | | | | | | | * src/gpgme.m4 (AM_PATH_GPGME): Add AC_CANONICAL_HOST. -- GnuPG-bug-id: 7114 Reported-by: Andreas Metzler Signed-off-by: NIIBE Yutaka <[email protected]>
* gpgme.m4: Update _AM_PATH_GPGRT_CONFIG macro from gpg-error.m4.NIIBE Yutaka2024-05-141-7/+5
| | | | | | | | * src/gpgme.m4 (_AM_PATH_GPGRT_CONFIG): Update. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* core: Check STATUS_FAILURE in import operations.Ingo Klöcker2024-03-111-0/+14
| | | | | | | | * src/import.c (op_data_t): Add failure_code. (_gpgme_import_status_handler): Set it. Return it on EOF. -- GnuPG-bug-id: 7036
* core: Tell gpg that we want to verify signed dataIngo Klöcker2023-12-221-0/+2
| | | | | | | | | | | | * src/engine-gpg.c (gpg_verify): Add "--verify" to command line. -- Since GnuPG 2.1.16 --verify writes the signed data to the file specified by --output. Explicitly telling gpg that we want to verify signed data frees gpg from guessing what we want and avoids the corresponding warning "no command supplied. Trying to guess what you mean ..." GnuPG-bug-id: 6907
* core: Support writing the decrypt/verify output directly to a fileikloecker/t6550Ingo Klöcker2023-12-191-6/+15
| | | | | | | | | | | | | | | | | | | * src/engine-gpg.c (gpg_decrypt): Pass output file name to gpg if output has file name set. (gpg_verify): Ditto. * tests/run-decrypt.c (show_usage): New option --output. (main): Parse new option. Set file name on output if --output is given. Do not print output if --output is given. * tests/run-verify.c (show_usage): New option --output. (main): Parse new option. Set file name on output if --output is given. -- This change makes it possible to tell gpg to write the output (i.e. the decrypted/verified data) directly to a file with given file name instead of piping the output back to gpgme. GnuPG-bug-id: 6550
* core: Support direct signing of file with gpgIngo Klöcker2023-12-195-19/+41
| | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_SIG_MODE_FILE): New signature mode flag. * src/engine-gpg.c (gpg_sign): Separate signature mode from additional flags. Check for incompatible flags. Explicitly set output to stdout if no output file is used. Pass filename instead of fd to gpg when new flag is set. * src/engine-gpgsm.c (gpgsm_sign): Return error if new flag is set. * src/engine-uiserver.c (uiserver_sign): Ditto. * src/sign.c (sign_start): Consider new flag on check for invalid flags. * tests/run-sign.c (show_usage): New options --detach and --direct-file-io. (main): Parse new options. Create a detached signature if --detach is given. Make gpg read the input file itself if --direct-file-io is given. -- With this change the gpgme_op_sign* functions gain the possibility to make gpg read the data to sign directly from a file instead of from an input FD to which it is written by gpgme. GnuPG-bug-id: 6550
* core: Support direct encryption of file with gpgIngo Klöcker2023-12-194-7/+34
| | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_ENCRYPT_FILE): New encryption flag. * src/engine-gpg.c (gpg_encrypt, gpg_encrypt_sign): Check for incompatible flags. Pass filename instead of fd to gpg when new flag is set. * src/engine-gpgsm.c (gpgsm_encrypt): Return error if new flag is set. * src/engine-uiserver.c (uiserver_encrypt): Ditto. * tests/run-encrypt.c (show_usage): New option --direct-file-io. (main): Parse new option. Make gpg read the input file itself if the option is given. -- With this change the gpgme_op_encrypt* and gpgme_op_encrypt_sign* functions gain the possibility to make gpg read the data to (sign and) encrypt directly from a file instead of from an input FD to which it is written by gpgme. GnuPG-bug-id: 6550
* core: percent decode filenameAndre Heinecke2023-11-291-3/+6
| | | | | | | | | | | | | | | * src/op-support.c (_gpgme_parse_plaintext): Decode filename as percent string. -- From gnupg/doc/DETAILS: If a filename is available it gets printed as the third argument, percent-escaped as usual. so we can use the usual percent decode function here. GnuPG-Bug-Id: T6852
* core: Preserve more specific existing failure codeIngo Klöcker2023-11-1412-12/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | * src/decrypt.c (_gpgme_decrypt_status_handler): Ignore received failure code if we already have a specific failure code. * src/encrypt.c (_gpgme_encrypt_status_handler): Ditto. * src/export.c (export_status_handler): Ditto. * src/genkey.c (genkey_status_handler): Ditto. * src/keylist.c (keylist_status_handler): Ditto. * src/keysign.c (keysign_status_handler): Ditto. * src/passwd.c (passwd_status_handler): Ditto. * src/revsig.c (revsig_status_handler): Ditto. * src/setexpire.c (setexpire_status_handler): Ditto. * src/sign.c (_gpgme_sign_status_handler): Ditto. * src/tofupolicy.c (tofu_policy_status_handler): Ditto. * src/verify.c (_gpgme_verify_status_handler): Ditto. -- Usually, a process emits at most one failure code. But some operations like the creation of an encrypted archive involve multiple chained processes, so that multiple failure codes can be received. We want to keep the first specific failure code we received. Further failure codes are only parsed if we received just an unspecific "general error" so far. GnuPG-bug-id: 6575
* Change gpgme-w32-spawn to unicodeAndre Heinecke2023-10-252-42/+50
| | | | | | | | | | | | | | | | | | | | | * src/Makefile.am (gpgme_w32spawn_CFLAGS): Add -municode. * src/gpgme-w32-spawn.c (build_commandline, my_spawn) (translate_handles): Convert to wchar_t API. (main): Use wmain instead. -- Some time ago we introduced an inconsistency that w32-util called gpgme-w32-spawn through CreateProcessW but since gpgme-w32-spawn internally worked with 8 bit the chars were mangled and the arguments not passed correctly through the CreateProcessA of the child process. Since the GnuPG processes use GetCommandLineW this is the proper way to pass on Unicode command line arguments. Please note that we did not pass UTF-8 before this patch but rather some broken native encoding where Windows replaces unicode characters with question marks etc. GnuPG-Bug-Id: T6728
* doc: Fix typos in documentation and source code commentsIngo Klöcker2023-10-139-17/+17
| | | | | | | | -- Anonymous contribution Signed-off-by: Ingo Klöcker <[email protected]>
* core: Add key capability flags has_encrypt etc.Werner Koch2023-10-052-1/+33
| | | | | | | | | | * src/gpgme.h.in (struct _gpgme_key): Add flags has_encrypt, has_certify, has_sign, and has_authenticate. * src/keylist.c (finish_key): Set these flags. * tests/run-keylist.c (main): Print them. -- GnuPG-bug-id: 6748