summaryrefslogtreecommitdiff
path: root/lang/qt/src
diff options
context:
space:
mode:
Diffstat (limited to 'lang/qt/src')
-rw-r--r--lang/qt/src/Makefile.am23
-rw-r--r--lang/qt/src/Makefile.in62
-rw-r--r--lang/qt/src/RevokeKeyJob1
-rw-r--r--lang/qt/src/SetPrimaryUserIDJob1
-rw-r--r--lang/qt/src/decryptjob.h2
-rw-r--r--lang/qt/src/decryptverifyjob.h2
-rw-r--r--lang/qt/src/downloadjob.h2
-rw-r--r--lang/qt/src/encryptjob.cpp61
-rw-r--r--lang/qt/src/encryptjob.h7
-rw-r--r--lang/qt/src/exportjob.h3
-rw-r--r--lang/qt/src/gpgcardjob.h18
-rw-r--r--lang/qt/src/job.cpp6
-rw-r--r--lang/qt/src/keyformailboxjob.h10
-rw-r--r--lang/qt/src/keylistjob.h6
-rw-r--r--lang/qt/src/protocol.h16
-rw-r--r--lang/qt/src/protocol_p.h35
-rw-r--r--lang/qt/src/qgpgmedecryptverifyjob.cpp8
-rw-r--r--lang/qt/src/qgpgmeencryptjob.cpp25
-rw-r--r--lang/qt/src/qgpgmekeyformailboxjob.cpp2
-rw-r--r--lang/qt/src/qgpgmerefreshsmimekeysjob.cpp (renamed from lang/qt/src/qgpgmerefreshkeysjob.cpp)61
-rw-r--r--lang/qt/src/qgpgmerefreshsmimekeysjob.h (renamed from lang/qt/src/qgpgmerefreshkeysjob.h)17
-rw-r--r--lang/qt/src/qgpgmerevokekeyjob.cpp128
-rw-r--r--lang/qt/src/qgpgmerevokekeyjob.h70
-rw-r--r--lang/qt/src/qgpgmesetprimaryuseridjob.cpp75
-rw-r--r--lang/qt/src/qgpgmesetprimaryuseridjob.h64
-rw-r--r--lang/qt/src/qgpgmesignencryptjob.cpp23
-rw-r--r--lang/qt/src/qgpgmesignkeyjob.cpp6
-rw-r--r--lang/qt/src/refreshkeysjob.h23
-rw-r--r--lang/qt/src/revokekeyjob.h86
-rw-r--r--lang/qt/src/setprimaryuseridjob.h69
-rw-r--r--lang/qt/src/signencryptjob.cpp61
-rw-r--r--lang/qt/src/signencryptjob.h7
-rw-r--r--lang/qt/src/signjob.h2
-rw-r--r--lang/qt/src/signkeyjob.h2
-rw-r--r--lang/qt/src/util.cpp18
-rw-r--r--lang/qt/src/util.h16
-rw-r--r--lang/qt/src/verifydetachedjob.h5
-rw-r--r--lang/qt/src/verifyopaquejob.h2
-rw-r--r--lang/qt/src/wkspublishjob.h7
39 files changed, 890 insertions, 142 deletions
diff --git a/lang/qt/src/Makefile.am b/lang/qt/src/Makefile.am
index d47da89..3923e5b 100644
--- a/lang/qt/src/Makefile.am
+++ b/lang/qt/src/Makefile.am
@@ -21,7 +21,7 @@
lib_LTLIBRARIES = libqgpgme.la
EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \
qgpgme_debug.h qgpgme_version.h.in \
- QGpgmeConfig.cmake.in.in
+ QGpgmeConfig-w32.cmake.in.in
qgpgme_sources = \
dataprovider.cpp \
@@ -35,14 +35,17 @@ qgpgme_sources = \
qgpgmeimportjob.cpp qgpgmekeygenerationjob.cpp qgpgmekeylistjob.cpp \
qgpgmelistallkeysjob.cpp qgpgmenewcryptoconfig.cpp \
qgpgmereceivekeysjob.cpp \
- qgpgmerefreshkeysjob.cpp \
+ qgpgmerefreshsmimekeysjob.cpp \
+ qgpgmerevokekeyjob.cpp \
+ qgpgmesetprimaryuseridjob.cpp \
qgpgmesignencryptjob.cpp \
qgpgmesignjob.cpp qgpgmesignkeyjob.cpp qgpgmeverifydetachedjob.cpp \
qgpgmeverifyopaquejob.cpp qgpgmewkdlookupjob.cpp threadedjobmixin.cpp \
qgpgmekeyformailboxjob.cpp qgpgme_debug.cpp \
qgpgmetofupolicyjob.cpp qgpgmequickjob.cpp \
defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp \
- qgpgmegpgcardjob.cpp changeexpiryjob.cpp importjob.cpp \
+ qgpgmegpgcardjob.cpp changeexpiryjob.cpp encryptjob.cpp importjob.cpp \
+ signencryptjob.cpp \
dn.cpp cryptoconfig.cpp wkdlookupresult.cpp \
util.cpp
@@ -70,6 +73,8 @@ qgpgme_headers= \
qgpgmenewcryptoconfig.h \
quickjob.h \
receivekeysjob.h \
+ revokekeyjob.h \
+ setprimaryuseridjob.h \
specialjob.h \
signjob.h \
signkeyjob.h \
@@ -114,6 +119,8 @@ camelcase_headers= \
QGpgMENewCryptoConfig \
QuickJob \
ReceiveKeysJob \
+ RevokeKeyJob \
+ SetPrimaryUserIDJob \
SpecialJob \
SignJob \
SignKeyJob \
@@ -158,7 +165,9 @@ private_qgpgme_headers = \
qgpgmekeylistjob.h \
qgpgmelistallkeysjob.h \
qgpgmereceivekeysjob.h \
- qgpgmerefreshkeysjob.h \
+ qgpgmerefreshsmimekeysjob.h \
+ qgpgmerevokekeyjob.h \
+ qgpgmesetprimaryuseridjob.h \
qgpgmesignencryptjob.h \
qgpgmesignjob.h \
qgpgmesignkeyjob.h \
@@ -211,7 +220,9 @@ qgpgme_moc_sources = \
qgpgmekeylistjob.moc \
qgpgmelistallkeysjob.moc \
qgpgmereceivekeysjob.moc \
- qgpgmerefreshkeysjob.moc \
+ qgpgmerefreshsmimekeysjob.moc \
+ qgpgmerevokekeyjob.moc \
+ qgpgmesetprimaryuseridjob.moc \
qgpgmesignencryptjob.moc \
qgpgmesignjob.moc \
qgpgmesignkeyjob.moc \
@@ -223,6 +234,8 @@ qgpgme_moc_sources = \
qgpgmetofupolicyjob.moc \
receivekeysjob.moc \
refreshkeysjob.moc \
+ revokekeyjob.moc \
+ setprimaryuseridjob.moc \
signencryptjob.moc \
signjob.moc \
signkeyjob.moc \
diff --git a/lang/qt/src/Makefile.in b/lang/qt/src/Makefile.in
index 2f09648..52ab451 100644
--- a/lang/qt/src/Makefile.in
+++ b/lang/qt/src/Makefile.in
@@ -92,6 +92,7 @@ host_triplet = @host@
subdir = lang/qt/src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cxx_compile_stdcxx.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pkg_swig.m4 \
$(top_srcdir)/m4/ax_python_devel.m4 \
$(top_srcdir)/m4/glib-2.0.m4 $(top_srcdir)/m4/glibc21.m4 \
@@ -155,15 +156,17 @@ am__objects_1 = dataprovider.lo debug.lo job.lo multideletejob.lo \
qgpgmeimportjob.lo qgpgmekeygenerationjob.lo \
qgpgmekeylistjob.lo qgpgmelistallkeysjob.lo \
qgpgmenewcryptoconfig.lo qgpgmereceivekeysjob.lo \
- qgpgmerefreshkeysjob.lo qgpgmesignencryptjob.lo \
+ qgpgmerefreshsmimekeysjob.lo qgpgmerevokekeyjob.lo \
+ qgpgmesetprimaryuseridjob.lo qgpgmesignencryptjob.lo \
qgpgmesignjob.lo qgpgmesignkeyjob.lo \
qgpgmeverifydetachedjob.lo qgpgmeverifyopaquejob.lo \
qgpgmewkdlookupjob.lo threadedjobmixin.lo \
qgpgmekeyformailboxjob.lo qgpgme_debug.lo \
qgpgmetofupolicyjob.lo qgpgmequickjob.lo \
defaultkeygenerationjob.lo qgpgmewkspublishjob.lo \
- qgpgmegpgcardjob.lo changeexpiryjob.lo importjob.lo dn.lo \
- cryptoconfig.lo wkdlookupresult.lo util.lo
+ qgpgmegpgcardjob.lo changeexpiryjob.lo encryptjob.lo \
+ importjob.lo signencryptjob.lo dn.lo cryptoconfig.lo \
+ wkdlookupresult.lo util.lo
am__objects_2 =
am_libqgpgme_la_OBJECTS = $(am__objects_1) $(am__objects_2) \
$(am__objects_2)
@@ -195,9 +198,9 @@ am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/changeexpiryjob.Plo \
./$(DEPDIR)/cryptoconfig.Plo ./$(DEPDIR)/dataprovider.Plo \
./$(DEPDIR)/debug.Plo ./$(DEPDIR)/defaultkeygenerationjob.Plo \
- ./$(DEPDIR)/dn.Plo ./$(DEPDIR)/importjob.Plo \
- ./$(DEPDIR)/job.Plo ./$(DEPDIR)/multideletejob.Plo \
- ./$(DEPDIR)/qgpgme_debug.Plo \
+ ./$(DEPDIR)/dn.Plo ./$(DEPDIR)/encryptjob.Plo \
+ ./$(DEPDIR)/importjob.Plo ./$(DEPDIR)/job.Plo \
+ ./$(DEPDIR)/multideletejob.Plo ./$(DEPDIR)/qgpgme_debug.Plo \
./$(DEPDIR)/qgpgmeaddexistingsubkeyjob.Plo \
./$(DEPDIR)/qgpgmeadduseridjob.Plo \
./$(DEPDIR)/qgpgmebackend.Plo \
@@ -220,7 +223,9 @@ am__depfiles_remade = ./$(DEPDIR)/changeexpiryjob.Plo \
./$(DEPDIR)/qgpgmenewcryptoconfig.Plo \
./$(DEPDIR)/qgpgmequickjob.Plo \
./$(DEPDIR)/qgpgmereceivekeysjob.Plo \
- ./$(DEPDIR)/qgpgmerefreshkeysjob.Plo \
+ ./$(DEPDIR)/qgpgmerefreshsmimekeysjob.Plo \
+ ./$(DEPDIR)/qgpgmerevokekeyjob.Plo \
+ ./$(DEPDIR)/qgpgmesetprimaryuseridjob.Plo \
./$(DEPDIR)/qgpgmesignencryptjob.Plo \
./$(DEPDIR)/qgpgmesignjob.Plo ./$(DEPDIR)/qgpgmesignkeyjob.Plo \
./$(DEPDIR)/qgpgmetofupolicyjob.Plo \
@@ -228,6 +233,7 @@ am__depfiles_remade = ./$(DEPDIR)/changeexpiryjob.Plo \
./$(DEPDIR)/qgpgmeverifyopaquejob.Plo \
./$(DEPDIR)/qgpgmewkdlookupjob.Plo \
./$(DEPDIR)/qgpgmewkspublishjob.Plo \
+ ./$(DEPDIR)/signencryptjob.Plo \
./$(DEPDIR)/threadedjobmixin.Plo ./$(DEPDIR)/util.Plo \
./$(DEPDIR)/wkdlookupresult.Plo
am__mv = mv -f
@@ -351,6 +357,7 @@ GPGME_CONFIG_AVAIL_LANG = @GPGME_CONFIG_AVAIL_LANG@
GPGME_CONFIG_CFLAGS = @GPGME_CONFIG_CFLAGS@
GPGME_CONFIG_HOST = @GPGME_CONFIG_HOST@
GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@
+GPGME_CPP_CFLAGS = @GPGME_CPP_CFLAGS@
GPGME_QTTEST_CFLAGS = @GPGME_QTTEST_CFLAGS@
GPGME_QTTEST_LIBS = @GPGME_QTTEST_LIBS@
GPGME_QT_CFLAGS = @GPGME_QT_CFLAGS@
@@ -524,7 +531,7 @@ top_srcdir = @top_srcdir@
lib_LTLIBRARIES = libqgpgme.la
EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \
qgpgme_debug.h qgpgme_version.h.in \
- QGpgmeConfig.cmake.in.in
+ QGpgmeConfig-w32.cmake.in.in
qgpgme_sources = \
dataprovider.cpp \
@@ -538,14 +545,17 @@ qgpgme_sources = \
qgpgmeimportjob.cpp qgpgmekeygenerationjob.cpp qgpgmekeylistjob.cpp \
qgpgmelistallkeysjob.cpp qgpgmenewcryptoconfig.cpp \
qgpgmereceivekeysjob.cpp \
- qgpgmerefreshkeysjob.cpp \
+ qgpgmerefreshsmimekeysjob.cpp \
+ qgpgmerevokekeyjob.cpp \
+ qgpgmesetprimaryuseridjob.cpp \
qgpgmesignencryptjob.cpp \
qgpgmesignjob.cpp qgpgmesignkeyjob.cpp qgpgmeverifydetachedjob.cpp \
qgpgmeverifyopaquejob.cpp qgpgmewkdlookupjob.cpp threadedjobmixin.cpp \
qgpgmekeyformailboxjob.cpp qgpgme_debug.cpp \
qgpgmetofupolicyjob.cpp qgpgmequickjob.cpp \
defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp \
- qgpgmegpgcardjob.cpp changeexpiryjob.cpp importjob.cpp \
+ qgpgmegpgcardjob.cpp changeexpiryjob.cpp encryptjob.cpp importjob.cpp \
+ signencryptjob.cpp \
dn.cpp cryptoconfig.cpp wkdlookupresult.cpp \
util.cpp
@@ -574,6 +584,8 @@ qgpgme_headers = \
qgpgmenewcryptoconfig.h \
quickjob.h \
receivekeysjob.h \
+ revokekeyjob.h \
+ setprimaryuseridjob.h \
specialjob.h \
signjob.h \
signkeyjob.h \
@@ -618,6 +630,8 @@ camelcase_headers = \
QGpgMENewCryptoConfig \
QuickJob \
ReceiveKeysJob \
+ RevokeKeyJob \
+ SetPrimaryUserIDJob \
SpecialJob \
SignJob \
SignKeyJob \
@@ -662,7 +676,9 @@ private_qgpgme_headers = \
qgpgmekeylistjob.h \
qgpgmelistallkeysjob.h \
qgpgmereceivekeysjob.h \
- qgpgmerefreshkeysjob.h \
+ qgpgmerefreshsmimekeysjob.h \
+ qgpgmerevokekeyjob.h \
+ qgpgmesetprimaryuseridjob.h \
qgpgmesignencryptjob.h \
qgpgmesignjob.h \
qgpgmesignkeyjob.h \
@@ -715,7 +731,9 @@ qgpgme_moc_sources = \
qgpgmekeylistjob.moc \
qgpgmelistallkeysjob.moc \
qgpgmereceivekeysjob.moc \
- qgpgmerefreshkeysjob.moc \
+ qgpgmerefreshsmimekeysjob.moc \
+ qgpgmerevokekeyjob.moc \
+ qgpgmesetprimaryuseridjob.moc \
qgpgmesignencryptjob.moc \
qgpgmesignjob.moc \
qgpgmesignkeyjob.moc \
@@ -727,6 +745,8 @@ qgpgme_moc_sources = \
qgpgmetofupolicyjob.moc \
receivekeysjob.moc \
refreshkeysjob.moc \
+ revokekeyjob.moc \
+ setprimaryuseridjob.moc \
signencryptjob.moc \
signjob.moc \
signkeyjob.moc \
@@ -861,6 +881,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/debug.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/defaultkeygenerationjob.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dn.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encryptjob.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/importjob.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/job.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multideletejob.Plo@am__quote@ # am--include-marker
@@ -887,7 +908,9 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmenewcryptoconfig.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmequickjob.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmereceivekeysjob.Plo@am__quote@ # am--include-marker
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmerefreshkeysjob.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmerefreshsmimekeysjob.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmerevokekeyjob.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmesetprimaryuseridjob.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmesignencryptjob.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmesignjob.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmesignkeyjob.Plo@am__quote@ # am--include-marker
@@ -896,6 +919,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmeverifyopaquejob.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmewkdlookupjob.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qgpgmewkspublishjob.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signencryptjob.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/threadedjobmixin.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wkdlookupresult.Plo@am__quote@ # am--include-marker
@@ -1135,6 +1159,7 @@ distclean: distclean-am
-rm -f ./$(DEPDIR)/debug.Plo
-rm -f ./$(DEPDIR)/defaultkeygenerationjob.Plo
-rm -f ./$(DEPDIR)/dn.Plo
+ -rm -f ./$(DEPDIR)/encryptjob.Plo
-rm -f ./$(DEPDIR)/importjob.Plo
-rm -f ./$(DEPDIR)/job.Plo
-rm -f ./$(DEPDIR)/multideletejob.Plo
@@ -1161,7 +1186,9 @@ distclean: distclean-am
-rm -f ./$(DEPDIR)/qgpgmenewcryptoconfig.Plo
-rm -f ./$(DEPDIR)/qgpgmequickjob.Plo
-rm -f ./$(DEPDIR)/qgpgmereceivekeysjob.Plo
- -rm -f ./$(DEPDIR)/qgpgmerefreshkeysjob.Plo
+ -rm -f ./$(DEPDIR)/qgpgmerefreshsmimekeysjob.Plo
+ -rm -f ./$(DEPDIR)/qgpgmerevokekeyjob.Plo
+ -rm -f ./$(DEPDIR)/qgpgmesetprimaryuseridjob.Plo
-rm -f ./$(DEPDIR)/qgpgmesignencryptjob.Plo
-rm -f ./$(DEPDIR)/qgpgmesignjob.Plo
-rm -f ./$(DEPDIR)/qgpgmesignkeyjob.Plo
@@ -1170,6 +1197,7 @@ distclean: distclean-am
-rm -f ./$(DEPDIR)/qgpgmeverifyopaquejob.Plo
-rm -f ./$(DEPDIR)/qgpgmewkdlookupjob.Plo
-rm -f ./$(DEPDIR)/qgpgmewkspublishjob.Plo
+ -rm -f ./$(DEPDIR)/signencryptjob.Plo
-rm -f ./$(DEPDIR)/threadedjobmixin.Plo
-rm -f ./$(DEPDIR)/util.Plo
-rm -f ./$(DEPDIR)/wkdlookupresult.Plo
@@ -1226,6 +1254,7 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/debug.Plo
-rm -f ./$(DEPDIR)/defaultkeygenerationjob.Plo
-rm -f ./$(DEPDIR)/dn.Plo
+ -rm -f ./$(DEPDIR)/encryptjob.Plo
-rm -f ./$(DEPDIR)/importjob.Plo
-rm -f ./$(DEPDIR)/job.Plo
-rm -f ./$(DEPDIR)/multideletejob.Plo
@@ -1252,7 +1281,9 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/qgpgmenewcryptoconfig.Plo
-rm -f ./$(DEPDIR)/qgpgmequickjob.Plo
-rm -f ./$(DEPDIR)/qgpgmereceivekeysjob.Plo
- -rm -f ./$(DEPDIR)/qgpgmerefreshkeysjob.Plo
+ -rm -f ./$(DEPDIR)/qgpgmerefreshsmimekeysjob.Plo
+ -rm -f ./$(DEPDIR)/qgpgmerevokekeyjob.Plo
+ -rm -f ./$(DEPDIR)/qgpgmesetprimaryuseridjob.Plo
-rm -f ./$(DEPDIR)/qgpgmesignencryptjob.Plo
-rm -f ./$(DEPDIR)/qgpgmesignjob.Plo
-rm -f ./$(DEPDIR)/qgpgmesignkeyjob.Plo
@@ -1261,6 +1292,7 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/qgpgmeverifyopaquejob.Plo
-rm -f ./$(DEPDIR)/qgpgmewkdlookupjob.Plo
-rm -f ./$(DEPDIR)/qgpgmewkspublishjob.Plo
+ -rm -f ./$(DEPDIR)/signencryptjob.Plo
-rm -f ./$(DEPDIR)/threadedjobmixin.Plo
-rm -f ./$(DEPDIR)/util.Plo
-rm -f ./$(DEPDIR)/wkdlookupresult.Plo
diff --git a/lang/qt/src/RevokeKeyJob b/lang/qt/src/RevokeKeyJob
new file mode 100644
index 0000000..5d0f973
--- /dev/null
+++ b/lang/qt/src/RevokeKeyJob
@@ -0,0 +1 @@
+#include "qgpgme/revokekeyjob.h"
diff --git a/lang/qt/src/SetPrimaryUserIDJob b/lang/qt/src/SetPrimaryUserIDJob
new file mode 100644
index 0000000..f61a24c
--- /dev/null
+++ b/lang/qt/src/SetPrimaryUserIDJob
@@ -0,0 +1 @@
+#include "qgpgme/setprimaryuseridjob.h"
diff --git a/lang/qt/src/decryptjob.h b/lang/qt/src/decryptjob.h
index 7753e18..5195407 100644
--- a/lang/qt/src/decryptjob.h
+++ b/lang/qt/src/decryptjob.h
@@ -84,8 +84,6 @@ public:
If \a plainText is non-null, the plaintext is written
there. Otherwise, it will be delivered in the second argument
of result().
-
- \throws GpgME::Exception if starting fails
*/
virtual void start(const std::shared_ptr<QIODevice> &cipherText, const std::shared_ptr<QIODevice> &plainText = std::shared_ptr<QIODevice>()) = 0;
diff --git a/lang/qt/src/decryptverifyjob.h b/lang/qt/src/decryptverifyjob.h
index e5c4346..8444e4d 100644
--- a/lang/qt/src/decryptverifyjob.h
+++ b/lang/qt/src/decryptverifyjob.h
@@ -85,8 +85,6 @@ public:
If \a plainText is non-null, the plaintext is written
there. Otherwise, it will be delivered in the third argument
of result().
-
- \throws GpgME::Exception if starting fails
*/
virtual void start(const std::shared_ptr<QIODevice> &cipherText, const std::shared_ptr<QIODevice> &plainText = std::shared_ptr<QIODevice>()) = 0;
diff --git a/lang/qt/src/downloadjob.h b/lang/qt/src/downloadjob.h
index 7c8bb72..b916c41 100644
--- a/lang/qt/src/downloadjob.h
+++ b/lang/qt/src/downloadjob.h
@@ -38,6 +38,7 @@
#include "job.h"
#include <QtCore/QByteArray>
+#include <QtCore/QStringList>
#include <memory>
@@ -46,7 +47,6 @@ namespace GpgME
class Error;
}
-class QStringList;
class QIODevice;
class QByteArray;
diff --git a/lang/qt/src/encryptjob.cpp b/lang/qt/src/encryptjob.cpp
new file mode 100644
index 0000000..7533bd9
--- /dev/null
+++ b/lang/qt/src/encryptjob.cpp
@@ -0,0 +1,61 @@
+/*
+ encryptjob.cpp
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ 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 "encryptjob.h"
+#include "job_p.h"
+
+using namespace QGpgME;
+
+namespace
+{
+struct EncryptJobPrivate : public JobPrivate
+{
+ QString m_fileName;
+};
+}
+
+void EncryptJob::setFileName(const QString &fileName)
+{
+ auto d = jobPrivate<EncryptJobPrivate>(this);
+ d->m_fileName = fileName;
+}
+
+QString EncryptJob::fileName() const
+{
+ auto d = jobPrivate<EncryptJobPrivate>(this);
+ return d->m_fileName;
+}
diff --git a/lang/qt/src/encryptjob.h b/lang/qt/src/encryptjob.h
index 937ee8d..8135053 100644
--- a/lang/qt/src/encryptjob.h
+++ b/lang/qt/src/encryptjob.h
@@ -5,6 +5,8 @@
Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
QGpgME is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -80,6 +82,9 @@ protected:
public:
~EncryptJob();
+ void setFileName(const QString &fileName);
+ QString fileName() const;
+
/**
Starts the encryption operation. \a recipients is the a list of
keys to encrypt \a plainText to. Empty (null) keys are
@@ -99,8 +104,6 @@ public:
If \a cipherText is non-null, the ciphertext is written
there. Otherwise, it will be delivered in the second argument of
result().
-
- \throws GpgME::Exception if starting fails
*/
virtual void start(const std::vector<GpgME::Key> &recipients,
const std::shared_ptr<QIODevice> &plainText,
diff --git a/lang/qt/src/exportjob.h b/lang/qt/src/exportjob.h
index 7f79ea0..4fdb468 100644
--- a/lang/qt/src/exportjob.h
+++ b/lang/qt/src/exportjob.h
@@ -39,14 +39,13 @@
#include "job.h"
#include <QtCore/QByteArray>
+#include <QtCore/QStringList>
namespace GpgME
{
class Error;
}
-class QStringList;
-
namespace QGpgME
{
diff --git a/lang/qt/src/gpgcardjob.h b/lang/qt/src/gpgcardjob.h
index 63f5cf7..3f1b239 100644
--- a/lang/qt/src/gpgcardjob.h
+++ b/lang/qt/src/gpgcardjob.h
@@ -44,24 +44,6 @@ class Error;
namespace QGpgME
{
-/**
- @short Get the best key to use for a Mailbox
-
- To use the keyformailboxjob, first obtain an instance from the
- CryptoBackend and either exec it or start and
- conncet the result() signals to a suitable slot.
- The job will be automatically deleted in which
- case the KeylistJob instance will have schedules it's own
- destruction with a call to QObject::deleteLater().
-
- The best key is defined as the key with a UID that has an
- E-Mail that matches the mailbox provided. If multiple
- keys are found the one with the highest validity is returned.
-
- After result() is emitted, the
- KeyListJob will schedule it's own destruction by calling
- QObject::deleteLater().
-*/
class QGPGME_EXPORT GpgCardJob: public Job
{
Q_OBJECT
diff --git a/lang/qt/src/job.cpp b/lang/qt/src/job.cpp
index a9edc8e..98f408b 100644
--- a/lang/qt/src/job.cpp
+++ b/lang/qt/src/job.cpp
@@ -72,6 +72,8 @@
#include "quickjob.h"
#include "gpgcardjob.h"
#include "receivekeysjob.h"
+#include "revokekeyjob.h"
+#include "setprimaryuseridjob.h"
#include <QCoreApplication>
#include <QDebug>
@@ -172,6 +174,8 @@ make_job_subclass(WKSPublishJob)
make_job_subclass(TofuPolicyJob)
make_job_subclass(QuickJob)
make_job_subclass(GpgCardJob)
+make_job_subclass(RevokeKeyJob)
+make_job_subclass(SetPrimaryUserIDJob)
#undef make_job_subclass
@@ -208,3 +212,5 @@ make_job_subclass(GpgCardJob)
#include "quickjob.moc"
#include "gpgcardjob.moc"
#include "receivekeysjob.moc"
+#include "revokekeyjob.moc"
+#include "setprimaryuseridjob.moc"
diff --git a/lang/qt/src/keyformailboxjob.h b/lang/qt/src/keyformailboxjob.h
index 42d1729..5e08907 100644
--- a/lang/qt/src/keyformailboxjob.h
+++ b/lang/qt/src/keyformailboxjob.h
@@ -57,18 +57,14 @@ namespace QGpgME
To use the keyformailboxjob, first obtain an instance from the
CryptoBackend and either exec it or start and
- conncet the result() signals to a suitable slot.
- The job will be automatically deleted in which
- case the KeylistJob instance will have schedules it's own
- destruction with a call to QObject::deleteLater().
+ connect the result() signal to a suitable slot.
The best key is defined as the key with a UID that has an
E-Mail that matches the mailbox provided. If multiple
keys are found the one with the highest validity is returned.
- After result() is emitted, the
- KeyListJob will schedule it's own destruction by calling
- QObject::deleteLater().
+ After result() is emitted, the job will schedule it's own
+ destruction by calling QObject::deleteLater().
*/
class QGPGME_EXPORT KeyForMailboxJob: public Job
{
diff --git a/lang/qt/src/keylistjob.h b/lang/qt/src/keylistjob.h
index 88eac87..ace9fbe 100644
--- a/lang/qt/src/keylistjob.h
+++ b/lang/qt/src/keylistjob.h
@@ -44,6 +44,8 @@
# include <gpgme++/key.h>
#endif
+#include <QtCore/QStringList>
+
#include <vector>
namespace GpgME
@@ -52,8 +54,6 @@ class Error;
class KeyListResult;
}
-class QStringList;
-
namespace QGpgME
{
@@ -64,7 +64,7 @@ namespace QGpgME
CryptoBackend implementation, connect the nextKey(), progress()
and result() signals to suitable slots and then start the key
listing with a call to start(). This call might fail, in which
- case the KeylistJob instance will have schedules it's own
+ case the KeylistJob instance will have scheduled it's own
destruction with a call to QObject::deleteLater().
During keylisting, you will receive new key objects through the
diff --git a/lang/qt/src/protocol.h b/lang/qt/src/protocol.h
index 62b2cb2..019633a 100644
--- a/lang/qt/src/protocol.h
+++ b/lang/qt/src/protocol.h
@@ -71,6 +71,8 @@ class TofuPolicyJob;
class QuickJob;
class GpgCardJob;
class ReceiveKeysJob;
+class RevokeKeyJob;
+class SetPrimaryUserIDJob;
/** The main entry point for QGpgME Comes in OpenPGP and SMIME(CMS) flavors.
*
@@ -134,6 +136,12 @@ public:
virtual DeleteJob *deleteJob() const = 0;
virtual SignEncryptJob *signEncryptJob(bool armor = false, bool textMode = false) const = 0;
virtual DecryptVerifyJob *decryptVerifyJob(bool textmode = false) const = 0;
+
+ /**
+ * For S/MIME keys this job performs a full validation check of the keys
+ * with updated CRLs.
+ * For OpenPGP keys, use receiveKeysJob.
+ */
virtual RefreshKeysJob *refreshKeysJob() const = 0;
virtual ChangeExpiryJob *changeExpiryJob() const = 0;
virtual SignKeyJob *signKeyJob() const = 0;
@@ -173,6 +181,14 @@ public:
virtual ExportJob *secretSubkeyExportJob(bool armor = false) const = 0;
virtual AddExistingSubkeyJob *addExistingSubkeyJob() const = 0;
virtual ReceiveKeysJob *receiveKeysJob() const = 0;
+
+ virtual RevokeKeyJob *revokeKeyJob() const = 0;
+
+ /**
+ * Returns a job for flagging a user ID as the primary user ID of an
+ * OpenPGP key.
+ */
+ virtual SetPrimaryUserIDJob *setPrimaryUserIDJob() const = 0;
};
/** Obtain a reference to the OpenPGP Protocol.
diff --git a/lang/qt/src/protocol_p.h b/lang/qt/src/protocol_p.h
index 4211e00..685ac4d 100644
--- a/lang/qt/src/protocol_p.h
+++ b/lang/qt/src/protocol_p.h
@@ -42,7 +42,7 @@
#include "qgpgmelistallkeysjob.h"
#include "qgpgmedecryptjob.h"
#include "qgpgmedecryptverifyjob.h"
-#include "qgpgmerefreshkeysjob.h"
+#include "qgpgmerefreshsmimekeysjob.h"
#include "qgpgmedeletejob.h"
#include "qgpgmedownloadjob.h"
#include "qgpgmesignencryptjob.h"
@@ -65,6 +65,8 @@
#include "qgpgmetofupolicyjob.h"
#include "qgpgmequickjob.h"
#include "qgpgmereceivekeysjob.h"
+#include "qgpgmerevokekeyjob.h"
+#include "qgpgmesetprimaryuseridjob.h"
namespace
{
@@ -282,12 +284,11 @@ public:
QGpgME::RefreshKeysJob *refreshKeysJob() const Q_DECL_OVERRIDE
{
- if (mProtocol != GpgME::CMS) { // fixme: add support for gpg, too
+ if (mProtocol != GpgME::CMS) {
return nullptr;
}
- // this operation is not supported by gpgme, so we have to call gpgsm ourselves:
- return new QGpgME::QGpgMERefreshKeysJob();
+ return new QGpgME::QGpgMERefreshSMIMEKeysJob;
}
QGpgME::DownloadJob *downloadJob(bool armor) const Q_DECL_OVERRIDE
@@ -421,7 +422,7 @@ public:
if (!context) {
return nullptr;
}
- context->setKeyListMode(GpgME::Extern | GpgME::Local | GpgME::Signatures | GpgME::Validate);
+ context->setKeyListMode(GpgME::Locate | GpgME::Signatures | GpgME::Validate);
return new QGpgME::QGpgMEKeyListJob(context);
}
@@ -481,6 +482,30 @@ public:
}
return new QGpgME::QGpgMEQuickJob(context);
}
+
+ QGpgME::RevokeKeyJob *revokeKeyJob() const Q_DECL_OVERRIDE
+ {
+ if (mProtocol != GpgME::OpenPGP) {
+ return nullptr;
+ }
+ GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
+ if (!context) {
+ return nullptr;
+ }
+ return new QGpgME::QGpgMERevokeKeyJob(context);
+ }
+
+ QGpgME::SetPrimaryUserIDJob *setPrimaryUserIDJob() const override
+ {
+ if (mProtocol != GpgME::OpenPGP) {
+ return nullptr;
+ }
+ GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
+ if (!context) {
+ return nullptr;
+ }
+ return new QGpgME::QGpgMESetPrimaryUserIDJob{context};
+ }
};
}
diff --git a/lang/qt/src/qgpgmedecryptverifyjob.cpp b/lang/qt/src/qgpgmedecryptverifyjob.cpp
index 5f9a8ab..e2b3724 100644
--- a/lang/qt/src/qgpgmedecryptverifyjob.cpp
+++ b/lang/qt/src/qgpgmedecryptverifyjob.cpp
@@ -67,8 +67,7 @@ static QGpgMEDecryptVerifyJob::result_type decrypt_verify(Context *ctx, QThread
const std::weak_ptr<QIODevice> &cipherText_,
const std::weak_ptr<QIODevice> &plainText_)
{
-
- qCDebug(QGPGME_LOG);
+ qCDebug(QGPGME_LOG) << __func__;
const std::shared_ptr<QIODevice> cipherText = cipherText_.lock();
const std::shared_ptr<QIODevice> plainText = plainText_.lock();
@@ -86,7 +85,7 @@ static QGpgMEDecryptVerifyJob::result_type decrypt_verify(Context *ctx, QThread
const std::pair<DecryptionResult, VerificationResult> res = ctx->decryptAndVerify(indata, outdata);
Error ae;
const QString log = _detail::audit_log_as_html(ctx, ae);
- qCDebug(QGPGME_LOG) << "End no plainText. Error: " << ae;
+ qCDebug(QGPGME_LOG) << __func__ << "- End no plainText. Error:" << ae.asString();
return std::make_tuple(res.first, res.second, out.data(), log, ae);
} else {
QGpgME::QIODeviceDataProvider out(plainText);
@@ -95,10 +94,9 @@ static QGpgMEDecryptVerifyJob::result_type decrypt_verify(Context *ctx, QThread
const std::pair<DecryptionResult, VerificationResult> res = ctx->decryptAndVerify(indata, outdata);
Error ae;
const QString log = _detail::audit_log_as_html(ctx, ae);
- qCDebug(QGPGME_LOG) << "End plainText. Error: " << ae;
+ qCDebug(QGPGME_LOG) << __func__ << "- End plainText. Error:" << ae.asString();
return std::make_tuple(res.first, res.second, QByteArray(), log, ae);
}
-
}
static QGpgMEDecryptVerifyJob::result_type decrypt_verify_qba(Context *ctx, const QByteArray &cipherText)
diff --git a/lang/qt/src/qgpgmeencryptjob.cpp b/lang/qt/src/qgpgmeencryptjob.cpp
index 8fb3dd3..cd54496 100644
--- a/lang/qt/src/qgpgmeencryptjob.cpp
+++ b/lang/qt/src/qgpgmeencryptjob.cpp
@@ -5,6 +5,8 @@
Copyright (c) 2004,2007,2008 Klarälvdalens Datakonsult AB
Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
QGpgME is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -45,7 +47,7 @@
#include "data.h"
#include <QBuffer>
-
+#include <QFileInfo>
#include <cassert>
@@ -71,7 +73,8 @@ static QGpgMEEncryptJob::result_type encrypt(Context *ctx, QThread *thread,
const std::weak_ptr<QIODevice> &plainText_,
const std::weak_ptr<QIODevice> &cipherText_,
const Context::EncryptionFlags eflags,
- bool outputIsBsse64Encoded)
+ bool outputIsBsse64Encoded,
+ const QString &fileName)
{
const std::shared_ptr<QIODevice> plainText = plainText_.lock();
@@ -81,7 +84,12 @@ static QGpgMEEncryptJob::result_type encrypt(Context *ctx, QThread *thread,
const _detail::ToThreadMover ptMover(plainText, thread);
QGpgME::QIODeviceDataProvider in(plainText);
- const Data indata(&in);
+ Data indata(&in);
+
+ const auto pureFileName = QFileInfo{fileName}.fileName().toStdString();
+ if (!pureFileName.empty()) {
+ indata.setFileName(pureFileName.c_str());
+ }
if (!cipherText) {
QGpgME::QByteArrayDataProvider out;
@@ -111,20 +119,20 @@ static QGpgMEEncryptJob::result_type encrypt(Context *ctx, QThread *thread,
}
-static QGpgMEEncryptJob::result_type encrypt_qba(Context *ctx, const std::vector<Key> &recipients, const QByteArray &plainText, const Context::EncryptionFlags eflags, bool outputIsBsse64Encoded)
+static QGpgMEEncryptJob::result_type encrypt_qba(Context *ctx, const std::vector<Key> &recipients, const QByteArray &plainText, const Context::EncryptionFlags eflags, bool outputIsBsse64Encoded, const QString &fileName)
{
const std::shared_ptr<QBuffer> buffer(new QBuffer);
buffer->setData(plainText);
if (!buffer->open(QIODevice::ReadOnly)) {
assert(!"This should never happen: QBuffer::open() failed");
}
- return encrypt(ctx, nullptr, recipients, buffer, std::shared_ptr<QIODevice>(), eflags, outputIsBsse64Encoded);
+ return encrypt(ctx, nullptr, recipients, buffer, std::shared_ptr<QIODevice>(), eflags, outputIsBsse64Encoded, fileName);
}
Error QGpgMEEncryptJob::start(const std::vector<Key> &recipients, const QByteArray &plainText, bool alwaysTrust)
{
run(std::bind(&encrypt_qba, std::placeholders::_1, recipients, plainText,
- alwaysTrust ? Context::AlwaysTrust : Context::None, mOutputIsBase64Encoded));
+ alwaysTrust ? Context::AlwaysTrust : Context::None, mOutputIsBase64Encoded, fileName()));
return Error();
}
@@ -136,14 +144,15 @@ void QGpgMEEncryptJob::start(const std::vector<Key> &recipients, const std::shar
recipients,
std::placeholders::_3, std::placeholders::_4,
eflags,
- mOutputIsBase64Encoded),
+ mOutputIsBase64Encoded,
+ fileName()),
plainText, cipherText);
}
EncryptionResult QGpgMEEncryptJob::exec(const std::vector<Key> &recipients, const QByteArray &plainText,
const Context::EncryptionFlags eflags, QByteArray &cipherText)
{
- const result_type r = encrypt_qba(context(), recipients, plainText, eflags, mOutputIsBase64Encoded);
+ const result_type r = encrypt_qba(context(), recipients, plainText, eflags, mOutputIsBase64Encoded, fileName());
cipherText = std::get<1>(r);
resultHook(r);
return mResult;
diff --git a/lang/qt/src/qgpgmekeyformailboxjob.cpp b/lang/qt/src/qgpgmekeyformailboxjob.cpp
index 534e9a3..b6ab3db 100644
--- a/lang/qt/src/qgpgmekeyformailboxjob.cpp
+++ b/lang/qt/src/qgpgmekeyformailboxjob.cpp
@@ -71,7 +71,7 @@ static bool subkeyIsOk(const Subkey s)
static QGpgMEKeyForMailboxJob::result_type do_work(Context *ctx, const QString &mailbox, bool canEncrypt)
{
/* Do a Keylisting. */
- ctx->setKeyListMode(GpgME::Extern | GpgME::Local | GpgME::Signatures | GpgME::Validate);
+ ctx->setKeyListMode(GpgME::Locate | GpgME::Signatures | GpgME::Validate);
std::vector<Key> keys;
QGpgMEKeyListJob *keylist = new QGpgMEKeyListJob(ctx);
diff --git a/lang/qt/src/qgpgmerefreshkeysjob.cpp b/lang/qt/src/qgpgmerefreshsmimekeysjob.cpp
index 5f78f2a..3187a0c 100644
--- a/lang/qt/src/qgpgmerefreshkeysjob.cpp
+++ b/lang/qt/src/qgpgmerefreshsmimekeysjob.cpp
@@ -1,5 +1,5 @@
/*
- qgpgmerefreshkeysjob.cpp
+ qgpgmerefreshsmimekeysjob.cpp
This file is part of qgpgme, the Qt API binding for gpgme
Copyright (c) 2004 Klarävdalens Datakonsult AB
@@ -38,21 +38,27 @@
#include "config.h"
#endif
-#include "qgpgmerefreshkeysjob.h"
+#include "qgpgmerefreshsmimekeysjob.h"
+#include "util.h"
#include <QDebug>
#include "qgpgme_debug.h"
#include "context.h"
+#include <key.h>
#include <QByteArray>
+#include <QMetaObject>
+#include <QProcess>
#include <QStringList>
#include <gpg-error.h>
#include <assert.h>
-QGpgME::QGpgMERefreshKeysJob::QGpgMERefreshKeysJob()
+using namespace QGpgME;
+
+QGpgMERefreshSMIMEKeysJob::QGpgMERefreshSMIMEKeysJob()
: RefreshKeysJob(nullptr),
mProcess(nullptr),
mError(0)
@@ -60,12 +66,12 @@ QGpgME::QGpgMERefreshKeysJob::QGpgMERefreshKeysJob()
}
-QGpgME::QGpgMERefreshKeysJob::~QGpgMERefreshKeysJob()
+QGpgMERefreshSMIMEKeysJob::~QGpgMERefreshSMIMEKeysJob()
{
}
-GpgME::Error QGpgME::QGpgMERefreshKeysJob::start(const QStringList &patterns)
+GpgME::Error QGpgMERefreshSMIMEKeysJob::start(const QStringList &patterns)
{
assert(mPatternsToDo.empty());
@@ -79,11 +85,31 @@ GpgME::Error QGpgME::QGpgMERefreshKeysJob::start(const QStringList &patterns)
return startAProcess();
}
+GpgME::Error QGpgMERefreshSMIMEKeysJob::start(const std::vector<GpgME::Key> &keys)
+{
+ if (keys.empty()) {
+ QMetaObject::invokeMethod(this, [this]() {
+ Q_EMIT slotProcessExited(0, QProcess::NormalExit);
+ }, Qt::QueuedConnection);
+ return {};
+ }
+
+ const bool gotWrongKeys = std::any_of(std::begin(keys), std::end(keys), [](const auto &k) {
+ return k.protocol() != GpgME::CMS;
+ });
+ if (gotWrongKeys) {
+ qCDebug(QGPGME_LOG) << "Error: At least one of the keys is not an S/MIME key";
+ return GpgME::Error::fromCode(GPG_ERR_INV_VALUE);
+ }
+
+ return start(toFingerprints(keys));
+}
+
#if MAX_CMD_LENGTH < 65 + 128
#error MAX_CMD_LENGTH is too low
#endif
-GpgME::Error QGpgME::QGpgMERefreshKeysJob::startAProcess()
+GpgME::Error QGpgMERefreshSMIMEKeysJob::startAProcess()
{
if (mPatternsToDo.empty()) {
return GpgME::Error();
@@ -122,10 +148,12 @@ GpgME::Error QGpgME::QGpgMERefreshKeysJob::startAProcess()
connect(mProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
SLOT(slotProcessExited(int,QProcess::ExitStatus)));
- connect(mProcess, SIGNAL(readyReadStandardOutput()),
- SLOT(slotStdout()));
- connect(mProcess, &QProcess::readyReadStandardError,
- this, &QGpgMERefreshKeysJob::slotStderr);
+ connect(mProcess, &QProcess::readyReadStandardOutput, this, [this]() {
+ qCDebug(QGPGME_LOG) << "stdout:" << mProcess->readAllStandardOutput();
+ });
+ connect(mProcess, &QProcess::readyReadStandardError, this, [this]() {
+ qCDebug(QGPGME_LOG) << "stderr:" << mProcess->readAllStandardError();
+ });
mProcess->start();
if (!mProcess->waitForStarted()) {
@@ -137,7 +165,7 @@ GpgME::Error QGpgME::QGpgMERefreshKeysJob::startAProcess()
}
}
-void QGpgME::QGpgMERefreshKeysJob::slotCancel()
+void QGpgMERefreshSMIMEKeysJob::slotCancel()
{
if (mProcess) {
mProcess->kill();
@@ -146,7 +174,7 @@ void QGpgME::QGpgMERefreshKeysJob::slotCancel()
mError = GpgME::Error::fromCode(GPG_ERR_CANCELED, GPG_ERR_SOURCE_GPGSM);
}
-void QGpgME::QGpgMERefreshKeysJob::slotStatus(QProcess *proc, const QString &type, const QStringList &args)
+void QGpgMERefreshSMIMEKeysJob::slotStatus(QProcess *proc, const QString &type, const QStringList &args)
{
if (proc != mProcess) {
return;
@@ -204,12 +232,7 @@ void QGpgME::QGpgMERefreshKeysJob::slotStatus(QProcess *proc, const QString &typ
}
}
-void QGpgME::QGpgMERefreshKeysJob::slotStderr()
-{
- // implement? or not?
-}
-
-void QGpgME::QGpgMERefreshKeysJob::slotProcessExited(int exitCode, QProcess::ExitStatus exitStatus)
+void QGpgMERefreshSMIMEKeysJob::slotProcessExited(int exitCode, QProcess::ExitStatus exitStatus)
{
if (!mError && !mPatternsToDo.empty()) {
if (const GpgME::Error err = startAProcess()) {
@@ -227,4 +250,4 @@ void QGpgME::QGpgMERefreshKeysJob::slotProcessExited(int exitCode, QProcess::Exi
Q_EMIT result(mError);
deleteLater();
}
-#include "qgpgmerefreshkeysjob.moc"
+#include "qgpgmerefreshsmimekeysjob.moc"
diff --git a/lang/qt/src/qgpgmerefreshkeysjob.h b/lang/qt/src/qgpgmerefreshsmimekeysjob.h
index 4dfd942..b5b70e9 100644
--- a/lang/qt/src/qgpgmerefreshkeysjob.h
+++ b/lang/qt/src/qgpgmerefreshsmimekeysjob.h
@@ -1,5 +1,5 @@
/*
- qgpgmerefreshkeysjob.h
+ qgpgmerefreshsmimekeysjob.h
This file is part of qgpgme, the Qt API binding for gpgme
Copyright (c) 2004 Klarälvdalens Datakonsult AB
@@ -32,8 +32,8 @@
your version.
*/
-#ifndef __QGPGME_QGPGMEREFRESHKEYSJOB_H__
-#define __QGPGME_QGPGMEREFRESHKEYSJOB_H__
+#ifndef __QGPGME_QGPGMEREFRESHSMIMEKEYSJOB_H__
+#define __QGPGME_QGPGMEREFRESHSMIMEKEYSJOB_H__
#include "refreshkeysjob.h"
#ifdef BUILDING_QGPGME
@@ -48,22 +48,23 @@
namespace QGpgME
{
-class QGpgMERefreshKeysJob : public RefreshKeysJob
+class QGpgMERefreshSMIMEKeysJob : public RefreshKeysJob
{
Q_OBJECT
public:
- QGpgMERefreshKeysJob();
- ~QGpgMERefreshKeysJob();
+ QGpgMERefreshSMIMEKeysJob();
+ ~QGpgMERefreshSMIMEKeysJob();
/* from RefreshKeysJob */
GpgME::Error start(const QStringList &patterns) Q_DECL_OVERRIDE;
+ GpgME::Error start(const std::vector<GpgME::Key> &keys) override;
+
private Q_SLOTS:
/* from Job */
void slotCancel() Q_DECL_OVERRIDE;
void slotStatus(QProcess *, const QString &, const QStringList &);
- void slotStderr();
void slotProcessExited(int exitCode, QProcess::ExitStatus exitStatus);
private:
@@ -77,4 +78,4 @@ private:
}
-#endif // __QGPGME_QGPGMEREFRESHKEYSJOB_H__
+#endif // __QGPGME_QGPGMEREFRESHSMIMEKEYSJOB_H__
diff --git a/lang/qt/src/qgpgmerevokekeyjob.cpp b/lang/qt/src/qgpgmerevokekeyjob.cpp
new file mode 100644
index 0000000..8a2c224
--- /dev/null
+++ b/lang/qt/src/qgpgmerevokekeyjob.cpp
@@ -0,0 +1,128 @@
+/*
+ qgpgmerevokekeyjob.cpp
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ 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 "qgpgmerevokekeyjob.h"
+
+#include "dataprovider.h"
+
+#include <context.h>
+#include <data.h>
+#include <gpgrevokekeyeditinteractor.h>
+#include <key.h>
+
+#include <gpg-error.h>
+
+#include "qgpgme_debug.h"
+
+using namespace QGpgME;
+using namespace GpgME;
+
+QGpgMERevokeKeyJob::QGpgMERevokeKeyJob(Context *context)
+ : mixin_type{context}
+{
+ lateInitialization();
+}
+
+QGpgMERevokeKeyJob::~QGpgMERevokeKeyJob() = default;
+
+
+static Error check_arguments(const Key &key,
+ RevocationReason reason,
+ const std::vector<std::string> &description)
+{
+ if (key.isNull()) {
+ qWarning(QGPGME_LOG) << "Error: Key is null key";
+ return Error::fromCode(GPG_ERR_INV_ARG);
+ }
+ if (reason < RevocationReason::Unspecified || reason > RevocationReason::NoLongerUsed) {
+ qWarning(QGPGME_LOG) << "Error: Invalid revocation reason" << static_cast<int>(reason);
+ return Error::fromCode(GPG_ERR_INV_VALUE);
+ }
+ if (std::any_of(std::begin(description), std::end(description),
+ [](const std::string &line) {
+ return line.empty() || line.find('\n') != std::string::npos;
+ })) {
+ qWarning(QGPGME_LOG) << "Error: Revocation description contains empty lines or lines with endline characters";
+ return Error::fromCode(GPG_ERR_INV_VALUE);
+ }
+ return {};
+}
+
+static QGpgMERevokeKeyJob::result_type revoke_key(Context *ctx, const Key &key,
+ RevocationReason reason,
+ const std::vector<std::string> &description)
+{
+ std::unique_ptr<GpgRevokeKeyEditInteractor> interactor{new GpgRevokeKeyEditInteractor};
+ interactor->setReason(reason, description);
+
+ QGpgME::QByteArrayDataProvider dp;
+ Data outData(&dp);
+ assert(!outData.isNull());
+
+ ctx->setFlag("extended-edit", "1");
+
+ const Error err = ctx->edit(key, std::unique_ptr<EditInteractor>(interactor.release()), outData);
+ Error ae;
+ const QString log = _detail::audit_log_as_html(ctx, ae);
+ return std::make_tuple(err, log, ae);
+}
+
+Error QGpgMERevokeKeyJob::start(const GpgME::Key &key,
+ GpgME::RevocationReason reason,
+ const std::vector<std::string> &description)
+{
+ Error err = check_arguments(key, reason, description);
+ if (!err) {
+ run(std::bind(&revoke_key, std::placeholders::_1, key, reason, description));
+ }
+ return err;
+}
+
+Error QGpgMERevokeKeyJob::exec(const GpgME::Key &key,
+ GpgME::RevocationReason reason,
+ const std::vector<std::string> &description)
+{
+ Error err = check_arguments(key, reason, description);
+ if (!err) {
+ const result_type r = revoke_key(context(), key, reason, description);
+ resultHook(r);
+ err = std::get<0>(r);
+ }
+ return err;
+}
+
+#include "qgpgmerevokekeyjob.moc"
diff --git a/lang/qt/src/qgpgmerevokekeyjob.h b/lang/qt/src/qgpgmerevokekeyjob.h
new file mode 100644
index 0000000..0eba5cb
--- /dev/null
+++ b/lang/qt/src/qgpgmerevokekeyjob.h
@@ -0,0 +1,70 @@
+/*
+ qgpgmerevokekeyjob.h
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ 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_QGPGMEREVOKEKEYJOB_H__
+#define __QGPGME_QGPGMEREVOKEKEYJOB_H__
+
+#include "threadedjobmixin.h"
+#include "revokekeyjob.h"
+
+namespace QGpgME
+{
+
+class QGpgMERevokeKeyJob
+#ifdef Q_MOC_RUN
+ : public RevokeKeyJob
+#else
+ : public _detail::ThreadedJobMixin<RevokeKeyJob>
+#endif
+{
+ Q_OBJECT
+#ifdef Q_MOC_RUN
+public Q_SLOTS:
+ void slotFinished();
+#endif
+public:
+ explicit QGpgMERevokeKeyJob(GpgME::Context *context);
+ ~QGpgMERevokeKeyJob() override;
+
+ GpgME::Error start(const GpgME::Key &key,
+ GpgME::RevocationReason reason = GpgME::RevocationReason::Unspecified,
+ const std::vector<std::string> &description = {}) override;
+
+ GpgME::Error exec(const GpgME::Key &key,
+ GpgME::RevocationReason reason = GpgME::RevocationReason::Unspecified,
+ const std::vector<std::string> &description = {}) override;
+};
+
+}
+
+#endif // __QGPGME_QGPGMEREVOKEKEYJOB_H__
diff --git a/lang/qt/src/qgpgmesetprimaryuseridjob.cpp b/lang/qt/src/qgpgmesetprimaryuseridjob.cpp
new file mode 100644
index 0000000..32da1fc
--- /dev/null
+++ b/lang/qt/src/qgpgmesetprimaryuseridjob.cpp
@@ -0,0 +1,75 @@
+/*
+ qgpgmesetprimaryuseridjob.cpp
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ 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 "qgpgmesetprimaryuseridjob.h"
+
+#include "util.h"
+
+#include <engineinfo.h>
+
+using namespace QGpgME;
+using namespace GpgME;
+
+static bool quickSetPrimayUidSupportsUidHash()
+{
+ return GpgME::engineInfo(GpgME::GpgEngine).engineVersion() >= "2.3.8";
+}
+
+static QGpgMESetPrimaryUserIDJob::result_type set_primary_userid(Context *ctx, const GpgME::UserID &userId)
+{
+ auto err = ctx->setPrimaryUid(userId.parent(), quickSetPrimayUidSupportsUidHash() ? userId.uidhash() : userId.id());
+ return std::make_tuple(err, QString(), Error());
+}
+
+QGpgMESetPrimaryUserIDJob::QGpgMESetPrimaryUserIDJob(Context *context)
+ : mixin_type{context}
+{
+ lateInitialization();
+}
+
+QGpgMESetPrimaryUserIDJob::~QGpgMESetPrimaryUserIDJob() = default;
+
+GpgME::Error QGpgMESetPrimaryUserIDJob::start(const GpgME::UserID &userId)
+{
+ if (userId.isNull()) {
+ return Error{make_error(GPG_ERR_INV_ARG)};
+ }
+ run([userId](Context *ctx) { return set_primary_userid(ctx, userId); });
+ return {};
+}
+
+#include "qgpgmesetprimaryuseridjob.moc"
diff --git a/lang/qt/src/qgpgmesetprimaryuseridjob.h b/lang/qt/src/qgpgmesetprimaryuseridjob.h
new file mode 100644
index 0000000..4ee967a
--- /dev/null
+++ b/lang/qt/src/qgpgmesetprimaryuseridjob.h
@@ -0,0 +1,64 @@
+/*
+ qgpgmesetprimaryuseridjob.h
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ 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_QGPGMESETPRIMARYUSERIDJOB_H__
+#define __QGPGME_QGPGMESETPRIMARYUSERIDJOB_H__
+
+#include "setprimaryuseridjob.h"
+#include "threadedjobmixin.h"
+
+namespace QGpgME
+{
+
+class QGpgMESetPrimaryUserIDJob
+#ifdef Q_MOC_RUN
+ : public SetPrimaryUserIDJob
+#else
+ : public _detail::ThreadedJobMixin<SetPrimaryUserIDJob>
+#endif
+{
+ Q_OBJECT
+#ifdef Q_MOC_RUN
+public Q_SLOTS:
+ void slotFinished();
+#endif
+public:
+ explicit QGpgMESetPrimaryUserIDJob(GpgME::Context *context);
+ ~QGpgMESetPrimaryUserIDJob() override;
+
+ GpgME::Error start(const GpgME::UserID &userId) override;
+};
+
+}
+
+#endif // __QGPGME_QGPGMESETPRIMARYUSERIDJOB_H__
diff --git a/lang/qt/src/qgpgmesignencryptjob.cpp b/lang/qt/src/qgpgmesignencryptjob.cpp
index 284c110..5466c54 100644
--- a/lang/qt/src/qgpgmesignencryptjob.cpp
+++ b/lang/qt/src/qgpgmesignencryptjob.cpp
@@ -5,6 +5,8 @@
Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
QGpgME is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -46,7 +48,7 @@
#include "exception.h"
#include <QBuffer>
-
+#include <QFileInfo>
#include <cassert>
@@ -69,7 +71,7 @@ void QGpgMESignEncryptJob::setOutputIsBase64Encoded(bool on)
static QGpgMESignEncryptJob::result_type sign_encrypt(Context *ctx, QThread *thread, const std::vector<Key> &signers,
const std::vector<Key> &recipients, const std::weak_ptr<QIODevice> &plainText_,
- const std::weak_ptr<QIODevice> &cipherText_, const Context::EncryptionFlags eflags, bool outputIsBsse64Encoded)
+ const std::weak_ptr<QIODevice> &cipherText_, const Context::EncryptionFlags eflags, bool outputIsBsse64Encoded, const QString &fileName)
{
const std::shared_ptr<QIODevice> &plainText = plainText_.lock();
const std::shared_ptr<QIODevice> &cipherText = cipherText_.lock();
@@ -78,7 +80,12 @@ static QGpgMESignEncryptJob::result_type sign_encrypt(Context *ctx, QThread *thr
const _detail::ToThreadMover ptMover(plainText, thread);
QGpgME::QIODeviceDataProvider in(plainText);
- const Data indata(&in);
+ Data indata(&in);
+
+ const auto pureFileName = QFileInfo{fileName}.fileName().toStdString();
+ if (!pureFileName.empty()) {
+ indata.setFileName(pureFileName.c_str());
+ }
ctx->clearSigningKeys();
Q_FOREACH (const Key &signer, signers)
@@ -116,26 +123,26 @@ static QGpgMESignEncryptJob::result_type sign_encrypt(Context *ctx, QThread *thr
}
static QGpgMESignEncryptJob::result_type sign_encrypt_qba(Context *ctx, const std::vector<Key> &signers,
- const std::vector<Key> &recipients, const QByteArray &plainText, const Context::EncryptionFlags eflags, bool outputIsBsse64Encoded)
+ const std::vector<Key> &recipients, const QByteArray &plainText, const Context::EncryptionFlags eflags, bool outputIsBsse64Encoded, const QString &fileName)
{
const std::shared_ptr<QBuffer> buffer(new QBuffer);
buffer->setData(plainText);
if (!buffer->open(QIODevice::ReadOnly)) {
assert(!"This should never happen: QBuffer::open() failed");
}
- return sign_encrypt(ctx, nullptr, signers, recipients, buffer, std::shared_ptr<QIODevice>(), eflags, outputIsBsse64Encoded);
+ return sign_encrypt(ctx, nullptr, signers, recipients, buffer, std::shared_ptr<QIODevice>(), eflags, outputIsBsse64Encoded, fileName);
}
Error QGpgMESignEncryptJob::start(const std::vector<Key> &signers, const std::vector<Key> &recipients, const QByteArray &plainText, bool alwaysTrust)
{
- run(std::bind(&sign_encrypt_qba, std::placeholders::_1, signers, recipients, plainText, alwaysTrust ? Context::AlwaysTrust : Context::None, mOutputIsBase64Encoded));
+ run(std::bind(&sign_encrypt_qba, std::placeholders::_1, signers, recipients, plainText, alwaysTrust ? Context::AlwaysTrust : Context::None, mOutputIsBase64Encoded, fileName()));
return Error();
}
void QGpgMESignEncryptJob::start(const std::vector<Key> &signers, const std::vector<Key> &recipients,
const std::shared_ptr<QIODevice> &plainText, const std::shared_ptr<QIODevice> &cipherText, const Context::EncryptionFlags eflags)
{
- run(std::bind(&sign_encrypt, std::placeholders::_1, std::placeholders::_2, signers, recipients, std::placeholders::_3, std::placeholders::_4, eflags, mOutputIsBase64Encoded), plainText, cipherText);
+ run(std::bind(&sign_encrypt, std::placeholders::_1, std::placeholders::_2, signers, recipients, std::placeholders::_3, std::placeholders::_4, eflags, mOutputIsBase64Encoded, fileName()), plainText, cipherText);
}
void QGpgMESignEncryptJob::start(const std::vector<Key> &signers, const std::vector<Key> &recipients, const std::shared_ptr<QIODevice> &plainText, const std::shared_ptr<QIODevice> &cipherText, bool alwaysTrust)
@@ -145,7 +152,7 @@ void QGpgMESignEncryptJob::start(const std::vector<Key> &signers, const std::vec
std::pair<SigningResult, EncryptionResult> QGpgMESignEncryptJob::exec(const std::vector<Key> &signers, const std::vector<Key> &recipients, const QByteArray &plainText, const Context::EncryptionFlags eflags, QByteArray &cipherText)
{
- const result_type r = sign_encrypt_qba(context(), signers, recipients, plainText, eflags, mOutputIsBase64Encoded);
+ const result_type r = sign_encrypt_qba(context(), signers, recipients, plainText, eflags, mOutputIsBase64Encoded, fileName());
cipherText = std::get<2>(r);
resultHook(r);
return mResult;
diff --git a/lang/qt/src/qgpgmesignkeyjob.cpp b/lang/qt/src/qgpgmesignkeyjob.cpp
index 5036a9b..506d64a 100644
--- a/lang/qt/src/qgpgmesignkeyjob.cpp
+++ b/lang/qt/src/qgpgmesignkeyjob.cpp
@@ -127,11 +127,11 @@ static QGpgMESignKeyJob::result_type sign_key(Context *ctx, const Key &key, cons
if (expirationDate.isValid()) {
// on 2106-02-07, the Unix time will reach 0xFFFFFFFF; since gpg uses uint32 internally
- // for the expiration date clip it at 2106-02-06
- static const QDate maxAllowedDate{2106, 2, 6};
+ // for the expiration date clip it at 2106-02-05 to avoid problems with negative time zones
+ static const QDate maxAllowedDate{2106, 2, 5};
const auto clippedExpirationDate = expirationDate <= maxAllowedDate ? expirationDate : maxAllowedDate;
if (clippedExpirationDate != expirationDate) {
- qCWarning(QGPGME_LOG) << "Expiration of certification has been changed to" << clippedExpirationDate;
+ qCDebug(QGPGME_LOG) << "Expiration of certification has been changed to" << clippedExpirationDate;
}
// use the "days from now" format to specify the expiration date of the certification;
// this format is the most appropriate regardless of the local timezone
diff --git a/lang/qt/src/refreshkeysjob.h b/lang/qt/src/refreshkeysjob.h
index c4ba74a..67774c2 100644
--- a/lang/qt/src/refreshkeysjob.h
+++ b/lang/qt/src/refreshkeysjob.h
@@ -38,6 +38,8 @@
#include "job.h"
#include "qgpgme_export.h"
+#include <QtCore/QStringList>
+
#include <vector>
namespace GpgME
@@ -46,8 +48,6 @@ class Error;
class Key;
}
-class QStringList;
-
namespace QGpgME
{
@@ -61,7 +61,7 @@ namespace QGpgME
RefreshKeysJob instance will have scheduled its own destruction
with a call to QObject::deleteLater().
- After result() is emitted, the KeyListJob will schedule it's own
+ After result() is emitted, the job will schedule it's own
destruction by calling QObject::deleteLater().
*/
class QGPGME_EXPORT RefreshKeysJob : public Job
@@ -73,21 +73,22 @@ public:
~RefreshKeysJob();
/**
- Starts the keylist operation. \a pattern is a list of patterns
+ Starts the refresh operation. \a pattern is a list of patterns
used to restrict the list of keys returned. Empty patterns are
ignored. If \a pattern is empty or contains only empty strings,
- all keys are returned (however, the backend is free to truncate
- the result and should do so; when this happens, it will be
- reported by the reult object).
+ all keys are refreshed.
- If \a secretOnly is true, only keys for which the secret key is
- also available are returned. Use this if you need to select a
- key for signing.
+ Only implemented for S/MIME.
*/
virtual GpgME::Error start(const QStringList &patterns) = 0;
+ /**
+ Starts a refresh of the \a keys.
+ */
+ virtual GpgME::Error start(const std::vector<GpgME::Key> &keys) = 0;
+
Q_SIGNALS:
- void result(const GpgME::Error &error);
+ void result(const GpgME::Error &result);
};
}
diff --git a/lang/qt/src/revokekeyjob.h b/lang/qt/src/revokekeyjob.h
new file mode 100644
index 0000000..69aef06
--- /dev/null
+++ b/lang/qt/src/revokekeyjob.h
@@ -0,0 +1,86 @@
+/*
+ revokekeyjob.h
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ 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_REVOKEKEYJOB_H__
+#define __QGPGME_REVOKEKEYJOB_H__
+
+#include "job.h"
+#include "qgpgme_export.h"
+
+class QString;
+
+namespace GpgME
+{
+class Error;
+class Key;
+}
+
+namespace QGpgME
+{
+
+class QGPGME_EXPORT RevokeKeyJob : public Job
+{
+ Q_OBJECT
+protected:
+ explicit RevokeKeyJob(QObject *parent);
+
+public:
+ ~RevokeKeyJob();
+
+ /**
+ Starts the operation. \a key is the key to revoke with reason \a reason and
+ optional description \a description. The individual elements of \a description
+ must be non-empty strings and they must not contain any endline characters.
+
+ The job deletes itself after it has completed the operation.
+ */
+ virtual GpgME::Error start(const GpgME::Key &key,
+ GpgME::RevocationReason reason = GpgME::RevocationReason::Unspecified,
+ const std::vector<std::string> &description = {}) = 0;
+
+ /**
+ Runs the operation. \a key is the key to revoke with reason \a reason and
+ optional description \a description. The individual elements of \a description
+ must be non-empty strings and they must not contain any endline characters.
+ */
+ virtual GpgME::Error exec(const GpgME::Key &key,
+ GpgME::RevocationReason reason = GpgME::RevocationReason::Unspecified,
+ const std::vector<std::string> &description = {}) = 0;
+
+Q_SIGNALS:
+ void result(const GpgME::Error &result, const QString &auditLogAsHtml = {}, const GpgME::Error &auditLogError = {});
+};
+
+}
+
+#endif // __QGPGME_REVOKEKEYJOB_H__
diff --git a/lang/qt/src/setprimaryuseridjob.h b/lang/qt/src/setprimaryuseridjob.h
new file mode 100644
index 0000000..fa76199
--- /dev/null
+++ b/lang/qt/src/setprimaryuseridjob.h
@@ -0,0 +1,69 @@
+/*
+ setprimaryuseridjob.h
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ 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_SETPRIMARYUSERIDJOB_H__
+#define __QGPGME_SETPRIMARYUSERIDJOB_H__
+
+#include "job.h"
+
+#include "qgpgme_export.h"
+
+namespace GpgME
+{
+class Error;
+class UserID;
+}
+
+namespace QGpgME
+{
+
+class QGPGME_EXPORT SetPrimaryUserIDJob : public Job
+{
+ Q_OBJECT
+public:
+ explicit SetPrimaryUserIDJob(QObject *parent);
+ ~SetPrimaryUserIDJob() override;
+
+ /**
+ * Starts setting user ID \a userId as the primary user ID.
+ */
+ virtual GpgME::Error start(const GpgME::UserID &userId) = 0;
+
+Q_SIGNALS:
+ void result(const GpgME::Error &error,
+ const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
+};
+
+}
+
+#endif // __QGPGME_SETPRIMARYUSERIDJOB_H__
diff --git a/lang/qt/src/signencryptjob.cpp b/lang/qt/src/signencryptjob.cpp
new file mode 100644
index 0000000..aa02fca
--- /dev/null
+++ b/lang/qt/src/signencryptjob.cpp
@@ -0,0 +1,61 @@
+/*
+ signencryptjob.cpp
+
+ This file is part of qgpgme, the Qt API binding for gpgme
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
+
+ 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 "signencryptjob.h"
+#include "job_p.h"
+
+using namespace QGpgME;
+
+namespace
+{
+struct SignEncryptJobPrivate : public JobPrivate
+{
+ QString m_fileName;
+};
+}
+
+void SignEncryptJob::setFileName(const QString &fileName)
+{
+ auto d = jobPrivate<SignEncryptJobPrivate>(this);
+ d->m_fileName = fileName;
+}
+
+QString SignEncryptJob::fileName() const
+{
+ auto d = jobPrivate<SignEncryptJobPrivate>(this);
+ return d->m_fileName;
+}
diff --git a/lang/qt/src/signencryptjob.h b/lang/qt/src/signencryptjob.h
index 61ab5c6..ebb866d 100644
--- a/lang/qt/src/signencryptjob.h
+++ b/lang/qt/src/signencryptjob.h
@@ -5,6 +5,8 @@
Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
Software engineering by Intevation GmbH
+ Copyright (c) 2022 g10 Code GmbH
+ Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
QGpgME is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -85,6 +87,9 @@ protected:
public:
~SignEncryptJob();
+ void setFileName(const QString &fileName);
+ QString fileName() const;
+
/**
Starts the combined signing and encrypting operation. \a signers
is the list of keys to sign \a plainText with. \a recipients is
@@ -106,8 +111,6 @@ public:
If \a cipherText is non-null, the ciphertext is written
there. Otherwise, it will be delivered in the third argument of
result().
-
- \throws GpgME::Exception if starting fails
*/
virtual void start(const std::vector<GpgME::Key> &signers,
const std::vector<GpgME::Key> &recipients,
diff --git a/lang/qt/src/signjob.h b/lang/qt/src/signjob.h
index 57d2d17..c05231c 100644
--- a/lang/qt/src/signjob.h
+++ b/lang/qt/src/signjob.h
@@ -95,8 +95,6 @@ public:
If \a signature is non-null the signature is written
there. Otherwise, it will be delivered in the second argument of
result().
-
- \throws GpgME::Exception if starting fails
*/
virtual void start(const std::vector<GpgME::Key> &signers,
const std::shared_ptr<QIODevice> &plainText,
diff --git a/lang/qt/src/signkeyjob.h b/lang/qt/src/signkeyjob.h
index f4b3ed8..d0e90c2 100644
--- a/lang/qt/src/signkeyjob.h
+++ b/lang/qt/src/signkeyjob.h
@@ -149,7 +149,7 @@ public:
* Sets the expiration date of the key signature to @a expiration. By default,
* key signatures do not expire.
*
- * Note: Expiration dates after 2106-02-06 will be set to 2106-02-06.
+ * Note: Expiration dates after 2106-02-05 will be set to 2106-02-05.
*
* Not pure virtual for ABI compatibility.
**/
diff --git a/lang/qt/src/util.cpp b/lang/qt/src/util.cpp
index 3d10e2f..66c7eed 100644
--- a/lang/qt/src/util.cpp
+++ b/lang/qt/src/util.cpp
@@ -31,9 +31,17 @@
your version.
*/
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
#include "util.h"
#include <QStringList>
+
+#include <key.h>
+
+#include <algorithm>
#include <functional>
std::vector<std::string> toStrings(const QStringList &l)
@@ -45,3 +53,13 @@ std::vector<std::string> toStrings(const QStringList &l)
std::mem_fn(&QString::toStdString));
return v;
}
+
+QStringList toFingerprints(const std::vector<GpgME::Key> &keys)
+{
+ QStringList fprs;
+ fprs.reserve(keys.size());
+ std::transform(std::begin(keys), std::end(keys), std::back_inserter(fprs), [](const auto &k) {
+ return QString::fromLatin1(k.primaryFingerprint());
+ });
+ return fprs;
+}
diff --git a/lang/qt/src/util.h b/lang/qt/src/util.h
index 94c9733..6aba62e 100644
--- a/lang/qt/src/util.h
+++ b/lang/qt/src/util.h
@@ -36,11 +36,17 @@
#include <gpgme.h>
+#include <sstream>
#include <string>
#include <vector>
class QStringList;
+namespace GpgME
+{
+class Key;
+}
+
static inline gpgme_error_t make_error(gpgme_err_code_t code)
{
return gpgme_err_make((gpgme_err_source_t)22, code);
@@ -48,4 +54,14 @@ static inline gpgme_error_t make_error(gpgme_err_code_t code)
std::vector<std::string> toStrings(const QStringList &l);
+QStringList toFingerprints(const std::vector<GpgME::Key> &keys);
+
+template<class Result>
+std::string toLogString(const Result &result)
+{
+ std::stringstream stream;
+ stream << result;
+ return stream.str();
+}
+
#endif // __QGPGME_UTIL_H__
diff --git a/lang/qt/src/verifydetachedjob.h b/lang/qt/src/verifydetachedjob.h
index 2293f3a..12fdfbb 100644
--- a/lang/qt/src/verifydetachedjob.h
+++ b/lang/qt/src/verifydetachedjob.h
@@ -81,11 +81,6 @@ public:
virtual GpgME::Error start(const QByteArray &signature,
const QByteArray &signedData) = 0;
- /*!
- \overload
-
- \throws GpgME::Exception if starting fails.
- */
virtual void start(const std::shared_ptr<QIODevice> &signature, const std::shared_ptr<QIODevice> &signedData) = 0;
virtual GpgME::VerificationResult exec(const QByteArray &signature,
diff --git a/lang/qt/src/verifyopaquejob.h b/lang/qt/src/verifyopaquejob.h
index bfa34e9..c9b2247 100644
--- a/lang/qt/src/verifyopaquejob.h
+++ b/lang/qt/src/verifyopaquejob.h
@@ -85,8 +85,6 @@ public:
If \a plainText is non-null, the plaintext is written
there. Otherwise, it will be delivered in the second argument
of result().
-
- \throws GpgME::Exception if starting fails
*/
virtual void start(const std::shared_ptr<QIODevice> &signedData, const std::shared_ptr<QIODevice> &plainText = std::shared_ptr<QIODevice>()) = 0;
diff --git a/lang/qt/src/wkspublishjob.h b/lang/qt/src/wkspublishjob.h
index ff3f21e..2b4daf5 100644
--- a/lang/qt/src/wkspublishjob.h
+++ b/lang/qt/src/wkspublishjob.h
@@ -52,11 +52,9 @@ namespace QGpgME {
* 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
+ * When the response is received call startReceive with the
* RFC822 mail received as parameter response. Check for errors
- * and then send again send the result from returnedData back to
- * the server.
- *
+ * and then send the result from returnedData back to the server.
*/
class QGPGME_EXPORT WKSPublishJob: public Job
{
@@ -66,7 +64,6 @@ protected:
public:
~WKSPublishJob();
-
/** Start a check if WKS Publishing is supported. As this involves
* an HTTP Query it might take a while. Returns GPG_ERR_NOT_SUPPORED
* result if GnuPG is too old or the required tools are not installed.