Commit Graph

1197 Commits

Author SHA1 Message Date
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
Ben McGinnes
302d5ef52e python: examples
* A rather obvious variant of the existing key import examples, except
  directed at Mailvelope's keyserver.
* Yeah, Werner, I know ... but it exists because I used it and there's
  no harm in sharing.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2019-02-11 06:34:40 +11:00
Ben McGinnes
e005052f4d python: docs
* Version bump in preparation for whenever GPGME 1.13.0 happens.
* Ran the post_installer.py for docs preparation again.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2019-01-31 05:52:59 +11:00
Ben McGinnes
2de1e59977 python: post installer script
* Removed auto-generated .texi files from doc/src/ so only the
  corrected versions are left.
* Which means now it is complete, but with the initial work to expand
  it with info file generation later.
2019-01-27 16:02:24 +11:00
Ben McGinnes
1e26572365 python: post installer docs fix script
* Moved post_installer.py into the examples/howto/ directory.
* Added instructions for its use to the Python Bindings HOWTO.
* Ran it as intended from the lang/python/ directory in order to both
  prove it works and quickly and easily get the updated howto
  replicated.  Also to fix all those .texi files.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2019-01-27 14:57:53 +11:00
NIIBE Yutaka
66bcb8acb2 build: With LD_LIBRARY_PATH defined, use --disable-new-dtags.
* configure.ac (LDADD_FOR_TESTS_KLUDGE): New for --disable-new-dtags.
* tests/Makefile.am (LDADD): Use LDADD_FOR_TESTS_KLUDGE.
* lang/cpp/tests/Makefile.am, lang/qt/tests/Makefile.am: Likewise.
* tests/gpg/Makefile.am, tests/gpgsm/Makefile.am: Likewise.
* tests/json/Makefile.am, tests/opassuan/Makefile.am: Likewise.

--

GnuPG-bug-id: 4298
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2019-01-16 10:59:25 +09:00
Andre Heinecke
66376f3e20
qt: Use tofu conflict test keys without expiry
* lang/qt/tests/t-tofuinfo.cpp: Use new test keys without
expiry.

--
The old keys expired on 2019-01-06.

GnuPG-Bug-Id: T3815
2019-01-09 08:26:25 +01:00
Ben McGinnes
a2e7c863c8 python: post installer doc fix script
* Got rid of the bash bit in the comments.
* Made the final printed instructions far more obvious.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2019-01-02 11:08:43 +11:00
Ben McGinnes
207d4289d8 python: examples
* Fixed inter-edit.py so it will actually work now.
* made 3 others executable.
* Fixed the semantics of assuan.py's instructions.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2019-01-02 11:08:43 +11:00
Ben McGinnes
ef9355c2fe python: docs processing
* Added some EPUB specific config options to the Sphinx config file
  which might help reduce some of Sphinx's more stupid default errors
  with EPUB validation.
* Added lang/python/post_installer.py script for automating the
  generation of .texi and .rst "source" files from the real source
  files written in Org mode.  Includes recreating the Sphinx Makefile
  which is excluded due to the m4 toolchain in parent directories, it
  also handles the rewriting of the reST index file properly and
  rewrites the .texi files so they don't impale themselves on Unicode.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-12-25 00:18:10 +11:00
Ben McGinnes
06bca0eaa8 python: docs
* Found a bug in org-mode's export to texinfo function which will
  require either manual modification of each file or a customs sed run
  over the generated files for all updates.
* Manually updated the current files for now, but will need to add
  some post-install processing scripts for future use (I already have
  some of these for my specific setup, they just need to be made a
  little more generic and platform independent for here).

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-12-22 09:39:13 +11:00
Ben McGinnes
dc5f416351 python: groups example
* Tightened code a little more.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-12-21 21:01:04 +11:00
Ben McGinnes
daded49254 python docs: house keeping
* Dropped the ASCII copyright line, since even MS have conceded their
  battle against Unicode enough to load UTF-8.
* Fixed the drafts section since there will be less need of multiple
  output format testing from next year.
2018-12-18 04:07:29 +11:00
Ben McGinnes
fbc298dc1b python: howto and examples
* Tightening up both the documentation and some of the example code.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-12-16 17:12:21 +11:00
Ben McGinnes
4308d17281 python: examples bugfix
* Fixed a bug in the ProtonMail importers (pmkey-*.py) where multiple
  keys found for a username would always result in the last email
  address checked being returned in the printed output for all located
  keys.
2018-12-14 05:17:10 +11:00
Ben McGinnes
3849b60e22 python: new example script
* Though Keybase really should not be encouraged due to
  disengenuosness and FUD emanating from that souce, this new script
  will obtain a key hosted on that site and import it when supplied
  with the keybase username.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-12-13 04:54:51 +11:00
Ben McGinnes
3ca7cf07f5 python: what's new summary
* Added a little more detail to the what's new section.
2018-12-12 23:18:22 +11:00
Ben McGinnes
64758a0dac python: advanced howto example
* Added Cython requirement to this advanced use case.
2018-12-12 23:05:50 +11:00
Ben McGinnes
4c324ac1be python: howto examples equirements
* Added small requirements.txt file for additional modules not in the
  standard python library and not including the bindings themselves
  and not including Cython, which is for more advanced examples.
2018-12-12 23:01:16 +11:00
Ben McGinnes
772b5aae24 python: hkp key importer
* Tweaked it slightly to avoid repetition of key searches when there
  is only one search pattern to check (i.e. usually a single key ID or
  fingerprint).
2018-12-11 09:55:15 +11:00
Ben McGinnes
2e7a14c9b3 python: HKP search and import updates
* Tweaked the code again so that it can also handle the cases where
  someone has included a hexadecimal string in their user ID.
* Updated the HOWTO to match.
* Exported to .rst and .texi.
2018-12-11 07:14:28 +11:00
Ben McGinnes
fe7e01d164 python: key import via HKP example
* Fixed the logic used to search for any given pattern.
* Added a sensible method of checking whether a pattern is a key ID or
  fingerprint.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-12-11 04:41:03 +11:00
Ben McGinnes
7c63bfe4ab python: docs updates
* Multiple updates, expanding on the Windows installation issues.
* Also adding to the new maintenance mode reference document.
* Includes content relating to the resolution of T4271 and T4191.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-12-10 16:05:14 +11:00
Ben McGinnes
ad030234b4 Merge branch 'master' of ssh+git://playfair.gnupg.org/git/gpgme 2018-12-06 01:53:08 +11:00
Ben McGinnes
dc5600d306 python: examples
* cut some of then poor len usage.
2018-12-06 01:50:52 +11:00
Daniel Kahn Gillmor
65c28da4e4
python: overhaul logic of Context.decrypt()
* lang/python/src/core.py (Context.decrypt): simplify and clarify the
logic behind handling verify=False.
* lang/python/tests/t-decrypt.py: ensure that we test verify=False

--

The function-internal variables were pretty unclear to the reader, and
the logic caused pretty nasty breakage when verify=False.

GnuPG-Bug-Id: 4271
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2018-12-05 11:46:10 +01:00
Daniel Kahn Gillmor
878a0ad012
python: ctx.decrypt() has problematic error handling
* lang/python/src/core.py (Context.decrypt): document odd
error-handling behavior as a potential problem to be addressed.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2018-12-05 11:46:09 +01:00
Daniel Kahn Gillmor
5d8b4f7489
python: Clarify the meaning of ctx.decrypt(verify=[])
* lang/python/src/core.py (Context.decrypt): docstring clarification
of what it means to pass an empty list to the verify argument.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2018-12-05 11:46:09 +01:00
Daniel Kahn Gillmor
b8fa76a30c
python: gpg.Context.decrypt verify_sigs and sink_result are bools
Both of these function-internal variables are never used for anything
other than a binary state.  Implement them as the booleans they are.
Otherwise, casual readers of the code might think that they're
supposed to represent something other than a flag (e.g. "verify_sigs"
could mean "the signatures to verify", and "sink_result" could mean
"the place where we sink the result").

Signed-Off-By: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2018-12-05 11:46:09 +01:00
Daniel Kahn Gillmor
49af6d76e5
python: clarify documentation for verify argument for Context.decrypt()
It's easy to miss that verify can take a list of keys.  Make it more
obvious to the average python dev who reads docstrings.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2018-12-05 11:46:09 +01:00
Daniel Kahn Gillmor
2491e6f92f
python: simplify Context.decrypt()
In the course of trying to address https://dev.gnupg.org/T4271, i
discovered that gpg.Context.decrypt() has a bit of superfluous code.
This changeset is intended to simplify the code without making any
functional changes.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2018-12-05 11:46:09 +01:00
Ben McGinnes
1dffdcc6e9 python: windows c and cython
* added warning that he Windows C runtime issues will also affect use
  with Cython and that relying on binary installers would remove that
  possible use case.
2018-12-05 10:51:59 +11:00
Ben McGinnes
c8a04af676 python: sphinx modification
* The make.bat file incorrectly triggers the trailing whitespace check
  in the git repo (it doesn't actually have any trailing whitespace,
  but triggers the error on every line).
* Will need to add a script to handle future org-mode conversions of
  the index page anyway, so will get that script to deal with this
  problem too by generating the make.bat file if the platform is
  detected as Windows.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-12-05 09:31:10 +11:00
Ben McGinnes
6d8823b811 python: Sphinx support
* Added framework from sphinx-quickstart to lang/python/doc/rst/ so
  that Python developers already using Sphinx can use the generated
  reST files with existing documentation systems.
* Note that when generating source files from Org-mode, the index page
  will require manual intervention to match the Sphinx requirements.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-12-05 09:17:31 +11:00
Ben McGinnes
8d2621fcad Merge branch 'master' of ssh+git://playfair.gnupg.org/git/gpgme 2018-12-05 08:49:41 +11:00
Ben McGinnes
8613727f1e python: docs update
* Expanded the section on issues with Windows installations, with
  greater detail of which versions of Visual Studio are needed
  depending on which version of CPython is to be used.
* Included a recommendation which is a bit harsh without being totally
  prickish.
* Updated all files to not link to author's key or related data in
  order to make them all consistent with the changes in commit
  649b196881.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-12-05 08:42:08 +11:00
Andre Heinecke
1d31420650
qt,cpp: Consistently use nullptr and override
* lang/cpp/src/Makefile.am, lang/qt/src/Makefile.am (AM_CPPFLAGS):
Add suggest-override and zero-as-null-pointer-constant warnings.

* lang/cpp/src/*, lang/qt/src/*: Consistenly use nullptr and override.

--
This was especially important for the headers so that downstream
users of GpgME++ or QGpgME do not get flooded by warnings if
they have these warnings enabled.

It also improves compiler errors/warnings in case of accidental
mistakes.
2018-12-03 12:25:00 +01:00
Werner Koch
649b196881
doc: Minor comment cleanups.
--

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-12-03 10:41:00 +01:00
Ben McGinnes
2e3a681d0c python: documentation fixes
* Typographic and whitespace error correction pertaining to the
  previous update.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-12-01 08:15:43 +11:00
Ben McGinnes
3b056a01a2 python: documentation
* Added long description to setup.py.in.
* Added maintenance mode details with clarification for what type of
  things would be a bug as far as MM is concerned and what wouldn't
  be.
** Includes a not too subtle hint directed towards the donations page.
* Miscellaneous tightening of documentation.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-12-01 07:45:50 +11:00
Ben McGinnes
1c92f3ff55 python docs: checking key signatures
* Added instructions for checking key certifications or key
  signatures (depending on preferred terminology).
* Added pendulum module to recommended installations, but not to
  requirements.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-11-26 13:19:34 +11:00
Ben McGinnes
c87155e6eb python: docs update
* Added documentation for the new methods added to gpgme.version.
* Removed the Flask based advanced use case from the what-is-new
  section as that type of code will not be added here.
2018-11-22 20:00:12 +11:00
Ben McGinnes
de6bb23279 python: version as integers
* lang/python/version.py.in: added gpg.version.versionintlist
* If gpg.version.versionintlist[2] ever returns -1 then there's a
  serious problem with the build and it should be lodged as a bug if
  it's repeatable.  Seeing this should never happen, but checking for
  it is better than not doing so.
2018-11-22 18:00:22 +11:00
Ben McGinnes
fd34415bdd python: import type
* Fixed bug T4242 and tested that dropping "Import" in favour of
  "import_type" does indeed work just fine.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-11-19 21:38:50 +11:00
Ben McGinnes
f773ad392d python: import constant
* lang/python/src/constants/__init__.py: dropped use of Import
  capitalisation and renamed lang/python/src/constants/import.py to
  lang/python/src/constants/import_type.py to address bug T4242.
* lang/python/doc/src/gpgme-python-howto: minor docs updates.
2018-11-19 21:19:42 +11:00
Werner Koch
8d91c0f4cd
Add SPDX identifiers to most source files
--

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-11-16 13:27:33 +01:00
Daniel Kahn Gillmor
2557d0ae6f spelling: fix misspellings
Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2018-11-08 12:34:27 +07:00
Ben McGinnes
d0a5caf73c docs: python bindings
* Continued restructuring as part of moving beyond mere;y the HOWTO
  file.
* Generated the alternative source files for reST and Texinfo.
* Fixed some errors and updated links after moving the what's new
  section to two new files (yes, two).
2018-11-06 16:22:50 +11:00
Ben McGinnes
0cb625da84 python examples: another importer
* Fixed a similar type of bug with the non-protonmail importer.
2018-11-06 14:58:15 +11:00
Ben McGinnes
1b9d30db08 python examples: protonmail hkp scripts
* fixed a bug in the import try statement for both versions.
2018-11-06 14:11:01 +11:00
Ben McGinnes
13e09bd21a docs: typo
* lang/python/doc/src/gpgme-python-howto: s/Revokinging/Revoking/g
2018-11-03 18:12:25 +11:00
Ben McGinnes
78be1e2f54 docs: python docs restructure
* Moved the what's new section out of the HOWTO (mostly), in
  anticipation of expanding the docs to be more than merely a HOWTO.
2018-10-31 03:41:47 +11:00
Ben McGinnes
d5c22966d5 docs: python
* dropped the ".org" extension and added a mode line for each file as
  this will make scripting format conversions a lot easier.
2018-10-31 03:06:24 +11:00
Andre Heinecke
62c736ba76
cpp,tests: Add another test runner
* lang/cpp/tests/run-verify.cpp: New.
* lang/cpp/tests/Makefile.am: Update accordingly.

--
Add another test runner which helps to find problems on windows.
2018-10-29 15:36:45 +01:00
Andre Heinecke
05a0e97f5c
cpp: Add some convenience functions
* lang/cpp/src/context.cpp (Context::create): New.
* lang/cpp/src/context.h: Update accordingly.
* lang/cpp/src/key.cpp, lang/cpp/src/key.h:
(Key::isBad, Subkey::isBad, UserID::isBad)
(UserID::Signature::isBad): Add shorthand for the isX checks.
* NEWS: Mention it.

--
I don't know how often I wrote:
if (key.isNull() || key.isExpired() || key.isRevoked() ...

And for the context it is good practice to use a unique ptr
so the API should make it easy.
2018-10-25 14:13:39 +02:00
Ben McGinnes
04791c8967 docs: python howto
* Fixed a few spelling and grammatical errors.
2018-10-23 23:38:56 +11:00
Ben McGinnes
59e38e3d2c Python: docs tweaks
* Fixed a minor error in how the reST version of the HOWTO is
  generated.
* Updated the help() in __init__.py with a little more detail as to
  why not to use the lower level functions.
2018-10-22 05:43:36 +11:00
Ben McGinnes
651a1afe80 python bindings: callback test
* lang/python/tests/t-callbacks.py: Updated test logic to try
  generating a key which expires in 2099 and if that fails then
  fallback to an expiration in 2037 in an attempt to catch the 32-bit
  systems.
2018-10-20 11:07:55 +11:00
Daniel Kahn Gillmor
9de1c96ac3 python: do not export HAVE_CXX11 definition
* lang/python/gpgme.i: ignore HAVE_CXX11 in SWIG interface

--

If there are two distinct builds (a) and (b) of gpgme which both build
python bindings, and build (a) also happens to build the C++ bindings,
then the generated gpg/gpgme.py file from build (a) will not be usable
with the .so generated in build (b), despite them being exactly the
same, and having nothing to do with C++.

In particular, it will fail with:

-----------
  File "…/gpg/__init__.py", line 99, in <module>
    from . import core
  File "…/gpg/core.py", line 10, in <module>
    from . import gpgme
  File "…/gpg/gpgme.py", line 152, in <module>
    HAVE_CXX11 = _gpgme.HAVE_CXX11
AttributeError: module 'gpg._gpgme' has no attribute 'HAVE_CXX11'
-----------

By asking SWIG to ignore this definition, we stabilize the generated
.py and the .so, ensuring that they are more cleanly interoperable.
2018-10-18 00:30:32 -04:00
Daniel Kahn Gillmor
a81534fed8 doc: convert more http:// links to https://
--

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2018-10-18 00:28:51 -04:00
Daniel Kahn Gillmor
2f12427e41 doc: use https:// for www.gnu.org
--

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2018-10-18 00:28:51 -04:00
Maximilian Krambach
9b6ed6a80f js: increase default startup timeout
--

* src/index.js: change the init default if none is given, so that all
  initialization defaults line up to 1000 miliseconds
2018-10-17 13:13:31 +02:00
Werner Koch
233d2f3d35
cl: Add missing file
--
Fixes-commit: 85d7af8ff2
My fault, sorry.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-10-12 09:05:41 +02:00
Guillaume LE VAILLANT
85d7af8ff2
cl: Several fixes
--

* Use wrapper types calling translation functions instead of
  TRANSLATE-{FROM,TO}-FOREIGN methods as they seem not to be
  called in some cases.
* Use the (:STRUCT SOME-C-STRUCT) notation instead of the
  deprecated direct reference to SOME-C-STRUCT.
* Add missing values in enums and bit fields.
* Use cffi-grovel to define system types (SIZE-T, OFF-T, etc).
* Wrap GPGME-DATA-T in a class (like contexts).
* Use the FINALIZE function from trivial-garbage to free the
  C objects for contexts, keys and data automatically.
* Make DATA-READ-CB and DATA-WRITE-CB run faster.
* Update the README file.

Signed-off-by: Guillaume LE VAILLANT <glv@posteo.net>
2018-10-12 09:02:18 +02:00
Andre Heinecke
c565cf42a3
cpp: Add KeyListMode::Locate
* cpp/src/global.h (KeyListMode): Add Locate.

--
Similar to locate in core.
2018-10-09 11:26:15 +02:00
Andre Heinecke
9f85f4967e
cpp: Add first manual tests
* lang/cpp/Makefile.am: Add tests subdir.
* lang/cpp/tests/Makefile.am: New.
* lang/cpp/tests/README,
lang/cpp/tests/run-getkey.cpp,
lang/cpp/tests/run-keylist.cpp: New.
* configure.ac: Configure tests makefile.

--
The autotests for c++ live in lang/qt/tests these
tests are more for manual experiments to validate some
functionality.
2018-10-09 11:24:18 +02:00
Andre Heinecke
7a1e6dbfb1
cpp: Initialize all gpgme_key_t's in context
* lang/cpp/src/context.cpp (Context::startKeyListing),
(Context::keyListResult, Context::signingKeys): Initialize key.

--
"Should" not be neccessary but it's cleaner and would have
covered the case of the previous commit.
2018-10-09 10:47:16 +02:00
Andre Heinecke
bf4aae4512
qt, tests: Add test for single get key
* lang/qt/tests/t-keylist.cpp (testGetKey): New.

--
Added this to check if there was a memleak in that function.
2018-10-09 09:37:28 +02:00
Werner Koch
1aff2512d8
Release 1.12.0
* configure.ac: Bump core LT version to C32/A21/R0.  Bump C++ LT
version to C14/A8/R0.

* lang/qt/tests/Makefile.am (CLEANFILES): Add reader status files.
* Makefile.am (EXTRA_DIST): Add conf/whatisthis.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-10-08 11:17:01 +02:00
Werner Koch
ecfa48fffa
build: Move config.h to conf/config.h
* conf/: New dir.
* configure.ac (AC_CONFIG_HEADER): Move header to conf dir.
* doc/Makefile.am (mkdefsinc): Adjust rule.
* lang/python/Makefile.am (copystamp): Ditto.
--

C++ uses those stupid files without a suffix and thus the new standard
header <version> as included by newer other libc++ versions may
conflict with the VERSION file in out top directory.   This change
should solve the problem.

GnuPG-bug-id: 4168
Signed-off-by: Werner Koch <wk@gnupg.org>
2018-10-05 15:14:58 +02:00
Ben McGinnes
033da18b88 docs: whitespace bug
* Same as before, but exported.
2018-10-05 02:41:45 +10:00
Ben McGinnes
a8d4aa6f76 docs: org to texinfo whitspace bug
* replaced "." in headings with "·" to prevent whitspace being
  appended by texinfo and breaking git.
2018-10-05 02:38:14 +10:00
Ben McGinnes
0b5930b276 docs: python
* Fixed an error in the new index page and then exported to the other
  two "source" formats.
2018-10-05 02:30:20 +10:00
Ben McGinnes
4825887972 docs: python
* lang/python/doc/meta/TODO.org: Added the two major documentation
  build system tasks to the TODO list.
* Added an index page in preparation for sorting out the second of
  those TODO lists (Docutils is a lot easier to handle than Texinfo).
* Meanwhile, have confirmed that it all builds just fine under
  GNU/Linux, OS X and FreeBSD while retaining the documentation, so
  that's a nice improvement from 1.11.1.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-10-05 01:47:56 +10:00
Ben McGinnes
f3fc737382 python: makefiles
* doc/Makefile.am: Removed a bit I forgot about.
* Renamed lang/python/docs to lang/python/doc bvecause apparently
  automake cares about that too.
* Decided to be extra explicit in the manifest because if I don't then
  all sorts of things get deleted ... like lang/python
* Tested on an external linux system just in case my osx workstation
  introduces too much weirdness.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-10-04 21:10:46 +10:00
Ben McGinnes
2cca422ca4 python: make file
* lang/python/Makefile.am: Attempting to remove the docs/meta
  directory did a lot worse than I thought it was doing, so better to
  just be sure the documentation is available than destroy the entire
  bindings directory.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-10-04 18:28:47 +10:00
Ben McGinnes
582f14d97a python: make file
* lang/python/Makefile.am: Now that gpg2 has been renamed back to gpg
  and gpg1 is semi-deprecated, we should check what the actual gpg
  binary is with gpgconf and use that rather than make assumptions per
  system.
* Also, it means less worry if gpg3 is ever a thing.  (Trust me, I
  remember the Python 1 to 2 transition as well as the current 2 to 3
  transition).  ;)

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-10-04 18:11:01 +10:00
Ben McGinnes
a174b26943 docs: more whitespace checks
* lang/python/docs/texinfo/short-history.texi:
2018-10-04 07:20:32 +10:00
Ben McGinnes
962dfca9b8 dpcs: python howto
* More updates to the docs themselves and the versions to be available
  with the next release.
* .texi and .rst copies of the HOWTO and the short history of (this
  part) of the project.
2018-10-04 07:09:40 +10:00
Ben McGinnes
2151b9828a docs: python
* More restructuring.  Also the painstaking task of deciphering some
  of the more eclectic aspects of Texinfo and make.
2018-10-04 07:06:57 +10:00
Ben McGinnes
a982f91315 docs: python bindings
* Restructured the docs directory to account for the GNU preferred
  source doc format (.texi) and the Python preferred source doc
  format (.rst) and the real source doc format (.org).
* Both the perceived source formats will need to be generated from the
  .org files and included at this stage.  Unfortunately there is not
  yet a native org-to-rst transformation method in the org-mode
  software in Emacs nor is there a a direct means of going from reST
  to Org-mode from Docutils.  There's only third party packages like
  Pandoc and, while very good, there is no guarantee of consistency;
  so we can't entirely automate this bit (yet).
2018-10-04 06:57:51 +10:00
Ben McGinnes
b280205319 docs: pre-python preparation
* doc/Makefile.am: removed the python howto from this file, restoring
  it to just the main project and the newer .js files.
* deleted: doc/gpgme-python-howto.texi
* renamed the Short_History.org file to short-history.org to keep the
  naming conventions similar.
* All the Python files can (and should) live together.
2018-10-04 01:42:12 +10:00
Ben McGinnes
23894ac9a9 python bindings: CPython order
* Changed the order of python versions the configure/make process
  checks for, placing Python 3.7 ahead of 3.6.
* Updated the HOWTO documentation to reflect this change.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-10-03 06:58:51 +10:00
Ben McGinnes
76bdfabb05 docs: python bindings
* Tightened up the docs a little bit, updated the "what's new"
  section, dropped the "-draft" version in preparation for GPGME
  1.12.0's release.
* Exported another .texi version (and updated the draft copies to this
  commit (which ought to be 1.11.1-beta313).

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-10-01 02:10:03 +10:00
Ben McGinnes
837a476053 python bindings: fixing decrypt-verify
* lang/python/src/core.py: First restoring the exception to the being
  just that.
* The means to manipulate the error output is temporarily in commented
  out code, but ought to be added to a proper test later.
* In the mean time the original test, with a very slight change, works
  again.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-30 19:32:45 +10:00
Ben McGinnes
11403a4635 python bindings: ctx.decrypt
* lang/python/src/core.py: Fixed methods of detecting whether verify
  is a boolean variable or a list.
* Added methods of catching the missing keys exceptions.
* Still retained PEP8 compliance (which might have been where one or
  two problems crept in).
* Though this is essentially the correct behaviour, it still does not
  quite fit the otiginal test; so that will also require some adjustment.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-30 16:28:54 +10:00
Ben McGinnes
ce045a1ef9 example: local signatures
* lang/python/examples/howto/local-sign-group.py: added the bit where
  specifying the signing key is actually used for signing rather than
  just pruning the list of keys to certify.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-27 23:23:37 +10:00
Ben McGinnes
a047e0f68e example: python bindings
* lang/python/examples/howto/local-sign-group.py: locally sign every
  key in a group line except one's own keys.  Intended to address the
  sort of thing one might see on lists like PGPNET or other closed
  groups amongst activists, journalists, etc. where everyone encrypts
  to all recipients, but may not sign everyone's keys publicly..

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-27 22:45:37 +10:00
Ben McGinnes
1d40d360bc docs: python bindings installation
* lang/python/docs/gpgme-python-howto.org: added a section on
  installing the bindings to a python virtualenv.
2018-09-27 14:06:48 +10:00
Ben McGinnes
b9aea3b9c2 tests: python bindings
* Fixed the final assertion to look for what will actually be reported
  in that case instead of something else (i.e. it looks for an
  IMPORT_ERROR status code).
2018-09-27 10:07:08 +10:00
Ben McGinnes
7c9f49a499 examples: python bindings
* Fixed homedir specifying logic in several cases.
2018-09-27 09:57:50 +10:00
Ben McGinnes
b625258d54 docs: a typographical two-step
* Sometimes you really do need or want punctuation in a heading, but
  ideally without something else generating whitespace and other
  annoyances to go with it.
* Trying a real decimal point instead.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-25 10:17:39 +10:00
Ben McGinnes
62e4e2cb5e docs and examples: python bindings
* Woumd up the "what's new" section.
* Added an example for sending a key to the keyservers via hkp4py.
* Updated the export key code to use a more complete check for the
  $GNUPGHOME location.
* Expanded on the installation and reinstallation troubleshooting
  section.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-25 09:59:31 +10:00
Ben McGinnes
e9da4d9710 docs: python bindings howto
* Added a What's New section to summarise changes since the last
  release.  There have been quite a few and some attention does need
  to be drawn to some of them.
* Confirming certain issues with some platform builds, especially
  BSD/OSX vs. Linux issues which will need to update the installation
  troubleshooting guides.
2018-09-25 04:32:13 +10:00
Ben McGinnes
b12b2cc996 docs and examples: python bindings howto
* Added more comprehensive examples using hkp4py and added a couple
  more example scripts for protonmail.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-23 19:36:54 +10:00
Ben McGinnes
ced4bdbbb2 examples: python bindings and hkp4py updates
* Mostly tightening up the details on the hkp4py example script.
* Also fixed a typo in the LGPL boiler plate text included in all the
  other example scripts for the HOWTO.
2018-09-23 11:43:34 +10:00
Ben McGinnes
6ed9a77c92 python bindings: importing from keyservers with hkp4py
* added a new example script to search the keyservers and import the
  results, this time using Marcel Fest's hkp4py module.
* Updated the key importing section to match this addition.
* Tested with the current version of hkp4py from github.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-23 08:18:44 +10:00
Ben McGinnes
3622576105 docs: python bindings howto
* Confirmed that updates to the tests have significant'y improved that
  output.
* Updated some of the additional notes for the section on hkp4py.
** This is in anticipation adding at least import examples using that
   module as well.  It may also include adding examples of exporting a
   key and uploading it to the keyservers.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-23 05:37:40 +10:00
Werner Koch
6878126b6f
python: Fix a couple of syntax errors.
* lang/python/tests/t-keylist-from-data.py: Add missing line
continuation.
* lang/python/tests/t-keylist.py: Ditto.
* lang/python/tests/t-quick-key-creation.py: Ditto.
* lang/python/tests/t-quick-subkey-creation.py: Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-09-20 17:45:07 +02:00
Werner Koch
dcdabf5f2e
python: Silence a few warnings.
* src/gpgme.h.in: Obsolete "class" also for Python.
* lang/python/gpgme.i: Silenece a swig warning.  Silence a gcc
warning.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-09-20 17:45:07 +02:00
Maximilian Krambach
ec2d2b78bc js: renamed keygen algo option
--

* src/Keyring.js: Confused default-future with future-default

* reverts commit 34be6163f6
2018-09-20 15:48:19 +02:00
Werner Koch
9f19b3aaec
python: Fix regression in the test suite.
* lang/python/tests/Makefile.am (GNUPGHOME): Remove stray backslash.
--

Fixes-commit: d09d19fa9f
Signed-off-by: Werner Koch <wk@gnupg.org>
2018-09-20 12:13:03 +02:00
Werner Koch
a824f4498e
tests: Don't try using keys from a scmartcard.
* tests/gpg/Makefile.am: Disable scdaemon
* lang/python/tests/Makefile.am: Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-09-20 12:13:03 +02:00
Ben McGinnes
5cb67257f2 docs: python bindings and its special request
* Added some material on using the new-ish hkp4py module with GPGME.
* Example code will be added later once a couple of little issues are
  addressed.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-09-20 11:38:20 +10:00
Maximilian Krambach
34be6163f6 js: add 'default-future' as createKey option
--
* src/Keyring.js: default-future can be used now for key creation as
  algo.
2018-09-19 17:56:55 +02:00
Werner Koch
c569adb5e3
json: Remove subkey-algo from createkey command.
* src/gpgme-json.c (op_createkey): Remove subkey-algo param.
(GPG_AGENT_ALLOWS_KEYGEN_TRHOUGH_BROWSER): Fix typo.
* lang/js/src/Keyring.js: Remove subkey-algo support.
* lang/js/src/permittedOperations.js: Ditto.
--

We do not want to expose details of the protocol's key generation and
thus the subkey-algo does not make sense.  Right now we support only
the default and future-default algorithms.  A user can configure them
anyway using new-default-key-algo in gpg.conf.  Eventually we may
officially support a more flexible way of creating special structured
OpenPGP keys but right now that is not part of the API.

Signed-off-by: Werner Koch <wk@gnupg.org>
2018-09-19 11:51:31 +02:00
Maximilian Krambach
7f14958606 js: add configuration option on startup
--

* src/index.js: Added an optional configuration object for the startup.

* configuration: timeout - the initial check for a connection ran into
  timeouts on slower testing machines. 500ms for initial startup is
  not sufficient everywhere. The default timeout was raised to 1000ms,
  and as an option this timeout can be increased even further.

* BrowsertestExtension: Set the initial connection timeouts to 2
  seconds, to be able to test on slower machines.
2018-09-19 10:56:36 +02:00
Ben McGinnes
362caaf02f docs: python bindings
* Updated the Cython example code slightly, along with the
  corresponding explanation.
2018-09-18 08:32:30 +10:00
Ben McGinnes
f4d83800d8 docs: python bindings howto
* Tightened up the Cython demonstration.
2018-09-17 14:33:02 +10:00
Ben McGinnes
44c846345e docs: cython sanitized
* Sanitized the shell command examples of extraneous whitespace.
* Removed keycount.c as sanitising it is pointless and it will be
  generated by Cython when the example is followed.
* Regenerated the .texi version.
2018-09-16 13:58:34 +10:00
Ben McGinnes
61c08f7435 docs: python bindings howto
* Added new advanced section with an example of using the Python
  bindings with CPython code compiled back to C code using Cython.
* Though it may seem a bit counter-intuitive to use the bindings just
  to go back to C via a different route, this is not actually stupid.
* Added examples/howto/advanced/cython/ directory.
* Added keycount.pyx, setup.py and the keycount.c file which the first
  two generated with Cython.  Not including the .so and .o files from
  the build.
* Exported the .texi version of the howto for the main docs.
2018-09-16 13:48:12 +10:00
Ben McGinnes
fbec29fdac docs: even more edits
* doc/gpgme-python-howto.texi: hunting down and killing commas,
  Oxford or not it can't stay in a heading.
2018-09-16 11:06:32 +10:00
Ben McGinnes
2a1b0b88d9 docs: more edits
* lang/python/docs/gpgme-python-howto.org: more tweaks and edits,
  along with another build of output formats.
* doc/gpgme-python-howto.texi: updated texinfo version for parent docs.
2018-09-16 10:52:30 +10:00
Ben McGinnes
91b26b0638 docs: whitespace culled
* lang/python/docs/gpgme-python-howto.org: Identified and fixed the
  headings which kept generating lines with trailing whitespace when
  exporting to Texinfo format and adjusted them to prevent that.
2018-09-16 09:47:05 +10:00
Ben McGinnes
766ec0e4a3 docs: renaming and drafts
* lang/python/docs/gpgme-python-howto.org: Renamed file to better fit
  the rest of the project's docs.
* Added a section on the very unofficial drafts I periodically post
  links to since they're often the easiest way to get a web version in
  front of someone in a hurry.
2018-09-16 08:36:10 +10:00
Ben McGinnes
7e9df9b9e3 docs: Python howto update
* lang/python/docs/GPGMEpythonHOWTOen.org: Added corresponding GPGME
  version number to table at the start and cut the shortcut from the
  groups.py example.
* doc/gpgme-python-howto.texi: New export of Texinfo file for docs
  build.
2018-09-16 06:35:02 +10:00
Ben McGinnes
d04fb0bf12 Python bindings: docs
* lang/python/docs/GPGMEpythonHOWTOen.org: Fixed a few errors in the
  newer sections.
* Updated code in the examples using secret key exporting and group
  lines to reflect the Python 2.7 compatibility fixes added.
2018-09-16 03:36:14 +10:00
Ben McGinnes
4e8a92ed14 Python bindings: examples
* lang/python/examples/howto/export-secret-keys.py and groups.py:
  Updated the backwards compatibility adjustments to account for
  unicode differences between python 2 and 3.
2018-09-16 03:34:36 +10:00
Ben McGinnes
864ef9b40f Python examples: backwards compatibility
* lang/python/examples/howto/groups.py: subprocess update
* lang/python/examples/howto/export-secret-keys.py: subprocess update

  Both of these try the nice and easy method of getting the subprocess
  output available in Python 3, but will fall back to the older Popen
  method if it doesn't work.  Essentially this is to be a little nicer
  to Python 2.7.15 (even though the examples are filled with warnings
  that py2 support is not guaranteed with the examples).
2018-09-15 12:10:05 +10:00
Thomas Oberndörfer
dd7d37ca21
js: Fix errorDetails of GPGME_Signature
* lang/js/src/Signature.js (GPGME_Signature.errorDetails):
Access properties from the summary object.
2018-09-10 13:11:48 +02:00
Maximilian Krambach
53d69af014 js: add new documentation file to extra_dist
--
* jsdoc_index.md is the documentation's 'main page' to offer a better
  intro than only the parser-generated API confusion.
2018-09-06 11:27:39 +02:00
Maximilian Krambach
6463b1cd3b js: fix error in toKeyIdArray
--
* src/Helpers.js: GPGME_Keys were not parsed as valid, as their
  fingerprint getter is not a fingerprint 'property'.

* BrowserTestExtension: fixed a dsplay typo in counting of tests.
2018-09-06 10:11:10 +02:00
Maximilian Krambach
1c618166fc js: documentation cleanup
--
2018-09-05 18:46:28 +02:00
Maximilian Krambach
dacb119715 js: key deletion after test
--

* Yet again some wrong syntax in Browsertests
2018-08-31 15:24:38 +02:00
Maximilian Krambach
346dfac0de js: cleanup after key import test
--

* one of the public Keys imported was not removed afterwards.
2018-08-31 10:36:54 +02:00
Ben McGinnes
55991aa916 docs: python bindings
* minor typographic update.

Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-08-31 17:36:45 +10:00
Maximilian Krambach
87bbe728fa js: tests for file name encoding
--

* BrowsertestExtension/tests/decryptTest.js: There were cases in which
  file names returned in a wrong encoding from decryption. The test
  cases here are a  'Hello World' in a text file with different names,
  then being encrypted with cli gnupg.
2018-08-30 16:16:13 +02:00
Maximilian Krambach
5d6039f6bf js: decoding of information
--

* src/Helpers.js: This additional escape should 'repair' special
  characters like spaces in filenames. In the strange world of
  encoding there is little hope that this captures all cases, or
  that it will never fail to return some value, let alone meaningful.
  In my test cases it worked.
2018-08-30 15:37:37 +02:00
Maximilian Krambach
3201ded91f js: add tests
--

* BrowserTestExtension/tests:

  - decryptTest.js: Check Decryption and return values of binary data
  - encryptTest.js: Return data type of armored/non-armored encryption
  - added a small encoded input png for testing

* DemoExtension/maindemo.js: Fixed unexpected usage of the Demo encrypt
  (non-armored)
2018-08-30 15:00:19 +02:00
Maximilian Krambach
44691995b7 js: add encoding parameter for encrypt return
--

* src/gpgme.js: In case the encryption was done unarmored, the result
  is binary data. Added an option to either return the binary data as
  base64-encoded string or as Uint8Array, similar to return values of
  decrypt
2018-08-30 14:46:54 +02:00
Maximilian Krambach
a9863717b1 js: separate gpgme answer by type of data
--

* src/Connection.js; src/permittedOperations.js: To avoid further
  encoding problems, data sent by gpgme is now sorted  as either
  'payload' or 'info'. Payload data may come in any encoding, and here
  the 'expected' and 'format' options are used, 'info' data may
  contain text created by gnupg which may need re-encoding, but this
  should not be affected by 'expected' and 'format'
2018-08-30 12:09:26 +02:00
Ben McGinnes
1d00fb987b python bindings: estreams fix
* lang/python/src/core.py: Adjusted new_from_estream function to alias
  new_from_stream instead of fd.
* fixed the _gpgme import errors introduced in commit
  08cd34afb7 by changing the exported
  functions/types to match the inner module where all the work is
  done, rather than the outer one(s).

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
2018-08-30 15:41:31 +10:00
Maximilian Krambach
61ac70cfb5 js: return base64 after encrypt with armor=false
--

* src/gpgmejs.js/encrypt: the encrypted data were converted back to a
  (incorrect) string, whereas they should be data with no encoding
  specified. Returning base64 data is the expected way.
* DemoExtension: caught yet another usage of old syntax.
2018-08-29 17:45:55 +02:00
Ben McGinnes
18ea838671 python bindings: core
* lang/python/src/core.py: expanded gpgme_error check lists.
2018-08-30 01:01:23 +10:00
Ben McGinnes
dcedddecb6 python bindings: core
* lang/python/src/core.py: added gpgme_data_set_flag to the errorcheck
  funtion.
2018-08-30 01:01:23 +10:00
Ben McGinnes
6078b53033 python bindings: core
* lang/python/src/core.py: added new function new_from_estream to wrap
  new_from_fd just like new_from_stream does and for the same reason.
2018-08-30 01:01:23 +10:00
Ben McGinnes
f7e5ae7f16 docs: python bindings - protonmail examples
* lang/python/docs/GPGMEpythonHOWTOen.org: Updated links to the
  ProtonMail keyserver import scripts and added a warning regarding
  being unable to update third party keys.
* lang/python/examples/howto/pmkey-import-alt.py: added usage.
* lang/python/examples/howto/pmkey-import.py: added usage.
2018-08-29 20:30:57 +10:00
Ben McGinnes
02d0b97bfe docs: python bindings HOWTO
* Finished CFFI vs SWIG bit in known issues.
* tidied up some of the structure.
* Fixed some minor errors and links.
2018-08-29 04:14:24 +10:00
Ben McGinnes
a8a983c5bc docs: python bindings
* Added section on why no CFFI.
2018-08-29 03:42:46 +10:00
Ben McGinnes
c2831e2377 docs: python howto
* Added another key import example using ProtonMail's new keyserver.
2018-08-28 18:45:37 +10:00
Ben McGinnes
1c261b9fa3 docs: python bindings
* Added details on installation troubleshooting.
2018-08-28 06:42:27 +10:00
Maximilian Krambach
8aa61fd3a2 js: small documentation update
--
2018-08-27 13:25:58 +02:00
Maximilian Krambach
28086252f1 js: make non-payload data more encoding-tolerant
--

* src/Helpers.js: As non-payload data might come in different
  encodings, a conversion has been introduced that worked in most
  cases. Data like the userid might come in different encodings,
  which we don't know of. For now, a try..catch returns the data
  as they are if the utf-8 decoding fails. Sometimes this yields the
  correct result, sometimes it may not work, but it won't stop the
  whole operation anymore.
2018-08-27 13:00:50 +02:00
Maximilian Krambach
766d42c248 js: typecheck destructured parameters
--

* destructuring just takes the input argument and treats it as object.
  In cases like in src/Keyring/generateKey, where I forgot to change
  the old syntax, the fingerprint as string was destructured into an
  object without "pattern", which caused all Keys to be retrieved.
  So, methods with a destructuring now check if the first argument is
  an object and get a default empty object if no parameter is
  submitted. This allows the further use of destructured parameters,
  while still ensuring nothing vastly incorrect is used.
* src/Kering.js, unittsets.js: fixed old syntax in method usage
2018-08-27 12:38:32 +02:00
Maximilian Krambach
4f28fbddd3 js: extend information on decoding in decrypt
--

* src/Connection.js: resulting data, if not pure ascii, is base64
  encoded in the result message. A further decoding attempt into
  javascript 'string' will be attempted by default, unless specified
  at the decrypt() method. The return value 'format' now shows which
  of the possibilities has been applied. The old boolean 'base64'
  now turns into format:'base64' if the returned payload is a base64
  string after decryption.
2018-08-27 11:50:09 +02:00
Maximilian Krambach
557fec6002 js: fix file_name return on decrypt
--
* src/gpgmejs: Line 228 checked the wrong variable. To avoid further
  confusion, _result was renamed to returnValue in the whole file
2018-08-27 11:21:02 +02:00
Maximilian Krambach
138e1dde02 js: add new options to permittedOperations
--

* reflecting the new optional strings accepted by the backend.
  'file_name' and 'sender' can be  used via the 'additional'
  parameter in encrypt operations
2018-08-24 10:33:42 +02:00
Maximilian Krambach
f62dd4bb27 js: fix syntax inside Keyring methods
--

* recent changes in parameter calling led to a forgotten internal call
  in getDefaultKey using old syntax (and failing in case a default key
  is configured)
2018-08-23 17:58:22 +02:00
Maximilian Krambach
352c53040d js: offer an always-trust parameter on encrypt
--

* src/gpgmejs.js: Setting the default to 'always trust' assumes that
  most api users will already have made their internal checks, but may
  not have the gnupg web-of-trust model implemented, thus trusting the
  key themselves, without gnupg having full or even any information.
  Still it should stay an option to have gnupg decide.
2018-08-23 12:30:49 +02:00
Maximilian Krambach
3fd6837fce js: use destructured option parameters
--
* Adds to f0409bbdaf and makes use of
  destructuring, allowing for defaults, and cleaning up the
  validation.
2018-08-23 12:15:59 +02:00
Maximilian Krambach
60dc499abd js: update getDefaultKey to more precise logic
--

* src/Keyring.js: Adapted Keyring.getDefaultKey() to my current
  understanding  of a default signing key: either the default key set
  in the gpg config, or 'the first usable private key' - usability
  meaning  'not invalid, expired, revoked, and can be used for
  signing'. It should be the same key used as in command line when
  doing a --sign operation.
  In case the user has a smartcard plugged in, we currently
  won't know of this here, so our choice may differ. But as we do all
  javascript-binding sign operations with the key  fingerprint
  explicitly set, this should not be a real problem. This method is
  seen more as a convenience to tell using librarys which key
  represents the main user.
2018-08-23 11:28:18 +02:00
Maximilian Krambach
24a0005865 js: add decrypt result options
--

* As a decrypt result cannot be known beforehand, the decrypt operation
  may add an 'expect' property, taking either 'uint8' or 'base64',
  which will return the decrypted data in the appropiate formats.
  the return property 'format' will give a feedback on which option
  was taken.
  A test was added to reflect these changes.
2018-08-22 19:07:05 +02:00
Maximilian Krambach
f0409bbdaf js: make method parameters objects
--

* As requested by using parties, the options to be passed into the
  methods are now objects, with the objects' properties better
  describing what they do, and to avoid the need to type several nulls
  in a method call if one wants the last parameter.
  - src/Keyring.js, src/gpgme.js: Changed parameters and their
    validations
  - BrowserTest/*.js Had to adapt quite some calls to the new format
2018-08-22 18:37:46 +02:00
Maximilian Krambach
129fa919b9 js: improve decryption performance
--
* src/Connection.js, src/Helpers.js: performance of decoding incoming
  base64 data was improved to about 4 times the speed by introducing
  two more efficient functions (thanks to rrenkert@intevation.de for
  finding and testing them)

* src/gpgmejs.js: Decrypted data will now return as Uint8Array, if the
  caller does not wish for a decoding. Decoding binary data will return
  invalid data, and a Uint8Array may be desired. This can be indicated
  by using the (new) 'binary' option in decrypt.

* src/Errors.js A new error in case this decoding fails

* src/Message.js, src/Connection.js: expected is change from base64
  to binary, to avoid confusion later on.
2018-08-22 16:32:31 +02:00
Maximilian Krambach
94a0ed361e js: Return error if signature has no fingerprint
--

* src/Signature.js/get fingerprint: A signature with no fingerprint
  should not happen, but if it does, we should throw an error here,
  as the method is a getter.
2018-08-22 14:49:11 +02:00
Andre Heinecke
59ed27bae1
Merge branch 'javascript-binding'
This adds a new language binding "gpgme.js" to GPGME. It
serves as a bridge between the native-messaging service "gpgme-json"
and JavaScript Applications.

The first user of this binding will be Mailvelope which will
see GnuPG integration in the near future.

GnuPG-Bug-Id: T4107
2018-08-22 13:15:35 +02:00
Maximilian Krambach
d8fd4aad8a js: changed verify signature result infos
--

* the resulting information of verify now are as documented,
  and the same as in a decrypt callback
2018-08-22 12:44:05 +02:00