Commit Graph

2242 Commits

Author SHA1 Message Date
Andre Heinecke
a27d7755d0 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.
2016-08-10 12:07:56 +02:00
Andre Heinecke
21d5e71d48 Cpp: Clarify ownership of provider classes
* lang/cpp/src/context.h: Note that the context does not take
ownership of providers.
2016-08-10 12:07:56 +02:00
Justus Winter
04f994d5db tests: Fix memory leak.
* tests/gpg/t-encrypt-mixed.c (main): Free 'text2'.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-08-10 10:37:31 +02:00
Andre Heinecke
270887309f core: Ensure err is initalized in gpg_encrypt
* src/engine-gpg.c (gpg_encrypt): Initialize err.
2016-08-10 10:27:05 +02:00
Andre Heinecke
0c222e1b3c 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.
2016-08-10 09:50:26 +02:00
Andre Heinecke
969f223d8d Qt: Clean up debug output in tests
* lang/qt/tests/t-support.cpp: Remove accidentally commited
debug output.
2016-08-09 18:39:56 +02:00
Andre Heinecke
f209ec8f58 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.
2016-08-09 14:23:51 +02:00
Andre Heinecke
34b456c3fb 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.
2016-08-09 14:23:51 +02:00
Andre Heinecke
1737239379 Cpp: Add support for all EncryptionFlags
* lang/cpp/src/context.h (EncryptionFlags): Extend.
* lang/cpp/src/context.cpp (encryptflags2encryptflags): Ditto.
2016-08-09 14:23:51 +02:00
Andre Heinecke
bf776ce94c 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.
2016-08-09 14:23:51 +02:00
Andre Heinecke
3d2f027d0f 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.
2016-08-09 14:23:51 +02:00
Werner Koch
b5e16b036f
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>
2016-08-08 17:02:54 +02:00
Andre Heinecke
ab6f66d676 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.
2016-08-08 15:04:01 +02:00
Justus Winter
2a613e8715 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>
2016-08-05 14:05:49 +02:00
Werner Koch
6f3dc66634
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>
2016-08-04 16:17:01 +02:00
Justus Winter
56e26b54da 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>
2016-08-03 16:32:30 +02:00
Justus Winter
4c8265d32d 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>
2016-08-02 18:45:10 +02:00
Justus Winter
0bd7d8c197 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>
2016-08-02 18:42:26 +02:00
Justus Winter
135185b7ef doc: Document the Assuan protocol.
* doc/gpgme.texi: Document the Assuan protocol.

GnuPG-bug-id: 2407
Signed-off-by: Justus Winter <justus@g10code.com>
2016-08-02 16:51:08 +02:00
Justus Winter
e11c65cfb5 doc: Fix formatting.
--
Signed-off-by: Justus Winter <justus@g10code.com>
2016-08-02 16:50:54 +02:00
Justus Winter
4e728de842 python: Fix out-of-tree build.
* lang/python/MANIFEST.in: Add 'private.h'.

Fixes-commit: 3d4dc3f0
Signed-off-by: Justus Winter <justus@g10code.com>
2016-07-28 18:14:08 +02:00
Justus Winter
5a7c7a86f7 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>
2016-07-28 17:50:07 +02:00
Justus Winter
b9e6eacd06 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>
2016-07-28 17:50:07 +02:00
Justus Winter
2ff58fcbd5 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>
2016-07-28 16:50:02 +02:00
Justus Winter
2f754440f2 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>
2016-07-28 16:49:50 +02:00
Justus Winter
b5aa05c3b2 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>
2016-07-28 15:26:43 +02:00
Justus Winter
1d2f22aae6 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>
2016-07-28 15:26:43 +02:00
Justus Winter
de69fa496c python: Support the Assuan engine.
* lang/python/gpgme.i: Add typemaps for the Assuan protocol callbacks.
* lang/python/helpers.c (_pyme_assuan_{data,inquire,status}_cb): New
functions.
* lang/python/private.h (_pyme_assuan_{data,inquire,status}_cb): New
prototypes.
* lang/python/pyme/core.py (Context.assuan_transact): New method.
* lang/python/pyme/util.py (percent_escape): New function.
* lang/python/tests/Makefile.am (py_tests): Add new test.
* lang/python/tests/t-protocol-assuan.py: New file.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-07-28 14:23:07 +02:00
Justus Winter
355d707286 python: Improve engine information handling.
* lang/python/gpgme.i (gpgme_engine_info_t): Wrap engine infos.
* lang/python/pyme/core.py (Context.engine_info): New property.
(Context.{g,s}et_engine_info): Improve docstrings.
* lang/python/pyme/results.py (EngineInfo): New class.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-07-28 11:16:35 +02:00
Justus Winter
78f7bf4dcf python: Add accessors for the protocol.
* lang/python/pyme/core.py (Context.__init__): Add 'protocol'
parameter.
(Context.protocol): New accessors.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-07-28 10:59:46 +02:00
Justus Winter
3d4dc3f021 python: Expose less functions to the Python world.
* lang/python/Makefile.am (EXTRA_DIST, COPY_FILES): Add new file.
* lang/python/gpgme.i: Include new file and add comments.
* lang/python/helpers.c: Include new file.
* lang/python/helpers.h: Move functions we do not need to expose...
* lang/python/private.h: ... here.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-07-28 10:23:32 +02:00
Ben Kibbey
6a7ee33abd Fix including nil bytes in keylist output.
* src/gpgme-tool.c (cmd_keylist,gt_result): use strlen().

Signed-off-by: Ben Kibbey <bjk@luxsci.net>
2016-07-19 11:14:23 +02:00
Justus Winter
e545ca3f68 python: Make GPGME's version easily accessible.
* lang/python/pyme/version.py.in (gpgme_versionstr): New variable.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-07-15 18:28:19 +02:00
Justus Winter
1f318b7aaa python: Add an idiomatic interface.
* configure.ac: Bump required Python version.
* lang/python/pyme/__init__.py: Update docstring.  Import Context and
Data.
* lang/python/pyme/core.py (Context.encrypt): New function.
(Context.decrypt): Likewise.
(Context.sign): Likewise.
(Context.verify): Likewise.
* lang/python/pyme/errors.py: Add new errors.
* lang/python/pyme/util.py (process_constants): Rework and return the
inserted keys.
* lang/python/tests/Makefile.am (EXTRA_DIST): Add new keys.
* lang/python/tests/encrypt-only.asc: New file.
* lang/python/tests/sign-only.asc: Likewise.
* lang/python/tests/initial.py: Mark key 'Alpha' as trusted, import
new keys.
* lang/python/tests/support.py: Add fingerprints of known keys.
(in_srcdir): New function.
(print_data): Handle bytes too.
(mark_key_trusted): New function.
* lang/python/tests/t-decrypt-verify.py: Adjust test.  Test idiomatic
interface.
* lang/python/tests/t-decrypt.py: Test idiomatic interface.
* lang/python/tests/t-encrypt-sign.py: Likewise.
* lang/python/tests/t-encrypt-sym.py: Likewise.
* lang/python/tests/t-encrypt.py: Likewise.
* lang/python/tests/t-idiomatic.py: Simplify.
* lang/python/tests/t-keylist.py: Adjust to newly trusted key.
* lang/python/tests/t-sign.py: Likewise.  Test idiomatic interface.
* lang/python/tests/t-signers.py: Likewise.
* lang/python/tests/t-verify.py: Likewise.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-07-15 18:28:09 +02:00
Andre Heinecke
d2f2cbd297 Qt: Disable keylocate test for gnupg < 2.0.10
* lang/qt/tests/t-keylocate.cpp: Disable test for gnupg < 2.0.10
2016-07-14 17:03:05 +02:00
Andre Heinecke
41de1ab904 Cpp: Add EngineInfo::Version class
* lang/cpp/src/engineinfo.cpp (EngineInfo::engineVersion): New.
* lang/cpp/src/engineinfo.h (EngineInfo::engineVersion): Declare.
(EngineInfo::Version): Small helper to work with versions.
2016-07-14 17:02:38 +02:00
Andre Heinecke
e7f4c36473 Qt: Fix usage of ignore-invalid-option in tests
* Makefile.am (pubring-stamp): Fix config.
2016-07-14 16:32:56 +02:00
Andre Heinecke
e4c0645c1e Qt: Fix tests if gpg2 is gpg
* lang/qt/tests/Makefile.am (pubring-stamp): Loopback and provide
passphrase on command line when importing.
2016-07-14 15:33:16 +02:00
Justus Winter
fddcc62abd python: Fix test.
* lang/python/tests/t-keylist.py: Do not assume key alpha is trusted
yet.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-07-14 13:34:49 +02:00
Justus Winter
b68700d227 python: Drop bad category.
--
Signed-off-by: Justus Winter <justus@g10code.com>
2016-07-14 13:34:49 +02:00
Werner Koch
a9670d152a
build: Update config.{guess,sub} to {2016-05-15,2016-06-20}.
* build-aux/config.guess: Update.
* build-aux/config.sub: Update.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-07-13 19:07:47 +02:00
Werner Koch
d8d5f5a167
core: New GPGME_DATA_ENCODING_MIME.
* src/gpgme.h.in (GPGME_DATA_ENCODING_MIME): New.
* src/data.c (gpgme_data_set_encoding): Adjust check.
* src/engine-gpg.c (have_gpg_version): New.
(gpg_encrypt, gpg_encrypt_sign): Pass flag '--mimemode'.
(gpg_sign): Ditto.

* lang/cpp/src/data.h (GpgME): Add MimeEncoding.
* lang/cpp/src/data.cpp (encoding, setEncoding): Support MimeEncoding.

* src/gpgme-tool.c (server_data_encoding): Add flag --mime.
--

This feature allows an application to declare that the encrypted or
signed data is a valid MIME part.

What is missing is a way to return that information to the application
after decryption/verification.  This can be done by setting the
encoding of the output data object; however this requires some
internal additions to our processing model.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-07-13 14:45:02 +02:00
Werner Koch
2095b1573a
core: Pass the engine's version string to the engine's new function.
* src/engine-backend.h (engine_ops): Add arg 'version' to NEW.
* src/engine-assuan.c (llass_new): Add dummy arg 'version'.
* src/engine-g13.c (g13_new): Ditto.
* src/engine-gpgconf.c (gpgconf_new): Ditto.
* src/engine-gpgsm.c (gpgsm_new): Ditto.
* src/engine-spawn.c (engspawn_new): Ditto.
* src/engine-uiserver.c (uiserver_new): Ditto.
* src/engine.c (_gpgme_engine_new): Pass version string to the new
function.
* src/engine-gpg.c (struct engine_gpg): Add field 'version'.
(gpg_new): Add arg 'version'.
(gpg_release): Free VERSION.

Signed-off-by: Werner Koch <wk@gnupg.org>
2016-07-13 13:57:14 +02:00
Andre Heinecke
537cb871fd Cpp: Add feature enum for new identify
* lang/cpp/src/context.cpp (supported_features2): Add
BinaryAndFineGrainedIdentify
* lang/cpp/src/global.h (Feature2): ditto.

--
This is mostly for compatible code with KF5::Gpgmepp where there
is no hard requirement against gpgme 1.7. With 1.7 a version
check would also suffice.
2016-07-13 11:56:18 +02:00
Justus Winter
1bff47ee58 python: Port more tests.
* lang/python/pyme/core.py (Context.op_keylist_all): Add missing
'op_keylist_end'.
(Context.op_trustlist_all): Fix function. Add missing
'op_trustlist_end'.
* lang/python/tests/Makefile.am (pytests): Add new files.
* lang/python/tests/t-import.py: New file.
* lang/python/tests/t-keylist.py: Likewise.
* lang/python/tests/t-trustlist.py: Check alternate interface.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-07-12 18:34:12 +02:00
Justus Winter
57b5168552 python: Improve python packaging.
* lang/python/Makefile.am: Sign source releases, and upload them.
* lang/python/setup.py.in: Add categories.

Signed-off-by: Justus Winter <justus@g10code.com>
2016-07-12 18:34:12 +02:00
Andre Heinecke
938f7e9c8b m4: Don't set fpic for qt on windows
* m4/qt.m4 (FIND_QT): Do not set fpic for windows.

--
Otherwise each compile call will result in a warning that
fpic is ignored for windows.
2016-07-12 15:26:14 +02:00
Andre Heinecke
744978cce8 m4: Use LIBS instead of LDFLAGS for Qt libs
* m4/qt.m4: Modify LIBS instead of LDFLAGS for link test.

--
The test would otherwise fail when building for windows because the
link order was wrong.
2016-07-12 15:10:16 +02:00
Andre Heinecke
bf742fb885 Bump version to 1.7.0
* configure.ac(mym4_version_minor),
(mym4_version_micro): Next release will be 1.7.0

--
This was already mentioned in NEWS but acidentally not changed
in configure.ac
2016-07-12 12:28:41 +02:00
Andre Heinecke
fd87c4679c Qt: Install CamelCase forward includes
* lang/qt/src/Makefile.am (camelcase_headers): New. Create and install
CamelCase headers.

--
For Qt Libraries it is a common pattern that headers are installed
additionally under their Namespace / Class Name so that automated
inclusion works once a class is used in code. This was also
done for QGpgME headers when they lived in Libkleo so this increases
compatibility.
2016-07-12 11:47:33 +02:00