Commit Graph

3521 Commits

Author SHA1 Message Date
Ingo Klöcker
7990f70107
doc,cpp: Treat GPG_ERR_FULLY_CANCELED as canceled
* doc/gpgme.texi (GPG_ERR_FULLY_CANCELED): New.
* lang/cpp/src/context.cpp (Error::isCanceled): Also return true for
GPG_ERR_FULLY_CANCELED.
--

For internal purposes, GnuPG sometimes uses the error code
GPG_ERR_FULLY_CANCELED instead of GPG_ERR_CANCELED. From a user
perspective both values mean the same thing and should therefore be
treated identically.

GnuPG-bug-id: 6510
2023-06-01 09:37:41 +02:00
Biswapriyo Nath
e2103be390
cpp,python: Respect --disable-gpg-test for tests
lang/cpp/Makefile.am (SUBDIRS): Depend tests in RUN_GPG_TESTS.
lang/python/Makefile.am (SUBDIRS): Ditto.
--

This is similar to the core and qt switch to disable the tests.

Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
ChangeLog entries added by wk.
2023-05-30 11:44:17 +02:00
Werner Koch
fbc3963d62
core: For key signing and uid revoking allow an empty user id.
* 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.
2023-05-30 11:20:34 +02:00
Werner Koch
36a68bc530
python: Fix wrong use of write.
* lang/python/helpers.c (pyPassphraseCb): Use gpgme_io_writen.
(_gpg_interact_cb): Ditto.
* lang/python/helpers.h (write) [W32]: Remove bad write macro.
--
GnuPG-bug-id: T6501

Using write(2) without checking for EINTR is a not a good idea.
Futher gpgme_io_writen is the correct way to send data from a
callback.  This also fixed the wrong use of a simple macro for
Windows.
2023-05-23 15:52:25 +02:00
NIIBE Yutaka
e622e36f1f
build: Sync to libtool from libgpg-error for 64-bit Windows.
* build-aux/ltmain.hs: Update from libgpg-error.

--

GnuPG-bug-id: 6484
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-05-16 10:52:51 +09:00
NIIBE Yutaka
d44a473e27
doc: Fix Python example code.
* lang/python/doc/src/gpgme-python-howto.org: Fix chmod race.
* lang/python/examples/howto/export-secret-key.py: Likewise.
* lang/python/examples/howto/export-secret-keys.py: Likewise.
* lang/python/examples/howto/temp-homedir-config.py: Likewise.

--

It's not for Python 2.7.

GnuPG-bug-id: 6466
Reported-by: Hanno Böck
Co-authored-by: Ingo Klöcker
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-04-26 08:46:45 +09:00
Werner Koch
d99156ff08
Post release updates
--
2023-04-20 14:02:34 +02:00
Werner Koch
451ed47434
Release 1.20.0 2023-04-20 13:48:17 +02:00
Werner Koch
7351ef32ce
core: Support the new macOS Homebrew location.
* src/posix-util.c (find_executable): Extend the path.
--

GnuPG-bug-id: 6440
2023-04-20 13:35:50 +02:00
Ingo Klöcker
a14155d2c1
build,qt: Simplify check for moc
m4/qt6.m4: Remove alternative checks for moc that were taken over from
Qt 5 and that are obsolete for Qt 6.
--
2023-04-19 09:23:05 +02:00
Ingo Klöcker
e80bf34bf8
Update NEWS
* NEWS: Add news for recent changes
--

GnuPG-bug-id: 5960, 6456
2023-04-19 09:18:04 +02:00
Ingo Klöcker
5bd84cfd3f
cpp: Fix Key::canSign()
* lang/cpp/src/key.h (canReallySign): Deprecate.
* lang/cpp/src/key.cpp (canSign): Remove workaround. Use implementation
of canReallySign.
(canReallySign): Use canSign().
(operator<<): Use canSign().
--

The workaround in canSign was added 19 years ago and canReallySign, the
workaround for the workaround, was added 13 years ago. Time to get rid
of those workarounds for a bug in gpgme which has been fixed long ago
and which cause bugs for any unsuspecting user of Key::canSign().

GnuPG-bug-id: 6456
2023-04-18 13:16:22 +02:00
Werner Koch
7d1159c1e9
core: Avoid printf format warnings due to gpgme_ssize_t.
* src/debug.h (_trace_sysres_ssize_t): Cast arg.
2023-04-17 15:05:22 +02:00
Werner Koch
0c29119e06
core,w32: Fix invocation of gpgtar
* 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.
2023-04-17 14:05:35 +02:00
NIIBE Yutaka
806a5d18b9
build: Update gpg-error.m4.
* m4/gpg-error.m4: Update from libgpg-error master.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-04-06 08:40:12 +09:00
Ingo Klöcker
d256ba7cc5
w32: Always use UTF-8 for localized texts
* 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
2023-04-04 12:11:15 +02:00
Werner Koch
34cc7daba1
core: Minor code cleanup.
* 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.
2023-03-27 16:56:29 +02:00
Ingo Klöcker
b608c084b9
core: Initialize error variable
* src/engine-gpg.c (build_argv): Initialize err.
--

Fixes-commit: fbce7deb3b
2023-03-27 16:49:24 +02:00
Werner Koch
6d21256c92
core,cpp: Add new key flags to gpgme_subkey_t
* 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
2023-03-21 08:37:47 +01:00
Werner Koch
18e09b15d5
Post release updates
--
2023-03-17 11:42:33 +01:00
Werner Koch
96a30fdf30
Release 1.19.0 2023-03-17 10:34:42 +01:00
Ben Greiner (bnavigator)
d086653cc3
python: Update python.m4 configure script.
* configure.ac: Unset PYTHON_LIBS.  Support python 3.10.
* m4/python.m4: Find correct version string for python >= 3.10.
--

See-also: https://dev.gnupg.org/D546

Also test for 3.11 and 3.12 (wk).
2023-03-17 10:06:55 +01:00
Ingo Klöcker
e50724e1bb
tests: Package the ownertrust file
tests/gpg/Makefile.am (EXTRA_DIST): Add ownertrust.txt.
--

This fixes `make distcheck`.

GnuPG-bug-id: 6342
2023-03-17 09:20:08 +01:00
Werner Koch
98a159eb5e
build: Update autogen.sh from libgpg-error
--

This fixes hopefully issues with the beta numbering.  Also removes the
Windows-CE support
2023-03-15 16:07:57 +01:00
Werner Koch
c1f6535f14
core: Also detect legacy X.509 v0 certificates.
* src/data-identify.c (basic_detection): Loose the detection of X.509
certs.
2023-03-08 15:54:54 +01:00
Werner Koch
76351c4877
tests: Add option --binary to run-verify
* 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.
2023-03-08 10:50:15 +01:00
Ingo Klöcker
73e46b3465
qt: Add signals for file-based and data-based progress
* lang/qt/src/decryptverifyarchivejob.h (DecryptVerifyArchiveJob): Add
signals fileProgress and dataProgress.
* lang/qt/src/encryptarchivejob.h (EncryptArchiveJob): Ditto.
* lang/qt/src/signarchivejob.h (SignArchiveJob): Ditto.
* lang/qt/src/signencryptarchivejob.h (SignEncryptArchiveJob): Ditto.
* lang/qt/src/job_p.h (emitArchiveProgressSignals): New.
* lang/qt/src/qgpgmedecryptverifyarchivejob.cpp
(QGpgMEDecryptVerifyArchiveJob::QGpgMEDecryptVerifyArchiveJob): Emit
appropriate signal when receiving Job::rawProgress signal.
* lang/qt/src/qgpgmeencryptarchivejob.cpp
(QGpgMEEncryptArchiveJob::QGpgMEEncryptArchiveJob): Ditto.
* lang/qt/src/qgpgmesignarchivejob.cpp
(QGpgMESignArchiveJob::QGpgMESignArchiveJob): Ditto.
* lang/qt/src/qgpgmesignencryptarchivejob.cpp
(QGpgMESignEncryptArchiveJob::QGpgMESignEncryptArchiveJob): Ditto.
--

GnuPG-bug-id: 6342
2023-02-14 09:25:21 +01:00
Ingo Klöcker
ccff6a96fc
qt: Remove commented out code
--

GnuPG-bug-id: 6342
2023-02-14 09:25:21 +01:00
Ingo Klöcker
ea6f15ed60
qt: Add simple and extended progress signals replacing old signal
* lang/qt/src/job.h (Job): Add signals jobProgress and rawProgress.
Deprecate signal progress.
* lang/qt/src/multideletejob.cpp (MultiDeleteJob::slotResult): Emit
new progress signals.
* lang/qt/src/qgpgmerefreshsmimekeysjob.cpp
(QGpgMERefreshSMIMEKeysJob::slotStatus): Ditto.
* lang/qt/src/threadedjobmixin.h (ThreadedJobMixin::showProgress): Use
modern overload of QMetaObject::invokeMethod to forward the progress
signal and add the value of what. Add forwarding of progress to the new
signals.

* lang/qt/tests/t-encrypt.cpp (EncryptionTest::testProgress): Test
the new signals instead of the deprecated one.
--

The new signal jobProgress omits the what value which is useless for
most consumers. The new signal rawProgress makes all information
provided by the backend available to consumers. The latter is not
really meant to be used by users of gpgme. It will be used by the
archive jobs to provide more user-friendly signals.

GnuPG-bug-id: 6342
2023-02-14 09:25:21 +01:00
Werner Koch
9c5506fde7
core: Switch to logging via gpgrt
* 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.
2023-02-10 11:12:52 +01:00
Werner Koch
c0da6f77c6
core: Update copyright notices
--
2023-02-10 11:12:52 +01:00
Ingo Klöcker
21283dfd1b
tests: Fix cleaning up at the end of the test
* tests/gpg/t-import.c (main): Unref key and release context.
--

This fixes leaks found with -fsanitize=address.
2023-02-10 10:00:56 +01:00
Ingo Klöcker
41dc3bd22a
core: Allow finalization of signature verification of unencrypted data
* 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
2023-02-10 09:54:03 +01:00
Ingo Klöcker
3aaed9cfbf
cpp: Improve debug output of some enums
* lang/cpp/src/verificationresult.cpp (operator<<): Fix output of
Signature::PKAStatus which doesn't represent flags. Print corresponding
name of enum value if Signature::Summary or Notation::Flags are 0.
--

GnuPG-bug-id: 6368
2023-02-09 09:56:18 +01:00
Ingo Klöcker
7098c14b23
tests: Stop daemons after setting up test environment
* 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".
2023-02-09 09:33:07 +01:00
Ingo Klöcker
fcefc78f74
tests: Extend tests with an ultimately trusted key
* 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
2023-02-08 13:46:17 +01:00
Ingo Klöcker
844e6cd3b9
tests: Make t-edit-sign idempotent
* 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
2023-02-08 13:25:27 +01:00
Ingo Klöcker
e0778ed910
doc: Add new flags
--

GnuPG-bug-id: 6342
2023-02-02 12:22:00 +01:00
Ingo Klöcker
52fd0bcde4
qt,tests: Add test for the previous commit
* lang/qt/tests/t-decryptverify.cpp: New.
* lang/qt/tests/Makefile.am: Add new test.
--

GnuPG-bug-id: 6342
2023-02-02 12:11:30 +01:00
Ingo Klöcker
1698eec2ae
cpp: Return successful verification for signed but not encrypted data
* lang/cpp/src/context.cpp (Context::decrypt): Use decryptionResult().
(Context::verifyDetachedSignature, Context::verifyOpaqueSignature):
Use verificationResult().
(Context::verificationResult): Ignore "no data" error for signed but
not encrypted data.
(Context::decryptAndVerify): Use decryptionResult() and
verificationResult().
--

gpgme's decrypt operations set the error to GPG_ERR_NO_DATA if no
encrypted data was found. It makes sense to use this error for the
encryption result, but it doesn't make sense to use it also for the
verfication result if signed data was found.
This way using the combined decrypt-verify operations on data that
may be encrypted and/or signed doesn't produce confusing results.

GnuPG-bug-id: 6342
2023-02-02 12:11:29 +01:00
Ingo Klöcker
c407728064
qt: Add job for extracting encrypted and signed archives
* lang/qt/src/decryptverifyarchivejob.cpp,
lang/qt/src/decryptverifyarchivejob.h,
lang/qt/src/decryptverifyarchivejob_p.h,
lang/qt/src/qgpgmedecryptverifyarchivejob.cpp,
lang/qt/src/qgpgmedecryptverifyarchivejob.h: New.
* lang/qt/src/protocol.h (class Protocol): Add pure virtual member
function decryptVerifyArchiveJob
* lang/qt/src/protocol_p.h (Protocol::decryptVerifyArchiveJob): ... and
implement it.
* lang/qt/src/Makefile.am: Update accordingly.

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

GnuPG-bug-id: 6342
2023-02-02 12:11:29 +01:00
Ingo Klöcker
7ad717f6ba
core: Make usage of input size hint compatible with gpgtar
* 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
2023-02-02 09:59:01 +01:00
Ingo Klöcker
b3bdf14b37
cpp: Update decryption flags
* lang/cpp/src/context.h (DecryptArchive): New flag.
--

This flag corresponds to the GPGME_DECRYPT_ARCHIVE flag in gpgme.

GnuPG-bug-id: 6342
2023-02-02 09:56:22 +01:00
Ingo Klöcker
55c948866f
qt: Allow checking if the sign/encrypt archive jobs are supported
* lang/qt/src/encryptarchivejob.cpp, lang/qt/src/encryptarchivejob.h
(isSupported): New.
* lang/qt/src/signarchivejob.cpp, lang/qt/src/signarchivejob.h
(isSupported): New.
* lang/qt/src/signencryptarchivejob.cpp,
lang/qt/src/signencryptarchivejob.h (isSupported): New.

* lang/qt/tests/run-encryptarchivejob.cpp (main),
lang/qt/tests/run-signarchivejob.cpp (main): Check if jobs are
supported.
--

GnuPG-bug-id: 6342
2023-02-02 09:47:11 +01:00
Ingo Klöcker
8478064691
cpp: Add const-overloads of version comparison operators
* lang/cpp/src/engineinfo.h (EngineInfo::Version): Add const-overloads
of all comparison operators.
--

We keep the non-const overloads for binary compatibility.

GnuPG-bug-id: 6342
2023-02-02 09:47:10 +01:00
Ingo Klöcker
7f541547fc
core: Allow usage of gpgtar also for new enough gpg 2.2
* 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
2023-02-02 09:47:10 +01:00
Werner Koch
5ab9c234d6
core,w32: More robust detection of GnuPG Desktop dir layout
* 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
2023-02-01 17:29:24 +01:00
Ingo Klöcker
343fb33bf0
qt: Fix build without installed gpgme++ headers
* lang/qt/src/filelistdataprovider.cpp: Include error.h without
folder prefix.
--

GnuPG-bug-id: 6342
2023-01-31 21:13:07 +01:00
Ingo Klöcker
472f109138
doc: Update "since" version
--
2023-01-31 12:13:29 +01:00
Ingo Klöcker
7b2188aca1
doc: Update NEWS
--

GnuPG-bug-id: 6342
2023-01-31 12:01:33 +01:00