summaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
authorJinWang An <jinwang.an@samsung.com>2021-12-01 16:54:36 +0900
committerJinWang An <jinwang.an@samsung.com>2021-12-01 16:54:36 +0900
commit10e16af58579b2e22154d944d8cb4144924a8406 (patch)
tree035206c11f62125c4b8aa66fb36daeb071c90184 /lang
parente158cb38f461261d019c653a5f5e0ca9ddab8d6d (diff)
downloadgpgme-10e16af58579b2e22154d944d8cb4144924a8406.tar.gz
gpgme-10e16af58579b2e22154d944d8cb4144924a8406.tar.bz2
gpgme-10e16af58579b2e22154d944d8cb4144924a8406.zip
Imported Upstream version 1.7.1upstream/1.7.1
Diffstat (limited to 'lang')
-rw-r--r--lang/cl/gpgme.asd2
-rw-r--r--lang/cpp/src/GpgmeppConfig.cmake.in.in13
-rw-r--r--lang/cpp/src/Makefile.am10
-rw-r--r--lang/cpp/src/Makefile.in10
-rw-r--r--lang/cpp/src/callbacks.cpp4
-rw-r--r--lang/cpp/src/configuration.cpp4
-rw-r--r--lang/cpp/src/context.cpp10
-rw-r--r--lang/cpp/src/context.h4
-rw-r--r--lang/cpp/src/context_vanilla.cpp4
-rw-r--r--lang/cpp/src/data.cpp10
-rw-r--r--lang/cpp/src/data.h5
-rw-r--r--lang/cpp/src/decryptionresult.cpp4
-rw-r--r--lang/cpp/src/defaultassuantransaction.cpp4
-rw-r--r--lang/cpp/src/editinteractor.cpp4
-rw-r--r--lang/cpp/src/encryptionresult.cpp4
-rw-r--r--lang/cpp/src/engineinfo.cpp4
-rw-r--r--lang/cpp/src/eventloopinteractor.cpp4
-rw-r--r--lang/cpp/src/exception.cpp4
-rw-r--r--lang/cpp/src/gpgadduserideditinteractor.cpp4
-rw-r--r--lang/cpp/src/gpgagentgetinfoassuantransaction.cpp4
-rw-r--r--lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp4
-rw-r--r--lang/cpp/src/gpgsetownertrusteditinteractor.cpp4
-rw-r--r--lang/cpp/src/gpgsignkeyeditinteractor.cpp4
-rw-r--r--lang/cpp/src/importresult.cpp4
-rw-r--r--lang/cpp/src/key.cpp25
-rw-r--r--lang/cpp/src/key.h15
-rw-r--r--lang/cpp/src/keygenerationresult.cpp4
-rw-r--r--lang/cpp/src/keylistresult.cpp4
-rw-r--r--lang/cpp/src/scdgetinfoassuantransaction.cpp4
-rw-r--r--lang/cpp/src/signingresult.cpp4
-rw-r--r--lang/cpp/src/tofuinfo.cpp5
-rw-r--r--lang/cpp/src/trustitem.cpp4
-rw-r--r--lang/cpp/src/verificationresult.cpp38
-rw-r--r--lang/cpp/src/verificationresult.h21
-rw-r--r--lang/cpp/src/vfsmountresult.cpp4
-rw-r--r--lang/python/Makefile.am17
-rw-r--r--lang/python/Makefile.in17
-rw-r--r--lang/python/examples/inter-edit.py4
-rw-r--r--lang/python/examples/testCMSgetkey.py2
-rwxr-xr-xlang/python/examples/verifydetails.py2
-rw-r--r--lang/python/gpgme.i92
-rw-r--r--lang/python/helpers.c4
-rw-r--r--lang/python/helpers.h4
-rw-r--r--lang/python/pyme/core.py31
-rw-r--r--lang/python/pyme/errors.py22
-rw-r--r--lang/python/pyme/version.py2
-rwxr-xr-xlang/python/setup.py.in3
-rw-r--r--lang/python/tests/support.py1
-rwxr-xr-xlang/python/tests/t-keylist.py23
-rwxr-xr-xlang/python/tests/t-sig-notation.py1
-rw-r--r--lang/qt/src/AbstractImportJob1
-rw-r--r--lang/qt/src/Makefile.am18
-rw-r--r--lang/qt/src/Makefile.in41
-rw-r--r--lang/qt/src/QGpgmeConfig.cmake.in.in13
-rw-r--r--lang/qt/src/SpecialJob1
-rw-r--r--lang/qt/src/dataprovider.cpp6
-rw-r--r--lang/qt/src/defaultkeygenerationjob.cpp4
-rw-r--r--lang/qt/src/gpgme_backend_debug.cpp4
-rw-r--r--lang/qt/src/job.cpp4
-rw-r--r--lang/qt/src/multideletejob.cpp117
-rw-r--r--lang/qt/src/multideletejob.h2
-rw-r--r--lang/qt/src/protocol.h6
-rw-r--r--lang/qt/src/qgpgmeadduseridjob.cpp4
-rw-r--r--lang/qt/src/qgpgmebackend.cpp4
-rw-r--r--lang/qt/src/qgpgmechangeexpiryjob.cpp4
-rw-r--r--lang/qt/src/qgpgmechangeownertrustjob.cpp4
-rw-r--r--lang/qt/src/qgpgmechangepasswdjob.cpp4
-rw-r--r--lang/qt/src/qgpgmedecryptjob.cpp4
-rw-r--r--lang/qt/src/qgpgmedecryptverifyjob.cpp4
-rw-r--r--lang/qt/src/qgpgmedeletejob.cpp4
-rw-r--r--lang/qt/src/qgpgmedownloadjob.cpp4
-rw-r--r--lang/qt/src/qgpgmeencryptjob.cpp4
-rw-r--r--lang/qt/src/qgpgmeexportjob.cpp4
-rw-r--r--lang/qt/src/qgpgmeimportfromkeyserverjob.cpp4
-rw-r--r--lang/qt/src/qgpgmeimportjob.cpp4
-rw-r--r--lang/qt/src/qgpgmekeyformailboxjob.cpp4
-rw-r--r--lang/qt/src/qgpgmekeygenerationjob.cpp4
-rw-r--r--lang/qt/src/qgpgmekeylistjob.cpp4
-rw-r--r--lang/qt/src/qgpgmelistallkeysjob.cpp4
-rw-r--r--lang/qt/src/qgpgmenewcryptoconfig.cpp6
-rw-r--r--lang/qt/src/qgpgmerefreshkeysjob.cpp6
-rw-r--r--lang/qt/src/qgpgmesecretkeyexportjob.cpp6
-rw-r--r--lang/qt/src/qgpgmesignencryptjob.cpp4
-rw-r--r--lang/qt/src/qgpgmesignjob.cpp4
-rw-r--r--lang/qt/src/qgpgmesignkeyjob.cpp4
-rw-r--r--lang/qt/src/qgpgmetofupolicyjob.cpp4
-rw-r--r--lang/qt/src/qgpgmeverifydetachedjob.cpp4
-rw-r--r--lang/qt/src/qgpgmeverifyopaquejob.cpp4
-rw-r--r--lang/qt/src/qgpgmewkspublishjob.cpp10
-rw-r--r--lang/qt/src/qgpgmewkspublishjob.h2
-rw-r--r--lang/qt/src/threadedjobmixin.cpp4
-rw-r--r--lang/qt/src/threadedjobmixin.h3
-rw-r--r--lang/qt/src/wkspublishjob.h4
-rw-r--r--lang/qt/tests/Makefile.am7
-rw-r--r--lang/qt/tests/Makefile.in23
-rw-r--r--lang/qt/tests/run-keyformailboxjob.cpp4
-rw-r--r--lang/qt/tests/t-encrypt.cpp36
-rw-r--r--lang/qt/tests/t-keylist.cpp4
-rw-r--r--lang/qt/tests/t-keylocate.cpp4
-rw-r--r--lang/qt/tests/t-ownertrust.cpp4
-rw-r--r--lang/qt/tests/t-support.cpp4
-rw-r--r--lang/qt/tests/t-support.h4
-rw-r--r--lang/qt/tests/t-tofuinfo.cpp4
-rw-r--r--lang/qt/tests/t-verify.cpp93
-rw-r--r--lang/qt/tests/t-wkspublish.cpp20
105 files changed, 894 insertions, 144 deletions
diff --git a/lang/cl/gpgme.asd b/lang/cl/gpgme.asd
index c192da7..bd195e5 100644
--- a/lang/cl/gpgme.asd
+++ b/lang/cl/gpgme.asd
@@ -27,7 +27,7 @@
(defsystem gpgme
:description "GnuPG Made Easy."
:author "g10 Code GmbH"
- :version "1.7.0"
+ :version "1.7.1"
:licence "GPL"
:depends-on ("cffi" "gpg-error")
:components ((:file "gpgme-package")
diff --git a/lang/cpp/src/GpgmeppConfig.cmake.in.in b/lang/cpp/src/GpgmeppConfig.cmake.in.in
index d54011e..73f5eaa 100644
--- a/lang/cpp/src/GpgmeppConfig.cmake.in.in
+++ b/lang/cpp/src/GpgmeppConfig.cmake.in.in
@@ -37,7 +37,7 @@ set(CMAKE_IMPORT_FILE_VERSION 1)
set(_targetsDefined)
set(_targetsNotDefined)
set(_expectedTargets)
-foreach(_expectedTarget KF5::Gpgmepp Gpgmepp)
+foreach(_expectedTarget Gpgmepp)
list(APPEND _expectedTargets ${_expectedTarget})
if(NOT TARGET ${_expectedTarget})
list(APPEND _targetsNotDefined ${_expectedTarget})
@@ -58,17 +58,11 @@ unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)
-# Compute the installation prefix relative to this file.
-get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
-get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
-get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
-get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
-
# Create imported target Gpgmepp
add_library(Gpgmepp SHARED IMPORTED)
set_target_properties(Gpgmepp PROPERTIES
- INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/gpgme++"
+ INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/gpgme++;@resolved_includedir@"
INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme@libsuffix@;@LIBASSUAN_LIBS@"
IMPORTED_LOCATION "@resolved_libdir@/libgpgmepp@libsuffix@"
)
@@ -77,9 +71,6 @@ if(CMAKE_VERSION VERSION_LESS 2.8.12)
message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.")
endif()
-# Cleanup temporary variables.
-set(_IMPORT_PREFIX)
-
# Loop over all imported files and verify that they actually exist
foreach(target ${_IMPORT_CHECK_TARGETS} )
foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
diff --git a/lang/cpp/src/Makefile.am b/lang/cpp/src/Makefile.am
index e65a875..342bdf8 100644
--- a/lang/cpp/src/Makefile.am
+++ b/lang/cpp/src/Makefile.am
@@ -76,15 +76,15 @@ libsuffix=.so
endif
GpgmeppConfig.cmake: GpgmeppConfig.cmake.in
- sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" > "$@"
- sed -e 's|[@]libsuffix@|$(libsuffix)|g' < "$@" > "$@".2
- mv "$@".2 "$@"
+ sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
+ sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
+ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
install-cmake-files: GpgmeppConfig.cmake GpgmeppConfigVersion.cmake
-$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp
- $(INSTALL) GpgmeppConfig.cmake \
+ $(INSTALL) -m 644 GpgmeppConfig.cmake \
$(DESTDIR)$(libdir)/cmake/Gpgmepp/GpgmeppConfig.cmake
- $(INSTALL) GpgmeppConfigVersion.cmake \
+ $(INSTALL) -m 644 GpgmeppConfigVersion.cmake \
$(DESTDIR)$(libdir)/cmake/Gpgmepp/GpgmeppConfigVersion.cmake
uninstall-cmake-files:
diff --git a/lang/cpp/src/Makefile.in b/lang/cpp/src/Makefile.in
index 9237d27..6be45d1 100644
--- a/lang/cpp/src/Makefile.in
+++ b/lang/cpp/src/Makefile.in
@@ -930,15 +930,15 @@ uninstall-am: uninstall-gpgmeppincludeHEADERS uninstall-libLTLIBRARIES \
GpgmeppConfig.cmake: GpgmeppConfig.cmake.in
- sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" > "$@"
- sed -e 's|[@]libsuffix@|$(libsuffix)|g' < "$@" > "$@".2
- mv "$@".2 "$@"
+ sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
+ sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
+ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
install-cmake-files: GpgmeppConfig.cmake GpgmeppConfigVersion.cmake
-$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp
- $(INSTALL) GpgmeppConfig.cmake \
+ $(INSTALL) -m 644 GpgmeppConfig.cmake \
$(DESTDIR)$(libdir)/cmake/Gpgmepp/GpgmeppConfig.cmake
- $(INSTALL) GpgmeppConfigVersion.cmake \
+ $(INSTALL) -m 644 GpgmeppConfigVersion.cmake \
$(DESTDIR)$(libdir)/cmake/Gpgmepp/GpgmeppConfigVersion.cmake
uninstall-cmake-files:
diff --git a/lang/cpp/src/callbacks.cpp b/lang/cpp/src/callbacks.cpp
index 4b4dd80..3631c53 100644
--- a/lang/cpp/src/callbacks.cpp
+++ b/lang/cpp/src/callbacks.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "callbacks.h"
#include "util.h"
diff --git a/lang/cpp/src/configuration.cpp b/lang/cpp/src/configuration.cpp
index 7ef2883..293746a 100644
--- a/lang/cpp/src/configuration.cpp
+++ b/lang/cpp/src/configuration.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "configuration.h"
#include "error.h"
#include "util.h"
diff --git a/lang/cpp/src/context.cpp b/lang/cpp/src/context.cpp
index 00f397b..1121104 100644
--- a/lang/cpp/src/context.cpp
+++ b/lang/cpp/src/context.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <context.h>
#include <eventloopinteractor.h>
#include <trustitem.h>
@@ -695,7 +699,7 @@ Error Context::startPasswd(const Key &key)
}
-#pragma GCC push_diagnostics
+#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
Error Context::edit(const Key &key, std::unique_ptr<EditInteractor> func, Data &data)
@@ -755,7 +759,7 @@ Error Context::startCardEditing(const Key &key, std::unique_ptr<EditInteractor>
dp ? dp->data : 0));
}
-#pragma GCC pop_diagnostics
+#pragma GCC diagnostic pop
EditInteractor *Context::lastCardEditInteractor() const
{
@@ -1051,6 +1055,7 @@ const char *Context::signaturePolicyURL() const
return n->value;
}
}
+ return nullptr;
}
Notation Context::signatureNotation(unsigned int idx) const
@@ -1344,6 +1349,7 @@ static gpgme_tofu_policy_t to_tofu_policy_t(unsigned int policy)
case TofuInfo::PolicyAsk:
return GPGME_TOFU_POLICY_ASK;
case TofuInfo::PolicyUnknown:
+ default:
return GPGME_TOFU_POLICY_UNKNOWN;
}
}
diff --git a/lang/cpp/src/context.h b/lang/cpp/src/context.h
index b1e4f5f..ab15a21 100644
--- a/lang/cpp/src/context.h
+++ b/lang/cpp/src/context.h
@@ -364,8 +364,8 @@ public:
* @param file The executable to start.
* @param argv list of arguments file should be argv[0].
* @param input The data to be sent through stdin.
- * @param output The data to be recieve the stdout.
- * @param err The data to recieve stderr.
+ * @param output The data to be receive the stdout.
+ * @param err The data to receive stderr.
* @param flags Additional flags.
*
* @returns An error or empty error.
diff --git a/lang/cpp/src/context_vanilla.cpp b/lang/cpp/src/context_vanilla.cpp
index 984d41b..77a488a 100644
--- a/lang/cpp/src/context_vanilla.cpp
+++ b/lang/cpp/src/context_vanilla.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <global.h>
GIOChannel *GpgME::getGIOChannel(int)
diff --git a/lang/cpp/src/data.cpp b/lang/cpp/src/data.cpp
index 9527b2f..2cb4fa8 100644
--- a/lang/cpp/src/data.cpp
+++ b/lang/cpp/src/data.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "data_p.h"
#include <error.h>
#include <interfaces/dataprovider.h>
@@ -157,6 +161,9 @@ GpgME::Data::Encoding GpgME::Data::encoding() const
case GPGME_DATA_ENCODING_BASE64: return Base64Encoding;
case GPGME_DATA_ENCODING_ARMOR: return ArmorEncoding;
case GPGME_DATA_ENCODING_MIME: return MimeEncoding;
+ case GPGME_DATA_ENCODING_URL: return UrlEncoding;
+ case GPGME_DATA_ENCODING_URLESC: return UrlEscEncoding;
+ case GPGME_DATA_ENCODING_URL0: return Url0Encoding;
}
return AutoEncoding;
}
@@ -170,6 +177,9 @@ GpgME::Error GpgME::Data::setEncoding(Encoding enc)
case Base64Encoding: ge = GPGME_DATA_ENCODING_BASE64; break;
case ArmorEncoding: ge = GPGME_DATA_ENCODING_ARMOR; break;
case MimeEncoding: ge = GPGME_DATA_ENCODING_MIME; break;
+ case UrlEncoding: ge = GPGME_DATA_ENCODING_URL; break;
+ case UrlEscEncoding: ge = GPGME_DATA_ENCODING_URLESC; break;
+ case Url0Encoding: ge = GPGME_DATA_ENCODING_URL0; break;
}
return Error(gpgme_data_set_encoding(d->data, ge));
}
diff --git a/lang/cpp/src/data.h b/lang/cpp/src/data.h
index b2f2173..50bdf62 100644
--- a/lang/cpp/src/data.h
+++ b/lang/cpp/src/data.h
@@ -78,7 +78,10 @@ public:
BinaryEncoding,
Base64Encoding,
ArmorEncoding,
- MimeEncoding
+ MimeEncoding,
+ UrlEncoding,
+ UrlEscEncoding,
+ Url0Encoding,
};
Encoding encoding() const;
Error setEncoding(Encoding encoding);
diff --git a/lang/cpp/src/decryptionresult.cpp b/lang/cpp/src/decryptionresult.cpp
index 78a2b1b..f59d24c 100644
--- a/lang/cpp/src/decryptionresult.cpp
+++ b/lang/cpp/src/decryptionresult.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <decryptionresult.h>
#include "result_p.h"
#include "util.h"
diff --git a/lang/cpp/src/defaultassuantransaction.cpp b/lang/cpp/src/defaultassuantransaction.cpp
index 5bcf970..549092d 100644
--- a/lang/cpp/src/defaultassuantransaction.cpp
+++ b/lang/cpp/src/defaultassuantransaction.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "defaultassuantransaction.h"
#include "error.h"
#include "data.h"
diff --git a/lang/cpp/src/editinteractor.cpp b/lang/cpp/src/editinteractor.cpp
index 07dc26d..31591fa 100644
--- a/lang/cpp/src/editinteractor.cpp
+++ b/lang/cpp/src/editinteractor.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "editinteractor.h"
#include "callbacks.h"
#include "error.h"
diff --git a/lang/cpp/src/encryptionresult.cpp b/lang/cpp/src/encryptionresult.cpp
index c4e7df5..b4298d7 100644
--- a/lang/cpp/src/encryptionresult.cpp
+++ b/lang/cpp/src/encryptionresult.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <encryptionresult.h>
#include "result_p.h"
#include "util.h"
diff --git a/lang/cpp/src/engineinfo.cpp b/lang/cpp/src/engineinfo.cpp
index c3b3e04..763aab9 100644
--- a/lang/cpp/src/engineinfo.cpp
+++ b/lang/cpp/src/engineinfo.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "engineinfo.h"
#include <gpgme.h>
diff --git a/lang/cpp/src/eventloopinteractor.cpp b/lang/cpp/src/eventloopinteractor.cpp
index 7ec258c..7faa50c 100644
--- a/lang/cpp/src/eventloopinteractor.cpp
+++ b/lang/cpp/src/eventloopinteractor.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <eventloopinteractor.h>
#include <context.h>
diff --git a/lang/cpp/src/exception.cpp b/lang/cpp/src/exception.cpp
index c687024..cf42f91 100644
--- a/lang/cpp/src/exception.cpp
+++ b/lang/cpp/src/exception.cpp
@@ -21,6 +21,10 @@
*/
// -*- c++ -*-
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "exception.h"
#include <gpgme.h>
diff --git a/lang/cpp/src/gpgadduserideditinteractor.cpp b/lang/cpp/src/gpgadduserideditinteractor.cpp
index 43c8592..f7851a5 100644
--- a/lang/cpp/src/gpgadduserideditinteractor.cpp
+++ b/lang/cpp/src/gpgadduserideditinteractor.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "gpgadduserideditinteractor.h"
#include "error.h"
diff --git a/lang/cpp/src/gpgagentgetinfoassuantransaction.cpp b/lang/cpp/src/gpgagentgetinfoassuantransaction.cpp
index 4739aa2..4b30b31 100644
--- a/lang/cpp/src/gpgagentgetinfoassuantransaction.cpp
+++ b/lang/cpp/src/gpgagentgetinfoassuantransaction.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "gpgagentgetinfoassuantransaction.h"
#include "error.h"
#include "data.h"
diff --git a/lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp b/lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp
index 8af897c..5e8ba80 100644
--- a/lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp
+++ b/lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "gpgsetexpirytimeeditinteractor.h"
#include "error.h"
diff --git a/lang/cpp/src/gpgsetownertrusteditinteractor.cpp b/lang/cpp/src/gpgsetownertrusteditinteractor.cpp
index 15b1269..581605f 100644
--- a/lang/cpp/src/gpgsetownertrusteditinteractor.cpp
+++ b/lang/cpp/src/gpgsetownertrusteditinteractor.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "gpgsetownertrusteditinteractor.h"
#include "error.h"
diff --git a/lang/cpp/src/gpgsignkeyeditinteractor.cpp b/lang/cpp/src/gpgsignkeyeditinteractor.cpp
index fded90f..7effc64 100644
--- a/lang/cpp/src/gpgsignkeyeditinteractor.cpp
+++ b/lang/cpp/src/gpgsignkeyeditinteractor.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "gpgsignkeyeditinteractor.h"
#include "error.h"
#include "key.h"
diff --git a/lang/cpp/src/importresult.cpp b/lang/cpp/src/importresult.cpp
index 97e8239..4329fc0 100644
--- a/lang/cpp/src/importresult.cpp
+++ b/lang/cpp/src/importresult.cpp
@@ -21,6 +21,10 @@
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <importresult.h>
#include "result_p.h"
diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp
index cfa1ba3..235a3c8 100644
--- a/lang/cpp/src/key.cpp
+++ b/lang/cpp/src/key.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <key.h>
#include "util.h"
@@ -29,6 +33,7 @@
#include <gpgme.h>
#include <string.h>
+#include <strings.h>
#include <istream>
#include <iterator>
@@ -273,6 +278,7 @@ const char *Key::primaryFingerprint() const
/* Return the first subkeys fingerprint */
return key->subkeys->fpr;
}
+ return nullptr;
}
unsigned int Key::keyListMode() const
@@ -872,6 +878,25 @@ const char *UserID::Signature::policyURL() const
return 0;
}
+std::string UserID::addrSpecFromString(const char *userid)
+{
+ if (!userid) {
+ return std::string();
+ }
+ char *normalized = gpgme_addrspec_from_uid (userid);
+ if (normalized) {
+ std::string ret(normalized);
+ gpgme_free(normalized);
+ return ret;
+ }
+ return std::string();
+}
+
+std::string UserID::addrSpec() const
+{
+ return addrSpecFromString(email());
+}
+
std::ostream &operator<<(std::ostream &os, const UserID &uid)
{
os << "GpgME::UserID(";
diff --git a/lang/cpp/src/key.h b/lang/cpp/src/key.h
index f193093..3f596a8 100644
--- a/lang/cpp/src/key.h
+++ b/lang/cpp/src/key.h
@@ -320,6 +320,21 @@ public:
* @returns The TOFU stats or a null TofuInfo.
*/
GpgME::TofuInfo tofuInfo() const;
+
+ /*! Wrapper around gpgme_addrspec_from_uid.
+ *
+ * The input string should match the format of
+ * a user id string.
+ *
+ * @returns a normalized mail address if found
+ * or an empty string. */
+ static std::string addrSpecFromString(const char *uid);
+
+ /*! Wrapper around gpgme_addrspec_from_uid.
+ *
+ * @returns a normalized mail address for this userid
+ * or an empty string. */
+ std::string addrSpec() const;
private:
shared_gpgme_key_t key;
gpgme_user_id_t uid;
diff --git a/lang/cpp/src/keygenerationresult.cpp b/lang/cpp/src/keygenerationresult.cpp
index 7837e20..52d5222 100644
--- a/lang/cpp/src/keygenerationresult.cpp
+++ b/lang/cpp/src/keygenerationresult.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <keygenerationresult.h>
#include "result_p.h"
diff --git a/lang/cpp/src/keylistresult.cpp b/lang/cpp/src/keylistresult.cpp
index 4512d3b..e6fb77f 100644
--- a/lang/cpp/src/keylistresult.cpp
+++ b/lang/cpp/src/keylistresult.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <keylistresult.h>
#include "result_p.h"
diff --git a/lang/cpp/src/scdgetinfoassuantransaction.cpp b/lang/cpp/src/scdgetinfoassuantransaction.cpp
index 073d772..fb59bcc 100644
--- a/lang/cpp/src/scdgetinfoassuantransaction.cpp
+++ b/lang/cpp/src/scdgetinfoassuantransaction.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "scdgetinfoassuantransaction.h"
#include "error.h"
#include "data.h"
diff --git a/lang/cpp/src/signingresult.cpp b/lang/cpp/src/signingresult.cpp
index 4f2ef72..3252c03 100644
--- a/lang/cpp/src/signingresult.cpp
+++ b/lang/cpp/src/signingresult.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <signingresult.h>
#include "result_p.h"
#include "util.h"
diff --git a/lang/cpp/src/tofuinfo.cpp b/lang/cpp/src/tofuinfo.cpp
index bb67fc8..a10a3cb 100644
--- a/lang/cpp/src/tofuinfo.cpp
+++ b/lang/cpp/src/tofuinfo.cpp
@@ -19,6 +19,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "tofuinfo.h"
#include <istream>
@@ -109,6 +113,7 @@ GpgME::TofuInfo::Policy GpgME::TofuInfo::policy() const
case GPGME_TOFU_POLICY_ASK:
return PolicyAsk;
case GPGME_TOFU_POLICY_UNKNOWN:
+ default:
return PolicyUnknown;
}
}
diff --git a/lang/cpp/src/trustitem.cpp b/lang/cpp/src/trustitem.cpp
index fc7e4a6..0565030 100644
--- a/lang/cpp/src/trustitem.cpp
+++ b/lang/cpp/src/trustitem.cpp
@@ -20,6 +20,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <trustitem.h>
#include <gpgme.h>
diff --git a/lang/cpp/src/verificationresult.cpp b/lang/cpp/src/verificationresult.cpp
index c62625d..23c458e 100644
--- a/lang/cpp/src/verificationresult.cpp
+++ b/lang/cpp/src/verificationresult.cpp
@@ -20,11 +20,16 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <verificationresult.h>
#include <notation.h>
#include "result_p.h"
#include "util.h"
#include "key.h"
+#include "context.h"
#include <gpgme.h>
@@ -68,6 +73,8 @@ public:
// copy keys
if (scopy->key) {
keys.push_back(Key(scopy->key, true));
+ } else {
+ keys.push_back(Key());
}
// copy notations:
nota.push_back(std::vector<Nota>());
@@ -115,6 +122,7 @@ public:
std::vector<GpgME::Key> keys;
std::vector<char *> purls;
std::string file_name;
+ Protocol proto;
};
GpgME::VerificationResult::VerificationResult(gpgme_ctx_t ctx, int error)
@@ -139,6 +147,10 @@ void GpgME::VerificationResult::init(gpgme_ctx_t ctx)
return;
}
d.reset(new Private(res));
+ gpgme_protocol_t proto = gpgme_get_protocol(ctx);
+ d->proto = proto == GPGME_PROTOCOL_OpenPGP ? OpenPGP :
+ proto == GPGME_PROTOCOL_CMS ? CMS :
+ UnknownProtocol;
}
make_standard_stuff(VerificationResult)
@@ -380,6 +392,32 @@ GpgME::Key GpgME::Signature::key() const
return d->keys[idx];
}
+GpgME::Key GpgME::Signature::key(bool search, bool update) const
+{
+ if (isNull()) {
+ return Key();
+ }
+
+ GpgME::Key ret = key();
+ if (ret.isNull() && search) {
+ auto ctx = Context::createForProtocol (d->proto);
+ if (ctx) {
+ ctx->setKeyListMode(KeyListMode::Local |
+ KeyListMode::Signatures |
+ KeyListMode::SignatureNotations |
+ KeyListMode::Validate |
+ KeyListMode::WithTofu);
+ Error e;
+ ret = d->keys[idx] = ctx->key(fingerprint(), e, false);
+ delete ctx;
+ }
+ }
+ if (update) {
+ ret.update();
+ }
+ return ret;
+}
+
class GpgME::Notation::Private
{
public:
diff --git a/lang/cpp/src/verificationresult.h b/lang/cpp/src/verificationresult.h
index 93288af..b6d1d8c 100644
--- a/lang/cpp/src/verificationresult.h
+++ b/lang/cpp/src/verificationresult.h
@@ -163,6 +163,27 @@ public:
* set or the associated TOFU Information if applicable. */
GpgME::Key key() const;
+ /* Search / Update the key of this signature.
+ *
+ * Same as above but if search is set to true this will
+ * either update the key provided by the engine or search
+ * the key in the engine. The key is cached.
+ *
+ * As this involves an engine call it might take some time
+ * to finish so it should be avoided to do this in a UI
+ * thread. The result will be cached and no engine call
+ * will be done if update is set to false and a key is
+ * already cached.
+ *
+ * If no key was provided by the engine this will look
+ * up the key so this call might block while the engine
+ * is called to obtain the key.
+ *
+ * If both search and update are false this is the same
+ * as calling key()
+ */
+ GpgME::Key key(bool search, bool update) const;
+
private:
std::shared_ptr<VerificationResult::Private> d;
unsigned int idx;
diff --git a/lang/cpp/src/vfsmountresult.cpp b/lang/cpp/src/vfsmountresult.cpp
index c9fdd5e..d3607d1 100644
--- a/lang/cpp/src/vfsmountresult.cpp
+++ b/lang/cpp/src/vfsmountresult.cpp
@@ -21,6 +21,10 @@
Boston, MA 02110-1301, USA.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <vfsmountresult.h>
#include "result_p.h"
diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am
index 2271ce0..224a91a 100644
--- a/lang/python/Makefile.am
+++ b/lang/python/Makefile.am
@@ -46,24 +46,33 @@ COPY_FILES_PYME = \
# For VPATH builds we need to copy some files because Python's
# distutils are not VPATH-aware.
-copystamp: $(COPY_FILES) $(COPY_FILES_PYME)
+copystamp: $(COPY_FILES) $(COPY_FILES_PYME) data.h config.h
if test "$(srcdir)" != "$(builddir)" ; then \
cp -R $(COPY_FILES) . ; \
cp -R $(COPY_FILES_PYME) pyme ; \
fi
touch $@
+data.h:
+ ln -s "$(top_srcdir)/src/data.h" .
+
+config.h:
+ ln -s "$(top_builddir)/config.h" .
+
all-local: copystamp
for PYTHON in $(PYTHONS); do \
- CFLAGS="$(CFLAGS) -I$(top_srcdir)" \
+ CFLAGS="$(CFLAGS)" \
$$PYTHON setup.py build --verbose ; \
done
dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc: copystamp
- CFLAGS="$(CFLAGS) -I$(top_srcdir)" \
+ CFLAGS="$(CFLAGS)" \
$(PYTHON) setup.py sdist --verbose
gpg2 --detach-sign --armor dist/pyme3-$(VERSION).tar.gz
+.PHONY: prepare
+prepare: copystamp
+
.PHONY: sdist
sdist: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc
@@ -72,7 +81,7 @@ upload: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc
twine upload $^
CLEANFILES = gpgme.h errors.i gpgme_wrap.c pyme/gpgme.py \
- copystamp
+ data.h config.h copystamp
# Remove the rest.
#
diff --git a/lang/python/Makefile.in b/lang/python/Makefile.in
index 6e6cfe6..08b26e0 100644
--- a/lang/python/Makefile.in
+++ b/lang/python/Makefile.in
@@ -418,7 +418,7 @@ COPY_FILES_PYME = \
$(srcdir)/pyme/util.py
CLEANFILES = gpgme.h errors.i gpgme_wrap.c pyme/gpgme.py \
- copystamp
+ data.h config.h copystamp
all: all-recursive
@@ -737,24 +737,33 @@ uninstall-am: uninstall-local
# For VPATH builds we need to copy some files because Python's
# distutils are not VPATH-aware.
-copystamp: $(COPY_FILES) $(COPY_FILES_PYME)
+copystamp: $(COPY_FILES) $(COPY_FILES_PYME) data.h config.h
if test "$(srcdir)" != "$(builddir)" ; then \
cp -R $(COPY_FILES) . ; \
cp -R $(COPY_FILES_PYME) pyme ; \
fi
touch $@
+data.h:
+ ln -s "$(top_srcdir)/src/data.h" .
+
+config.h:
+ ln -s "$(top_builddir)/config.h" .
+
all-local: copystamp
for PYTHON in $(PYTHONS); do \
- CFLAGS="$(CFLAGS) -I$(top_srcdir)" \
+ CFLAGS="$(CFLAGS)" \
$$PYTHON setup.py build --verbose ; \
done
dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc: copystamp
- CFLAGS="$(CFLAGS) -I$(top_srcdir)" \
+ CFLAGS="$(CFLAGS)" \
$(PYTHON) setup.py sdist --verbose
gpg2 --detach-sign --armor dist/pyme3-$(VERSION).tar.gz
+.PHONY: prepare
+prepare: copystamp
+
.PHONY: sdist
sdist: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc
diff --git a/lang/python/examples/inter-edit.py b/lang/python/examples/inter-edit.py
index 39d6f17..3c0f29b 100644
--- a/lang/python/examples/inter-edit.py
+++ b/lang/python/examples/inter-edit.py
@@ -40,8 +40,8 @@ with pyme.Context() as c:
print("Editing key {} ({}):".format(key.uids[0].uid, key.subkeys[0].fpr))
def edit_fnc(keyword, args):
- print("Status: {} ({}), args: {} > ".format(
- keyword, status, args), end='', flush=True)
+ print("Status: {}, args: {} > ".format(
+ keyword, args), end='', flush=True)
if not 'GET' in keyword:
# no prompt
diff --git a/lang/python/examples/testCMSgetkey.py b/lang/python/examples/testCMSgetkey.py
index 4467b6c..62c35d2 100644
--- a/lang/python/examples/testCMSgetkey.py
+++ b/lang/python/examples/testCMSgetkey.py
@@ -28,7 +28,7 @@ if len(sys.argv) != 2:
sys.exit("fingerprint or unique key ID for gpgme_get_key()")
with pyme.Context(protocol=pyme.constants.PROTOCOL_CMS) as c:
- key = c.get_key(sys.argv[1], False)
+ key = c.get_key(sys.argv[1])
print("got key: ", key.subkeys[0].fpr)
for uid in key.uids:
diff --git a/lang/python/examples/verifydetails.py b/lang/python/examples/verifydetails.py
index fa34926..81f82e9 100755
--- a/lang/python/examples/verifydetails.py
+++ b/lang/python/examples/verifydetails.py
@@ -52,7 +52,7 @@ def verifyprintdetails(filename, detached_sig_filename=None):
print(" status: %#0x" % (sign.status))
print(" timestamp: ", sign.timestamp)
print(" fingerprint:", sign.fpr)
- print(" uid: ", c.get_key(sign.fpr, 0).uids[0].uid)
+ print(" uid: ", c.get_key(sign.fpr).uids[0].uid)
# Print "unsigned" text if inline signature
if data:
diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i
index 84addae..5d074aa 100644
--- a/lang/python/gpgme.i
+++ b/lang/python/gpgme.i
@@ -110,7 +110,7 @@
Py_XDECREF(pyVector$argnum[i]);
}
-// Release returned buffers as necessary.
+/* Release returned buffers as necessary. */
%typemap(newfree) char * "free($1);";
%newobject gpgme_data_release_and_get_mem;
@@ -133,7 +133,7 @@
/* input = $input, 1 = $1, 1_descriptor = $1_descriptor */
/* &1_descriptor = $&1_descriptor *1_descriptor = $*1_descriptor */
- // Following code is from swig's python.swg
+ /* Following code is from swig's python.swg. */
if ((SWIG_ConvertPtr(pypointer,(void **) &$1[i], $*1_descriptor,SWIG_POINTER_EXCEPTION | $disown )) == -1) {
Py_DECREF(pypointer);
return NULL;
@@ -147,7 +147,7 @@
if ($1) free($1);
}
-// Special handling for references to our objects.
+/* Special handling for references to our objects. */
%typemap(in) gpgme_data_t DATAIN (gpgme_data_t wrapper = NULL,
PyObject *bytesio = NULL,
Py_buffer view, int have_view = 0) {
@@ -167,7 +167,7 @@
/* input = $input, 1 = $1, 1_descriptor = $1_descriptor */
- // Following code is from swig's python.swg
+ /* Following code is from swig's python.swg. */
if ((SWIG_ConvertPtr(pypointer,(void **) &$1, $1_descriptor,
SWIG_POINTER_EXCEPTION | $disown )) == -1) {
@@ -183,7 +183,7 @@
representation of struct gpgme_data for an very efficient check if
the buffer has been modified. */
%{
-#include "src/data.h" /* For struct gpgme_data. */
+#include "data.h" /* For struct gpgme_data. */
%}
#endif
@@ -291,23 +291,67 @@
/* SWIG has problems interpreting ssize_t, off_t or gpgme_error_t in
gpgme.h. */
-/* XXX: This is wrong at least for off_t if compiled with LFS. */
-%typemap(out) ssize_t, off_t, gpgme_error_t, gpgme_err_code_t, gpgme_err_source_t, gpg_error_t {
+%typemap(out) ssize_t, gpgme_error_t, gpgme_err_code_t, gpgme_err_source_t, gpg_error_t {
$result = PyLong_FromLong($1);
}
-/* XXX: This is wrong at least for off_t if compiled with LFS. */
-%typemap(in) ssize_t, off_t, gpgme_error_t, gpgme_err_code_t, gpgme_err_source_t, gpg_error_t {
- $1 = PyLong_AsLong($input);
+
+%typemap(in) ssize_t, gpgme_error_t, gpgme_err_code_t, gpgme_err_source_t, gpg_error_t {
+ if (PyLong_Check($input))
+ $1 = PyLong_AsLong($input);
+#if PY_MAJOR_VERSION < 3
+ else if (PyInt_Check($input))
+ $1 = PyInt_AsLong($input);
+#endif
+ else
+ PyErr_SetString(PyExc_TypeError, "Numeric argument expected");
+}
+
+%typemap(out) off_t {
+#if _FILE_OFFSET_BITS == 64
+ $result = PyLong_FromLongLong($1);
+#else
+ $result = PyLong_FromLong($1);
+#endif
+}
+
+%typemap(in) off_t {
+ if (PyLong_Check($input))
+#if _FILE_OFFSET_BITS == 64
+ $1 = PyLong_AsLongLong($input);
+#else
+ $1 = PyLong_AsLong($input);
+#endif
+#if PY_MAJOR_VERSION < 3
+ else if (PyInt_Check($input))
+ $1 = PyInt_AsLong($input);
+#endif
+ else
+ PyErr_SetString(PyExc_TypeError, "Numeric argument expected");
}
-// Those are for gpgme_data_read() and gpgme_strerror_r()
+/* Those are for gpgme_data_read() and gpgme_strerror_r(). */
%typemap(in) (void *buffer, size_t size), (char *buf, size_t buflen) {
- $2 = PyLong_AsLong($input);
- if ($2 < 0) {
- PyErr_SetString(PyExc_ValueError, "Positive integer expected");
- return NULL;
- }
- $1 = ($1_ltype) malloc($2+1);
+ {
+ long tmp$argnum;
+ if (PyLong_Check($input))
+ tmp$argnum = PyLong_AsLong($input);
+#if PY_MAJOR_VERSION < 3
+ else if (PyInt_Check($input))
+ tmp$argnum = PyInt_AsLong($input);
+#endif
+ else
+ {
+ PyErr_SetString(PyExc_TypeError, "Numeric argument expected");
+ return NULL;
+ }
+
+ if (tmp$argnum < 0) {
+ PyErr_SetString(PyExc_ValueError, "Positive integer expected");
+ return NULL;
+ }
+ $2 = (size_t) tmp$argnum;
+ $1 = ($1_ltype) malloc($2+1);
+ }
}
%typemap(argout) (void *buffer, size_t size), (char *buf, size_t buflen) {
Py_XDECREF($result); /* Blow away any previous result */
@@ -357,7 +401,7 @@
Py_XDECREF(encodedInput$argnum);
}
-// Make types containing 'next' field to be lists
+/* Make types containing 'next' field to be lists. */
%ignore next;
%typemap(out) gpgme_sig_notation_t, gpgme_subkey_t,
gpgme_key_sig_t, gpgme_user_id_t, gpgme_invalid_key_t,
@@ -547,6 +591,10 @@
some structs, which we provide prior to including the version for
SWIG. */
%{
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <gpgme.h>
%}
@@ -575,11 +623,15 @@ struct _gpgme_sig_notation
/* Now include our local modified version. Any structs defined above
are ignored. */
+#ifdef HAVE_CONFIG_H
+%include "config.h"
+#endif
+
%include "gpgme.h"
%include "errors.i"
-// Generating and handling pointers-to-pointers.
+/* Generating and handling pointers-to-pointers. */
%pointer_functions(gpgme_ctx_t, gpgme_ctx_t_p);
%pointer_functions(gpgme_data_t, gpgme_data_t_p);
@@ -588,7 +640,7 @@ struct _gpgme_sig_notation
%pointer_functions(gpgme_trust_item_t, gpgme_trust_item_t_p);
%pointer_functions(gpgme_engine_info_t, gpgme_engine_info_t_p);
-// Helper functions.
+/* Helper functions. */
%{
#include <stdio.h>
diff --git a/lang/python/helpers.c b/lang/python/helpers.c
index f9aec91..3724752 100644
--- a/lang/python/helpers.c
+++ b/lang/python/helpers.c
@@ -18,6 +18,10 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <assert.h>
#include <stdio.h>
#include <gpgme.h>
diff --git a/lang/python/helpers.h b/lang/python/helpers.h
index 9200f93..67d23b2 100644
--- a/lang/python/helpers.h
+++ b/lang/python/helpers.h
@@ -18,6 +18,10 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <gpgme.h>
#include "Python.h"
diff --git a/lang/python/pyme/core.py b/lang/python/pyme/core.py
index 88a086b..f0eab43 100644
--- a/lang/python/pyme/core.py
+++ b/lang/python/pyme/core.py
@@ -670,15 +670,34 @@ class Context(GpgmeWrapper):
key.__del__ = lambda self: gpgme.gpgme_key_unref(self)
return key
- def get_key(self, fpr, secret):
- """Return the key corresponding to the fingerprint 'fpr'"""
+ def get_key(self, fpr, secret=False):
+ """Get a key given a fingerprint
+
+ Keyword arguments:
+ secret -- to request a secret key
+
+ Returns:
+ -- the matching key
+
+ Raises:
+ KeyError -- if the key was not found
+ GPGMEError -- as signaled by the underlying library
+
+ """
ptr = gpgme.new_gpgme_key_t_p()
- errorcheck(gpgme.gpgme_get_key(self.wrapped, fpr, ptr, secret))
+
+ try:
+ errorcheck(gpgme.gpgme_get_key(self.wrapped, fpr, ptr, secret))
+ except errors.GPGMEError as e:
+ if e.getcode() == errors.EOF:
+ raise errors.KeyNotFound(fpr)
+ raise e
+
key = gpgme.gpgme_key_t_p_value(ptr)
gpgme.delete_gpgme_key_t_p(ptr)
- if key:
- key.__del__ = lambda self: gpgme.gpgme_key_unref(self)
- return key
+ assert key
+ key.__del__ = lambda self: gpgme.gpgme_key_unref(self)
+ return key
def op_trustlist_all(self, *args, **kwargs):
self.op_trustlist_start(*args, **kwargs)
diff --git a/lang/python/pyme/errors.py b/lang/python/pyme/errors.py
index e26c747..0fd85ef 100644
--- a/lang/python/pyme/errors.py
+++ b/lang/python/pyme/errors.py
@@ -21,10 +21,12 @@ del absolute_import, print_function, unicode_literals
from . import gpgme
from . import util
-util.process_constants('GPG_ERR_', globals())
+# To appease static analysis tools, we define some constants here.
+# They are overwritten with the proper values by process_constants.
+NO_ERROR = None
+EOF = None
-# To appease static analysis tools, we define some constants here:
-NO_ERROR = 0
+util.process_constants('GPG_ERR_', globals())
class PymeError(Exception):
pass
@@ -58,6 +60,20 @@ def errorcheck(retval, extradata = None):
if retval:
raise GPGMEError(retval, extradata)
+class KeyNotFound(GPGMEError, KeyError):
+ """Raised if a key was not found
+
+ GPGME indicates this condition with EOF, which is not very
+ idiomatic. We raise this error that is both a GPGMEError
+ indicating EOF, and a KeyError.
+
+ """
+ def __init__(self, keystr):
+ self.keystr = keystr
+ GPGMEError.__init__(self, EOF)
+ def __str__(self):
+ return self.keystr
+
# These errors are raised in the idiomatic interface code.
class EncryptionError(PymeError):
diff --git a/lang/python/pyme/version.py b/lang/python/pyme/version.py
index 21a0122..13c5129 100644
--- a/lang/python/pyme/version.py
+++ b/lang/python/pyme/version.py
@@ -22,7 +22,7 @@ del absolute_import, print_function
from . import gpgme
productname = 'pyme'
-versionstr = "1.7.0"
+versionstr = "1.7.1"
gpgme_versionstr = gpgme.GPGME_VERSION
in_tree_build = bool(gpgme.cvar.pyme_in_tree_build)
diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in
index 31892c1..4c41673 100755
--- a/lang/python/setup.py.in
+++ b/lang/python/setup.py.in
@@ -28,6 +28,7 @@ gpg_error_config = ["gpg-error-config"]
gpgme_config_flags = ["--thread=pthread"]
gpgme_config = ["gpgme-config"] + gpgme_config_flags
gpgme_h = ""
+include_dirs = [os.getcwd()]
library_dirs = []
in_tree = False
extra_swig_opts = []
@@ -40,6 +41,7 @@ if os.path.exists("../../src/gpgme-config"):
gpgme_h = "../../src/gpgme.h"
library_dirs = ["../../src/.libs"] # XXX uses libtool internals
extra_macros.update(
+ HAVE_CONFIG_H=1,
HAVE_DATA_H=1,
IN_TREE_BUILD=1,
)
@@ -94,7 +96,6 @@ subprocess.check_call([sys.executable, "gpgme-h-clean.py", gpgme_h],
subprocess.check_call([sys.executable, "gpgme-h-clean.py", gpg_error_h],
stdout=open("errors.i", "w"))
-include_dirs = [os.getcwd()]
define_macros = []
libs = getconfig('libs')
diff --git a/lang/python/tests/support.py b/lang/python/tests/support.py
index 4d7135e..f1ffdc3 100644
--- a/lang/python/tests/support.py
+++ b/lang/python/tests/support.py
@@ -27,6 +27,7 @@ alpha = "A0FF4590BB6122EDEF6E3C542D727CC768697734"
bob = "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2"
encrypt_only = "F52770D5C4DB41408D918C9F920572769B9FE19C"
sign_only = "7CCA20CCDE5394CEE71C9F0BFED153F12F18F45D"
+no_such_key = "A" * 40
def make_filename(name):
return os.path.join(os.environ['top_srcdir'], 'tests', 'gpg', name)
diff --git a/lang/python/tests/t-keylist.py b/lang/python/tests/t-keylist.py
index 5e8b333..f7f6674 100755
--- a/lang/python/tests/t-keylist.py
+++ b/lang/python/tests/t-keylist.py
@@ -20,6 +20,7 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
+import pyme
from pyme import core, constants
import support
@@ -244,3 +245,25 @@ for i, key in enumerate(c.keylist()):
if misc_check:
misc_check (uids[0][0], key)
+
+
+# check get_key()
+with pyme.Context() as c:
+ c.get_key(support.alpha)
+ c.get_key(support.alpha, secret=True)
+
+ c.get_key(support.bob)
+ try:
+ c.get_key(support.bob, secret=True)
+ except KeyError:
+ pass
+ else:
+ assert False, "Expected KeyError"
+
+ # Legacy error
+ try:
+ c.get_key(support.no_such_key)
+ except pyme.errors.GPGMEError:
+ pass
+ else:
+ assert False, "Expected GPGMEError"
diff --git a/lang/python/tests/t-sig-notation.py b/lang/python/tests/t-sig-notation.py
index 777bc0b..eb5b111 100755
--- a/lang/python/tests/t-sig-notation.py
+++ b/lang/python/tests/t-sig-notation.py
@@ -36,6 +36,7 @@ expected_notations = {
with core.Context() as c:
version = c.engine_info.version
have_correct_sig_data = not (version.startswith("1.")
+ or version.startswith("2.0.")
or version == "2.1.1"
or (version.startswith("2.1.1")
and version[5] < '3'))
diff --git a/lang/qt/src/AbstractImportJob b/lang/qt/src/AbstractImportJob
new file mode 100644
index 0000000..4627c40
--- /dev/null
+++ b/lang/qt/src/AbstractImportJob
@@ -0,0 +1 @@
+#include "qgpgme/abstractimportjob.h"
diff --git a/lang/qt/src/Makefile.am b/lang/qt/src/Makefile.am
index c15da18..51fe314 100644
--- a/lang/qt/src/Makefile.am
+++ b/lang/qt/src/Makefile.am
@@ -22,7 +22,7 @@ EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \
gpgme_backend_debug.h qgpgme_version.h.in
qgpgme_sources = \
- dataprovider.cpp job.cpp qgpgmeadduseridjob.cpp \
+ dataprovider.cpp job.cpp multideletejob.cpp qgpgmeadduseridjob.cpp \
qgpgmebackend.cpp qgpgmechangeexpiryjob.cpp qgpgmechangeownertrustjob.cpp \
qgpgmechangepasswdjob.cpp qgpgmedecryptjob.cpp \
qgpgmedecryptverifyjob.cpp qgpgmedeletejob.cpp qgpgmedownloadjob.cpp \
@@ -39,6 +39,7 @@ qgpgme_sources = \
# If you add one here make sure that you also add one in camelcase
qgpgme_headers= \
+ abstractimportjob.h \
adduseridjob.h \
changeexpiryjob.h \
changeownertrustjob.h \
@@ -56,6 +57,7 @@ qgpgme_headers= \
protocol.h \
qgpgme_export.h \
qgpgmenewcryptoconfig.h \
+ specialjob.h \
signjob.h \
signkeyjob.h \
signencryptjob.h \
@@ -75,6 +77,7 @@ qgpgme_headers= \
camelcase_headers= \
AddUserIDJob \
+ AbstractImportJob \
ChangeExpiryJob \
ChangeOwnerTrustJob \
ChangePasswdJob \
@@ -89,6 +92,7 @@ camelcase_headers= \
MultiDeleteJob \
Protocol \
QGpgMENewCryptoConfig \
+ SpecialJob \
SignJob \
SignKeyJob \
SignEncryptJob \
@@ -109,7 +113,6 @@ camelcase_headers= \
private_qgpgme_headers = \
qgpgme_export.h \
- abstractimportjob.h \
protocol_p.h \
qgpgmeadduseridjob.h \
qgpgmebackend.h \
@@ -137,7 +140,6 @@ private_qgpgme_headers = \
qgpgmekeyformailboxjob.h \
qgpgmewkspublishjob.h \
qgpgmetofupolicyjob.h \
- specialjob.h \
threadedjobmixin.h
qgpgme_moc_sources = \
@@ -221,9 +223,9 @@ libsuffix=.so
endif
QGpgmeConfig.cmake: QGpgmeConfig.cmake.in
- sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" > "$@"
- sed -e 's|[@]libsuffix@|$(libsuffix)|g' < "$@" > "$@".2
- mv "$@".2 "$@"
+ sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
+ sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
+ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
$(camelcase_headers): Makefile.am
echo -n "#include \"qgpgme/" > "$@"
@@ -232,9 +234,9 @@ $(camelcase_headers): Makefile.am
install-cmake-files: QGpgmeConfig.cmake QGpgmeConfigVersion.cmake
-$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp
- $(INSTALL) QGpgmeConfig.cmake \
+ $(INSTALL) -m 644 QGpgmeConfig.cmake \
$(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfig.cmake
- $(INSTALL) QGpgmeConfigVersion.cmake \
+ $(INSTALL) -m 644 QGpgmeConfigVersion.cmake \
$(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfigVersion.cmake
uninstall-cmake-files:
diff --git a/lang/qt/src/Makefile.in b/lang/qt/src/Makefile.in
index d10eca3..0aa0590 100644
--- a/lang/qt/src/Makefile.in
+++ b/lang/qt/src/Makefile.in
@@ -138,17 +138,17 @@ am__installdirs = "$(DESTDIR)$(libdir)" \
LTLIBRARIES = $(lib_LTLIBRARIES)
libqgpgme_la_DEPENDENCIES = ../../cpp/src/libgpgmepp.la \
../../../src/libgpgme.la
-am__objects_1 = dataprovider.lo job.lo qgpgmeadduseridjob.lo \
- qgpgmebackend.lo qgpgmechangeexpiryjob.lo \
- qgpgmechangeownertrustjob.lo qgpgmechangepasswdjob.lo \
- qgpgmedecryptjob.lo qgpgmedecryptverifyjob.lo \
- qgpgmedeletejob.lo qgpgmedownloadjob.lo qgpgmeencryptjob.lo \
- qgpgmeexportjob.lo qgpgmeimportfromkeyserverjob.lo \
- qgpgmeimportjob.lo qgpgmekeygenerationjob.lo \
- qgpgmekeylistjob.lo qgpgmelistallkeysjob.lo \
- qgpgmenewcryptoconfig.lo qgpgmerefreshkeysjob.lo \
- qgpgmesecretkeyexportjob.lo qgpgmesignencryptjob.lo \
- qgpgmesignjob.lo qgpgmesignkeyjob.lo \
+am__objects_1 = dataprovider.lo job.lo multideletejob.lo \
+ qgpgmeadduseridjob.lo qgpgmebackend.lo \
+ qgpgmechangeexpiryjob.lo qgpgmechangeownertrustjob.lo \
+ qgpgmechangepasswdjob.lo qgpgmedecryptjob.lo \
+ qgpgmedecryptverifyjob.lo qgpgmedeletejob.lo \
+ qgpgmedownloadjob.lo qgpgmeencryptjob.lo qgpgmeexportjob.lo \
+ qgpgmeimportfromkeyserverjob.lo qgpgmeimportjob.lo \
+ qgpgmekeygenerationjob.lo qgpgmekeylistjob.lo \
+ qgpgmelistallkeysjob.lo qgpgmenewcryptoconfig.lo \
+ qgpgmerefreshkeysjob.lo qgpgmesecretkeyexportjob.lo \
+ qgpgmesignencryptjob.lo qgpgmesignjob.lo qgpgmesignkeyjob.lo \
qgpgmeverifydetachedjob.lo qgpgmeverifyopaquejob.lo \
threadedjobmixin.lo qgpgmekeyformailboxjob.lo \
gpgme_backend_debug.lo qgpgmetofupolicyjob.lo \
@@ -464,7 +464,7 @@ EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \
gpgme_backend_debug.h qgpgme_version.h.in
qgpgme_sources = \
- dataprovider.cpp job.cpp qgpgmeadduseridjob.cpp \
+ dataprovider.cpp job.cpp multideletejob.cpp qgpgmeadduseridjob.cpp \
qgpgmebackend.cpp qgpgmechangeexpiryjob.cpp qgpgmechangeownertrustjob.cpp \
qgpgmechangepasswdjob.cpp qgpgmedecryptjob.cpp \
qgpgmedecryptverifyjob.cpp qgpgmedeletejob.cpp qgpgmedownloadjob.cpp \
@@ -482,6 +482,7 @@ qgpgme_sources = \
# If you add one here make sure that you also add one in camelcase
qgpgme_headers = \
+ abstractimportjob.h \
adduseridjob.h \
changeexpiryjob.h \
changeownertrustjob.h \
@@ -499,6 +500,7 @@ qgpgme_headers = \
protocol.h \
qgpgme_export.h \
qgpgmenewcryptoconfig.h \
+ specialjob.h \
signjob.h \
signkeyjob.h \
signencryptjob.h \
@@ -518,6 +520,7 @@ qgpgme_headers = \
camelcase_headers = \
AddUserIDJob \
+ AbstractImportJob \
ChangeExpiryJob \
ChangeOwnerTrustJob \
ChangePasswdJob \
@@ -532,6 +535,7 @@ camelcase_headers = \
MultiDeleteJob \
Protocol \
QGpgMENewCryptoConfig \
+ SpecialJob \
SignJob \
SignKeyJob \
SignEncryptJob \
@@ -552,7 +556,6 @@ camelcase_headers = \
private_qgpgme_headers = \
qgpgme_export.h \
- abstractimportjob.h \
protocol_p.h \
qgpgmeadduseridjob.h \
qgpgmebackend.h \
@@ -580,7 +583,6 @@ private_qgpgme_headers = \
qgpgmekeyformailboxjob.h \
qgpgmewkspublishjob.h \
qgpgmetofupolicyjob.h \
- specialjob.h \
threadedjobmixin.h
qgpgme_moc_sources = \
@@ -751,6 +753,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/defaultkeygenerationjob.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gpgme_backend_debug.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/job.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multideletejob.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmeadduseridjob.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmebackend.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmechangeexpiryjob.Plo@am__quote@
@@ -1090,9 +1093,9 @@ uninstall-am: uninstall-camelcaseincludeHEADERS \
QGpgmeConfig.cmake: QGpgmeConfig.cmake.in
- sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" > "$@"
- sed -e 's|[@]libsuffix@|$(libsuffix)|g' < "$@" > "$@".2
- mv "$@".2 "$@"
+ sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
+ sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
+ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
$(camelcase_headers): Makefile.am
echo -n "#include \"qgpgme/" > "$@"
@@ -1101,9 +1104,9 @@ $(camelcase_headers): Makefile.am
install-cmake-files: QGpgmeConfig.cmake QGpgmeConfigVersion.cmake
-$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp
- $(INSTALL) QGpgmeConfig.cmake \
+ $(INSTALL) -m 644 QGpgmeConfig.cmake \
$(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfig.cmake
- $(INSTALL) QGpgmeConfigVersion.cmake \
+ $(INSTALL) -m 644 QGpgmeConfigVersion.cmake \
$(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfigVersion.cmake
uninstall-cmake-files:
diff --git a/lang/qt/src/QGpgmeConfig.cmake.in.in b/lang/qt/src/QGpgmeConfig.cmake.in.in
index 3d19696..5b6c188 100644
--- a/lang/qt/src/QGpgmeConfig.cmake.in.in
+++ b/lang/qt/src/QGpgmeConfig.cmake.in.in
@@ -37,7 +37,7 @@ set(CMAKE_IMPORT_FILE_VERSION 1)
set(_targetsDefined)
set(_targetsNotDefined)
set(_expectedTargets)
-foreach(_expectedTarget QGpgme KF5::QGpgme)
+foreach(_expectedTarget QGpgme)
list(APPEND _expectedTargets ${_expectedTarget})
if(NOT TARGET ${_expectedTarget})
list(APPEND _targetsNotDefined ${_expectedTarget})
@@ -58,17 +58,11 @@ unset(_targetsDefined)
unset(_targetsNotDefined)
unset(_expectedTargets)
-# Compute the installation prefix relative to this file.
-get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
-get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
-get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
-get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
-
# Create imported target QGpgme
add_library(QGpgme SHARED IMPORTED)
set_target_properties(QGpgme PROPERTIES
- INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${_IMPORT_PREFIX}/include/qgpgme"
+ INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/qgpgme;@resolved_includedir@"
INTERFACE_LINK_LIBRARIES "Gpgmepp;Qt5::Core"
IMPORTED_LOCATION "@resolved_libdir@/libqgpgme@libsuffix@"
)
@@ -77,9 +71,6 @@ if(CMAKE_VERSION VERSION_LESS 2.8.12)
message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.")
endif()
-# Cleanup temporary variables.
-set(_IMPORT_PREFIX)
-
# Loop over all imported files and verify that they actually exist
foreach(target ${_IMPORT_CHECK_TARGETS} )
foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
diff --git a/lang/qt/src/SpecialJob b/lang/qt/src/SpecialJob
new file mode 100644
index 0000000..e869ebb
--- /dev/null
+++ b/lang/qt/src/SpecialJob
@@ -0,0 +1 @@
+#include "qgpgme/specialjob.h"
diff --git a/lang/qt/src/dataprovider.cpp b/lang/qt/src/dataprovider.cpp
index 533b67d..8385686 100644
--- a/lang/qt/src/dataprovider.cpp
+++ b/lang/qt/src/dataprovider.cpp
@@ -1,5 +1,5 @@
/* dataprovider.cpp
- Copyright (C) 2004 Klar�vdalens Datakonsult AB
+ Copyright (C) 2004 Klarävdalens Datakonsult AB
Copyright (c) 2016 Intevation GmbH
This file is part of QGPGME.
@@ -21,6 +21,10 @@
// -*- c++ -*-
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <dataprovider.h>
#include <error.h>
diff --git a/lang/qt/src/defaultkeygenerationjob.cpp b/lang/qt/src/defaultkeygenerationjob.cpp
index 8257a72..d26e824 100644
--- a/lang/qt/src/defaultkeygenerationjob.cpp
+++ b/lang/qt/src/defaultkeygenerationjob.cpp
@@ -28,6 +28,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "defaultkeygenerationjob.h"
#include "protocol.h"
#include "keygenerationjob.h"
diff --git a/lang/qt/src/gpgme_backend_debug.cpp b/lang/qt/src/gpgme_backend_debug.cpp
index 6dfb313..6efe932 100644
--- a/lang/qt/src/gpgme_backend_debug.cpp
+++ b/lang/qt/src/gpgme_backend_debug.cpp
@@ -1,5 +1,9 @@
// This file is autogenerated by CMake: DO NOT EDIT
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "gpgme_backend_debug.h"
diff --git a/lang/qt/src/job.cpp b/lang/qt/src/job.cpp
index 8936ea5..38dbc99 100644
--- a/lang/qt/src/job.cpp
+++ b/lang/qt/src/job.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "job.h"
#include "keylistjob.h"
diff --git a/lang/qt/src/multideletejob.cpp b/lang/qt/src/multideletejob.cpp
new file mode 100644
index 0000000..67f2a78
--- /dev/null
+++ b/lang/qt/src/multideletejob.cpp
@@ -0,0 +1,117 @@
+/*
+ multideletejob.cpp
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2004 Klarälvdalens Datakonsult AB
+
+ QGpgME is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ QGpgME is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+*/
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include "multideletejob.h"
+#include "protocol.h"
+#include "deletejob.h"
+
+#include <key.h>
+#include <context.h>
+#include <data.h>
+
+#include <iterator>
+
+#include <assert.h>
+
+QGpgME::MultiDeleteJob::MultiDeleteJob(const Protocol *protocol)
+ : Job(0),
+ mProtocol(protocol),
+ mJob(0)
+{
+ assert(protocol);
+}
+
+QGpgME::MultiDeleteJob::~MultiDeleteJob()
+{
+
+}
+
+GpgME::Error QGpgME::MultiDeleteJob::start(const std::vector<GpgME::Key> &keys, bool allowSecretKeyDeletion)
+{
+ mKeys = keys;
+ mAllowSecretKeyDeletion = allowSecretKeyDeletion;
+ mIt = mKeys.begin();
+
+ const GpgME::Error err = startAJob();
+
+ if (err) {
+ deleteLater();
+ }
+ return err;
+}
+
+void QGpgME::MultiDeleteJob::slotCancel()
+{
+ if (mJob) {
+ mJob->slotCancel();
+ }
+ mIt = mKeys.end();
+}
+
+void QGpgME::MultiDeleteJob::slotResult(const GpgME::Error &err)
+{
+ mJob = 0;
+ GpgME::Error error = err;
+ if (error || // error in last op
+ mIt == mKeys.end() || // (shouldn't happen)
+ ++mIt == mKeys.end() || // was the last key
+ (error = startAJob())) { // error starting the job for the new key
+ Q_EMIT done();
+ Q_EMIT result(error, error && mIt != mKeys.end() ? *mIt : GpgME::Key::null);
+ deleteLater();
+ return;
+ }
+
+ const int current = mIt - mKeys.begin();
+ const int total = mKeys.size();
+ Q_EMIT progress(QStringLiteral("%1/%2").arg(current).arg(total), current, total);
+}
+
+GpgME::Error QGpgME::MultiDeleteJob::startAJob()
+{
+ if (mIt == mKeys.end()) {
+ return GpgME::Error(0);
+ }
+ mJob = mProtocol->deleteJob();
+ assert(mJob); // FIXME: we need a way to generate errors ourselves,
+ // but I don't like the dependency on gpg-error :/
+
+ connect(mJob.data(), &DeleteJob::result, this, &MultiDeleteJob::slotResult);
+
+ return mJob->start(*mIt, mAllowSecretKeyDeletion);
+}
+
+#include "multideletejob.moc"
diff --git a/lang/qt/src/multideletejob.h b/lang/qt/src/multideletejob.h
index 8915cd1..8e9eb14 100644
--- a/lang/qt/src/multideletejob.h
+++ b/lang/qt/src/multideletejob.h
@@ -36,7 +36,7 @@
#include "qgpgme_export.h"
#include "job.h"
-#include "cryptobackend.h"
+#include "protocol.h"
#include <QPointer>
diff --git a/lang/qt/src/protocol.h b/lang/qt/src/protocol.h
index 40ddcb5..15d83e0 100644
--- a/lang/qt/src/protocol.h
+++ b/lang/qt/src/protocol.h
@@ -76,7 +76,7 @@ class TofuPolicyJob;
* two are always a QString for the auditlog and an GpgME::Error for
* an eventual error.
*
- * In case async API is used and the result signal is emited a
+ * In case async API is used and the result signal is emitted a
* job schedules its own deletion.
*
* Most jobs also provide a synchronous call exec in which case
@@ -161,14 +161,14 @@ public:
/** Obtain a reference to the OpenPGP Protocol.
*
* The reference is to a static object.
- * @returns Refrence to the OpenPGP Protocol.
+ * @returns Reference to the OpenPGP Protocol.
*/
QGPGME_EXPORT Protocol *openpgp();
/** Obtain a reference to the smime Protocol.
*
* The reference is to a static object.
- * @returns Refrence to the smime Protocol.
+ * @returns Reference to the smime Protocol.
*/
QGPGME_EXPORT Protocol *smime();
diff --git a/lang/qt/src/qgpgmeadduseridjob.cpp b/lang/qt/src/qgpgmeadduseridjob.cpp
index eb3bfab..4fc80d1 100644
--- a/lang/qt/src/qgpgmeadduseridjob.cpp
+++ b/lang/qt/src/qgpgmeadduseridjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmeadduseridjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmebackend.cpp b/lang/qt/src/qgpgmebackend.cpp
index 797e58a..f06244b 100644
--- a/lang/qt/src/qgpgmebackend.cpp
+++ b/lang/qt/src/qgpgmebackend.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmebackend.h"
diff --git a/lang/qt/src/qgpgmechangeexpiryjob.cpp b/lang/qt/src/qgpgmechangeexpiryjob.cpp
index 43ceee3..cf417ab 100644
--- a/lang/qt/src/qgpgmechangeexpiryjob.cpp
+++ b/lang/qt/src/qgpgmechangeexpiryjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmechangeexpiryjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmechangeownertrustjob.cpp b/lang/qt/src/qgpgmechangeownertrustjob.cpp
index 55131d9..d9a613f 100644
--- a/lang/qt/src/qgpgmechangeownertrustjob.cpp
+++ b/lang/qt/src/qgpgmechangeownertrustjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmechangeownertrustjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmechangepasswdjob.cpp b/lang/qt/src/qgpgmechangepasswdjob.cpp
index 0aec927..b04273c 100644
--- a/lang/qt/src/qgpgmechangepasswdjob.cpp
+++ b/lang/qt/src/qgpgmechangepasswdjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmechangepasswdjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmedecryptjob.cpp b/lang/qt/src/qgpgmedecryptjob.cpp
index 7116449..449e9aa 100644
--- a/lang/qt/src/qgpgmedecryptjob.cpp
+++ b/lang/qt/src/qgpgmedecryptjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmedecryptjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmedecryptverifyjob.cpp b/lang/qt/src/qgpgmedecryptverifyjob.cpp
index d46a9b5..e6d3ff2 100644
--- a/lang/qt/src/qgpgmedecryptverifyjob.cpp
+++ b/lang/qt/src/qgpgmedecryptverifyjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmedecryptverifyjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmedeletejob.cpp b/lang/qt/src/qgpgmedeletejob.cpp
index 323aec4..9145298 100644
--- a/lang/qt/src/qgpgmedeletejob.cpp
+++ b/lang/qt/src/qgpgmedeletejob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmedeletejob.h"
#include "context.h"
diff --git a/lang/qt/src/qgpgmedownloadjob.cpp b/lang/qt/src/qgpgmedownloadjob.cpp
index 48cc907..b0dca56 100644
--- a/lang/qt/src/qgpgmedownloadjob.cpp
+++ b/lang/qt/src/qgpgmedownloadjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmedownloadjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmeencryptjob.cpp b/lang/qt/src/qgpgmeencryptjob.cpp
index 82c8ed8..d13acab 100644
--- a/lang/qt/src/qgpgmeencryptjob.cpp
+++ b/lang/qt/src/qgpgmeencryptjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmeencryptjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmeexportjob.cpp b/lang/qt/src/qgpgmeexportjob.cpp
index dfc5fc9..e6073f0 100644
--- a/lang/qt/src/qgpgmeexportjob.cpp
+++ b/lang/qt/src/qgpgmeexportjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmeexportjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp b/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp
index 0f19679..acefbb2 100644
--- a/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp
+++ b/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmeimportfromkeyserverjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmeimportjob.cpp b/lang/qt/src/qgpgmeimportjob.cpp
index f125b12..dcabad3 100644
--- a/lang/qt/src/qgpgmeimportjob.cpp
+++ b/lang/qt/src/qgpgmeimportjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmeimportjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmekeyformailboxjob.cpp b/lang/qt/src/qgpgmekeyformailboxjob.cpp
index 803d0e6..7054c78 100644
--- a/lang/qt/src/qgpgmekeyformailboxjob.cpp
+++ b/lang/qt/src/qgpgmekeyformailboxjob.cpp
@@ -30,6 +30,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmekeyformailboxjob.h"
#include "qgpgmekeylistjob.h"
diff --git a/lang/qt/src/qgpgmekeygenerationjob.cpp b/lang/qt/src/qgpgmekeygenerationjob.cpp
index cba6b76..31f3342 100644
--- a/lang/qt/src/qgpgmekeygenerationjob.cpp
+++ b/lang/qt/src/qgpgmekeygenerationjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmekeygenerationjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmekeylistjob.cpp b/lang/qt/src/qgpgmekeylistjob.cpp
index 1169c46..887a902 100644
--- a/lang/qt/src/qgpgmekeylistjob.cpp
+++ b/lang/qt/src/qgpgmekeylistjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmekeylistjob.h"
#include "key.h"
diff --git a/lang/qt/src/qgpgmelistallkeysjob.cpp b/lang/qt/src/qgpgmelistallkeysjob.cpp
index fd8bfc3..7ba8bc9 100644
--- a/lang/qt/src/qgpgmelistallkeysjob.cpp
+++ b/lang/qt/src/qgpgmelistallkeysjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmelistallkeysjob.h"
#include "key.h"
diff --git a/lang/qt/src/qgpgmenewcryptoconfig.cpp b/lang/qt/src/qgpgmenewcryptoconfig.cpp
index 7303f10..eb3af56 100644
--- a/lang/qt/src/qgpgmenewcryptoconfig.cpp
+++ b/lang/qt/src/qgpgmenewcryptoconfig.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmenewcryptoconfig.h"
#include <QDebug>
@@ -80,7 +84,7 @@ QGpgMENewCryptoConfig::~QGpgMENewCryptoConfig()
clear();
}
-void QGpgMENewCryptoConfig::reloadConfiguration(bool showErrors)
+void QGpgMENewCryptoConfig::reloadConfiguration(bool)
{
clear();
diff --git a/lang/qt/src/qgpgmerefreshkeysjob.cpp b/lang/qt/src/qgpgmerefreshkeysjob.cpp
index 3d221f6..493a010 100644
--- a/lang/qt/src/qgpgmerefreshkeysjob.cpp
+++ b/lang/qt/src/qgpgmerefreshkeysjob.cpp
@@ -2,7 +2,7 @@
qgpgmerefreshkeysjob.cpp
This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klar�vdalens Datakonsult AB
+ Copyright (c) 2004 Klarävdalens Datakonsult AB
Copyright (c) 2016 Intevation GmbH
QGpgME is free software; you can redistribute it and/or
@@ -33,6 +33,10 @@
#define MAX_CMD_LENGTH 32768
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmerefreshkeysjob.h"
#include <QDebug>
diff --git a/lang/qt/src/qgpgmesecretkeyexportjob.cpp b/lang/qt/src/qgpgmesecretkeyexportjob.cpp
index f4ec698..75cd83a 100644
--- a/lang/qt/src/qgpgmesecretkeyexportjob.cpp
+++ b/lang/qt/src/qgpgmesecretkeyexportjob.cpp
@@ -2,7 +2,7 @@
qgpgmesecretexportjob.cpp
This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klar�vdalens Datakonsult AB
+ Copyright (c) 2004 Klarävdalens Datakonsult AB
Copyright (c) 2016 Intevation GmbH
QGpgME is free software; you can redistribute it and/or
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmesecretkeyexportjob.h"
#include <QDebug>
diff --git a/lang/qt/src/qgpgmesignencryptjob.cpp b/lang/qt/src/qgpgmesignencryptjob.cpp
index d2e45b1..9dcc619 100644
--- a/lang/qt/src/qgpgmesignencryptjob.cpp
+++ b/lang/qt/src/qgpgmesignencryptjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmesignencryptjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmesignjob.cpp b/lang/qt/src/qgpgmesignjob.cpp
index 4e2312b..e165f52 100644
--- a/lang/qt/src/qgpgmesignjob.cpp
+++ b/lang/qt/src/qgpgmesignjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmesignjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmesignkeyjob.cpp b/lang/qt/src/qgpgmesignkeyjob.cpp
index e6c1478..27aff5e 100644
--- a/lang/qt/src/qgpgmesignkeyjob.cpp
+++ b/lang/qt/src/qgpgmesignkeyjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmesignkeyjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmetofupolicyjob.cpp b/lang/qt/src/qgpgmetofupolicyjob.cpp
index a24c946..34630a1 100644
--- a/lang/qt/src/qgpgmetofupolicyjob.cpp
+++ b/lang/qt/src/qgpgmetofupolicyjob.cpp
@@ -28,6 +28,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmetofupolicyjob.h"
#include "context.h"
diff --git a/lang/qt/src/qgpgmeverifydetachedjob.cpp b/lang/qt/src/qgpgmeverifydetachedjob.cpp
index 8efef05..ee74861 100644
--- a/lang/qt/src/qgpgmeverifydetachedjob.cpp
+++ b/lang/qt/src/qgpgmeverifydetachedjob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmeverifydetachedjob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmeverifyopaquejob.cpp b/lang/qt/src/qgpgmeverifyopaquejob.cpp
index b513f82..aea406a 100644
--- a/lang/qt/src/qgpgmeverifyopaquejob.cpp
+++ b/lang/qt/src/qgpgmeverifyopaquejob.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmeverifyopaquejob.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/qgpgmewkspublishjob.cpp b/lang/qt/src/qgpgmewkspublishjob.cpp
index 8f97cb5..9773893 100644
--- a/lang/qt/src/qgpgmewkspublishjob.cpp
+++ b/lang/qt/src/qgpgmewkspublishjob.cpp
@@ -28,6 +28,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "qgpgmewkspublishjob.h"
#include "context.h"
@@ -137,7 +141,7 @@ static QGpgMEWKSPublishJob::result_type create_worker(const char *fpr, const QSt
proc.readAllStandardOutput(), proc.readAllStandardError(), QString(), Error());
}
-static QGpgMEWKSPublishJob::result_type recieve_worker(const QByteArray &response)
+static QGpgMEWKSPublishJob::result_type receive_worker(const QByteArray &response)
{
if (response.isEmpty()) {
return std::make_tuple (Error(make_error(GPG_ERR_INV_ARG)),
@@ -181,9 +185,9 @@ void QGpgMEWKSPublishJob::startCreate(const char *fpr, const QString &mailbox) {
run(std::bind(&create_worker, fpr, mailbox));
}
-void QGpgMEWKSPublishJob::startRecieve(const QByteArray &response)
+void QGpgMEWKSPublishJob::startReceive(const QByteArray &response)
{
- run(std::bind(&recieve_worker, response));
+ run(std::bind(&receive_worker, response));
}
#include "qgpgmewkspublishjob.moc"
diff --git a/lang/qt/src/qgpgmewkspublishjob.h b/lang/qt/src/qgpgmewkspublishjob.h
index 1a31149..5fd3c03 100644
--- a/lang/qt/src/qgpgmewkspublishjob.h
+++ b/lang/qt/src/qgpgmewkspublishjob.h
@@ -62,7 +62,7 @@ public:
void startCheck(const QString &mailbox) Q_DECL_OVERRIDE;
void startCreate(const char *fpr, const QString &mailbox) Q_DECL_OVERRIDE;
- void startRecieve(const QByteArray &response) Q_DECL_OVERRIDE;
+ void startReceive(const QByteArray &response) Q_DECL_OVERRIDE;
};
}
diff --git a/lang/qt/src/threadedjobmixin.cpp b/lang/qt/src/threadedjobmixin.cpp
index cd6ab5f..66d21fb 100644
--- a/lang/qt/src/threadedjobmixin.cpp
+++ b/lang/qt/src/threadedjobmixin.cpp
@@ -31,6 +31,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "threadedjobmixin.h"
#include "dataprovider.h"
diff --git a/lang/qt/src/threadedjobmixin.h b/lang/qt/src/threadedjobmixin.h
index 62d7f1c..d1b1043 100644
--- a/lang/qt/src/threadedjobmixin.h
+++ b/lang/qt/src/threadedjobmixin.h
@@ -223,7 +223,8 @@ protected:
{
return m_auditLogError;
}
- void showProgress(const char *what, int type, int current, int total) Q_DECL_OVERRIDE {
+ void showProgress(const char * /*what*/,
+ int /*type*/, int current, int total) Q_DECL_OVERRIDE {
// will be called from the thread exec'ing the operation, so
// just bounce everything to the owning thread:
// ### hope this is thread-safe (meta obj is const, and
diff --git a/lang/qt/src/wkspublishjob.h b/lang/qt/src/wkspublishjob.h
index 782112f..0cec630 100644
--- a/lang/qt/src/wkspublishjob.h
+++ b/lang/qt/src/wkspublishjob.h
@@ -45,7 +45,7 @@ namespace QGpgME {
* Handles Web Key Service Publishing. Needs WKS tools installed and
* server support.
*
- * Remember that after a result is emited the job is auto deleted
+ * Remember that after a result is emitted the job is auto deleted
* so you can only use it for a single action.
*/
class QGPGME_EXPORT WKSPublishJob: public Job
@@ -82,7 +82,7 @@ public:
*
* @param response The response of the server.
**/
- virtual void startRecieve(const QByteArray &response) = 0;
+ virtual void startReceive(const QByteArray &response) = 0;
Q_SIGNALS:
/* Result of the operation returned Data and returned Error are
diff --git a/lang/qt/tests/Makefile.am b/lang/qt/tests/Makefile.am
index f243a55..ad08ad4 100644
--- a/lang/qt/tests/Makefile.am
+++ b/lang/qt/tests/Makefile.am
@@ -25,10 +25,10 @@ TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir)
EXTRA_DIST = initial.test
TESTS = initial.test t-keylist t-keylocate t-ownertrust t-tofuinfo \
- t-encrypt t-wkspublish
+ t-encrypt t-verify
moc_files = t-keylist.moc t-keylocate.moc t-ownertrust.moc t-tofuinfo.moc \
- t-encrypt.moc t-support.hmoc t-wkspublish.moc
+ t-encrypt.moc t-support.hmoc t-wkspublish.moc t-verify.moc
AM_LDFLAGS = -no-install
@@ -56,6 +56,7 @@ t_ownertrust_SOURCES = t-ownertrust.cpp $(support_src)
t_tofuinfo_SOURCES = t-tofuinfo.cpp $(support_src)
t_encrypt_SOURCES = t-encrypt.cpp $(support_src)
t_wkspublish_SOURCES = t-wkspublish.cpp $(support_src)
+t_verify_SOURCES = t-verify.cpp $(support_src)
run_keyformailboxjob_SOURCES = run-keyformailboxjob.cpp
nodist_t_keylist_SOURCES = $(moc_files)
@@ -63,7 +64,7 @@ nodist_t_keylist_SOURCES = $(moc_files)
BUILT_SOURCES = $(moc_files)
noinst_PROGRAMS = t-keylist t-keylocate t-ownertrust t-tofuinfo t-encrypt \
- run-keyformailboxjob t-wkspublish
+ run-keyformailboxjob t-wkspublish t-verify
CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \
diff --git a/lang/qt/tests/Makefile.in b/lang/qt/tests/Makefile.in
index 45d4c76..5149a08 100644
--- a/lang/qt/tests/Makefile.in
+++ b/lang/qt/tests/Makefile.in
@@ -98,10 +98,11 @@ build_triplet = @build@
host_triplet = @host@
TESTS = initial.test t-keylist$(EXEEXT) t-keylocate$(EXEEXT) \
t-ownertrust$(EXEEXT) t-tofuinfo$(EXEEXT) t-encrypt$(EXEEXT) \
- t-wkspublish$(EXEEXT)
+ t-verify$(EXEEXT)
noinst_PROGRAMS = t-keylist$(EXEEXT) t-keylocate$(EXEEXT) \
t-ownertrust$(EXEEXT) t-tofuinfo$(EXEEXT) t-encrypt$(EXEEXT) \
- run-keyformailboxjob$(EXEEXT) t-wkspublish$(EXEEXT)
+ run-keyformailboxjob$(EXEEXT) t-wkspublish$(EXEEXT) \
+ t-verify$(EXEEXT)
subdir = lang/qt/tests
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/build-aux/mkinstalldirs \
@@ -163,6 +164,11 @@ t_tofuinfo_OBJECTS = $(am_t_tofuinfo_OBJECTS)
t_tofuinfo_LDADD = $(LDADD)
t_tofuinfo_DEPENDENCIES = ../../cpp/src/libgpgmepp.la \
../src/libqgpgme.la ../../../src/libgpgme.la
+am_t_verify_OBJECTS = t-verify.$(OBJEXT) $(am__objects_1)
+t_verify_OBJECTS = $(am_t_verify_OBJECTS)
+t_verify_LDADD = $(LDADD)
+t_verify_DEPENDENCIES = ../../cpp/src/libgpgmepp.la \
+ ../src/libqgpgme.la ../../../src/libgpgme.la
am_t_wkspublish_OBJECTS = t-wkspublish.$(OBJEXT) $(am__objects_1)
t_wkspublish_OBJECTS = $(am_t_wkspublish_OBJECTS)
t_wkspublish_LDADD = $(LDADD)
@@ -223,11 +229,12 @@ am__v_CCLD_1 =
SOURCES = $(run_keyformailboxjob_SOURCES) $(t_encrypt_SOURCES) \
$(t_keylist_SOURCES) $(nodist_t_keylist_SOURCES) \
$(t_keylocate_SOURCES) $(t_ownertrust_SOURCES) \
- $(t_tofuinfo_SOURCES) $(t_wkspublish_SOURCES)
+ $(t_tofuinfo_SOURCES) $(t_verify_SOURCES) \
+ $(t_wkspublish_SOURCES)
DIST_SOURCES = $(run_keyformailboxjob_SOURCES) $(t_encrypt_SOURCES) \
$(t_keylist_SOURCES) $(t_keylocate_SOURCES) \
$(t_ownertrust_SOURCES) $(t_tofuinfo_SOURCES) \
- $(t_wkspublish_SOURCES)
+ $(t_verify_SOURCES) $(t_wkspublish_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -471,7 +478,7 @@ GPG = gpg
TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir)
EXTRA_DIST = initial.test
moc_files = t-keylist.moc t-keylocate.moc t-ownertrust.moc t-tofuinfo.moc \
- t-encrypt.moc t-support.hmoc t-wkspublish.moc
+ t-encrypt.moc t-support.hmoc t-wkspublish.moc t-verify.moc
AM_LDFLAGS = -no-install
LDADD = ../../cpp/src/libgpgmepp.la ../src/libqgpgme.la \
@@ -491,6 +498,7 @@ t_ownertrust_SOURCES = t-ownertrust.cpp $(support_src)
t_tofuinfo_SOURCES = t-tofuinfo.cpp $(support_src)
t_encrypt_SOURCES = t-encrypt.cpp $(support_src)
t_wkspublish_SOURCES = t-wkspublish.cpp $(support_src)
+t_verify_SOURCES = t-verify.cpp $(support_src)
run_keyformailboxjob_SOURCES = run-keyformailboxjob.cpp
nodist_t_keylist_SOURCES = $(moc_files)
BUILT_SOURCES = $(moc_files)
@@ -568,6 +576,10 @@ t-tofuinfo$(EXEEXT): $(t_tofuinfo_OBJECTS) $(t_tofuinfo_DEPENDENCIES) $(EXTRA_t_
@rm -f t-tofuinfo$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(t_tofuinfo_OBJECTS) $(t_tofuinfo_LDADD) $(LIBS)
+t-verify$(EXEEXT): $(t_verify_OBJECTS) $(t_verify_DEPENDENCIES) $(EXTRA_t_verify_DEPENDENCIES)
+ @rm -f t-verify$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t_verify_OBJECTS) $(t_verify_LDADD) $(LIBS)
+
t-wkspublish$(EXEEXT): $(t_wkspublish_OBJECTS) $(t_wkspublish_DEPENDENCIES) $(EXTRA_t_wkspublish_DEPENDENCIES)
@rm -f t-wkspublish$(EXEEXT)
$(AM_V_CXXLD)$(CXXLINK) $(t_wkspublish_OBJECTS) $(t_wkspublish_LDADD) $(LIBS)
@@ -585,6 +597,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-ownertrust.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-support.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-tofuinfo.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-verify.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-wkspublish.Po@am__quote@
.cpp.o:
diff --git a/lang/qt/tests/run-keyformailboxjob.cpp b/lang/qt/tests/run-keyformailboxjob.cpp
index 9ac7668..73bedbd 100644
--- a/lang/qt/tests/run-keyformailboxjob.cpp
+++ b/lang/qt/tests/run-keyformailboxjob.cpp
@@ -29,6 +29,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "keyformailboxjob.h"
#include "keylistjob.h"
#include "protocol.h"
diff --git a/lang/qt/tests/t-encrypt.cpp b/lang/qt/tests/t-encrypt.cpp
index 3d4cfa9..4d65dc7 100644
--- a/lang/qt/tests/t-encrypt.cpp
+++ b/lang/qt/tests/t-encrypt.cpp
@@ -28,6 +28,10 @@
you do not wish to do so, delete this exception statement from
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <QDebug>
#include <QTest>
#include <QTemporaryDir>
@@ -49,6 +53,23 @@
using namespace QGpgME;
using namespace GpgME;
+static bool decryptSupported()
+{
+ /* With GnuPG 2.0.x (at least 2.0.26 by default on jessie)
+ * the passphrase_cb does not work. So the test popped up
+ * a pinentry. So tests requiring decryption don't work. */
+ static auto version = GpgME::engineInfo(GpgME::GpgEngine).engineVersion();
+ if (version < "2.0.0") {
+ /* With 1.4 it just works */
+ return true;
+ }
+ if (version < "2.1.0") {
+ /* With 2.1 it works with loopback mode */
+ return false;
+ }
+ return true;
+}
+
class EncryptionTest : public QGpgMETest
{
Q_OBJECT
@@ -78,6 +99,9 @@ private Q_SLOTS:
Q_ASSERT(cipherString.startsWith("-----BEGIN PGP MESSAGE-----"));
/* Now decrypt */
+ if (!decryptSupported()) {
+ return;
+ }
auto ctx = Context::createForProtocol(OpenPGP);
TestPassphraseProvider provider;
ctx->setPassphraseProvider(&provider);
@@ -113,7 +137,7 @@ private Q_SLOTS:
bool initSeen = false;
bool finishSeen = false;
- connect(job, &Job::progress, this, [this, &initSeen, &finishSeen] (const QString& what, int current, int total) {
+ connect(job, &Job::progress, this, [this, &initSeen, &finishSeen] (const QString&, int current, int total) {
// We only check for progress 0 and max progress as the other progress
// lines depend on the system speed and are as such unreliable to test.
Q_ASSERT(total == PROGRESS_TEST_SIZE);
@@ -125,8 +149,8 @@ private Q_SLOTS:
}
Q_ASSERT(current >= 0 && current <= total);
});
- connect(job, &EncryptJob::result, this, [this, &initSeen, &finishSeen] (const GpgME::EncryptionResult &result,
- const QByteArray &cipherText,
+ connect(job, &EncryptJob::result, this, [this, &initSeen, &finishSeen] (const GpgME::EncryptionResult &,
+ const QByteArray &,
const QString,
const GpgME::Error) {
Q_ASSERT(initSeen);
@@ -146,6 +170,9 @@ private Q_SLOTS:
void testSymmetricEncryptDecrypt()
{
+ if (!decryptSupported()) {
+ return;
+ }
auto ctx = Context::createForProtocol(OpenPGP);
TestPassphraseProvider provider;
ctx->setPassphraseProvider(&provider);
@@ -178,6 +205,9 @@ private:
* So this test is disabled until gnupg(?) is fixed for this. */
void testMixedEncryptDecrypt()
{
+ if (!decryptSupported()) {
+ return;
+ }
auto listjob = openpgp()->keyListJob(false, false, false);
std::vector<Key> keys;
auto keylistresult = listjob->exec(QStringList() << QStringLiteral("alfa@example.net"),
diff --git a/lang/qt/tests/t-keylist.cpp b/lang/qt/tests/t-keylist.cpp
index 767c96b..2578576 100644
--- a/lang/qt/tests/t-keylist.cpp
+++ b/lang/qt/tests/t-keylist.cpp
@@ -29,6 +29,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <QDebug>
#include <QTest>
#include <QSignalSpy>
diff --git a/lang/qt/tests/t-keylocate.cpp b/lang/qt/tests/t-keylocate.cpp
index e75f24d..63cb836 100644
--- a/lang/qt/tests/t-keylocate.cpp
+++ b/lang/qt/tests/t-keylocate.cpp
@@ -28,6 +28,10 @@
you do not wish to do so, delete this exception statement from
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <QDebug>
#include <QTest>
#include <QSignalSpy>
diff --git a/lang/qt/tests/t-ownertrust.cpp b/lang/qt/tests/t-ownertrust.cpp
index b9efffd..db863b2 100644
--- a/lang/qt/tests/t-ownertrust.cpp
+++ b/lang/qt/tests/t-ownertrust.cpp
@@ -29,6 +29,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <QDebug>
#include <QTest>
#include <QSignalSpy>
diff --git a/lang/qt/tests/t-support.cpp b/lang/qt/tests/t-support.cpp
index 86372f7..857d0a3 100644
--- a/lang/qt/tests/t-support.cpp
+++ b/lang/qt/tests/t-support.cpp
@@ -29,6 +29,10 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "t-support.h"
#include <QTest>
diff --git a/lang/qt/tests/t-support.h b/lang/qt/tests/t-support.h
index 59d9a4d..704fab4 100644
--- a/lang/qt/tests/t-support.h
+++ b/lang/qt/tests/t-support.h
@@ -39,8 +39,8 @@ namespace GpgME
class TestPassphraseProvider : public PassphraseProvider
{
public:
- char *getPassphrase(const char *useridHint, const char *description,
- bool previousWasBad, bool &canceled) Q_DECL_OVERRIDE
+ char *getPassphrase(const char * /*useridHint*/, const char * /*description*/,
+ bool /*previousWasBad*/, bool &/*canceled*/) Q_DECL_OVERRIDE
{
return strdup("abc");
}
diff --git a/lang/qt/tests/t-tofuinfo.cpp b/lang/qt/tests/t-tofuinfo.cpp
index d76ff7b..2c87e4a 100644
--- a/lang/qt/tests/t-tofuinfo.cpp
+++ b/lang/qt/tests/t-tofuinfo.cpp
@@ -28,6 +28,10 @@
you do not wish to do so, delete this exception statement from
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <QDebug>
#include <QTest>
#include <QTemporaryDir>
diff --git a/lang/qt/tests/t-verify.cpp b/lang/qt/tests/t-verify.cpp
new file mode 100644
index 0000000..aedfc19
--- /dev/null
+++ b/lang/qt/tests/t-verify.cpp
@@ -0,0 +1,93 @@
+/* t-verifiy.cpp
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2016 Intevation GmbH
+
+ QGpgME is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ QGpgME is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+ In addition, as a special exception, the copyright holders give
+ permission to link the code of this program with any edition of
+ the Qt library by Trolltech AS, Norway (or with modified versions
+ of Qt that use the same license as Qt), and distribute linked
+ combinations including the two. You must obey the GNU General
+ Public License in all respects for all of the code used other than
+ Qt. If you modify this file, you may extend this exception to
+ your version of the file, but you are not obligated to do so. If
+ you do not wish to do so, delete this exception statement from
+ your version.
+*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <QDebug>
+#include <QTest>
+
+
+#include "protocol.h"
+
+#include "verifyopaquejob.h"
+#include "verificationresult.h"
+#include "key.h"
+#include "t-support.h"
+
+using namespace QGpgME;
+using namespace GpgME;
+
+static const char testMsg1[] =
+"-----BEGIN PGP MESSAGE-----\n"
+"\n"
+"owGbwMvMwCSoW1RzPCOz3IRxjXQSR0lqcYleSUWJTZOvjVdpcYmCu1+oQmaJIleH\n"
+"GwuDIBMDGysTSIqBi1MApi+nlGGuwDeHao53HBr+FoVGP3xX+kvuu9fCMJvl6IOf\n"
+"y1kvP4y+8D5a11ang0udywsA\n"
+"=Crq6\n"
+"-----END PGP MESSAGE-----\n";
+
+
+class VerifyTest: public QGpgMETest
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+
+ /* Check that a signature always has a key. */
+ void testSignatureKey()
+ {
+ const QByteArray signedData(testMsg1);
+ auto verifyJob = openpgp()->verifyOpaqueJob(true);
+ QByteArray verified;
+
+ auto result = verifyJob->exec(signedData, verified);
+ Q_ASSERT(!result.error());
+ delete verifyJob;
+
+ Q_ASSERT(result.numSignatures() == 1);
+ auto sig = result.signatures()[0];
+
+ const auto key = sig.key(true, false);
+ Q_ASSERT(!key.isNull());
+
+ bool found = false;
+ for (const auto subkey: key.subkeys()) {
+ if (!strcmp (subkey.fingerprint(), sig.fingerprint())) {
+ found = true;
+ }
+ }
+ Q_ASSERT(found);
+ }
+};
+
+QTEST_MAIN(VerifyTest)
+#include "t-verify.moc"
diff --git a/lang/qt/tests/t-wkspublish.cpp b/lang/qt/tests/t-wkspublish.cpp
index 17d3447..326ecaa 100644
--- a/lang/qt/tests/t-wkspublish.cpp
+++ b/lang/qt/tests/t-wkspublish.cpp
@@ -28,6 +28,10 @@
you do not wish to do so, delete this exception statement from
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include <QDebug>
#include <QTest>
#include <QSignalSpy>
@@ -122,7 +126,7 @@ private Q_SLOTS:
// First check if it is supported
auto job = openpgp()->wksPublishJob();
connect(job, &WKSPublishJob::result, this,
- [this] (Error err, QByteArray out, QByteArray errout, QString, Error) {
+ [this] (Error err, QByteArray, QByteArray, QString, Error) {
Q_ASSERT(err);
Q_EMIT asyncDone();
});
@@ -140,7 +144,7 @@ private:
// First check if it is supported
auto job = openpgp()->wksPublishJob();
connect(job, &WKSPublishJob::result, this,
- [this] (Error err, QByteArray out, QByteArray errout, QString, Error) {
+ [this] (Error err, QByteArray, QByteArray, QString, Error) {
if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.0.16") {
std::cout << err;
Q_ASSERT(err);
@@ -161,7 +165,7 @@ private:
}
auto job = openpgp()->wksPublishJob();
connect(job, &WKSPublishJob::result, this,
- [this] (Error err, QByteArray out, QByteArray errout, QString, Error) {
+ [this] (Error err, QByteArray, QByteArray, QString, Error) {
Q_ASSERT(err);
Q_EMIT asyncDone();
});
@@ -193,7 +197,7 @@ private:
auto keygenjob = openpgp()->keyGenerationJob();
QByteArray fpr;
connect(keygenjob, &KeyGenerationJob::result, this,
- [this, &fpr](KeyGenerationResult result, QByteArray pubkeyData, QString, Error)
+ [this, &fpr](KeyGenerationResult result, QByteArray, QString, Error)
{
Q_ASSERT(!result.error());
fpr = QByteArray(result.fingerprint());
@@ -207,7 +211,7 @@ private:
/* Then try to create a request. */
auto job = openpgp()->wksPublishJob();
connect(job, &WKSPublishJob::result, this,
- [this] (Error err, QByteArray out, QByteArray errout, QString, Error) {
+ [this] (Error err, QByteArray out, QByteArray, QString, Error) {
Q_ASSERT(!err);
Q_EMIT asyncDone();
const QString outstr = QString(out);
@@ -222,7 +226,7 @@ private:
Q_ASSERT(spy.wait());
}
- void testWKSPublishRecieve() {
+ void testWKSPublishReceive() {
if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.0.16") {
/* Not supported */
return;
@@ -243,7 +247,7 @@ private:
/* Get a response. */
auto job = openpgp()->wksPublishJob();
connect(job, &WKSPublishJob::result, this,
- [this] (Error err, QByteArray out, QByteArray errout, QString, Error) {
+ [this] (Error err, QByteArray out, QByteArray, QString, Error) {
Q_ASSERT(!err);
Q_EMIT asyncDone();
const QString outstr = QString(out);
@@ -254,7 +258,7 @@ private:
Q_ASSERT(outstr.contains(
QStringLiteral("From: " TEST_ADDRESS)));
});
- job->startRecieve(QByteArray(testResponse));
+ job->startReceive(QByteArray(testResponse));
Q_ASSERT(spy.wait());
}