summaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
Diffstat (limited to 'lang')
-rw-r--r--lang/Makefile.in3
-rw-r--r--lang/README2
-rw-r--r--lang/cl/Makefile.in3
-rw-r--r--lang/cl/gpgme.asd2
-rw-r--r--lang/cpp/Makefile.in3
-rw-r--r--lang/cpp/src/GpgmeppConfig-w32.cmake.in.in103
-rw-r--r--lang/cpp/src/GpgmeppConfig.cmake.in.in2
-rw-r--r--lang/cpp/src/GpgmeppConfigVersion.cmake.in2
-rw-r--r--lang/cpp/src/Makefile.am24
-rw-r--r--lang/cpp/src/Makefile.in78
-rw-r--r--lang/cpp/src/context.cpp10
-rw-r--r--lang/cpp/src/context.h4
-rw-r--r--lang/cpp/src/engineinfo.h16
-rw-r--r--lang/cpp/src/gpgmefw.h6
-rw-r--r--lang/cpp/src/gpgmepp_version.h.in11
-rw-r--r--lang/cpp/src/swdbresult.cpp231
-rw-r--r--lang/cpp/src/swdbresult.h128
-rw-r--r--lang/cpp/src/tofuinfo.h2
-rw-r--r--lang/python/MANIFEST.in2
-rw-r--r--lang/python/Makefile.am44
-rw-r--r--lang/python/Makefile.in47
-rw-r--r--lang/python/README12
-rw-r--r--lang/python/examples/assuan.py4
-rw-r--r--lang/python/examples/decryption-filter.py6
-rwxr-xr-xlang/python/examples/delkey.py6
-rwxr-xr-xlang/python/examples/encrypt-to-all.py6
-rwxr-xr-xlang/python/examples/exportimport.py12
-rwxr-xr-xlang/python/examples/genkey.py8
-rw-r--r--lang/python/examples/inter-edit.py4
-rwxr-xr-xlang/python/examples/sign.py6
-rwxr-xr-xlang/python/examples/signverify.py10
-rwxr-xr-xlang/python/examples/simple.py4
-rw-r--r--lang/python/examples/testCMSgetkey.py4
-rwxr-xr-xlang/python/examples/verifydetails.py15
-rw-r--r--lang/python/gpg/__init__.py (renamed from lang/python/pyme/__init__.py)24
-rw-r--r--lang/python/gpg/callbacks.py (renamed from lang/python/pyme/callbacks.py)0
-rw-r--r--lang/python/gpg/constants/__init__.py (renamed from lang/python/pyme/constants/__init__.py)32
-rw-r--r--lang/python/gpg/constants/data/__init__.py (renamed from lang/python/pyme/constants/data/__init__.py)0
-rw-r--r--lang/python/gpg/constants/data/encoding.py (renamed from lang/python/pyme/constants/data/encoding.py)3
-rw-r--r--lang/python/gpg/constants/event.py (renamed from lang/python/pyme/constants/event.py)3
-rw-r--r--lang/python/gpg/constants/import.py (renamed from lang/python/pyme/constants/import.py)3
-rw-r--r--lang/python/gpg/constants/keylist/__init__.py (renamed from lang/python/pyme/constants/keylist/__init__.py)0
-rw-r--r--lang/python/gpg/constants/keylist/mode.py (renamed from lang/python/pyme/constants/keylist/mode.py)3
-rw-r--r--lang/python/gpg/constants/md.py (renamed from lang/python/pyme/constants/md.py)3
-rw-r--r--lang/python/gpg/constants/pk.py (renamed from lang/python/pyme/constants/pk.py)3
-rw-r--r--lang/python/gpg/constants/protocol.py (renamed from lang/python/pyme/constants/protocol.py)3
-rw-r--r--lang/python/gpg/constants/sig/__init__.py (renamed from lang/python/pyme/constants/sig/__init__.py)4
-rw-r--r--lang/python/gpg/constants/sig/mode.py (renamed from lang/python/pyme/constants/sig/mode.py)3
-rw-r--r--lang/python/gpg/constants/sig/notation.py25
-rw-r--r--lang/python/gpg/constants/sigsum.py (renamed from lang/python/pyme/constants/sigsum.py)3
-rw-r--r--lang/python/gpg/constants/status.py (renamed from lang/python/pyme/constants/status.py)2
-rw-r--r--lang/python/gpg/constants/validity.py (renamed from lang/python/pyme/constants/validity.py)3
-rw-r--r--lang/python/gpg/core.py (renamed from lang/python/pyme/core.py)30
-rw-r--r--lang/python/gpg/errors.py (renamed from lang/python/pyme/errors.py)13
-rw-r--r--lang/python/gpg/gpgme.py (renamed from lang/python/pyme/gpgme.py)1
-rw-r--r--lang/python/gpg/results.py (renamed from lang/python/pyme/results.py)0
-rw-r--r--lang/python/gpg/util.py (renamed from lang/python/pyme/util.py)0
-rw-r--r--lang/python/gpg/version.py (renamed from lang/python/pyme/version.py)6
-rw-r--r--lang/python/gpg/version.py.in (renamed from lang/python/pyme/version.py.in)4
-rw-r--r--lang/python/gpgme.i32
-rw-r--r--lang/python/helpers.c124
-rw-r--r--lang/python/helpers.h12
-rw-r--r--lang/python/private.h28
-rw-r--r--lang/python/pyme/__pycache__/__init__.cpython-34.pycbin4633 -> 0 bytes
-rw-r--r--lang/python/pyme/__pycache__/version.cpython-34.pycbin1997 -> 0 bytes
-rwxr-xr-xlang/python/setup.py.in18
-rw-r--r--lang/python/tests/Makefile.am2
-rw-r--r--lang/python/tests/Makefile.in5
-rwxr-xr-xlang/python/tests/initial.py6
-rw-r--r--lang/python/tests/support.py6
-rwxr-xr-xlang/python/tests/t-callbacks.py58
-rwxr-xr-xlang/python/tests/t-data.py30
-rwxr-xr-xlang/python/tests/t-decrypt-verify.py29
-rwxr-xr-xlang/python/tests/t-decrypt.py13
-rwxr-xr-xlang/python/tests/t-edit.py10
-rwxr-xr-xlang/python/tests/t-encrypt-large.py12
-rwxr-xr-xlang/python/tests/t-encrypt-sign.py25
-rwxr-xr-xlang/python/tests/t-encrypt-sym.py21
-rwxr-xr-xlang/python/tests/t-encrypt.py17
-rwxr-xr-xlang/python/tests/t-export.py10
-rwxr-xr-xlang/python/tests/t-file-name.py14
-rwxr-xr-xlang/python/tests/t-idiomatic.py18
-rwxr-xr-xlang/python/tests/t-import.py10
-rwxr-xr-xlang/python/tests/t-keylist.py25
-rwxr-xr-xlang/python/tests/t-protocol-assuan.py8
-rwxr-xr-xlang/python/tests/t-sig-notation.py26
-rwxr-xr-xlang/python/tests/t-sign.py41
-rwxr-xr-xlang/python/tests/t-signers.py31
-rwxr-xr-xlang/python/tests/t-trustlist.py6
-rwxr-xr-xlang/python/tests/t-verify.py75
-rwxr-xr-xlang/python/tests/t-wait.py12
-rwxr-xr-xlang/python/tests/t-wrapper.py6
-rw-r--r--lang/qt/Makefile.in3
-rw-r--r--lang/qt/doc/Makefile.in3
-rw-r--r--lang/qt/src/DN1
-rw-r--r--lang/qt/src/Makefile.am40
-rw-r--r--lang/qt/src/Makefile.in92
-rw-r--r--lang/qt/src/QGpgmeConfig-w32.cmake.in.in105
-rw-r--r--lang/qt/src/QGpgmeConfig.cmake.in.in5
-rw-r--r--lang/qt/src/QGpgmeConfigVersion.cmake.in2
-rw-r--r--lang/qt/src/defaultkeygenerationjob.cpp6
-rw-r--r--lang/qt/src/dn.cpp495
-rw-r--r--lang/qt/src/dn.h136
-rw-r--r--lang/qt/src/job.cpp10
-rw-r--r--lang/qt/src/job.h16
-rw-r--r--lang/qt/src/qgpgme_export.h40
-rw-r--r--lang/qt/src/qgpgme_version.h.in58
-rw-r--r--lang/qt/src/threadedjobmixin.h11
-rw-r--r--lang/qt/src/wkspublishjob.h17
-rw-r--r--lang/qt/tests/Makefile.in3
-rw-r--r--lang/qt/tests/t-tofuinfo.cpp4
111 files changed, 2089 insertions, 679 deletions
diff --git a/lang/Makefile.in b/lang/Makefile.in
index 5c96b8f..647734a 100644
--- a/lang/Makefile.in
+++ b/lang/Makefile.in
@@ -328,6 +328,9 @@ SWIG = @SWIG@
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
diff --git a/lang/README b/lang/README
index f7a1595..0c5bbd9 100644
--- a/lang/README
+++ b/lang/README
@@ -12,4 +12,4 @@ Directory Language
cl Common Lisp
cpp C++
qt Qt-Framework API
-python Python 2 and 3 (port of PyME 0.9.0)
+python Python 2 and 3 (module name: gpg)
diff --git a/lang/cl/Makefile.in b/lang/cl/Makefile.in
index 7a79757..31d9325 100644
--- a/lang/cl/Makefile.in
+++ b/lang/cl/Makefile.in
@@ -301,6 +301,9 @@ SWIG = @SWIG@
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
diff --git a/lang/cl/gpgme.asd b/lang/cl/gpgme.asd
index bd195e5..5410fad 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.1"
+ :version "1.8.0"
:licence "GPL"
:depends-on ("cffi" "gpg-error")
:components ((:file "gpgme-package")
diff --git a/lang/cpp/Makefile.in b/lang/cpp/Makefile.in
index f042f77..30aef31 100644
--- a/lang/cpp/Makefile.in
+++ b/lang/cpp/Makefile.in
@@ -330,6 +330,9 @@ SWIG = @SWIG@
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
diff --git a/lang/cpp/src/GpgmeppConfig-w32.cmake.in.in b/lang/cpp/src/GpgmeppConfig-w32.cmake.in.in
new file mode 100644
index 0000000..1282676
--- /dev/null
+++ b/lang/cpp/src/GpgmeppConfig-w32.cmake.in.in
@@ -0,0 +1,103 @@
+# CMake Config file for GPGMEPP.
+# Copyright (C) 2016 Intevation GmbH
+#
+# This file is part of GPGMEPP.
+#
+# GPGME-CL 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.
+#
+# GPGME-CL 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 Lesser 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., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA
+
+# based on a generated file from cmake.
+# Generated by CMake 3.0.2
+
+if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
+ message(FATAL_ERROR "CMake >= 2.6.0 required")
+endif()
+cmake_policy(PUSH)
+cmake_policy(VERSION 2.6)
+#----------------------------------------------------------------
+# Generated CMake target import file.
+#----------------------------------------------------------------
+
+# Commands may need to know the format version.
+set(CMAKE_IMPORT_FILE_VERSION 1)
+
+# Protect against multiple inclusion, which would fail when already imported targets are added once more.
+set(_targetsDefined)
+set(_targetsNotDefined)
+set(_expectedTargets)
+foreach(_expectedTarget Gpgmepp)
+ list(APPEND _expectedTargets ${_expectedTarget})
+ if(NOT TARGET ${_expectedTarget})
+ list(APPEND _targetsNotDefined ${_expectedTarget})
+ endif()
+ if(TARGET ${_expectedTarget})
+ list(APPEND _targetsDefined ${_expectedTarget})
+ endif()
+endforeach()
+if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
+ set(CMAKE_IMPORT_FILE_VERSION)
+ cmake_policy(POP)
+ return()
+endif()
+if(NOT "${_targetsDefined}" STREQUAL "")
+ message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
+endif()
+unset(_targetsDefined)
+unset(_targetsNotDefined)
+unset(_expectedTargets)
+
+# Create imported target Gpgmepp
+add_library(Gpgmepp SHARED IMPORTED)
+
+set_target_properties(Gpgmepp PROPERTIES
+ IMPORTED_IMPLIB "@resolved_libdir@/libgpgmepp.dll.a"
+ INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/gpgme++;@resolved_includedir@"
+ INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme.dll.a;@LIBASSUAN_LIBS@"
+ IMPORTED_LOCATION "@resolved_bindir@/libgpgmepp-6.dll"
+)
+list(APPEND _IMPORT_CHECK_TARGETS Gpgmepp )
+list(APPEND _IMPORT_CHECK_FILES_FOR_Gpgmepp "@resolved_libdir@/libgpgmepp.dll.a" "@resolved_bindir@/libgpgmepp-6.dll" )
+
+
+if(CMAKE_VERSION VERSION_LESS 2.8.12)
+ message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.")
+endif()
+
+# Loop over all imported files and verify that they actually exist
+foreach(target ${_IMPORT_CHECK_TARGETS} )
+ foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
+ if(NOT EXISTS "${file}" )
+ message(FATAL_ERROR "The imported target \"${target}\" references the file
+ \"${file}\"
+but this file does not exist. Possible reasons include:
+* The file was deleted, renamed, or moved to another location.
+* An install or uninstall procedure did not complete successfully.
+* The installation package was faulty and contained
+ \"${CMAKE_CURRENT_LIST_FILE}\"
+but not all the files it references.
+")
+ endif()
+ endforeach()
+ unset(_IMPORT_CHECK_FILES_FOR_${target})
+endforeach()
+unset(_IMPORT_CHECK_TARGETS)
+
+# Commands beyond this point should not need to know the version.
+set(CMAKE_IMPORT_FILE_VERSION)
+cmake_policy(POP)
+
+get_filename_component(QGpgme_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+# Pull in QGpgme for compatibility with KF5 variant.
+find_package(QGpgme CONFIG)
diff --git a/lang/cpp/src/GpgmeppConfig.cmake.in.in b/lang/cpp/src/GpgmeppConfig.cmake.in.in
index 73f5eaa..928d19f 100644
--- a/lang/cpp/src/GpgmeppConfig.cmake.in.in
+++ b/lang/cpp/src/GpgmeppConfig.cmake.in.in
@@ -64,7 +64,7 @@ add_library(Gpgmepp SHARED IMPORTED)
set_target_properties(Gpgmepp PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/gpgme++;@resolved_includedir@"
INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme@libsuffix@;@LIBASSUAN_LIBS@"
- IMPORTED_LOCATION "@resolved_libdir@/libgpgmepp@libsuffix@"
+ IMPORTED_LOCATION "@resolved_libdir@/libgpgmepp.so"
)
if(CMAKE_VERSION VERSION_LESS 2.8.12)
diff --git a/lang/cpp/src/GpgmeppConfigVersion.cmake.in b/lang/cpp/src/GpgmeppConfigVersion.cmake.in
index 43d6512..259bddd 100644
--- a/lang/cpp/src/GpgmeppConfigVersion.cmake.in
+++ b/lang/cpp/src/GpgmeppConfigVersion.cmake.in
@@ -19,7 +19,7 @@
# 02111-1307, USA
# based on a generated file from cmake.
-set(PACKAGE_VERSION "@LIBGPGMEPP_LT_CURRENT@.@LIBGPGMEPP_LT_AGE@.@LIBGPGMEPP_LT_REVISION@.@BUILD_REVISION@")
+set(PACKAGE_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_MICRO@")
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
set(PACKAGE_VERSION_COMPATIBLE FALSE)
diff --git a/lang/cpp/src/Makefile.am b/lang/cpp/src/Makefile.am
index 342bdf8..92ed784 100644
--- a/lang/cpp/src/Makefile.am
+++ b/lang/cpp/src/Makefile.am
@@ -19,7 +19,7 @@
# 02111-1307, USA
EXTRA_DIST = GpgmeppConfig.cmake.in.in GpgmeppConfigVersion.cmake.in \
- gpgmepp_version.h.in
+ gpgmepp_version.h.in GpgmeppConfig-w32.cmake.in.in
lib_LTLIBRARIES = libgpgmepp.la
@@ -33,7 +33,7 @@ main_sources = \
gpgsetownertrusteditinteractor.cpp gpgsignkeyeditinteractor.cpp \
gpgadduserideditinteractor.cpp defaultassuantransaction.cpp \
scdgetinfoassuantransaction.cpp gpgagentgetinfoassuantransaction.cpp \
- vfsmountresult.cpp configuration.cpp tofuinfo.cpp
+ vfsmountresult.cpp configuration.cpp tofuinfo.cpp swdbresult.cpp
gpgmepp_headers = \
configuration.h context.h data.h decryptionresult.h \
@@ -45,7 +45,7 @@ gpgmepp_headers = \
importresult.h keygenerationresult.h key.h keylistresult.h \
notation.h result.h scdgetinfoassuantransaction.h signingresult.h \
trustitem.h verificationresult.h vfsmountresult.h gpgmepp_export.h \
- tofuinfo.h
+ tofuinfo.h swdbresult.h
private_gpgmepp_headers = \
result_p.h context_p.h util.h callbacks.h data_p.h
@@ -57,7 +57,7 @@ interface_headers= \
gpgmeppincludedir = $(includedir)/gpgme++
gpgmeppinclude_HEADERS = $(gpgmepp_headers)
nobase_gpgmeppinclude_HEADERS = $(interface_headers)
-nodist_include_HEADERS = gpgmepp_version.h
+nodist_gpgmeppinclude_HEADERS = gpgmepp_version.h
libgpgmepp_la_SOURCES = $(main_sources) $(gpgmepp_headers) context_vanilla.cpp \
$(interface_headers) $(private_gpgmepp_headers)
@@ -66,20 +66,19 @@ AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
-DBUILDING_GPGMEPP
libgpgmepp_la_LIBADD = ../../../src/libgpgme.la @LIBASSUAN_LIBS@
-libgpgmepp_la_LDFLAGS = -version-info \
+libgpgmepp_la_LDFLAGS = -no-undefined -version-info \
@LIBGPGMEPP_LT_CURRENT@:@LIBGPGMEPP_LT_REVISION@:@LIBGPGMEPP_LT_AGE@
if HAVE_W32_SYSTEM
-libsuffix=.dll.a
+GpgmeppConfig.cmake: GpgmeppConfig-w32.cmake.in
+ sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \
+ sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \
+ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
else
-libsuffix=.so
-endif
-
GpgmeppConfig.cmake: GpgmeppConfig.cmake.in
sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
- sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
-
+endif
install-cmake-files: GpgmeppConfig.cmake GpgmeppConfigVersion.cmake
-$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp
$(INSTALL) -m 644 GpgmeppConfig.cmake \
@@ -96,4 +95,5 @@ install-data-local: install-cmake-files
uninstall-local: uninstall-cmake-files
-CLEANFILES = GpgmeppConfig.cmake
+CLEANFILES = GpgmeppConfig.cmake GpgmeppConfigVersion.cmake \
+ gpgmepp_version.h GpgmeppConfig.cmake.in
diff --git a/lang/cpp/src/Makefile.in b/lang/cpp/src/Makefile.in
index 6be45d1..45f6219 100644
--- a/lang/cpp/src/Makefile.in
+++ b/lang/cpp/src/Makefile.in
@@ -102,6 +102,7 @@ host_triplet = @host@
subdir = lang/cpp/src
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/build-aux/mkinstalldirs \
+ $(srcdir)/GpgmeppConfig-w32.cmake.in.in \
$(srcdir)/GpgmeppConfig.cmake.in.in \
$(srcdir)/GpgmeppConfigVersion.cmake.in \
$(srcdir)/gpgmepp_version.h.in $(top_srcdir)/build-aux/depcomp \
@@ -122,8 +123,8 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES = GpgmeppConfig.cmake.in GpgmeppConfigVersion.cmake \
- gpgmepp_version.h
+CONFIG_CLEAN_FILES = GpgmeppConfig-w32.cmake.in GpgmeppConfig.cmake.in \
+ GpgmeppConfigVersion.cmake gpgmepp_version.h
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
@@ -154,7 +155,8 @@ am__uninstall_files_from_dir = { \
}
am__installdirs = "$(DESTDIR)$(libdir)" \
"$(DESTDIR)$(gpgmeppincludedir)" \
- "$(DESTDIR)$(gpgmeppincludedir)" "$(DESTDIR)$(includedir)"
+ "$(DESTDIR)$(gpgmeppincludedir)" \
+ "$(DESTDIR)$(gpgmeppincludedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libgpgmepp_la_DEPENDENCIES = ../../../src/libgpgme.la
am__objects_1 = exception.lo context.lo key.lo trustitem.lo data.lo \
@@ -167,7 +169,7 @@ am__objects_1 = exception.lo context.lo key.lo trustitem.lo data.lo \
gpgadduserideditinteractor.lo defaultassuantransaction.lo \
scdgetinfoassuantransaction.lo \
gpgagentgetinfoassuantransaction.lo vfsmountresult.lo \
- configuration.lo tofuinfo.lo
+ configuration.lo tofuinfo.lo swdbresult.lo
am__objects_2 =
am_libgpgmepp_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
context_vanilla.lo $(am__objects_2) $(am__objects_2)
@@ -240,7 +242,7 @@ am__can_run_installinfo = \
*) (install-info --version) >/dev/null 2>&1;; \
esac
HEADERS = $(gpgmeppinclude_HEADERS) $(nobase_gpgmeppinclude_HEADERS) \
- $(nodist_include_HEADERS)
+ $(nodist_gpgmeppinclude_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
@@ -392,6 +394,9 @@ SWIG = @SWIG@
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
@@ -454,7 +459,7 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
EXTRA_DIST = GpgmeppConfig.cmake.in.in GpgmeppConfigVersion.cmake.in \
- gpgmepp_version.h.in
+ gpgmepp_version.h.in GpgmeppConfig-w32.cmake.in.in
lib_LTLIBRARIES = libgpgmepp.la
main_sources = \
@@ -467,7 +472,7 @@ main_sources = \
gpgsetownertrusteditinteractor.cpp gpgsignkeyeditinteractor.cpp \
gpgadduserideditinteractor.cpp defaultassuantransaction.cpp \
scdgetinfoassuantransaction.cpp gpgagentgetinfoassuantransaction.cpp \
- vfsmountresult.cpp configuration.cpp tofuinfo.cpp
+ vfsmountresult.cpp configuration.cpp tofuinfo.cpp swdbresult.cpp
gpgmepp_headers = \
configuration.h context.h data.h decryptionresult.h \
@@ -479,7 +484,7 @@ gpgmepp_headers = \
importresult.h keygenerationresult.h key.h keylistresult.h \
notation.h result.h scdgetinfoassuantransaction.h signingresult.h \
trustitem.h verificationresult.h vfsmountresult.h gpgmepp_export.h \
- tofuinfo.h
+ tofuinfo.h swdbresult.h
private_gpgmepp_headers = \
result_p.h context_p.h util.h callbacks.h data_p.h
@@ -491,7 +496,7 @@ interface_headers = \
gpgmeppincludedir = $(includedir)/gpgme++
gpgmeppinclude_HEADERS = $(gpgmepp_headers)
nobase_gpgmeppinclude_HEADERS = $(interface_headers)
-nodist_include_HEADERS = gpgmepp_version.h
+nodist_gpgmeppinclude_HEADERS = gpgmepp_version.h
libgpgmepp_la_SOURCES = $(main_sources) $(gpgmepp_headers) context_vanilla.cpp \
$(interface_headers) $(private_gpgmepp_headers)
@@ -499,12 +504,12 @@ AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
-DBUILDING_GPGMEPP
libgpgmepp_la_LIBADD = ../../../src/libgpgme.la @LIBASSUAN_LIBS@
-libgpgmepp_la_LDFLAGS = -version-info \
+libgpgmepp_la_LDFLAGS = -no-undefined -version-info \
@LIBGPGMEPP_LT_CURRENT@:@LIBGPGMEPP_LT_REVISION@:@LIBGPGMEPP_LT_AGE@
-@HAVE_W32_SYSTEM_FALSE@libsuffix = .so
-@HAVE_W32_SYSTEM_TRUE@libsuffix = .dll.a
-CLEANFILES = GpgmeppConfig.cmake
+CLEANFILES = GpgmeppConfig.cmake GpgmeppConfigVersion.cmake \
+ gpgmepp_version.h GpgmeppConfig.cmake.in
+
all: all-am
.SUFFIXES:
@@ -539,6 +544,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
+GpgmeppConfig-w32.cmake.in: $(top_builddir)/config.status $(srcdir)/GpgmeppConfig-w32.cmake.in.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
GpgmeppConfig.cmake.in: $(top_builddir)/config.status $(srcdir)/GpgmeppConfig.cmake.in.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
GpgmeppConfigVersion.cmake: $(top_builddir)/config.status $(srcdir)/GpgmeppConfigVersion.cmake.in
@@ -613,6 +620,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keylistresult.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scdgetinfoassuantransaction.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signingresult.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/swdbresult.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tofuinfo.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trustitem.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/verificationresult.Plo@am__quote@
@@ -689,27 +697,27 @@ uninstall-nobase_gpgmeppincludeHEADERS:
@list='$(nobase_gpgmeppinclude_HEADERS)'; test -n "$(gpgmeppincludedir)" || list=; \
$(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
dir='$(DESTDIR)$(gpgmeppincludedir)'; $(am__uninstall_files_from_dir)
-install-nodist_includeHEADERS: $(nodist_include_HEADERS)
+install-nodist_gpgmeppincludeHEADERS: $(nodist_gpgmeppinclude_HEADERS)
@$(NORMAL_INSTALL)
- @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \
+ @list='$(nodist_gpgmeppinclude_HEADERS)'; test -n "$(gpgmeppincludedir)" || list=; \
if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(gpgmeppincludedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(gpgmeppincludedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
- echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
- $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(gpgmeppincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(gpgmeppincludedir)" || exit $$?; \
done
-uninstall-nodist_includeHEADERS:
+uninstall-nodist_gpgmeppincludeHEADERS:
@$(NORMAL_UNINSTALL)
- @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \
+ @list='$(nodist_gpgmeppinclude_HEADERS)'; test -n "$(gpgmeppincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
+ dir='$(DESTDIR)$(gpgmeppincludedir)'; $(am__uninstall_files_from_dir)
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
@@ -797,7 +805,7 @@ check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
- for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(gpgmeppincludedir)" "$(DESTDIR)$(gpgmeppincludedir)" "$(DESTDIR)$(includedir)"; do \
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(gpgmeppincludedir)" "$(DESTDIR)$(gpgmeppincludedir)" "$(DESTDIR)$(gpgmeppincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
@@ -856,7 +864,7 @@ info-am:
install-data-am: install-data-local install-gpgmeppincludeHEADERS \
install-nobase_gpgmeppincludeHEADERS \
- install-nodist_includeHEADERS
+ install-nodist_gpgmeppincludeHEADERS
install-dvi: install-dvi-am
@@ -904,7 +912,7 @@ ps-am:
uninstall-am: uninstall-gpgmeppincludeHEADERS uninstall-libLTLIBRARIES \
uninstall-local uninstall-nobase_gpgmeppincludeHEADERS \
- uninstall-nodist_includeHEADERS
+ uninstall-nodist_gpgmeppincludeHEADERS
.MAKE: install-am install-strip
@@ -918,22 +926,24 @@ uninstall-am: uninstall-gpgmeppincludeHEADERS uninstall-libLTLIBRARIES \
install-html install-html-am install-info install-info-am \
install-libLTLIBRARIES install-man \
install-nobase_gpgmeppincludeHEADERS \
- install-nodist_includeHEADERS install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
+ install-nodist_gpgmeppincludeHEADERS install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am \
uninstall-gpgmeppincludeHEADERS uninstall-libLTLIBRARIES \
uninstall-local uninstall-nobase_gpgmeppincludeHEADERS \
- uninstall-nodist_includeHEADERS
-
+ uninstall-nodist_gpgmeppincludeHEADERS
-GpgmeppConfig.cmake: GpgmeppConfig.cmake.in
- sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
- sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
- sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
+@HAVE_W32_SYSTEM_TRUE@GpgmeppConfig.cmake: GpgmeppConfig-w32.cmake.in
+@HAVE_W32_SYSTEM_TRUE@ sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \
+@HAVE_W32_SYSTEM_TRUE@ sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \
+@HAVE_W32_SYSTEM_TRUE@ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
+@HAVE_W32_SYSTEM_FALSE@GpgmeppConfig.cmake: GpgmeppConfig.cmake.in
+@HAVE_W32_SYSTEM_FALSE@ sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
+@HAVE_W32_SYSTEM_FALSE@ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
install-cmake-files: GpgmeppConfig.cmake GpgmeppConfigVersion.cmake
-$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp
$(INSTALL) -m 644 GpgmeppConfig.cmake \
diff --git a/lang/cpp/src/context.cpp b/lang/cpp/src/context.cpp
index 1121104..ada7bea 100644
--- a/lang/cpp/src/context.cpp
+++ b/lang/cpp/src/context.cpp
@@ -466,6 +466,16 @@ Error Context::setEngineHomeDirectory(const char *home_dir)
return Error(gpgme_ctx_set_engine_info(d->ctx, gpgme_get_protocol(d->ctx), filename, home_dir));
}
+Error Context::setSender (const char *sender)
+{
+ return Error(gpgme_set_sender(d->ctx, sender));
+}
+
+const char *Context::getSender ()
+{
+ return gpgme_get_sender(d->ctx);
+}
+
//
//
// Key Management
diff --git a/lang/cpp/src/context.h b/lang/cpp/src/context.h
index ab15a21..2c205b0 100644
--- a/lang/cpp/src/context.h
+++ b/lang/cpp/src/context.h
@@ -304,6 +304,10 @@ public:
GpgME::Error startSigning(const Data &plainText, Data &signature, SignatureMode mode);
SigningResult signingResult() const;
+ // wrapper for gpgme_set_sender
+ const char *getSender();
+ GpgME::Error setSender(const char *sender);
+
//
// Encryption
//
diff --git a/lang/cpp/src/engineinfo.h b/lang/cpp/src/engineinfo.h
index 72e125c..aa6fcca 100644
--- a/lang/cpp/src/engineinfo.h
+++ b/lang/cpp/src/engineinfo.h
@@ -40,6 +40,12 @@ public:
struct Version
{
int major, minor, patch;
+ Version()
+ {
+ major = 0;
+ minor = 0;
+ patch = 0;
+ }
Version(const std::string& version)
{
@@ -51,6 +57,16 @@ public:
}
}
+ Version(const char *version)
+ {
+ if (!version ||
+ std::sscanf(version, "%d.%d.%d", &major, &minor, &patch) != 3) {
+ major = 0;
+ minor = 0;
+ patch = 0;
+ }
+ }
+
bool operator < (const Version& other)
{
if (major < other.major)
diff --git a/lang/cpp/src/gpgmefw.h b/lang/cpp/src/gpgmefw.h
index cbdd444..e3c9b18 100644
--- a/lang/cpp/src/gpgmefw.h
+++ b/lang/cpp/src/gpgmefw.h
@@ -67,4 +67,10 @@ typedef struct gpgme_conf_comp *gpgme_conf_comp_t;
struct gpgme_conf_arg;
typedef struct gpgme_conf_arg *gpgme_conf_arg_t;
+struct _gpgme_tofu_info;
+typedef struct _gpgme_tofu_info *gpgme_tofu_info_t;
+
+struct _gpgme_op_query_swdb_result;
+typedef struct _gpgme_op_query_swdb_result *gpgme_query_swdb_result_t;
+
#endif // __GPGMEPP_GPGMEFW_H__
diff --git a/lang/cpp/src/gpgmepp_version.h.in b/lang/cpp/src/gpgmepp_version.h.in
index 3c33a30..9cf6aeb 100644
--- a/lang/cpp/src/gpgmepp_version.h.in
+++ b/lang/cpp/src/gpgmepp_version.h.in
@@ -23,10 +23,9 @@
#ifndef GPGMEPP_VERSION_H
#define GPGMEPP_VERSION_H
-#define GPGMEPP_VERSION_STRING "@LIBGPGMEPP_LT_CURRENT@.@LIBGPGMEPP_LT_AGE@.@LIBGPGMEPP_LT_REVISION@"
-#define GPGMEPP_VERSION_MAJOR @LIBGPGMEPP_LT_CURRENT@
-#define GPGMEPP_VERSION_MINOR @LIBGPGMEPP_LT_AGE@
-#define GPGMEPP_VERSION_PATCH @LIBGPGMEPP_LT_REVISION@
-#define GPGMEPP_VERSION ((@LIBGPGMEPP_LT_CURRENT@<<16)|(@LIBGPGMEPP_LT_AGE@<<8)|(@LIBGPGMEPP_LT_REVISION@))
-
+#define GPGMEPP_VERSION_STRING "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_MICRO@"
+#define GPGMEPP_VERSION_MAJOR @VERSION_MAJOR@
+#define GPGMEPP_VERSION_MINOR @VERSION_MINOR@
+#define GPGMEPP_VERSION_PATCH @VERSION_MICRO@
+#define GPGMEPP_VERSION ((@VERSION_MAJOR@<<16)|(@VERSION_MINOR@<<8)|(@VERSION_MICRO@))
#endif
diff --git a/lang/cpp/src/swdbresult.cpp b/lang/cpp/src/swdbresult.cpp
new file mode 100644
index 0000000..3afa8b5
--- /dev/null
+++ b/lang/cpp/src/swdbresult.cpp
@@ -0,0 +1,231 @@
+/* swdbresult.cpp - wraps gpgme swdb result / query
+ Copyright (C) 2016 Intevation GmbH
+
+ This file is part of GPGME++.
+
+ GPGME++ is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ GPGME++ 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 Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with GPGME++; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include "swdbresult.h"
+
+#include <istream>
+
+#include "error.h"
+
+#include "gpgme.h"
+
+class GpgME::SwdbResult::Private
+{
+public:
+ Private() {}
+ Private(gpgme_query_swdb_result_t result)
+ : mResult(result ? new _gpgme_op_query_swdb_result (*result) : nullptr)
+ {
+ if (!result) {
+ mResult->name = nullptr;
+ return;
+ }
+ if (result->name) {
+ mResult->name = strdup(result->name);
+ }
+ if (result->version) {
+ mVersion = result->version;
+ }
+ if (result->iversion) {
+ mIVersion = result->iversion;
+ }
+ }
+
+ Private(const Private &other)
+ : mResult(other.mResult)
+ {
+ if (mResult && mResult->name) {
+ mResult->name = strdup(mResult->name);
+ }
+ mVersion = other.mVersion;
+ mIVersion = other.mIVersion;
+ }
+
+ ~Private()
+ {
+ if (mResult) {
+ std::free(mResult->name);
+ delete mResult;
+ }
+ }
+
+ GpgME::EngineInfo::Version mVersion;
+ GpgME::EngineInfo::Version mIVersion;
+ gpgme_query_swdb_result_t mResult;
+};
+
+GpgME::SwdbResult::SwdbResult(gpgme_query_swdb_result_t result)
+ : d(new Private(result))
+{
+}
+
+GpgME::SwdbResult::SwdbResult() : d()
+{
+}
+
+bool GpgME::SwdbResult::isNull() const
+{
+ return !d || !d->mResult;
+}
+
+std::string GpgME::SwdbResult::name() const
+{
+ if (isNull() || !d->mResult->name) {
+ return std::string();
+ }
+ return d->mResult->name;
+}
+
+GpgME::EngineInfo::Version GpgME::SwdbResult::version() const
+{
+ if (isNull()) {
+ return GpgME::EngineInfo::Version();
+ }
+ return d->mVersion;
+}
+
+GpgME::EngineInfo::Version GpgME::SwdbResult::installedVersion() const
+{
+ if (isNull()) {
+ return GpgME::EngineInfo::Version();
+ }
+ return d->mIVersion;
+}
+
+unsigned long GpgME::SwdbResult::created() const
+{
+ return isNull() ? 0 : d->mResult->created;
+}
+
+unsigned long GpgME::SwdbResult::retrieved() const
+{
+ return isNull() ? 0 : d->mResult->retrieved;
+}
+
+unsigned long GpgME::SwdbResult::releaseDate() const
+{
+ return isNull() ? 0 : d->mResult->reldate;
+}
+
+bool GpgME::SwdbResult::warning() const
+{
+ return isNull() ? 0 : d->mResult->warning;
+}
+
+bool GpgME::SwdbResult::update() const
+{
+ return isNull() ? 0 : d->mResult->update;
+}
+
+bool GpgME::SwdbResult::noinfo() const
+{
+ return isNull() ? 0 : d->mResult->noinfo;
+}
+
+bool GpgME::SwdbResult::unknown() const
+{
+ return isNull() ? 0 : d->mResult->unknown;
+}
+
+bool GpgME::SwdbResult::error() const
+{
+ return isNull() ? 0 : d->mResult->error;
+}
+
+bool GpgME::SwdbResult::tooOld() const
+{
+ return isNull() ? 0 : d->mResult->tooold;
+}
+
+bool GpgME::SwdbResult::urgent() const
+{
+ return isNull() ? 0 : d->mResult->urgent;
+}
+
+std::vector<GpgME::SwdbResult> GpgME::SwdbResult::query(const char *name,
+ const char *iversion,
+ Error *err)
+{
+ std::vector <GpgME::SwdbResult> ret;
+ gpgme_ctx_t ctx;
+ gpgme_error_t gpgerr = gpgme_new(&ctx);
+
+ if (gpgerr) {
+ if (err) {
+ *err = Error (gpgerr);
+ }
+ return ret;
+ }
+
+ gpgerr = gpgme_set_protocol(ctx, GPGME_PROTOCOL_GPGCONF);
+
+ if (gpgerr) {
+ if (err) {
+ *err = Error(gpgerr);
+ }
+ gpgme_release(ctx);
+ return ret;
+ }
+
+ gpgerr = gpgme_op_query_swdb(ctx, name, iversion, 0);
+
+ if (gpgerr) {
+ if (err) {
+ *err = Error(gpgerr);
+ }
+ gpgme_release(ctx);
+ return ret;
+ }
+ gpgme_query_swdb_result_t result = gpgme_op_query_swdb_result(ctx);
+ while (result) {
+ ret.push_back(SwdbResult(result));
+ result = result->next;
+ }
+
+ gpgme_release(ctx);
+ return ret;
+}
+
+std::ostream &GpgME::operator<<(std::ostream &os, const GpgME::SwdbResult &result)
+{
+ os << "GpgME::SwdbResult(";
+ if (!result.isNull()) {
+ os << "\n name: " << result.name()
+ << "\n version: " << result.version()
+ << "\n installed: "<< result.installedVersion()
+ << "\n created: " << result.created()
+ << "\n retrieved: "<< result.retrieved()
+ << "\n warning: " << result.warning()
+ << "\n update: " << result.update()
+ << "\n urgent: " << result.urgent()
+ << "\n noinfo: " << result.noinfo()
+ << "\n unknown: " << result.unknown()
+ << "\n tooOld: " << result.tooOld()
+ << "\n error: " << result.error()
+ << "\n reldate: " << result.releaseDate()
+ << '\n';
+ }
+ return os << ")\n";
+}
diff --git a/lang/cpp/src/swdbresult.h b/lang/cpp/src/swdbresult.h
new file mode 100644
index 0000000..e15954d
--- /dev/null
+++ b/lang/cpp/src/swdbresult.h
@@ -0,0 +1,128 @@
+/*
+ swdbresult.h - wraps a gpgme swdb query / rsult
+ Copyright (C) 2016 Intevation GmbH
+
+ This file is part of GPGME++.
+
+ GPGME++ is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ GPGME++ 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 Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with GPGME++; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+#ifndef __GPGMEPP_SWDB_H__
+#define __GPGMEPP_SWDB_H__
+
+#include "gpgmepp_export.h"
+
+#include "global.h"
+#include "engineinfo.h"
+
+#include <vector>
+#include <string>
+#include <iostream>
+#include <ostream>
+
+namespace GpgME
+{
+
+class GPGMEPP_EXPORT SwdbResult
+{
+public:
+ /* Obtain swdb results through query() */
+ SwdbResult();
+ explicit SwdbResult(gpgme_query_swdb_result_t result);
+
+ /** Query the swdb to get information about updates.
+ *
+ * Runs gpgconf --query-swdb through gpgme and
+ * returns a list of results.
+ * If iversion is given as NULL a check is only done if GPGME
+ * can figure out the version by itself (for example when using
+ * "gpgme" or "gnupg").
+ *
+ * If NULL is used for name the current gpgme version is
+ * checked.
+ *
+ * @param name: Name of the component to query.
+ * @param iversion: Optionally the installed version.
+ * @param err: Optional error.
+ */
+ static std::vector<SwdbResult> query(const char *name,
+ const char *iversion = NULL,
+ Error *err = NULL);
+
+ const SwdbResult &operator=(SwdbResult other)
+ {
+ swap(other);
+ return *this;
+ }
+
+ void swap(SwdbResult &other)
+ {
+ using std::swap;
+ swap(this->d, other.d);
+ }
+ bool isNull() const;
+
+ /* The name of the package (e.g. "gpgme", "gnupg") */
+ std::string name() const;
+
+ /* The version of the installed version. */
+ EngineInfo::Version installedVersion() const;
+
+ /* The time the online info was created. */
+ unsigned long created() const;
+
+ /* The time the online info was retrieved. */
+ unsigned long retrieved() const;
+
+ /* This bit is set if an error occured or some of the information
+ * in this structure may not be set. */
+ bool warning() const;
+
+ /* An update is available. */
+ bool update() const;
+
+ /* The update is important. */
+ bool urgent() const;
+
+ /* No information at all available. */
+ bool noinfo() const;
+
+ /* The package name is not known. */
+ bool unknown() const;
+
+ /* The information here is too old. */
+ bool tooOld() const;
+
+ /* Other error. */
+ bool error() const;
+
+ /* The version of the latest released version. */
+ EngineInfo::Version version() const;
+
+ /* The release date of that version. */
+ unsigned long releaseDate() const;
+
+private:
+ class Private;
+ std::shared_ptr<Private> d;
+};
+
+GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const SwdbResult &info);
+
+} // namespace GpgME
+
+GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(SwdbResult)
+
+#endif
diff --git a/lang/cpp/src/tofuinfo.h b/lang/cpp/src/tofuinfo.h
index c09c82a..7165d05 100644
--- a/lang/cpp/src/tofuinfo.h
+++ b/lang/cpp/src/tofuinfo.h
@@ -25,8 +25,6 @@
#include "gpgmepp_export.h"
-#include "gpgme.h"
-
#include "global.h"
#include <memory>
diff --git a/lang/python/MANIFEST.in b/lang/python/MANIFEST.in
index eefdb83..8f63640 100644
--- a/lang/python/MANIFEST.in
+++ b/lang/python/MANIFEST.in
@@ -1,4 +1,4 @@
recursive-include examples *.py
include gpgme-h-clean.py gpgme.i
include helpers.c helpers.h private.h
-recursive-include pyme *.py
+recursive-include gpg *.py
diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am
index 224a91a..e32fd12 100644
--- a/lang/python/Makefile.am
+++ b/lang/python/Makefile.am
@@ -23,7 +23,7 @@ EXTRA_DIST = \
helpers.c helpers.h private.h \
gpgme-h-clean.py \
examples \
- pyme
+ gpg
SUBDIRS = . tests
@@ -35,21 +35,21 @@ COPY_FILES = \
$(srcdir)/examples \
$(srcdir)/helpers.c $(srcdir)/helpers.h $(srcdir)/private.h
-COPY_FILES_PYME = \
- $(srcdir)/pyme/callbacks.py \
- $(srcdir)/pyme/constants \
- $(srcdir)/pyme/core.py \
- $(srcdir)/pyme/errors.py \
- $(srcdir)/pyme/__init__.py \
- $(srcdir)/pyme/results.py \
- $(srcdir)/pyme/util.py
+COPY_FILES_GPG = \
+ $(srcdir)/gpg/callbacks.py \
+ $(srcdir)/gpg/constants \
+ $(srcdir)/gpg/core.py \
+ $(srcdir)/gpg/errors.py \
+ $(srcdir)/gpg/__init__.py \
+ $(srcdir)/gpg/results.py \
+ $(srcdir)/gpg/util.py
# For VPATH builds we need to copy some files because Python's
# distutils are not VPATH-aware.
-copystamp: $(COPY_FILES) $(COPY_FILES_PYME) data.h config.h
+copystamp: $(COPY_FILES) $(COPY_FILES_GPG) data.h config.h
if test "$(srcdir)" != "$(builddir)" ; then \
cp -R $(COPY_FILES) . ; \
- cp -R $(COPY_FILES_PYME) pyme ; \
+ cp -R $(COPY_FILES_GPG) gpg ; \
fi
touch $@
@@ -65,22 +65,22 @@ all-local: copystamp
$$PYTHON setup.py build --verbose ; \
done
-dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc: copystamp
+dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc: copystamp
CFLAGS="$(CFLAGS)" \
$(PYTHON) setup.py sdist --verbose
- gpg2 --detach-sign --armor dist/pyme3-$(VERSION).tar.gz
+ gpg2 --detach-sign --armor dist/gpg-$(VERSION).tar.gz
.PHONY: prepare
prepare: copystamp
.PHONY: sdist
-sdist: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc
+sdist: dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc
.PHONY: upload
-upload: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc
+upload: dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc
twine upload $^
-CLEANFILES = gpgme.h errors.i gpgme_wrap.c pyme/gpgme.py \
+CLEANFILES = gpgme.h errors.i gpgme_wrap.c gpg/gpgme.py \
data.h config.h copystamp
# Remove the rest.
@@ -92,8 +92,8 @@ clean-local:
if test "$(srcdir)" != "$(builddir)" ; then \
find . -type d ! -perm -200 -exec chmod u+w {} ';' ; \
for F in $(COPY_FILES); do rm -rf -- `basename $$F` ; done ; \
- for F in $(COPY_FILES_PYME); do \
- rm -rf -- pyme/`basename $$F` ; \
+ for F in $(COPY_FILES_GPG); do \
+ rm -rf -- gpg/`basename $$F` ; \
done ; \
fi
@@ -107,9 +107,9 @@ install-exec-local:
cat files.txt >> install_files.txt ; \
rm files.txt ; \
done
- $(MKDIR_P) $(DESTDIR)$(pythondir)/pyme
- mv install_files.txt $(DESTDIR)$(pythondir)/pyme
+ $(MKDIR_P) $(DESTDIR)$(pythondir)/gpg
+ mv install_files.txt $(DESTDIR)$(pythondir)/gpg
uninstall-local:
- xargs <$(DESTDIR)$(pythondir)/pyme/install_files.txt -- rm -rf --
- rm -rf -- $(DESTDIR)$(pythondir)/pyme
+ xargs <$(DESTDIR)$(pythondir)/gpg/install_files.txt -- rm -rf --
+ rm -rf -- $(DESTDIR)$(pythondir)/gpg
diff --git a/lang/python/Makefile.in b/lang/python/Makefile.in
index 08b26e0..4168708 100644
--- a/lang/python/Makefile.in
+++ b/lang/python/Makefile.in
@@ -329,6 +329,9 @@ SWIG = @SWIG@
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
@@ -397,7 +400,7 @@ EXTRA_DIST = \
helpers.c helpers.h private.h \
gpgme-h-clean.py \
examples \
- pyme
+ gpg
SUBDIRS = . tests
COPY_FILES = \
@@ -408,16 +411,16 @@ COPY_FILES = \
$(srcdir)/examples \
$(srcdir)/helpers.c $(srcdir)/helpers.h $(srcdir)/private.h
-COPY_FILES_PYME = \
- $(srcdir)/pyme/callbacks.py \
- $(srcdir)/pyme/constants \
- $(srcdir)/pyme/core.py \
- $(srcdir)/pyme/errors.py \
- $(srcdir)/pyme/__init__.py \
- $(srcdir)/pyme/results.py \
- $(srcdir)/pyme/util.py
+COPY_FILES_GPG = \
+ $(srcdir)/gpg/callbacks.py \
+ $(srcdir)/gpg/constants \
+ $(srcdir)/gpg/core.py \
+ $(srcdir)/gpg/errors.py \
+ $(srcdir)/gpg/__init__.py \
+ $(srcdir)/gpg/results.py \
+ $(srcdir)/gpg/util.py
-CLEANFILES = gpgme.h errors.i gpgme_wrap.c pyme/gpgme.py \
+CLEANFILES = gpgme.h errors.i gpgme_wrap.c gpg/gpgme.py \
data.h config.h copystamp
all: all-recursive
@@ -737,10 +740,10 @@ 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) data.h config.h
+copystamp: $(COPY_FILES) $(COPY_FILES_GPG) data.h config.h
if test "$(srcdir)" != "$(builddir)" ; then \
cp -R $(COPY_FILES) . ; \
- cp -R $(COPY_FILES_PYME) pyme ; \
+ cp -R $(COPY_FILES_GPG) gpg ; \
fi
touch $@
@@ -756,19 +759,19 @@ all-local: copystamp
$$PYTHON setup.py build --verbose ; \
done
-dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc: copystamp
+dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc: copystamp
CFLAGS="$(CFLAGS)" \
$(PYTHON) setup.py sdist --verbose
- gpg2 --detach-sign --armor dist/pyme3-$(VERSION).tar.gz
+ gpg2 --detach-sign --armor dist/gpg-$(VERSION).tar.gz
.PHONY: prepare
prepare: copystamp
.PHONY: sdist
-sdist: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc
+sdist: dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc
.PHONY: upload
-upload: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc
+upload: dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc
twine upload $^
# Remove the rest.
@@ -780,8 +783,8 @@ clean-local:
if test "$(srcdir)" != "$(builddir)" ; then \
find . -type d ! -perm -200 -exec chmod u+w {} ';' ; \
for F in $(COPY_FILES); do rm -rf -- `basename $$F` ; done ; \
- for F in $(COPY_FILES_PYME); do \
- rm -rf -- pyme/`basename $$F` ; \
+ for F in $(COPY_FILES_GPG); do \
+ rm -rf -- gpg/`basename $$F` ; \
done ; \
fi
@@ -795,12 +798,12 @@ install-exec-local:
cat files.txt >> install_files.txt ; \
rm files.txt ; \
done
- $(MKDIR_P) $(DESTDIR)$(pythondir)/pyme
- mv install_files.txt $(DESTDIR)$(pythondir)/pyme
+ $(MKDIR_P) $(DESTDIR)$(pythondir)/gpg
+ mv install_files.txt $(DESTDIR)$(pythondir)/gpg
uninstall-local:
- xargs <$(DESTDIR)$(pythondir)/pyme/install_files.txt -- rm -rf --
- rm -rf -- $(DESTDIR)$(pythondir)/pyme
+ xargs <$(DESTDIR)$(pythondir)/gpg/install_files.txt -- rm -rf --
+ rm -rf -- $(DESTDIR)$(pythondir)/gpg
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/lang/python/README b/lang/python/README
index 98c007e..6a2e8b8 100644
--- a/lang/python/README
+++ b/lang/python/README
@@ -1,10 +1,10 @@
-PyME - GPGME for Python -*- org -*-
+gpg - GPGME bindings for Python -*- org -*-
=======================
-PyME is a python interface to the GPGME library:
+The "gpg" module is a python interface to the GPGME library:
https://www.gnupg.org/related_software/gpgme/
-PyME offers two interfaces, one is a high-level, curated, and
+"gpg" offers two interfaces, one is a high-level, curated, and
idiomatic interface that is implemented as a shim on top of the
low-level interface automatically created using SWIG.
@@ -27,20 +27,22 @@ https://bugs.gnupg.org/gnupg/
* Authors
-PyME has been created by John Goerzen, and maintained, developed, and
+PyME was created by John Goerzen, and maintained, developed, and
cherished by Igor Belyi, Martin Albrecht, Ben McGinnes, and everyone
who contributed to it in any way.
In 2016 we merged a port of PyME to into the GPGME repository, and
development will continue there. Please see the VCS history for the
list of contributors, and if you do find bugs, or want to contribute,
-please get in touch and help maintain PyME.
+please get in touch and help maintain the python gpg bindings.
Please see the section 'History' further down this document for
references to previous versions.
* History
+ - The python bindings were renamed from PyME to "gpg" in 2016.
+
- The bindings have been merged into the GPGME repository in 2016.
- The latest version of PyME for Python 3.2 and above (as of
diff --git a/lang/python/examples/assuan.py b/lang/python/examples/assuan.py
index 22960d3..dd42ad4 100644
--- a/lang/python/examples/assuan.py
+++ b/lang/python/examples/assuan.py
@@ -20,9 +20,9 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-import pyme
+import gpg
-with pyme.Context(protocol=pyme.constants.PROTOCOL_ASSUAN) as c:
+with gpg.Context(protocol=gpg.constants.protocol.ASSUAN) as c:
# Invoke the pinentry to get a confirmation.
err = c.assuan_transact(['GET_CONFIRMATION', 'Hello there'])
print("You chose {}.".format("cancel" if err else "ok"))
diff --git a/lang/python/examples/decryption-filter.py b/lang/python/examples/decryption-filter.py
index 3007c2b..987dfd1 100644
--- a/lang/python/examples/decryption-filter.py
+++ b/lang/python/examples/decryption-filter.py
@@ -17,7 +17,7 @@
"""A decryption filter
-This demonstrates decryption using pyme3 in three lines of code. To
+This demonstrates decryption using gpg3 in three lines of code. To
be used like this:
./decryption-filter.py <message.gpg >message.plain
@@ -28,5 +28,5 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import sys
-import pyme
-pyme.Context().decrypt(sys.stdin, sink=sys.stdout)
+import gpg
+gpg.Context().decrypt(sys.stdin, sink=sys.stdout)
diff --git a/lang/python/examples/delkey.py b/lang/python/examples/delkey.py
index a02f412..12510f3 100755
--- a/lang/python/examples/delkey.py
+++ b/lang/python/examples/delkey.py
@@ -22,12 +22,12 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-import pyme
+import gpg
-with pyme.Context() as c:
+with gpg.Context() as c:
# Note: We must not modify the key store during iteration,
# therefore, we explicitly make a list.
- keys = list(c.keylist("joe+pyme@example.org"))
+ keys = list(c.keylist("joe+gpg@example.org"))
for k in keys:
c.op_delete(k, True)
diff --git a/lang/python/examples/encrypt-to-all.py b/lang/python/examples/encrypt-to-all.py
index 35873bd..bad4220 100755
--- a/lang/python/examples/encrypt-to-all.py
+++ b/lang/python/examples/encrypt-to-all.py
@@ -26,9 +26,9 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import sys
-import pyme
+import gpg
-with pyme.Context(armor=True) as c:
+with gpg.Context(armor=True) as c:
recipients = list()
for key in c.keylist():
valid = 0
@@ -42,7 +42,7 @@ with pyme.Context(armor=True) as c:
try:
ciphertext, _, _ = c.encrypt(b'This is my message.',
recipients=recipients)
- except pyme.errors.InvalidRecipients as e:
+ except gpg.errors.InvalidRecipients as e:
print("Encryption failed for these keys:\n{0!s}".format(e))
# filter out the bad keys
diff --git a/lang/python/examples/exportimport.py b/lang/python/examples/exportimport.py
index bc946bc..8ae87a8 100755
--- a/lang/python/examples/exportimport.py
+++ b/lang/python/examples/exportimport.py
@@ -17,18 +17,18 @@
# along with this program; if not, see <http://www.gnu.org/licenses/>.
# Sample of export and import of keys
-# It uses keys for joe+pyme@example.org generated by genkey.py script
+# It uses keys for joe+gpg@example.org generated by genkey.py script
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import sys
import os
-import pyme
+import gpg
-user = "joe+pyme@example.org"
+user = "joe+gpg@example.org"
-with pyme.Context(armor=True) as c, pyme.Data() as expkey:
+with gpg.Context(armor=True) as c, gpg.Data() as expkey:
print(" - Export %s's public keys - " % user)
c.op_export(user, 0, expkey)
@@ -43,7 +43,7 @@ with pyme.Context(armor=True) as c, pyme.Data() as expkey:
# delete keys to ensure that they came from our imported data. Note
# that if joe's key has private part as well we can only delete both
# of them.
-with pyme.Context() as c:
+with gpg.Context() as c:
# Note: We must not modify the key store during iteration,
# therfore, we explicitly make a list.
keys = list(c.keylist(user))
@@ -51,7 +51,7 @@ with pyme.Context() as c:
for k in keys:
c.op_delete(k, True)
-with pyme.Context() as c:
+with gpg.Context() as c:
print(" - Import exported keys - ")
c.op_import(expstring)
result = c.op_import_result()
diff --git a/lang/python/examples/genkey.py b/lang/python/examples/genkey.py
index ee70303..a043500 100755
--- a/lang/python/examples/genkey.py
+++ b/lang/python/examples/genkey.py
@@ -20,7 +20,7 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-import pyme
+import gpg
# This is the example from the GPGME manual.
@@ -31,14 +31,14 @@ Subkey-Type: RSA
Subkey-Length: 2048
Name-Real: Joe Tester
Name-Comment: with stupid passphrase
-Name-Email: joe+pyme@example.org
+Name-Email: joe+gpg@example.org
Passphrase: Crypt0R0cks
Expire-Date: 2020-12-31
</GnupgKeyParms>
"""
-with pyme.Context() as c:
- c.set_progress_cb(pyme.callbacks.progress_stdout)
+with gpg.Context() as c:
+ c.set_progress_cb(gpg.callbacks.progress_stdout)
c.op_genkey(parms, None, None)
print("Generated key with fingerprint {0}.".format(
c.op_genkey_result().fpr))
diff --git a/lang/python/examples/inter-edit.py b/lang/python/examples/inter-edit.py
index 3c0f29b..ed0d8c4 100644
--- a/lang/python/examples/inter-edit.py
+++ b/lang/python/examples/inter-edit.py
@@ -22,14 +22,14 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import sys
-import pyme
+import gpg
if len(sys.argv) != 2:
sys.exit("Usage: %s <Gpg key pattern>\n" % sys.argv[0])
name = sys.argv[1]
-with pyme.Context() as c:
+with gpg.Context() as c:
keys = list(c.keylist(name))
if len(keys) == 0:
sys.exit("No key matching {}.".format(name))
diff --git a/lang/python/examples/sign.py b/lang/python/examples/sign.py
index 2f235ba..16c2256 100755
--- a/lang/python/examples/sign.py
+++ b/lang/python/examples/sign.py
@@ -20,9 +20,9 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import sys
-import pyme
-from pyme.constants.sig import mode
+import gpg
+from gpg.constants.sig import mode
-with pyme.Context() as c:
+with gpg.Context() as c:
signed, _ = c.sign(b"Test message", mode=mode.CLEAR)
sys.stdout.buffer.write(signed)
diff --git a/lang/python/examples/signverify.py b/lang/python/examples/signverify.py
index 03bc0a6..5870ca9 100755
--- a/lang/python/examples/signverify.py
+++ b/lang/python/examples/signverify.py
@@ -17,18 +17,18 @@
# along with this program; if not, see <http://www.gnu.org/licenses/>.
# Sample of unattended signing/verifying of a message.
-# It uses keys for joe+pyme@example.org generated by genkey.py script
+# It uses keys for joe+gpg@example.org generated by genkey.py script
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import sys
-import pyme
-from pyme.constants.sig import mode
+import gpg
+from gpg.constants.sig import mode
-user = "joe+pyme"
+user = "joe+gpg"
-with pyme.Context(pinentry_mode=pyme.constants.PINENTRY_MODE_LOOPBACK) as c:
+with gpg.Context(pinentry_mode=gpg.constants.PINENTRY_MODE_LOOPBACK) as c:
keys = list(c.keylist(user))
if len(keys) == 0:
sys.exit("No key matching {}.".format(user))
diff --git a/lang/python/examples/simple.py b/lang/python/examples/simple.py
index 5598487..8f451d7 100755
--- a/lang/python/examples/simple.py
+++ b/lang/python/examples/simple.py
@@ -21,9 +21,9 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import sys
-import pyme
+import gpg
-with pyme.Context(armor=True) as c:
+with gpg.Context(armor=True) as c:
recipients = []
print("Enter name of your recipient(s), end with a blank line.")
while True:
diff --git a/lang/python/examples/testCMSgetkey.py b/lang/python/examples/testCMSgetkey.py
index 62c35d2..d4c0884 100644
--- a/lang/python/examples/testCMSgetkey.py
+++ b/lang/python/examples/testCMSgetkey.py
@@ -22,12 +22,12 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import sys
-import pyme
+import gpg
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:
+with gpg.Context(protocol=gpg.constants.protocol.CMS) as c:
key = c.get_key(sys.argv[1])
print("got key: ", key.subkeys[0].fpr)
diff --git a/lang/python/examples/verifydetails.py b/lang/python/examples/verifydetails.py
index 81f82e9..b3ca133 100755
--- a/lang/python/examples/verifydetails.py
+++ b/lang/python/examples/verifydetails.py
@@ -21,24 +21,23 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import sys
-from pyme import core
-from pyme.constants import protocol
+import gpg
def print_engine_infos():
- print("gpgme version:", core.check_version(None))
+ print("gpgme version:", gpg.core.check_version(None))
print("engines:")
- for engine in core.get_engine_info():
+ for engine in gpg.core.get_engine_info():
print(engine.file_name, engine.version)
- for proto in [protocol.OpenPGP, protocol.CMS]:
- print("Have {}? {}".format(core.get_protocol_name(proto),
- core.engine_check_version(proto)))
+ for proto in [gpg.constants.protocol.OpenPGP, gpg.constants.protocol.CMS]:
+ print("Have {}? {}".format(gpg.core.get_protocol_name(proto),
+ gpg.core.engine_check_version(proto)))
def verifyprintdetails(filename, detached_sig_filename=None):
"""Verify a signature, print a lot of details."""
- with core.Context() as c:
+ with gpg.Context() as c:
# Verify.
data, result = c.verify(open(filename),
diff --git a/lang/python/pyme/__init__.py b/lang/python/gpg/__init__.py
index 12c96c2..385b17e 100644
--- a/lang/python/pyme/__init__.py
+++ b/lang/python/gpg/__init__.py
@@ -16,17 +16,13 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-"""Pyme: GPGME Interface for Python
+"""gpg: GnuPG Interface for Python (GPGME bindings)
-Welcome to PyME, the GPGME Interface for Python. "Pyme", when prounced,
-rhymes with "Pine".
+Welcome to gpg, the GnuPG Interface for Python.
The latest release of this package may be obtained from
https://www.gnupg.org
-Previous releases of this package for Python 2 can be obtained from
-http://pyme.sourceforge.net
-
FEATURES
--------
@@ -43,23 +39,23 @@ FEATURES
QUICK EXAMPLE
-------------
- >>> import pyme
- >>> with pyme.Context() as c:
- >>> with pyme.Context() as c:
+ >>> import gpg
+ >>> with gpg.Context() as c:
+ >>> with gpg.Context() as c:
... cipher, _, _ = c.encrypt("Hello world :)".encode(),
... passphrase="abc")
... c.decrypt(cipher, passphrase="abc")
...
(b'Hello world :)',
- <pyme.results.DecryptResult object at 0x7f5ab8121080>,
- <pyme.results.VerifyResult object at 0x7f5ab81219b0>)
+ <gpg.results.DecryptResult object at 0x7f5ab8121080>,
+ <gpg.results.VerifyResult object at 0x7f5ab81219b0>)
GENERAL OVERVIEW
----------------
For those of you familiar with GPGME, you will be right at home here.
-Pyme is, for the most part, a direct interface to the C GPGME
+The python gpg module is, for the most part, a direct interface to the C GPGME
library. However, it is re-packaged in a more Pythonic way --
object-oriented with classes and modules. Take a look at the classes
defined here -- they correspond directly to certain object types in GPGME
@@ -77,7 +73,7 @@ context = core.Context()
context.op_encrypt(recp, 1, plain, cipher)
The Python module automatically does error-checking and raises Python
-exception pyme.errors.GPGMEError when GPGME signals an error. getcode()
+exception gpg.errors.GPGMEError when GPGME signals an error. getcode()
and getsource() of this exception return code and source of the error.
IMPORTANT NOTE
@@ -94,7 +90,7 @@ be found only in GPGME documentation.
FOR MORE INFORMATION
--------------------
-PYME3 homepage: https://www.gnupg.org/
+GnuPG homepage: https://www.gnupg.org/
GPGME documentation: https://www.gnupg.org/documentation/manuals/gpgme/
"""
diff --git a/lang/python/pyme/callbacks.py b/lang/python/gpg/callbacks.py
index b25a9a7..b25a9a7 100644
--- a/lang/python/pyme/callbacks.py
+++ b/lang/python/gpg/callbacks.py
diff --git a/lang/python/pyme/constants/__init__.py b/lang/python/gpg/constants/__init__.py
index 96d89e4..4fb3d6f 100644
--- a/lang/python/pyme/constants/__init__.py
+++ b/lang/python/gpg/constants/__init__.py
@@ -1,15 +1,43 @@
+# Constants.
+#
+# Copyright (C) 2016 g10 Code GmbH
+#
+# This file is part of GPGME.
+#
+# GPGME is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# GPGME 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 Lesser General
+# Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, see <http://www.gnu.org/licenses/>.
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_', globals())
+del util
+
+# For convenience, we import the modules here.
+from . import data, event, keylist, md, pk
+from . import protocol, sig, sigsum, status, validity
+
+# A complication arises because 'import' is a reserved keyword.
+# Import it as 'Import' instead.
+globals()['Import'] = getattr(__import__('', globals(), locals(),
+ [str('import')], 1), "import")
__all__ = ['data', 'event', 'import', 'keylist', 'md', 'pk',
'protocol', 'sig', 'sigsum', 'status', 'validity']
# GPGME 1.7 replaced gpgme_op_edit with gpgme_op_interact. We
-# implement pyme.Context.op_edit using gpgme_op_interact, so the
+# implement gpg.Context.op_edit using gpgme_op_interact, so the
# callbacks will be called with string keywords instead of numeric
# status messages. Code that is using these constants will continue
# to work.
diff --git a/lang/python/pyme/constants/data/__init__.py b/lang/python/gpg/constants/data/__init__.py
index 8274ab9..8274ab9 100644
--- a/lang/python/pyme/constants/data/__init__.py
+++ b/lang/python/gpg/constants/data/__init__.py
diff --git a/lang/python/pyme/constants/data/encoding.py b/lang/python/gpg/constants/data/encoding.py
index a05dbb4..e76a22e 100644
--- a/lang/python/pyme/constants/data/encoding.py
+++ b/lang/python/gpg/constants/data/encoding.py
@@ -18,5 +18,6 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_DATA_ENCODING_', globals())
+del util
diff --git a/lang/python/pyme/constants/event.py b/lang/python/gpg/constants/event.py
index 2e30c5e..1b14d1d 100644
--- a/lang/python/pyme/constants/event.py
+++ b/lang/python/gpg/constants/event.py
@@ -18,5 +18,6 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_EVENT_', globals())
+del util
diff --git a/lang/python/pyme/constants/import.py b/lang/python/gpg/constants/import.py
index 10e7d3c..47c296c 100644
--- a/lang/python/pyme/constants/import.py
+++ b/lang/python/gpg/constants/import.py
@@ -18,5 +18,6 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_IMPORT_', globals())
+del util
diff --git a/lang/python/pyme/constants/keylist/__init__.py b/lang/python/gpg/constants/keylist/__init__.py
index 2ce0edf..2ce0edf 100644
--- a/lang/python/pyme/constants/keylist/__init__.py
+++ b/lang/python/gpg/constants/keylist/__init__.py
diff --git a/lang/python/pyme/constants/keylist/mode.py b/lang/python/gpg/constants/keylist/mode.py
index 000dd79..39e1819 100644
--- a/lang/python/pyme/constants/keylist/mode.py
+++ b/lang/python/gpg/constants/keylist/mode.py
@@ -18,5 +18,6 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_KEYLIST_MODE_', globals())
+del util
diff --git a/lang/python/pyme/constants/md.py b/lang/python/gpg/constants/md.py
index dbd762c..f3e8bbd 100644
--- a/lang/python/pyme/constants/md.py
+++ b/lang/python/gpg/constants/md.py
@@ -18,5 +18,6 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_MD_', globals())
+del util
diff --git a/lang/python/pyme/constants/pk.py b/lang/python/gpg/constants/pk.py
index cfc5309..6bf2a21 100644
--- a/lang/python/pyme/constants/pk.py
+++ b/lang/python/gpg/constants/pk.py
@@ -18,5 +18,6 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_PK_', globals())
+del util
diff --git a/lang/python/pyme/constants/protocol.py b/lang/python/gpg/constants/protocol.py
index a4b6583..d086bbd 100644
--- a/lang/python/pyme/constants/protocol.py
+++ b/lang/python/gpg/constants/protocol.py
@@ -18,5 +18,6 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_PROTOCOL_', globals())
+del util
diff --git a/lang/python/pyme/constants/sig/__init__.py b/lang/python/gpg/constants/sig/__init__.py
index 2ce0edf..39d4e6e 100644
--- a/lang/python/pyme/constants/sig/__init__.py
+++ b/lang/python/gpg/constants/sig/__init__.py
@@ -2,5 +2,5 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from . import mode
-__all__ = ['mode']
+from . import mode, notation
+__all__ = ['mode', 'notation']
diff --git a/lang/python/pyme/constants/sig/mode.py b/lang/python/gpg/constants/sig/mode.py
index fb534bc..0f4f0ef 100644
--- a/lang/python/pyme/constants/sig/mode.py
+++ b/lang/python/gpg/constants/sig/mode.py
@@ -18,5 +18,6 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_SIG_MODE_', globals())
+del util
diff --git a/lang/python/gpg/constants/sig/notation.py b/lang/python/gpg/constants/sig/notation.py
new file mode 100644
index 0000000..9a79e01
--- /dev/null
+++ b/lang/python/gpg/constants/sig/notation.py
@@ -0,0 +1,25 @@
+# Constants for signature notation data.
+#
+# Copyright (C) 2016 g10 Code GmbH
+#
+# This file is part of GPGME.
+#
+# GPGME is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of the
+# License, or (at your option) any later version.
+#
+# GPGME 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 Lesser General
+# Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+from __future__ import absolute_import, print_function, unicode_literals
+del absolute_import, print_function, unicode_literals
+
+from gpg import util
+util.process_constants('GPGME_SIG_NOTATION_', globals())
+del util
diff --git a/lang/python/pyme/constants/sigsum.py b/lang/python/gpg/constants/sigsum.py
index 3d94745..09ef9d7 100644
--- a/lang/python/pyme/constants/sigsum.py
+++ b/lang/python/gpg/constants/sigsum.py
@@ -18,5 +18,6 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_SIGSUM_', globals())
+del util
diff --git a/lang/python/pyme/constants/status.py b/lang/python/gpg/constants/status.py
index a04d9aa..a0ad073 100644
--- a/lang/python/pyme/constants/status.py
+++ b/lang/python/gpg/constants/status.py
@@ -19,7 +19,7 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
# GPGME 1.7 replaced gpgme_op_edit with gpgme_op_interact. We
-# implement pyme.Context.op_edit using gpgme_op_interact, so the
+# implement gpg.Context.op_edit using gpgme_op_interact, so the
# callbacks will be called with string keywords instead of numeric
# status messages. Code that is using these constants will continue
# to work.
diff --git a/lang/python/pyme/constants/validity.py b/lang/python/gpg/constants/validity.py
index 4ecd4d3..d3c5345 100644
--- a/lang/python/pyme/constants/validity.py
+++ b/lang/python/gpg/constants/validity.py
@@ -18,5 +18,6 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import util
+from gpg import util
util.process_constants('GPGME_VALIDITY_', globals())
+del util
diff --git a/lang/python/pyme/core.py b/lang/python/gpg/core.py
index f0eab43..748bcbb 100644
--- a/lang/python/pyme/core.py
+++ b/lang/python/gpg/core.py
@@ -131,13 +131,13 @@ class GpgmeWrapper(object):
def _funcwrap(slf, *args):
result = func(slf.wrapped, *args)
if slf._callback_excinfo:
- gpgme.pyme_raise_callback_exception(slf)
+ gpgme.gpg_raise_callback_exception(slf)
return errorcheck(result, "Invocation of " + name)
else:
def _funcwrap(slf, *args):
result = func(slf.wrapped, *args)
if slf._callback_excinfo:
- gpgme.pyme_raise_callback_exception(slf)
+ gpgme.gpg_raise_callback_exception(slf)
return result
doc = self._munge_docstring.sub(r'\2.\1(\3', getattr(func, "__doc__"))
@@ -528,7 +528,7 @@ class Context(GpgmeWrapper):
errptr)
if self._callback_excinfo:
- gpgme.pyme_raise_callback_exception(self)
+ gpgme.gpg_raise_callback_exception(self)
errorcheck(err)
@@ -567,7 +567,7 @@ class Context(GpgmeWrapper):
result = gpgme.gpgme_op_interact(self.wrapped, key, flags,
opaquedata, sink)
if self._callback_excinfo:
- gpgme.pyme_raise_callback_exception(self)
+ gpgme.gpg_raise_callback_exception(self)
errorcheck(result)
@property
@@ -743,10 +743,10 @@ class Context(GpgmeWrapper):
hookdata = (weakref.ref(self), func)
else:
hookdata = (weakref.ref(self), func, hook)
- gpgme.pyme_set_passphrase_cb(self, hookdata)
+ gpgme.gpg_set_passphrase_cb(self, hookdata)
def _free_passcb(self):
- if gpgme.pyme_set_passphrase_cb:
+ if gpgme.gpg_set_passphrase_cb:
self.set_passphrase_cb(None)
def set_progress_cb(self, func, hook=None):
@@ -768,10 +768,10 @@ class Context(GpgmeWrapper):
hookdata = (weakref.ref(self), func)
else:
hookdata = (weakref.ref(self), func, hook)
- gpgme.pyme_set_progress_cb(self, hookdata)
+ gpgme.gpg_set_progress_cb(self, hookdata)
def _free_progresscb(self):
- if gpgme.pyme_set_progress_cb:
+ if gpgme.gpg_set_progress_cb:
self.set_progress_cb(None)
def set_status_cb(self, func, hook=None):
@@ -792,10 +792,10 @@ class Context(GpgmeWrapper):
hookdata = (weakref.ref(self), func)
else:
hookdata = (weakref.ref(self), func, hook)
- gpgme.pyme_set_status_cb(self, hookdata)
+ gpgme.gpg_set_status_cb(self, hookdata)
def _free_statuscb(self):
- if gpgme.pyme_set_status_cb:
+ if gpgme.gpg_set_status_cb:
self.set_status_cb(None)
@property
@@ -958,7 +958,7 @@ class Data(GpgmeWrapper):
if self.wrapped != None and gpgme.gpgme_data_release:
gpgme.gpgme_data_release(self.wrapped)
if self._callback_excinfo:
- gpgme.pyme_raise_callback_exception(self)
+ gpgme.gpg_raise_callback_exception(self)
self.wrapped = None
self._free_datacbs()
@@ -1003,7 +1003,7 @@ class Data(GpgmeWrapper):
else:
hookdata = (weakref.ref(self),
read_cb, write_cb, seek_cb, release_cb)
- gpgme.pyme_data_new_from_cbs(self, hookdata, tmp)
+ gpgme.gpg_data_new_from_cbs(self, hookdata, tmp)
self.wrapped = gpgme.gpgme_data_t_p_value(tmp)
gpgme.delete_gpgme_data_t_p(tmp)
@@ -1057,7 +1057,7 @@ class Data(GpgmeWrapper):
written = gpgme.gpgme_data_write(self.wrapped, buffer)
if written < 0:
if self._callback_excinfo:
- gpgme.pyme_raise_callback_exception(self)
+ gpgme.gpg_raise_callback_exception(self)
else:
raise GPGMEError.fromSyserror()
return written
@@ -1078,7 +1078,7 @@ class Data(GpgmeWrapper):
result = gpgme.gpgme_data_read(self.wrapped, size)
except:
if self._callback_excinfo:
- gpgme.pyme_raise_callback_exception(self)
+ gpgme.gpg_raise_callback_exception(self)
else:
raise
return result
@@ -1089,7 +1089,7 @@ class Data(GpgmeWrapper):
result = gpgme.gpgme_data_read(self.wrapped, 4096)
except:
if self._callback_excinfo:
- gpgme.pyme_raise_callback_exception(self)
+ gpgme.gpg_raise_callback_exception(self)
else:
raise
if len(result) == 0:
diff --git a/lang/python/pyme/errors.py b/lang/python/gpg/errors.py
index 0fd85ef..1ce139e 100644
--- a/lang/python/pyme/errors.py
+++ b/lang/python/gpg/errors.py
@@ -27,11 +27,12 @@ NO_ERROR = None
EOF = None
util.process_constants('GPG_ERR_', globals())
+del util
-class PymeError(Exception):
+class GpgError(Exception):
pass
-class GPGMEError(PymeError):
+class GPGMEError(GpgError):
def __init__(self, error = None, message = None):
self.error = error
self.message = message
@@ -76,7 +77,7 @@ class KeyNotFound(GPGMEError, KeyError):
# These errors are raised in the idiomatic interface code.
-class EncryptionError(PymeError):
+class EncryptionError(GpgError):
pass
class InvalidRecipients(EncryptionError):
@@ -87,7 +88,7 @@ class InvalidRecipients(EncryptionError):
gpgme.gpgme_strerror(r.reason))
for r in self.recipients)
-class DeryptionError(PymeError):
+class DeryptionError(GpgError):
pass
class UnsupportedAlgorithm(DeryptionError):
@@ -96,7 +97,7 @@ class UnsupportedAlgorithm(DeryptionError):
def __str__(self):
return self.algorithm
-class SigningError(PymeError):
+class SigningError(GpgError):
pass
class InvalidSigners(SigningError):
@@ -107,7 +108,7 @@ class InvalidSigners(SigningError):
gpgme.gpgme_strerror(s.reason))
for s in self.signers)
-class VerificationError(PymeError):
+class VerificationError(GpgError):
pass
class BadSignatures(VerificationError):
diff --git a/lang/python/pyme/gpgme.py b/lang/python/gpg/gpgme.py
index ea4983d..238359d 100644
--- a/lang/python/pyme/gpgme.py
+++ b/lang/python/gpg/gpgme.py
@@ -120,6 +120,7 @@ except AttributeError:
+
# This file is compatible with both classic and new-style classes.
diff --git a/lang/python/pyme/results.py b/lang/python/gpg/results.py
index 3383896..3383896 100644
--- a/lang/python/pyme/results.py
+++ b/lang/python/gpg/results.py
diff --git a/lang/python/pyme/util.py b/lang/python/gpg/util.py
index e4fca4c..e4fca4c 100644
--- a/lang/python/pyme/util.py
+++ b/lang/python/gpg/util.py
diff --git a/lang/python/pyme/version.py b/lang/python/gpg/version.py
index 13c5129..9ec657d 100644
--- a/lang/python/pyme/version.py
+++ b/lang/python/gpg/version.py
@@ -21,10 +21,10 @@ del absolute_import, print_function
from . import gpgme
-productname = 'pyme'
-versionstr = "1.7.1"
+productname = 'gpg'
+versionstr = "1.8.0"
gpgme_versionstr = gpgme.GPGME_VERSION
-in_tree_build = bool(gpgme.cvar.pyme_in_tree_build)
+in_tree_build = bool(gpgme.cvar.gpg_in_tree_build)
versionlist = versionstr.split(".")
major = versionlist[0]
diff --git a/lang/python/pyme/version.py.in b/lang/python/gpg/version.py.in
index cfb9510..1a1baf0 100644
--- a/lang/python/pyme/version.py.in
+++ b/lang/python/gpg/version.py.in
@@ -21,10 +21,10 @@ del absolute_import, print_function
from . import gpgme
-productname = 'pyme'
+productname = 'gpg'
versionstr = "@VERSION@"
gpgme_versionstr = gpgme.GPGME_VERSION
-in_tree_build = bool(gpgme.cvar.pyme_in_tree_build)
+in_tree_build = bool(gpgme.cvar.gpg_in_tree_build)
versionlist = versionstr.split(".")
major = versionlist[0]
diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i
index 5d074aa..783531f 100644
--- a/lang/python/gpgme.i
+++ b/lang/python/gpgme.i
@@ -159,7 +159,7 @@
$1 = NULL;
else {
PyObject *pypointer;
- pypointer = _pyme_obj2gpgme_data_t($input, $argnum, &wrapper,
+ pypointer = _gpg_obj2gpgme_data_t($input, $argnum, &wrapper,
&bytesio, &view);
if (pypointer == NULL)
return NULL;
@@ -428,7 +428,7 @@
PyObject *fragile;
fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor,
%newpointer_flags);
- $result = _pyme_wrap_result(fragile, "EncryptResult");
+ $result = _gpg_wrap_result(fragile, "EncryptResult");
Py_DECREF(fragile);
}
@@ -436,7 +436,7 @@
PyObject *fragile;
fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor,
%newpointer_flags);
- $result = _pyme_wrap_result(fragile, "DecryptResult");
+ $result = _gpg_wrap_result(fragile, "DecryptResult");
Py_DECREF(fragile);
}
@@ -444,7 +444,7 @@
PyObject *fragile;
fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor,
%newpointer_flags);
- $result = _pyme_wrap_result(fragile, "SignResult");
+ $result = _gpg_wrap_result(fragile, "SignResult");
Py_DECREF(fragile);
}
@@ -452,7 +452,7 @@
PyObject *fragile;
fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor,
%newpointer_flags);
- $result = _pyme_wrap_result(fragile, "VerifyResult");
+ $result = _gpg_wrap_result(fragile, "VerifyResult");
Py_DECREF(fragile);
}
@@ -460,7 +460,7 @@
PyObject *fragile;
fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor,
%newpointer_flags);
- $result = _pyme_wrap_result(fragile, "ImportResult");
+ $result = _gpg_wrap_result(fragile, "ImportResult");
Py_DECREF(fragile);
}
@@ -468,7 +468,7 @@
PyObject *fragile;
fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor,
%newpointer_flags);
- $result = _pyme_wrap_result(fragile, "GenkeyResult");
+ $result = _gpg_wrap_result(fragile, "GenkeyResult");
Py_DECREF(fragile);
}
@@ -476,7 +476,7 @@
PyObject *fragile;
fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor,
%newpointer_flags);
- $result = _pyme_wrap_result(fragile, "KeylistResult");
+ $result = _gpg_wrap_result(fragile, "KeylistResult");
Py_DECREF(fragile);
}
@@ -484,7 +484,7 @@
PyObject *fragile;
fragile = SWIG_NewPointerObj(SWIG_as_voidptr($1), $1_descriptor,
%newpointer_flags);
- $result = _pyme_wrap_result(fragile, "VFSMountResult");
+ $result = _gpg_wrap_result(fragile, "VFSMountResult");
Py_DECREF(fragile);
}
@@ -507,7 +507,7 @@
Py_DECREF($result);
return NULL; /* raise */
}
- o = _pyme_wrap_result(fragile, "EngineInfo");
+ o = _gpg_wrap_result(fragile, "EngineInfo");
Py_DECREF(fragile);
if (o == NULL)
{
@@ -528,7 +528,7 @@
return PyErr_Format(PyExc_TypeError,
"interact callback must be a tuple of size 2 or 3");
- $1 = (gpgme_interact_cb_t) _pyme_interact_cb;
+ $1 = (gpgme_interact_cb_t) _gpg_interact_cb;
$2 = $input;
}
@@ -547,7 +547,7 @@
"callback must be a tuple of size 2");
if (! PyCallable_Check(PyTuple_GetItem($input, 1)))
return PyErr_Format(PyExc_TypeError, "second item must be callable");
- $1 = _pyme_assuan_data_cb;
+ $1 = _gpg_assuan_data_cb;
$2 = $input;
}
}
@@ -564,7 +564,7 @@
"callback must be a tuple of size 2");
if (! PyCallable_Check(PyTuple_GetItem($input, 1)))
return PyErr_Format(PyExc_TypeError, "second item must be callable");
- $1 = _pyme_assuan_inquire_cb;
+ $1 = _gpg_assuan_inquire_cb;
$2 = $input;
}
}
@@ -581,7 +581,7 @@
"callback must be a tuple of size 2");
if (! PyCallable_Check(PyTuple_GetItem($input, 1)))
return PyErr_Format(PyExc_TypeError, "second item must be callable");
- $1 = _pyme_assuan_status_cb;
+ $1 = _gpg_assuan_status_cb;
$2 = $input;
}
}
@@ -654,13 +654,13 @@ FILE *fdopen(int fildes, const char *mode);
/* SWIG runtime support for helpers.c */
PyObject *
-_pyme_wrap_gpgme_data_t(gpgme_data_t data)
+_gpg_wrap_gpgme_data_t(gpgme_data_t data)
{
return SWIG_Python_NewPointerObj(NULL, data, SWIGTYPE_p_gpgme_data, 0);
}
gpgme_ctx_t
-_pyme_unwrap_gpgme_ctx_t(PyObject *wrapped)
+_gpg_unwrap_gpgme_ctx_t(PyObject *wrapped)
{
gpgme_ctx_t result;
if (SWIG_ConvertPtr(wrapped,
diff --git a/lang/python/helpers.c b/lang/python/helpers.c
index 3724752..8f71a30 100644
--- a/lang/python/helpers.c
+++ b/lang/python/helpers.c
@@ -33,7 +33,7 @@
#include "private.h"
/* Flag specifying whether this is an in-tree build. */
-int pyme_in_tree_build =
+int gpg_in_tree_build =
#if IN_TREE_BUILD
1
#else
@@ -43,7 +43,7 @@ int pyme_in_tree_build =
static PyObject *GPGMEError = NULL;
-void _pyme_exception_init(void) {
+void _gpg_exception_init(void) {
if (GPGMEError == NULL) {
PyObject *errors;
PyObject *from_list = PyList_New(0);
@@ -58,11 +58,11 @@ void _pyme_exception_init(void) {
}
static PyObject *
-_pyme_raise_exception(gpgme_error_t err)
+_gpg_raise_exception(gpgme_error_t err)
{
PyObject *e;
- _pyme_exception_init();
+ _gpg_exception_init();
if (GPGMEError == NULL)
return PyErr_Format(PyExc_RuntimeError, "Got gpgme_error_t %d", err);
@@ -76,7 +76,7 @@ _pyme_raise_exception(gpgme_error_t err)
return NULL; /* raise */
}
-gpgme_error_t _pyme_exception2code(void) {
+gpgme_error_t _gpg_exception2code(void) {
gpgme_error_t err_status = gpg_error(GPG_ERR_GENERAL);
if (GPGMEError && PyErr_ExceptionMatches(GPGMEError)) {
PyObject *type = 0, *value = 0, *traceback = 0;
@@ -94,7 +94,7 @@ gpgme_error_t _pyme_exception2code(void) {
/* Exception support for callbacks. */
#define EXCINFO "_callback_excinfo"
-static void _pyme_stash_callback_exception(PyObject *weak_self)
+static void _gpg_stash_callback_exception(PyObject *weak_self)
{
PyObject *self, *ptype, *pvalue, *ptraceback, *excinfo;
@@ -136,7 +136,7 @@ static void _pyme_stash_callback_exception(PyObject *weak_self)
Py_DECREF(excinfo);
}
-PyObject *pyme_raise_callback_exception(PyObject *self)
+PyObject *gpg_raise_callback_exception(PyObject *self)
{
PyGILState_STATE state = PyGILState_Ensure();
PyObject *ptype, *pvalue, *ptraceback, *excinfo;
@@ -192,7 +192,7 @@ PyObject *pyme_raise_callback_exception(PyObject *self)
/* Convert object to a pointer to gpgme type, generic version. */
PyObject *
-_pyme_obj2gpgme_t(PyObject *input, const char *objtype, int argnum)
+_gpg_obj2gpgme_t(PyObject *input, const char *objtype, int argnum)
{
PyObject *pyname = NULL, *pypointer = NULL;
pyname = PyObject_GetAttrString(input, "_ctype");
@@ -229,7 +229,7 @@ _pyme_obj2gpgme_t(PyObject *input, const char *objtype, int argnum)
objects with a fileno method, returning it in WRAPPER. This object
must be de-referenced when no longer needed. */
PyObject *
-_pyme_obj2gpgme_data_t(PyObject *input, int argnum, gpgme_data_t *wrapper,
+_gpg_obj2gpgme_data_t(PyObject *input, int argnum, gpgme_data_t *wrapper,
PyObject **bytesio, Py_buffer *view)
{
gpgme_error_t err;
@@ -242,9 +242,9 @@ _pyme_obj2gpgme_data_t(PyObject *input, int argnum, gpgme_data_t *wrapper,
err = gpgme_data_new_from_fd(wrapper, (int) PyLong_AsLong(fd));
Py_DECREF(fd);
if (err)
- return _pyme_raise_exception (err);
+ return _gpg_raise_exception (err);
- return _pyme_wrap_gpgme_data_t(*wrapper);
+ return _gpg_wrap_gpgme_data_t(*wrapper);
}
else
PyErr_Clear();
@@ -283,17 +283,17 @@ _pyme_obj2gpgme_data_t(PyObject *input, int argnum, gpgme_data_t *wrapper,
err = gpgme_data_new_from_mem(wrapper, view->buf, (size_t) view->len, 0);
if (err)
- return _pyme_raise_exception (err);
+ return _gpg_raise_exception (err);
- return _pyme_wrap_gpgme_data_t(*wrapper);
+ return _gpg_wrap_gpgme_data_t(*wrapper);
}
/* As last resort we assume it is a wrapped data object. */
if (PyObject_HasAttrString(data, "_ctype"))
- return _pyme_obj2gpgme_t(data, "gpgme_data_t", argnum);
+ return _gpg_obj2gpgme_t(data, "gpgme_data_t", argnum);
return PyErr_Format(PyExc_TypeError,
- "arg %d: expected pyme.Data, file, or an object "
+ "arg %d: expected gpg.Data, file, or an object "
"implementing the buffer protocol, got %s",
argnum, data->ob_type->tp_name);
}
@@ -301,7 +301,7 @@ _pyme_obj2gpgme_data_t(PyObject *input, int argnum, gpgme_data_t *wrapper,
PyObject *
-_pyme_wrap_result(PyObject *fragile, const char *classname)
+_gpg_wrap_result(PyObject *fragile, const char *classname)
{
static PyObject *results;
PyObject *class;
@@ -348,7 +348,7 @@ static gpgme_error_t pyPassphraseCb(void *hook,
PyObject *encoded = NULL;
gpgme_error_t err_status = 0;
- _pyme_exception_init();
+ _gpg_exception_init();
assert (PyTuple_Check(pyhook));
assert (PyTuple_Size(pyhook) == 2 || PyTuple_Size(pyhook) == 3);
@@ -385,12 +385,12 @@ static gpgme_error_t pyPassphraseCb(void *hook,
retval = PyObject_CallObject(func, args);
Py_DECREF(args);
if (PyErr_Occurred()) {
- err_status = _pyme_exception2code();
+ err_status = _gpg_exception2code();
} else {
if (!retval) {
if (write(fd, "\n", 1) < 0) {
err_status = gpgme_error_from_syserror ();
- _pyme_raise_exception (err_status);
+ _gpg_raise_exception (err_status);
}
} else {
char *buf;
@@ -425,11 +425,11 @@ static gpgme_error_t pyPassphraseCb(void *hook,
if (write(fd, buf, len) < 0) {
err_status = gpgme_error_from_syserror ();
- _pyme_raise_exception (err_status);
+ _gpg_raise_exception (err_status);
}
if (! err_status && write(fd, "\n", 1) < 0) {
err_status = gpgme_error_from_syserror ();
- _pyme_raise_exception (err_status);
+ _gpg_raise_exception (err_status);
}
Py_DECREF(retval);
@@ -438,7 +438,7 @@ static gpgme_error_t pyPassphraseCb(void *hook,
leave:
if (err_status)
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
Py_XDECREF(encoded);
PyGILState_Release(state);
@@ -446,7 +446,7 @@ static gpgme_error_t pyPassphraseCb(void *hook,
}
PyObject *
-pyme_set_passphrase_cb(PyObject *self, PyObject *cb) {
+gpg_set_passphrase_cb(PyObject *self, PyObject *cb) {
PyGILState_STATE state = PyGILState_Ensure();
PyObject *wrapped;
gpgme_ctx_t ctx;
@@ -459,7 +459,7 @@ pyme_set_passphrase_cb(PyObject *self, PyObject *cb) {
return NULL;
}
- ctx = _pyme_unwrap_gpgme_ctx_t(wrapped);
+ ctx = _gpg_unwrap_gpgme_ctx_t(wrapped);
Py_DECREF(wrapped);
if (ctx == NULL)
{
@@ -512,7 +512,7 @@ static void pyProgressCb(void *hook, const char *what, int type, int current,
PyTuple_SetItem(args, 0, PyUnicode_DecodeUTF8(what, strlen (what),
"strict"));
if (PyErr_Occurred()) {
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
Py_DECREF(args);
PyGILState_Release(state);
return;
@@ -527,14 +527,14 @@ static void pyProgressCb(void *hook, const char *what, int type, int current,
retval = PyObject_CallObject(func, args);
if (PyErr_Occurred())
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
Py_DECREF(args);
Py_XDECREF(retval);
PyGILState_Release(state);
}
PyObject *
-pyme_set_progress_cb(PyObject *self, PyObject *cb) {
+gpg_set_progress_cb(PyObject *self, PyObject *cb) {
PyGILState_STATE state = PyGILState_Ensure();
PyObject *wrapped;
gpgme_ctx_t ctx;
@@ -547,7 +547,7 @@ pyme_set_progress_cb(PyObject *self, PyObject *cb) {
return NULL;
}
- ctx = _pyme_unwrap_gpgme_ctx_t(wrapped);
+ ctx = _gpg_unwrap_gpgme_ctx_t(wrapped);
Py_DECREF(wrapped);
if (ctx == NULL)
{
@@ -624,19 +624,19 @@ static gpgme_error_t pyStatusCb(void *hook, const char *keyword,
retval = PyObject_CallObject(func, pyargs);
if (PyErr_Occurred())
- err = _pyme_exception2code();
+ err = _gpg_exception2code();
Py_DECREF(pyargs);
Py_XDECREF(retval);
leave:
if (err)
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
PyGILState_Release(state);
return err;
}
PyObject *
-pyme_set_status_cb(PyObject *self, PyObject *cb) {
+gpg_set_status_cb(PyObject *self, PyObject *cb) {
PyGILState_STATE state = PyGILState_Ensure();
PyObject *wrapped;
gpgme_ctx_t ctx;
@@ -649,7 +649,7 @@ pyme_set_status_cb(PyObject *self, PyObject *cb) {
return NULL;
}
- ctx = _pyme_unwrap_gpgme_ctx_t(wrapped);
+ ctx = _gpg_unwrap_gpgme_ctx_t(wrapped);
Py_DECREF(wrapped);
if (ctx == NULL)
{
@@ -684,7 +684,7 @@ pyme_set_status_cb(PyObject *self, PyObject *cb) {
/* Interact callbacks. */
gpgme_error_t
-_pyme_interact_cb(void *opaque, const char *keyword,
+_gpg_interact_cb(void *opaque, const char *keyword,
const char *args, int fd)
{
PyGILState_STATE state = PyGILState_Ensure();
@@ -694,7 +694,7 @@ _pyme_interact_cb(void *opaque, const char *keyword,
gpgme_error_t err_status = 0;
PyObject *self = NULL;
- _pyme_exception_init();
+ _gpg_exception_init();
assert (PyTuple_Check(pyopaque));
assert (PyTuple_Size(pyopaque) == 2 || PyTuple_Size(pyopaque) == 3);
@@ -725,7 +725,7 @@ _pyme_interact_cb(void *opaque, const char *keyword,
retval = PyObject_CallObject(func, pyargs);
Py_DECREF(pyargs);
if (PyErr_Occurred()) {
- err_status = _pyme_exception2code();
+ err_status = _gpg_exception2code();
} else {
if (fd>=0 && retval && PyUnicode_Check(retval)) {
PyObject *encoded = NULL;
@@ -747,18 +747,18 @@ _pyme_interact_cb(void *opaque, const char *keyword,
if (write(fd, buffer, size) < 0) {
err_status = gpgme_error_from_syserror ();
- _pyme_raise_exception (err_status);
+ _gpg_raise_exception (err_status);
}
if (! err_status && write(fd, "\n", 1) < 0) {
err_status = gpgme_error_from_syserror ();
- _pyme_raise_exception (err_status);
+ _gpg_raise_exception (err_status);
}
Py_DECREF(encoded);
}
}
leave:
if (err_status)
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
Py_XDECREF(retval);
PyGILState_Release(state);
@@ -804,7 +804,7 @@ static ssize_t pyDataReadCb(void *hook, void *buffer, size_t size)
retval = PyObject_CallObject(func, pyargs);
Py_DECREF(pyargs);
if (PyErr_Occurred()) {
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
result = -1;
goto leave;
}
@@ -813,7 +813,7 @@ static ssize_t pyDataReadCb(void *hook, void *buffer, size_t size)
PyErr_Format(PyExc_TypeError,
"expected bytes from read callback, got %s",
retval->ob_type->tp_name);
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
result = -1;
goto leave;
}
@@ -822,7 +822,7 @@ static ssize_t pyDataReadCb(void *hook, void *buffer, size_t size)
PyErr_Format(PyExc_TypeError,
"expected %zu bytes from read callback, got %zu",
size, PyBytes_Size(retval));
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
result = -1;
goto leave;
}
@@ -871,7 +871,7 @@ static ssize_t pyDataWriteCb(void *hook, const void *buffer, size_t size)
retval = PyObject_CallObject(func, pyargs);
Py_DECREF(pyargs);
if (PyErr_Occurred()) {
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
result = -1;
goto leave;
}
@@ -887,7 +887,7 @@ static ssize_t pyDataWriteCb(void *hook, const void *buffer, size_t size)
PyErr_Format(PyExc_TypeError,
"expected int from write callback, got %s",
retval->ob_type->tp_name);
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
result = -1;
}
@@ -938,7 +938,7 @@ static off_t pyDataSeekCb(void *hook, off_t offset, int whence)
retval = PyObject_CallObject(func, pyargs);
Py_DECREF(pyargs);
if (PyErr_Occurred()) {
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
result = -1;
goto leave;
}
@@ -958,7 +958,7 @@ static off_t pyDataSeekCb(void *hook, off_t offset, int whence)
PyErr_Format(PyExc_TypeError,
"expected int from seek callback, got %s",
retval->ob_type->tp_name);
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
result = -1;
}
@@ -1000,12 +1000,12 @@ static void pyDataReleaseCb(void *hook)
Py_XDECREF(retval);
Py_DECREF(pyargs);
if (PyErr_Occurred())
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
PyGILState_Release(state);
}
PyObject *
-pyme_data_new_from_cbs(PyObject *self,
+gpg_data_new_from_cbs(PyObject *self,
PyObject *pycbs,
gpgme_data_t *r_data)
{
@@ -1026,7 +1026,7 @@ pyme_data_new_from_cbs(PyObject *self,
err = gpgme_data_new_from_cbs(r_data, &cbs, (void *) pycbs);
if (err)
- return _pyme_raise_exception(err);
+ return _gpg_raise_exception(err);
PyObject_SetAttrString(self, "_data_cbs", pycbs);
@@ -1040,7 +1040,7 @@ pyme_data_new_from_cbs(PyObject *self,
/* The assuan callbacks. */
gpgme_error_t
-_pyme_assuan_data_cb (void *hook, const void *data, size_t datalen)
+_gpg_assuan_data_cb (void *hook, const void *data, size_t datalen)
{
PyGILState_STATE state = PyGILState_Ensure();
gpgme_error_t err = 0;
@@ -1059,25 +1059,25 @@ _pyme_assuan_data_cb (void *hook, const void *data, size_t datalen)
py_data = PyBytes_FromStringAndSize(data, datalen);
if (py_data == NULL)
{
- err = _pyme_exception2code();
+ err = _gpg_exception2code();
goto leave;
}
retval = PyObject_CallFunctionObjArgs(func, py_data, NULL);
if (PyErr_Occurred())
- err = _pyme_exception2code();
+ err = _gpg_exception2code();
Py_DECREF(py_data);
Py_XDECREF(retval);
leave:
if (err)
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
PyGILState_Release(state);
return err;
}
gpgme_error_t
-_pyme_assuan_inquire_cb (void *hook, const char *name, const char *args,
+_gpg_assuan_inquire_cb (void *hook, const char *name, const char *args,
gpgme_data_t *r_data)
{
PyGILState_STATE state = PyGILState_Ensure();
@@ -1098,20 +1098,20 @@ _pyme_assuan_inquire_cb (void *hook, const char *name, const char *args,
py_name = PyUnicode_FromString(name);
if (py_name == NULL)
{
- err = _pyme_exception2code();
+ err = _gpg_exception2code();
goto leave;
}
py_args = PyUnicode_FromString(args);
if (py_args == NULL)
{
- err = _pyme_exception2code();
+ err = _gpg_exception2code();
goto leave;
}
retval = PyObject_CallFunctionObjArgs(func, py_name, py_args, NULL);
if (PyErr_Occurred())
- err = _pyme_exception2code();
+ err = _gpg_exception2code();
Py_XDECREF(retval);
/* FIXME: Returning data is not yet implemented. */
@@ -1121,13 +1121,13 @@ _pyme_assuan_inquire_cb (void *hook, const char *name, const char *args,
Py_XDECREF(py_name);
Py_XDECREF(py_args);
if (err)
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
PyGILState_Release(state);
return err;
}
gpgme_error_t
-_pyme_assuan_status_cb (void *hook, const char *status, const char *args)
+_gpg_assuan_status_cb (void *hook, const char *status, const char *args)
{
PyGILState_STATE state = PyGILState_Ensure();
gpgme_error_t err = 0;
@@ -1147,27 +1147,27 @@ _pyme_assuan_status_cb (void *hook, const char *status, const char *args)
py_status = PyUnicode_FromString(status);
if (py_status == NULL)
{
- err = _pyme_exception2code();
+ err = _gpg_exception2code();
goto leave;
}
py_args = PyUnicode_FromString(args);
if (py_args == NULL)
{
- err = _pyme_exception2code();
+ err = _gpg_exception2code();
goto leave;
}
retval = PyObject_CallFunctionObjArgs(func, py_status, py_args, NULL);
if (PyErr_Occurred())
- err = _pyme_exception2code();
+ err = _gpg_exception2code();
Py_XDECREF(retval);
leave:
Py_XDECREF(py_status);
Py_XDECREF(py_args);
if (err)
- _pyme_stash_callback_exception(self);
+ _gpg_stash_callback_exception(self);
PyGILState_Release(state);
return err;
}
diff --git a/lang/python/helpers.h b/lang/python/helpers.h
index 67d23b2..61f538e 100644
--- a/lang/python/helpers.h
+++ b/lang/python/helpers.h
@@ -31,13 +31,13 @@
#endif
/* Flag specifying whether this is an in-tree build. */
-extern int pyme_in_tree_build;
+extern int gpg_in_tree_build;
-PyObject *pyme_raise_callback_exception(PyObject *self);
+PyObject *gpg_raise_callback_exception(PyObject *self);
-PyObject *pyme_set_passphrase_cb(PyObject *self, PyObject *cb);
-PyObject *pyme_set_progress_cb(PyObject *self, PyObject *cb);
-PyObject *pyme_set_status_cb(PyObject *self, PyObject *cb);
+PyObject *gpg_set_passphrase_cb(PyObject *self, PyObject *cb);
+PyObject *gpg_set_progress_cb(PyObject *self, PyObject *cb);
+PyObject *gpg_set_status_cb(PyObject *self, PyObject *cb);
-PyObject *pyme_data_new_from_cbs(PyObject *self, PyObject *pycbs,
+PyObject *gpg_data_new_from_cbs(PyObject *self, PyObject *pycbs,
gpgme_data_t *r_data);
diff --git a/lang/python/private.h b/lang/python/private.h
index 3a903c1..e7b371f 100644
--- a/lang/python/private.h
+++ b/lang/python/private.h
@@ -19,36 +19,36 @@
#include <gpgme.h>
-#ifndef _PYME_PRIVATE_H_
-#define _PYME_PRIVATE_H_
+#ifndef _GPG_PRIVATE_H_
+#define _GPG_PRIVATE_H_
/* GPGME glue. Implemented in helpers.c. */
-void _pyme_exception_init(void);
-gpgme_error_t _pyme_exception2code(void);
+void _gpg_exception_init(void);
+gpgme_error_t _gpg_exception2code(void);
-PyObject *_pyme_obj2gpgme_t(PyObject *input, const char *objtype, int argnum);
-PyObject *_pyme_obj2gpgme_data_t(PyObject *input, int argnum,
+PyObject *_gpg_obj2gpgme_t(PyObject *input, const char *objtype, int argnum);
+PyObject *_gpg_obj2gpgme_data_t(PyObject *input, int argnum,
gpgme_data_t *wrapper,
PyObject **bytesio, Py_buffer *view);
-PyObject *_pyme_wrap_result(PyObject *fragile, const char *classname);
+PyObject *_gpg_wrap_result(PyObject *fragile, const char *classname);
-gpgme_error_t _pyme_interact_cb(void *opaque, const char *keyword,
+gpgme_error_t _gpg_interact_cb(void *opaque, const char *keyword,
const char *args, int fd);
-gpgme_error_t _pyme_assuan_data_cb (void *hook,
+gpgme_error_t _gpg_assuan_data_cb (void *hook,
const void *data, size_t datalen);
-gpgme_error_t _pyme_assuan_inquire_cb (void *hook,
+gpgme_error_t _gpg_assuan_inquire_cb (void *hook,
const char *name, const char *args,
gpgme_data_t *r_data);
-gpgme_error_t _pyme_assuan_status_cb (void *hook,
+gpgme_error_t _gpg_assuan_status_cb (void *hook,
const char *status, const char *args);
/* SWIG runtime support. Implemented in gpgme.i. */
-PyObject *_pyme_wrap_gpgme_data_t(gpgme_data_t data);
-gpgme_ctx_t _pyme_unwrap_gpgme_ctx_t(PyObject *wrapped);
+PyObject *_gpg_wrap_gpgme_data_t(gpgme_data_t data);
+gpgme_ctx_t _gpg_unwrap_gpgme_ctx_t(PyObject *wrapped);
-#endif /* _PYME_PRIVATE_H_ */
+#endif /* _GPG_PRIVATE_H_ */
diff --git a/lang/python/pyme/__pycache__/__init__.cpython-34.pyc b/lang/python/pyme/__pycache__/__init__.cpython-34.pyc
deleted file mode 100644
index ba78937..0000000
--- a/lang/python/pyme/__pycache__/__init__.cpython-34.pyc
+++ /dev/null
Binary files differ
diff --git a/lang/python/pyme/__pycache__/version.cpython-34.pyc b/lang/python/pyme/__pycache__/version.cpython-34.pyc
deleted file mode 100644
index 658008a..0000000
--- a/lang/python/pyme/__pycache__/version.cpython-34.pyc
+++ /dev/null
Binary files differ
diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in
index 4c41673..9669c28 100755
--- a/lang/python/setup.py.in
+++ b/lang/python/setup.py.in
@@ -23,7 +23,7 @@ import os, os.path, sys
import glob
import subprocess
-# Out-of-tree build of the pyme3 bindings.
+# Out-of-tree build of the gpg bindings.
gpg_error_config = ["gpg-error-config"]
gpgme_config_flags = ["--thread=pthread"]
gpgme_config = ["gpgme-config"] + gpgme_config_flags
@@ -75,8 +75,8 @@ if '-' in version:
version = version.split('-')[0]
major, minor, patch = map(int, version.split('.'))
-if not (major > 1 or (major == 1 and minor >= 6)):
- sys.exit('Need at least GPGME version 1.6, found {}.'.format(version_raw))
+if not (major > 1 or (major == 1 and minor >= 7)):
+ sys.exit('Need at least GPGME version 1.7, found {}.'.format(version_raw))
if not gpgme_h:
gpgme_h = os.path.join(getconfig("prefix")[0], "include", "gpgme.h")
@@ -88,7 +88,7 @@ if not os.path.exists(gpg_error_h):
glob.glob(os.path.join(gpg_error_prefix, "include",
"*", "gpg-error.h"))[0]
-print("Building pyme3 using {} and {}.".format(gpgme_h, gpg_error_h))
+print("Building python gpg module using {} and {}.".format(gpgme_h, gpg_error_h))
# Cleanup gpgme.h from deprecated functions and typedefs.
subprocess.check_call([sys.executable, "gpgme-h-clean.py", gpgme_h],
@@ -152,15 +152,15 @@ class BuildExtFirstHack(build):
self.run_command('build_ext')
build.run(self)
-swige = Extension("pyme._gpgme", ["gpgme.i", "helpers.c"],
+swige = Extension("gpg._gpgme", ["gpgme.i", "helpers.c"],
swig_opts = ['-py3', '-builtin', '-threads',
- '-outdir', 'pyme'] + extra_swig_opts,
+ '-outdir', 'gpg'] + extra_swig_opts,
include_dirs = include_dirs,
define_macros = define_macros,
library_dirs = library_dirs,
extra_link_args = libs)
-setup(name="pyme3",
+setup(name="gpg",
cmdclass={'build': BuildExtFirstHack},
version="@VERSION@",
description='Python bindings for GPGME GnuPG cryptography library',
@@ -170,8 +170,8 @@ setup(name="pyme3",
author_email='gnupg-devel@gnupg.org',
url='https://www.gnupg.org',
ext_modules=[swige],
- packages = ['pyme', 'pyme.constants', 'pyme.constants.data',
- 'pyme.constants.keylist', 'pyme.constants.sig'],
+ packages = ['gpg', 'gpg.constants', 'gpg.constants.data',
+ 'gpg.constants.keylist', 'gpg.constants.sig'],
license="LGPL2.1+ (the library), GPL2+ (tests and examples)",
classifiers=[
'Development Status :: 4 - Beta',
diff --git a/lang/python/tests/Makefile.am b/lang/python/tests/Makefile.am
index aa88bdc..39f532c 100644
--- a/lang/python/tests/Makefile.am
+++ b/lang/python/tests/Makefile.am
@@ -89,7 +89,7 @@ clean-local:
./private-keys-v1.d/gpg-sample.stamp: $(private_keys)
- test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
+ $(MKDIR_P) ./private-keys-v1.d
for k in $(private_keys); do \
cp $$k private-keys-v1.d/$${k#$(test_srcdir)/}.key; \
done
diff --git a/lang/python/tests/Makefile.in b/lang/python/tests/Makefile.in
index 3886bf4..ce60cd5 100644
--- a/lang/python/tests/Makefile.in
+++ b/lang/python/tests/Makefile.in
@@ -268,6 +268,9 @@ SWIG = @SWIG@
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
@@ -591,7 +594,7 @@ clean-local:
-rm -fR -- private-keys-v1.d openpgp-revocs.d S.gpg-agent sshcontrol
./private-keys-v1.d/gpg-sample.stamp: $(private_keys)
- test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d
+ $(MKDIR_P) ./private-keys-v1.d
for k in $(private_keys); do \
cp $$k private-keys-v1.d/$${k#$(test_srcdir)/}.key; \
done
diff --git a/lang/python/tests/initial.py b/lang/python/tests/initial.py
index 2d4827a..ebe7f8a 100755
--- a/lang/python/tests/initial.py
+++ b/lang/python/tests/initial.py
@@ -22,14 +22,14 @@ del absolute_import, print_function, unicode_literals
import os
import subprocess
-import pyme
+import gpg
import support
-support.init_gpgme(pyme.constants.PROTOCOL_OpenPGP)
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
subprocess.check_call([os.path.join(os.getenv('top_srcdir'),
"tests", "start-stop-agent"), "--start"])
-with pyme.Context() as c:
+with gpg.Context() as c:
alpha = c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False)
bob = c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False)
diff --git a/lang/python/tests/support.py b/lang/python/tests/support.py
index f1ffdc3..f991c6d 100644
--- a/lang/python/tests/support.py
+++ b/lang/python/tests/support.py
@@ -20,7 +20,7 @@ del absolute_import, print_function, unicode_literals
import sys
import os
-from pyme import core
+import gpg
# known keys
alpha = "A0FF4590BB6122EDEF6E3C542D727CC768697734"
@@ -36,7 +36,7 @@ def in_srcdir(name):
return os.path.join(os.environ['srcdir'], name)
def init_gpgme(proto):
- core.engine_check_version(proto)
+ gpg.core.engine_check_version(proto)
verbose = int(os.environ.get('verbose', 0)) > 1
def print_data(data):
@@ -66,5 +66,5 @@ def mark_key_trusted(ctx, key):
else:
result = None
return result
- with core.Data() as sink:
+ with gpg.Data() as sink:
ctx.op_edit(key, Editor().edit, sink, sink)
diff --git a/lang/python/tests/t-callbacks.py b/lang/python/tests/t-callbacks.py
index b3b4349..eed50bc 100755
--- a/lang/python/tests/t-callbacks.py
+++ b/lang/python/tests/t-callbacks.py
@@ -21,16 +21,16 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import os
-from pyme import core, constants
+import gpg
import support
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
-c = core.Context()
-c.set_pinentry_mode(constants.PINENTRY_MODE_LOOPBACK)
+c = gpg.Context()
+c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK)
-source = core.Data("Hallo Leute\n")
-sink = core.Data()
+source = gpg.Data("Hallo Leute\n")
+sink = gpg.Data()
# Valid passphrases, both as string and bytes.
for passphrase in ('foo', b'foo'):
@@ -87,7 +87,7 @@ Key-Type: RSA
Key-Length: 1024
Name-Real: Joe Tester
Name-Comment: with stupid passphrase
-Name-Email: joe+pyme@example.org
+Name-Email: joe+gpg@example.org
Passphrase: Crypt0R0cks
Expire-Date: 2020-12-31
</GnupgKeyParms>
@@ -100,7 +100,7 @@ def progress_cb(what, typ, current, total, hook=None):
"PROGRESS UPDATE: what = {}, type = {}, current = {}, total = {}"
.format(what, typ, current, total))
-c = core.Context()
+c = gpg.Context()
c.set_progress_cb(progress_cb, messages)
c.op_genkey(parms, None, None)
assert len(messages) > 0
@@ -109,7 +109,7 @@ assert len(messages) > 0
def progress_cb(what, typ, current, total, hook=None):
raise myException
-c = core.Context()
+c = gpg.Context()
c.set_progress_cb(progress_cb, None)
try:
c.op_genkey(parms, None, None)
@@ -120,10 +120,10 @@ else:
# Test the edit callback.
-c = core.Context()
-c.set_pinentry_mode(constants.PINENTRY_MODE_LOOPBACK)
+c = gpg.Context()
+c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK)
c.set_passphrase_cb(lambda *args: "abc")
-sink = core.Data()
+sink = gpg.Data()
alpha = c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False)
cookie = object()
@@ -137,10 +137,10 @@ c.op_edit(alpha, edit_cb, cookie, sink)
assert edit_cb_called
# Test exceptions.
-c = core.Context()
-c.set_pinentry_mode(constants.PINENTRY_MODE_LOOPBACK)
+c = gpg.Context()
+c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK)
c.set_passphrase_cb(lambda *args: "abc")
-sink = core.Data()
+sink = gpg.Data()
def edit_cb(status, args):
raise myException
@@ -154,8 +154,8 @@ else:
# Test the status callback.
-source = core.Data("Hallo Leute\n")
-sink = core.Data()
+source = gpg.Data("Hallo Leute\n")
+sink = gpg.Data()
status_cb_called = False
def status_cb(keyword, args, hook=None):
@@ -163,24 +163,24 @@ def status_cb(keyword, args, hook=None):
status_cb_called = True
assert hook == cookie
-c = core.Context()
+c = gpg.Context()
c.set_status_cb(status_cb, cookie)
c.set_ctx_flag("full-status", "1")
-c.op_encrypt([alpha], constants.ENCRYPT_ALWAYS_TRUST, source, sink)
+c.op_encrypt([alpha], gpg.constants.ENCRYPT_ALWAYS_TRUST, source, sink)
assert status_cb_called
# Test exceptions.
-source = core.Data("Hallo Leute\n")
-sink = core.Data()
+source = gpg.Data("Hallo Leute\n")
+sink = gpg.Data()
def status_cb(keyword, args):
raise myException
-c = core.Context()
+c = gpg.Context()
c.set_status_cb(status_cb, None)
c.set_ctx_flag("full-status", "1")
try:
- c.op_encrypt([alpha], constants.ENCRYPT_ALWAYS_TRUST, source, sink)
+ c.op_encrypt([alpha], gpg.constants.ENCRYPT_ALWAYS_TRUST, source, sink)
except Exception as e:
assert e == myException
else:
@@ -194,7 +194,7 @@ def read_cb(amount, hook=None):
return 0
def release_cb(hook=None):
assert hook == cookie
-data = core.Data(cbs=(read_cb, None, None, release_cb, cookie))
+data = gpg.Data(cbs=(read_cb, None, None, release_cb, cookie))
try:
data.read()
except Exception as e:
@@ -204,7 +204,7 @@ else:
def read_cb(amount):
raise myException
-data = core.Data(cbs=(read_cb, None, None, lambda: None))
+data = gpg.Data(cbs=(read_cb, None, None, lambda: None))
try:
data.read()
except Exception as e:
@@ -216,7 +216,7 @@ else:
def write_cb(what, hook=None):
assert hook == cookie
return "wrong type"
-data = core.Data(cbs=(None, write_cb, None, release_cb, cookie))
+data = gpg.Data(cbs=(None, write_cb, None, release_cb, cookie))
try:
data.write(b'stuff')
except Exception as e:
@@ -226,7 +226,7 @@ else:
def write_cb(what):
raise myException
-data = core.Data(cbs=(None, write_cb, None, lambda: None))
+data = gpg.Data(cbs=(None, write_cb, None, lambda: None))
try:
data.write(b'stuff')
except Exception as e:
@@ -238,7 +238,7 @@ else:
def seek_cb(offset, whence, hook=None):
assert hook == cookie
return "wrong type"
-data = core.Data(cbs=(None, None, seek_cb, release_cb, cookie))
+data = gpg.Data(cbs=(None, None, seek_cb, release_cb, cookie))
try:
data.seek(0, os.SEEK_SET)
except Exception as e:
@@ -248,7 +248,7 @@ else:
def seek_cb(offset, whence):
raise myException
-data = core.Data(cbs=(None, None, seek_cb, lambda: None))
+data = gpg.Data(cbs=(None, None, seek_cb, lambda: None))
try:
data.seek(0, os.SEEK_SET)
except Exception as e:
diff --git a/lang/python/tests/t-data.py b/lang/python/tests/t-data.py
index 4812a2e..d1facd4 100755
--- a/lang/python/tests/t-data.py
+++ b/lang/python/tests/t-data.py
@@ -23,9 +23,9 @@ del absolute_import, print_function, unicode_literals
import io
import os
import tempfile
-from pyme import core
+import gpg
-data = core.Data('Hello world!')
+data = gpg.Data('Hello world!')
assert data.read() == b'Hello world!'
assert data.read() == b''
@@ -33,29 +33,29 @@ data.seek(0, os.SEEK_SET)
assert data.read() == b'Hello world!'
assert data.read() == b''
-data = core.Data(b'Hello world!')
+data = gpg.Data(b'Hello world!')
assert data.read() == b'Hello world!'
-data = core.Data(b'Hello world!', copy=False)
+data = gpg.Data(b'Hello world!', copy=False)
assert data.read() == b'Hello world!'
-data = core.Data()
+data = gpg.Data()
data.write('Hello world!')
data.seek(0, os.SEEK_SET)
assert data.read() == b'Hello world!'
-data = core.Data()
+data = gpg.Data()
data.write(b'Hello world!')
data.seek(0, os.SEEK_SET)
assert data.read() == b'Hello world!'
binjunk = bytes(range(256))
-data = core.Data()
+data = gpg.Data()
data.write(binjunk)
data.seek(0, os.SEEK_SET)
assert data.read() == binjunk
-data = core.Data()
+data = gpg.Data()
data.set_file_name("foobar")
assert data.get_file_name() == "foobar"
@@ -66,26 +66,26 @@ with tempfile.NamedTemporaryFile() as tmp:
tmp.seek(0)
# Open using name.
- data = core.Data(file=tmp.name)
+ data = gpg.Data(file=tmp.name)
assert data.read() == binjunk
# Open using name, without copying.
if False:
# delayed reads are not yet supported
- data = core.Data(file=tmp.name, copy=False)
+ data = gpg.Data(file=tmp.name, copy=False)
assert data.read() == binjunk
# Open using stream.
tmp.seek(0)
- data = core.Data(file=tmp)
+ data = gpg.Data(file=tmp)
assert data.read() == binjunk
# Open using stream, offset, and length.
- data = core.Data(file=tmp, offset=0, length=42)
+ data = gpg.Data(file=tmp, offset=0, length=42)
assert data.read() == binjunk[:42]
# Open using name, offset, and length.
- data = core.Data(file=tmp.name, offset=23, length=42)
+ data = gpg.Data(file=tmp.name, offset=23, length=42)
assert data.read() == binjunk[23:23+42]
# Test callbacks.
@@ -112,7 +112,7 @@ class DataObject(object):
do = DataObject()
cookie = object()
-data = core.Data(cbs=(do.read, do.write, do.seek, do.release, cookie))
+data = gpg.Data(cbs=(do.read, do.write, do.seek, do.release, cookie))
data.write('Hello world!')
data.seek(0, os.SEEK_SET)
assert data.read() == b'Hello world!'
@@ -121,7 +121,7 @@ assert do.released
# Again, without the cookie.
do = DataObject()
-data = core.Data(cbs=(do.read, do.write, do.seek, do.release))
+data = gpg.Data(cbs=(do.read, do.write, do.seek, do.release))
data.write('Hello world!')
data.seek(0, os.SEEK_SET)
assert data.read() == b'Hello world!'
diff --git a/lang/python/tests/t-decrypt-verify.py b/lang/python/tests/t-decrypt-verify.py
index a38a965..6243167 100755
--- a/lang/python/tests/t-decrypt-verify.py
+++ b/lang/python/tests/t-decrypt-verify.py
@@ -20,8 +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, errors
+import gpg
import support
def check_verify_result(result, summary, fpr, status):
@@ -29,17 +28,17 @@ def check_verify_result(result, summary, fpr, status):
sig = result.signatures[0]
assert sig.summary == summary, "Unexpected signature summary"
assert sig.fpr == fpr
- assert errors.GPGMEError(sig.status).getcode() == status
+ assert gpg.errors.GPGMEError(sig.status).getcode() == status
assert len(sig.notations) == 0
assert not sig.wrong_key_usage
- assert sig.validity == constants.VALIDITY_FULL
- assert errors.GPGMEError(sig.validity_reason).getcode() == errors.NO_ERROR
+ assert sig.validity == gpg.constants.validity.FULL
+ assert gpg.errors.GPGMEError(sig.validity_reason).getcode() == gpg.errors.NO_ERROR
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
-source = core.Data(file=support.make_filename("cipher-2.asc"))
-sink = core.Data()
+source = gpg.Data(file=support.make_filename("cipher-2.asc"))
+sink = gpg.Data()
c.op_decrypt_verify(source, sink)
result = c.op_decrypt_result()
@@ -50,12 +49,12 @@ support.print_data(sink)
verify_result = c.op_verify_result()
check_verify_result(verify_result,
- constants.SIGSUM_VALID | constants.SIGSUM_GREEN,
+ gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN,
"A0FF4590BB6122EDEF6E3C542D727CC768697734",
- errors.NO_ERROR)
+ gpg.errors.NO_ERROR)
# Idiomatic interface.
-with pyme.Context() as c:
+with gpg.Context() as c:
alpha = c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False)
bob = c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False)
plaintext, _, verify_result = \
@@ -63,14 +62,14 @@ with pyme.Context() as c:
assert plaintext.find(b'Wenn Sie dies lesen k') >= 0, \
'Plaintext not found'
check_verify_result(verify_result,
- constants.SIGSUM_VALID | constants.SIGSUM_GREEN,
+ gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN,
"A0FF4590BB6122EDEF6E3C542D727CC768697734",
- errors.NO_ERROR)
+ gpg.errors.NO_ERROR)
try:
c.decrypt(open(support.make_filename("cipher-2.asc")),
verify=[alpha, bob])
- except errors.MissingSignatures as e:
+ except gpg.errors.MissingSignatures as e:
assert len(e.missing) == 1
assert e.missing[0] == bob
else:
diff --git a/lang/python/tests/t-decrypt.py b/lang/python/tests/t-decrypt.py
index 2d85bc2..1af0562 100755
--- a/lang/python/tests/t-decrypt.py
+++ b/lang/python/tests/t-decrypt.py
@@ -20,15 +20,14 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-import pyme
-from pyme import core, constants
+import gpg
import support
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
-source = core.Data(file=support.make_filename("cipher-1.asc"))
-sink = core.Data()
+source = gpg.Data(file=support.make_filename("cipher-1.asc"))
+sink = gpg.Data()
c.op_decrypt(source, sink)
result = c.op_decrypt_result()
@@ -38,7 +37,7 @@ assert not result.unsupported_algorithm, \
support.print_data(sink)
# Idiomatic interface.
-with pyme.Context() as c:
+with gpg.Context() as c:
plaintext, _, _ = c.decrypt(open(support.make_filename("cipher-1.asc")))
assert len(plaintext) > 0
assert plaintext.find(b'Wenn Sie dies lesen k') >= 0, \
diff --git a/lang/python/tests/t-edit.py b/lang/python/tests/t-edit.py
index 18bcb94..bd70e7e 100755
--- a/lang/python/tests/t-edit.py
+++ b/lang/python/tests/t-edit.py
@@ -23,7 +23,7 @@ del absolute_import, print_function, unicode_literals
import sys
import os
-from pyme import core, constants
+import gpg
import support
class KeyEditor(object):
@@ -51,10 +51,10 @@ class KeyEditor(object):
return result
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
-c = core.Context()
-c.set_pinentry_mode(constants.PINENTRY_MODE_LOOPBACK)
+c = gpg.Context()
+c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK)
c.set_passphrase_cb(lambda *args: "abc")
c.set_armor(True)
@@ -65,7 +65,7 @@ c.interact(c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False),
assert editor.done
# The deprecated interface.
-sink = core.Data()
+sink = gpg.Data()
editor = KeyEditor()
c.op_edit(c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False),
editor.edit_fnc, sink, sink)
diff --git a/lang/python/tests/t-encrypt-large.py b/lang/python/tests/t-encrypt-large.py
index b9cc3b5..cdb4a32 100755
--- a/lang/python/tests/t-encrypt-large.py
+++ b/lang/python/tests/t-encrypt-large.py
@@ -22,7 +22,7 @@ del absolute_import, print_function, unicode_literals
import sys
import random
-from pyme import core, constants
+import gpg
import support
if len(sys.argv) == 2:
@@ -30,8 +30,8 @@ if len(sys.argv) == 2:
else:
nbytes = 100000
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
ntoread = nbytes
def read_cb(amount):
@@ -48,14 +48,14 @@ def write_cb(data):
nwritten += len(data)
return len(data)
-source = core.Data(cbs=(read_cb, None, None, lambda: None))
-sink = core.Data(cbs=(None, write_cb, None, lambda: None))
+source = gpg.Data(cbs=(read_cb, None, None, lambda: None))
+sink = gpg.Data(cbs=(None, write_cb, None, lambda: None))
keys = []
keys.append(c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False))
keys.append(c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False))
-c.op_encrypt(keys, constants.ENCRYPT_ALWAYS_TRUST, source, sink)
+c.op_encrypt(keys, gpg.constants.ENCRYPT_ALWAYS_TRUST, source, sink)
result = c.op_encrypt_result()
assert not result.invalid_recipients, \
"Invalid recipient encountered: {}".format(result.invalid_recipients.fpr)
diff --git a/lang/python/tests/t-encrypt-sign.py b/lang/python/tests/t-encrypt-sign.py
index a453f79..094a2b0 100755
--- a/lang/python/tests/t-encrypt-sign.py
+++ b/lang/python/tests/t-encrypt-sign.py
@@ -21,12 +21,11 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import sys
-import pyme
-from pyme import core, constants
+import gpg
import support
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
c.set_armor(True)
def check_result(r, typ):
@@ -40,11 +39,11 @@ def check_result(r, typ):
if signature.type != typ:
sys.exit("Wrong type of signature created")
- if signature.pubkey_algo != constants.PK_DSA:
+ if signature.pubkey_algo != gpg.constants.pk.DSA:
sys.exit("Wrong pubkey algorithm reported: {}".format(
signature.pubkey_algo))
- if signature.hash_algo not in (constants.MD_SHA1, constants.MD_RMD160):
+ if signature.hash_algo not in (gpg.constants.md.SHA1, gpg.constants.md.RMD160):
sys.exit("Wrong hash algorithm reported: {}".format(
signature.hash_algo))
@@ -60,30 +59,30 @@ keys.append(c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False))
keys.append(c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False))
for recipients in (keys, []):
- source = core.Data("Hallo Leute\n")
- sink = core.Data()
+ source = gpg.Data("Hallo Leute\n")
+ sink = gpg.Data()
- c.op_encrypt_sign(recipients, constants.ENCRYPT_ALWAYS_TRUST, source, sink)
+ c.op_encrypt_sign(recipients, gpg.constants.ENCRYPT_ALWAYS_TRUST, source, sink)
result = c.op_encrypt_result()
assert not result.invalid_recipients, \
"Invalid recipient encountered: {}".format(
result.invalid_recipients.fpr)
result = c.op_sign_result()
- check_result(result, constants.SIG_MODE_NORMAL)
+ check_result(result, gpg.constants.sig.mode.NORMAL)
support.print_data(sink)
# Idiomatic interface.
-with pyme.Context(armor=True) as c:
+with gpg.Context(armor=True) as c:
message = "Hallo Leute\n".encode()
ciphertext, _, sig_result = c.encrypt(message,
recipients=keys,
always_trust=True)
assert len(ciphertext) > 0
assert ciphertext.find(b'BEGIN PGP MESSAGE') > 0, 'Marker not found'
- check_result(sig_result, constants.SIG_MODE_NORMAL)
+ check_result(sig_result, gpg.constants.sig.mode.NORMAL)
c.signers = [c.get_key(support.sign_only, True)]
c.encrypt(message, recipients=keys, always_trust=True)
@@ -91,7 +90,7 @@ with pyme.Context(armor=True) as c:
c.signers = [c.get_key(support.encrypt_only, True)]
try:
c.encrypt(message, recipients=keys, always_trust=True)
- except pyme.errors.InvalidSigners as e:
+ except gpg.errors.InvalidSigners as e:
assert len(e.signers) == 1
assert support.encrypt_only.endswith(e.signers[0].fpr)
else:
diff --git a/lang/python/tests/t-encrypt-sym.py b/lang/python/tests/t-encrypt-sym.py
index d577184..07e6b62 100755
--- a/lang/python/tests/t-encrypt-sym.py
+++ b/lang/python/tests/t-encrypt-sym.py
@@ -21,19 +21,18 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import os
-import pyme
-from pyme import core, constants
+import gpg
import support
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
for passphrase in ("abc", b"abc"):
- c = core.Context()
+ c = gpg.Context()
c.set_armor(True)
- c.set_pinentry_mode(constants.PINENTRY_MODE_LOOPBACK)
+ c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK)
- source = core.Data("Hallo Leute\n")
- cipher = core.Data()
+ source = gpg.Data("Hallo Leute\n")
+ cipher = gpg.Data()
passphrase_cb_called = 0
def passphrase_cb(hint, desc, prev_bad, hook=None):
@@ -48,11 +47,11 @@ for passphrase in ("abc", b"abc"):
"Callback called {} times".format(passphrase_cb_called)
support.print_data(cipher)
- c = core.Context()
+ c = gpg.Context()
c.set_armor(True)
- c.set_pinentry_mode(constants.PINENTRY_MODE_LOOPBACK)
+ c.set_pinentry_mode(gpg.constants.PINENTRY_MODE_LOOPBACK)
c.set_passphrase_cb(passphrase_cb, None)
- plain = core.Data()
+ plain = gpg.Data()
cipher.seek(0, os.SEEK_SET)
c.op_decrypt(cipher, plain)
@@ -68,7 +67,7 @@ for passphrase in ("abc", b"abc"):
# Idiomatic interface.
for passphrase in ("abc", b"abc"):
- with pyme.Context(armor=True) as c:
+ with gpg.Context(armor=True) as c:
# Check that the passphrase callback is not altered.
def f(*args):
assert False
diff --git a/lang/python/tests/t-encrypt.py b/lang/python/tests/t-encrypt.py
index 65e7d24..0c0ca35 100755
--- a/lang/python/tests/t-encrypt.py
+++ b/lang/python/tests/t-encrypt.py
@@ -20,29 +20,28 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-import pyme
-from pyme import core, constants
+import gpg
import support
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
c.set_armor(True)
-source = core.Data("Hallo Leute\n")
-sink = core.Data()
+source = gpg.Data("Hallo Leute\n")
+sink = gpg.Data()
keys = []
keys.append(c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False))
keys.append(c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False))
-c.op_encrypt(keys, constants.ENCRYPT_ALWAYS_TRUST, source, sink)
+c.op_encrypt(keys, gpg.constants.ENCRYPT_ALWAYS_TRUST, source, sink)
result = c.op_encrypt_result()
assert not result.invalid_recipients, \
"Invalid recipients: {}".format(", ".join(r.fpr for r in result.recipients))
support.print_data(sink)
# Idiomatic interface.
-with pyme.Context(armor=True) as c:
+with gpg.Context(armor=True) as c:
ciphertext, _, _ = c.encrypt("Hallo Leute\n".encode(),
recipients=keys,
sign=False,
@@ -58,7 +57,7 @@ with pyme.Context(armor=True) as c:
c.encrypt("Hallo Leute\n".encode(),
recipients=[c.get_key(support.sign_only, False)],
sign=False, always_trust=True)
- except pyme.errors.InvalidRecipients as e:
+ except gpg.errors.InvalidRecipients as e:
assert len(e.recipients) == 1
assert support.sign_only.endswith(e.recipients[0].fpr)
else:
diff --git a/lang/python/tests/t-export.py b/lang/python/tests/t-export.py
index db36b98..4927beb 100755
--- a/lang/python/tests/t-export.py
+++ b/lang/python/tests/t-export.py
@@ -20,14 +20,14 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import core, constants
+import gpg
import support
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
c.set_armor(True)
-sink = core.Data()
+sink = gpg.Data()
c.op_export_ext(['Alpha', 'Bob'], 0, sink)
support.print_data(sink)
@@ -35,6 +35,6 @@ support.print_data(sink)
keys = []
keys.append(c.get_key("0x68697734", False)) # Alpha
keys.append(c.get_key("0xA9E3B0B2", False)) # Bob
-sink = core.Data()
+sink = gpg.Data()
c.op_export_keys(keys, 0, sink)
support.print_data(sink)
diff --git a/lang/python/tests/t-file-name.py b/lang/python/tests/t-file-name.py
index e93b120..d12afb8 100755
--- a/lang/python/tests/t-file-name.py
+++ b/lang/python/tests/t-file-name.py
@@ -21,24 +21,24 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import os
-from pyme import core, constants
+import gpg
import support
testname = "abcde12345"
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
c.set_armor(True)
-source = core.Data("Hallo Leute\n")
+source = gpg.Data("Hallo Leute\n")
source.set_file_name(testname)
-cipher = core.Data()
-plain = core.Data()
+cipher = gpg.Data()
+plain = gpg.Data()
keys = []
keys.append(c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False))
-c.op_encrypt(keys, constants.ENCRYPT_ALWAYS_TRUST, source, cipher)
+c.op_encrypt(keys, gpg.constants.ENCRYPT_ALWAYS_TRUST, source, cipher)
cipher.seek(0, os.SEEK_SET)
c.op_decrypt(cipher, plain)
result = c.op_decrypt_result()
diff --git a/lang/python/tests/t-idiomatic.py b/lang/python/tests/t-idiomatic.py
index f063206..485f048 100755
--- a/lang/python/tests/t-idiomatic.py
+++ b/lang/python/tests/t-idiomatic.py
@@ -24,13 +24,13 @@ import sys
import io
import os
import tempfile
-import pyme
+import gpg
import support
-support.init_gpgme(pyme.constants.PROTOCOL_OpenPGP)
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
# Both Context and Data can be used as context manager:
-with pyme.Context() as c, pyme.Data() as d:
+with gpg.Context() as c, gpg.Data() as d:
c.get_engine_info()
d.write(b"Halloechen")
leak_c = c
@@ -39,17 +39,17 @@ assert leak_c.wrapped == None
assert leak_d.wrapped == None
def sign_and_verify(source, signed, sink):
- with pyme.Context() as c:
- c.op_sign(source, signed, pyme.constants.SIG_MODE_NORMAL)
+ with gpg.Context() as c:
+ c.op_sign(source, signed, gpg.constants.sig.mode.NORMAL)
signed.seek(0, os.SEEK_SET)
c.op_verify(signed, None, sink)
result = c.op_verify_result()
assert len(result.signatures) == 1, "Unexpected number of signatures"
sig = result.signatures[0]
- assert sig.summary == (pyme.constants.SIGSUM_VALID |
- pyme.constants.SIGSUM_GREEN)
- assert pyme.errors.GPGMEError(sig.status).getcode() == pyme.errors.NO_ERROR
+ assert sig.summary == (gpg.constants.sigsum.VALID |
+ gpg.constants.sigsum.GREEN)
+ assert gpg.errors.GPGMEError(sig.status).getcode() == gpg.errors.NO_ERROR
sink.seek(0, os.SEEK_SET)
assert sink.read() == b"Hallo Leute\n"
@@ -80,5 +80,5 @@ if sys.version_info[0] == 3:
# Demonstrate automatic wrapping of objects implementing the buffer
# interface, and the use of data objects with the 'with' statement.
- with io.BytesIO(preallocate) as signed, pyme.Data() as sink:
+ with io.BytesIO(preallocate) as signed, gpg.Data() as sink:
sign_and_verify(b"Hallo Leute\n", signed, sink)
diff --git a/lang/python/tests/t-import.py b/lang/python/tests/t-import.py
index 0b50d02..5b0576f 100755
--- a/lang/python/tests/t-import.py
+++ b/lang/python/tests/t-import.py
@@ -20,7 +20,7 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import core, constants
+import gpg
import support
def check_result(result, fpr, secret):
@@ -67,13 +67,13 @@ def check_result(result, fpr, secret):
assert len(result.imports) == 1 or fpr == result.imports[1].fpr
assert result.imports[0].result == 0
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
-c.op_import(core.Data(file=support.make_filename("pubkey-1.asc")))
+c.op_import(gpg.Data(file=support.make_filename("pubkey-1.asc")))
result = c.op_import_result()
check_result(result, "ADAB7FCC1F4DE2616ECFA402AF82244F9CD9FD55", False)
-c.op_import(core.Data(file=support.make_filename("seckey-1.asc")))
+c.op_import(gpg.Data(file=support.make_filename("seckey-1.asc")))
result = c.op_import_result()
check_result(result, "ADAB7FCC1F4DE2616ECFA402AF82244F9CD9FD55", True)
diff --git a/lang/python/tests/t-keylist.py b/lang/python/tests/t-keylist.py
index f7f6674..ea2a724 100755
--- a/lang/python/tests/t-keylist.py
+++ b/lang/python/tests/t-keylist.py
@@ -20,12 +20,11 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-import pyme
-from pyme import core, constants
+import gpg
import support
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
# Check expration of keys. This test assumes three subkeys of which
# 2 are expired; it is used with the "Whisky" test key. It has
@@ -109,7 +108,7 @@ def check_global(key, uids, n_subkeys):
assert key.can_sign, "Key unexpectedly unusable for signing"
assert key.can_certify, "Key unexpectedly unusable for certifications"
assert not key.secret, "Key unexpectedly secret"
- assert not key.protocol != constants.PROTOCOL_OpenPGP, \
+ assert not key.protocol != gpg.constants.protocol.OpenPGP, \
"Key has unexpected protocol: {}".format(key.protocol)
assert not key.issuer_serial, \
"Key unexpectedly carries issuer serial: {}".format(key.issuer_serial)
@@ -120,10 +119,10 @@ def check_global(key, uids, n_subkeys):
# Only key Alfa is trusted
assert key.uids[0].name == 'Alfa Test' \
- or key.owner_trust == constants.VALIDITY_UNKNOWN, \
+ or key.owner_trust == gpg.constants.validity.UNKNOWN, \
"Key has unexpected owner trust: {}".format(key.owner_trust)
assert key.uids[0].name != 'Alfa Test' \
- or key.owner_trust == constants.VALIDITY_ULTIMATE, \
+ or key.owner_trust == gpg.constants.validity.ULTIMATE, \
"Key has unexpected owner trust: {}".format(key.owner_trust)
assert len(key.subkeys) - 1 == n_subkeys, \
@@ -154,8 +153,8 @@ def check_subkey(fpr, which, subkey):
assert not subkey.secret, which + " key unexpectedly secret"
assert not subkey.is_cardkey, "Public key marked as card key"
assert not subkey.card_number, "Public key with card number set"
- assert not subkey.pubkey_algo != (constants.PK_DSA if which == "Primary"
- else constants.PK_ELG_E), \
+ assert not subkey.pubkey_algo != (gpg.constants.pk.DSA if which == "Primary"
+ else gpg.constants.pk.ELG_E), \
which + " key has unexpected public key algo: {}".\
format(subkey.pubkey_algo)
assert subkey.length == 1024, \
@@ -170,10 +169,10 @@ def check_subkey(fpr, which, subkey):
def check_uid(which, ref, uid):
assert not uid.revoked, which + " user ID unexpectedly revoked"
assert not uid.invalid, which + " user ID unexpectedly invalid"
- assert uid.validity == (constants.VALIDITY_UNKNOWN
+ assert uid.validity == (gpg.constants.validity.UNKNOWN
if uid.name.split()[0]
not in {'Alfa', 'Alpha', 'Alice'} else
- constants.VALIDITY_ULTIMATE), \
+ gpg.constants.validity.ULTIMATE), \
which + " user ID has unexpectedly validity: {}".format(uid.validity)
assert not uid.signatures, which + " user ID unexpectedly signed"
assert uid.name == ref[0], \
@@ -248,7 +247,7 @@ for i, key in enumerate(c.keylist()):
# check get_key()
-with pyme.Context() as c:
+with gpg.Context() as c:
c.get_key(support.alpha)
c.get_key(support.alpha, secret=True)
@@ -263,7 +262,7 @@ with pyme.Context() as c:
# Legacy error
try:
c.get_key(support.no_such_key)
- except pyme.errors.GPGMEError:
+ except gpg.errors.GPGMEError:
pass
else:
assert False, "Expected GPGMEError"
diff --git a/lang/python/tests/t-protocol-assuan.py b/lang/python/tests/t-protocol-assuan.py
index 172c7d0..0084a6b 100755
--- a/lang/python/tests/t-protocol-assuan.py
+++ b/lang/python/tests/t-protocol-assuan.py
@@ -20,17 +20,17 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-import pyme
+import gpg
-with pyme.Context(protocol=pyme.constants.PROTOCOL_ASSUAN) as c:
+with gpg.Context(protocol=gpg.constants.protocol.ASSUAN) as c:
# Do nothing.
c.assuan_transact('nop')
c.assuan_transact('NOP')
c.assuan_transact(['NOP'])
err = c.assuan_transact('idontexist')
- assert err.getsource() == pyme.errors.SOURCE_GPGAGENT
- assert err.getcode() == pyme.errors.ASS_UNKNOWN_CMD
+ assert err.getsource() == gpg.errors.SOURCE_GPGAGENT
+ assert err.getcode() == gpg.errors.ASS_UNKNOWN_CMD
# Invoke the pinentry to get a confirmation.
c.assuan_transact(['GET_CONFIRMATION', 'Hello there'])
diff --git a/lang/python/tests/t-sig-notation.py b/lang/python/tests/t-sig-notation.py
index eb5b111..f1342b1 100755
--- a/lang/python/tests/t-sig-notation.py
+++ b/lang/python/tests/t-sig-notation.py
@@ -21,19 +21,19 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import os
-from pyme import core, constants
+import gpg
import support
expected_notations = {
- "laughing@me": ("Just Squeeze Me", constants.SIG_NOTATION_HUMAN_READABLE),
+ "laughing@me": ("Just Squeeze Me", gpg.constants.sig.notation.HUMAN_READABLE),
"preferred-email-encoding@pgp.com": ("pgpmime",
- constants.SIG_NOTATION_HUMAN_READABLE
- | constants.SIG_NOTATION_CRITICAL),
+ gpg.constants.sig.notation.HUMAN_READABLE
+ | gpg.constants.sig.notation.CRITICAL),
None: ("http://www.gnu.org/policy/", 0),
}
# GnuPG prior to 2.1.13 did not report the critical flag correctly.
-with core.Context() as c:
+with gpg.Context() as c:
version = c.engine_info.version
have_correct_sig_data = not (version.startswith("1.")
or version.startswith("2.0.")
@@ -55,26 +55,26 @@ def check_result(result):
assert r.value == value, \
"Expected {!r}, got {!r}".format(value, r.value)
assert r.human_readable \
- == bool(flags&constants.SIG_NOTATION_HUMAN_READABLE)
+ == bool(flags & gpg.constants.sig.notation.HUMAN_READABLE)
assert r.critical \
- == (bool(flags&constants.SIG_NOTATION_CRITICAL)
+ == (bool(flags & gpg.constants.sig.notation.CRITICAL)
if have_correct_sig_data else False)
assert len(expected_notations) == 0
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
-source = core.Data("Hallo Leute\n")
-signed = core.Data()
+source = gpg.Data("Hallo Leute\n")
+signed = gpg.Data()
-c = core.Context()
+c = gpg.Context()
for name, (value, flags) in expected_notations.items():
c.sig_notation_add(name, value, flags)
-c.op_sign(source, signed, constants.SIG_MODE_NORMAL)
+c.op_sign(source, signed, gpg.constants.sig.mode.NORMAL)
signed.seek(0, os.SEEK_SET)
-sink = core.Data()
+sink = gpg.Data()
c.op_verify(signed, None, sink)
result = c.op_verify_result()
check_result(result)
diff --git a/lang/python/tests/t-sign.py b/lang/python/tests/t-sign.py
index b0e211a..9418ed8 100755
--- a/lang/python/tests/t-sign.py
+++ b/lang/python/tests/t-sign.py
@@ -21,8 +21,7 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import os
-import pyme
-from pyme import core, constants
+import gpg
import support
def fail(msg):
@@ -39,11 +38,11 @@ def check_result(r, typ):
if signature.type != typ:
fail("Wrong type of signature created")
- if signature.pubkey_algo != constants.PK_DSA:
+ if signature.pubkey_algo != gpg.constants.pk.DSA:
fail("Wrong pubkey algorithm reported: {}".format(
signature.pubkey_algo))
- if signature.hash_algo != constants.MD_SHA1:
+ if signature.hash_algo != gpg.constants.md.SHA1:
fail("Wrong hash algorithm reported: {}".format(
signature.hash_algo))
@@ -55,58 +54,58 @@ def check_result(r, typ):
fail("Wrong fingerprint reported: {}".format(signature.fpr))
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
c.set_textmode(True)
c.set_armor(True)
-source = core.Data("Hallo Leute\n")
-sink = core.Data()
+source = gpg.Data("Hallo Leute\n")
+sink = gpg.Data()
-c.op_sign(source, sink, constants.SIG_MODE_NORMAL)
+c.op_sign(source, sink, gpg.constants.sig.mode.NORMAL)
result = c.op_sign_result()
-check_result(result, constants.SIG_MODE_NORMAL)
+check_result(result, gpg.constants.sig.mode.NORMAL)
support.print_data(sink)
# Now a detached signature.
source.seek(0, os.SEEK_SET)
-sink = core.Data()
+sink = gpg.Data()
-c.op_sign(source, sink, constants.SIG_MODE_DETACH)
+c.op_sign(source, sink, gpg.constants.sig.mode.DETACH)
result = c.op_sign_result()
-check_result(result, constants.SIG_MODE_DETACH)
+check_result(result, gpg.constants.sig.mode.DETACH)
support.print_data(sink)
# And finally a cleartext signature. */
source.seek(0, os.SEEK_SET)
-sink = core.Data()
+sink = gpg.Data()
-c.op_sign(source, sink, constants.SIG_MODE_CLEAR)
+c.op_sign(source, sink, gpg.constants.sig.mode.CLEAR)
result = c.op_sign_result()
-check_result(result, constants.SIG_MODE_CLEAR)
+check_result(result, gpg.constants.sig.mode.CLEAR)
support.print_data(sink)
# Idiomatic interface.
-with pyme.Context(armor=True, textmode=True) as c:
+with gpg.Context(armor=True, textmode=True) as c:
message = "Hallo Leute\n".encode()
signed, _ = c.sign(message)
assert len(signed) > 0
assert signed.find(b'BEGIN PGP MESSAGE') > 0, 'Message not found'
- signed, _ = c.sign(message, mode=pyme.constants.SIG_MODE_DETACH)
+ signed, _ = c.sign(message, mode=gpg.constants.sig.mode.DETACH)
assert len(signed) > 0
assert signed.find(b'BEGIN PGP SIGNATURE') > 0, 'Signature not found'
- signed, _ = c.sign(message, mode=pyme.constants.SIG_MODE_CLEAR)
+ signed, _ = c.sign(message, mode=gpg.constants.sig.mode.CLEAR)
assert len(signed) > 0
assert signed.find(b'BEGIN PGP SIGNED MESSAGE') > 0, 'Message not found'
assert signed.find(message) > 0, 'Message content not found'
assert signed.find(b'BEGIN PGP SIGNATURE') > 0, 'Signature not found'
-with pyme.Context() as c:
+with gpg.Context() as c:
message = "Hallo Leute\n".encode()
c.signers = [c.get_key(support.sign_only, True)]
@@ -115,7 +114,7 @@ with pyme.Context() as c:
c.signers = [c.get_key(support.encrypt_only, True)]
try:
c.sign(message)
- except pyme.errors.InvalidSigners as e:
+ except gpg.errors.InvalidSigners as e:
assert len(e.signers) == 1
assert support.encrypt_only.endswith(e.signers[0].fpr)
else:
diff --git a/lang/python/tests/t-signers.py b/lang/python/tests/t-signers.py
index 11403af..80e797c 100755
--- a/lang/python/tests/t-signers.py
+++ b/lang/python/tests/t-signers.py
@@ -20,8 +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 gpg
import support
def fail(msg):
@@ -38,11 +37,11 @@ def check_result(r, typ):
if signature.type != typ:
fail("Wrong type of signature created")
- if signature.pubkey_algo != constants.PK_DSA:
+ if signature.pubkey_algo != gpg.constants.pk.DSA:
fail("Wrong pubkey algorithm reported: {}".format(
signature.pubkey_algo))
- if signature.hash_algo != constants.MD_SHA1:
+ if signature.hash_algo != gpg.constants.md.SHA1:
fail("Wrong hash algorithm reported: {}".format(
signature.hash_algo))
@@ -55,8 +54,8 @@ def check_result(r, typ):
fail("Wrong fingerprint reported: {}".format(signature.fpr))
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
c.set_textmode(True)
c.set_armor(True)
@@ -69,10 +68,10 @@ c.op_keylist_end()
c.signers_add(keys[0])
c.signers_add(keys[1])
-for mode in (constants.SIG_MODE_NORMAL, constants.SIG_MODE_DETACH,
- constants.SIG_MODE_CLEAR):
- source = core.Data("Hallo Leute\n")
- sink = core.Data()
+for mode in (gpg.constants.sig.mode.NORMAL, gpg.constants.sig.mode.DETACH,
+ gpg.constants.sig.mode.CLEAR):
+ source = gpg.Data("Hallo Leute\n")
+ sink = gpg.Data()
c.op_sign(source, sink, mode)
@@ -81,18 +80,18 @@ for mode in (constants.SIG_MODE_NORMAL, constants.SIG_MODE_DETACH,
support.print_data(sink)
# Idiomatic interface.
-with pyme.Context(armor=True, textmode=True, signers=keys) as c:
+with gpg.Context(armor=True, textmode=True, signers=keys) as c:
message = "Hallo Leute\n".encode()
signed, result = c.sign(message)
- check_result(result, constants.SIG_MODE_NORMAL)
+ check_result(result, gpg.constants.sig.mode.NORMAL)
assert signed.find(b'BEGIN PGP MESSAGE') > 0, 'Message not found'
- signed, result = c.sign(message, mode=constants.SIG_MODE_DETACH)
- check_result(result, constants.SIG_MODE_DETACH)
+ signed, result = c.sign(message, mode=gpg.constants.sig.mode.DETACH)
+ check_result(result, gpg.constants.sig.mode.DETACH)
assert signed.find(b'BEGIN PGP SIGNATURE') > 0, 'Signature not found'
- signed, result = c.sign(message, mode=constants.SIG_MODE_CLEAR)
- check_result(result, constants.SIG_MODE_CLEAR)
+ signed, result = c.sign(message, mode=gpg.constants.sig.mode.CLEAR)
+ check_result(result, gpg.constants.sig.mode.CLEAR)
assert signed.find(b'BEGIN PGP SIGNED MESSAGE') > 0, 'Message not found'
assert signed.find(message) > 0, 'Message content not found'
assert signed.find(b'BEGIN PGP SIGNATURE') > 0, 'Signature not found'
diff --git a/lang/python/tests/t-trustlist.py b/lang/python/tests/t-trustlist.py
index 4253bd7..8c5e214 100755
--- a/lang/python/tests/t-trustlist.py
+++ b/lang/python/tests/t-trustlist.py
@@ -20,11 +20,11 @@
from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
-from pyme import core, constants
+import gpg
import support
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
def dump_item(item):
print("l={} k={} t={} o={} v={} u={}".format(
diff --git a/lang/python/tests/t-verify.py b/lang/python/tests/t-verify.py
index 39f6176..f18e1dd 100755
--- a/lang/python/tests/t-verify.py
+++ b/lang/python/tests/t-verify.py
@@ -22,8 +22,7 @@ del absolute_import, print_function, unicode_literals
import sys
import os
-import pyme
-from pyme import core, constants, errors
+import gpg
import support
test_text1 = b"Just GNU it!\n"
@@ -67,7 +66,7 @@ def check_result(result, summary, validity, fpr, status, notation):
"Unexpected signature summary: {}, want: {}".format(sig.summary,
summary)
assert sig.fpr == fpr
- assert errors.GPGMEError(sig.status).getcode() == status
+ assert gpg.errors.GPGMEError(sig.status).getcode() == status
if notation:
expected_notations = {
@@ -96,87 +95,87 @@ def check_result(result, summary, validity, fpr, status, notation):
assert sig.validity == validity, \
"Unexpected signature validity: {}, want: {}".format(
sig.validity, validity)
- assert errors.GPGMEError(sig.validity_reason).getcode() == errors.NO_ERROR
+ assert gpg.errors.GPGMEError(sig.validity_reason).getcode() == gpg.errors.NO_ERROR
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
c.set_armor(True)
# Checking a valid message.
-text = core.Data(test_text1)
-sig = core.Data(test_sig1)
+text = gpg.Data(test_text1)
+sig = gpg.Data(test_sig1)
c.op_verify(sig, text, None)
result = c.op_verify_result()
-check_result(result, constants.SIGSUM_VALID | constants.SIGSUM_GREEN,
- constants.VALIDITY_FULL,
+check_result(result, gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN,
+ gpg.constants.validity.FULL,
"A0FF4590BB6122EDEF6E3C542D727CC768697734",
- errors.NO_ERROR, True)
+ gpg.errors.NO_ERROR, True)
# Checking a manipulated message.
-text = core.Data(test_text1f)
+text = gpg.Data(test_text1f)
sig.seek(0, os.SEEK_SET)
c.op_verify(sig, text, None)
result = c.op_verify_result()
-check_result(result, constants.SIGSUM_RED, constants.VALIDITY_UNKNOWN,
- "2D727CC768697734", errors.BAD_SIGNATURE, False)
+check_result(result, gpg.constants.sigsum.RED, gpg.constants.validity.UNKNOWN,
+ "2D727CC768697734", gpg.errors.BAD_SIGNATURE, False)
# Checking a normal signature.
-text = core.Data()
-sig = core.Data(test_sig2)
+text = gpg.Data()
+sig = gpg.Data(test_sig2)
c.op_verify(sig, None, text)
result = c.op_verify_result()
-check_result(result, constants.SIGSUM_VALID | constants.SIGSUM_GREEN,
- constants.VALIDITY_FULL,
+check_result(result, gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN,
+ gpg.constants.validity.FULL,
"A0FF4590BB6122EDEF6E3C542D727CC768697734",
- errors.NO_ERROR, False)
+ gpg.errors.NO_ERROR, False)
# Checking an invalid message.
-text = core.Data()
-sig = core.Data(double_plaintext_sig)
+text = gpg.Data()
+sig = gpg.Data(double_plaintext_sig)
try:
c.op_verify(sig, None, text)
except Exception as e:
- assert type(e) == errors.GPGMEError
- assert e.getcode() == errors.BAD_DATA
+ assert type(e) == gpg.errors.GPGMEError
+ assert e.getcode() == gpg.errors.BAD_DATA
else:
assert False, "Expected an error but got none."
# Idiomatic interface.
-with pyme.Context(armor=True) as c:
+with gpg.Context(armor=True) as c:
# Checking a valid message.
_, result = c.verify(test_text1, test_sig1)
- check_result(result, constants.SIGSUM_VALID | constants.SIGSUM_GREEN,
- constants.VALIDITY_FULL,
+ check_result(result, gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN,
+ gpg.constants.validity.FULL,
"A0FF4590BB6122EDEF6E3C542D727CC768697734",
- errors.NO_ERROR, True)
+ gpg.errors.NO_ERROR, True)
# Checking a manipulated message.
try:
c.verify(test_text1f, test_sig1)
- except errors.BadSignatures as e:
- check_result(e.result, constants.SIGSUM_RED,
- constants.VALIDITY_UNKNOWN,
- "2D727CC768697734", errors.BAD_SIGNATURE, False)
+ except gpg.errors.BadSignatures as e:
+ check_result(e.result, gpg.constants.sigsum.RED,
+ gpg.constants.validity.UNKNOWN,
+ "2D727CC768697734", gpg.errors.BAD_SIGNATURE, False)
else:
assert False, "Expected an error but got none."
# Checking a normal signature.
- sig = core.Data(test_sig2)
+ sig = gpg.Data(test_sig2)
data, result = c.verify(test_sig2)
- check_result(result, constants.SIGSUM_VALID | constants.SIGSUM_GREEN,
- constants.VALIDITY_FULL,
+ check_result(result, gpg.constants.sigsum.VALID | gpg.constants.sigsum.GREEN,
+ gpg.constants.validity.FULL,
"A0FF4590BB6122EDEF6E3C542D727CC768697734",
- errors.NO_ERROR, False)
+ gpg.errors.NO_ERROR, False)
assert data == test_text1
# Checking an invalid message.
try:
c.verify(double_plaintext_sig)
- except errors.GPGMEError as e:
- assert e.getcode() == errors.BAD_DATA
+ except gpg.errors.GPGMEError as e:
+ assert e.getcode() == gpg.errors.BAD_DATA
else:
assert False, "Expected an error but got none."
@@ -188,7 +187,7 @@ with pyme.Context(armor=True) as c:
try:
c.verify(test_text1, test_sig1, verify=[alpha, bob])
- except errors.MissingSignatures as e:
+ except gpg.errors.MissingSignatures as e:
assert len(e.missing) == 1
assert e.missing[0] == bob
else:
diff --git a/lang/python/tests/t-wait.py b/lang/python/tests/t-wait.py
index b7d9a34..b1f2043 100755
--- a/lang/python/tests/t-wait.py
+++ b/lang/python/tests/t-wait.py
@@ -21,16 +21,16 @@ from __future__ import absolute_import, print_function, unicode_literals
del absolute_import, print_function, unicode_literals
import time
-from pyme import core, constants, errors
+import gpg
import support
-support.init_gpgme(constants.PROTOCOL_OpenPGP)
-c = core.Context()
+support.init_gpgme(gpg.constants.protocol.OpenPGP)
+c = gpg.Context()
c.set_armor(True)
# Checking a message without a signature.
-sig = core.Data("foo\n")
-text = core.Data()
+sig = gpg.Data("foo\n")
+text = gpg.Data()
c.op_verify_start(sig, None, text)
try:
@@ -40,6 +40,6 @@ try:
break
time.sleep(0.1)
except Exception as e:
- assert e.getcode() == errors.NO_DATA
+ assert e.getcode() == gpg.errors.NO_DATA
else:
assert False, "Expected an error, got none"
diff --git a/lang/python/tests/t-wrapper.py b/lang/python/tests/t-wrapper.py
index d260264..79f047f 100755
--- a/lang/python/tests/t-wrapper.py
+++ b/lang/python/tests/t-wrapper.py
@@ -17,9 +17,9 @@
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, see <http://www.gnu.org/licenses/>.
-from pyme import core
+import gpg
-d0 = core.Data()
+d0 = gpg.Data()
d0.seek # trigger on-demand-wrapping
assert d0.seek == d0.seek, "Generated wrapper functions are not cached"
-assert hasattr(core.Data, 'seek'), "Generated wrapper functions are not shared"
+assert hasattr(gpg.Data, 'seek'), "Generated wrapper functions are not shared"
diff --git a/lang/qt/Makefile.in b/lang/qt/Makefile.in
index d8b48d2..5c32620 100644
--- a/lang/qt/Makefile.in
+++ b/lang/qt/Makefile.in
@@ -330,6 +330,9 @@ SWIG = @SWIG@
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
diff --git a/lang/qt/doc/Makefile.in b/lang/qt/doc/Makefile.in
index d6d9ef7..c4aff43 100644
--- a/lang/qt/doc/Makefile.in
+++ b/lang/qt/doc/Makefile.in
@@ -268,6 +268,9 @@ SWIG = @SWIG@
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
diff --git a/lang/qt/src/DN b/lang/qt/src/DN
new file mode 100644
index 0000000..2697bfb
--- /dev/null
+++ b/lang/qt/src/DN
@@ -0,0 +1 @@
+#include "qgpgme/dn.h"
diff --git a/lang/qt/src/Makefile.am b/lang/qt/src/Makefile.am
index 51fe314..87e2ec2 100644
--- a/lang/qt/src/Makefile.am
+++ b/lang/qt/src/Makefile.am
@@ -19,7 +19,8 @@
# 02111-1307, USA
lib_LTLIBRARIES = libqgpgme.la
EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \
- gpgme_backend_debug.h qgpgme_version.h.in
+ gpgme_backend_debug.h qgpgme_version.h.in \
+ QGpgmeConfig.cmake.in.in
qgpgme_sources = \
dataprovider.cpp job.cpp multideletejob.cpp qgpgmeadduseridjob.cpp \
@@ -35,7 +36,8 @@ qgpgme_sources = \
qgpgmeverifyopaquejob.cpp threadedjobmixin.cpp \
qgpgmekeyformailboxjob.cpp gpgme_backend_debug.cpp \
qgpgmetofupolicyjob.cpp \
- defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp
+ defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp \
+ dn.cpp
# If you add one here make sure that you also add one in camelcase
qgpgme_headers= \
@@ -73,7 +75,8 @@ qgpgme_headers= \
verifydetachedjob.h \
defaultkeygenerationjob.h \
tofupolicyjob.h \
- wkspublishjob.h
+ wkspublishjob.h \
+ dn.h
camelcase_headers= \
AddUserIDJob \
@@ -84,6 +87,7 @@ camelcase_headers= \
DataProvider \
DecryptJob \
DecryptVerifyJob \
+ DN \
DownloadJob \
EncryptJob \
ExportJob \
@@ -203,7 +207,7 @@ qgpgmeincludedir = $(includedir)/qgpgme
qgpgmeinclude_HEADERS = $(qgpgme_headers)
camelcaseincludedir = $(includedir)/QGpgME
camelcaseinclude_HEADERS = $(camelcase_headers)
-nodist_include_HEADERS = qgpgme_version.h
+nodist_qgpgmeinclude_HEADERS = qgpgme_version.h
libqgpgme_la_SOURCES = $(qgpgme_sources) $(qgpgme_headers) $(private_qgpgme_headers)
@@ -213,19 +217,19 @@ AM_CPPFLAGS = -I$(top_srcdir)/lang/cpp/src -I$(top_builddir)/src \
libqgpgme_la_LIBADD = ../../cpp/src/libgpgmepp.la ../../../src/libgpgme.la \
@LIBASSUAN_LIBS@ @GPGME_QT_LIBS@
-libqgpgme_la_LDFLAGS = -version-info \
+libqgpgme_la_LDFLAGS = -no-undefined -version-info \
@LIBQGPGME_LT_CURRENT@:@LIBQGPGME_LT_REVISION@:@LIBQGPGME_LT_AGE@
if HAVE_W32_SYSTEM
-libsuffix=.dll.a
+QGpgmeConfig.cmake: QGpgmeConfig-w32.cmake.in
+ sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \
+ sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \
+ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
else
-libsuffix=.so
-endif
-
QGpgmeConfig.cmake: QGpgmeConfig.cmake.in
sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
- sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
+endif
$(camelcase_headers): Makefile.am
echo -n "#include \"qgpgme/" > "$@"
@@ -233,16 +237,16 @@ $(camelcase_headers): Makefile.am
echo ".h\"" >> "$@"
install-cmake-files: QGpgmeConfig.cmake QGpgmeConfigVersion.cmake
- -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp
+ -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/QGpgme
$(INSTALL) -m 644 QGpgmeConfig.cmake \
- $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfig.cmake
+ $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake
$(INSTALL) -m 644 QGpgmeConfigVersion.cmake \
- $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfigVersion.cmake
+ $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake
uninstall-cmake-files:
- -rm $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfigVersion.cmake
- -rm $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfig.cmake
- -rmdir $(DESTDIR)$(libdir)/cmake/Gpgmepp/
+ -rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake
+ -rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake
+ -rmdir $(DESTDIR)$(libdir)/cmake/QGpgme/
install-data-local: install-cmake-files
@@ -250,7 +254,9 @@ uninstall-local: uninstall-cmake-files
BUILT_SOURCES = $(qgpgme_moc_sources) $(camelcase_headers)
-CLEANFILES = $(qgpgme_moc_sources) $(camelcase_headers) QGpgmeConfig.cmake
+CLEANFILES = $(qgpgme_moc_sources) $(camelcase_headers) QGpgmeConfig.cmake \
+ qgpgme_version.h QGpgmeConfig.cmake.in \
+ QGpgmeConfigVersion.cmake
nodist_libqgpgme_la_SOURCES = $(qgpgme_moc_sources)
diff --git a/lang/qt/src/Makefile.in b/lang/qt/src/Makefile.in
index 0aa0590..5b87f6e 100644
--- a/lang/qt/src/Makefile.in
+++ b/lang/qt/src/Makefile.in
@@ -82,6 +82,7 @@ host_triplet = @host@
subdir = lang/qt/src
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/build-aux/mkinstalldirs \
+ $(srcdir)/QGpgmeConfig-w32.cmake.in.in \
$(srcdir)/QGpgmeConfig.cmake.in.in \
$(srcdir)/QGpgmeConfigVersion.cmake.in \
$(srcdir)/qgpgme_version.h.in $(top_srcdir)/build-aux/depcomp \
@@ -102,8 +103,8 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES = QGpgmeConfig.cmake.in QGpgmeConfigVersion.cmake \
- qgpgme_version.h
+CONFIG_CLEAN_FILES = QGpgmeConfig-w32.cmake.in QGpgmeConfig.cmake.in \
+ QGpgmeConfigVersion.cmake qgpgme_version.h
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
@@ -133,7 +134,8 @@ am__uninstall_files_from_dir = { \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(libdir)" \
- "$(DESTDIR)$(camelcaseincludedir)" "$(DESTDIR)$(includedir)" \
+ "$(DESTDIR)$(camelcaseincludedir)" \
+ "$(DESTDIR)$(qgpgmeincludedir)" \
"$(DESTDIR)$(qgpgmeincludedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libqgpgme_la_DEPENDENCIES = ../../cpp/src/libgpgmepp.la \
@@ -152,7 +154,7 @@ am__objects_1 = dataprovider.lo job.lo multideletejob.lo \
qgpgmeverifydetachedjob.lo qgpgmeverifyopaquejob.lo \
threadedjobmixin.lo qgpgmekeyformailboxjob.lo \
gpgme_backend_debug.lo qgpgmetofupolicyjob.lo \
- defaultkeygenerationjob.lo qgpgmewkspublishjob.lo
+ defaultkeygenerationjob.lo qgpgmewkspublishjob.lo dn.lo
am__objects_2 =
am_libqgpgme_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
$(am__objects_2)
@@ -225,7 +227,7 @@ am__can_run_installinfo = \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
-HEADERS = $(camelcaseinclude_HEADERS) $(nodist_include_HEADERS) \
+HEADERS = $(camelcaseinclude_HEADERS) $(nodist_qgpgmeinclude_HEADERS) \
$(qgpgmeinclude_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
@@ -378,6 +380,9 @@ SWIG = @SWIG@
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
@@ -461,7 +466,8 @@ top_srcdir = @top_srcdir@
# 02111-1307, USA
lib_LTLIBRARIES = libqgpgme.la
EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \
- gpgme_backend_debug.h qgpgme_version.h.in
+ gpgme_backend_debug.h qgpgme_version.h.in \
+ QGpgmeConfig.cmake.in.in
qgpgme_sources = \
dataprovider.cpp job.cpp multideletejob.cpp qgpgmeadduseridjob.cpp \
@@ -477,7 +483,8 @@ qgpgme_sources = \
qgpgmeverifyopaquejob.cpp threadedjobmixin.cpp \
qgpgmekeyformailboxjob.cpp gpgme_backend_debug.cpp \
qgpgmetofupolicyjob.cpp \
- defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp
+ defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp \
+ dn.cpp
# If you add one here make sure that you also add one in camelcase
@@ -516,7 +523,8 @@ qgpgme_headers = \
verifydetachedjob.h \
defaultkeygenerationjob.h \
tofupolicyjob.h \
- wkspublishjob.h
+ wkspublishjob.h \
+ dn.h
camelcase_headers = \
AddUserIDJob \
@@ -527,6 +535,7 @@ camelcase_headers = \
DataProvider \
DecryptJob \
DecryptVerifyJob \
+ DN \
DownloadJob \
EncryptJob \
ExportJob \
@@ -646,7 +655,7 @@ qgpgmeincludedir = $(includedir)/qgpgme
qgpgmeinclude_HEADERS = $(qgpgme_headers)
camelcaseincludedir = $(includedir)/QGpgME
camelcaseinclude_HEADERS = $(camelcase_headers)
-nodist_include_HEADERS = qgpgme_version.h
+nodist_qgpgmeinclude_HEADERS = qgpgme_version.h
libqgpgme_la_SOURCES = $(qgpgme_sources) $(qgpgme_headers) $(private_qgpgme_headers)
AM_CPPFLAGS = -I$(top_srcdir)/lang/cpp/src -I$(top_builddir)/src \
@GPGME_QT_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
@@ -655,13 +664,14 @@ AM_CPPFLAGS = -I$(top_srcdir)/lang/cpp/src -I$(top_builddir)/src \
libqgpgme_la_LIBADD = ../../cpp/src/libgpgmepp.la ../../../src/libgpgme.la \
@LIBASSUAN_LIBS@ @GPGME_QT_LIBS@
-libqgpgme_la_LDFLAGS = -version-info \
+libqgpgme_la_LDFLAGS = -no-undefined -version-info \
@LIBQGPGME_LT_CURRENT@:@LIBQGPGME_LT_REVISION@:@LIBQGPGME_LT_AGE@
-@HAVE_W32_SYSTEM_FALSE@libsuffix = .so
-@HAVE_W32_SYSTEM_TRUE@libsuffix = .dll.a
BUILT_SOURCES = $(qgpgme_moc_sources) $(camelcase_headers)
-CLEANFILES = $(qgpgme_moc_sources) $(camelcase_headers) QGpgmeConfig.cmake
+CLEANFILES = $(qgpgme_moc_sources) $(camelcase_headers) QGpgmeConfig.cmake \
+ qgpgme_version.h QGpgmeConfig.cmake.in \
+ QGpgmeConfigVersion.cmake
+
nodist_libqgpgme_la_SOURCES = $(qgpgme_moc_sources)
all: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) all-am
@@ -698,6 +708,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
+QGpgmeConfig-w32.cmake.in: $(top_builddir)/config.status $(srcdir)/QGpgmeConfig-w32.cmake.in.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
QGpgmeConfig.cmake.in: $(top_builddir)/config.status $(srcdir)/QGpgmeConfig.cmake.in.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
QGpgmeConfigVersion.cmake: $(top_builddir)/config.status $(srcdir)/QGpgmeConfigVersion.cmake.in
@@ -751,6 +763,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dataprovider.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/defaultkeygenerationjob.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dn.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@
@@ -830,27 +843,27 @@ uninstall-camelcaseincludeHEADERS:
@list='$(camelcaseinclude_HEADERS)'; test -n "$(camelcaseincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(camelcaseincludedir)'; $(am__uninstall_files_from_dir)
-install-nodist_includeHEADERS: $(nodist_include_HEADERS)
+install-nodist_qgpgmeincludeHEADERS: $(nodist_qgpgmeinclude_HEADERS)
@$(NORMAL_INSTALL)
- @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \
+ @list='$(nodist_qgpgmeinclude_HEADERS)'; test -n "$(qgpgmeincludedir)" || list=; \
if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(qgpgmeincludedir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(qgpgmeincludedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
- echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
- $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(qgpgmeincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(qgpgmeincludedir)" || exit $$?; \
done
-uninstall-nodist_includeHEADERS:
+uninstall-nodist_qgpgmeincludeHEADERS:
@$(NORMAL_UNINSTALL)
- @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \
+ @list='$(nodist_qgpgmeinclude_HEADERS)'; test -n "$(qgpgmeincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
+ dir='$(DESTDIR)$(qgpgmeincludedir)'; $(am__uninstall_files_from_dir)
install-qgpgmeincludeHEADERS: $(qgpgmeinclude_HEADERS)
@$(NORMAL_INSTALL)
@list='$(qgpgmeinclude_HEADERS)'; test -n "$(qgpgmeincludedir)" || list=; \
@@ -960,7 +973,7 @@ check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
installdirs:
- for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(camelcaseincludedir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(qgpgmeincludedir)"; do \
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(camelcaseincludedir)" "$(DESTDIR)$(qgpgmeincludedir)" "$(DESTDIR)$(qgpgmeincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: $(BUILT_SOURCES)
@@ -1020,7 +1033,8 @@ info: info-am
info-am:
install-data-am: install-camelcaseincludeHEADERS install-data-local \
- install-nodist_includeHEADERS install-qgpgmeincludeHEADERS
+ install-nodist_qgpgmeincludeHEADERS \
+ install-qgpgmeincludeHEADERS
install-dvi: install-dvi-am
@@ -1068,7 +1082,8 @@ ps-am:
uninstall-am: uninstall-camelcaseincludeHEADERS \
uninstall-libLTLIBRARIES uninstall-local \
- uninstall-nodist_includeHEADERS uninstall-qgpgmeincludeHEADERS
+ uninstall-nodist_qgpgmeincludeHEADERS \
+ uninstall-qgpgmeincludeHEADERS
.MAKE: all check install install-am install-strip
@@ -1081,21 +1096,24 @@ uninstall-am: uninstall-camelcaseincludeHEADERS \
install-data-local install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-libLTLIBRARIES install-man \
- install-nodist_includeHEADERS install-pdf install-pdf-am \
+ install-nodist_qgpgmeincludeHEADERS install-pdf install-pdf-am \
install-ps install-ps-am install-qgpgmeincludeHEADERS \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \
uninstall-camelcaseincludeHEADERS uninstall-libLTLIBRARIES \
- uninstall-local uninstall-nodist_includeHEADERS \
+ uninstall-local uninstall-nodist_qgpgmeincludeHEADERS \
uninstall-qgpgmeincludeHEADERS
-QGpgmeConfig.cmake: QGpgmeConfig.cmake.in
- sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
- sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
- sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
+@HAVE_W32_SYSTEM_TRUE@QGpgmeConfig.cmake: QGpgmeConfig-w32.cmake.in
+@HAVE_W32_SYSTEM_TRUE@ sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \
+@HAVE_W32_SYSTEM_TRUE@ sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \
+@HAVE_W32_SYSTEM_TRUE@ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
+@HAVE_W32_SYSTEM_FALSE@QGpgmeConfig.cmake: QGpgmeConfig.cmake.in
+@HAVE_W32_SYSTEM_FALSE@ sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
+@HAVE_W32_SYSTEM_FALSE@ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@
$(camelcase_headers): Makefile.am
echo -n "#include \"qgpgme/" > "$@"
@@ -1103,16 +1121,16 @@ $(camelcase_headers): Makefile.am
echo ".h\"" >> "$@"
install-cmake-files: QGpgmeConfig.cmake QGpgmeConfigVersion.cmake
- -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp
+ -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/QGpgme
$(INSTALL) -m 644 QGpgmeConfig.cmake \
- $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfig.cmake
+ $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake
$(INSTALL) -m 644 QGpgmeConfigVersion.cmake \
- $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfigVersion.cmake
+ $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake
uninstall-cmake-files:
- -rm $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfigVersion.cmake
- -rm $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfig.cmake
- -rmdir $(DESTDIR)$(libdir)/cmake/Gpgmepp/
+ -rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake
+ -rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake
+ -rmdir $(DESTDIR)$(libdir)/cmake/QGpgme/
install-data-local: install-cmake-files
diff --git a/lang/qt/src/QGpgmeConfig-w32.cmake.in.in b/lang/qt/src/QGpgmeConfig-w32.cmake.in.in
new file mode 100644
index 0000000..b897805
--- /dev/null
+++ b/lang/qt/src/QGpgmeConfig-w32.cmake.in.in
@@ -0,0 +1,105 @@
+# CMake Config file for QGPGME.
+# Copyright (C) 2016 Intevation GmbH
+#
+# This file is part of GPGME.
+#
+# GPGME-CL 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.
+#
+# GPGME-CL 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 Lesser 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., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA
+
+# based on a generated file from cmake.
+# Generated by CMake 3.0.2
+
+if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.5)
+ message(FATAL_ERROR "CMake >= 2.6.0 required")
+endif()
+cmake_policy(PUSH)
+cmake_policy(VERSION 2.6)
+#----------------------------------------------------------------
+# Generated CMake target import file.
+#----------------------------------------------------------------
+
+# Commands may need to know the format version.
+set(CMAKE_IMPORT_FILE_VERSION 1)
+
+# Protect against multiple inclusion, which would fail when already imported targets are added once more.
+set(_targetsDefined)
+set(_targetsNotDefined)
+set(_expectedTargets)
+foreach(_expectedTarget QGpgme)
+ list(APPEND _expectedTargets ${_expectedTarget})
+ if(NOT TARGET ${_expectedTarget})
+ list(APPEND _targetsNotDefined ${_expectedTarget})
+ endif()
+ if(TARGET ${_expectedTarget})
+ list(APPEND _targetsDefined ${_expectedTarget})
+ endif()
+endforeach()
+if("${_targetsDefined}" STREQUAL "${_expectedTargets}")
+ set(CMAKE_IMPORT_FILE_VERSION)
+ cmake_policy(POP)
+ return()
+endif()
+if(NOT "${_targetsDefined}" STREQUAL "")
+ message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_targetsDefined}\nTargets not yet defined: ${_targetsNotDefined}\n")
+endif()
+unset(_targetsDefined)
+unset(_targetsNotDefined)
+unset(_expectedTargets)
+
+# Create imported target QGpgme
+add_library(QGpgme SHARED IMPORTED)
+
+set_target_properties(QGpgme PROPERTIES
+ IMPORTED_IMPLIB_RELEASE "@resolved_libdir@/libqgpgme.dll.a"
+ INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/qgpgme;@resolved_includedir@"
+ INTERFACE_LINK_LIBRARIES "Gpgmepp;Qt5::Core"
+ IMPORTED_LOCATION "@resolved_libdir@/libqgpgme-7.dll"
+)
+
+list(APPEND _IMPORT_CHECK_TARGETS QGgpme )
+list(APPEND _IMPORT_CHECK_FILES_FOR_Qgpgme "@resolved_libdir@/libqgpgme.dll.a" "@resolved_bindir@/libqgpgme-7.dll" )
+
+if(CMAKE_VERSION VERSION_LESS 2.8.12)
+ message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.")
+endif()
+
+# Loop over all imported files and verify that they actually exist
+foreach(target ${_IMPORT_CHECK_TARGETS} )
+ foreach(file ${_IMPORT_CHECK_FILES_FOR_${target}} )
+ if(NOT EXISTS "${file}" )
+ message(FATAL_ERROR "The imported target \"${target}\" references the file
+ \"${file}\"
+but this file does not exist. Possible reasons include:
+* The file was deleted, renamed, or moved to another location.
+* An install or uninstall procedure did not complete successfully.
+* The installation package was faulty and contained
+ \"${CMAKE_CURRENT_LIST_FILE}\"
+but not all the files it references.
+")
+ endif()
+ endforeach()
+ unset(_IMPORT_CHECK_FILES_FOR_${target})
+endforeach()
+unset(_IMPORT_CHECK_TARGETS)
+
+# This file does not depend on other imported targets which have
+# been exported from the same project but in a separate export set.
+
+# Commands beyond this point should not need to know the version.
+set(CMAKE_IMPORT_FILE_VERSION)
+cmake_policy(POP)
+
+# Gpgmepp is a requirement for qgpgme
+find_package(Gpgmepp CONFIG REQUIRED)
diff --git a/lang/qt/src/QGpgmeConfig.cmake.in.in b/lang/qt/src/QGpgmeConfig.cmake.in.in
index 5b6c188..88ed242 100644
--- a/lang/qt/src/QGpgmeConfig.cmake.in.in
+++ b/lang/qt/src/QGpgmeConfig.cmake.in.in
@@ -64,7 +64,7 @@ add_library(QGpgme SHARED IMPORTED)
set_target_properties(QGpgme PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/qgpgme;@resolved_includedir@"
INTERFACE_LINK_LIBRARIES "Gpgmepp;Qt5::Core"
- IMPORTED_LOCATION "@resolved_libdir@/libqgpgme@libsuffix@"
+ IMPORTED_LOCATION "@resolved_libdir@/libqgpgme.so"
)
if(CMAKE_VERSION VERSION_LESS 2.8.12)
@@ -96,3 +96,6 @@ unset(_IMPORT_CHECK_TARGETS)
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
cmake_policy(POP)
+
+# Gpgmepp is a requirement for qgpgme
+find_package(Gpgmepp CONFIG REQUIRED)
diff --git a/lang/qt/src/QGpgmeConfigVersion.cmake.in b/lang/qt/src/QGpgmeConfigVersion.cmake.in
index 04a12cb..549a536 100644
--- a/lang/qt/src/QGpgmeConfigVersion.cmake.in
+++ b/lang/qt/src/QGpgmeConfigVersion.cmake.in
@@ -19,7 +19,7 @@
# 02111-1307, USA
# based on a generated file from cmake.
-set(PACKAGE_VERSION "@LIBQGPGME_LT_CURRENT@.@LIBQGPGME_LT_AGE@.@LIBQGPGME_LT_REVISION@.@BUILD_REVISION@")
+set(PACKAGE_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_MICRO@")
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
set(PACKAGE_VERSION_COMPATIBLE FALSE)
diff --git a/lang/qt/src/defaultkeygenerationjob.cpp b/lang/qt/src/defaultkeygenerationjob.cpp
index d26e824..020f4d2 100644
--- a/lang/qt/src/defaultkeygenerationjob.cpp
+++ b/lang/qt/src/defaultkeygenerationjob.cpp
@@ -105,11 +105,11 @@ GpgME::Error DefaultKeyGenerationJob::start(const QString &email, const QString
d->job = openpgp()->keyGenerationJob();
d->job->installEventFilter(this);
- connect(d->job, &KeyGenerationJob::result,
+ connect(d->job.data(), &KeyGenerationJob::result,
this, &DefaultKeyGenerationJob::result);
- connect(d->job, &KeyGenerationJob::done,
+ connect(d->job.data(), &KeyGenerationJob::done,
this, &DefaultKeyGenerationJob::done);
- connect(d->job, &KeyGenerationJob::done,
+ connect(d->job.data(), &KeyGenerationJob::done,
this, &QObject::deleteLater);
return d->job->start(args);
}
diff --git a/lang/qt/src/dn.cpp b/lang/qt/src/dn.cpp
new file mode 100644
index 0000000..0f81a4c
--- /dev/null
+++ b/lang/qt/src/dn.cpp
@@ -0,0 +1,495 @@
+/*
+ dn.cpp
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2004 Klarälvdalens Datakonsult AB
+ 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 "dn.h"
+
+static const struct {
+ const char *name;
+ const char *oid;
+} oidmap[] = {
+ // keep them ordered by oid:
+ { "SP", "ST" }, // hack to show the Sphinx-required/desired SP for
+ // StateOrProvince, otherwise known as ST or even S
+ { "NameDistinguisher", "0.2.262.1.10.7.20" },
+ { "EMAIL", "1.2.840.113549.1.9.1" },
+ { "SN", "2.5.4.4" },
+ { "SerialNumber", "2.5.4.5" },
+ { "T", "2.5.4.12" },
+ { "D", "2.5.4.13" },
+ { "BC", "2.5.4.15" },
+ { "ADDR", "2.5.4.16" },
+ { "PC", "2.5.4.17" },
+ { "GN", "2.5.4.42" },
+ { "Pseudo", "2.5.4.65" },
+};
+static const unsigned int numOidMaps = sizeof oidmap / sizeof * oidmap;
+
+class QGpgME::DN::Private
+{
+public:
+ Private() : mRefCount(0) {}
+ Private(const Private &other)
+ : attributes(other.attributes),
+ reorderedAttributes(other.reorderedAttributes),
+ order{"CN", "L", "_X_", "OU", "O", "C"},
+ mRefCount(0)
+ {
+ }
+
+ int ref()
+ {
+ return ++mRefCount;
+ }
+
+ int unref()
+ {
+ if (--mRefCount <= 0) {
+ delete this;
+ return 0;
+ } else {
+ return mRefCount;
+ }
+ }
+
+ int refCount() const
+ {
+ return mRefCount;
+ }
+
+ DN::Attribute::List attributes;
+ DN::Attribute::List reorderedAttributes;
+ QStringList order;
+private:
+ int mRefCount;
+};
+
+namespace
+{
+struct DnPair {
+ char *key;
+ char *value;
+};
+}
+
+// copied from CryptPlug and adapted to work on DN::Attribute::List:
+
+#define digitp(p) (*(p) >= '0' && *(p) <= '9')
+#define hexdigitp(a) (digitp (a) \
+ || (*(a) >= 'A' && *(a) <= 'F') \
+ || (*(a) >= 'a' && *(a) <= 'f'))
+#define xtoi_1(p) (*(p) <= '9'? (*(p)- '0'): \
+ *(p) <= 'F'? (*(p)-'A'+10):(*(p)-'a'+10))
+#define xtoi_2(p) ((xtoi_1(p) * 16) + xtoi_1((p)+1))
+
+static char *
+trim_trailing_spaces(char *string)
+{
+ char *p, *mark;
+
+ for (mark = NULL, p = string; *p; p++) {
+ if (isspace(*p)) {
+ if (!mark) {
+ mark = p;
+ }
+ } else {
+ mark = NULL;
+ }
+ }
+ if (mark) {
+ *mark = '\0';
+ }
+
+ return string;
+}
+
+/* Parse a DN and return an array-ized one. This is not a validating
+ parser and it does not support any old-stylish syntax; gpgme is
+ expected to return only rfc2253 compatible strings. */
+static const unsigned char *
+parse_dn_part(DnPair *array, const unsigned char *string)
+{
+ const unsigned char *s, *s1;
+ size_t n;
+ char *p;
+
+ /* parse attributeType */
+ for (s = string + 1; *s && *s != '='; s++)
+ ;
+ if (!*s) {
+ return NULL; /* error */
+ }
+ n = s - string;
+ if (!n) {
+ return NULL; /* empty key */
+ }
+ p = (char *)malloc(n + 1);
+
+ memcpy(p, string, n);
+ p[n] = 0;
+ trim_trailing_spaces((char *)p);
+ // map OIDs to their names:
+ for (unsigned int i = 0; i < numOidMaps; ++i)
+ if (!strcasecmp((char *)p, oidmap[i].oid)) {
+ free(p);
+ p = strdup(oidmap[i].name);
+ break;
+ }
+ array->key = p;
+ string = s + 1;
+
+ if (*string == '#') {
+ /* hexstring */
+ string++;
+ for (s = string; hexdigitp(s); s++) {
+ s++;
+ }
+ n = s - string;
+ if (!n || (n & 1)) {
+ return NULL; /* empty or odd number of digits */
+ }
+ n /= 2;
+ array->value = p = (char *)malloc(n + 1);
+
+ for (s1 = string; n; s1 += 2, n--) {
+ *p++ = xtoi_2(s1);
+ }
+ *p = 0;
+ } else {
+ /* regular v3 quoted string */
+ for (n = 0, s = string; *s; s++) {
+ if (*s == '\\') {
+ /* pair */
+ s++;
+ if (*s == ',' || *s == '=' || *s == '+'
+ || *s == '<' || *s == '>' || *s == '#' || *s == ';'
+ || *s == '\\' || *s == '\"' || *s == ' ') {
+ n++;
+ } else if (hexdigitp(s) && hexdigitp(s + 1)) {
+ s++;
+ n++;
+ } else {
+ return NULL; /* invalid escape sequence */
+ }
+ } else if (*s == '\"') {
+ return NULL; /* invalid encoding */
+ } else if (*s == ',' || *s == '=' || *s == '+'
+ || *s == '<' || *s == '>' || *s == '#' || *s == ';') {
+ break;
+ } else {
+ n++;
+ }
+ }
+
+ array->value = p = (char *)malloc(n + 1);
+
+ for (s = string; n; s++, n--) {
+ if (*s == '\\') {
+ s++;
+ if (hexdigitp(s)) {
+ *p++ = xtoi_2(s);
+ s++;
+ } else {
+ *p++ = *s;
+ }
+ } else {
+ *p++ = *s;
+ }
+ }
+ *p = 0;
+ }
+ return s;
+}
+
+/* Parse a DN and return an array-ized one. This is not a validating
+ parser and it does not support any old-stylish syntax; gpgme is
+ expected to return only rfc2253 compatible strings. */
+static QGpgME::DN::Attribute::List
+parse_dn(const unsigned char *string)
+{
+ if (!string) {
+ return QVector<QGpgME::DN::Attribute>();
+ }
+
+ QVector<QGpgME::DN::Attribute> result;
+ while (*string) {
+ while (*string == ' ') {
+ string++;
+ }
+ if (!*string) {
+ break; /* ready */
+ }
+
+ DnPair pair = { 0, 0 };
+ string = parse_dn_part(&pair, string);
+ if (!string) {
+ goto failure;
+ }
+ if (pair.key && pair.value)
+ result.push_back(QGpgME::DN::Attribute(QString::fromUtf8(pair.key),
+ QString::fromUtf8(pair.value)));
+ free(pair.key);
+ free(pair.value);
+
+ while (*string == ' ') {
+ string++;
+ }
+ if (*string && *string != ',' && *string != ';' && *string != '+') {
+ goto failure; /* invalid delimiter */
+ }
+ if (*string) {
+ string++;
+ }
+ }
+ return result;
+
+failure:
+ return QVector<QGpgME::DN::Attribute>();
+}
+
+static QVector<QGpgME::DN::Attribute>
+parse_dn(const QString &dn)
+{
+ return parse_dn((const unsigned char *)dn.toUtf8().data());
+}
+
+static QString dn_escape(const QString &s)
+{
+ QString result;
+ for (unsigned int i = 0, end = s.length(); i != end; ++i) {
+ const QChar ch = s[i];
+ switch (ch.unicode()) {
+ case ',':
+ case '+':
+ case '"':
+ case '\\':
+ case '<':
+ case '>':
+ case ';':
+ result += QLatin1Char('\\');
+ // fall through
+ default:
+ result += ch;
+ }
+ }
+ return result;
+}
+
+static QString
+serialise(const QVector<QGpgME::DN::Attribute> &dn, const QString &sep)
+{
+ QStringList result;
+ for (QVector<QGpgME::DN::Attribute>::const_iterator it = dn.begin(); it != dn.end(); ++it)
+ if (!(*it).name().isEmpty() && !(*it).value().isEmpty()) {
+ result.push_back((*it).name().trimmed() + QLatin1Char('=') + dn_escape((*it).value().trimmed()));
+ }
+ return result.join(sep);
+}
+
+static QGpgME::DN::Attribute::List
+reorder_dn(const QGpgME::DN::Attribute::List &dn, const QStringList &attrOrder)
+{
+ QGpgME::DN::Attribute::List unknownEntries;
+ QGpgME::DN::Attribute::List result;
+ unknownEntries.reserve(dn.size());
+ result.reserve(dn.size());
+
+ // find all unknown entries in their order of appearance
+ for (QGpgME::DN::const_iterator it = dn.begin(); it != dn.end(); ++it)
+ if (!attrOrder.contains((*it).name())) {
+ unknownEntries.push_back(*it);
+ }
+
+ // process the known attrs in the desired order
+ for (QStringList::const_iterator oit = attrOrder.begin(); oit != attrOrder.end(); ++oit)
+ if (*oit == QLatin1String("_X_")) {
+ // insert the unknown attrs
+ std::copy(unknownEntries.begin(), unknownEntries.end(),
+ std::back_inserter(result));
+ unknownEntries.clear(); // don't produce dup's
+ } else {
+ for (QGpgME::DN::const_iterator dnit = dn.begin(); dnit != dn.end(); ++dnit)
+ if ((*dnit).name() == *oit) {
+ result.push_back(*dnit);
+ }
+ }
+
+ return result;
+}
+
+//
+//
+// class DN
+//
+//
+
+QGpgME::DN::DN()
+{
+ d = new Private();
+ d->ref();
+}
+
+QGpgME::DN::DN(const QString &dn)
+{
+ d = new Private();
+ d->ref();
+ d->attributes = parse_dn(dn);
+}
+
+QGpgME::DN::DN(const char *utf8DN)
+{
+ d = new Private();
+ d->ref();
+ if (utf8DN) {
+ d->attributes = parse_dn((const unsigned char *)utf8DN);
+ }
+}
+
+QGpgME::DN::DN(const DN &other)
+ : d(other.d)
+{
+ if (d) {
+ d->ref();
+ }
+}
+
+QGpgME::DN::~DN()
+{
+ if (d) {
+ d->unref();
+ }
+}
+
+const QGpgME::DN &QGpgME::DN::operator=(const DN &that)
+{
+ if (this->d == that.d) {
+ return *this;
+ }
+
+ if (that.d) {
+ that.d->ref();
+ }
+ if (this->d) {
+ this->d->unref();
+ }
+
+ this->d = that.d;
+
+ return *this;
+}
+
+QString QGpgME::DN::prettyDN() const
+{
+ if (!d) {
+ return QString();
+ }
+ if (d->reorderedAttributes.empty()) {
+ d->reorderedAttributes = reorder_dn(d->attributes, d->order);
+ }
+ return serialise(d->reorderedAttributes, QStringLiteral(","));
+}
+
+QString QGpgME::DN::dn() const
+{
+ return d ? serialise(d->attributes, QStringLiteral(",")) : QString();
+}
+
+QString QGpgME::DN::dn(const QString &sep) const
+{
+ return d ? serialise(d->attributes, sep) : QString();
+}
+
+// static
+QString QGpgME::DN::escape(const QString &value)
+{
+ return dn_escape(value);
+}
+
+void QGpgME::DN::detach()
+{
+ if (!d) {
+ d = new QGpgME::DN::Private();
+ d->ref();
+ } else if (d->refCount() > 1) {
+ QGpgME::DN::Private *d_save = d;
+ d = new QGpgME::DN::Private(*d);
+ d->ref();
+ d_save->unref();
+ }
+}
+
+void QGpgME::DN::append(const Attribute &attr)
+{
+ detach();
+ d->attributes.push_back(attr);
+ d->reorderedAttributes.clear();
+}
+
+QString QGpgME::DN::operator[](const QString &attr) const
+{
+ if (!d) {
+ return QString();
+ }
+ const QString attrUpper = attr.toUpper();
+ for (QVector<Attribute>::const_iterator it = d->attributes.constBegin();
+ it != d->attributes.constEnd(); ++it)
+ if ((*it).name() == attrUpper) {
+ return (*it).value();
+ }
+ return QString();
+}
+
+static QVector<QGpgME::DN::Attribute> empty;
+
+QGpgME::DN::const_iterator QGpgME::DN::begin() const
+{
+ return d ? d->attributes.constBegin() : empty.constBegin();
+}
+
+QGpgME::DN::const_iterator QGpgME::DN::end() const
+{
+ return d ? d->attributes.constEnd() : empty.constEnd();
+}
+
+void QGpgME::DN::setAttributeOrder (const QStringList &order) const
+{
+ d->order = order;
+}
+
+const QStringList & QGpgME::DN::attributeOrder () const
+{
+ return d->order;
+}
diff --git a/lang/qt/src/dn.h b/lang/qt/src/dn.h
new file mode 100644
index 0000000..17b1c30
--- /dev/null
+++ b/lang/qt/src/dn.h
@@ -0,0 +1,136 @@
+/*
+ dn.h
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2004 Klarälvdalens Datakonsult AB
+ 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.
+*/
+#ifndef QGPGME_DN_H
+#define QGPGME_DN_H
+
+#include "qgpgme_export.h"
+
+#include <QString>
+#include <QStringList>
+
+#include <QVector>
+
+namespace QGpgME
+{
+
+/**
+ @short DN parser and reorderer
+*/
+class QGPGME_EXPORT DN
+{
+public:
+ class Attribute;
+ typedef QVector<Attribute> AttributeList;
+ typedef AttributeList::const_iterator const_iterator;
+
+ DN();
+ explicit DN(const QString &dn);
+ explicit DN(const char *utf8DN);
+ DN(const DN &other);
+ ~DN();
+
+ const DN &operator=(const DN &other);
+
+ /** @return the value in rfc-2253-escaped form */
+ static QString escape(const QString &value);
+
+ /** @return the DN in a reordered form, according to the settings in
+ the [DN] group of the application's config file */
+ QString prettyDN() const;
+ /** @return the DN in the original form */
+ QString dn() const;
+ /**
+ \overload
+ Uses \a sep as separator (default: ,)
+ */
+ QString dn(const QString &sep) const;
+
+ QString operator[](const QString &attr) const;
+
+ void append(const Attribute &attr);
+
+ const_iterator begin() const;
+ const_iterator end() const;
+
+ /** Set the order in which prettyDN will reorder the Attirbutes. */
+ void setAttributeOrder(const QStringList &order) const;
+
+ /** Get the used attribute order. */
+ const QStringList & attributeOrder() const;
+
+private:
+ void detach();
+private:
+ class Private;
+ Private *d;
+};
+
+class QGPGME_EXPORT DN::Attribute
+{
+public:
+ typedef DN::AttributeList List;
+
+ explicit Attribute(const QString &name = QString(), const QString &value = QString())
+ : mName(name.toUpper()), mValue(value) {}
+ Attribute(const Attribute &other)
+ : mName(other.name()), mValue(other.value()) {}
+
+ const Attribute &operator=(const Attribute &other)
+ {
+ if (this != &other) {
+ mName = other.name();
+ mValue = other.value();
+ }
+ return *this;
+ }
+
+ const QString &name() const
+ {
+ return mName;
+ }
+ const QString &value() const
+ {
+ return mValue;
+ }
+
+ void setValue(const QString &value)
+ {
+ mValue = value;
+ }
+
+private:
+ QString mName;
+ QString mValue;
+};
+} // namespace QGpgME
+#endif // QGPGME_DN_H
diff --git a/lang/qt/src/job.cpp b/lang/qt/src/job.cpp
index 38dbc99..9ae3f31 100644
--- a/lang/qt/src/job.cpp
+++ b/lang/qt/src/job.cpp
@@ -62,6 +62,7 @@
#include "keyformailboxjob.h"
#include "wkspublishjob.h"
#include "tofupolicyjob.h"
+#include "threadedjobmixin.h"
#include <QCoreApplication>
#include <QDebug>
@@ -78,7 +79,6 @@ QGpgME::Job::Job(QObject *parent)
QGpgME::Job::~Job()
{
-
}
QString QGpgME::Job::auditLogAsHtml() const
@@ -98,6 +98,14 @@ bool QGpgME::Job::isAuditLogSupported() const
return auditLogError().code() != GPG_ERR_NOT_IMPLEMENTED;
}
+QMap <QGpgME::Job *, GpgME::Context *> QGpgME::g_context_map;
+
+/* static */
+GpgME::Context *QGpgME::Job::context(QGpgME::Job *job)
+{
+ return QGpgME::g_context_map.value (job, nullptr);
+}
+
#define make_job_subclass_ext(x,y) \
QGpgME::x::x( QObject * parent ) : y( parent ) {} \
QGpgME::x::~x() {}
diff --git a/lang/qt/src/job.h b/lang/qt/src/job.h
index 5767729..a0c0285 100644
--- a/lang/qt/src/job.h
+++ b/lang/qt/src/job.h
@@ -38,6 +38,7 @@
#include <QObject>
#include <QString>
+#include <QMap>
#ifdef BUILDING_QGPGME
# include "error.h"
@@ -79,6 +80,20 @@ public:
virtual GpgME::Error auditLogError() const;
bool isAuditLogSupported() const;
+ /** Get the underlying context to set some additional options for a job.
+ *
+ * This is intended to provide more flexibility on configuring jobs before
+ * they are started.
+ * The context is still owned by the thread, do not delete it.
+ *
+ * This is a static method that takes the job as argument.
+ *
+ * This function may not be called for running jobs.
+ *
+ * @returns the context used by the job job or null.
+ */
+ static GpgME::Context *context(Job *job);
+
public Q_SLOTS:
virtual void slotCancel() = 0;
@@ -87,6 +102,7 @@ Q_SIGNALS:
void done();
};
+extern QMap <Job *, GpgME::Context *> g_context_map;
}
#endif // __KLEO_JOB_H__
diff --git a/lang/qt/src/qgpgme_export.h b/lang/qt/src/qgpgme_export.h
index ceb3888..48296f7 100644
--- a/lang/qt/src/qgpgme_export.h
+++ b/lang/qt/src/qgpgme_export.h
@@ -1,22 +1,32 @@
-/*qgpgme_export.h - Export macros for qgpgme
- Copyright (C) 2016, Intevation GmbH
+/* qgpgme_export.h - Export macros for qgpgme
- This file is part of GPGME++.
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2016 Intevation GmbH
- GPGME++ is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library 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 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.
- GPGME++ 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 Library General Public License for more details.
+ 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 Library General Public License
- along with GPGME++; see the file COPYING.LIB. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ 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.
*/
#ifndef QGPGME_EXPORT_H
diff --git a/lang/qt/src/qgpgme_version.h.in b/lang/qt/src/qgpgme_version.h.in
index 9fbe965..1bc5694 100644
--- a/lang/qt/src/qgpgme_version.h.in
+++ b/lang/qt/src/qgpgme_version.h.in
@@ -1,32 +1,42 @@
-/*qgpgme_version.h - Version macros for qgpgme
- Copyright (C) 2016, Intevation GmbH
-
- This file is part of GPGME++.
-
- GPGME++ is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- GPGME++ 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 Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with GPGME++; see the file COPYING.LIB. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+/* qgpgme_version.h - Version macros for qgpgme
+
+ 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.
*/
#ifndef QGPGME_VERSION_H
#define QGPGME_VERSION_H
-#define QGPGME_VERSION_STRING "@LIBQGPGME_LT_CURRENT@.@LIBQGPGME_LT_AGE@.@LIBQGPGME_LT_REVISION@"
-#define QGPGME_VERSION_MAJOR @LIBQGPGME_LT_CURRENT@
-#define QGPGME_VERSION_MINOR @LIBQGPGME_LT_AGE@
-#define QGPGME_VERSION_PATCH @LIBQGPGME_LT_REVISION@
-#define QGPGME_VERSION ((@LIBQGPGME_LT_CURRENT@<<16)|(@LIBQGPGME_LT_AGE@<<8)|(@LIBQGPGME_LT_REVISION@))
+#define QGPGME_VERSION_STRING "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_MICRO@"
+#define QGPGME_VERSION_MAJOR @VERSION_MAJOR@
+#define QGPGME_VERSION_MINOR @VERSION_MINOR@
+#define QGPGME_VERSION_PATCH @VERSION_MICRO@
+#define QGPGME_VERSION ((@VERSION_MAJOR@<<16)|(@VERSION_MINOR@<<8)|(@VERSION_MICRO@))
#endif
diff --git a/lang/qt/src/threadedjobmixin.h b/lang/qt/src/threadedjobmixin.h
index d1b1043..32b23db 100644
--- a/lang/qt/src/threadedjobmixin.h
+++ b/lang/qt/src/threadedjobmixin.h
@@ -48,6 +48,7 @@
# include <gpgme++/interfaces/progressprovider.h>
#endif
+#include "job.h"
#include <cassert>
@@ -147,14 +148,20 @@ protected:
explicit ThreadedJobMixin(GpgME::Context *ctx)
: T_base(0), m_ctx(ctx), m_thread(), m_auditLog(), m_auditLogError()
{
-
}
void lateInitialization()
{
assert(m_ctx);
- QObject::connect(&m_thread, SIGNAL(finished()), this, SLOT(slotFinished()));
+ QObject::connect(&m_thread, &QThread::finished, this,
+ &mixin_type::slotFinished);
m_ctx->setProgressProvider(this);
+ QGpgME::g_context_map.insert(this, m_ctx.get());
+ }
+
+ ~ThreadedJobMixin()
+ {
+ QGpgME::g_context_map.remove(this);
}
template <typename T_binder>
diff --git a/lang/qt/src/wkspublishjob.h b/lang/qt/src/wkspublishjob.h
index 0cec630..b17cba4 100644
--- a/lang/qt/src/wkspublishjob.h
+++ b/lang/qt/src/wkspublishjob.h
@@ -47,6 +47,15 @@ namespace QGpgME {
*
* Remember that after a result is emitted the job is auto deleted
* so you can only use it for a single action.
+ *
+ * The workflow is to call startCreate, check for errors and then
+ * send the RFC822 mail returned in returnedData.
+ *
+ * When the response is received start a startRecieve with the
+ * RFC822 mail received as paramater response. Check for errors
+ * and then send again send the result from returnedData back to
+ * the server.
+ *
*/
class QGPGME_EXPORT WKSPublishJob: public Job
{
@@ -69,16 +78,16 @@ public:
virtual void startCheck(const QString &mailbox) = 0;
/** Create a publish request.
- * The returned Data from the result will contain
- * the full Mail as returned by gpg-wks-client --create
+ * The returnedData from the result signal will contain
+ * the full Request as returned by gpg-wks-client --create
*
* @param fpr the fingerprint of the key to create the request for.
* @param mailbox A simple mail address without a Name.
*/
virtual void startCreate(const char *fpr, const QString &mailbox) = 0;
- /** Handle a submisson response. The returned Data will contain
- * the full Mail as returned by gpg-wks-client --create
+ /** Handle a submisson response. The returnedData in the result singnal
+ * will contain the confirmation response as returned by gpg-wks-client --receive
*
* @param response The response of the server.
**/
diff --git a/lang/qt/tests/Makefile.in b/lang/qt/tests/Makefile.in
index 5149a08..e0ac22e 100644
--- a/lang/qt/tests/Makefile.in
+++ b/lang/qt/tests/Makefile.in
@@ -413,6 +413,9 @@ SWIG = @SWIG@
SWIG_LIB = @SWIG_LIB@
SYSROOT = @SYSROOT@
VERSION = @VERSION@
+VERSION_MAJOR = @VERSION_MAJOR@
+VERSION_MICRO = @VERSION_MICRO@
+VERSION_MINOR = @VERSION_MINOR@
VERSION_NUMBER = @VERSION_NUMBER@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
diff --git a/lang/qt/tests/t-tofuinfo.cpp b/lang/qt/tests/t-tofuinfo.cpp
index 2c87e4a..f89e1c2 100644
--- a/lang/qt/tests/t-tofuinfo.cpp
+++ b/lang/qt/tests/t-tofuinfo.cpp
@@ -152,6 +152,10 @@ private Q_SLOTS:
const QByteArray data1(testMsg1);
QByteArray plaintext;
+ auto ctx = Job::context(job);
+ Q_ASSERT(ctx);
+ ctx->setSender("alfa@example.net");
+
auto result = job->exec(data1, plaintext);
delete job;