gpgme.git
2 years agotests: Mark lots of unused vars and fix const mismatches.
Werner Koch [Tue, 13 Sep 2016 18:48:06 +0000 (20:48 +0200)]
tests: Mark lots of unused vars and fix const mismatches.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agotests: Use gpgme_io_write in passhrase callbacks.
Werner Koch [Tue, 13 Sep 2016 18:46:41 +0000 (20:46 +0200)]
tests: Use gpgme_io_write in passhrase callbacks.

* tests/gpg/t-support.h (passphrase_cb): Use gpgme_io_write.
* tests/gpgsm/t-support.h (passphrase_cb): Ditto.
* tests/run-support.h (passphrase_cb): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Do not pass const char* to functions taking a char*.
Werner Koch [Tue, 13 Sep 2016 18:44:59 +0000 (20:44 +0200)]
core: Do not pass const char* to functions taking a char*.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agobuild: Use more compiler warnings
Werner Koch [Tue, 13 Sep 2016 18:41:16 +0000 (20:41 +0200)]
build: Use more compiler warnings

* configure.ac: Add useful compiler warnings.
--

It is strange that this seems to be the only GnuPG package which does
not use modern warning.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: New function gpgme_op_create_key.
Werner Koch [Tue, 13 Sep 2016 16:57:38 +0000 (18:57 +0200)]
core: New function gpgme_op_create_key.

* src/engine-backend.h (engine_ops): Change prototype of genkey.
* src/engine-gpgsm.c (gpgsm_genkey): Change accordingly.
* src/engine-gpg.c (gpg_genkey): Change it to a dispatcher.
(gpg_createkey_from_param): New for the old functionality.
(gpg_createkey_legacy): New.  Stub for now.
(gpg_createkey): New.
(gpg_addkey): New.  Stub for now.
(gpg_adduid): New.  Stub for now.
* src/engine.c (_gpgme_engine_op_genkey): Add new args.
* src/genkey.c (op_data_t): Add field ERROR_CODE.
(parse_error): New.
(genkey_status_handler): Parse ERROR status line.
(genkey_start): Use NULL/0 for the new args.
(createkey_start): New.
(gpgme_op_createkey_start, gpgme_op_createkey): New.
* src/gpgme.def, src/libgpgme.vers: Add gpgme_op_createkey_start and
gpgme_op_createkey.
* src/gpgme.h.in (_gpgme_op_genkey_result): Add fields PUBKEY and
SECKEY.
(GPGME_CREATE_SIGN): New.
(GPGME_CREATE_ENCR): New.
(GPGME_CREATE_CERT): New.
(GPGME_CREATE_AUTH): New.
(GPGME_CREATE_NOPASSWD): New.
(GPGME_CREATE_SELFSIGNED): New.
(GPGME_CREATE_NOSTORE): New.
(GPGME_CREATE_WANTPUB): New.
(GPGME_CREATE_WANTSEC): New.
(GPGME_CREATE_FORCE): New.

* tests/run-genkey.c: New.
* tests/Makefile.am (noinst_PROGRAMS): Add it.
--

This function uses the new --quick-gen-key API of gpg.  A limited
compatibility mode to use older gpg versions and gpgsm will eventually
be provided.  Not all flags are currently implemented.

 ./run-genkey --unprotected --force test@example.com

Create a new standard key with the given user id.  --force is used to
allow creating more than one key with that user id in the keyring.

 ./run-genkey --unprotected --force \
      test@example.com default default 2145826800

Creates a new standard key with an expiration date of 2037-12-31.

 ./run-genkey --unprotected --force \
      test@example.com future-default default 2145826800

Create a standard key using the fugure default algorithms.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agopython: Handle slight differences between Python 2 and 3.
Justus Winter [Tue, 13 Sep 2016 08:44:14 +0000 (10:44 +0200)]
python: Handle slight differences between Python 2 and 3.

* lang/python/helpers.c (pyDataWriteCb): Handle Python integers being
returned on Python 2.
(pyDataSeekCb): Likewise.
* lang/python/pyme/core.py (Data.__init__): Fix testing for string
argument.
(Data.new_from_filepart): Likewise.
* lang/python/pyme/util.py (is_a_string): New function.
* lang/python/tests/t-encrypt-large.py (read_cb): Force evaluation of
generator.
* lang/python/tests/t-idiomatic.py: Partly skip test on Python 2.
* lang/python/tests/t-verify.py (check_result): Here, the difference
between 2 and 3 really matters.  We cannot change the char *
conversion in Python 2 without breaking all existing applications, and
using bytestrings in Python 3 would be very inconvenient.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Fix types and error handling.
Justus Winter [Tue, 13 Sep 2016 11:25:15 +0000 (13:25 +0200)]
python: Fix types and error handling.

* lang/python/helpers.c (_pyme_edit_cb): Drop the const.
(_pyme_assuan_{data,inquire,status}_cb): Fix error handling.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Avoid Python3-only form of super().
Justus Winter [Mon, 12 Sep 2016 15:21:34 +0000 (17:21 +0200)]
python: Avoid Python3-only form of super().

* lang/python/pyme/core.py (GpgmeWrapper.__repr__): Use more
compatible form of super.
(GpgmeWrapper.__setattr__): Likewise.
(Context.__init__): Likewise.
(Data.__init__): Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Make type translation compatible with Python 2.7.
Justus Winter [Mon, 12 Sep 2016 15:11:19 +0000 (17:11 +0200)]
python: Make type translation compatible with Python 2.7.

* lang/python/gpgme.i: Avoid functions not available in Python 2.7.
* lang/python/helpers.c: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Avoid hardcoding the interpreter.
Justus Winter [Mon, 12 Sep 2016 14:19:07 +0000 (16:19 +0200)]
python: Avoid hardcoding the interpreter.

* lang/python/setup.py.in: Avoid hardcoding the interpreter.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agopython: Do not rely on subprocess.DEVNULL.
Justus Winter [Mon, 12 Sep 2016 14:18:31 +0000 (16:18 +0200)]
python: Do not rely on subprocess.DEVNULL.

* lang/python/setup.py.in: Do not rely on subprocess.DEVNULL.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agotests: Fix version comparison.
Justus Winter [Mon, 12 Sep 2016 13:42:07 +0000 (15:42 +0200)]
tests: Fix version comparison.

* tests/gpg/t-sig-notation.c: Fix version comparison.

Fixes-commit: a0263ad2
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agotests: Make signature notation test compatible with older GnuPGs.
Justus Winter [Mon, 12 Sep 2016 12:53:08 +0000 (14:53 +0200)]
tests: Make signature notation test compatible with older GnuPGs.

* lang/python/tests/t-sig-notation.py: Only check the critical flag
when GnuPG >= 2.1.13 is used.
* tests/gpg/t-sig-notation.c: Likewise.

Fixes-commit: c88c9ef3
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agoqt: Fix some includes
Andre Heinecke [Mon, 12 Sep 2016 08:52:10 +0000 (10:52 +0200)]
qt: Fix some includes

* lang/qt/src/qgpgmekeyformailboxjob.cpp: Explicitly include
QStringList.
* lang/qt/tests/t-support.h, lang/qt/tests/t-support.cpp: Move
includes into impl. Explicitly include QDir.

--
This fixes build against Qt versions where the includes are less
implicit.

2 years agoqt: Fix tofu test.
Justus Winter [Mon, 12 Sep 2016 08:11:44 +0000 (10:11 +0200)]
qt: Fix tofu test.

* lang/qt/tests/t-tofuinfo.cpp: Adjust member names.

Fixes-commit: 120b1478
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agocore,cpp: Extend the TOFU information.
Werner Koch [Wed, 7 Sep 2016 07:26:11 +0000 (09:26 +0200)]
core,cpp: Extend the TOFU information.

* src/gpgme.h.in (struct _gpeme_tofu_info): Rename FIRSTSEEN to
SIGNFIRST and LASTSEEN to SIGNLAST.  Add ENCRFIST and ENCRLAST.
* src/keylist.c (parse_tfs_record): Parse to ENCRFIRST and ENCRLAST.
* src/verify.c (parse_tofu_stats): Ditto.
* tests/run-keylist.c (main): Adjust and print encrypt stats.
* tests/run-verify.c (print_result): Ditto.

* lang/cpp/src/tofuinfo.h (TofuInfo): Rename firstSeen to signFirst
and lastSeen to signLast.  Add encrCount, encrFirst and encrLast.
* lang/cpp/src/tofuinfo.cpp (encrCount, encrFirst, encrLast): New.
--

The latest GnuPG commits have the needed changes but we also allow the
use of currently released GnuPG version.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agotests: Set passphrase cb in t-encrypt-mixed
Andre Heinecke [Tue, 6 Sep 2016 14:32:01 +0000 (16:32 +0200)]
tests: Set passphrase cb in t-encrypt-mixed

* tests/gpg/t-encrypt-mixed.c (main): Set passphrase cb.

--
This fixes the test when run without an agent and our
faked pinentry program.

2 years agocore: Check for gpg version for loopback mode
Andre Heinecke [Tue, 6 Sep 2016 14:30:24 +0000 (16:30 +0200)]
core: Check for gpg version for loopback mode

* src/engine-gpg.c (build_argv): Check for version 2.1.0
before adding pinentry-mode.

--
This is a compatibility fix for older versions that don't support
this flag which would otherwise result in an invalid argument
error.

2 years agocore: Fix passphrase cb for mixed sym encrypt
Andre Heinecke [Tue, 6 Sep 2016 14:28:45 +0000 (16:28 +0200)]
core: Fix passphrase cb for mixed sym encrypt

* src/encrypt.c (encrypt_start): Handle SYMMETRIC flag.
* src/encrypt-sign.c (encrypt_sign_start): Ditto.

--
This causes the passphrace command handler to be properly
registered which in turn will result in the passphrase
callback beeing called.

2 years agoqt: Clarify comment and strings in tofuinfo test
Andre Heinecke [Mon, 5 Sep 2016 14:54:50 +0000 (16:54 +0200)]
qt: Clarify comment and strings in tofuinfo test

* lang/qt/tests/t-tofuinfo.cpp (testTofuSignCount)
(testTofuKeyList): Ensure distinct messages. Clarify comment.

2 years agoqt: Enable signcount checks in tofuinfo test
Andre Heinecke [Mon, 5 Sep 2016 10:58:35 +0000 (12:58 +0200)]
qt: Enable signcount checks in tofuinfo test

* lang/qt/tests/t-tofuinfo.cpp: Enable checks for signcount.

--
Signcount for userIDs works now as expected with gnupg 2.1.16.

2 years agocpp: Add convenience update function to a key
Andre Heinecke [Mon, 5 Sep 2016 10:53:02 +0000 (12:53 +0200)]
cpp: Add convenience update function to a key

* lang/cpp/src/key.cpp (Key::update): New.
* lang/cpp/src/key.h: Update accordingly.

--
This function helps if you have an incomplete key or want
to make sure all info in a key is complete (e.g. validity / tofuinfo)

2 years agocpp: Add ostream operators for key and uid
Andre Heinecke [Mon, 5 Sep 2016 09:57:09 +0000 (11:57 +0200)]
cpp: Add ostream operators for key and uid

* lang/cpp/src/key.cpp (Key, UserID): Add ostream operator.
* lang/cpp/src/key.h: Update accordingly.

--
This is helpful debugging / showing the state of a key / uid and
tofuinfo.

2 years agoqt: Add missing header redirection
Andre Heinecke [Mon, 5 Sep 2016 08:44:41 +0000 (10:44 +0200)]
qt: Add missing header redirection

* lang/qt/src/keyformailboxjob.h,
lang/qt/src/qgpgmekeyformailboxjob.h: Fix includes.

--
This ensures that when building qgpgme you do not need an installed
gpgme++.

2 years agoqt: Include cpp before core directory
Andre Heinecke [Mon, 5 Sep 2016 08:42:02 +0000 (10:42 +0200)]
qt: Include cpp before core directory

* lang/qt/src/Makefile.am (AM_CPPFLAGS): Include cpp before core.

--
Both core and cpp have headers that have the same names, this
can lead to the wrong headers beeing included when qt bindings
are built.

2 years agoqt: Fix 2.1 t-support copy
Andre Heinecke [Thu, 25 Aug 2016 15:16:25 +0000 (17:16 +0200)]
qt: Fix 2.1 t-support copy

* lang/qt/src/t-support.cpp (copyKeyring): Fix seckey copy.

2 years agoqt: Fix and extend TofuInfo test.
Andre Heinecke [Thu, 25 Aug 2016 14:25:49 +0000 (16:25 +0200)]
qt: Fix and extend TofuInfo test.

* lang/qt/tests/t-tofuinfo.cpp: Delete executed jobs.
(testTofuKeyList): New.
(testSupported): Activate for 2.1.16
(signAndVerify): Disable sigcount tests.

2 years agoqt: Fix keyring copy in tests
Andre Heinecke [Thu, 25 Aug 2016 14:23:58 +0000 (16:23 +0200)]
qt: Fix keyring copy in tests

* lang/qt/test/t-encrypt.cpp,
lang/qt/test/t-tofuinfo.cpp: Assert on copy failure.
* lang/qt/test/t-support.cpp (copyKeyrings): Fix path.

2 years agoqt: Add generic flag support for keylistjobs
Andre Heinecke [Thu, 25 Aug 2016 14:22:12 +0000 (16:22 +0200)]
qt: Add generic flag support for keylistjobs

* lang/qt/src/keylistjob.h (addMode): New.
* lang/qt/src/qgpgmekeylistjob.h (addMode): New.
* lang/qt/src/qgpgmekeylistjob.cpp (addMode: New.

--
Instead of new API for each new thing lets be a bit more
generic / open.

2 years agoqt: Ensure that current src dir is included first
Andre Heinecke [Thu, 25 Aug 2016 14:19:39 +0000 (16:19 +0200)]
qt: Ensure that current src dir is included first

* lang/qt/src/Makefile.am: Reorder include directives.

--
This fixes the problem that QGpgME would pick up gpgme or
gpgme++ headers from an installed version.

2 years agocpp: Add WithTofu Keylist Mode
Andre Heinecke [Thu, 25 Aug 2016 14:17:46 +0000 (16:17 +0200)]
cpp: Add WithTofu Keylist Mode

* lang/cpp/src/context.cpp: Handle WithTofu.
* lang/cpp/src/global.h (KeyListMode): Add WithTofu.
* lang/cpp/src/util.h (add_to_gpgme_keylist_mode_t): Handle WithTofu.

2 years agoqt: Fix tofuinfo test when gpg is gpg2
Andre Heinecke [Thu, 25 Aug 2016 13:20:02 +0000 (15:20 +0200)]
qt: Fix tofuinfo test when gpg is gpg2

* lang/qt/tests/t-support.cpp (QGpgMETest::copyKeyrings): New helper.
* lang/qt/tests/t-support.h: Declare.
* lang/qt/tests/t-encrypt.cpp: use it
* lang/qt/tests/t-tofuinbo.cpp: ditto.

--
New helper takes care of copying the correct files for either
keybox or keyring.

2 years agoqt: Remove unused variable in test
Andre Heinecke [Thu, 25 Aug 2016 13:00:46 +0000 (15:00 +0200)]
qt: Remove unused variable in test

* t-wkspublish.cpp (testWKSPublishCreate): Remove context.

2 years agoqt: Add test for wkspublishjob
Andre Heinecke [Thu, 25 Aug 2016 12:35:09 +0000 (14:35 +0200)]
qt: Add test for wkspublishjob

* lang/qt/tests/t-wkspublish.cpp: New.
* lang/qt/tests/Makefile.am: Update accordingly.

--
Most tests are disabled by default as tey require
an online connection.
Define DO_ONLINE_TESTS to enable the tests.

2 years agoqt: Add WKSPublishJob
Andre Heinecke [Thu, 25 Aug 2016 12:29:41 +0000 (14:29 +0200)]
qt: Add WKSPublishJob

* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/job.cpp: Include moc / subclass stub.
* lang/qt/src/protocol.h: Add virtual for new job.
* lang/qt/src/protocol_p.h: Add job.
* lang/qt/src/wkspublishjob.h: Interface for WKSPublishJob.
* lang/qt/src/qgpgmewkspublishjob.cpp,
lang/qt/src/qgpgmewkspublishjob.h: New.

--
The Job was originally intended to be used with a SpawnEngine
Context but QProcess was a better fit for the job.

Usage is similar to the client tool. check, create, recieve.

2 years agoCpp: Change firstSeen / lastSeen return values
Andre Heinecke [Thu, 25 Aug 2016 08:46:17 +0000 (10:46 +0200)]
Cpp: Change firstSeen / lastSeen return values

* lang/cpp/src/tofuinfo.cpp,
lang/cpp/src/tofuinfo.h (TofuInfo::firstSeen, TofuInfo::lastSeen):
Change return values to unsigned long and update doc.

2 years agoCpp: Add wrapper for gpgme_get_dirinfo
Andre Heinecke [Thu, 25 Aug 2016 08:45:24 +0000 (10:45 +0200)]
Cpp: Add wrapper for gpgme_get_dirinfo

* lang/cpp/src/context.cpp (dirInfo): New.
* lang/cpp/src/global.h (dirInfo): New.

2 years agoCpp: Add support for spawn engine
Andre Heinecke [Thu, 25 Aug 2016 08:42:49 +0000 (10:42 +0200)]
Cpp: Add support for spawn engine

* lang/cpp/src/context.cpp (Context::spawn, Context::spawnAsync): New.
* lang/cpp/src/context.h: Add prototypes.
(SpawnFlags): New.
* lang/cpp/src/global.h (SpawnEngine): Added.

2 years agocore: Add GPGME_KEYLIST_MODE_WITH_TOFU.
Werner Koch [Thu, 25 Aug 2016 09:38:03 +0000 (11:38 +0200)]
core: Add GPGME_KEYLIST_MODE_WITH_TOFU.

* src/gpgme.h.in (GPGME_KEYLIST_MODE_WITH_TOFU): New.
* src/engine-gpg.c (gpg_keylist_build_options): Use that.
* src/keylist.c: Include limits.h.
(parse_tfs_record): New.
(keylist_colon_handler): Support TFS record.
* tests/run-keylist.c: Include time.h.
(isotimestr): New.
(main): Add option --tofu.  Print TOFU info.
* tests/run-verify.c: Include time.h.
(isotimestr): New.
(print_result): Use isotimestr for TOFU dates.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Adjust for TOFU_STATS change in gnupg 2.1.16.
Werner Koch [Wed, 24 Aug 2016 18:10:36 +0000 (20:10 +0200)]
core: Adjust for TOFU_STATS change in gnupg 2.1.16.

* src/gpgme.h.in (_gpgme_tofu_info): Change 'firstseen' and 'lastseen'
to a timestamp value.
* src/verify.c (parse_tofu_stats): Do not cap these values at UINT_MAX.
--

Using an unsigned long here is okay: We will never get an error and
even on machines where unsigned long is 32 bit (e.g. Windows64) this
allows us to operate until 2106.  By then Windows will be a footnote
in history or Windows128 has changed that type to something larger
than 32 bit ;-)

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Set the 'encrcount' field in gpgme_tofu_info_t.
Werner Koch [Wed, 24 Aug 2016 14:04:54 +0000 (16:04 +0200)]
core: Set the 'encrcount' field in gpgme_tofu_info_t.

* src/verify.c (parse_tofu_stats): Set ENCRCOUNT field.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocpp: Get rid of AssuanResult due to its deprecation.
Werner Koch [Tue, 23 Aug 2016 17:50:01 +0000 (19:50 +0200)]
cpp: Get rid of AssuanResult due to its deprecation.

* lang/cpp/src/assuanresult.cpp: Remove.
* lang/cpp/src/assuanresult.h: Remove.
* lang/cpp/src/Makefile.am: Remove these files.
* lang/cpp/src/context.cpp: Remove header assuanresult.h
(assuanTransact): Change return type to Error.  Use
gpgme_op_assuan_transact_ext.
(startAssuanTransaction): Change return type to Error.
(assuanResult): Remove
* lang/cpp/src/context.h (assuanResult): Adjust for changes.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoQt: Adapt (disabled) tofuinfo test to new API
Andre Heinecke [Wed, 24 Aug 2016 12:00:41 +0000 (14:00 +0200)]
Qt: Adapt (disabled) tofuinfo test to new API

* lang/qt/tests/t-tofuinfo.cpp: Switch to UID based API.

--
Test is still disabled as GnuPG still returns unexpected
results.

2 years agoCpp: Add Key to signature
Andre Heinecke [Wed, 24 Aug 2016 11:59:37 +0000 (13:59 +0200)]
Cpp: Add Key to signature

* lang/cpp/src/verificationresult.cpp,
lang/cpp/src/verificationresult.h (Signature::key): New.

2 years agoCpp: Use fpr field for primaryFingerprint
Andre Heinecke [Wed, 24 Aug 2016 11:57:49 +0000 (13:57 +0200)]
Cpp: Use fpr field for primaryFingerprint

* lang/cpp/src/key.cpp (Key::primaryFingerprint): Return
fpr value if available.

--
Should not be necessary but we might have an incomplete
key without subkeys but the fingerprint already set in
gpgme's data type.

2 years agoCpp: Move tofuinfo from signature to userid
Andre Heinecke [Tue, 23 Aug 2016 14:40:21 +0000 (16:40 +0200)]
Cpp: Move tofuinfo from signature to userid

* lang/cpp/src/key.cpp (UserID::tofuInfo): New.
* lang/cpp/src/key.h: Update accordingly.
* lang/cpp/src/tofuinfo.cpp: Remove dropped fields.
* lang/cpp/src/tofuinfo.h: Update accordingly.
* lang/cpp/src/verificationresult.cpp,
lang/cpp/src/verificationresult.h: Remove tofu info.
* lang/qt/tests/t-tofuinfo.cpp: Disable for now.

--
With be4ff75d7 Tofu info now lives with a UserID
Object. While this breaks API it was not yet released.

2 years agocore: Put the protocol into a TOFU created key object.
Werner Koch [Tue, 23 Aug 2016 13:55:55 +0000 (15:55 +0200)]
core: Put the protocol into a TOFU created key object.

* src/verify.c (parse_tofu_user): Add arg 'protocol' and store it in
the KEY.
(_gpgme_verify_status_handler): Pass protocol.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Change the way TOFU information are represented.
Werner Koch [Tue, 23 Aug 2016 13:22:28 +0000 (15:22 +0200)]
core: Change the way TOFU information are represented.

* src/gpgme.h.in (struct _gpgme_signature): Remove field 'tofu'.  Add
field 'key'.
(struct _gpgme_key): Add field 'fpr'.
(struct _gpgme_user_id): Add field 'tofu'.
(struct _gpgme_tofu_info): Remove fields 'address' and 'fpr'.
* src/key.c (gpgme_key_unref): Release TOFU and FPR.
* src/keylist.c (keylist_colon_handler): Store the fingerprint of the
first subkey also in KEY.
* src/verify.c (release_tofu_info): Remove.
(release_op_data): Release KEY.
(parse_tofu_user): Rewrite for new data structure.
(parse_tofu_stats): Ditto.
(parse_tofu_stats_long): Ditto.
* tests/run-verify.c (print_result): Ditto.
* tests/run-keylist.c (main): Print more fields.
--

TOFU information are now associated with the user ID and not with a
separate object.

Note that this breaks code relying on the former non-released TOFU
feature.  The C++ bindings won't work right now.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Extend gpgme_user_id_t with 'address'.
Werner Koch [Tue, 23 Aug 2016 04:48:50 +0000 (06:48 +0200)]
core: Extend gpgme_user_id_t with 'address'.

* src/mbox-util.c, src/mbox-util.h: Adjust for use in gpgme.
* src/Makefile.am (main_sources): Add mbox-util.
* src/key.c (_gpgme_key_append_name): Set 'address' field of uid.
(gpgme_key_unref): Free it.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: New code for parsing mail addresses.
Werner Koch [Mon, 22 Aug 2016 18:50:37 +0000 (20:50 +0200)]
core: New code for parsing mail addresses.

* src/mbox-util.c: New.
* src/mbox-util.h: New.
--

The files haven been copied verbatim from
GnuPG 2.1.15 commit 54245979e691129ed9d3a6c642087fb8d3227449
after the license has been changed in GnuPG.

We need this file too match GnuPG's idea of a mail address.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Add new items for gpgme_get_dirinfo.
Werner Koch [Mon, 22 Aug 2016 14:57:51 +0000 (16:57 +0200)]
core: Add new items for gpgme_get_dirinfo.

* src/dirinfo.c (WANT_SYSCONFDIR, WANT_LIBEXECDIR, WANT_LIBDIR): New.
(WANT_DATADIR, WANT_LCOALEDIR, WANT_AGENT_SSH_SOCKET): New
(WANT_DIRMNGR_SOCKET): New.
(dirinfo): Add fields 'sysconfdir', 'bindir', 'libexecdir', 'libdir',
'datadir', 'localedir', 'agent_ssh_socket', and 'dirmngr_socket'.
(parse_output): Set these fields.
(get_gpgconf_item): Return them.
(gpgme_get_dirinfo): Likewise.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: Base gpgme_get_dirinfo(uiserver-socket) on the socket dir.
Werner Koch [Mon, 22 Aug 2016 14:32:14 +0000 (16:32 +0200)]
core: Base gpgme_get_dirinfo(uiserver-socket) on the socket dir.

* src/dirinfo.c (dirname_len): New.
(parse_output): Change computation of UISRV_SOCKET.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agocore: New commands --lang and --have-lang for gpgme-config
Werner Koch [Sun, 21 Aug 2016 13:49:03 +0000 (15:49 +0200)]
core: New commands --lang and --have-lang for gpgme-config

* configure.ac (GPGME_CONFIG_AVAIL_LANG): New ac_subst.
* src/gpgme-config.in (avail_lang): Add commands --lang and
--have-lang.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocore: Remove (now) useless diagnostic
Andre Heinecke [Thu, 18 Aug 2016 15:14:36 +0000 (17:14 +0200)]
core: Remove (now) useless diagnostic

* src/w32-io.c(_gpgme_io_spawn): Remove spawnhelper not found
diagnostic.

--
When spawnhelper is not found the error is now catched before
the CreateProcess call so the added diagnostic in bb2d11c
(which was not helpful because the value for spawnhelper
would be NULL in that case) is now no longer needed.

3 years agocore: Fail loudly in case w32 spawner not found
Andre Heinecke [Thu, 18 Aug 2016 14:56:58 +0000 (16:56 +0200)]
core: Fail loudly in case w32 spawner not found

* src/w32-io.c (_gpgme_io_spawn): Show a message box in
case gpgme-w32spawn.exe not found.

--
Otherwise every engine call will just fail with unsupported
protocol. Even in the debug output the problem was not made
clear because CreateProcess will fail with error code 87
(Invalid Parameter) because spawnhelper is NULL. The helpful
error message for ERROR_INVALID_PARAMETER would have been:
"is 'NULL' correctly installed"

As GpgME basically becomes useless on Windows without the
spawnhelper we want to fail very loud in that case.

3 years agoCpp: Fix some pedantic warnings
Andre Heinecke [Wed, 17 Aug 2016 05:23:05 +0000 (07:23 +0200)]
Cpp: Fix some pedantic warnings

* lang/cpp/src/context.cpp,
lang/cpp/src/context.h (Context::getKeysFromRecipients): Remove
ignored / invalid const qualifier.
* lang/cpp/src/result.h: Don't shadow error function in ctor.

3 years agocore: New global flag "require-gnupg".
Werner Koch [Tue, 16 Aug 2016 16:53:42 +0000 (18:53 +0200)]
core: New global flag "require-gnupg".

* src/gpgme.c (gpgme_set_global_flag): Add flag.
* src/engine.c (engine_minimal_version): New variable.
(_gpgme_set_engine_minimal_version): New function.
(gpgme_get_engine_info): Check that flag.

* tests/run-keylist.c (main): New option --require-gnupg.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocore: Simplify setting of dummy versions.
Werner Koch [Tue, 16 Aug 2016 16:49:11 +0000 (18:49 +0200)]
core: Simplify setting of dummy versions.

* src/engine.c (_gpgme_engine_info_release): Do not assert but free
FILE_NAME.
(gpgme_get_engine_info): Provide default for VERSION and REQ_VERSION.
Use calloc instead of malloc.
(_gpgme_set_engine_info): Ditto.
* src/engine-assuan.c (llass_get_version): Return NULL.
(llass_get_req_version): Ditto.
* src/engine-spawn.c (engspawn_get_version): Ditto.
(engspawn_get_req_version): Ditto.
* src/engine-uiserver.c (uiserver_get_version): Ditto.
(uiserver_get_req_version): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoQt: Add test for progress signal of encryptjob
Andre Heinecke [Fri, 12 Aug 2016 14:55:51 +0000 (16:55 +0200)]
Qt: Add test for progress signal of encryptjob

* lang/qt/tests/t-encrypt.cpp (testProgress): New.

--
This tests that a ByteArray IODevice now gives proper progress
signals.

3 years agoCpp: Provide size-hint for seekable and mem data
Andre Heinecke [Fri, 12 Aug 2016 14:51:13 +0000 (16:51 +0200)]
Cpp: Provide size-hint for seekable and mem data

* lang/cpp/src/data.cpp (GpgME::Data::Data): Set size-hint for
mem and DataProvider based Data.

--
This fixes the case that QGpgME did not have a total value for
progress as the size was unknown.

3 years agocore: Make use of the "size-hint" in engine-gpg.
Werner Koch [Fri, 12 Aug 2016 13:24:46 +0000 (15:24 +0200)]
core: Make use of the "size-hint" in engine-gpg.

* src/engine-gpg.c: Include data.h.
(add_input_size_hint): New.
(gpg_decrypt, gpg_encrypt, gpg_encrypt_sign, gpg_sign)
(gpg_verify): Call new function,

* tests/run-encrypt.c (status_cb): Print to stderr.
(progress_cb): New.o
(main): Add option --progress.  Print full-status lines.  Provide a
size for the input data.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocore: Add gpgme_data_set_flag to add more meta data to data objects.
Werner Koch [Fri, 12 Aug 2016 13:21:16 +0000 (15:21 +0200)]
core: Add gpgme_data_set_flag to add more meta data to data objects.

* src/gpgme.h.in (gpgme_data_set_flag): New public function.
* src/data.c (gpgme_data_set_flag): New.
(_gpgme_data_get_size_hint): New.
* src/data.h (strucy gpgme_data): Add field 'size_hint'.
* src/gpgme.def, src/libgpgme.vers: Add new function.
* src/conversion.c (_gpgme_string_to_off): New.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoAdd Python bindings to NEWS.
Justus Winter [Fri, 12 Aug 2016 10:28:03 +0000 (12:28 +0200)]
Add Python bindings to NEWS.

--
Signed-off-by: Justus Winter <justus@g10code.com>
3 years agoQt: Fix defaultkeygenerationjob build
Andre Heinecke [Fri, 12 Aug 2016 06:17:18 +0000 (08:17 +0200)]
Qt: Fix defaultkeygenerationjob build

* lang/qt/src/defaultkeygenerationjob.cpp: Include moc.

3 years agoQt: Add DefaultKeyGenerationJob
Andre Heinecke [Thu, 11 Aug 2016 15:57:14 +0000 (17:57 +0200)]
Qt: Add DefaultKeyGenerationJob

* lang/qt/src/defaultkeygenerationjob.cpp,
lang/qt/src/defaultkeygenerationjob.h: New.
* lang/qt/src/Makefile.am: Update accordingly.

--
The defaultkeygenerationjob makes it easier to just generate a key
in the future this should probably use quick-gen key but since this
is not exposed in gpgme we hardcode the defaults and do it with
the params file.

This is also the first job that uses a new and better architecture
without backend abstraction and the pimpl pattern instead of
a specialized subclass.

This is an adoption of kde's libkleo commit f49b7157
Thanks dvratil@kde.org

3 years agoQt: Ensure all public classes are exported
Andre Heinecke [Thu, 11 Aug 2016 15:38:36 +0000 (17:38 +0200)]
Qt: Ensure all public classes are exported

* src/abstractimportjob.h,
src/cryptoconfig.h,
src/deletejob.h,
src/exportjob.h,
src/importfromkeyserverjob.h,
src/importjob.h,
src/keygenerationjob.h,
src/keylistjob.h,
src/listallkeysjob.h,
src/refreshkeysjob.h,
src/signencryptjob.h,
src/specialjob.h,
src/verifydetachedjob.h: Export classes.

--
This is an adoption of kde's libkleo commit: d6a71a4e
Thanks dvratil@kde.org

3 years agoQt: Add KeyForMailboxJob
Andre Heinecke [Thu, 11 Aug 2016 15:22:35 +0000 (17:22 +0200)]
Qt: Add KeyForMailboxJob

* lang/qt/src/job.cpp: Include moc and make subclass.
* lang/qt/src/keyformailboxjob.h,
lang/qt/src/qgpgmekeyformailboxjob.cpp,
lang/qt/src/qgpgmekeyformailboxjob.h: New.
* lang/qt/tests/run-keyformailboxjob.cpp: New manual test.
* lang/qt/tests/Makefile.am: Add run-keyformailboxjob.
* lang/qt/src/Makefile.am: Update accordingly.
* lang/qt/src/protocol.h, lang/qt/src/protocol_p.h: Add
keyformailboxjob.

--
The KeyForMailboxjob can be used to determine the best key to
use to encrypt something to a given mail address.

3 years agodoc: Get rid of version.texi
Werner Koch [Wed, 10 Aug 2016 14:33:20 +0000 (16:33 +0200)]
doc: Get rid of version.texi

* configure.ac (CC_FOR_BUILD): New.
* doc/mkdefsinc.c: New.  Taken from GnuPG and modified for gpgme.
* doc/Makefile.am (EXTRA_DIST): Add defsincdate and mkdefsinc.c
(BUILT_SOURCES): new.
(gpgme.texi): New dependency.
(mkdefsinc, defsincdate, defs.inc): New rules.
(dist-hook): New.
* doc/gpgme.texi: Include defs.inc.  Remove version.texi.
--

GnuPG-bug-id: 2352

That new system should also yield more approriate date infos for the
manual.

3 years agobuild: Declare all languages for make dist.
Werner Koch [Wed, 10 Aug 2016 14:28:36 +0000 (16:28 +0200)]
build: Declare all languages for make dist.

* lang/Makefile.am (DIST_SUBDIRS): New.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agocore: Do not identify PNG files as PGP signatures.
Werner Koch [Wed, 10 Aug 2016 13:31:25 +0000 (15:31 +0200)]
core: Do not identify PNG files as PGP signatures.

* src/data-identify.c (next_openpgp_packet): Blacklist PNG files.
--

GnuPG-bug-id: 2314
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoCpp: Handle empty recipients consistently
Andre Heinecke [Wed, 10 Aug 2016 12:12:33 +0000 (14:12 +0200)]
Cpp: Handle empty recipients consistently

* lang/cpp/src/context.cpp (Context::getKeysFromRecipients):
New helper.
(Context::encrypt, Context::startEncryption, Context::signAndEncrypt)
(Context::startCombinedSigningAndEncryption): Use new helper.
* lang/cpp/src/context.h (Context::getKeysFromRecipients): Add
as private helper.

--
bf776ce was incomplete as the code to handle recpients
was duplicated four times. This is now unified and constently
uses a nullptr instead of an empty array.

3 years agocore: Handle ENCRYPT_SYMMETRIC also for sig & enc
Andre Heinecke [Wed, 10 Aug 2016 12:01:38 +0000 (14:01 +0200)]
core: Handle ENCRYPT_SYMMETRIC also for sig & enc

* src/engine-gpg.c (gpg_encrypt_sign): Handle ENCRYPT_SYMMETRIC
flag.

3 years agoQt: Remove unused variable
Andre Heinecke [Wed, 10 Aug 2016 10:06:39 +0000 (12:06 +0200)]
Qt: Remove unused variable

* lang/qt/src/qgpgmerefreshkeysjob.cpp (slotStatus): Remove
unused variable typ.

3 years agoQt: Create TestPassphraseProvider on stack
Andre Heinecke [Wed, 10 Aug 2016 10:05:32 +0000 (12:05 +0200)]
Qt: Create TestPassphraseProvider on stack

* lang/qt/tests/t-encrypt.cpp, lang/qt/tests/t-tofuinfo.cpp: Create
TestPassphraseProvider on stack.

--
Context does not delete the provider. This fixes ASAN errors.

3 years agoCpp: Clarify ownership of provider classes
Andre Heinecke [Wed, 10 Aug 2016 10:04:16 +0000 (12:04 +0200)]
Cpp: Clarify ownership of provider classes

* lang/cpp/src/context.h: Note that the context does not take
ownership of providers.

3 years agotests: Fix memory leak.
Justus Winter [Wed, 10 Aug 2016 08:37:31 +0000 (10:37 +0200)]
tests: Fix memory leak.

* tests/gpg/t-encrypt-mixed.c (main): Free 'text2'.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agocore: Ensure err is initalized in gpg_encrypt
Andre Heinecke [Wed, 10 Aug 2016 08:27:05 +0000 (10:27 +0200)]
core: Ensure err is initalized in gpg_encrypt

* src/engine-gpg.c (gpg_encrypt): Initialize err.

3 years agoQt: Fix t-keylist moc include
Andre Heinecke [Wed, 10 Aug 2016 07:50:26 +0000 (09:50 +0200)]
Qt: Fix t-keylist moc include

* lang/qt/tests/t-keylist.cpp: Don't include t-support.moc

--
Accidental leftover from trying to generate t-support moc from
another cpp file. This was solved instead by a new rule to generate
moc files from the header.

3 years agoQt: Clean up debug output in tests
Andre Heinecke [Tue, 9 Aug 2016 16:39:56 +0000 (18:39 +0200)]
Qt: Clean up debug output in tests

* lang/qt/tests/t-support.cpp: Remove accidentally commited
debug output.

3 years agoQt: Add encryption test and refactor testsuite
Andre Heinecke [Tue, 9 Aug 2016 12:10:15 +0000 (14:10 +0200)]
Qt: Add encryption test and refactor testsuite

* lang/qt/tests/Makefile.am: Add t-encrypt and t-support.
* lang/qt/tests/t-support.cpp, lang/qt/tests/t-support.c (QGpgMETest):
New. Class to handle common cleanup / init.
* lang/qt/tests/t-keylist.cpp,
lang/qt/tests/t-keylocate.cpp,
lang/qt/tests/t-ownertrust.cpp,
lang/qt/tests/t-tofuinfo.cpp: Inherit QGpgMETest.
* lang/qt/tests/t-encrypt.cpp: New. Test Symetric and Asymectric
encryption. Mixed encryption test is disabled.

3 years agoQt: Add support for EncryptJobs with generic flags
Andre Heinecke [Tue, 9 Aug 2016 11:10:08 +0000 (13:10 +0200)]
Qt: Add support for EncryptJobs with generic flags

* lang/qt/src/encryptjob.h, lang/qt/src/signencryptjob.h,
lang/qt/src/qgpgmeencryptjob.h, lang/qt/src/qgpgmeencryptjob.cpp,
lang/qt/src/qgpgmesignencryptjob.cpp,
lang/qt/src/qgpgmeencryptjob.cpp: Add start and exec overloads
that accept generic EncryptFlags.

--
While this technically is an ABI break (vtable change) there
are no known classes outside qgpgme that inherit encryptjob
or signencryptjob. And the new functions should be added
to the bottom of the vtable.

3 years agoCpp: Add support for all EncryptionFlags
Andre Heinecke [Tue, 9 Aug 2016 11:07:30 +0000 (13:07 +0200)]
Cpp: Add support for all EncryptionFlags

* lang/cpp/src/context.h (EncryptionFlags): Extend.
* lang/cpp/src/context.cpp (encryptflags2encryptflags): Ditto.

3 years agoCpp: Fix simple symmetric encryption
Andre Heinecke [Tue, 9 Aug 2016 10:56:01 +0000 (12:56 +0200)]
Cpp: Fix simple symmetric encryption

* lang/cpp/src/context.cpp (Context::encrypt): If no recipients
are provided encrypt with NULL and not an empty array.

--
Sending an empty array leads to an invalid argument error.

3 years agocore: Add support for mixed symmetric and asym enc
Andre Heinecke [Tue, 9 Aug 2016 09:40:29 +0000 (11:40 +0200)]
core: Add support for mixed symmetric and asym enc

* src/gpgme.h.in (gpgme_encrypt_flags_t): New flag
GPGME_ENCRYPT_SYMMETRIC.
* src/engine-gpg.c (gpg_encrypt): Also add --symmetric if the flag
is given.
* NEWS: Mention new flag.
* tests/run-encrypt.c (show_usage): Extend for --symmetric.
(main): Handle --symmetric.
(main): Set passphrase_cb in loopback mode.
(main): Fix encrypt call if no recipients are given.
* tests/gpg/t-encrypt-mixed.c: New.
* tests/gpg/Makefile.am (c_tests): Add new test.
* doc/gpgme.texi: Document new flag.

3 years agocore: Let GPGME_PROTOCOL_ASSUAN pass Assuan comments through.
Werner Koch [Mon, 8 Aug 2016 15:02:54 +0000 (17:02 +0200)]
core: Let GPGME_PROTOCOL_ASSUAN pass Assuan comments through.

* src/engine-assuan.c (llass_new): Set ASSUAN_CONVEY_COMMENTS,
--

GnuPG-bug-id: 2429
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoPrepend LD_LIBRARY_PATH for python tests
Andre Heinecke [Mon, 8 Aug 2016 13:04:01 +0000 (15:04 +0200)]
Prepend LD_LIBRARY_PATH for python tests

* lang/python/tests/Makefile.am (TESTS_ENVIRONMENT): Prepend path
instead of setting the value.

--
This fixes the case where tools / libararies are needed for
a working GnuPG system that are pointed to by LD_LIBRARY_PATH.
E.g. GnuPG itself is installed in a custom prefix and PATH /
LD_LIBRARY_PATH is set accordingly.

3 years agopython: Clean up and modernize examples.
Justus Winter [Fri, 5 Aug 2016 12:03:15 +0000 (14:03 +0200)]
python: Clean up and modernize examples.

* lang/python/examples/Examples.rst: Delete file.
* lang/python/examples/t-edit.py: Likewise.  This is actually a test
case and has been moved to 'tests'.
* lang/python/examples/assuan.py: New file.
* lang/python/examples/decryption-filter.py: Likewise.
* lang/python/examples/delkey.py: Modernize.
* lang/python/examples/encrypt-to-all.py: Likewise.
* lang/python/examples/exportimport.py: Likewise.
* lang/python/examples/genkey.py: Likewise.
* lang/python/examples/inter-edit.py: Likewise.
* lang/python/examples/sign.py: Likewise.
* lang/python/examples/signverify.py: Likewise.
* lang/python/examples/simple.py: Likewise.
* lang/python/examples/testCMSgetkey.py: Likewise.
* lang/python/examples/verifydetails.py: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agocore: Extend gpgme_subkey_t to carry the keygrip.
Werner Koch [Thu, 4 Aug 2016 14:17:01 +0000 (16:17 +0200)]
core: Extend gpgme_subkey_t to carry the keygrip.

* src/gpgme.h.in (struct _gpgme_subkey): Add file 'keygrip'.
* src/key.c (gpgme_key_unref): Free KEYGRIP.
* src/keylist.c (keylist_colon_handler): Parse GRP records.
* src/engine-gpg.c (gpg_keylist_build_options): Do not use
--with-fingerprint options for gpg versions >= 2.1.15.

* tests/run-keylist.c (main): Print subkeys and keygrips.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agopython: Add a nicer interface to list keys.
Justus Winter [Wed, 3 Aug 2016 14:32:30 +0000 (16:32 +0200)]
python: Add a nicer interface to list keys.

* lang/python/pyme/core.py (Context.keylist): New method.
* lang/python/tests/t-keylist.py: Test new method.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agopython: Add a flag identifying in-tree builds.
Justus Winter [Tue, 2 Aug 2016 16:45:10 +0000 (18:45 +0200)]
python: Add a flag identifying in-tree builds.

* lang/python/helpers.c (pyme_in_tree_build): New variable.
* lang/python/helpers.h (pyme_in_tree_build): New declaration.
* lang/python/pyme/version.py.in (in_tree_build): New variable.
* lang/python/setup.py.in: Rework macro handling, set 'IN_TREE_BUILD'
as appropriate.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agopython: Fix build system integration.
Justus Winter [Tue, 2 Aug 2016 16:42:26 +0000 (18:42 +0200)]
python: Fix build system integration.

* lang/python/Makefile.am: Be more careful when cleaning the build
directory, we must not delete the generated file 'pyme/version.py'.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agodoc: Document the Assuan protocol.
Justus Winter [Tue, 2 Aug 2016 14:51:08 +0000 (16:51 +0200)]
doc: Document the Assuan protocol.

* doc/gpgme.texi: Document the Assuan protocol.

GnuPG-bug-id: 2407
Signed-off-by: Justus Winter <justus@g10code.com>
3 years agodoc: Fix formatting.
Justus Winter [Tue, 2 Aug 2016 14:50:54 +0000 (16:50 +0200)]
doc: Fix formatting.

--
Signed-off-by: Justus Winter <justus@g10code.com>
3 years agopython: Fix out-of-tree build.
Justus Winter [Thu, 28 Jul 2016 16:14:08 +0000 (18:14 +0200)]
python: Fix out-of-tree build.

* lang/python/MANIFEST.in: Add 'private.h'.

Fixes-commit: 3d4dc3f0
Signed-off-by: Justus Winter <justus@g10code.com>
3 years agopython: Improve error handling.
Justus Winter [Thu, 28 Jul 2016 15:44:18 +0000 (17:44 +0200)]
python: Improve error handling.

* lang/python/pyme/core.py (Context.protocol): Check that the engine
is usable before setting the protocol.
(Context._errorcheck): Add missing functions.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agosrc: Fix dummy engine versions.
Justus Winter [Thu, 28 Jul 2016 15:45:53 +0000 (17:45 +0200)]
src: Fix dummy engine versions.

Previously, 'gpgme_engine_check_version' failed for these protocols
because the version parser failed to parse the dummy versions.

* src/engine-assuan.c (llass_get_version): Use a version triple that
the parser can understand.
(llass_get_req_version): Likewise.
* src/engine-spawn.c (engspawn_get_version): Likewise.
(engspawn_get_req_version): Likewise.
* src/engine-uiserver.c (uiserver_get_version): Likewise.
(uiserver_get_req_version): Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agopython: Drop superfluous imports and trim public interface.
Justus Winter [Thu, 28 Jul 2016 14:29:05 +0000 (16:29 +0200)]
python: Drop superfluous imports and trim public interface.

* lang/python/pyme/__init__.py: Avoid leaking low-level 'gpgme', make
sure the main module looks nice and tidy, appease pyflakes.
* lang/python/pyme/errors.py: Appease pyflakes.
* lang/python/pyme/util.py: Avoid leaking low-level 'gpgme' into the
module namespace.
* lang/python/pyme/version.py.in: Likewise.
* lang/python/tests/t-keylist.py: Drop superfluous imports.
* lang/python/tests/t-sig-notation.py: Likewise.
* lang/python/tests/t-sign.py: Likewise.
* lang/python/tests/t-signers.py: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agopython: Rename compiled SWIG module.
Justus Winter [Thu, 28 Jul 2016 13:44:38 +0000 (15:44 +0200)]
python: Rename compiled SWIG module.

Avoid the name pygpgme, as this is the name of another popular Python
binding for GPGME.

This commit renames the compiled Python module produced by SWIG.

* lang/python/Makefile.am: Rename the compiled Python module.
* lang/python/gpgme.i: Likewise.
* lang/python/pyme/core.py: Likewise.
* lang/python/pyme/errors.py: Likewise.
* lang/python/pyme/util.py: Likewise.
* lang/python/pyme/version.py.in: Likewise.
* lang/python/setup.py.in: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agopython: Rename exported functions.
Justus Winter [Thu, 28 Jul 2016 13:24:05 +0000 (15:24 +0200)]
python: Rename exported functions.

Avoid the name pygpgme, as this is the name of another popular Python
binding for GPGME.

This commit renames all functions that are exported to the Python
world.

* lang/python/helpers.c: Rename all exported functions.
* lang/python/helpers.h: Likewise.
* lang/python/pyme/core.py: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
3 years agopython: Rename private functions.
Justus Winter [Thu, 28 Jul 2016 12:51:20 +0000 (14:51 +0200)]
python: Rename private functions.

Avoid the name pygpgme, as this is the name of another popular Python
binding for GPGME.

This commit renames all functions that are not exported to the Python
world.

* lang/python/gpgme.i: Rename all private functions.
* lang/python/helpers.c: Likewise.
* lang/python/helpers.h: Likewise.
* lang/python/private.h: Likewise.  Also move the SWIG runtime helper
prototypes here.

Signed-off-by: Justus Winter <justus@g10code.com>