aboutsummaryrefslogtreecommitdiffstats
path: root/tests (follow)
Commit message (Collapse)AuthorAgeFilesLines
* New decrypt flags GPGME_DECRYPT_LISTONLY.HEADmasterWerner Koch2025-03-181-1/+7
| | | | | | | | | | | | | | * 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-141-15/+68
| | | | | | | | | | | | | | | | | | * 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-262-1/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* tests,json: Prevent failing tests after 2027-05-15Ingo Klöcker2025-01-022-20/+20
| | | | | | | | | | | | | | | | | | | * tests/json/key-with-revokers.asc: Replace with new public key. * tests/json/t-keylist-revokers.out.json: Update to new public key. -- The old test key expired on 2027-05-15 which would break the tests after this date. Replace it with a new test key which doesn't expire. The new key was generated with gpg --faked-system-time 1715782979 \ --add-desig-revoker sensitive:A0FF4590BB6122EDEF6E3C542D727CC768697734 \ --add-desig-revoker 23FD347A419429BACCD5E72D6BC4778054ACD246 \ --quick-gen-key [email protected] default default never and exported with gpg --export --armor --export-options export-sensitive-revkeys \ [email protected] GnuPG-bug-id: 7471
* Support the Kyber algorithm in key listings.Werner Koch2024-11-141-2/+6
| | | | | | | * 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.
* core: New context flags "known-notations".Werner Koch2024-10-292-0/+33
| | | | | | | | | | | | | | | | | | | * 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: New flag fields beta_compliance.Werner Koch2024-10-073-6/+10
| | | | | | | | | | | | | * 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: New encryption flags GPGME_ENCRYPT_ADD_RECP and _CHG_RECP.Werner Koch2024-09-091-0/+14
| | | | | | | | | | | | | * 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-415/+540
| | | | | | | | | | | | | | | | | | | | * 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-231-0/+10
| | | | | | | | | | | | | * 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
* tests,json: Remove no longer needed codeIngo Klöcker2024-08-071-106/+1
| | | | | | | | | | * tests/json/t-json.c (parse_version_number, parse_version_string, compare_versions, check_gpg_version): Remove. (main): Use have_gpg_version from t-support.h. -- In the meantime gpgrt provides API for comparing versions (which is used by have_gpg_version in t-support.h).
* core: New function gpgme_op_setownertrustIngo Klöcker2024-08-065-4/+284
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* tests: Add --import-filter option to usage info of run-importIngo Klöcker2024-06-121-0/+1
| | | | | * tests/run-import.c (show_usage): Add option --import-filter. --
* core: Allow setting import options when importing keysIngo Klöcker2024-06-121-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | * 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
* tests: Add new files to distributionIngo Klöcker2024-05-241-0/+2
| | | | | | | | * tests/json/Makefile.am (EXTRA_DIST): Add files added with f2575b63. -- Fixes-commit: f2575b6313aeb23d867682856f7842704786349e GnuPG-bug-id: 7118
* Merge branch 'ikloecker/t7118-revkeys'Ingo Klöcker2024-05-246-1/+136
|\
| * json: Add information about revocation keys to key list resultIngo Klöcker2024-05-215-1/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-211-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-221-2/+39
|/ | | | | | | | | | | | | | | * 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.
* tests: Fix segv in t-json.cWerner Koch2024-05-211-1/+1
| | | | | * tests/json/t-json.c (test_contains): Avoid calling recusivly with no child.
* tests: Avoid some compiler warnings.Werner Koch2024-05-212-3/+25
| | | | | | | | | | | * tests/gpg/t-support.h (fail_with_syserr): New. (check_data): Use it to avoid compiler warnings. * tests/run-support.h (fail_with_syserr): New. -- I don't think that there is a way to tell gcc that gpgme_err_code_from_errno will never return 0. Thus we better use a different macro.
* tests: Fix test after changed behavior of gpgme_op_verifyIngo Klöcker2024-05-151-6/+7
| | | | | | | | | | | * tests/gpg/t-verify.c (main): Change assertion of test. -- The change introduced with 1dc44b7c makes gpg abort the verification of a clear-signed message if it encounters garbage following the signed data. We have to adapt the test to this change. GnuPG-bug-id: 6907
* core: Support writing the decrypt/verify output directly to a fileikloecker/t6550Ingo Klöcker2023-12-192-5/+55
| | | | | | | | | | | | | | | | | | | * 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-191-1/+22
| | | | | | | | | | | | | | | | | | | | | | | * 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-191-0/+15
| | | | | | | | | | | | | | | | | | | | | * 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
* tests: Add option --chain to run-keylistWerner Koch2023-11-101-1/+48
| | | | | | | | * tests/run-keylist.c (xstrdup): New. (main): Add option. -- This allows to list the entire chain.
* doc: Fix typos in documentation and source code commentsIngo Klöcker2023-10-131-1/+1
| | | | | | | | -- Anonymous contribution Signed-off-by: Ingo Klöcker <[email protected]>
* core: Add key capability flags has_encrypt etc.Werner Koch2023-10-051-1/+6
| | | | | | | | | | * 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
* tests: Re-add --with-secret optionIngo Klöcker2023-09-041-2/+2
| | | | | | | | | | * tests/run-keylist.c (main): Handle option --with-secret again. -- Re-add handling of --with-secret option that was accidentally removed with the previous commit. GnuPG-bug-id: 6705
* New mode to list a v5 fingerprint for v4 packets.Werner Koch2023-09-041-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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/+7
| | | | | | | | | | | | | * 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
* tests: Support offline mode in run-importIngo Klöcker2023-08-141-0/+9
| | | | | | | | | | * tests/run-import.c (show_usage): New option --offline. (main): Parse new option. Set offline mode accordingly. -- This allows testing gpgme_op_import with (and without) offline mode. GnuPG-bug-id: 6648
* core: Prevent wrong plaintext when verifying clearsigned signatureIngo Klöcker2023-07-282-0/+98
| | | | | | | | | | | | | | | | | | * 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: Support reading the archive to decrypt/verify directly from a fileIngo Klöcker2023-06-212-24/+83
| | | | | | | | | | | | | | | | | | | | | | | | | * 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-192-6/+42
| | | | | | | | | | | | | | | | | | | | | | * 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
* tests: Add option --cancel to run-encrypt.Werner Koch2023-06-151-3/+29
| | | | | | | | | | | * tests/run-encrypt.c (cancel_after_progress): New. (progress_cb): Take care of it. (main): Add option --cancel. -- This tool may now be used to test gpgme_cancel_async. Releated to GnuPG-bug-id: 6534
* core,cpp: Add new key flags to gpgme_subkey_tWerner Koch2023-03-211-3/+6
| | | | | | | | | | | | | | | | | * 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
* tests: Package the ownertrust fileIngo Klöcker2023-03-171-1/+1
| | | | | | | | | tests/gpg/Makefile.am (EXTRA_DIST): Add ownertrust.txt. -- This fixes `make distcheck`. GnuPG-bug-id: 6342
* tests: Add option --binary to run-verifyWerner Koch2023-03-081-0/+8
| | | | | | | | | | * tests/run-verify.c (main): Set encoding. -- gpgsm usually used autodetection of the input format. But sometimes it is required to tell gpgsm that the input is binary encoded. In particular, this allows to strip trailing zeroes from a detached signature.
* tests: Fix cleaning up at the end of the testIngo Klöcker2023-02-101-0/+2
| | | | | | | * tests/gpg/t-import.c (main): Unref key and release context. -- This fixes leaks found with -fsanitize=address.
* core: Allow finalization of signature verification of unencrypted dataIngo Klöcker2023-02-101-0/+31
| | | | | | | | | | | | | | | | * 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
* tests: Stop daemons after setting up test environmentIngo Klöcker2023-02-092-0/+2
| | | | | | | | | | * lang/python/tests/Makefile.am, lang/qt/tests/Makefile.am, tests/gpg/Makefile.am, tests/json/Makefile.am (pubring-stamp): Call `gpgconf --kill all` after importing test keys. -- This ensures that no gpg-agents or other daemons are running after "make".
* tests: Extend tests with an ultimately trusted keyIngo Klöcker2023-02-087-42/+56
| | | | | | | | | | | | | | | | | | | | * tests/gpg/Makefile.am (gpg-sample.stamp, pubring-stamp): Unify usage of tabs. (pubring-stamp): Import owner trust values. * tests/gpg/ownertrust.txt: New. * tests/gpg/t-decrypt-verify.c, tests/gpg/t-verify.c: Update expected values for signature summary and validity. * tests/gpg/t-keylist-secret-sig.c, tests/gpg/t-keylist-sig.c, tests/gpg/t-keylist.c: Update expected values of owner trust and uid validity. -- This change marks the "Alpha Test" test key as ultimately trusted which makes it possible to check for correct values derived from this, i.e. key owner trust, user id validity, signature summary and signature validity. GnuPG-bug-id: 6342
* tests: Make t-edit-sign idempotentIngo Klöcker2023-02-081-3/+56
| | | | | | | | | | | | | | | * tests/gpg/t-edit-sign.c (test_key, test_key_fpr, import_key, delete_key): New. (main): Remove key_fpr. Import test key to sign. Delete test key after test. -- Using a dedicated test key for testing key signing, which is imported before the test and deleted after the test, makes sure that the keys in the test key ring don't change. This is important for stable results of the key listing tests. GnuPG-bug-id: 6342
* core: Support usage of gpgtar for verifying a signed archiveIngo Klöcker2023-01-251-2/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-241-0/+26
| | | | | | | | | | | | | | | | | | * 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-232-0/+32
| | | | | | | | | | | | | * 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-7/+47
| | | | | | | | | | | | | | | | | | | | | | * 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-191-5/+48
| | | | | | | | | | | | | | | | | | | | | | | | | * 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: Support usage of gpgtar for encryptionIngo Klöcker2023-01-181-37/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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