gpgme.git
3 months agow32: Fix a few compiler warnings.
Werner Koch [Fri, 2 Nov 2018 11:54:22 +0000 (12:54 +0100)]
w32: Fix a few compiler warnings.

* src/debug.h (TRACE_SYSERR_NR): New.
* src/w32-io.c: Fix compiler warnings.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 months agow32: Log all errors from CloseHandle and WFSO in w32-io.
Werner Koch [Fri, 2 Nov 2018 11:28:17 +0000 (12:28 +0100)]
w32: Log all errors from CloseHandle and WFSO in w32-io.

* src/w32-io.c (close_handle, _close_handle): New macro and function;
use in place of all CloseHandle calls.
(wait_for_single_object, _wait_for_single_object): Likewise.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 months agow32: Don't use CloseHandle on an arbitrary integer.
Werner Koch [Fri, 2 Nov 2018 10:26:19 +0000 (11:26 +0100)]
w32: Don't use CloseHandle on an arbitrary integer.

* src/assuan-support.c (my_waitpid): Do not close the PID = it is not
a handle.
--

At some time in the distant past we might have used the process object
as pid which obviously required a close.  However this was changed and
so what we did here was to close an arbitrary handle (one which
matches the pid).

GnuPG-bug-id: 4237
Signed-off-by: Werner Koch <wk@gnupg.org>
3 months agow32: Revamp the closing of system objects.
Werner Koch [Fri, 2 Nov 2018 08:14:07 +0000 (09:14 +0100)]
w32: Revamp the closing of system objects.

* src/w32-io.c (hddesc_t): New.
(reader_context_s, writer_context_s): Replace file_sock and file_hd by
the hddesc_t hdd.
(fd_table): Ditto.  Add want_reader and want_writer.
(hddesc_lock): New lock variable.
(new_hddesc, ref_hddesc): New.
(release_hddesc): New.
(reader, writer): Call release_hddesc.
(create_reader, create_writer): Change for new hddesc scheme.
(destroy_reader, destroy_writer): Replace closing by a call to
release_hddesc.
(_gpgme_io_pipe): Change for new hddesc scheme.
(_gpgme_io_close): Ditto.
(_gpgme_io_dup): Ditto.  Use want_reader and want_writer.
(_gpgme_io_socket): Change for new hddesc scheme.
--

GnuPG-bug-id: 4237
Signed-off-by: Werner Koch <wk@gnupg.org>
3 months agocore: Print a dump of the I/O data only at level 8.
Werner Koch [Fri, 2 Nov 2018 08:03:43 +0000 (09:03 +0100)]
core: Print a dump of the I/O data only at level 8.

* src/debug.h (TRACE_SUC3): New.
(TRACE_LOGBUFX): New.
* src/posix-io.c: Use TRACE_LOGBUFX instead of TRACE_LOGBUF.
* src/w32-glib-io.c: Ditto.
--

This will also be changed for w32-io as part of another commit.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 months agow32: Fix and improve CancelSynchronousIo use.
Werner Koch [Fri, 2 Nov 2018 07:47:44 +0000 (08:47 +0100)]
w32: Fix and improve CancelSynchronousIo use.

* src/w32-util.c (_gpgme_w32_cancel_synchronous_io): Fix name of DLL
and print trace info only on error.
--

Fixes-commit: 63ba09b541dabbe838253926896e721cb9be564a
Signed-off-by: Werner Koch <wk@gnupg.org>
3 months agow32: Use CancelSynchronousIo in destroy_reader.
Werner Koch [Thu, 1 Nov 2018 08:55:24 +0000 (09:55 +0100)]
w32: Use CancelSynchronousIo in destroy_reader.

* src/w32-util.c (_gpgme_w32_cancel_synchronous_io): New.
* src/w32-io.c (destroy_reader): Use it here.
--

This has not been tested but should on Vista and later help to fix a
possible hang.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 months agow32: Merge all the object tables of w32-io into one.
Werner Koch [Thu, 1 Nov 2018 08:53:48 +0000 (09:53 +0100)]
w32: Merge all the object tables of w32-io into one.

* src/w32-io.c (fd_table_size): New.  Used in most places instead of
the MAX_SLAFD constant.
(reader_table, writer_table, notify_table): Merge them into ...
(fd_table): this table.  Chnage all affected code to take just one
lock.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 months agow32: Remove unused arg from two functions.
Werner Koch [Wed, 31 Oct 2018 13:58:23 +0000 (14:58 +0100)]
w32: Remove unused arg from two functions.

* src/w32-io.c (find_reader, find_writer): Remove unused start_it
arg.  It is always passed as true.  Change callers.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 months agow32: Remove all support for WindowsCE
Werner Koch [Wed, 31 Oct 2018 11:27:27 +0000 (12:27 +0100)]
w32: Remove all support for WindowsCE

* configure.ac: Remove WindwosCE support.
* contrib/: Remove all; it was only used for WindowsCE.
* src/w32-ce.c, src/w32-ce.h: Remove files.
* src/Makefile.am (system_components): Remove these files.
* src/ath.c, src/ath.h: Remove W32CE support.
* src/data-compat.c (gpgme_data_new_from_filepart): Ditto.
(gpgme_data_new_from_file): Ditto.
* src/debug.c (debug_init, _gpgme_debug): Ditto.
* src/gpgme-tool.c (gpgme_server): Ditto.
(main): Ditto.
* src/priv-io.h: Do not include w32-ce.h.
* src/util.h: Remove WindowsCE support.
* src/w32-io.c: Ditto.
* src/w32-util.c: Ditto.
* src/debug.h (TRACE_SUC4): New.
--

There is no more hardware to test our code, the support for Windows CE
terminated along time ago.  Note that our code worked only with the
old WindowsCE with that overall system limit of 31 processes.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 months agow32: Remove cruft in w32-io from WindowsME times.
Werner Koch [Wed, 31 Oct 2018 10:57:45 +0000 (11:57 +0100)]
w32: Remove cruft in w32-io from WindowsME times.

* src/w32-io.c (set_synchronize): Remove.
(create_reader, create_writer): No need for set_synchronize.
--

The set_synchronize dates back to 2001 at a time when I wrote the
Windows support on WindowsME and Windows2000.  Maybe this was required
then due to bugs in that old NT or partly NT based Windows versions.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 months agodocs: python docs restructure
Ben McGinnes [Tue, 30 Oct 2018 16:41:47 +0000 (03:41 +1100)]
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.

3 months agodocs: python
Ben McGinnes [Tue, 30 Oct 2018 14:24:47 +0000 (01:24 +1100)]
docs: python

* dropped the ".org" extension and added a mode line for each file as
  this will make scripting format conversions a lot easier.

3 months agow32: Fix previous commit.
Werner Koch [Tue, 30 Oct 2018 10:19:33 +0000 (11:19 +0100)]
w32: Fix previous commit.

* src/w32-io.c (_gpgme_io_spawn): Move freeing of TMP_NAME behind its
use in an error handling.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 months agocore,w32: Fix memleak of tmp_name in w32-io
Andre Heinecke [Mon, 29 Oct 2018 18:44:02 +0000 (19:44 +0100)]
core,w32: Fix memleak of tmp_name in w32-io

* src/w32-io.c (_gpgme_io_spawn): Free tmp_name.

--
GnuPG-Bug-Id: T4238

3 months agotests: Add repeat argument to run-verify
Andre Heinecke [Mon, 29 Oct 2018 15:33:04 +0000 (16:33 +0100)]
tests: Add repeat argument to run-verify

* tests/run-verify.c (main): Add repeat argument.

--
This helps reproducing rare / random crashes.

3 months agocore: Do not crash if CMS plaintext is ignored
Andre Heinecke [Mon, 29 Oct 2018 15:11:22 +0000 (16:11 +0100)]
core: Do not crash if CMS plaintext is ignored

* src/engine-gpgsm.c (gpgsm_verify): Fix handling both
plaintext and signed_text as NULL.

--
Previously if plaintext was NULL and signed_text was NULL
it would set MESSAGE_FD to NULL which resulted in a
crash.

Ignoring the plaintext of an opaque signature might
make sense in some cases and engine-gpg handles it.

3 months agocpp,tests: Add another test runner
Andre Heinecke [Mon, 29 Oct 2018 14:36:45 +0000 (15:36 +0100)]
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.

3 months agocpp: Add some convenience functions
Andre Heinecke [Thu, 25 Oct 2018 12:09:37 +0000 (14:09 +0200)]
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.

3 months agodocs: python howto
Ben McGinnes [Tue, 23 Oct 2018 12:38:56 +0000 (23:38 +1100)]
docs: python howto

* Fixed a few spelling and grammatical errors.

3 months agoPython: docs tweaks
Ben McGinnes [Sun, 21 Oct 2018 18:43:36 +0000 (05:43 +1100)]
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.

4 months agopython bindings: callback test
Ben McGinnes [Sat, 20 Oct 2018 00:07:55 +0000 (11:07 +1100)]
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.

4 months agocore: Fix segv in genkey when no endtag is provided.
Werner Koch [Thu, 18 Oct 2018 15:36:30 +0000 (17:36 +0200)]
core: Fix segv in genkey when no endtag is provided.

* src/genkey.c (get_key_parameter): Provide a fallback ENDTAG.
--

It would actually be more correct to return an error in this case but
it is possible tha there are users who did not provide an endtag and
out of luck they also didn't trigger a segv.

GnuPG-bug-id: 4192
Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agocore: Return an error if NULL is provided for genkey's parms.
Werner Koch [Thu, 18 Oct 2018 14:50:18 +0000 (16:50 +0200)]
core: Return an error if NULL is provided for genkey's parms.

* src/debug.c (_gpgme_debug_buffer): Bail out of BUF is NULL.
* src/genkey.c (gpgme_op_genkey): Do no deref a NULL in
TRACE_LOGBUF.
(gpgme_op_genkey_start): Ditto. Return an error if PARMS is NULL.
--

This robustness patch should solve one part of
GnuPG-bug-id: 4192
Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agopython: do not export HAVE_CXX11 definition
Daniel Kahn Gillmor [Thu, 18 Oct 2018 02:23:59 +0000 (22:23 -0400)]
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.

4 months agodoc: convert more links to equivalent https:// URLs
Daniel Kahn Gillmor [Thu, 18 Oct 2018 04:19:34 +0000 (00:19 -0400)]
doc: convert more links to equivalent https:// URLs

--

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
4 months agodoc: convert more http:// links to https://
Daniel Kahn Gillmor [Thu, 18 Oct 2018 04:10:19 +0000 (00:10 -0400)]
doc: convert more http:// links to https://

--

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
4 months agodoc: use https:// for www.gnu.org
Daniel Kahn Gillmor [Thu, 18 Oct 2018 03:56:27 +0000 (23:56 -0400)]
doc: use https:// for www.gnu.org

--

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
4 months agojs: increase default startup timeout
Maximilian Krambach [Wed, 17 Oct 2018 11:13:31 +0000 (13:13 +0200)]
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

4 months agopython: Auto-check for all installed python versions.
Werner Koch [Wed, 17 Oct 2018 08:05:04 +0000 (10:05 +0200)]
python: Auto-check for all installed python versions.

* m4/python.m4 (AM_PATH_PYTHON): Add a 4th arg.
* configure.ac (available_languages): Remove separate python2 and
python3 and keep just python.  Simplify test for pythons.  Use an
explicit list of python versions to test.
--

This seems to be a starightforward chnage to support more than two
python versions.  I am not sure why we had that complicated thing
before.  On my box I get builds and run tests for 2.7, 3.4 and 3.5.
If 3.6, 3.7 or 3.8 are installed they should also work.

GnuPG-bug-id: 3354
Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agocore: Really remove CR from version output.
Werner Koch [Tue, 16 Oct 2018 15:05:14 +0000 (17:05 +0200)]
core: Really remove CR from version output.

* src/version.c (_gpgme_get_program_version): Fix test.
--

Fixes-commit: 6bde056355796f15b6e6954372e87f349847515b
Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agocl: Add missing file
Werner Koch [Fri, 12 Oct 2018 07:05:41 +0000 (09:05 +0200)]
cl: Add missing file

--
Fixes-commit: 85d7af8ff2f6afd63701079e23f31be08d58a15d
My fault, sorry.

Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agocl: Several fixes
Guillaume LE VAILLANT [Fri, 12 Oct 2018 06:49:26 +0000 (08:49 +0200)]
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>
4 months agoRegister DCO for Guillaume LE VAILLANT
Werner Koch [Fri, 12 Oct 2018 06:38:10 +0000 (08:38 +0200)]
Register DCO for Guillaume LE VAILLANT

--

4 months agobuild: Let configure create the VERSION file.
NIIBE Yutaka [Wed, 10 Oct 2018 04:39:42 +0000 (13:39 +0900)]
build: Let configure create the VERSION file.

* autogen.sh: Update from libgpg-error.
* configure.ac: Use mym4_version to create VERSION file.
* Makefile.am (dist-hook): Do not create VERSION.
(EXTRA_DIST): Add VERSION.

--

GnuPG-bug-id: 3283
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
4 months agocpp: Add KeyListMode::Locate
Andre Heinecke [Tue, 9 Oct 2018 09:26:15 +0000 (11:26 +0200)]
cpp: Add KeyListMode::Locate

* cpp/src/global.h (KeyListMode): Add Locate.

--
Similar to locate in core.

4 months agocpp: Add first manual tests
Andre Heinecke [Tue, 9 Oct 2018 09:24:18 +0000 (11:24 +0200)]
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.

4 months agocore: Add trust-model flag
Andre Heinecke [Wed, 12 Sep 2018 07:42:09 +0000 (09:42 +0200)]
core: Add trust-model flag

* src/context.h (gpgme_context): Extend with trust_model.
* src/engine-gpg.c (engine_gpg): Extend with trust_model.
(gpg_set_engine_flags): Take trust_model from context.
(build_argv): Handle trust_model.
(gpg_release): Free trust_model.
* src/gpgme.c (gpgme_set_ctx_flag): Handle trust-model flag.
(gpgme_release): Release trust-model.
* doc/gpgme.texi: Document new flag for gpgme_set_ctx_flag.
(Context Flags): New subsection for the context flags.
* tests/run-keylist.c (show_usage, main): Add new --trust-model
parameter.

--
This gives a GPGME user fine grained control over the
trust-model.

Changing the trust model for only a single application depends
on:
GnuPG-Bug-Id: T4134
Maniphest Tasks: T4134
Differential Revision: https://dev.gnupg.org/D466

4 months agocpp: Initialize all gpgme_key_t's in context
Andre Heinecke [Tue, 9 Oct 2018 08:47:16 +0000 (10:47 +0200)]
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.

4 months agocore: Ensure r_key init in gpgme_get_key
Andre Heinecke [Tue, 9 Oct 2018 08:45:12 +0000 (10:45 +0200)]
core: Ensure r_key init in gpgme_get_key

* src/keylist.c (gpgme_get_key): Move r_key init above
the first invalid value check.

--
This fixes the case where someone passes an unitialized
r_key and no fingerprint.

4 months agoqt, tests: Add test for single get key
Andre Heinecke [Tue, 9 Oct 2018 07:37:28 +0000 (09:37 +0200)]
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.

4 months agoPost release updates
Werner Koch [Mon, 8 Oct 2018 09:36:37 +0000 (11:36 +0200)]
Post release updates

--

4 months agoRelease 1.12.0 gpgme-1.12.0
Werner Koch [Mon, 8 Oct 2018 08:28:43 +0000 (10:28 +0200)]
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>
4 months agobuild: Update .gitignore
Werner Koch [Fri, 5 Oct 2018 13:46:25 +0000 (15:46 +0200)]
build: Update .gitignore

--

4 months agocore: Apply GPGME_EXPORT_MODE_NOUID also to keyserver exports.
Werner Koch [Fri, 5 Oct 2018 13:16:53 +0000 (15:16 +0200)]
core: Apply GPGME_EXPORT_MODE_NOUID also to keyserver exports.

* src/engine-gpg.c (export_common): Add keyserver-options to the
send-keys commands.

Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agobuild: Move config.h to conf/config.h
Werner Koch [Fri, 5 Oct 2018 13:14:58 +0000 (15:14 +0200)]
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>
4 months agodocs: whitespace bug
Ben McGinnes [Thu, 4 Oct 2018 16:41:45 +0000 (02:41 +1000)]
docs: whitespace bug

* Same as before, but exported.

4 months agodocs: org to texinfo whitspace bug
Ben McGinnes [Thu, 4 Oct 2018 16:38:14 +0000 (02:38 +1000)]
docs: org to texinfo whitspace bug

* replaced "." in headings with "·" to prevent whitspace being
  appended by texinfo and breaking git.

4 months agodocs: python
Ben McGinnes [Thu, 4 Oct 2018 16:30:20 +0000 (02:30 +1000)]
docs: python

* Fixed an error in the new index page and then exported to the other
  two "source" formats.

4 months agodocs: python
Ben McGinnes [Thu, 4 Oct 2018 15:47:56 +0000 (01:47 +1000)]
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>
4 months agopython: makefiles
Ben McGinnes [Thu, 4 Oct 2018 11:10:46 +0000 (21:10 +1000)]
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>
4 months agopython: make file
Ben McGinnes [Thu, 4 Oct 2018 08:28:47 +0000 (18:28 +1000)]
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>
4 months agopython: make file
Ben McGinnes [Thu, 4 Oct 2018 08:11:01 +0000 (18:11 +1000)]
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>
4 months agodocs: more whitespace checks
Ben McGinnes [Wed, 3 Oct 2018 21:20:32 +0000 (07:20 +1000)]
docs: more whitespace checks

* lang/python/docs/texinfo/short-history.texi:

4 months agodpcs: python howto
Ben McGinnes [Wed, 3 Oct 2018 21:09:40 +0000 (07:09 +1000)]
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.

4 months agodocs: python
Ben McGinnes [Wed, 3 Oct 2018 21:06:57 +0000 (07:06 +1000)]
docs: python

* More restructuring.  Also the painstaking task of deciphering some
  of the more eclectic aspects of Texinfo and make.

4 months agodocs: python bindings
Ben McGinnes [Wed, 3 Oct 2018 20:57:51 +0000 (06:57 +1000)]
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).

4 months agodocs: pre-python preparation
Ben McGinnes [Wed, 3 Oct 2018 15:42:12 +0000 (01:42 +1000)]
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.

4 months agopython bindings: CPython order
Ben McGinnes [Tue, 2 Oct 2018 20:58:51 +0000 (06:58 +1000)]
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>
4 months agocore: add experimental GPGME_EXPORT_MODE_NOUID.
Werner Koch [Tue, 2 Oct 2018 09:18:00 +0000 (11:18 +0200)]
core: add experimental GPGME_EXPORT_MODE_NOUID.

* src/gpgme.h.in (GPGME_EXPORT_MODE_NOUID): New.
* src/export.c (export_start): Adjust option check.
* src/engine-gpg.c (export_common): Implement option.

Signed-off-by: Werner Koch <wk@gnupg.org>
4 months agodocs: python bindings
Ben McGinnes [Sun, 30 Sep 2018 16:10:03 +0000 (02:10 +1000)]
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>
4 months agopython bindings: fixing decrypt-verify
Ben McGinnes [Sun, 30 Sep 2018 09:32:45 +0000 (19:32 +1000)]
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>
4 months agopython bindings: ctx.decrypt
Ben McGinnes [Sun, 30 Sep 2018 06:28:54 +0000 (16:28 +1000)]
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>
4 months agoexample: local signatures
Ben McGinnes [Thu, 27 Sep 2018 13:23:37 +0000 (23:23 +1000)]
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>
4 months agoexample: python bindings
Ben McGinnes [Thu, 27 Sep 2018 12:45:37 +0000 (22:45 +1000)]
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>
4 months agodocs: python bindings installation
Ben McGinnes [Thu, 27 Sep 2018 04:06:48 +0000 (14:06 +1000)]
docs: python bindings installation

* lang/python/docs/gpgme-python-howto.org: added a section on
  installing the bindings to a python virtualenv.

4 months agotests: python bindings
Ben McGinnes [Thu, 27 Sep 2018 00:07:08 +0000 (10:07 +1000)]
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).

4 months agoexamples: python bindings
Ben McGinnes [Wed, 26 Sep 2018 23:57:50 +0000 (09:57 +1000)]
examples: python bindings

* Fixed homedir specifying logic in several cases.

4 months agodocs: a typographical two-step
Ben McGinnes [Tue, 25 Sep 2018 00:17:39 +0000 (10:17 +1000)]
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>
4 months agodocs and examples: python bindings
Ben McGinnes [Mon, 24 Sep 2018 23:59:31 +0000 (09:59 +1000)]
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>
4 months agodocs: python bindings howto
Ben McGinnes [Mon, 24 Sep 2018 18:32:13 +0000 (04:32 +1000)]
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.

4 months agodocs and examples: python bindings howto
Ben McGinnes [Sun, 23 Sep 2018 09:36:54 +0000 (19:36 +1000)]
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>
4 months agoexamples: python bindings and hkp4py updates
Ben McGinnes [Sun, 23 Sep 2018 01:43:34 +0000 (11:43 +1000)]
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.

4 months agopython bindings: importing from keyservers with hkp4py
Ben McGinnes [Sat, 22 Sep 2018 22:18:44 +0000 (08:18 +1000)]
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>
4 months agodocs: python bindings howto
Ben McGinnes [Sat, 22 Sep 2018 19:37:40 +0000 (05:37 +1000)]
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>
5 months agopython: Fix a couple of syntax errors.
Werner Koch [Thu, 20 Sep 2018 15:30:48 +0000 (17:30 +0200)]
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>
5 months agopython: Silence a few warnings.
Werner Koch [Thu, 20 Sep 2018 15:28:25 +0000 (17:28 +0200)]
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>
5 months agojs: renamed keygen algo option
Maximilian Krambach [Thu, 20 Sep 2018 13:46:03 +0000 (15:46 +0200)]
js: renamed keygen algo option

--

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

* reverts commit 34be6163f6c1057e2a87705925a9d0c70e4ecf17

5 months agopython: Fix regression in the test suite.
Werner Koch [Thu, 20 Sep 2018 09:58:02 +0000 (11:58 +0200)]
python: Fix regression in the test suite.

* lang/python/tests/Makefile.am (GNUPGHOME): Remove stray backslash.
--

Fixes-commit: d09d19fa9fe1e81dd819b32208b4bd09f83e3918
Signed-off-by: Werner Koch <wk@gnupg.org>
5 months agotests: Don't try using keys from a scmartcard.
Werner Koch [Wed, 19 Sep 2018 15:28:29 +0000 (17:28 +0200)]
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>
5 months agodocs: python bindings and its special request
Ben McGinnes [Thu, 20 Sep 2018 01:38:20 +0000 (11:38 +1000)]
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>
5 months agojs: add 'default-future' as createKey option
Maximilian Krambach [Wed, 19 Sep 2018 15:54:59 +0000 (17:54 +0200)]
js: add 'default-future' as createKey option

--
* src/Keyring.js: default-future can be used now for key creation as
  algo.

5 months agojson: Remove subkey-algo from createkey command.
Werner Koch [Wed, 19 Sep 2018 09:51:31 +0000 (11:51 +0200)]
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>
5 months agojs: add configuration option on startup
Maximilian Krambach [Wed, 19 Sep 2018 08:56:36 +0000 (10:56 +0200)]
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.

5 months agodocs: python bindings
Ben McGinnes [Mon, 17 Sep 2018 22:32:30 +0000 (08:32 +1000)]
docs: python bindings

* Updated the Cython example code slightly, along with the
  corresponding explanation.

5 months agodocs: python bindings howto
Ben McGinnes [Mon, 17 Sep 2018 04:33:02 +0000 (14:33 +1000)]
docs: python bindings howto

* Tightened up the Cython demonstration.

5 months agodocs: cython sanitized
Ben McGinnes [Sun, 16 Sep 2018 03:58:34 +0000 (13:58 +1000)]
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.

5 months agodocs: python bindings howto
Ben McGinnes [Sun, 16 Sep 2018 03:48:12 +0000 (13:48 +1000)]
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.

5 months agodocs: even more edits
Ben McGinnes [Sun, 16 Sep 2018 01:06:32 +0000 (11:06 +1000)]
docs: even more edits

* doc/gpgme-python-howto.texi: hunting down and killing commas,
  Oxford or not it can't stay in a heading.

5 months agodocs: more edits
Ben McGinnes [Sun, 16 Sep 2018 00:52:30 +0000 (10:52 +1000)]
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.

5 months agodocs: whitespace culled
Ben McGinnes [Sat, 15 Sep 2018 23:47:05 +0000 (09:47 +1000)]
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.

5 months agodocs: renaming and drafts
Ben McGinnes [Sat, 15 Sep 2018 22:36:10 +0000 (08:36 +1000)]
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.

5 months agodocs: python howto texinfo update
Ben McGinnes [Sat, 15 Sep 2018 20:42:35 +0000 (06:42 +1000)]
docs: python howto texinfo update

* doc/gpgme-python-howto.texi:

5 months agodocs: Python howto update
Ben McGinnes [Sat, 15 Sep 2018 20:35:02 +0000 (06:35 +1000)]
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.

5 months agodocs: generated whitespace
Ben McGinnes [Sat, 15 Sep 2018 19:02:44 +0000 (05:02 +1000)]
docs: generated whitespace

* doc/gpgme-python-howto.texi: culled whitespace included with the
  org-mode export.

5 months agoDocs: including howto with standard docs
Ben McGinnes [Sat, 15 Sep 2018 18:55:33 +0000 (04:55 +1000)]
Docs: including howto with standard docs

* gpgme.spec.in: Added gpgme-python-howto.info build on the grounds
  that it now deals with certain possible installation issues and end
  users encountering them would want the docs to hand.
* doc/gpgme.texi: updated the copyright year to this year.

5 months agoDocs: Python bindings HOWTO
Ben McGinnes [Sat, 15 Sep 2018 18:04:13 +0000 (04:04 +1000)]
Docs: Python bindings HOWTO

* Added doc/gpgme-python-howto.texi: generated from
  GPGMEpythonHOWTOen.org and then slightly modified so the generated
  Info file doesn't use camelCase.
* doc/Makefile.am: Updated makefile to include the Python HOWTO with
  gpgme_TEXINFOS and to export the generated files to the webserver
  along with the main GPGME one.

5 months agoPython bindings: docs
Ben McGinnes [Sat, 15 Sep 2018 17:36:14 +0000 (03:36 +1000)]
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.

5 months agoPython bindings: examples
Ben McGinnes [Sat, 15 Sep 2018 17:34:36 +0000 (03:34 +1000)]
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.

5 months agoPython examples: backwards compatibility
Ben McGinnes [Sat, 15 Sep 2018 02:10:05 +0000 (12:10 +1000)]
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).