Commit Graph

1053 Commits

Author SHA1 Message Date
Ingo Klöcker
1dca8c2b3c qt: Do not set empty base DN as query of keyserver URL
* lang/qt/src/qgpgmenewcryptoconfig.cpp (parseURL): Only set non-empty
base DN as URL query.
--

This makes it possible to differentiate an unset query from an empty
query.

GnuPG-bug-id: 5465
2021-06-17 09:38:33 +02:00
Ingo Klöcker
0d03f31e07 qt: Fix API documentation
* lang/qt/src/signkeyjob.h (SignKeyJob::start,
SignKeyJob::setUserIDsToSign, SignKeyJob::setCheckLevel): Fix
documentation of parameters.
--

GnuPG-bug-id: 5245
2021-06-17 09:13:59 +02:00
Andre Heinecke
b3b75c37e2
qt: Flush output after write for QProcess output
* lang/qt/src/dataprovider.cpp (QIODeviceDataProvider::write): Call
waitForBytesWritten.

--
The problem here is that QProcess writes into an internal buffer
which is written to stdin of the process triggered by a
signal/slot connection. That connection is broken when we move
the QProcess into our GPGME thread and only restablished when
our Job is finished. This caused Kleopatra to basically keep
everything when decrypting a large archive in memory and
only write it out to the unpack process once the decryption
was finished.

GnuPG-Bug-Id: T5475
2021-06-10 15:36:26 +02:00
Andre Heinecke
e6095e5471
qt: Explicitly link libgpg-error
* lang/qt/src/Makefile.am (libqgpgme_la_LIBADD): Explicitly link
gpg-error.

--
Previously this was implicit from the libassuan flags.
2021-06-09 10:53:28 +02:00
Ingo Klöcker
5bc4e23a57 qt: Add separate logging category for result of config loading
* lang/qt/src/qgpgme_debug.h: Make include guard match file name.
* lang/qt/src/qgpgme_debug.h, lang/qt/src/qgpgme_debug.cpp
(QGPGME_CONFIG_LOADING_LOG): New.
* lang/qt/src/qgpgmenewcryptoconfig.cpp
(QGpgMENewCryptoConfig::reloadConfiguration): Use new logging category.
--

Use a separate logging category for the extremely noisy logging of
the result of config loading to make debug logging more useful.

GnuPG-bug-id: 5217
2021-06-02 10:56:52 +02:00
Ingo Klöcker
27aa7c4a0f qt: Add support for flags in LDAP server options
* lang/qt/src/qgpgmenewcryptoconfig.cpp (parseURL): Handle extended
LDAP server option syntax.
(portToString): New.
(splitURL): Append flags to LDAP server option.
--

This adds support for the extended syntax of LDAP server options
introduced in gpg 2.2.18/2.3. The flags are stored as fragment of a
QUrl.

GnuPG-bug-id: 5217
2021-06-01 15:29:03 +02:00
Ingo Klöcker
58a217b108 cpp: Do not close stdout/stderr when destroying EditInteractor
* lang/cpp/src/editinteractor.cpp (EditInteractor::Private): Initialize
members 'state' and 'debug' in-class. Add member 'debugNeedsClosing'.
(EditInteractor::Private::Private): Remove members initializers.
Remember if 'debug' needs to be closed.
(EditInteractor::Private::~Private): Only close 'debug' if it needs to
be closed.
--

This fixes the problem that after destroying an edit interactor all
debug output went to /dev/null instead of stderr (or stdout) if one
enabled debugging of the edit interactors with GPGMEPP_INTERACTOR_DEBUG
set to stderr (or stdout).
2021-05-06 10:14:44 +02:00
Ingo Klöcker
f0858e45b0 qt: Extend SignKeyJob to create trust signatures
* lang/qt/src/signkeyjob.h (SignKeyJob::setTrustSignature): New.
* lang/qt/src/qgpgmesignkeyjob.h, lang/qt/src/qgpgmesignkeyjob.cpp
(QGpgMESignKeyJob::setTrustSignature): New.
* lang/qt/src/qgpgmesignkeyjob.cpp (sign_key): Handle trust signatures.
(QGpgMESignKeyJob::start): Pass trust signature attributes to sign_key.
(QGpgMESignKeyJob::setTrustSignature): New.
--

This allows Kleopatra to create trust signatures for trusted
introducers.

GnuPG-bug-id: 5245, 5421
2021-05-05 19:26:33 +02:00
Ingo Klöcker
dae01f8185 qt: Pimpl QGpgMESignKeyJob
* lang/qt/src/qgpgmesignkeyjob.h: Remove unneeded includes. Include
<memory>.
(QGpgMESignKeyJob): Remove all member variables. Add pimpl pointer.
* lang/qt/src/qgpgmesignkeyjob.cpp: Include <QString>. Don't include
<memory>.
(QGpgMESignKeyJob::Private): New.
(QGpgMESignKeyJob::QGpgMESignKeyJob): Remove initialization of removed
members. Initialize d.
(QGpgMESignKeyJob::start, QGpgMESignKeyJob::setUserIDsToSign,
QGpgMESignKeyJob::setCheckLevel, QGpgMESignKeyJob::setExportable,
QGpgMESignKeyJob::setSigningKey, QGpgMESignKeyJob::setNonRevocable,
QGpgMESignKeyJob::setRemark, QGpgMESignKeyJob::setDupeOk): Adapt to move
of member variables to pimpl.
--

GnuPG-bug-id: 5245, 5421
2021-05-05 19:26:19 +02:00
Ingo Klöcker
a8d7b9d167 cpp: Add support for trust signatures to sign key edit interactor
* lang/cpp/src/gpgsignkeyeditinteractor.h,
lang/cpp/src/gpgsignkeyeditinteractor.cpp
(GpgSignKeyEditInteractor::setTrustSignatureTrust): New.
(GpgSignKeyEditInteractor::setTrustSignatureDepth): New.
(GpgSignKeyEditInteractor::setTrustSignatureScope): New.
* lang/cpp/src/gpgsignkeyeditinteractor.cpp
(GpgSignKeyEditInteractor::Private::Private): Initialize new member.
(makeTable): Add new transition. Fix typos in existing transitions.
(GpgSignKeyEditInteractor::action): Handle SET_TRUST_VALUE,
SET_TRUST_DEPTH, and SET_TRUST_REGEXP.
--

GnuPG-bug-id: 5245, 5421
2021-05-05 19:26:03 +02:00
Ingo Klöcker
e391a08c6f cpp: Add getters for the attributes of a trust signature
* lang/cpp/src/key.h (TrustSignatureTrust): New enum.
* lang/cpp/src/key.h, lang/cpp/src/key.cpp
(UserID::Signature::isTrustSignature): New.
(UserID::Signature::trustValue): New.
(UserID::Signature::trustDepth): New.
(UserID::Signature::trustScope): New.
--

GnuPG-bug-id: 5245, 5420
2021-05-05 19:25:48 +02:00
Ingo Klöcker
fe900a41bf qt: Add method for getting config entries for components by entry name
* lang/qt/src/cryptoconfig.h, lang/qt/src/cryptoconfig.cpp
(CryptoConfig::entry): Move implementation to cpp. Add overload not
requiring a group name.
--

The group name is not needed for identifying a config entry because the
groups only provide a logical grouping of config entry for user
interfaces. To improve usability entries are sometimes moved to a
different group, but this shouldn't break existing applications trying
to access those entries. The new group-agnostic overload makes
applications robust against regrouping of config entries.

GnuPG-bug-id: 5217
2021-03-05 09:24:01 +01:00
Ingo Klöcker
a6220adf30 cpp: Add const-overload of UserID::Signature::operator<
lang/cpp/src/key.h, lang/cpp/src/key.cpp (UserID::Signature::operator<):
Add const-overload. Deprecate non-const overload.

--

This fixes compilation on FreeBSD with clang 10.
2021-01-04 16:30:41 +01:00
Andre Heinecke
543e210638
Qt: Undeprecate QByteArray based start functs
* lang/qt/src/encryptjob.h, lang/qt/src/signjob.h (start):
Undeprecate QByteArray based functions.

--
While the QIODevice access might avoid a copy it is more
difficult to manage the data and lifetime of the
QIODevices in calling code. The QByteArray calls are
convienient for small data objects like mails where
an in memory copy is not really expensive anymore.
2021-01-04 13:35:24 +01:00
NIIBE Yutaka
7a4fe82a01 python: Fix key_export*.
* lang/python/src/core.py (key_export): Just raise an error.
(key_export_minimal, key_export_secret): Ditto.

--

GnuPG-bug-id: 5149
Fixes-commit: 7faef33d13
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2020-12-03 11:35:24 +09:00
Andre Heinecke
a5c4b03025
Revert "cpp: Use portable off_t size_t"
This reverts commit 88294023c1.

--
This commit was too early and i needed to test more
this is breaking more then it helps so for now
revert it before we can do a proper solution.
2020-11-20 10:10:32 +01:00
Andre Heinecke
88294023c1
cpp: Use portable off_t size_t
* configure.ac: Configure cpp data.h.in
* lang/cpp/src/Makefile.am: Generate data.h
* lang/cpp/src/data.cpp, lang/cpp/src/data.h: Use portable
types.
* lang/qt/src/Makefile.am: Include build dir.
* lang/qt/tests/makefile.am: Include build dir.

--
These kind of patches have been around for a while, IMO this
should not create an ABI incompatbility for cases where
it already works because the types should be the same
so I think this is not an interface break.

GnuPG-Bug-Id: T3996
2020-11-18 15:14:56 +01:00
Ingo Klöcker
3c185c2159 qt: Avoid empty "rem@gnupg.org" signature notations
* lang/qt/src/qgpgmesignkeyjob.cpp (sign_key): Check remark for being
an empty string instead of a null QString.
--

GnuPG-bug-id: 5142
Co-authored-by: Daniel Kahn Gillmor
2020-11-18 12:43:45 +01:00
Andre Heinecke
df5a89e692
qt: Fix export of qDebug GpgME::Error overload
* lang/qt/src/debug.cpp: Include debug.h to get the export decl.
2020-11-12 16:07:14 +01:00
NIIBE Yutaka
7139afc5cd python: Fix a test for newer GnuPG (>= 2.3).
* lang/python/tests/t-quick-subkey-creation.py: Specify RSA.

--

Using GnuPG 2.3, a key with default (ed25519/cv25519) cannot have some
combination of capabilities (e.g., "encr auth").

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2020-11-12 11:11:36 +09:00
Andre Heinecke
81f0dc7293
qt: Add export macro for QDebug operator
* lang/qt/src/debug.h: Add export macro.

--
This is public API so it should be exported. This did not
resolve a link issue for Windows that I've experienced
when building. But this might be to some uncleanlyness
in my build environment.
2020-11-11 18:12:20 +01:00
NIIBE Yutaka
276f3390e1 qt: Allow build with older GnuPG (< 2.2.18).
* lang/qt/tests/t-remarks.cpp (initTestCase): Check gpg for
allow-weak-key-signatures option.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2020-11-11 11:58:28 +09:00
Ingo Klöcker
0fee135997 qt: Make audit parameters of result signal optional
lang/qt/src/quickjob.h (QuickJob::result): Make parameters
auditLogAsHtml and audigLogError optional.
--

This aligns the signature of QuickJob's result signal with the result
signals of the other Job subclasses.

GnuPG-bug-id: 5094
2020-11-03 13:50:53 +01:00
Ingo Klöcker
b41f5fec1c cpp: Mark helper functions as static
lang/cpp/src/key.cpp (find_subkey, verify_subkey, find_uid, verify_uid,
find_signature, verify_signature): Mark as static.
2020-11-03 09:01:32 +01:00
Ingo Klöcker
6a6d2a2764 cpp: Make signatures belonging to the same user ID sortable
lang/cpp/src/key.h, lang/cpp/src/key.cpp (UserID::Signature::operator<):
New.
lang/cpp/src/key.cpp (signature_index): New.
--

operator< defines a canonical sort order for signatures belonging to
the same user ID. It is based on the sort order defined by
cmp_signodes() in g10/keylist.c of gnupg. In particular, the ordering
of signatures made with the same key by creation time allows to see
easily whether the most recent signature is a certification or a
revocation.

GnuPG-bug-id: 5094
recent
2020-11-03 08:59:54 +01:00
Ingo Klöcker
f042739d3a qt: Add support for revoke signature quick command
* lang/qt/src/quickjob.h (QuickJob::startRevokeSignature): New.
* lang/qt/src/qgpgmequickjob.h, lang/qt/src/qgpgmequickjob.cpp
(QGpgMEQuickJob::startRevokeSignature): New.
* lang/qt/src/qgpgmequickjob.cpp (revokeSignatureWorker): New.
--

GnuPG-bug-id: 5094
2020-10-29 12:57:10 +01:00
Ingo Klöcker
60328c4690 qt: Some minor cleanups
* lang/qt/src/qgpgmequickjob.h: (GpgME::Key, QDateTime, QString):
Remove superfluous forward declarations.
(QGpgMEQuickJob): Remove superfluous second template argument. It is
identical to the default.
(QGpgMEQuickJob::result): Remove. It is already defined in the base
class.
2020-10-29 12:57:10 +01:00
Ingo Klöcker
4166d263e4 cpp: Add support for gpgme_op_revsig
* lang/cpp/src/context.cpp, lang/cpp/src/context.h
(Context::revokeSignature, Context::startRevokeSignature): New.
* lang/cpp/src/context.cpp
(getLFSeparatedListOfStrings, getLFSeparatedListOfUserIds): New.
(getLFSeparatedListOfFingerprintsFromSubkeys): Extracted second part
of function to getLFSeparatedListOfStrings.
--

GnuPG-bug-id: 5094
2020-10-29 12:57:10 +01:00
NIIBE Yutaka
089164a0c0 python: Handle the when case __doc__ is None.
* lang/python/src/core.py (GpgmeWrapper): Check if None.

--

GnuPG-bug-id: 5075
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2020-10-28 08:49:33 +09:00
Ingo Klöcker
74c8131d80 cpp: Add support for gpgme_cancel
* lang/cpp/src/context.cpp, lang/cpp/context.h
(Context::cancelPendingOperationImmediately): New.
* NEWS: Mention added API
--

This allows immediate canceling of running operations, e.g. when a
thread with a long running operation (like SCD DEVINFO --watch) is
going to be terminated (on application shutdown).

GnuPG-bug-id: 5066
2020-10-23 13:50:16 +02:00
Ingo Klöcker
ff23e24063 Add Assuan transaction that forwards status lines to another object
* lang/cpp/src/Makefile.am: Add new files.
* lang/cpp/src/interfaces/statusconsumer.h,
lang/cpp/src/statusconsumerassuantransaction.cpp,
lang/cpp/src/statusconsumerassuantransaction.h: New.
* NEWS: Mention new API.
--

This Assuan transaction is useful for long running Assuan commands.
Classes implementing the StatusConsumer interface can process received
status lines while the Assuan command is still running.

GnuPG-bug-id: 5066
2020-10-23 13:50:16 +02:00
Ingo Klöcker
b21cabb311 qt: Add QDebug stream operator for GpgME::Error
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/debug.h, lang/qt/src/debug.cpp: New.
* NEWS: Mention it.
--

This was previously implemented in Kleopatra, but it makes sense for
all users of qgpgme.
2020-10-23 13:50:16 +02:00
Ingo Klöcker
c3406462d1 cpp, qt: Add missing comparison operators for version info comparison
* lang/cpp/src/engineinfo.h (EngineInfo::Version::operator<=,
EngineInfo::Version::operator>=, EngineInfo::Version::operator!=):
New.
* lang/qt/tests/t-various.cpp (TestVarious::testVersion): Add tests for
new comparison operators.
* NEWS: Mention added API
2020-10-23 13:50:16 +02:00
Ingo Klöcker
2f53a2f4be cpp, qt: Fix version info comparison
* lang/cpp/src/engineinfo.h
(EngineInfo::Version::operator>(const Version &)): Fix logic.
(EngineInfo::Version::operator>(const char *)): Use Version-overload of
operator>.

* lang/qt/tests/t-various.cpp: Add test.
--

This fixes a logic error that 2.0.0 > 2.0.0 would return true.
2020-10-23 13:50:16 +02:00
Ingo Klöcker
973c8116c8 qt: Update the documentation of ListAllKeysJob
* lang/qt/src/listallkeysjob.h (ListAllKeysJob::start): Document that
the mergeKeys argument is ignored with gpg >= 2.1.
--

GnuPG-bug-id: 4794
2020-09-08 15:38:00 +02:00
Ingo Klöcker
3dd7377e12 cpp: Update key with --with-secret instead of updating it twice
* lang/cpp/src/key.cpp (Key::update): Call Context::key() only once
with KeyListMode::WithSecret.
--

With gpg >= 2.1, get the key with --with-secret instead of first trying
to get the secret key and, if that fails, getting the public key.

GnuPG-bug-id: 4794
2020-09-08 14:55:20 +02:00
Ingo Klöcker
13bcc6680a qt: List keys once with --with-secret instead of twice
* lang/qt/src/qgpgmelistallkeysjob.cpp
(do_list_keys): Rename to do_list_keys_legacy and put into unnamed
namespace.
(merge_keys): Put into unnamed namespace.
(list_keys): Rename to list_keys_legacy and put into unnamed namespace.
(do_list_keys, list_keys): New.
* lang/qt/tests/t-keylist.cpp (testListAllKeysSync): New.
--

With gpg >= 2.1, list keys once with --with-secret instead of listing
public keys and secret keys and then merging (part of) the information
about the keys.

GnuPG-bug-id: 4794
2020-09-07 12:02:29 +02:00
Ingo Klöcker
188cc9e9b5 cpp: Add keylist mode WithSecret
* lang/cpp/src/global.h (WithSecret): New.
* lang/cpp/src/context.cpp (operator<<): Handle WithSecret.
* lang/cpp/src/util.h (add_to_gpgme_keylist_mode_t,
convert_from_gpgme_keylist_mode_t): Ditto.
--

GnuPG-bug-id: 4794
2020-09-07 11:55:07 +02:00
Ingo Klöcker
b714a6bbc8 cpp: Add missing keylist modes
* lang/cpp/src/util.h
(add_to_gpgme_keylist_mode_t): Sort modes as in enum definition and
add missing modes to check.
(convert_from_gpgme_keylist_mode_t): Add missing handling of
GPGME_KEYLIST_MODE_WITH_TOFU and GPGME_KEYLIST_MODE_WITH_KEYGRIP.
2020-09-07 11:36:11 +02:00
Ingo Klöcker
4d87ea2851 cpp: Copy some more subkey properties when merging keys
* lang/cpp/src/key.cpp (Key::mergeWith): Also merge secret flag and
keygrip
--

The keygrip was lost if the result of a public key listing was merged
with the result of a secret key listing as done by QGpgMEListAllKeysJob.

GnuPG-bug-id: 4794
2020-09-03 12:24:21 +02:00
Werner Koch
b088d81cef
qt: Fix an rfc2253 parser flaw
* lang/qt/src/dn.cpp (parse_dn_part): Fix parser.

--

This could in theory result in reading bytes after a after Nul in a
string and thus possible segv on unallocated memory or reading other
parts of the memory.  However, it is harmless because the rfc2253
strings have been received from GnuPG which is expected to emit
correct syntax.

GnuPG-bug-id: 5037
2020-08-28 09:13:35 +02:00
Ingo Klöcker
f66f856c89 core: Add error handling to setexpire
* src/genkey.c (setexpire, gpgme_op_setexpire_start,
gpgme_op_setexpire): Move to ...
* src/setexpire.c: New.
* src/Makefile.am (main_sources): Add that file.
* src/context.h (ctx_op_data_id_t): Add OPDATA_SETEXPIRE.

* lang/qt/tests/t-various.cpp (testSetExpire): Test error handling.
--

Errors (and failures) emitted via status-fd need to be handled
explicitly, i.e. we need to provide an appropriate status handler with
corresponding op_data_t. Additionally, we need to set a passphrase
command handler if a passphrase callback is set in the context, e.g.
during tests.

GnuPG-bug-id: 4395
2020-08-14 11:11:23 +02:00
Ingo Klöcker
4f2cd3a0c6 qt: Support changing expiry of subkeys
* lang/qt/src/changeexpiryjob.h (ChangeExpiryJob::start): New overload
that accepts subkeys (with empty implementation).
* lang/qt/src/qgpgmechangeexpiryjob.h,
lang/qt/src/qgpgmechangeexpiryjob.cpp (QGpgMEChangeExpiryJob::start):
New overload that accepts subkeys.
--

This adds the possibility to change the expiry of subkeys.

GnuPG-bug-id: 4717
2020-08-11 17:02:25 +02:00
Ingo Klöcker
c813734c9c cpp: Make private helper a file static
* lang/cpp/src/context.h, lang/cpp/src/context.cpp
(Context::getLFSeparatedListOfFingerprintsFromSubkeys): Remove
from Context; make it a static function instead
--

GnuPG-bug-id: 5003
2020-08-10 11:06:13 +02:00
Andre Heinecke
0676d41ef5
cpp: Use cstdlib getenv for portability
* lang/cpp/src/editinteractor.cpp (EditInteractor::Private::Private):
Use std::getenv.

--
This should fix compiling on MacOS X

GnuPG-Bug-Id: T5013
2020-08-06 09:50:16 +02:00
Ingo Klöcker
8950150913 qt: Port to new setExpire()
* lang/qt/src/qgpgmechangeexpiryjob.cpp (change_expiry): Use new
setExpire() instead of edit() with GpgSetExpiryTimeEditInteractor
--

Using the new setExpire() (which uses --quick-set-expire) is a lot less
complex than using gpg's edit interface. It also feels faster. Next,
I'll add support for changing the expiration time of subkeys.

GnuPG-bug-id: 5003
2020-08-05 16:49:18 +02:00
Ingo Klöcker
84c6b6e2fe qt: Add test for setExpire
* lang/qt/tests/t-various.cpp (TestVarious::testSetExpire): New.
--

GnuPG-bug-id: 5003
2020-08-04 16:53:57 +02:00
Ingo Klöcker
aa03205fe5 cpp: Add support for gpgme_op_setexpire
* lang/cpp/src/context.cpp
(Context::setExpire, Context::startSetExpire): New.
(Context::getLFSeparatedListOfFingerprintsFromSubkeys):
New helper.
* lang/cpp/src/context.h
(Context::SetExpireFlags): New enum.
(Context::setExpire, Context::startSetExpire): Add
prototypes.
(Context::getLFSeparatedListOfFingerprintsFromSubkeys):
Add as private helper.
--

GnuPG-bug-id: 5003
2020-08-04 16:53:29 +02:00
Ingo Klöcker
197ba151e7 cpp: Add ostream operator for subkey
* lang/cpp/src/key.cpp (Subkey): Add ostream operator.
* lang/cpp/src/key.h: Update accordingly.
--

This is helpful for debugging / showing the state of a subkey.
2020-08-04 16:53:28 +02:00
Andre Heinecke
690d967196
qt, cpp: Support export modes
* lang/cpp/context.cpp, lang/cpp/context.h
(Context::startPublicKeyExport, Context::exportPublicKeys): Extend
with flags paramenter.
(Context::ExportMode): New.
* lang/qt/src/exportjob.h (ExportJob::setExportMode): New.
* lang/qt/src/qgpgmeexportjob.cpp, lang/qt/src/qgpgmeexportjob.h:
Update accordingly.

--
This adds the C++ and Qt API for export modes.
2020-07-16 17:00:28 +02:00
Werner Koch
8589091682
core: Deprecate the non-working trustlist functions.
* src/gpgme.h.in: Clarify that the trustlist function should not be
used.
* src/engine.c (_gpgme_engine_op_trustlist): Always return an error.
* src/engine-backend.h (struct engine_ops): Remove trustlist member.
* src/engine-gpg.c (gpg_trustlist): Remove.
(struct engine_ops): Remove that member.  Also in all other engines.
* tests/gpg/t-trustlist.c: Remove.
* lang/python/tests/t-trustlist.py: Remove.
--

This never worked in reality because the required feature has been
removed from GnuPG version 1.3.2 soon after introduction of this
feature in gpgme - 17 years ago.  It was anyway marked as
experimental.  We keep the API and ABI, though.

GnuPG-bug-id: 4834
Signed-off-by: Werner Koch <wk@gnupg.org>
2020-07-15 16:34:24 +02:00
Werner Koch
c8048bf8eb
core: New keylist mode GPGME_KEYLIST_MODE_WITH_KEYGRIP.
* src/gpgme.h.in (GPGME_KEYLIST_MODE_WITH_KEYGRIP): New.
* src/gpgme-json.c (op_keylist): New flag "keygrip".
* src/engine-gpg.c (gpg_keylist_build_options): Pass the options.

* lang/cpp/src/global.h (WithKeygrip): New.
* lang/cpp/src/context.cpp: Add check.
* lang/cpp/src/key.cpp (Key::update): Handle WithKeygrip.
* lang/cpp/src/verificationresult.cpp: Ditto.
* lang/cpp/src/util.h (add_to_gpgme_keylist_mode_t): Ditto.
--

GnuPG-bug-id: 4939
Signed-off-by: Werner Koch <wk@gnupg.org>
2020-07-15 14:11:17 +02:00
Werner Koch
32b80cf3c7
python: Workaround for a regression in GnuPG 2.2.21
* lang/python/tests/support.py (is_gpg_version): New.
* lang/python/tests/t-encrypt-sym.py: Add workaround.
--

GnuPG-bug-id: 4991
Signed-off-by: Werner Koch <wk@gnupg.org>
2020-07-14 14:48:01 +02:00
NIIBE Yutaka
0cc040e82f tests: Remove/change tests for GnuPG 2.3 with no gpg.keyserver.
* lang/qt/tests/t-config.cpp (testKeyserver): Remove.
* tests/gpg/t-gpgconf.c (main): Test with dirmngr.keyserver.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2020-05-11 14:20:48 +09:00
Bernhard Reiter
11edc073a3
python: fix minor typo in howto 2020-03-03 08:52:54 +01:00
Andre Heinecke
ec9690cf5c
qt: Change logging category
* lang/qt/src/*: Change logging category to macro to QGPGME_LOG.

--
The old logging category macro had a typo and this way we
are more consistent with other logging rules. For example
you could write gpg.* in the logging conf.
2020-02-19 11:15:54 +01:00
Andre Heinecke
ba08aadfa7
qt: Log execution args of gpg-card
* lang/qt/src/qgpgmegpgcardjob.cpp (do_work): Log call.
2020-02-19 11:15:54 +01:00
Werner Koch
2b8680aba9
python: Also detect python 3.9.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
2020-02-14 13:16:01 +01:00
Andre Heinecke
9ca679c150
qt: Add dummy context to make mixin happy
* lang/qt/qgpgmegpgcardjob.cpp (QGpgMEGpgCardJob): Add context.
--
Otherwise it fails with an assert.
2020-02-12 15:50:36 +01:00
Andre Heinecke
77feaa4510
qt: Add GpgCardJob following the job pattern
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/job.cpp (GpgCardJob): Add impl stuff.
* lang/qt/src/protocol.h (gpgCardJob): Get one.
* lang/qt/src/qgpgmebackend.cpp,
lang/qt/src/qgpgmebackend.h: Add helpers to get the job.
* lang/qt/src/qgpgmegpgcardjob.cpp,
lang/qt/src/gpgcardjob.h,
lang/qt/src/qgpgmegpgcardjob.h: New.

--
This is annoyingly complex to add a simple new job.
In the future we should implement something like this
without the threadedjobmixin stuff. But the idea was
to follow the usual job pattern.

GnuPG-Bug-Id: T4794
2020-02-12 11:57:09 +01:00
Andre Heinecke
194272dbc3
cpp, qt: Use uidhash to select uids for signing
* lang/cpp/src/gpgsignkeyeditinteractor.cpp (action):
Use uidhash instead of number.
(GpgSignKeyEditInteractor::setKey): New.
* lang/cpp/src/gpgsignkeyeditinteractor.h: Update accordingly.
* lang/cpp/src/key.h, lang/cpp/src/key.cpp: Wrap uidhash.
* lang/qt/src/qgpgmesignkeyjob.cpp: Set the key.

--
Using the uidhash avoids problems when the user ids
on --edit-key are different ones then the uids
captured by gpgme when listing keys. Or if
they are in a different order. This can happen
with cached keys or keys with user attributes.
2019-12-13 18:06:00 +01:00
NIIBE Yutaka
c493242007 qt,tests: Take care for old DSA key using deprecated digest algo.
* lang/qt/tests/t-remarks.cpp (initTestCase): Supply
allow-weak-key-signatures flag for GnuPG 2.3, which
normally rejects use of SHA1 digest.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-11-08 08:07:33 +09:00
Andre Heinecke
e7b5c6405d
qt, tests: Add check for supported versions
* lang/qt/tests/t-encrypt.cpp (decryptSupported): Moved to
t-support as loopbackSupported.
* lang/qt/tests/t-remarks.cpp: Check for loopbackSupported.
* lang/qt/tests/t-support.cpp, lang/qt/tests/t-support.h
(loopbackSupported): New.

--
This ensures that the tests do not fail with GnuPG 2.0.x
2019-11-06 09:21:02 +01:00
Andre Heinecke
024edbbd3c
qt, tests: Replace accidentally commited assert
* lang/qt/test/t-remarks.cpp (testRemarkReplaceSingleUIDExportable):
Use QVERIFY instead of assert.

--
An assert causes the temp directory not to be cleaned up. I
use this to analyze test failures.
If you want to see the tests home directory after a failure you
can just change a failing verify to an assert.
2019-11-06 09:12:09 +01:00
Andre Heinecke
a56f6015e9
qt,tests: Add test to add an exportable certify
* lang/qt/test/t-remarks.cpp (testRemarkReplaceSingleUIDExportable):
New.

--
Just checking in case the edit-key offers new states for that.
2019-11-06 09:10:03 +01:00
NIIBE Yutaka
1b840a151a python: Fix how to generate documentation.
* lang/python/doc/Makefile.am: Explicitly write rules to generate rst
and texinfo files.

Fixes-commit: 36428d8cf1
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-11-06 10:30:16 +09:00
Andre Heinecke
9cf4db1e52
qt, tests: Add testcase for multiple remarsk
* lang/qt/tests/t-remarks.cpp (testMultipleRemarks): New.
2019-11-04 13:56:14 +01:00
Andre Heinecke
cb7668caeb
cpp: Add API to obtain mutliple remarks
* lang/cpp/src/key.cpp, lang/cpp/src/key.h (UserID::remarks): New.
* NEWS: Mention this.

--
This can be useful if we want to show remarks made by others, too.

For:
GnuPG-Bug-Id: T4734
2019-11-04 13:54:55 +01:00
Andre Heinecke
db888b1cc0
qt,tests: Move remarks test out and extend it
* lang/qt/tests/t-various.cpp (testRemarks): Move out.
* lang/qt/tests/t-remarks.cpp: New.
* lang/qt/tests/Makefile.am: Update accordingly.
--
While t-various is nice to add a quick test for more
extensive stuff it is better to move it in its own test.

This also tests with a key that has only a single uid.
2019-11-04 11:18:35 +01:00
Andre Heinecke
08933c183a
cpp: Fix dupe_ok state for single uid
* lang/cpp/src/gpgsignkeyeditinteractor.cpp (makeTable):
Add transition from command to dupe_ok
2019-11-04 11:17:27 +01:00
Andre Heinecke
d61491dd25
qt: Allow adding empty remarks
* lang/qt/src/qgpgmesignkeyjob.cpp (sign_key): Allow empty
remarks.
2019-11-01 12:05:47 +01:00
Andre Heinecke
174caaa6f5
cpp: Minor optimization in remark lookup
* lang/cpp/src/key.cpp (UserID::remark): Use C-API.

--
The other parts of that function already use the C API
so we can also avoid function calls for the keyListMode.
2019-11-01 12:04:41 +01:00
Andre Heinecke
266e05eee8
cpp: Fix adding duplicated sigs on multiple uids
* lang/cpp/src/gpgsignkeyeditinteractor.cpp: Add another
state DUPE_OK2 to allow gpg looping over all uids.

--
When duplicated signatures should be added to multiple
user ids GnuPG will ask for each uid so we have to
add a transition for that.

GnuPG-Bug-Id: T4734
2019-11-01 12:02:07 +01:00
Andre Heinecke
a4d5394b46
cpp: Add env var to control editinteractor debug
* lang/cpp/src/editinteractor.cpp (EditInteractor::Private::Private):
Read "GPGMEPP_INTERACTOR_DEBUG" env var.
(EditInteractor::Private::~Private): Close debug file.

--
While it was possible for the application to control the
debug through setDebugChannel it is often times helpful
to just debug without changing the application using
GPGME
2019-11-01 12:00:18 +01:00
Andre Heinecke
1f3ca698f1
qt,tests: Add test for remarks
* lang/qt/tests/t-various.cpp (testRemark): New.
2019-10-29 16:36:45 +01:00
Andre Heinecke
373acd6923
qt: Extend signkeyjob to handle remarks and dups
* lang/qt/src/qgpgmesignkeyjob.cpp: Handle remarks and
dupeOK.
* lang/qt/src/signkeyjob.h (SignKeyJob::setDupeOk),
(SignKeyJob::setRemark): New.

--
This API makes it easy for Kleopatra to add remarks for:
GnuPG-Bug-Id: T4734
2019-10-29 16:33:58 +01:00
Andre Heinecke
36f7f7a478
cpp: Add support for multiple keysigs in edit
* lang/cpp/src/gpgsignkeyeditinteractor.cpp
(GpgSignKeyEditInteractor::setDupeOk): New.
(makeTable): Add new tansitions.
(SignKeyState): Add DUPE_OK Status.
(GpgSignKeyEditInteractor::action): Handle DUPE_OK.
(GpgSignKeyEditInteractor::Private::Private): Carry flag.

--
When extended-edit is enabled this can be used to answer
the "dupe_ok" query from the edit-key with yes.

This is for:
GnuPG-Bug-Id: T4734
2019-10-29 16:31:20 +01:00
Andre Heinecke
83ecf1686a
cpp: Add convenience API to obtain remarks
* lang/cpp/src/key.h, lang/cpp/src/key.cpp (UserID::remark): New.

--
A remark made by one key on another is a signature notation on
a user id certification signature with the name "rem@gnupg.org".

This helps with:
GnuPG-Bug-Id: T4734
2019-10-29 16:24:01 +01:00
Andre Heinecke
9d83698818
cpp: Minor coding style fix
--
2019-10-29 11:04:41 +01:00
NIIBE Yutaka
36428d8cf1 python: doc: Remove generated files, put rules in Makefile.
* lang/python/doc/Makefile.am (EXTRA_DIST): Remove files not
distributed like files under meta.
* Add rules to generate .rst and .texi files.
* lang/python/doc/rst: Remove .rst files to be generated.
* lang/python/doc/texinfo: Remove .texi files to be generated.

GnuPG-bug-id: 4275
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-12 14:53:55 +09:00
NIIBE Yutaka
d9387650ff python: doc: Add suffix for org files.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-07-12 14:53:31 +09:00
Maximilian Krambach
ed1dffb474 js: improve connection check
--

* Connection.js: In some cases, the browser disconnect does not
  happen inmediately (e.g. wrong extension for the app). I added a
  delay of 25 ms to see if the connection was closed by the browser.
  Also, I tried to make the checkConnection more readable.
2019-07-03 16:19:44 +02:00
Maximilian Krambach
f5e27a12d3 js: Error handling for browser errors
--

* Connection.js
  - Add some meaningful nativeMessaging feedback for failing
    communication due to misconfiguration or other browser-originated
    fails
  - add an "isDisconnected" property
  - "isNativeHostUnknown" tries to match browser's feedback string if
    the browser does not find gpgme-json
* init.js
  - initialization will now reject with a more meaningful error if the
    configuration is not set up or other browser-based errors
    (chrome.runtime.lastError) are present. This should speed up
    the normal initialization (not having to waiting for a timeout
    any more in case of improper setup)
* errors.js
  - CONN_NATIVEMESSAGE: New error that passes the browser's
    nativeMessaging error
  - CONN_NO_CONFIG: native messaging error indicating that the
    nativeMessaging host was not set up properly
* unittests.js:
  - added the "isDisconnected" property to the startup tests
  - added tests for proper behavior of connection checks
2019-06-19 12:58:44 +02:00
Werner Koch
7d0a979c07
python: Fix regression in t-decrypt-verify test.
* lang/python/tests/t-decrypt-verify.py: Comment recent changes.
--

Fixes-commit: bd2d282e57
GnuPG-bug-id: 4276
2019-06-13 15:18:36 +02:00
Werner Koch
ad1395f210
python: Set a default-key into gpg.conf for the tests.
* lang/python/tests/Makefile.am (gpg.conf): Set a default key.

--

It seems we need to set a default key because at least t-sign.py does
not specify the key to use and we do not want to rely on the order of
keys in the keyring.

Also
Fixes-commit: f3ca2c9ce9

gpg 2.0 is end-of-life and we don't need these extra options anymore.
In fact they for the use of some gpg version and don't use the version
gpgconf knows about.  This also aligns the python tests to what we use
for the C test suite.

Signed-off-by: Werner Koch <wk@gnupg.org>
2019-06-13 11:56:08 +02:00
NIIBE Yutaka
47135ffdb9 python: Fix typo in DecryptionError exception.
* lang/python/src/errors.py (DecryptionError): Rename from
DeryptionError.
(UnsupportedAlgorithm): Use DecryptionError.

--

GnuPG-bug-id: 4478
Reported-by: Jan Girlich
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-06-04 10:38:17 +09:00
Andre Heinecke
f9c923bb2d
python: Make EXTRA_DIST files explicit
* configure.ac: Configure new Makefiles.
* lang/python/Makefile.am: Remove dirs from extra dist and use
subdirs.
* lang/python/examples/Makefile.am, lang/python/src/Makefile.am,
lang/python/doc/Makefile.am: New. Files that list EXTRA_DIST files.

--
This is similar to what lang/js does by explicitly listing the
files. This ensures that we have clean distribution tarballs
without accidentall additions that just lay in the directory.

GnuPG-Bug-Id: T4481
2019-05-06 16:08:26 +02:00
Andre Heinecke
63055f1340
Python, doc: Minor style improvement
* lang/python/src/core.py (Context): Retab and shorten
max line length.
2019-05-06 08:36:26 +02:00
Andre Heinecke
f303806a11
Merge remote-tracking branch 'origin/dkg/fix-T4276' 2019-05-06 08:10:03 +02:00
Andre Heinecke
0ed8149814
cpp: Fix initialization warning
* lanc/cpp/src/gpggencardkeyinteractor.cpp
(GpgGenCardKeyInteractor::Private): Fix initialization warning.
2019-05-03 08:49:34 +02:00
Daniel Kahn Gillmor
4100794e30 python: stop raising BadSignatures from decrypt(verify=True)
* src/core.py (decrypt): filter out signatures with errors from the
returned verify_result, but avoid raising BadSignatures
* tests/t-decrypt-verify.py: ensure that only a single signature is
returned when evaluating cipher-3.asc, since the other signature is
unknown.

--

This change preserves the invariant that decrypt() only ever returns
valid signatures in the verify_result, but it avoids unnecessary
errors in the face of the presence of an additional bad signature.

GnuPG-bug-id: 4276
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-05-02 23:28:11 -04:00
Daniel Kahn Gillmor
bd2d282e57 python/tests: try to decrypt and verify new test data
* lang/python/tests/t-decrypt.py: test decryption of cipher-3.asc and
cipher-no-sig.asc
* lang/python/tests/t-decrypt-verify.py: test decryption and
verification of cipher-3.asc and cipher-no-sig.asc

--

note that this introduces a failed test -- decrypt-verify.py
misbehaves on cipher-3.asc by throwing a BadSignature even though

GnuPG-bug-id: 4276
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-05-02 22:23:28 -04:00
Daniel Kahn Gillmor
30bd1c0975 python: make it easier to run a limited number of tests
* lang/python/tests/Makefile.am: prefer py_tests from the environment
if present.

--

I'm trying to make it nicer/quicker to hack on the testsuite for
python bindings. With this change, if you're improving the python
bindings test suite, you can selectively run only a few specific tests
like so:

   lang/python$ make check py_tests='t-decrypt.py t-decrypt-verify.py'

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-05-02 22:23:28 -04:00
Andre Heinecke
7981ec4147
cpp: Add wrapper for gpgme_set_global_flag
* lang/cpp/src/context.cpp (setGlobalFlag): New.
* lang/cpp/src/global.h (setGlobalFlag): Export it.

--
GnuPG-Bug-Id: T4471
2019-04-24 12:36:14 +02:00
Werner Koch
1b5a6bf27a
Release GPGME 1.13.0
* configure.ac: Bump LT versions.
                For C to C33/A22/R0.
                For C++ to C15/A9/R0.
                For Qt to C10/A3/R3.

Signed-off-by: Werner Koch <wk@gnupg.org>
2019-03-26 17:17:08 +01:00
Andre Heinecke
ffdb75217b
cpp: Fix GenCardKeyInteractor and extend it
* NEWS: Mention interface change.
* lang/cpp/src/gpggencardkeyinteractor.cpp
(GpgGenCardKeyInteractor::setAlgo): New.
(GpgGenCardKeyInteractor::action),
(GpgGenCardKeyInteractor::nextState: Handle new interface.

--
Tested that this workes with the old interface of GnuPG 2.2.5
and the new interface since GnuPG 2.2.6

GnuPG-Bug-Id: T4428
2019-03-26 12:02:28 +01:00
Andre Heinecke
47369569e2
qt: Handle diagnostic audit log for CMS
* lang/qt/src/threadedjobmixin.cpp(_detail::audit_log_as_html):
Handle CMS audit log.
2019-03-20 09:56:38 +01:00
Andre Heinecke
c4cc47ee8f
cpp: Fix Error::hasSystemError
* lang/cpp/src/context.cpp (Error::hasSystemError): Invert logic to
do what it says.

--
This is safe because according to codesearch it is only used
in QGpgME
2019-03-13 12:02:05 +01:00
Andre Heinecke
73b2f40ae5
cpp: Add ostream operators for import result
* lang/cpp/src/importresult.cpp: Add ostream operators.
* lang/cpp/src/importresult.h: Update accordingly.
2019-02-21 13:05:55 +01:00
Andre Heinecke
6175025c82
cpp: Make GpgME::Data::toKeys really const
* lang/cpp/src/data.cpp (GpgME::Data::toKeys): Rewind afterards.

--
This fixes unexpected behavior that the seek pointer is changed
after calling the const toKeys.
2019-02-21 13:04:54 +01:00