3723 Commits

Author SHA1 Message Date
Werner Koch
62b6c1f16a
Support the Kyber algorithm in key listings.
* 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.
2024-11-14 12:31:21 +01:00
Werner Koch
32b4e4a9b5
Post release updates
--
2024-11-06 11:54:22 +01:00
Werner Koch
98b10fbc63
Release 1.24.0 gpgme-1.24.0 2024-11-06 11:38:59 +01:00
Werner Koch
0ad30e670a
Include the full commit id.
* 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.
2024-11-05 14:19:17 +01:00
Werner Koch
a304ec0ede
core: New context flags "known-notations".
* 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
2024-10-29 12:00:11 +01:00
Werner Koch
c835676f7d
core: Add new helper _gpgme_strtokenize.
* 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.
2024-10-29 12:00:11 +01:00
Ingo Klöcker
e656e51d53
qt: Fix typo
* lang/qt/src/Makefile.am (camelcase_headers): Fix typo in header name.
--
2024-10-23 10:13:25 +02:00
Ingo Klöcker
7d02ba8a93
qt: Put attributes before declarations
* lang/qt/src/downloadjob.h (DownloadJob::start): Move QGPGME_DEPRECATED
before the whole function declaration.
--
2024-10-23 10:12:23 +02:00
Ingo Klöcker
c4b39a7795
cpp: Put attributes before declarations
* lang/cpp/src/key.h (UserID::Signature::Notation): Move
GPGMEPP_DEPRECATED before the whole typedef declaration.
* lang/cpp/src/verificationresult.h (Signature::Notation): Ditto.
--
2024-10-23 10:12:08 +02:00
Ingo Klöcker
bff4b847fc
cpp: Add/change some includes
* lang/cpp/src/gpgaddexistingsubkeyeditinteractor.h,
lang/cpp/src/gpgrevokekeyeditinteractor.h: Include <string>.
* lang/cpp/src/key.h: Include <ctime> instead of <sys/time.h>.
--
2024-10-23 10:01:07 +02:00
Ingo Klöcker
f42e2b0fbd
cpp,doc: Update NEWS
--
2024-10-22 10:34:47 +02:00
Ingo Klöcker
2a05959069
cpp: Add support for new flag fields beta_compliance
* lang/cpp/src/decryptionresult.cpp, lang/cpp/src/decryptionresult.h
(class DecryptionResult): Add method isBetaCompliance.
* lang/cpp/src/decryptionresult.cpp (operator<<): Add new flag.
* lang/cpp/src/key.cpp, lang/cpp/src/key.h (class Key): Add method
isBetaCompliance.
(class Subkey): Add method isBetaCompliance.
* lang/cpp/src/key.cpp:
(Key::isDeVs): Remove duplicate check of is_de_vs of first subkey.
(operator<<): Add new flag.
* lang/cpp/src/verificationresult.cpp, lang/cpp/src/verificationresult.h
(class Signature): Add method isBetaCompliance.
* lang/cpp/src/verificationresult.cpp (operator<<): Add new flag.
--

GnuPG-bug-id: 7346
2024-10-21 14:47:10 +02:00
Ingo Klöcker
f510c5d78c
doc: Fix, update, add API documentation
--
Nowadays, VS-NfD requires RSA 3072. And the documentation of
gpgme_signature_t was missing the compliance flags.
2024-10-21 14:23:44 +02:00
Tobias Fella
227c9c763b
core: fix passing --proc-all-sigs to gpgtar
* src/engine-gpg.c: Pass --gpg-args before passing --proc-all-sigs
  if using gpgtar
--

GnuPG-Bug-ID: 7320
2024-10-09 09:17:11 +02:00
Werner Koch
1a7bc88ee7
core: New flag fields beta_compliance.
* 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
2024-10-07 10:33:13 +02:00
Werner Koch
3bf1ea97bc
core: Allow GPGME_CREATE_ADSK also for gnupg 2.2.45
* src/engine-gpg.c (gpg_addadsk): Extend the version check.
2024-09-26 11:18:56 +02:00
Ingo Klöcker
79ca846993
core: Report failed encryption/signing if gpgtar didn't emit SUCCESS
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
2024-09-20 10:05:30 +02:00
Ingo Klöcker
9747f18962
doc,build: Look for yat2m in $prefix/bin
* configure.ac: Look for yat2m first in $prefix/bin and then in $PATH.
--

This makes sure that yat2m is found in case libgpg-error and gpgme are
installed in the same prefix.
2024-09-17 15:11:12 +02:00
Ingo Klöcker
e4b04ae153
doc,build: Fix "make install" if yat2m isn't available
* configure.ac: Add hint for YAT2M variable. Set HAVE_YAT2M if yat2m was
found.
* doc/Makefile.am (myman_pages): Set to empty string if yat2m isn't
available
--
2024-09-17 14:30:57 +02:00
Sébastien Noel
8e7f443045
doc: Provide a man page for gpgme-json.
* doc/gpgme-json.texi: New.
* configure.ac: Check for yat2m.
* doc/Makefile.am (YAT2M_OPTIONS): New.  Also add all the other man
page stuff similar to what is used in gnupg.
--

ChangeLog entries by wk.
2024-09-10 16:58:29 +02:00
Werner Koch
09b694359f
doc: Update the texinfo version also on gpgme.texi changes.
--
Fixes-commit: 7e7eaf43424556c3c25edc7b67e760ab60de55ce
2024-09-10 16:38:18 +02:00
Werner Koch
cd79fc3973
core: New encryption flags GPGME_ENCRYPT_ADD_RECP and _CHG_RECP.
* 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
2024-09-09 17:33:29 +02:00
Ingo Klöcker
2264b64b85
core: Treat email-only user IDs with upper case letters as email address
* 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
2024-09-04 14:31:12 +02:00
Ingo Klöcker
ecd0c86d62
build,python: Fix build with setuptools 72.2.0+
* lang/python/setup.py.in (BuildExtFirstHack.run): Extend members of the
extension instead of lists that were passed to the extension.
--

setuptools 72.2.0 integrated changes in distutils which included
"Support for Pathlike objects in data files and extensions". With this
change the extensions now take a copy of the sources list passed to the
constructor instead of keeping a reference to the passed list. Hence,
modifying the sources list that was passed to the extension didn't
change the sources list of the extension anymore. This is fixed by
modifying the sources list of the extension directly. For consistency
we do the same for the swig_opts list.

GnuPG-bug-id: 7281
2024-09-02 15:33:25 +02:00
Ingo Klöcker
569348ee84
cpp: Add pkgconfig file for gpgmepp
* configure.ac: Add substitutions GPGMEPP_PKGCONFIG_LIBS,
GPGMEPP_PKGCONFIG_CFLAGS, GPGMEPP_PKGCONFIG_HOST. Apply them. Configure
gpgmepp.pc file.
* lang/cpp/src/Makefile.am (pkgconfigdir, pkgconfig_DATA): New.
(EXTRA_DIST): Add gpgmepp.pc.in.
* lang/cpp/src/gpgmepp.pc.in: New.
--

This pkgconfig file will be used, at least temporarily, by qgpgme
to find gpgmepp, but it's also useful in general for projects that
don't use cmake.

GnuPG-bug-id: 7262
2024-08-29 13:51:38 +02:00
Ingo Klöcker
7579c40124
cpp: Go with default answer on unknown question by key edit interface
* lang/cpp/src/editinteractor.cpp (edit_interactor_callback_impl):
Send empty string to edit interface if General Error occurred.
--

A General Error is usually returned by the nextState function of the
concrete EditInteractor subclasses if gpg asks an unexpected question
which isn't handled by the edit interactor's state machine. In this
case, it's usually safe to go with the default answer. This makes the
edit interactors much more robust.

GnuPG-bug-id: 7274
2024-08-28 16:32:18 +02:00
Ingo Klöcker
409e314582
qt: Add support for new context flag "proc-all-sigs"
* lang/qt/src/decryptverifyarchivejob.cpp,
lang/qt/src/decryptverifyarchivejob.h (DecryptVerifyArchiveJob): Add
member functions setProcessAllSignatures, processAllSignatures.
* lang/qt/src/decryptverifyarchivejob_p.h
(DecryptVerifyArchiveJobPrivate): Add member m_processAllSignatures.
* lang/qt/src/decryptverifyjob.cpp, lang/qt/src/decryptverifyjob.h
(DecryptVerifyJob): Add member functions setProcessAllSignatures,
processAllSignatures.
* lang/qt/src/decryptverifyjob_p.h (DecryptVerifyJobPrivate): Add member
m_processAllSignatures.
* lang/qt/src/qgpgmedecryptverifyarchivejob.cpp
(decrypt_verify_from_file_name): Add argument "processAllSignatures".
Set context flag "proc-all-sigs" if requested.
(QGpgMEDecryptVerifyArchiveJob::start): Set context flag "proc-all-sigs"
if requested.
(QGpgMEDecryptVerifyArchiveJobPrivate::startIt): Pass
m_processAllSignatures to decrypt_verify_from_file_name.
* lang/qt/src/qgpgmedecryptverifyjob.cpp
(decrypt_verify_from_filename): Add argument "processAllSignatures".
Set context flag "proc-all-sigs" if requested.
(QGpgMEDecryptVerifyJob::start, QGpgMEDecryptVerifyJob::exec): Set
context flag "proc-all-sigs" if requested.
(QGpgMEDecryptVerifyJobPrivate::startIt): Pass
m_processAllSignatures to decrypt_verify_from_filename.
* lang/qt/src/qgpgmeverifydetachedjob.cpp (verify_from_filename): Add
argument "processAllSignatures". Set context flag "proc-all-sigs" if
requested.
(QGpgMEVerifyDetachedJob::start, QGpgMEVerifyDetachedJob::exec): Set
context flag "proc-all-sigs" if requested.
(QGpgMEVerifyDetachedJobPrivate::startIt): Pass
m_processAllSignatures to decrypt_verify_from_filename.
* lang/qt/src/qgpgmeverifyopaquejob.cpp (verify_from_filename): Add
argument "processAllSignatures". Set context flag "proc-all-sigs" if
requested.
(QGpgMEVerifyOpaqueJob::start, QGpgMEVerifyOpaqueJob::exec): Set
context flag "proc-all-sigs" if requested.
(QGpgMEVerifyOpaqueJobPrivate::startIt): Pass
m_processAllSignatures to decrypt_verify_from_filename.
* lang/qt/src/verifydetachedjob.cpp, lang/qt/src/verifydetachedjob.h
(VerifyDetachedJob): Add member functions setProcessAllSignatures,
processAllSignatures.
* lang/qt/src/verifydetachedjob_p.h (VerifyDetachedJobPrivate): Add
member m_processAllSignatures.
* lang/qt/src/verifyopaquejob.cpp, lang/qt/src/verifyopaquejob.h
(VerifyOpaqueJob): Add member functions setProcessAllSignatures,
processAllSignatures.
* lang/qt/src/verifyopaquejob_p.h (VerifyOpaqueJobPrivate): Add
member m_processAllSignatures.

* lang/qt/tests/run-decryptverifyarchivejob.cpp,
lang/qt/tests/run-decryptverifyjob.cpp,
lang/qt/tests/run-verifydetachedjob.cpp,
lang/qt/tests/run-verifyopaquejob.cpp (struct CommandLineOptions): Add
member processAllSignatures.
(parseCommandLine): Add command line option --process-all-signatures.
(main): Pass new option to the job.
--

The new option processAllSignatures is added to all jobs that verify
data signatures. By enabling this option, one can tell gpg not to stop
checking signatures after the first bad signature.

GnuPG-bug-id: 6870
2024-08-26 14:08:17 +02:00
Werner Koch
37aa9eee7c
New context flag "proc-all-sigs".
* 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
2024-08-23 13:35:58 +02:00
Ingo Klöcker
0174575c8c
qt,tests: Add make target to clean the keyring
* lang/qt/tests/Makefile.am (clean-keyring): New target.
--

Many tests operate on the keyring in the build directory. If a test
fails then the keyring might be in an unclean state causing subsequent
tests to fail. The new make target allows cleaning the keyring without
resorting to brute force with "make clean".
2024-08-07 10:53:22 +02:00
Ingo Klöcker
a73eee3655
qt: Use --quick-set-ownertrust if available
* lang/qt/src/qgpgmechangeownertrustjob.cpp (set_owner_trust): New.
(QGpgMEChangeOwnerTrustJob::start): Use set_owner_trust if gpg is new
enough.

* lang/qt/tests/t-ownertrust.cpp
(ChangeOwnerTrustTest::testChangeOwnerTrust): Log unexpected error.
--

Using the --quick-set-ownertrust command to set the owner trust is much
more robust than using the edit interface. Prefer the former if gpg
supports it.

GnuPG-bug-id: 7239
2024-08-07 10:53:21 +02:00
Ingo Klöcker
668a1344c6
tests,json: Remove no longer needed code
* 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).
2024-08-07 10:53:21 +02:00
Ingo Klöcker
63822343df
qt: Support disabling and enabling of keys
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/job.cpp (QuickJob): Move definition of constructor and
destructor and inclusion of the moc file to quickjob.cpp.
* lang/qt/src/qgpgmequickjob.cpp (class QGpgMEQuickJobPrivate): New.
(QGpgMEQuickJob::QGpgMEQuickJob): Instantiate private job class.
(set_key_enabled): New.
* lang/qt/src/quickjob.cpp: New.
* lang/qt/src/quickjob.h (class QuickJob): Add member function
startSetKeyEnabled.
* lang/qt/src/quickjob_p.h: New.

* lang/qt/tests/Makefile.am: Add new test for Qt 5 and Qt 6.
* lang/qt/tests/t-disablekey.cpp: New.
--

GnuPG-bug-id: 7239
2024-08-07 10:53:21 +02:00
Ingo Klöcker
d5f612e968
cpp: Add support for setting owner trust and for disabling keys
* lang/cpp/src/context.cpp, lang/cpp/src/context.h (class Context): Add
member functions setOwnerTrust, startSetOwnerTrust, setKeyEnabled,
startSetKeyEnabled.
* lang/cpp/src/context.cpp (owner_trust_to_string): New.
--

GnuPG-bug-id: 7239
2024-08-06 17:56:43 +02:00
Ingo Klöcker
d804a7a4bc
core: New function gpgme_op_setownertrust
* 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
2024-08-06 12:43:28 +02:00
Ingo Klöcker
9272b0fb6e
w32: Use UTF-8 for localized error descriptions for all threads
* 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
2024-08-05 12:16:35 +02:00
Ingo Klöcker
5c095553e4
build,qt: Fix include path in CMake files
* lang/qt/src/Makefile.am (QGpgmeConfig.cmake, QGpgmeQt6Config.cmake):
Use new variables includeprefix{5,6} instead of replaced variable
includeprefix.
--

GnuPG-bug-id: 7205
2024-07-22 10:32:00 +02:00
Ingo Klöcker
9ab2ce36f9
build,qt: Don't put generated camel-case headers in tarball
* lang/qt/src/Makefile.am: Change camelcase5include_HEADERS to
nodist_camelcase5include_HEADERS. Change camelcase6include_HEADERS to
nodist_camelcase6include_HEADERS.
--
2024-07-18 16:16:33 +02:00
Ingo Klöcker
c69240c843
core: Remove obsolete source files
* src/isascii.c, src/putc_unlocked.c: Remove.
--

I noticed those files when I compared the content of the dist tarball
with the repo.
2024-07-18 15:51:44 +02:00
Ingo Klöcker
42e151b34b
build,qt: Allow building Qt 5 bindings and Qt 6 bindings
* configure.ac: Remove "qt" from default_languages. Add "qt5 qt6" to
default_languages. Remove "qt" from help for --enable-languages. Don't
fail anymore if "qt5" and "qt6" are enabled. Warn that "qt" is
deprecated if it was enabled.
* lang/qt/src/Makefile.am (libqgpgme_la, libqgpgmeqt6_la): New.
(lib_LTLIBRARIES): Set Qt 5 and/or Qt 6 variant of libqgpgme.
(AM_CPPFLAGS): Replace with libqgpgme_la_CPPFLAGS for Qt 5 and
libqgpgmeqt6_la_CPPFLAGS for Qt 6.
--

This makes it possible to build QGpgME simultaneously for Qt 5 and Qt 6.
By default, QGpgME is now built for all versions of Qt that are found.
Specifying "qt" as language is deprecated.

GnuPG-bug-id: 7205
2024-07-18 14:42:30 +02:00
Ingo Klöcker
e6830b58b6
build,qt: Decouple generation of moc files
* m4/qt5.m4: Export moc for Qt 5 in variable MOC5. Unset temporary MOC2.
* m4/qt6.m4: Export moc for Qt 6 in variable MOC6.
* lang/qt/src/Makefile.am: Generate .moc5 files from .h files. Generate
.moc forwarding headers in moc5 subfolder. Add moc5 subfolder to include
paths for Qt 5-based qgpgme library. Ditto for Qt 6. Clean up moc5 and
moc6 subfolders.
* lang/qt/tests/Makefile.am: List tests and test runners for Qt 5 and
Qt 6. Generate .moc5 files from .cpp files of tests. Generate .moc
forwarding headers in moc5 subfolder. Generate .hmoc file from
t-support.h directly in moc5 subfolder. Add moc5 subfolder to include
paths for all Qt 5-based tests and runners. Ditto for Qt 6. Specify
sources, LDADD and CPPFLAGS for all tests and test runners for Qt 5 and
Qt 6. Clean up moc5 and moc6 subfolders.
--

The output of Qt 5's moc and Qt 6's moc is incompatible. Therefore, we
need to generate different .moc files for Qt 5 and Qt 6 to support
co-building of the Qt 5 and Qt 6 bindings. The duplication of the
listing of the tests couldn't be avoided because automake doesn't
understand `the_tests5 = $(the_tests:%=%5)` and couldn't match the
tests with their _SOURCES. Maybe some m4 programming would have helped,
but that would have made the Makefiles even more unreadable.

GnuPG-bug-id: 7205
2024-07-18 14:41:52 +02:00
Ingo Klöcker
899a572b33
build,qt: Remove include directories on uninstall
* lang/qt/src/Makefile.am (uninstall-include-dirs-qt5,
uninstall-include-dirs-qt6): New targets.
(uninstall_include_dirs_qt5, uninstall_include_dirs_qt6): New variables.
(uninstall-local): Replace with...
(uninstall-hook): ...this. Add new uninstall_include_dirs_qt* variables.
--

We have to use uninstall-hook because uninstall-local runs before the
header files have been removed from the include folders we want to
remove.

GnuPG-bug-id: 7205
2024-07-18 14:41:32 +02:00
Ingo Klöcker
69558f2c0b
build,qt: Decouple handling of include headers
* lang/qt/src/Makefile.am (includeprefix): Replace with...
(includeprefix5, includeprefix6): ...these.
(qgpgmeincludedir): Replace with...
(qgpgme5includedir, qgpgme6includedir): ...these.
(qgpgmeinclude_HEADERS): Replace with...
(qgpgme5include_HEADERS, qgpgme6include_HEADERS): ...these.
(nodist_qgpgmeinclude_HEADERS): Replace with...
(nodist_qgpgme5include_HEADERS, nodist_qgpgme6include_HEADERS): ..these.
(camelcaseincludedir): Replace with...
(camelcase5includedir, camelcase6includedir): ...these.
(camelcaseinclude_HEADERS): Replace with...
(camelcase5include_HEADERS, camelcase6include_HEADERS): ...these.
--

This prepares the code for the case that WANT_QT5 and WANT_QT6 are both
true.

GnuPG-bug-id: 7205
2024-07-18 14:40:37 +02:00
Ingo Klöcker
576d2db9dd
build,qt: Decouple (un)install of CMake files
* lang/qt/src/Makefile.am (install-cmake-files): Rename target to
install-cmake-files-qt5 and install-cmake-files-qt6.
(uninstall-cmake-files): Rename target to uninstall-cmake-files-qt5 and
uninstall-cmake-files-qt6.
(install_cmake_files_qt5, uninstall_cmake_files_qt5,
install_cmake_files_qt6, uninstall_cmake_files_qt6): New variables.
(install-data-local): Depend on both install-cmake-files-qt* targets.
(uninstall-local): Depend on both uninstall-cmake-files-qt* targets.
--

This prepares the targets for the case that WANT_QT5 and WANT_QT6 are
both true.

GnuPG-bug-id: 7205
2024-07-18 14:35:46 +02:00
Ingo Klöcker
aa15a664b3
core: Support all keylist modes and fix possible overrun
* 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.
2024-07-15 22:19:13 +02:00
Ingo Klöcker
e46748a0d1
build,cpp: Fix include paths in forwarding headers in gpgme++ folder
* lang/cpp/src/Makefile.am (build rule for copied headers): Write
abs_srcdir instead of srcdir in the generated headers.
--

The generated include paths lacked a "../" if srcdir was relative. This
lead to self-including includes for in-source builds. Including the real
headers with their absolute paths fixes this.

GnuPG-bug-id: 7110
2024-07-10 23:28:27 +02:00
Ingo Klöcker
f6d020e24f
qt: Replace usage of deprecated Error::asString
* lang/qt/src/debug.cpp (operator<<): Use Error::asStdString instead of
Error::asString.
* lang/qt/src/qgpgmedecryptverifyjob.cpp (decrypt_verify),
lang/qt/src/qgpgmenewcryptoconfig.cpp
(QGpgMENewCryptoConfigComponent::sync),
lang/qt/src/qgpgmewkdlookupjob.cpp (startDirmngr): Use QDebug operator
for Error instead of Error::asString.
* lang/qt/src/threadedjobmixin.cpp (_detail::audit_log_as_html): Use
errorAsString instead of Error::asString.
* lang/qt/src/util.h (errorAsString): New.

* lang/qt/tests/run-decryptverifyarchivejob.cpp (main),
lang/qt/tests/run-decryptverifyjob.cpp (main),
lang/qt/tests/run-encryptarchivejob.cpp (main),
lang/qt/tests/run-encryptjob.cpp (main),
lang/qt/tests/run-exportjob.cpp (main),
lang/qt/tests/run-importjob.cpp (main),
lang/qt/tests/run-receivekeysjob.cpp (main),
lang/qt/tests/run-refreshkeysjob.cpp (main),
lang/qt/tests/run-signarchivejob.cpp (main),
lang/qt/tests/run-signjob.cpp (main),
lang/qt/tests/run-verifydetachedjob.cpp (main),
lang/qt/tests/run-verifyopaquejob.cpp (main),
lang/qt/tests/run-wkdrefreshjob.cpp (main),
lang/qt/tests/t-ownertrust.cpp (testChangeOwnerTrust),
lang/qt/tests/t-remarks.cpp (testRemarkOwnKey),
lang/qt/tests/t-tofuinfo.cpp (testTofuPolicy): Use QDebug operator for
Error instead of Error::asString.
* lang/qt/tests/t-changeexpiryjob.cpp (all test functions),
lang/qt/tests/t-trustsignatures.cpp (all test functions),
lang/qt/tests/t-various.cpp (testSignKeyWithoutExpiration,
testSignKeyWithExpiration): Use errorAsString instead of
Error::asString.
--

GnuPG-bug-id: 7188
2024-07-05 10:05:51 +02:00
Ingo Klöcker
28542b14c4
cpp: Deprecate Error::asString and update users
* lang/cpp/src/error.h (Error::asString): Mark as deprecated.
* lang/cpp/src/context.cpp (operator<<),
lang/cpp/src/editinteractor.cpp (edit_interactor_callback_impl),
lang/cpp/tests/run-getkey.cpp (main),
lang/cpp/tests/run-keylist.cpp (main),
lang/cpp/tests/run-wkdlookup.cpp (main): Use Error::asStdString instead
of Error::asString.
--

GnuPG-bug-id: 7188
2024-07-05 10:05:51 +02:00
Ingo Klöcker
2656d3ee5b
cpp: Add safer member function returning text describing an error
* lang/cpp/src/error.h, lang/cpp/src/context.cpp (class Error): New
member function asStdString.
--

Unlike asString the new function doesn't cache the value returned by
gpgme_strerror_r. This ensures that on Windows the UTF-8 encoded text
is returned for the main thread even if the function was called before
for another thread. For other threads asStdString will still return the
natively encoded error description until UTF-8 encoded error
descriptions can be enabled for all threads (T7185).

GnuPG-bug-id: 7188
2024-07-05 10:05:51 +02:00
Ingo Klöcker
acf574af64
qt: Always include C++ binding headers with gpgme++/ prefix
* lang/qt/src/Makefile.am, lang/qt/tests/Makefile.am (AM_CPPFLAGS):
Add builddir instead of srcdir of C++ bindings as include path.
* lang/qt/src/changeexpiryjob.cpp, lang/qt/src/changeexpiryjob.h,
lang/qt/src/changeownertrustjob.h, lang/qt/src/dataprovider.cpp,
lang/qt/src/dataprovider.h, lang/qt/src/debug.cpp,
lang/qt/src/decryptverifyarchivejob.cpp,
lang/qt/src/decryptverifyarchivejob.h,
lang/qt/src/encryptarchivejob.cpp, lang/qt/src/encryptarchivejob.h,
lang/qt/src/encryptjob.h, lang/qt/src/encryptjob_p.h,
lang/qt/src/filelistdataprovider.cpp,
lang/qt/src/filelistdataprovider.h,
lang/qt/src/hierarchicalkeylistjob.h, lang/qt/src/importjob.cpp,
lang/qt/src/importjob.h, lang/qt/src/importjob_p.h, lang/qt/src/job.h,
lang/qt/src/keyformailboxjob.h, lang/qt/src/keylistjob.h,
lang/qt/src/listallkeysjob.h, lang/qt/src/multideletejob.cpp,
lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp,
lang/qt/src/qgpgmeadduseridjob.cpp, lang/qt/src/qgpgmebackend.cpp,
lang/qt/src/qgpgmechangeexpiryjob.cpp,
lang/qt/src/qgpgmechangeownertrustjob.cpp,
lang/qt/src/qgpgmechangepasswdjob.cpp, lang/qt/src/qgpgmedecryptjob.cpp,
lang/qt/src/qgpgmedecryptjob.h,
lang/qt/src/qgpgmedecryptverifyarchivejob.cpp,
lang/qt/src/qgpgmedecryptverifyarchivejob.h,
lang/qt/src/qgpgmedecryptverifyjob.cpp,
lang/qt/src/qgpgmedecryptverifyjob.h, lang/qt/src/qgpgmedeletejob.cpp,
lang/qt/src/qgpgmedownloadjob.cpp,
lang/qt/src/qgpgmeencryptarchivejob.cpp,
lang/qt/src/qgpgmeencryptarchivejob.h, lang/qt/src/qgpgmeencryptjob.cpp,
lang/qt/src/qgpgmeencryptjob.h, lang/qt/src/qgpgmeexportjob.cpp,
lang/qt/src/qgpgmeimportfromkeyserverjob.cpp,
lang/qt/src/qgpgmeimportfromkeyserverjob.h,
lang/qt/src/qgpgmeimportjob.cpp, lang/qt/src/qgpgmeimportjob.h,
lang/qt/src/qgpgmekeyformailboxjob.h,
lang/qt/src/qgpgmekeygenerationjob.cpp,
lang/qt/src/qgpgmekeygenerationjob.h, lang/qt/src/qgpgmekeylistjob.cpp,
lang/qt/src/qgpgmekeylistjob.h, lang/qt/src/qgpgmelistallkeysjob.cpp,
lang/qt/src/qgpgmelistallkeysjob.h,
lang/qt/src/qgpgmenewcryptoconfig.cpp,
lang/qt/src/qgpgmenewcryptoconfig.h, lang/qt/src/qgpgmequickjob.cpp,
lang/qt/src/qgpgmereceivekeysjob.h,
lang/qt/src/qgpgmerefreshsmimekeysjob.cpp,
lang/qt/src/qgpgmerefreshsmimekeysjob.h,
lang/qt/src/qgpgmerevokekeyjob.cpp,
lang/qt/src/qgpgmesetprimaryuseridjob.cpp,
lang/qt/src/qgpgmesignarchivejob.cpp,
lang/qt/src/qgpgmesignarchivejob.h,
lang/qt/src/qgpgmesignencryptarchivejob.cpp,
lang/qt/src/qgpgmesignencryptarchivejob.h,
lang/qt/src/qgpgmesignencryptjob.cpp,
lang/qt/src/qgpgmesignencryptjob.h, lang/qt/src/qgpgmesignjob.cpp,
lang/qt/src/qgpgmesignjob.h, lang/qt/src/qgpgmesignkeyjob.cpp,
lang/qt/src/qgpgmetofupolicyjob.cpp,
lang/qt/src/qgpgmeverifydetachedjob.cpp,
lang/qt/src/qgpgmeverifydetachedjob.h,
lang/qt/src/qgpgmeverifyopaquejob.cpp,
lang/qt/src/qgpgmeverifyopaquejob.h, lang/qt/src/qgpgmewkdlookupjob.cpp,
lang/qt/src/qgpgmewkdrefreshjob.cpp, lang/qt/src/qgpgmewkdrefreshjob.h,
lang/qt/src/qgpgmewkspublishjob.cpp, lang/qt/src/quickjob.h,
lang/qt/src/signarchivejob.cpp, lang/qt/src/signarchivejob.h,
lang/qt/src/signencryptarchivejob.cpp,
lang/qt/src/signencryptarchivejob.h, lang/qt/src/signencryptjob.h,
lang/qt/src/signencryptjob_p.h, lang/qt/src/signjob.h,
lang/qt/src/signjob_p.h, lang/qt/src/threadedjobmixin.cpp,
lang/qt/src/threadedjobmixin.h, lang/qt/src/tofupolicyjob.h,
lang/qt/src/util.cpp, lang/qt/src/wkdlookupresult.cpp,
lang/qt/src/wkdlookupresult.h, lang/qt/src/wkdrefreshjob_p.h,
lang/qt/tests/run-decryptverifyarchivejob.cpp,
lang/qt/tests/run-decryptverifyjob.cpp,
lang/qt/tests/run-encryptarchivejob.cpp,
lang/qt/tests/run-encryptjob.cpp, lang/qt/tests/run-exportjob.cpp,
lang/qt/tests/run-importjob.cpp, lang/qt/tests/run-keyformailboxjob.cpp,
lang/qt/tests/run-receivekeysjob.cpp,
lang/qt/tests/run-refreshkeysjob.cpp,
lang/qt/tests/run-signarchivejob.cpp, lang/qt/tests/run-signjob.cpp,
lang/qt/tests/run-verifydetachedjob.cpp,
lang/qt/tests/run-verifyopaquejob.cpp,
lang/qt/tests/run-wkdrefreshjob.cpp,
lang/qt/tests/t-addexistingsubkey.cpp,
lang/qt/tests/t-changeexpiryjob.cpp, lang/qt/tests/t-config.cpp,
lang/qt/tests/t-decryptverify.cpp, lang/qt/tests/t-encrypt.cpp,
lang/qt/tests/t-import.cpp, lang/qt/tests/t-keylist.cpp,
lang/qt/tests/t-keylocate.cpp, lang/qt/tests/t-ownertrust.cpp,
lang/qt/tests/t-remarks.cpp, lang/qt/tests/t-revokekey.cpp,
lang/qt/tests/t-setprimaryuserid.cpp, lang/qt/tests/t-support.cpp,
lang/qt/tests/t-support.h, lang/qt/tests/t-tofuinfo.cpp,
lang/qt/tests/t-trustsignatures.cpp, lang/qt/tests/t-various.cpp,
lang/qt/tests/t-verify.cpp, lang/qt/tests/t-wkdlookup.cpp,
lang/qt/tests/t-wkspublish.cpp: Include GpgME++ headers with gpgme++/
prefix.
--

This prepares the Qt bindings for building them separately from the C++
bindings.

GnuPG-bug-id: 7110
2024-07-05 10:05:50 +02:00
Ingo Klöcker
b7435b31f6
build,cpp: Create forwarding headers in a gpgme++ folder
* lang/cpp/src/Makefile.am (copied_headers): New.
(build rule for all copied headers): New.
(BUILT_SOURCES): New.
(CLEANFILES): Add copied_headers.
--

The forwarding headers make it easier to use the headers from the Qt
bindings when building them against the built but not installed C++
bindings because we can always include the C++ headers with gpgme++/
prefix. This also helps to avoid including a C++ header with the same
name as a header in the Qt bindings (e.g. util.h).

GnuPG-bug-id: 7110
2024-07-05 10:02:45 +02:00