aboutsummaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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
* core: Check STATUS_FAILURE in export operations.Werner Koch2023-10-051-3/+12
| | | | | | | | | | | * src/export.c (op_data_t): Add failure_code. (export_status_handler): Set it. (gpgme_op_export_ext, gpgme_op_export_keys): Also check the failure code. -- That is just in case we missed an error code. For example with older gpg versions (e.g. 2.3.8) and exporting to a keyserver.
* gpgme-tool: Support use of Windows HANDLE for INPUT/OUTPUT/MESSAGE.NIIBE Yutaka2023-09-291-1/+13
| | | | | | | | | | * src/gpgme-tool.c [HAVE_W32_SYSTEM] (server_data_obj): Implement for Windows HANDLE. -- GnuPG-bug-id: 6634 Signed-off-by: NIIBE Yutaka <[email protected]>
* New mode to list a v5 fingerprint for v4 packets.Werner Koch2023-09-044-2/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_KEYLIST_MODE_WITH_V5FPR): New. (struct _gpgme_subkey): Add field v5fpr. * src/engine-gpg.c (gpg_keylist_build_options): Pass new option to gpg. * src/key.c (gpgme_key_unref): Free new field. * src/keylist.c (op_data_t): Parse and add "fp2" line. * tests/run-keylist.c (show_usage): Add option --v5fpr. * src/keylist.c (op_data_t): Add field failure_code. (keylist_status_handler): Handle special value. (gpgme_op_keylist_end): Return an error if a FAILURE line has been seen. -- Note that the failure code part has been added to better diagnose problems if a wrong gpg version is used. If verything works right we should not get this because we check that the gnupg version sis either >= 2.4.4 or less than 2.3 and >= 2.2.42. Note further that the v5fpr field may also be used to get the SHA-256 fingerprint of X.509 certificates (even without passing the new mode flag). GnuPG-bug-id: 6705
* Support GPGME_ENCRYPT_ALWAYS_TRUST also for S/MIME.Werner Koch2023-08-311-1/+12
| | | | | | | | | | | | | * src/engine-gpgsm.c (gpgsm_encrypt): Send the always-trust options. * tests/run-encrypt.c: Add option --always-trust. -- Note that the run-encrypt test tool used to assume always-trust for OpenPGP since 1.7.0 This bug has also been fixed by introducing the explicit option. GnuPG-bug-id: 6559
* core: Use offline mode for all operations of gpgsm engineIngo Klöcker2023-08-146-47/+33
| | | | | | | | | | | | | | | | | | | | * src/engine-backend.h (keylist, keylist_ext): Remove engine_flags. * src/engine-gpg.c (gpg_keylist, gpg_keylist_ext): Ditto. * src/engine.c, src/engine.h (_gpgme_engine_op_keylist): Ditto. (_gpgme_engine_op_keylist_ext): Ditto. * src/engine.h (GPGME_ENGINE_FLAG_OFFLINE): Remove. * src/engine-gpgsm.c (struct engine_gpgsm): New field flags with offline flag. (have_gpgsm_version): New. (gpg_set_engine_flags): Set the offline flag. (start): Send OPTION "offline". (gpgsm_keylist, gpgsm_keylist_ext): Remove engine_flags. Remove sending of OPTION "offline". * src/keylist.c (gpgme_op_keylist_start, gpgme_op_keylist_ext_start): Remove setting of offline flag. -- GnuPG-bug-id: 6648
* core: Store engine's version string in gpgsm engineIngo Klöcker2023-08-141-2/+14
| | | | | | | | | * src/engine-gpgsm.c (struct engine_gpgsm): Add field 'version'. (gpgsm_new): Copy version string. (gpgsm_release): Free VERSION. -- GnuPG-bug-id: 6648
* core: Prevent wrong plaintext when verifying clearsigned signatureIngo Klöcker2023-07-281-3/+1
| | | | | | | | | | | | | | | | | | * src/engine-gpg.c (gpg_verify): Use a separate pipe instead of stdout for reading the plaintext. * tests/gpg/t-support.h (PGM): Define if undefined. (print_data): Undefine BUF_SIZE. (check_data): New. * tests/gpg/t-verify.c (clearsigned_plus_key_block): New. (main): Add test. -- Reading the plaintext from stdout is a bad idea because gpg can also print other stuff on stdout, e.g. the keys contained in a public key block. This is fixed by reading the plaintext via a special pipe. GnuPG-bug-id: 6622
* core: Return bad data error instead of general error on unexpected dataIngo Klöcker2023-07-281-1/+1
| | | | | | | | | | | * src/verify.c (_gpgme_verify_status_handler): Return GPG_ERR_BAD_DATA instead of GPG_ERR_GENERAL. -- This gives users trying to decrypt and/or verify for example a public key block a more useful error. GnuPG-bug-id: 6617
* core: Support reading the archive to decrypt/verify directly from a fileIngo Klöcker2023-06-211-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | * src/engine-gpg.c (add_file_name_arg_or_data): New. (gpg_decrypt): Use add_file_name_arg_or_data instead of add_data for the ciphertext. (gpg_verify): Use add_file_name_arg_or_data instead of add_data for the signature and the signed text. * tests/run-decrypt.c (show_usage): New option --direct-file-io. (main): Parse new option. If option is given, then don't open input file, create simple data object instead of data object from stream and set input file name on input data. * tests/run-verify.c (show_usage): New option --direct-file-io. (main): Parse new option. If option is given, then don't open input files, create simple data objects instead of data objects from stream and set input file names on input data objects. -- This change makes it possible to tell gpg (and gpgtar) to read the input (i.e. the signed/encrypted data or the signature or the created archive) directly from the files with given file names instead of from streams piped through GpgME's Data IO. GnuPG-bug-id: 6530
* core: Support writing the sign/encrypt output directly to a fileIngo Klöcker2023-06-191-7/+35
| | | | | | | | | | | | | | | | | | | | | | * src/engine-gpg.c (gpg_encrypt): Pass output file name to gpg if output has file name set. (gpg_encrypt_sign): Ditto. (gpg_sign): Ditto. * tests/run-encrypt.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-sign.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. -- This change makes it possible to tell gpg (and gpgtar) to write the output (i.e. the signed/encrypted data or the signature or the created archive) directly to a file with given file name instead of piping the output back to gpgme. GnuPG-bug-id: 6530
* core: Send a input-size-hint for gpgsm.Werner Koch2023-06-151-0/+52
| | | | | | | | | | * src/engine-gpgsm.c (send_input_size_hint): New. (gpgsm_decrypt): Send hint. (gpgsm_encrypt): Send hint. (gpgsm_sign): Send hint. (gpgsm_verify): Send hint. -- GnuPG-bug-id: 6534
* core: Use 64 bit instead of gpgme_off_t for some internal functions.Werner Koch2023-06-155-8/+10
| | | | | | | | | | | | * src/conversion.c (_gpgme_string_to_off): Return an u64 value. * src/data.c (_gpgme_data_get_size_hint): Ditto. (gpgme_data_set_flag): Use u64 for io-buffer-size due to string_to_off change. * src/data.h (struct gpgme_data): Change size_hint to u64. * src/engine-gpg.c (add_input_size_hint): Replace gpgme_off_t by u64. -- GnuPG-bug-id: 6534
* core: For key signing and uid revoking allow an empty user id.Werner Koch2023-05-301-2/+2
| | | | | | | | * src/engine-gpg.c (gpg_keysign): Required USERID to be non-empty. -- For some language bindings it is easier if the engine considers an empty user id to be equivalent to NULL.
* core: Support the new macOS Homebrew location.Werner Koch2023-04-201-1/+2
| | | | | | | * src/posix-util.c (find_executable): Extend the path. -- GnuPG-bug-id: 6440
* core: Avoid printf format warnings due to gpgme_ssize_t.Werner Koch2023-04-171-1/+1
| | | | * src/debug.h (_trace_sysres_ssize_t): Cast arg.
* core,w32: Fix invocation of gpgtarWerner Koch2023-04-172-13/+32
| | | | | | | * src/dirinfo.c (EXEEXT_S): New. (get_gpgconf_item): Append ".exe" to gpg-wks-client and gpgtar. * src/gpgme-w32spawn.c (mystderr): Add code to ease debugging.
* w32: Always use UTF-8 for localized textsIngo Klöcker2023-04-041-0/+3
| | | | | | | | | | | | | | * configure.ac: Define GPG_ERR_ENABLE_GETTEXT_MACROS. * src/version.c (do_subsystem_inits) [W32]: Switch gettext to UTF-8. -- On Windows, applications using GpgME can now rely on localized texts returned by GpgME, e.g. the texts for error codes, to be UTF-8 encoded. In particular, this saves a useless and possibly lossy conversion to native encoding and back to UTF-8. On other OSes, where we use the system provided gettext, we assume that UTF-8 is used nowadays. GnuPG-bug-id: 5960
* core: Minor code cleanup.Werner Koch2023-03-271-50/+25
| | | | | | | | * src/engine-gpg.c (build_argv): Remove superfluous tes. -- gpg_error_from_syserror is guaranteed not to return 0 even if errno is not set.
* core: Initialize error variableIngo Klöcker2023-03-271-1/+1
| | | | | | | * src/engine-gpg.c (build_argv): Initialize err. -- Fixes-commit: fbce7deb3b68af900f692591d5d05fa5c1a83f5f
* core,cpp: Add new key flags to gpgme_subkey_tWerner Koch2023-03-212-1/+22
| | | | | | | | | | | | | | | | | * src/gpgme.h.in (struct _gpgme_subkey): Add bit flags can_renc, can_timestamp, adn is_group_owned. Reduce size of _unused. * src/keylist.c (set_subkey_capability): Set them. * tests/run-keylist.c (main): Print them. * lang/cpp/src/key.h (Subkey::canRenc): New. (Subkey::canTimestamp): New. (Subkey::isGroupOwned): New. * lang/cpp/src/key.cpp: Implement new methods. (Subkey::isQualified): Print them. (std::ostream &operator<<): Print them. -- GnuPG-bug-id: 6395
* core: Also detect legacy X.509 v0 certificates.Werner Koch2023-03-081-19/+31
| | | | | * src/data-identify.c (basic_detection): Loose the detection of X.509 certs.
* core: Switch to logging via gpgrtWerner Koch2023-02-102-96/+100
| | | | | | | | | | | | * src/debug.c (errfp): Remove. (debug_init): Factor some code out to ... (safe_to_use_debug_file): new. (tid_log_callback): New. (debug_init): Rewrite to make use of gpgrt logging. (_gpgme_debug): Ditto. (_gpgme_debug_end): Remove extra LF testing code. * src/dirinfo.c (get_gpgconf_item): Remove now unneeded LFs. Realign output.
* core: Update copyright noticesWerner Koch2023-02-101-1/+1
| | | | --
* core: Allow finalization of signature verification of unencrypted dataIngo Klöcker2023-02-101-3/+7
| | | | | | | | | | | | | | | | * src/decrypt-verify.c (decrypt_verify_status_handler): Call _gpgme_verify_status_handler on EOF even if _gpgme_decrypt_status_handler returned NO DATA error. * tests/gpg/t-decrypt-verify.c (normal_signed_message): New. (main): Add test with signed, but not encrypted data. -- This allows the verify status handler to finalize the verification of the last signature even if the decrypt status handler returned a NO DATA error because the input data wasn't encrypted. GnuPG-bug-id: 6368
* core: Make usage of input size hint compatible with gpgtarIngo Klöcker2023-02-021-13/+8
| | | | | | | | * src/engine-gpg.c (add_input_size_hint): Use add_gpg_arg_with_value to add the --input-size-hint option. -- GnuPG-bug-id: 6342
* core: Allow usage of gpgtar also for new enough gpg 2.2Ingo Klöcker2023-02-021-19/+23
| | | | | | | | | | | | | | * src/engine-gpg.c (have_usable_gpgtar): New. (start): Always pass --status-fd to the called process. (gpg_decrypt, gpg_encrypt, gpg_encrypt_sign, gpg_sign, gpg_verify): Use have_usable_gpgtar() to check for suitable gpg. -- The version check in start() is not needed because versions of gpg that are unsuitable for the usage of gpgtar are rejected already by the callers. GnuPG-bug-id: 6342
* core,w32: More robust detection of GnuPG Desktop dir layoutWerner Koch2023-02-011-20/+75
| | | | | | | | | | * src/w32-util.c (INST_TYPE_GPG4WIN, INST_TYPE_GPGDESK): New to replace the numeric constants. (find_version_file): New. (_gpgme_get_gpgconf_path): Guess a default for inst_type. -- GnuPG-bug-id: 6362
* json: New operation "identify" and convenience option --identify.Werner Koch2023-01-311-1/+126
| | | | | | | | | * src/gpgme-json.c (data_type_to_string): New. (op_identify): New. (process_request): Add to command list. (cmd_identify): New. (main): Add option --identify. --
* core: Use signature modes as flagsIngo Klöcker2023-01-308-26/+37
| | | | | | | | | | | | | | | | | | | | | | | | | * src/engine-backend.h (engine_ops.sign): Rename argument mode to flags. * src/engine-gpg.c (gpg_sign): Rename argument mode to flags. Check for invalid combination of flags. * src/engine-gpgsm.c (gpgsm_sign): Rename argument mode to flags. Check for unsupported flags. * src/engine-uiserver.c (gpgsm_sign): Rename argument mode to flags. Check for unsupported flags. * src/engine.c, src/engine.h (_gpgme_engine_op_sign): Rename argument mode to flags. * src/gpgme.h.in (GPGME_SIG_MODE_ARCHIVE): Change value to 4. (gpgme_op_sign_start, gpgme_op_sign): Rename argument mode to flags. * src/sign.c (sign_start): Rename argument mode to flags. Adjust check for invalid flags. (gpgme_op_sign_start, gpgme_op_sign): Rename argument mode to flags. -- Using the signature mode constants as flags is more natural, even if currently all flags are mutually exclusive, because archives are signed with a normal signature. GnuPG-bug-id: 6342
* core: Update required GnuPG version for new archive featuresIngo Klöcker2023-01-261-5/+5
| | | | | | | | | | | * src/engine-gpg.c (gpg_decrypt, gpg_encrypt, gpg_encrypt_sign, gpg_sign, gpg_verify): Require gpg 2.4.1. -- To work properly the archive feature needs a fix added in GnuPG 2.4.1. GnuPG-bug-id: 6342
* core: Support usage of gpgtar for verifying a signed archiveIngo Klöcker2023-01-2510-31/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_verify_flags_t): New enum. (GPGME_VERIFY_ARCHIVE): New const. (gpgme_op_verify_ext_start): New func. (gpgme_op_verify_ext): New func. * src/gpgme.def, src/libgpgme.vers: Add new functions. * src/verify.c (gpgme_op_verify_ext_start): New. (gpgme_op_verify_ext): New. (verify_start): Add arg FLAGS. Pass the flags to _gpgme_engine_op_verify. (gpgme_op_verify_start): Call gpgme_op_verify_ext_start with 0 for FLAGS. (gpgme_op_verify): Call gpgme_op_verify_ext with 0 for FLAGS. * src/engine.c, src/engine.h (_gpgme_engine_op_verify): Add arg FLAGS. * src/engine-backend.h (struct engine_ops): Add FLAGS to 'verify'. * src/engine-gpg.c (gpg_verify): Add arg FLAGS. Set use_gpgtar engine flag if GPGME_VERIFY_ARCHIVE flag is set. Check for new enough gpg. Use add_gpg_arg for gpg-only options without a value. Set extra options for gpgtar and pass input data to stdin when using gpgtar. * src/engine-gpgsm.c (gpgsm_verify): Add arg FLAGS. Return error if GPGME_VERIFY_ARCHIVE flag is set. * src/engine-uiserver.c (uiserver_verify): Ditto. * tests/run-verify.c (show_usage): New options --archive, --directory, and --diagnostics. (main): Parse new options. Verify and extract with gpgtar if --archive is given. Set file name of output data to value of --directory option. Print stderr of gpg/gpgtar if --diagnostics is given. -- GnuPG-bug-id: 6342
* core: Support usage of gpgtar for decrypting an encrypted archiveIngo Klöcker2023-01-242-20/+48
| | | | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_DECRYPT_ARCHIVE): New decryption flag. * src/engine-gpg.c (gpg_decrypt): Set use_gpgtar engine flag if GPGME_DECRYPT_ARCHIVE flag is set. Check for new enough gpg and incompatible flags. Use add_gpg_arg_with_value for gpg-only options with a value and add_gpg_arg for gpg-only options without a value. Set extra options for gpgtar and pass input data to stdin when using gpgtar. * tests/run-decrypt.c (show_usage): New options --archive and --directory. (main): Parse new options. Decrypt with gpgtar if --archive is given. Set file name of output data to value of --directory option. -- GnuPG-bug-id: 6342
* core: Allow setting the base directory when creating an archiveIngo Klöcker2023-01-231-16/+30
| | | | | | | | | | | | | * src/engine-gpg.c (gpg_encrypt, gpg_encrypt_sign, gpg_sign): Pass file name set in data with --directory option to gpgtar. * tests/run-encrypt.c (show_usage): New option --directory. (main): Parse new option. Set file name of input data to option value. * tests/run-sign.c (show_usage): New option --directory. (main): Parse new option. Set file name of input data to option value. -- GnuPG-bug-id: 6342
* core: Support usage of gpgtar for creating an encrypted signed archiveIngo Klöcker2023-01-191-15/+35
| | | | | | | | | | | | | | | | | | | | | | * src/engine-gpg.c (gpg_encrypt_sign): Set use_gpgtar engine flag if GPGME_ENCRYPT_ARCHIVE mode is set. Check for new enough gpg. Use add_gpg_arg_with_value for gpg-only options with a value and add_gpg_arg for gpg-only options without a value. Set extra options for gpgtar and pass input data to stdin when using gpgtar. * tests/run-encrypt.c (print_result): Rename to print_encrypt_result. Print header. (print_sign_result): New. (show_usage): New option --sign. (main): Parse new option. Sign and encrypt --sign is given. Print results of signing additionally to results of encryption. -- With this change the gpgme_op_encrypt_sign* functions get support for creating an encrypted and signed archive from files and/or directories passed as NUL-separated list in the "plain" data with gpgtar. GnuPG-bug-id: 6342
* core: Support usage of gpgtar for creating a signed archiveIngo Klöcker2023-01-193-31/+44
| | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_SIG_MODE_ARCHIVE): New signature mode. * src/engine-gpg.c (append_args_from_sender, append_args_from_sig_notations): Use add_gpg_arg_with_value for gpg-only options with a value. (gpg_sign): Set use_gpgtar engine flag if GPGME_SIG_MODE_ARCHIVE mode is set. Check for new enough gpg. Use add_gpg_arg_with_value for gpg-only options with a value and add_gpg_arg for gpg-only options without a value. Set extra options for gpgtar and pass input data to stdin when using gpgtar. * src/sign.c (sign_start): Add GPGME_SIG_MODE_ARCHIVE as valid mode. * tests/run-sign.c (show_usage): New options --archive and --diagnostics. (main): Parse new options. Sign with gpgtar if --archive is given. Print stderr of gpg/gpgtar if --diagnostics is given. -- With this change the gpgme_op_sign* functions get support for creating a signed archive from files and/or directories passed as NUL-separated list in the "in" data with gpgtar. GnuPG-bug-id: 6342
* core: Fix --set-filename argumentIngo Klöcker2023-01-191-1/+1
| | | | | | | * src/engine-gpg.c (gpg_encrypt): Append equal sign to argument name. -- GnuPG-bug-id: 6342
* core: Support usage of gpgtar for encryptionIngo Klöcker2023-01-184-79/+222
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_ENCRYPT_ARCHIVE): New encryption flag. * src/engine-gpg.c (arg_and_data_s): New field gpg_arg. (engine_gpg): New flag use_gpgtar. (_add_arg): Add argument gpg_arg and set it. (add_arg_ext, add_arg_with_locp, add_arg, add_arg_pfx, add_arg_len): Adjust call of _add_arg. (add_arg_with_locp): Add argument front. (add_gpg_arg, add_gpg_arg_with_value): New. (gpg_new): Use add_gpg_arg_with_value for gpg-only options with a value and add_gpg_arg for gpg-only options without. (build_argv): Consider usage of gpgtar when counting arguments to pass to gpg/gpgtar. Prepend "--gpg-args" to all gpg-only arguments if gpgtar is used. (start): Set program to use. Read diagnostics output from stderr when using gpgtar. Do not pass --status-fd to gpgtar for gpg < 2.4.1. Use add_gpg_arg_with_value for --lc-ctype and --lc-messages. (gpg_encrypt): Set use_gpgtar engine flag if GPGME_ENCRYPT_ARCHIVE flag is set. Check for new enough gpg and incompatible flags. Use add_gpg_arg_with_value for gpg-only options with a value and add_gpg_arg for gpg-only options without a value. Set extra options for gpgtar and pass input data to stdin when using gpgtar. * 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 options --archive and --diagnostics. (main): Parse new options. Encrypt with gpgtar if --archive is given. Print stderr of gpg/gpgtar if --diagnostics is given. -- With this change the gpgme_op_encrypt* functions get support for encrypting a list of files and/or directories passed as NUL-separated list in "plain" data with gpgtar. GnuPG-bug-id: 6342
* core: Defer adding --status-fd and --logger-fd to argument listIngo Klöcker2023-01-181-41/+60
| | | | | | | | | | | | | | | * src/engine-gpg.c (_append_to_arglist, _prepend_to_arglist): New. (_add_arg): Use _append_to_arglist and _prepend_to_arglist. (add_data_ext): New. Extends add_data. (add_data): Uses add_data_ext. (gpg_new): Do not add --status-fd and --logger-fd to argument list. (start): Prepend --logger-fd and --status-fd to the argument list. -- This change makes it possible to handle those two arguments differently if gpgtar is used instead of gpg. GnuPG-bug-id: 6342
* core: Extend gpgme_get_dirinfo to return the gpgtar nameIngo Klöcker2023-01-182-0/+20
| | | | | | | | | | | | | * src/dirinfo.c (WANT_GPGTAR_NAME): New. (dirinfo): Add field gpgtar_name. (get_gpgconf_item): Build gpgtar_name on demand and return it. (_gpgme_get_default_gpgtar_name) : New. (gpgme_get_dirinfo): New value "gpgtar-name" for WHAT. * src/util.h (_gpgme_get_default_gpgtar_name): New. * tests/t-engine-info.c (main): Add gpgtar-name to the output. GnuPG-bug-id: 6342
* core: Use "goto leave" pattern to clean up resourcesIngo Klöcker2023-01-171-68/+62
| | | | | | | | | | | * src/engine-gpg.c (build_argv): Initialize fd_data_map and argv. Goto leave on error. Free fd_data_map and argv on error. -- This will make it easier to add an additional "--with-gpg-args" option where needed. GnuPG-bug-id: 6342
* core: Do not add obsolete --no-sk-comments to command lineIngo Klöcker2023-01-161-11/+0
| | | | | | | | | * src/engine-gpg.c (build_argv): Don't add "--no-sk-comments" to argv. -- This option is a no-op since 1.4.3 and 1.4.23 is the latest 1.4 release. GnuPG-bug-id: 6342
* gpgme.m4: Fix AM_PATH_GPGME_PTHREAD.NIIBE Yutaka2022-11-251-21/+24
| | | | | | | | | | * src/gpgme.m4 (AM_PATH_GPGME_PTHREAD): It's deprecated, since gpgme supports threads and GNU C library has integrated pthread features. -- GnuPG-bug-id: 6285 Signed-off-by: NIIBE Yutaka <[email protected]>