Commit Graph

3600 Commits

Author SHA1 Message Date
Tobias Fella
e18c09cbc4
qt: Fix validity for (sub)keys generated using QGpgMEQuickJob
* lang/qt/src/qgpgmequickjob.cpp: Fix expiration calculation
--

The job calculates the validity as the seconds since epoch,
while GPG expects the seconds since the current time.
This leads to the validity being significantly longer than expected.

GnuPG-Bug-Id: 6889
2023-12-13 16:43:22 +01:00
Andre Heinecke
6baccdc0c3
core: percent decode filename
* 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
2023-11-30 00:06:08 +01:00
Werner Koch
f212de4a9e
Post release updates
--
2023-11-28 16:48:37 +01:00
Werner Koch
1a26db7175
Release 1.23.2 2023-11-28 16:42:59 +01:00
Ingo Klöcker
1bbe2d4b70
qt: Start dirmngr with gpgconf to avoid multiple instances
* lang/qt/src/qgpgmewkdlookupjob.cpp (startDirmngr): Use "gpgconf
--launch dirmngr" to start dirmngr.
--

Using gpgconf to start dirmngr prevents multiple instances to be started
by the concurrently running keyserver lookup and WKD lookup.

GnuPG-bug-id: 6833
2023-11-23 16:13:39 +01:00
Ingo Klöcker
618fea9e20
qt: On Windows, use UTF-8 when logging the error text
* lang/qt/src/debug.cpp (operator<<): On Windows, interpret the error
text as UTF-8 instead of local 8-bit encoding.
--

GnuPG-bug-id: 5960
2023-11-15 11:57:18 +01:00
Ingo Klöcker
278f92b189
qt: Remove left-over partial files more persistently
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/cleaner.cpp, lang/qt/src/cleaner.h: New.
* lang/qt/src/util.cpp (PartialFileGuard::~PartialFileGuard): Call
Cleaner::removeFile instead of removeFile.
* lang/qt/src/util.cpp, lang/qt/src/util.h (removeFile): Remove.
--

If the initial attempt to remove the file fails then a Cleaner is
created that tries to remove the file at regular intervals (10 s)
and on destruction (which happens on application shutdown).

GnuPG-bug-id: 6584
2023-11-15 11:57:18 +01:00
NIIBE Yutaka
185ab7d7ba
doc: Fix for e.g. and i.e.
--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-11-15 15:21:07 +09:00
Ingo Klöcker
77e982579c
core: Preserve more specific existing failure code
* 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
2023-11-14 13:51:24 +01:00
Werner Koch
1bfd5e92d0
tests: Add option --chain to run-keylist
* tests/run-keylist.c (xstrdup): New.
(main): Add option.
--

This allows to list the entire chain.
2023-11-10 09:45:35 +01:00
Ingo Klöcker
52d59d75ca
qt: Deprecate DefaultKeyGenerationJob
* lang/qt/src/defaultkeygenerationjob.h (class DefaultKeyGenerationJob):
Deprecate.
--

GnuPG generates Ed25519 keys by default and has switched to 3072 bits as
default for RSA keys. DefaultKeyGenerationJob always generates RSA 2048
keys and uses the old parameter file API of GnuPG. It shouldn't be used
anymore.

GnuPG-bug-id: 6805
2023-11-10 08:55:07 +01:00
Ingo Klöcker
ae332749ee
build,qt: Build Qt with -fPIC if required or requested
* configure.ac: Add option to enable building the Qt 6 binding with
-fPIC. Fix typo and mention default for --enable-no-direct-extern-access
option.
* m4/qt6.m4: Add -fPIC to GPGME_QT6_CFLAGS if requested or if Qt 6 was
built with reduce_relocations.
--

GnuPG-bug-id: 6781
2023-10-30 09:42:09 +01:00
Ingo Klöcker
cf88690cf4
Update NEWS
--
2023-10-27 16:14:01 +02:00
Ingo Klöcker
46f5d5eeb3
qt: Use temporary .part file names when creating archives
* lang/qt/src/util.h, lang/qt/src/util.cpp (class PartialFileGuard):
New.
* lang/qt/src/util.cpp (getRandomCharacters, createPartFileName): New.
* lang/qt/src/qgpgmeencryptarchivejob.cpp (encrypt_to_filename): Use
PartialFileGuard.
* lang/qt/src/qgpgmesignarchivejob.cpp (sign_to_filename): Ditto.
* lang/qt/src/qgpgmesignencryptarchivejob.cpp
(sign_encrypt_to_filename): Ditto.
--

When creating signed and/or encrypted archives, gpgtar now writes the
result to a temporary file name. On success, the archive is renamed to
the final file name. Otherwise, the (partially written) temporary file
is removed (if possible).

GnuPG-bug-id: 6721
2023-10-27 16:07:34 +02:00
Ingo Klöcker
8d8985bda1
qt: Refactor removal of output file on cancel or error
* lang/qt/src/util.h, lang/qt/src/util.cpp (removeFile): New.
* lang/qt/src/qgpgmeencryptarchivejob.cpp (encrypt): Move removal of
output file from here
(encrypt_to_filename): ... to here and use new function.
* lang/qt/src/qgpgmesignarchivejob.cpp (sign): Move removal of output
file from here
(sign_to_filename): ... to here and use new function.
* lang/qt/src/qgpgmesignencryptarchivejob.cpp (sign_encrypt): Move
removal of output file from here
(sign_encrypt_to_filename): ... to here and use new function.
--

GnuPG-bug-id: 6721
2023-10-27 16:07:34 +02:00
Werner Koch
0a0a5906d5
Post release updates
--
2023-10-27 14:41:52 +02:00
Werner Koch
cadcb38469
Release 1.23.1
--

This is minor fix to the spawn helper.  No change to the library code.

GnuPG-bug-id: 6774
2023-10-27 14:36:15 +02:00
Andre Heinecke
a0a4cd411c
Change gpgme-w32-spawn to unicode
* 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
2023-10-25 17:42:27 +02:00
Werner Koch
8faaf7b72b
Post release updates
--
2023-10-25 11:16:19 +02:00
Werner Koch
aae967ec9c
Release 1.23.0 2023-10-25 11:05:29 +02:00
Andre Heinecke
ab25df8328
qt: Handle cancel in changeexpiryjob
* lang/qt/src/qgpgmechangeexpiryjob.cpp (change_expiry): Return
cancel error.

--
The classical "cancel is not an error" problem.
GnuPG-Bug-Id: T6754
2023-10-18 11:13:35 +02:00
Ingo Klöcker
5c7e4d252a
qt,doc: Fix typos in source code comments
--

Anonymous contribution

Signed-off-by: Ingo Klöcker <dev@ingo-kloecker.de>
2023-10-13 09:23:24 +02:00
Ingo Klöcker
131384b107
python,doc: Fix typos in documentation and source code comments
--

Anonymous contribution

Signed-off-by: Ingo Klöcker <dev@ingo-kloecker.de>
2023-10-13 09:22:36 +02:00
Ingo Klöcker
bd448c9cbf
cpp,doc: Fix typos in API documentation and source code comments
--

Anonymous contribution

Signed-off-by: Ingo Klöcker <dev@ingo-kloecker.de>
2023-10-13 09:21:47 +02:00
Ingo Klöcker
57205c1dfa
doc: Fix typos in documentation and source code comments
--

Anonymous contribution

Signed-off-by: Ingo Klöcker <dev@ingo-kloecker.de>
2023-10-13 09:18:12 +02:00
Marius P
959f976dfc
python,examples: Add missing word "License"
* lang/python/examples/howto/add-userid.py,
lang/python/examples/howto/clear-sign-file.py,
lang/python/examples/howto/create-key.py,
lang/python/examples/howto/decrypt-file.py,
lang/python/examples/howto/detach-sign-file.py,
lang/python/examples/howto/encrypt-file.py,
lang/python/examples/howto/encrypt-sign-file.py,
lang/python/examples/howto/encrypt-to-group-gullible.py,
lang/python/examples/howto/encrypt-to-group-trustno1.py,
lang/python/examples/howto/encrypt-to-group.py,
lang/python/examples/howto/export-key.py,
lang/python/examples/howto/export-minimised-key.py,
lang/python/examples/howto/export-secret-key.py,
lang/python/examples/howto/export-secret-keys.py,
lang/python/examples/howto/groups.py,
lang/python/examples/howto/import-key.py,
lang/python/examples/howto/import-keybasekey.py,
lang/python/examples/howto/import-keys-hkp.py,
lang/python/examples/howto/import-keys.py,
lang/python/examples/howto/import-mailvelope-keys.py,
lang/python/examples/howto/keycount.py,
lang/python/examples/howto/local-sign-group.py,
lang/python/examples/howto/mutt-groups.py,
lang/python/examples/howto/pmkey-import-alt.py,
lang/python/examples/howto/pmkey-import-hkp-alt.py,
lang/python/examples/howto/pmkey-import-hkp.py,
lang/python/examples/howto/pmkey-import.py,
lang/python/examples/howto/revoke-userid.py,
lang/python/examples/howto/send-key-to-keyserver.py,
lang/python/examples/howto/sign-file.py,
lang/python/examples/howto/sign-key.py,
lang/python/examples/howto/symcrypt-file.py,
lang/python/examples/howto/temp-homedir-config.py,
lang/python/examples/howto/verify-signatures.py,
lang/python/examples/howto/verify-signed-file.py: Add "License" after
"Lesser General Public"
--

Anonymous contribution

Signed-off-by: Ingo Klöcker <dev@ingo-kloecker.de>
2023-10-13 09:08:39 +02:00
Ingo Klöcker
a9e5a25b56
cpp: Support new key capability flags
* lang/cpp/src/key.cpp, lang/cpp/src/key.h (class Key): New methods
hasCertify, hasSign, hasEncrypt, hasAuthenticate.
--

GnuPG-bug-id: 6748
2023-10-05 15:27:52 +02:00
Ingo Klöcker
0132a1089f
doc: Fix typo
--
2023-10-05 15:12:29 +02:00
Werner Koch
b63d203d3b
core: Add key capability flags has_encrypt etc.
* 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
2023-10-05 14:18:03 +02:00
Werner Koch
349a69b5ea
core: Check STATUS_FAILURE in export operations.
* 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.
2023-10-05 14:17:21 +02:00
NIIBE Yutaka
8ad22290df
gpgme-tool: Support use of Windows HANDLE for INPUT/OUTPUT/MESSAGE.
* src/gpgme-tool.c [HAVE_W32_SYSTEM] (server_data_obj): Implement for
Windows HANDLE.

--

GnuPG-bug-id: 6634
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-09-29 11:12:13 +09:00
Ingo Klöcker
d43d787e9a
qt: Use UTF-8 for file names on Windows
* lang/qt/src/qgpgmedecryptverifyarchivejob.cpp
(decrypt_verify_from_file_name): On Windows, convert Unicode file name
to UTF-8.
* lang/qt/src/qgpgmeencryptarchivejob.cpp (encrypt,
encrypt_to_filename): On Windows, convert Unicode file name from/to
UTF-8.
* lang/qt/src/qgpgmesignarchivejob.cpp (sign, sign_to_filename): Ditto.
* lang/qt/src/qgpgmesignencryptarchivejob.cpp (sign_encrypt,
sign_encrypt_to_filename): Ditto.
--

On Windows, GnuPG expects file names to be UTF-8-encoded. This fixes
encrypting and decrypting folders with umlauts in the folder name and
in the file name of the archive. Encrypting and decrypting folders
with kanji still fails.

GnuPG-bug-id: 6728
2023-09-22 10:22:18 +02:00
Ingo Klöcker
4e321a0f06
build,qt: Autodetect whether Qt was built with -mno-direct-extern-access
* m4/qt6.m4: Check the build configuration of Qt 6 for
no_direct_extern_access.
--

If building with -mno-direct-extern-access has been neither enabled nor
disabled explicitly, then check whether Qt 6 was built with this flag.
The check is skipped, if we build for Windows.

GnuPG-bug-id: 6696
2023-09-21 22:53:00 +02:00
Ingo Klöcker
927f129663
build,qt: Optionally build Qt 6 bindings with -mno-direct-extern-access
* configure.ac: Check if C++ compiler supports
-mno-direct-extern-access. Add option to enable building with
-mno-direct-extern-access.
* m4/ax_check_compile_flag.m4: New.
* m4/qt6.m4: Add -mno-direct-extern-access to GPGME_QT6_CFLAGS if
supported and requested.
--

This adds the possibility to build the Qt 6 bindings with the
-mno-direct-extern-access flag. This is required if Qt 6 was built with
this flag. This is a workaround for the lack of Qt 6's pkgconfig files
providing this flag if needed.

GnuPG-bug-id: 6696
2023-09-21 10:58:27 +02:00
Ingo Klöcker
3e64856208
build,qt: Drop broken check for -fPIC
* m4/qt6.m4: Remove attempt to build a Qt program with -fPIC.
--

libtool already takes care of adding -fPIC. Moreover, building without
-fPIC succeeded even if Qt was built with -fPIC, i.e. the check didn't
work as intended.

GnuPG-bug-id: 6696
2023-09-21 10:45:09 +02:00
Ingo Klöcker
8fde9cbe22
tests: Re-add --with-secret option
* 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
2023-09-04 17:31:18 +02:00
Werner Koch
e36b2d1bce
New mode to list a v5 fingerprint for v4 packets.
* 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
2023-09-04 17:03:52 +02:00
NIIBE Yutaka
b80d52a1f7
build: Change the default for --with-libtool-modification.
* configure.ac (--with-libtool-modification): default=never.

--

GnuPG-bug-id: 6619
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-09-01 14:06:25 +09:00
Werner Koch
d75b2a9151
Support GPGME_ENCRYPT_ALWAYS_TRUST also for S/MIME.
* 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
2023-08-31 12:02:02 +02:00
Ingo Klöcker
3f297387bf
qt: Allow specifying user IDs to use when refreshing keys via WKD
* lang/qt/src/wkdrefreshjob.h, lang/qt/src/wkdrefreshjob.cpp
(WKDRefreshJob::start): New overload.
* lang/qt/src/wkdrefreshjob_p.h (WKDRefreshJobPrivate): Add field
m_userIds.
* lang/qt/src/qgpgmewkdrefreshjob.cpp (toEmailAddresses): New.
(locate_external_keys): Change return type and arguments.
(refresh_keys): Remove.
(QGpgMEWKDRefreshJobPrivate::startIt): Get emails from keys or user IDs.
Remove duplicates. Call locate_external_keys instead of refresh_keys.

* lang/qt/tests/run-wkdrefreshjob.cpp (CommandLineOptions,
parseCommandLine): New.
(main): Support new option --all-userids.
--

The new start() overload allows to specify the user IDs to use for the
WKD lookup explicitly. This allows updating user IDs via WKD which were
originally not retrieved via WKD.

GnuPG-bug-id: 6672
2023-08-23 12:00:26 +02:00
Christian Hesse
aee18a2ab2
qt,tests: Fix build in source directory, part 2
* lang/qt/tests/Makefile.am (AM_CPPFLAGS): Include Qt binding sources
before C++ binding sources and C sources.
--

This fixes the problem that the debug.h in the C sources was found
before the one in the Qt bindings.

Commit d23528cadf fixed it for Qt5, we
need Qt6 as well.

GnuPG-bug-id: 6673
2023-08-22 11:15:01 +02:00
Ingo Klöcker
24a8c279da
build: Suggest out-of-source build
* autogen.rc (final_info): Suggest to run configure from a build
subdirectory.
--

We recommend out-of-source builds. The suggestion what to do next shown
by autogen.sh should reflect this.

GnuPG-bug-id: 6673
2023-08-21 21:32:40 +02:00
Ingo Klöcker
d23528cadf
qt,tests: Fix build in source directory
* lang/qt/tests/Makefile.am (AM_CPPFLAGS): Include Qt binding sources
before C++ binding sources and C sources.
--

This fixes the problem that the debug.h in the C sources was found
before the one in the Qt bindings.

GnuPG-bug-id: 6673
2023-08-21 21:08:01 +02:00
Ingo Klöcker
2ad36f7114
qt: Add job for refreshing OpenPGP keys via WKD
* lang/qt/src/wkdrefreshjob.cpp, lang/qt/src/wkdrefreshjob.h,
lang/qt/src/wkdrefreshjob_p.h, lang/qt/src/qgpgmewkdrefreshjob.cpp,
lang/qt/src/qgpgmewkdrefreshjob.h: New.
* lang/qt/src/protocol.h (class Protocol): Add pure virtual member
function wkdRefreshJob
* lang/qt/src/protocol_p.h (Protocol::wkdRefreshJob): ... and
implement it.
* lang/qt/src/Makefile.am: Update accordingly.

* lang/qt/tests/run-wkdrefreshjob.cpp: New.
* lang/qt/tests/Makefile.am: Add new test runner.
--

This job allows updating keys via WKD. Only user IDs that were
originally retrieved via WKD (i.e. which have origin WKD) are
considered.

GnuPG-bug-id: 6672
2023-08-21 18:06:52 +02:00
Ingo Klöcker
fb03a5b3df
doc: Fix interface changes
--

toLogString is in the QGpgME namespace (as everything else in the qt
bindings).
2023-08-21 10:19:09 +02:00
Werner Koch
cfeb62d358
Post release updates
--
2023-08-21 09:54:04 +02:00
Werner Koch
8ea7015a23
Release 1.22.0 2023-08-21 09:41:39 +02:00
NIIBE Yutaka
dacbd51c3f
build: New configure option --with-libtool-modification.
* Makefile.am (EXTRA_DIST): Add build-aux/libtool-patch.sed.
* build-aux/libtool-patch.sed: New.
* configure.ac (--with-libtool-modification): New.
* build-aux/ltmain.sh: Revert our own local modification.

--

Fixes-commit: e622e36f1f
GnuPG-bug-id: 6619
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-08-17 14:03:09 +09:00
Ingo Klöcker
40ca3d5896
qt: Clean up after failure or cancel of sign/encrypt archive operation
* lang/qt/src/qgpgmeencryptarchivejob.cpp (encrypt): Remove output file
if operation was canceled or failed.
* lang/qt/src/qgpgmesignarchivejob.cpp (sign): Ditto.
* lang/qt/src/qgpgmesignencryptarchivejob.cpp (sign_encrypt): Ditto.

* lang/qt/tests/run-encryptarchivejob.cpp (CommandLineOptions): Add
field cancelTimeout.
(parseCommandLine): Add option --cancel-after. Parse option value.
(main): Check for invalid cancel timeout. Start timer for canceling
the job.
* lang/qt/tests/run-signarchivejob.cpp (CommandLineOptions): Add
field cancelTimeout.
(parseCommandLine): Add option --cancel-after. Parse option value.
(main): Check for invalid cancel timeout. Start timer for canceling
the job.
--

This change ensures that the output file is removed if the creation of
a signed or encrypted archive was canceled or failed. The new option
of the test runners enables testing the cancelation of the jobs.

GnuPG-bug-id: 6584
2023-08-16 14:23:15 +02:00
Ingo Klöcker
c3171d0cf1
qt: Make toLogString helper public
* lang/qt/src/util.h: Move toLogString ...
* lang/qt/src/debug.h: ... here.
* lang/qt/tests/run-importjob.cpp (main): Use toLogString.
--

This allows using the helper in dependent projects without duplicating
it everywhere.

GnuPG-bug-id: 6584
2023-08-15 11:56:40 +02:00