aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Klöcker <[email protected]>2025-02-03 09:49:25 +0000
committerIngo Klöcker <[email protected]>2025-02-03 09:55:40 +0000
commit763d5f5d6a88ec938b8678ab597e1404af724553 (patch)
tree7f3791e3560bd3a51470494bf965b9f9a40a87bd
parentbuild: Fix generation of ChangeLog on secondary working trees (diff)
downloadgpgme-763d5f5d6a88ec938b8678ab597e1404af724553.tar.gz
gpgme-763d5f5d6a88ec938b8678ab597e1404af724553.zip
cpp,qt: Remove C++ and Qt bindings
* README: Update. * configure.ac: Remove checks, variables and file generations related to the C++/Qt bindings. Remove cpp and qt* from available_languages and default_languages. * lang/Makefile.am (DIST_SUBDIRS): Remove cpp and qt. * lang/cpp, lang/qt: Remove. * m4/ax_check_compile_flag.m4, m4/ax_cxx_compile_stdcxx.m4, m4/ax_gcc_func_attribute.m4, m4/pkg.m4, m4/qt5.m4, m4/qt6.m4: Remove. -- The C++ and Qt bindings have been moved to separate Git repositories: gpgmepp and gpgmeqt. GnuPG-bug-id: 7262
-rw-r--r--README5
-rw-r--r--configure.ac298
-rw-r--r--lang/Makefile.am2
-rw-r--r--lang/README9
-rw-r--r--lang/cpp/Makefile.am29
-rw-r--r--lang/cpp/README101
-rw-r--r--lang/cpp/src/GpgmeppConfig-w32.cmake.in.in99
-rw-r--r--lang/cpp/src/GpgmeppConfig.cmake.in.in95
-rw-r--r--lang/cpp/src/GpgmeppConfigVersion.cmake.in31
-rw-r--r--lang/cpp/src/Makefile.am134
-rw-r--r--lang/cpp/src/callbacks.cpp155
-rw-r--r--lang/cpp/src/callbacks.h47
-rw-r--r--lang/cpp/src/configuration.cpp788
-rw-r--r--lang/cpp/src/configuration.h292
-rw-r--r--lang/cpp/src/context.cpp2138
-rw-r--r--lang/cpp/src/context.h586
-rw-r--r--lang/cpp/src/context_p.h88
-rw-r--r--lang/cpp/src/context_vanilla.cpp39
-rw-r--r--lang/cpp/src/data.cpp293
-rw-r--r--lang/cpp/src/data.h149
-rw-r--r--lang/cpp/src/data_p.h42
-rw-r--r--lang/cpp/src/decryptionresult.cpp287
-rw-r--r--lang/cpp/src/decryptionresult.h143
-rw-r--r--lang/cpp/src/defaultassuantransaction.cpp82
-rw-r--r--lang/cpp/src/defaultassuantransaction.h67
-rw-r--r--lang/cpp/src/editinteractor.cpp436
-rw-r--r--lang/cpp/src/editinteractor.h73
-rw-r--r--lang/cpp/src/encryptionresult.cpp165
-rw-r--r--lang/cpp/src/encryptionresult.h117
-rw-r--r--lang/cpp/src/engineinfo.cpp94
-rw-r--r--lang/cpp/src/engineinfo.h255
-rw-r--r--lang/cpp/src/error.h84
-rw-r--r--lang/cpp/src/eventloopinteractor.cpp205
-rw-r--r--lang/cpp/src/eventloopinteractor.h158
-rw-r--r--lang/cpp/src/exception.cpp64
-rw-r--r--lang/cpp/src/exception.h70
-rw-r--r--lang/cpp/src/global.h244
-rw-r--r--lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp205
-rw-r--r--lang/cpp/src/gpgaddexistingsubkeyeditinteractor.h60
-rw-r--r--lang/cpp/src/gpgadduserideditinteractor.cpp191
-rw-r--r--lang/cpp/src/gpgadduserideditinteractor.h69
-rw-r--r--lang/cpp/src/gpgagentgetinfoassuantransaction.cpp123
-rw-r--r--lang/cpp/src/gpgagentgetinfoassuantransaction.h75
-rw-r--r--lang/cpp/src/gpggencardkeyinteractor.cpp469
-rw-r--r--lang/cpp/src/gpggencardkeyinteractor.h95
-rw-r--r--lang/cpp/src/gpgmefw.h81
-rw-r--r--lang/cpp/src/gpgmepp.pc.in13
-rw-r--r--lang/cpp/src/gpgmepp_export.h74
-rw-r--r--lang/cpp/src/gpgmepp_version.h.in31
-rw-r--r--lang/cpp/src/gpgrevokekeyeditinteractor.cpp207
-rw-r--r--lang/cpp/src/gpgrevokekeyeditinteractor.h63
-rw-r--r--lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp143
-rw-r--r--lang/cpp/src/gpgsetexpirytimeeditinteractor.h51
-rw-r--r--lang/cpp/src/gpgsetownertrusteditinteractor.cpp153
-rw-r--r--lang/cpp/src/gpgsetownertrusteditinteractor.h52
-rw-r--r--lang/cpp/src/gpgsignkeyeditinteractor.cpp395
-rw-r--r--lang/cpp/src/gpgsignkeyeditinteractor.h77
-rw-r--r--lang/cpp/src/importresult.cpp395
-rw-r--r--lang/cpp/src/importresult.h152
-rw-r--r--lang/cpp/src/interfaces/assuantransaction.h51
-rw-r--r--lang/cpp/src/interfaces/dataprovider.h55
-rw-r--r--lang/cpp/src/interfaces/passphraseprovider.h42
-rw-r--r--lang/cpp/src/interfaces/progressprovider.h42
-rw-r--r--lang/cpp/src/interfaces/statusconsumer.h42
-rw-r--r--lang/cpp/src/key.cpp1455
-rw-r--r--lang/cpp/src/key.h618
-rw-r--r--lang/cpp/src/keygenerationresult.cpp98
-rw-r--r--lang/cpp/src/keygenerationresult.h85
-rw-r--r--lang/cpp/src/keylistresult.cpp113
-rw-r--r--lang/cpp/src/keylistresult.h84
-rw-r--r--lang/cpp/src/notation.h87
-rw-r--r--lang/cpp/src/result.h68
-rw-r--r--lang/cpp/src/result_p.h45
-rw-r--r--lang/cpp/src/scdgetinfoassuantransaction.cpp161
-rw-r--r--lang/cpp/src/scdgetinfoassuantransaction.h78
-rw-r--r--lang/cpp/src/signingresult.cpp273
-rw-r--r--lang/cpp/src/signingresult.h167
-rw-r--r--lang/cpp/src/statusconsumerassuantransaction.cpp67
-rw-r--r--lang/cpp/src/statusconsumerassuantransaction.h51
-rw-r--r--lang/cpp/src/swdbresult.cpp232
-rw-r--r--lang/cpp/src/swdbresult.h130
-rw-r--r--lang/cpp/src/tofuinfo.cpp173
-rw-r--r--lang/cpp/src/tofuinfo.h124
-rw-r--r--lang/cpp/src/trustitem.cpp120
-rw-r--r--lang/cpp/src/trustitem.h83
-rw-r--r--lang/cpp/src/util.cpp47
-rw-r--r--lang/cpp/src/util.h214
-rw-r--r--lang/cpp/src/verificationresult.cpp642
-rw-r--r--lang/cpp/src/verificationresult.h207
-rw-r--r--lang/cpp/src/vfsmountresult.cpp96
-rw-r--r--lang/cpp/src/vfsmountresult.h77
-rw-r--r--lang/cpp/tests/Makefile.am45
-rw-r--r--lang/cpp/tests/README4
-rw-r--r--lang/cpp/tests/run-getkey.cpp158
-rw-r--r--lang/cpp/tests/run-keylist.cpp172
-rw-r--r--lang/cpp/tests/run-verify.cpp185
-rw-r--r--lang/cpp/tests/run-wkdlookup.cpp158
-rw-r--r--lang/qt/Makefile.am29
-rw-r--r--lang/qt/README130
-rw-r--r--lang/qt/doc/Doxyfile.in2352
-rw-r--r--lang/qt/doc/Makefile.am33
-rw-r--r--lang/qt/src/Makefile.am509
-rw-r--r--lang/qt/src/QGpgmeConfig-w32.cmake.in.in109
-rw-r--r--lang/qt/src/QGpgmeConfig.cmake.in.in101
-rw-r--r--lang/qt/src/QGpgmeConfigVersion.cmake.in31
-rw-r--r--lang/qt/src/QGpgmeQt6Config-w32.cmake.in.in109
-rw-r--r--lang/qt/src/QGpgmeQt6Config.cmake.in.in101
-rw-r--r--lang/qt/src/QGpgmeQt6ConfigVersion.cmake.in31
-rw-r--r--lang/qt/src/abstractimportjob.h65
-rw-r--r--lang/qt/src/addexistingsubkeyjob.h79
-rw-r--r--lang/qt/src/adduseridjob.h85
-rw-r--r--lang/qt/src/changeexpiryjob.cpp62
-rw-r--r--lang/qt/src/changeexpiryjob.h111
-rw-r--r--lang/qt/src/changeexpiryjob_p.h51
-rw-r--r--lang/qt/src/changeownertrustjob.h78
-rw-r--r--lang/qt/src/changepasswdjob.h83
-rw-r--r--lang/qt/src/cleaner.cpp99
-rw-r--r--lang/qt/src/cleaner.h60
-rw-r--r--lang/qt/src/cryptoconfig.cpp75
-rw-r--r--lang/qt/src/cryptoconfig.h424
-rw-r--r--lang/qt/src/dataprovider.cpp301
-rw-r--r--lang/qt/src/dataprovider.h98
-rw-r--r--lang/qt/src/debug.cpp55
-rw-r--r--lang/qt/src/debug.h64
-rw-r--r--lang/qt/src/decryptjob.h99
-rw-r--r--lang/qt/src/decryptverifyarchivejob.cpp95
-rw-r--r--lang/qt/src/decryptverifyarchivejob.h130
-rw-r--r--lang/qt/src/decryptverifyarchivejob_p.h51
-rw-r--r--lang/qt/src/decryptverifyjob.cpp86
-rw-r--r--lang/qt/src/decryptverifyjob.h146
-rw-r--r--lang/qt/src/decryptverifyjob_p.h51
-rw-r--r--lang/qt/src/defaultkeygenerationjob.cpp134
-rw-r--r--lang/qt/src/defaultkeygenerationjob.h80
-rw-r--r--lang/qt/src/deletejob.h84
-rw-r--r--lang/qt/src/dn.cpp497
-rw-r--r--lang/qt/src/dn.h137
-rw-r--r--lang/qt/src/downloadjob.h104
-rw-r--r--lang/qt/src/encryptarchivejob.cpp119
-rw-r--r--lang/qt/src/encryptarchivejob.h151
-rw-r--r--lang/qt/src/encryptarchivejob_p.h53
-rw-r--r--lang/qt/src/encryptjob.cpp122
-rw-r--r--lang/qt/src/encryptjob.h198
-rw-r--r--lang/qt/src/encryptjob_p.h60
-rw-r--r--lang/qt/src/exportjob.h95
-rw-r--r--lang/qt/src/filelistdataprovider.cpp98
-rw-r--r--lang/qt/src/filelistdataprovider.h75
-rw-r--r--lang/qt/src/gpgcardjob.h74
-rw-r--r--lang/qt/src/hierarchicalkeylistjob.h122
-rw-r--r--lang/qt/src/importfromkeyserverjob.h85
-rw-r--r--lang/qt/src/importjob.cpp87
-rw-r--r--lang/qt/src/importjob.h98
-rw-r--r--lang/qt/src/importjob_p.h54
-rw-r--r--lang/qt/src/job.cpp214
-rw-r--r--lang/qt/src/job.h152
-rw-r--r--lang/qt/src/job_p.h98
-rw-r--r--lang/qt/src/keyformailboxjob.h99
-rw-r--r--lang/qt/src/keygenerationjob.h86
-rw-r--r--lang/qt/src/keylistjob.h106
-rw-r--r--lang/qt/src/listallkeysjob.cpp53
-rw-r--r--lang/qt/src/listallkeysjob.h116
-rw-r--r--lang/qt/src/listallkeysjob_p.h51
-rw-r--r--lang/qt/src/multideletejob.cpp123
-rw-r--r--lang/qt/src/multideletejob.h108
-rw-r--r--lang/qt/src/protocol.h235
-rw-r--r--lang/qt/src/protocol_p.h575
-rw-r--r--lang/qt/src/qgpgme_debug.cpp14
-rw-r--r--lang/qt/src/qgpgme_debug.h10
-rw-r--r--lang/qt/src/qgpgme_export.h84
-rw-r--r--lang/qt/src/qgpgme_version.h.in42
-rw-r--r--lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp96
-rw-r--r--lang/qt/src/qgpgmeaddexistingsubkeyjob.h68
-rw-r--r--lang/qt/src/qgpgmeadduseridjob.cpp85
-rw-r--r--lang/qt/src/qgpgmeadduseridjob.h66
-rw-r--r--lang/qt/src/qgpgmebackend.cpp222
-rw-r--r--lang/qt/src/qgpgmebackend.h95
-rw-r--r--lang/qt/src/qgpgmechangeexpiryjob.cpp133
-rw-r--r--lang/qt/src/qgpgmechangeexpiryjob.h72
-rw-r--r--lang/qt/src/qgpgmechangeownertrustjob.cpp96
-rw-r--r--lang/qt/src/qgpgmechangeownertrustjob.h66
-rw-r--r--lang/qt/src/qgpgmechangepasswdjob.cpp84
-rw-r--r--lang/qt/src/qgpgmechangepasswdjob.h67
-rw-r--r--lang/qt/src/qgpgmedecryptjob.cpp128
-rw-r--r--lang/qt/src/qgpgmedecryptjob.h75
-rw-r--r--lang/qt/src/qgpgmedecryptverifyarchivejob.cpp169
-rw-r--r--lang/qt/src/qgpgmedecryptverifyarchivejob.h68
-rw-r--r--lang/qt/src/qgpgmedecryptverifyjob.cpp228
-rw-r--r--lang/qt/src/qgpgmedecryptverifyjob.h76
-rw-r--r--lang/qt/src/qgpgmedeletejob.cpp70
-rw-r--r--lang/qt/src/qgpgmedeletejob.h72
-rw-r--r--lang/qt/src/qgpgmedownloadjob.cpp105
-rw-r--r--lang/qt/src/qgpgmedownloadjob.h70
-rw-r--r--lang/qt/src/qgpgmeencryptarchivejob.cpp192
-rw-r--r--lang/qt/src/qgpgmeencryptarchivejob.h70
-rw-r--r--lang/qt/src/qgpgmeencryptjob.cpp257
-rw-r--r--lang/qt/src/qgpgmeencryptjob.h98
-rw-r--r--lang/qt/src/qgpgmeexportjob.cpp115
-rw-r--r--lang/qt/src/qgpgmeexportjob.h81
-rw-r--r--lang/qt/src/qgpgmegpgcardjob.cpp131
-rw-r--r--lang/qt/src/qgpgmegpgcardjob.h63
-rw-r--r--lang/qt/src/qgpgmeimportfromkeyserverjob.cpp80
-rw-r--r--lang/qt/src/qgpgmeimportfromkeyserverjob.h72
-rw-r--r--lang/qt/src/qgpgmeimportjob.cpp172
-rw-r--r--lang/qt/src/qgpgmeimportjob.h76
-rw-r--r--lang/qt/src/qgpgmekeyformailboxjob.cpp142
-rw-r--r--lang/qt/src/qgpgmekeyformailboxjob.h80
-rw-r--r--lang/qt/src/qgpgmekeygenerationjob.cpp76
-rw-r--r--lang/qt/src/qgpgmekeygenerationjob.h69
-rw-r--r--lang/qt/src/qgpgmekeylistjob.cpp164
-rw-r--r--lang/qt/src/qgpgmekeylistjob.h80
-rw-r--r--lang/qt/src/qgpgmelistallkeysjob.cpp241
-rw-r--r--lang/qt/src/qgpgmelistallkeysjob.h73
-rw-r--r--lang/qt/src/qgpgmenewcryptoconfig.cpp819
-rw-r--r--lang/qt/src/qgpgmenewcryptoconfig.h188
-rw-r--r--lang/qt/src/qgpgmequickjob.cpp211
-rw-r--r--lang/qt/src/qgpgmequickjob.h78
-rw-r--r--lang/qt/src/qgpgmereceivekeysjob.cpp73
-rw-r--r--lang/qt/src/qgpgmereceivekeysjob.h69
-rw-r--r--lang/qt/src/qgpgmerefreshsmimekeysjob.cpp256
-rw-r--r--lang/qt/src/qgpgmerefreshsmimekeysjob.h78
-rw-r--r--lang/qt/src/qgpgmerevokekeyjob.cpp127
-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/qgpgmesignarchivejob.cpp196
-rw-r--r--lang/qt/src/qgpgmesignarchivejob.h69
-rw-r--r--lang/qt/src/qgpgmesignencryptarchivejob.cpp212
-rw-r--r--lang/qt/src/qgpgmesignencryptarchivejob.h72
-rw-r--r--lang/qt/src/qgpgmesignencryptjob.cpp266
-rw-r--r--lang/qt/src/qgpgmesignencryptjob.h106
-rw-r--r--lang/qt/src/qgpgmesignjob.cpp280
-rw-r--r--lang/qt/src/qgpgmesignjob.h90
-rw-r--r--lang/qt/src/qgpgmesignkeyjob.cpp242
-rw-r--r--lang/qt/src/qgpgmesignkeyjob.h98
-rw-r--r--lang/qt/src/qgpgmetofupolicyjob.cpp70
-rw-r--r--lang/qt/src/qgpgmetofupolicyjob.h66
-rw-r--r--lang/qt/src/qgpgmeverifydetachedjob.cpp201
-rw-r--r--lang/qt/src/qgpgmeverifydetachedjob.h76
-rw-r--r--lang/qt/src/qgpgmeverifyopaquejob.cpp216
-rw-r--r--lang/qt/src/qgpgmeverifyopaquejob.h75
-rw-r--r--lang/qt/src/qgpgmewkdlookupjob.cpp185
-rw-r--r--lang/qt/src/qgpgmewkdlookupjob.h70
-rw-r--r--lang/qt/src/qgpgmewkdrefreshjob.cpp159
-rw-r--r--lang/qt/src/qgpgmewkdrefreshjob.h64
-rw-r--r--lang/qt/src/qgpgmewkspublishjob.cpp195
-rw-r--r--lang/qt/src/qgpgmewkspublishjob.h71
-rw-r--r--lang/qt/src/quickjob.cpp52
-rw-r--r--lang/qt/src/quickjob.h101
-rw-r--r--lang/qt/src/quickjob_p.h51
-rw-r--r--lang/qt/src/receivekeysjob.h66
-rw-r--r--lang/qt/src/refreshkeysjob.h96
-rw-r--r--lang/qt/src/revokekeyjob.h86
-rw-r--r--lang/qt/src/setprimaryuseridjob.h69
-rw-r--r--lang/qt/src/signarchivejob.cpp107
-rw-r--r--lang/qt/src/signarchivejob.h141
-rw-r--r--lang/qt/src/signarchivejob_p.h52
-rw-r--r--lang/qt/src/signencryptarchivejob.cpp131
-rw-r--r--lang/qt/src/signencryptarchivejob.h165
-rw-r--r--lang/qt/src/signencryptarchivejob_p.h54
-rw-r--r--lang/qt/src/signencryptjob.cpp122
-rw-r--r--lang/qt/src/signencryptjob.h213
-rw-r--r--lang/qt/src/signencryptjob_p.h59
-rw-r--r--lang/qt/src/signjob.cpp110
-rw-r--r--lang/qt/src/signjob.h176
-rw-r--r--lang/qt/src/signjob_p.h56
-rw-r--r--lang/qt/src/signkeyjob.h164
-rw-r--r--lang/qt/src/specialjob.h92
-rw-r--r--lang/qt/src/threadedjobmixin.cpp152
-rw-r--r--lang/qt/src/threadedjobmixin.h302
-rw-r--r--lang/qt/src/tofupolicyjob.h77
-rw-r--r--lang/qt/src/util.cpp173
-rw-r--r--lang/qt/src/util.h91
-rw-r--r--lang/qt/src/verifydetachedjob.cpp86
-rw-r--r--lang/qt/src/verifydetachedjob.h130
-rw-r--r--lang/qt/src/verifydetachedjob_p.h51
-rw-r--r--lang/qt/src/verifyopaquejob.cpp86
-rw-r--r--lang/qt/src/verifyopaquejob.h142
-rw-r--r--lang/qt/src/verifyopaquejob_p.h51
-rw-r--r--lang/qt/src/wkdlookupjob.h78
-rw-r--r--lang/qt/src/wkdlookupresult.cpp117
-rw-r--r--lang/qt/src/wkdlookupresult.h84
-rw-r--r--lang/qt/src/wkdrefreshjob.cpp64
-rw-r--r--lang/qt/src/wkdrefreshjob.h80
-rw-r--r--lang/qt/src/wkdrefreshjob_p.h52
-rw-r--r--lang/qt/src/wkspublishjob.h108
-rw-r--r--lang/qt/tests/Makefile.am424
-rwxr-xr-xlang/qt/tests/final.test6
-rwxr-xr-xlang/qt/tests/initial.test2
-rw-r--r--lang/qt/tests/run-decryptverifyarchivejob.cpp127
-rw-r--r--lang/qt/tests/run-decryptverifyjob.cpp168
-rw-r--r--lang/qt/tests/run-encryptarchivejob.cpp217
-rw-r--r--lang/qt/tests/run-encryptjob.cpp199
-rw-r--r--lang/qt/tests/run-exportjob.cpp120
-rw-r--r--lang/qt/tests/run-importjob.cpp97
-rw-r--r--lang/qt/tests/run-keyformailboxjob.cpp61
-rw-r--r--lang/qt/tests/run-receivekeysjob.cpp66
-rw-r--r--lang/qt/tests/run-refreshkeysjob.cpp156
-rw-r--r--lang/qt/tests/run-signarchivejob.cpp177
-rw-r--r--lang/qt/tests/run-signjob.cpp168
-rw-r--r--lang/qt/tests/run-verifydetachedjob.cpp128
-rw-r--r--lang/qt/tests/run-verifyopaquejob.cpp165
-rw-r--r--lang/qt/tests/run-wkdrefreshjob.cpp154
-rw-r--r--lang/qt/tests/t-addexistingsubkey.cpp266
-rw-r--r--lang/qt/tests/t-changeexpiryjob.cpp397
-rw-r--r--lang/qt/tests/t-config.cpp94
-rw-r--r--lang/qt/tests/t-decryptverify.cpp131
-rw-r--r--lang/qt/tests/t-disablekey.cpp118
-rw-r--r--lang/qt/tests/t-encrypt.cpp333
-rw-r--r--lang/qt/tests/t-import.cpp250
-rw-r--r--lang/qt/tests/t-keylist.cpp206
-rw-r--r--lang/qt/tests/t-keylocate.cpp132
-rw-r--r--lang/qt/tests/t-ownertrust.cpp113
-rw-r--r--lang/qt/tests/t-remarks.cpp472
-rw-r--r--lang/qt/tests/t-revokekey.cpp338
-rw-r--r--lang/qt/tests/t-setprimaryuserid.cpp165
-rw-r--r--lang/qt/tests/t-support.cpp170
-rw-r--r--lang/qt/tests/t-support.h134
-rw-r--r--lang/qt/tests/t-tofuinfo.cpp530
-rw-r--r--lang/qt/tests/t-trustsignatures.cpp524
-rw-r--r--lang/qt/tests/t-various.cpp418
-rw-r--r--lang/qt/tests/t-verify.cpp95
-rw-r--r--lang/qt/tests/t-wkdlookup.cpp155
-rw-r--r--lang/qt/tests/t-wkspublish.cpp280
-rw-r--r--m4/ax_check_compile_flag.m453
-rw-r--r--m4/ax_cxx_compile_stdcxx.m41009
-rw-r--r--m4/ax_gcc_func_attribute.m4242
-rw-r--r--m4/pkg.m4157
-rw-r--r--m4/qt5.m483
-rw-r--r--m4/qt6.m498
328 files changed, 16 insertions, 51562 deletions
diff --git a/README b/README
index a62ddeab..dc47f622 100644
--- a/README
+++ b/README
@@ -22,8 +22,9 @@ to public key crypto engines like GnuPG or GpgSM easier for
applications. GPGME provides a high-level crypto API for encryption,
decryption, signing, signature verification and key management.
-GPGME comes with language bindings for Common Lisp, C++, QT, Python2,
-and Python 3.
+GPGME comes with language bindings for Common Lisp, Python2, and
+Python 3. Language bindings for C++ and Qt are available in separate
+repositories.
GPGME uses GnuPG as its backend to support OpenPGP and the
Cryptographic Message Syntax (CMS).
diff --git a/configure.ac b/configure.ac
index 8d712dc9..c631a8f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -58,31 +58,12 @@ AC_INIT([mym4_package],[mym4_version],[https://bugs.gnupg.org])
LIBGPGME_LT_CURRENT=44
LIBGPGME_LT_AGE=33
LIBGPGME_LT_REVISION=1
-
-# If there is an ABI break in gpgmepp or qgpgme also bump the
-# version in IMPORTED_LOCATION in the GpgmeppConfig-w32.cmake.in.in
-
-LIBGPGMEPP_LT_CURRENT=27
-LIBGPGMEPP_LT_AGE=21
-LIBGPGMEPP_LT_REVISION=1
-
-LIBQGPGME_LT_CURRENT=21
-LIBQGPGME_LT_AGE=6
-LIBQGPGME_LT_REVISION=1
################################################
AC_SUBST(LIBGPGME_LT_CURRENT)
AC_SUBST(LIBGPGME_LT_AGE)
AC_SUBST(LIBGPGME_LT_REVISION)
-AC_SUBST(LIBGPGMEPP_LT_CURRENT)
-AC_SUBST(LIBGPGMEPP_LT_AGE)
-AC_SUBST(LIBGPGMEPP_LT_REVISION)
-
-AC_SUBST(LIBQGPGME_LT_CURRENT)
-AC_SUBST(LIBQGPGME_LT_AGE)
-AC_SUBST(LIBQGPGME_LT_REVISION)
-
# If the API is changed in an incompatible way: increment the next counter.
GPGME_CONFIG_API_VERSION=1
##############################################
@@ -159,7 +140,6 @@ AH_VERBATIM([_REENTRANT],
AC_PROG_CC
AC_PROG_CPP
-AC_PROG_CXX
# Note: A suitable gitlog-to-changelog script can be found in GnuPG master.
AC_CHECK_PROGS(GITLOG_TO_CHANGELOG, gitlog-to-changelog, [gitlog-to-changelog])
@@ -262,8 +242,8 @@ have_w64_system=no
have_macos_system=no
build_w32_glib=no
build_w32_qt=no
-available_languages="cl cpp python qt qt5 qt6"
-default_languages="cl cpp python qt5 qt6"
+available_languages="cl python"
+default_languages="cl python"
case "${host}" in
x86_64-*mingw32*)
have_w64_system=yes
@@ -344,47 +324,14 @@ if test x$fixed_search_path != x ; then
[Locate binaries only via this PATH])
fi
-# Option --enable-reduce-relocations
-#
-# Allow building the Qt 6 bindings explicitly with -fPIC if the automatic
-# detection fails. Note: We assume that this flag is always available (unless
-# we built for Windows).
-AC_ARG_ENABLE([reduce-relocations],
- AS_HELP_STRING([--enable-reduce-relocations],
- [build Qt 6 bindings with -fPIC (default is
- auto)]),
- [use_reduce_relocations="$enableval"],
- [use_reduce_relocations=""])
-
-# Option --enable-no-direct-extern-access
-#
-# Some distributions build Qt 6 with -mno-direct-extern-access. Libraries and
-# applications using Qt then must also be build with this flag. As workaround
-# for a bug in Qt's pkgconfig files which don't have this flag we allow
-# building with this flag explicitly.
-AC_LANG_PUSH(C++)
-AX_CHECK_COMPILE_FLAG([-mno-direct-extern-access],
- [have_no_direct_extern_access="yes"],
- [have_no_direct_extern_access="no"],
- [-Werror])
-AC_LANG_POP()
-AC_ARG_ENABLE([no-direct-extern-access],
- AS_HELP_STRING([--enable-no-direct-extern-access],
- [build Qt 6 bindings with
- -mno-direct-extern-access (default is auto)]),
- [use_no_direct_extern_access="$enableval"],
- [use_no_direct_extern_access=""])
-
-
# Note: You need to declare all possible languages also in
# lang/Makefile.am's DIST_SUBDIRS.
AC_ARG_ENABLE([languages],
AS_HELP_STRING([--enable-languages=languages],
[enable only specific language bindings:
- cl cpp python qt5 qt6]),
+ cl python]),
[enabled_languages=`echo $enableval | \
- tr ',:' ' ' | tr '[A-Z]' '[a-z]' | \
- sed 's/c++/cpp/'`],
+ tr ',:' ' ' | tr '[A-Z]' '[a-z]'`],
[enabled_languages="maybe"])
if test "x$enabled_languages" = "x" \
-o "$enabled_languages" = "no"; then
@@ -407,191 +354,6 @@ for language in $enabled_languages; do
fi
done
-# Check whether qt5 and/or qt6 are enabled
-want_qt5="no"
-LIST_MEMBER("qt5", $enabled_languages)
-if test "$found" = "1"; then
- if test "$explicit_languages" = "1"; then
- want_qt5="yes"
- else
- want_qt5="maybe"
- fi
- # Remove qt5; further down qt will be added
- enabled_languages=$(echo $enabled_languages | sed 's/qt5//')
-fi
-want_qt6="no"
-LIST_MEMBER("qt6", $enabled_languages)
-if test "$found" = "1"; then
- if test "$explicit_languages" = "1"; then
- want_qt6="yes"
- else
- want_qt6="maybe"
- fi
- # Remove qt6; further down qt will be added
- enabled_languages=$(echo $enabled_languages | sed 's/qt6//')
-fi
-
-# Check whether qt is enabled; if yes then it has been enabled explicitly
-want_qt="no"
-LIST_MEMBER("qt", $enabled_languages)
-if test "$found" = "1"; then
- # Ignore qt if specified together with qt5 or qt6
- if test "$want_qt5" = "no" -a "$want_qt6" = "no"; then
- want_qt="yes"
- fi
- # Remove qt
- enabled_languages=$(echo $enabled_languages | sed 's/qt//')
- AC_MSG_WARN([[
-***
-*** Language binding "qt" is deprecated and will be removed in a future version.
-*** Use "qt5" and/or "qt6" instead.
-***]])
-fi
-
-# Ensure that pkg-config is available for all calls of FIND_QT5/FIND_QT6
-PKG_PROG_PKG_CONFIG
-
-# Check for Qt 5 (if qt5 or qt is enabled)
-if test "$want_qt" = "yes"; then
- want_qt5="maybe"
-fi
-if test "$want_qt5" != "no"; then
- FIND_QT5
- if test "$have_qt5_libs" = "yes"; then
- want_qt5="yes"
- elif test "$want_qt5" = "yes"; then
- AC_MSG_ERROR([[
-***
-*** Qt5 (Qt5Core) is required for the Qt 5 binding.
-***]])
- else
- want_qt5="no"
- fi
-fi
-
-# Check for Qt 6 (if qt6 is enabled or if qt is enabled and Qt 5 wasn't found)
-if test "$want_qt" = "yes" -a "$have_qt5_libs" != "yes"; then
- want_qt6="maybe"
-fi
-if test "$want_qt6" != "no"; then
- FIND_QT6
- if test "$have_qt6_libs" = "yes"; then
- want_qt6="yes";
- elif test "$want_qt6" = "yes"; then
- AC_MSG_ERROR([[
-***
-*** Qt6 (Qt6Core) is required for the Qt 6 binding.
-***]])
- else
- want_qt6="no"
- fi
-fi
-
-# Check if any Qt was found (if qt is enabled)
-if test "$want_qt" = "yes" -a "$have_qt5_libs" != "yes" -a "$have_qt6_libs" != "yes"; then
- AC_MSG_ERROR([[
-***
-*** Qt5 (Qt5Core) or Qt6 (Qt6Core) is required for the Qt bindings.
-***]])
-fi
-
-# Check that cpp is enabled if qt5 or qt6 is enabled and was found
-if test "$want_qt5" = "yes" -o "$want_qt6" = "yes"; then
- LIST_MEMBER("cpp", $enabled_languages)
- if test "$found" = "0"; then
- AC_MSG_ERROR([[
-***
-*** The Qt bindings depend on the C++ binding.
-***]])
- fi
-fi
-
-# Enable C++ 17 if qt6 is requested
-if test "$want_qt6" = "yes"; then
- AX_CXX_COMPILE_STDCXX(17, noext, optional)
- if test "$HAVE_CXX17" != "1"; then
- if test "$explicit_languages" = "1"; then
- AC_MSG_ERROR([[
-***
-*** A compiler with c++17 support is required for the Qt 6 binding.
-***]])
- else
- want_qt6="no"
- AC_MSG_WARN([[
-***
-*** No c++17 support detected. Qt 6 binding will be disabled.
-***]])
- fi
- fi
-fi
-
-# Enable C++ 11 if cpp is requested (unless C++ 17 was already enabled)
-LIST_MEMBER("cpp", $enabled_languages)
-if test "$found" = "1" -a "$HAVE_CXX17" != "1"; then
- AX_CXX_COMPILE_STDCXX(11, noext, optional)
- if test "$HAVE_CXX11" != "1"; then
- if test "$explicit_languages" = "1"; then
- AC_MSG_ERROR([[
-***
-*** A compiler with c++11 support is required for the C++ binding.
-***]])
- else
- enabled_languages=$(echo $enabled_languages | sed 's/cpp//')
- want_qt5="no"
- AC_MSG_WARN([[
-***
-*** No c++11 support detected. C++ and Qt 5 bindings will be disabled.
-***]])
- fi
- fi
-fi
-
-# Now append qt to the list of language bindings (to enable the subdir in lang)
-if test "$want_qt5" = "yes" -o "$want_qt6" = "yes"; then
- enabled_languages=$(echo $enabled_languages qt)
-fi
-
-# Check whether compiler supports visibility attribute (if cpp language is enabled)
-LIST_MEMBER("cpp", $enabled_languages)
-if test "$found" = "1"; then
- AX_GCC_FUNC_ATTRIBUTE(visibility)
- if test "$ax_cv_have_func_attribute_visibility" = "yes"; then
- GPGME_CPP_CFLAGS="$GPGME_CPP_CFLAGS -fvisibility=hidden"
- if test "$want_qt5" = "yes"; then
- GPGME_QT5_CFLAGS="$GPGME_QT5_CFLAGS -fvisibility=hidden"
- fi
- if test "$want_qt6" = "yes"; then
- GPGME_QT6_CFLAGS="$GPGME_QT6_CFLAGS -fvisibility=hidden"
- fi
- fi
-fi
-AC_SUBST(GPGME_CPP_CFLAGS)
-
-AM_CONDITIONAL(WANT_QT5, test "$want_qt5" = yes)
-AM_CONDITIONAL(WANT_QT6, test "$want_qt6" = yes)
-
-# Check for tools for building the Qt binding docs
-if test "$want_qt5" = "yes" -o "$want_qt6" = "yes"; then
- AC_CHECK_PROGS([DOXYGEN], [doxygen])
- if test -z "$DOXYGEN"; then
- # This is not highlighted because it's not really important.
- AC_MSG_WARN([Doxygen not found - Qt binding doc will not be built.])
- fi
- AC_CHECK_PROGS([GRAPHVIZ], [dot])
- if test -z "$GRAPHVIZ"; then
- AC_MSG_WARN([Graphviz not found - Qt binding doc will not have diagrams.])
- fi
-fi
-
-AM_CONDITIONAL([HAVE_DOXYGEN],
- [test -n "$DOXYGEN"])
-if test -n "$GRAPHVIZ"; then
- HAVE_DOT="YES"
-else
- HAVE_DOT="NO"
-fi
-AC_SUBST(HAVE_DOT)
-
# Python bindings.
LIST_MEMBER("python", $enabled_languages)
found_py=$found
@@ -1044,16 +806,12 @@ AH_BOTTOM([
])
-# Substitution used for gpgme-config and gpgme.pc and gpgmepp.pc
+# Substitution used for gpgme-config and gpgme.pc
GPGME_CONFIG_LIBS="-lgpgme"
GPGME_CONFIG_CFLAGS=""
GPGME_CONFIG_HOST="$host"
GPGME_CONFIG_AVAIL_LANG="$enabled_languages"
-GPGMEPP_PKGCONFIG_LIBS="-lgpgmepp"
-GPGMEPP_PKGCONFIG_CFLAGS=""
-GPGMEPP_PKGCONFIG_HOST="$host"
-
case "$includedir" in
/usr/include|/include) ;;
'${prefix}/include')
@@ -1063,11 +821,6 @@ case "$includedir" in
else
GPGME_CONFIG_CFLAGS="-I\${includedir} $GPGME_CONFIG_CFLAGS"
fi
- if test -z "$GPGMEPP_PKGCONFIG_CFLAGS"; then
- GPGMEPP_PKGCONFIG_CFLAGS="-I\${includedir}"
- else
- GPGMEPP_PKGCONFIG_CFLAGS="-I\${includedir} $GPGMEPP_PKGCONFIG_CFLAGS"
- fi
fi
;;
*)
@@ -1076,11 +829,6 @@ case "$includedir" in
else
GPGME_CONFIG_CFLAGS="-I\${includedir} $GPGME_CONFIG_CFLAGS"
fi
- if test -z "$GPGMEPP_PKGCONFIG_CFLAGS"; then
- GPGMEPP_PKGCONFIG_CFLAGS="-I\${includedir}"
- else
- GPGMEPP_PKGCONFIG_CFLAGS="-I\${includedir} $GPGMEPP_PKGCONFIG_CFLAGS"
- fi
;;
esac
case "$libdir" in
@@ -1089,16 +837,13 @@ case "$libdir" in
if test "$exec_prefix" = "NONE"; then
if test "$prefix" != / -a "$prefix" != /usr; then
GPGME_CONFIG_LIBS="-L\${libdir} $GPGME_CONFIG_LIBS"
- GPGMEPP_PKGCONFIG_LIBS="-L\${libdir} $GPGMEPP_PKGCONFIG_LIBS"
fi
elif test "$exec_prefix" != / -a "$exec_prefix" != /usr; then
GPGME_CONFIG_LIBS="-L\${libdir} $GPGME_CONFIG_LIBS"
- GPGMEPP_PKGCONFIG_LIBS="-L\${libdir} $GPGMEPP_PKGCONFIG_LIBS"
fi
;;
*)
GPGME_CONFIG_LIBS="-L\${libdir} $GPGME_CONFIG_LIBS"
- GPGMEPP_PKGCONFIG_LIBS="-L\${libdir} $GPGMEPP_PKGCONFIG_LIBS"
;;
esac
@@ -1107,9 +852,6 @@ AC_SUBST(GPGME_CONFIG_LIBS)
AC_SUBST(GPGME_CONFIG_CFLAGS)
AC_SUBST(GPGME_CONFIG_HOST)
AC_SUBST(GPGME_CONFIG_AVAIL_LANG)
-AC_SUBST(GPGMEPP_PKGCONFIG_LIBS)
-AC_SUBST(GPGMEPP_PKGCONFIG_CFLAGS)
-AC_SUBST(GPGMEPP_PKGCONFIG_HOST)
# Frob'da Variables
LTLIBOBJS=`echo "$LIB@&t@OBJS" |
@@ -1176,32 +918,10 @@ AC_CONFIG_FILES(Makefile src/Makefile
src/gpgme-glib.pc
src/gpgme.h)
AC_CONFIG_FILES(src/gpgme-config, chmod +x src/gpgme-config)
-AC_CONFIG_FILES(lang/cpp/Makefile lang/cpp/src/Makefile)
-AC_CONFIG_FILES(lang/cpp/tests/Makefile)
-AC_CONFIG_FILES(lang/cpp/src/gpgmepp.pc)
-AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfig-w32.cmake.in)
-AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfig.cmake.in)
-AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfigVersion.cmake)
-AC_CONFIG_FILES(lang/cpp/src/gpgmepp_version.h)
-AC_CONFIG_FILES(lang/qt/Makefile lang/qt/src/Makefile)
-if test "$want_qt5" = "yes"; then
- AC_CONFIG_FILES(lang/qt/src/QGpgmeConfig-w32.cmake.in)
- AC_CONFIG_FILES(lang/qt/src/QGpgmeConfig.cmake.in)
- AC_CONFIG_FILES(lang/qt/src/QGpgmeConfigVersion.cmake)
-fi
-if test "$want_qt6" = "yes"; then
- AC_CONFIG_FILES(lang/qt/src/QGpgmeQt6Config-w32.cmake.in)
- AC_CONFIG_FILES(lang/qt/src/QGpgmeQt6Config.cmake.in)
- AC_CONFIG_FILES(lang/qt/src/QGpgmeQt6ConfigVersion.cmake)
-fi
-AC_CONFIG_FILES(lang/qt/tests/Makefile)
-AC_CONFIG_FILES(lang/qt/src/qgpgme_version.h)
AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpgme.asd])
-AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([lang/qt/doc/Doxyfile])])
AC_CONFIG_FILES([lang/js/Makefile lang/js/src/Makefile
lang/js/BrowserTestExtension/Makefile
lang/js/DemoExtension/Makefile])
-AC_CONFIG_FILES(lang/qt/doc/Makefile)
AC_CONFIG_FILES([lang/python/Makefile
lang/python/version.py
lang/python/tests/Makefile
@@ -1211,14 +931,6 @@ AC_CONFIG_FILES([lang/python/Makefile
AC_CONFIG_FILES([lang/python/setup.py], [chmod a+x lang/python/setup.py])
AC_OUTPUT
-if test "$want_qt5" = "yes" -a "$want_qt6" = "yes"; then
- enabled_languages_v=$(echo ${enabled_languages_v:-$enabled_languages} | sed "s/qt/qt (Qt 5, Qt 6)/")
-elif test "$want_qt5" = "yes"; then
- enabled_languages_v=$(echo ${enabled_languages_v:-$enabled_languages} | sed "s/qt/qt (Qt 5)/")
-elif test "$want_qt6" = "yes"; then
- enabled_languages_v=$(echo ${enabled_languages_v:-$enabled_languages} | sed "s/qt/qt (Qt 6)/")
-fi
-
echo "
GPGME v${VERSION} has been configured as follows:
diff --git a/lang/Makefile.am b/lang/Makefile.am
index 0cc36c27..5f8fbc94 100644
--- a/lang/Makefile.am
+++ b/lang/Makefile.am
@@ -18,6 +18,6 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
SUBDIRS = $(ENABLED_LANGUAGES)
-DIST_SUBDIRS = cl cpp qt python js
+DIST_SUBDIRS = cl python js
EXTRA_DIST = README
diff --git a/lang/README b/lang/README
index afd7b083..ebda5c39 100644
--- a/lang/README
+++ b/lang/README
@@ -10,7 +10,12 @@ sub-directory.
Directory Language
cl Common Lisp
-cpp C++
-qt Qt-Framework API
python Python 2 and 3 (module name: gpg)
js Native messaging client for the gpgme-json server.
+
+More language bindings are available in separate repositories.
+
+Repository Language
+
+gpgmepp C++
+gpgmeqt Qt-Framework API
diff --git a/lang/cpp/Makefile.am b/lang/cpp/Makefile.am
deleted file mode 100644
index 70ca7462..00000000
--- a/lang/cpp/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-# Makefile.am for GPGMEPP.
-# Copyright (C) 2016 Bundesamt für Sicherheit in der Informationstechnik
-# Software engineering by 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 Lesser General Public
-# License along with this program; if not, see <https://gnu.org/licenses/>.
-# SPDX-License-Identifier: LGPL-2.1-or-later
-
-if RUN_GPG_TESTS
-tests = tests
-else
-tests =
-endif
-
-SUBDIRS = src ${tests}
-
-EXTRA_DIST = README
diff --git a/lang/cpp/README b/lang/cpp/README
deleted file mode 100644
index 16c9a4a1..00000000
--- a/lang/cpp/README
+++ /dev/null
@@ -1,101 +0,0 @@
-GpgMEpp - C++ bindings/wrapper for GPGME
-----------------------------------------
-Based on KF5gpgmepp
-
-Overview
---------
-
-GpgMEpp is a C++ wrapper (or C++ bindings) for the GnuPG project's
-gpgme (GnuPG Made Easy) library, version 0.4.4 and later.
-
-It is fairly complete, with some minor things still missing (in
-particular, the key edit interface).
-
-The design principles of this library are as follows:
-
-1. A value-based interface (most clases are implicitly shared)
-2. Callbacks are replaced by C++ interfaces (classes with only
- abstract methods).
-3. No exceptions are thrown
-4. There is (as yet) no explicit support for multi-threaded use
- (other than what gpgme itself provides; most notably the
- refcounting for implicit sharing is not thread-safe)
-5. To avoid binary incompatible interface changes, we make
- extensive use of the d-pointer pattern and avoid virtual
- methods; any polymorphism present is already provided by gpgme
- itself, anyway (see e.g. Data). A notable exception of the
- no-virtuals rule is the use of abstract classes to cover
- C-callbacks.
-6. Use of STL containers for improved memory management and
- dealing with lists.
-7. Complete abstraction of the C-API so "gpgme.h" should not
- be needed in your project using GpgME++.
-8. Abstraction of GnuPG's edit-key interface by prepared
- Editinteractor classes.
-
-GpgMEpp was originally developed as part of the KDEPIM community.
-
-Usage
------
-
-The usage pattern of GpgMEpp closely follows GPGMEs core usage
-pattern so the documentation for GPGME itself provides a good
-way to start.
-
-The context structure in GPGME is mapped to a Context object in
-GpgMEpp. Additional convenience code provides Data objects and
-a Dataprovider interface that can be used to implement GPGME's
-data with any subclass by implementing the right callbacks.
-
-EditInteractor subclasses provide ready to use classes for
-common --edit-key tasks. You can implement your own editinteractor
-classes by implementing the EditInteractor interface and using
-your subclass as an interactor in the edit function.
-
-Example to set the ownertrust of a key:
-
- /* Create an edit interactor */
- EditInteractor *ei = new GpgSetOwnerTrustEditInteractor(Key::Ultimate);
- /* Obtain a Context */
- Context *ctx = Context::createForProtocol(Protocol::OpenPGP);
- /* Create an in memory data object */
- Data data;
- /* Start the edit on some key previously obtained. */
- Error e = ctx->edit(key, std::unique_ptr<EditInteractor>(ei), data);
- /* Errors provide boolean comparison */
- if (!e)
- ...
- /* Delete the context */
- delete ctx;
-
-Examples / Tests
-----------------
-
-GpgMEpp is tested through the Qt API. You can refer to the
-tests in qt/tests for examples of usage or refer to
-the actual QGpgME*Job.cpp implementations which rely
-on GpgMEpp and should cover most use cases.
-
-Hacking
--------
-
-GpgMEpp follows KDE Coding styles. See:
-https://techbase.kde.org/Policies/Frameworks_Coding_Style
-for more info.
-
-License
--------
-GPGMEpp 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.
-
-GPGMEpp 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.
diff --git a/lang/cpp/src/GpgmeppConfig-w32.cmake.in.in b/lang/cpp/src/GpgmeppConfig-w32.cmake.in.in
deleted file mode 100644
index 51ada3b1..00000000
--- a/lang/cpp/src/GpgmeppConfig-w32.cmake.in.in
+++ /dev/null
@@ -1,99 +0,0 @@
-# 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)
diff --git a/lang/cpp/src/GpgmeppConfig.cmake.in.in b/lang/cpp/src/GpgmeppConfig.cmake.in.in
deleted file mode 100644
index 8777623e..00000000
--- a/lang/cpp/src/GpgmeppConfig.cmake.in.in
+++ /dev/null
@@ -1,95 +0,0 @@
-# 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
- INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/gpgme++;@resolved_includedir@"
- INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme@libsuffix@;@LIBASSUAN_LIBS@"
- IMPORTED_LOCATION "@resolved_libdir@/libgpgmepp@libsuffix@"
-)
-
-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)
diff --git a/lang/cpp/src/GpgmeppConfigVersion.cmake.in b/lang/cpp/src/GpgmeppConfigVersion.cmake.in
deleted file mode 100644
index 259bddd5..00000000
--- a/lang/cpp/src/GpgmeppConfigVersion.cmake.in
+++ /dev/null
@@ -1,31 +0,0 @@
-# CMake Version 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.
-set(PACKAGE_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_MICRO@")
-
-if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
- set(PACKAGE_VERSION_COMPATIBLE FALSE)
-else()
- set(PACKAGE_VERSION_COMPATIBLE TRUE)
- if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
- set(PACKAGE_VERSION_EXACT TRUE)
- endif()
-endif()
diff --git a/lang/cpp/src/Makefile.am b/lang/cpp/src/Makefile.am
deleted file mode 100644
index db363226..00000000
--- a/lang/cpp/src/Makefile.am
+++ /dev/null
@@ -1,134 +0,0 @@
-# Makefile.am for GPGMEPP.
-# Copyright (C) 2016 Bundesamt für Sicherheit in der Informationstechnik
-# Software engineering by 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
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = gpgmepp.pc
-
-EXTRA_DIST = GpgmeppConfig.cmake.in.in GpgmeppConfigVersion.cmake.in \
- gpgmepp_version.h.in GpgmeppConfig-w32.cmake.in.in \
- gpgmepp.pc.in
-
-lib_LTLIBRARIES = libgpgmepp.la
-
-main_sources = \
- exception.cpp context.cpp key.cpp trustitem.cpp data.cpp callbacks.cpp \
- eventloopinteractor.cpp editinteractor.cpp \
- keylistresult.cpp keygenerationresult.cpp importresult.cpp \
- decryptionresult.cpp verificationresult.cpp \
- signingresult.cpp encryptionresult.cpp \
- engineinfo.cpp gpgsetexpirytimeeditinteractor.cpp \
- gpgsetownertrusteditinteractor.cpp gpgsignkeyeditinteractor.cpp \
- gpgadduserideditinteractor.cpp gpggencardkeyinteractor.cpp \
- gpgaddexistingsubkeyeditinteractor.cpp \
- gpgrevokekeyeditinteractor.cpp \
- defaultassuantransaction.cpp \
- scdgetinfoassuantransaction.cpp gpgagentgetinfoassuantransaction.cpp \
- statusconsumerassuantransaction.cpp \
- vfsmountresult.cpp configuration.cpp tofuinfo.cpp swdbresult.cpp \
- util.cpp
-
-gpgmepp_headers = \
- configuration.h context.h data.h decryptionresult.h \
- defaultassuantransaction.h editinteractor.h encryptionresult.h \
- engineinfo.h error.h eventloopinteractor.h exception.h global.h \
- gpgadduserideditinteractor.h gpgagentgetinfoassuantransaction.h \
- gpgmefw.h gpgsetexpirytimeeditinteractor.h \
- gpgsetownertrusteditinteractor.h gpgsignkeyeditinteractor.h \
- gpggencardkeyinteractor.h \
- gpgaddexistingsubkeyeditinteractor.h \
- gpgrevokekeyeditinteractor.h \
- importresult.h keygenerationresult.h key.h keylistresult.h \
- notation.h result.h scdgetinfoassuantransaction.h signingresult.h \
- statusconsumerassuantransaction.h \
- trustitem.h verificationresult.h vfsmountresult.h gpgmepp_export.h \
- tofuinfo.h swdbresult.h
-
-private_gpgmepp_headers = \
- result_p.h context_p.h util.h callbacks.h data_p.h
-
-interface_headers= \
- interfaces/assuantransaction.h interfaces/dataprovider.h \
- interfaces/passphraseprovider.h interfaces/progressprovider.h \
- interfaces/statusconsumer.h
-
-gpgmeppincludedir = $(includedir)/gpgme++
-gpgmeppinclude_HEADERS = $(gpgmepp_headers)
-nobase_gpgmeppinclude_HEADERS = $(interface_headers)
-nodist_gpgmeppinclude_HEADERS = gpgmepp_version.h
-
-libgpgmepp_la_SOURCES = $(main_sources) $(gpgmepp_headers) context_vanilla.cpp \
- $(interface_headers) $(private_gpgmepp_headers)
-
-AM_CPPFLAGS = -I$(top_builddir)/src \
- @GPGME_CPP_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
- -DBUILDING_GPGMEPP -Wsuggest-override \
- -Wzero-as-null-pointer-constant
-
-libgpgmepp_la_LIBADD = ../../../src/libgpgme.la @LIBASSUAN_LIBS@
-libgpgmepp_la_LDFLAGS = -no-undefined -version-info \
- @LIBGPGMEPP_LT_CURRENT@:@LIBGPGMEPP_LT_REVISION@:@LIBGPGMEPP_LT_AGE@
-
-if HAVE_MACOS_SYSTEM
-libsuffix=.dylib
-else
-libsuffix=.so
-endif
-
-copied_headers = $(gpgmepp_headers:%=gpgme++/%) $(interface_headers:%=gpgme++/%)
-
-$(copied_headers): Makefile.am
- mkdir -p $(builddir)/gpgme++/interfaces
- echo -n "#include \"$(abs_srcdir)" > "$@"
- echo -n "$@" | sed "s/gpgme++//" >> "$@"
- echo "\"" >> "$@"
-
-if HAVE_W32_SYSTEM
-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
-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 \
- $(DESTDIR)$(libdir)/cmake/Gpgmepp/GpgmeppConfig.cmake
- $(INSTALL) -m 644 GpgmeppConfigVersion.cmake \
- $(DESTDIR)$(libdir)/cmake/Gpgmepp/GpgmeppConfigVersion.cmake
-
-uninstall-cmake-files:
- -rm $(DESTDIR)$(libdir)/cmake/Gpgmepp/GpgmeppConfigVersion.cmake
- -rm $(DESTDIR)$(libdir)/cmake/Gpgmepp/GpgmeppConfig.cmake
- -rmdir $(DESTDIR)$(libdir)/cmake/Gpgmepp/
-
-install-data-local: install-cmake-files
-
-uninstall-local: uninstall-cmake-files
-
-BUILT_SOURCES = $(copied_headers)
-
-CLEANFILES = GpgmeppConfig.cmake GpgmeppConfigVersion.cmake \
- gpgmepp_version.h GpgmeppConfig.cmake.in \
- $(copied_headers)
diff --git a/lang/cpp/src/callbacks.cpp b/lang/cpp/src/callbacks.cpp
deleted file mode 100644
index 21c2a813..00000000
--- a/lang/cpp/src/callbacks.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- callbacks.cpp - callback targets for internal use:
- Copyright (C) 2003,2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "callbacks.h"
-#include "util.h"
-
-#include <interfaces/progressprovider.h>
-#include <interfaces/passphraseprovider.h>
-#include <interfaces/dataprovider.h>
-#include <error.h>
-
-#include <gpgme.h>
-#include <gpg-error.h>
-
-#include <cassert>
-#include <cerrno>
-#include <cstring>
-#include <unistd.h>
-#include <stdlib.h>
-
-static inline gpgme_error_t make_err_from_syserror()
-{
- return gpgme_error_from_syserror();
-}
-
-using GpgME::ProgressProvider;
-using GpgME::PassphraseProvider;
-using GpgME::DataProvider;
-
-void progress_callback(void *opaque, const char *what,
- int type, int current, int total)
-{
- ProgressProvider *provider = static_cast<ProgressProvider *>(opaque);
- if (provider) {
- provider->showProgress(what, type, current, total);
- }
-}
-
-/* To avoid that a compiler optimizes certain memset calls away, these
- macros may be used instead. */
-#define wipememory2(_ptr,_set,_len) do { \
- volatile char *_vptr=(volatile char *)(_ptr); \
- size_t _vlen=(_len); \
- while(_vlen) { *_vptr=(_set); _vptr++; _vlen--; } \
- } while(0)
-#define wipememory(_ptr,_len) wipememory2(_ptr,0,_len)
-
-gpgme_error_t passphrase_callback(void *opaque, const char *uid_hint, const char *desc,
- int prev_was_bad, int fd)
-{
- PassphraseProvider *provider = static_cast<PassphraseProvider *>(opaque);
- bool canceled = false;
- gpgme_error_t err = GPG_ERR_NO_ERROR;
- char *passphrase = provider ? provider->getPassphrase(uid_hint, desc, prev_was_bad, canceled) : nullptr ;
- if (canceled) {
- err = make_error(GPG_ERR_CANCELED);
- } else {
- if (passphrase && *passphrase) {
- size_t passphrase_length = std::strlen(passphrase);
- size_t written = 0;
- do {
- ssize_t now_written = gpgme_io_write(fd, passphrase + written, passphrase_length - written);
- if (now_written < 0) {
- err = make_err_from_syserror();
- break;
- }
- written += now_written;
- } while (written < passphrase_length);
- }
- }
-
- if (passphrase && *passphrase) {
- wipememory(passphrase, std::strlen(passphrase));
- }
- free(passphrase);
- gpgme_io_write(fd, "\n", 1);
- return err;
-}
-
-static gpgme_ssize_t
-data_read_callback(void *opaque, void *buf, size_t buflen)
-{
- DataProvider *provider = static_cast<DataProvider *>(opaque);
- if (!provider) {
- gpgme_err_set_errno(gpgme_err_code_to_errno(GPG_ERR_EINVAL));
- return -1;
- }
- return (gpgme_ssize_t)provider->read(buf, buflen);
-}
-
-static gpgme_ssize_t
-data_write_callback(void *opaque, const void *buf, size_t buflen)
-{
- DataProvider *provider = static_cast<DataProvider *>(opaque);
- if (!provider) {
- gpgme_err_set_errno(gpgme_err_code_to_errno(GPG_ERR_EINVAL));
- return -1;
- }
- return (gpgme_ssize_t)provider->write(buf, buflen);
-}
-
-static gpgme_off_t
-data_seek_callback(void *opaque, gpgme_off_t offset, int whence)
-{
- DataProvider *provider = static_cast<DataProvider *>(opaque);
- if (!provider) {
- gpgme_err_set_errno(gpgme_err_code_to_errno(GPG_ERR_EINVAL));
- return -1;
- }
- if (whence != SEEK_SET && whence != SEEK_CUR && whence != SEEK_END) {
- gpgme_err_set_errno(gpgme_err_code_to_errno(GPG_ERR_EINVAL));
- return -1;
- }
- return provider->seek((off_t)offset, whence);
-}
-
-static void data_release_callback(void *opaque)
-{
- DataProvider *provider = static_cast<DataProvider *>(opaque);
- if (provider) {
- provider->release();
- }
-}
-
-const gpgme_data_cbs GpgME::data_provider_callbacks = {
- &data_read_callback,
- &data_write_callback,
- &data_seek_callback,
- &data_release_callback
-};
diff --git a/lang/cpp/src/callbacks.h b/lang/cpp/src/callbacks.h
deleted file mode 100644
index a2c6e1b9..00000000
--- a/lang/cpp/src/callbacks.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- callbacks.h - callback targets for internal use:
- Copyright (C) 2003 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- This file is part of GPGME++.
-
- This is an internal header file, subject to change without
- notice. DO NOT USE.
-
- 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_CALLBACKS_H__
-#define __GPGMEPP_CALLBACKS_H__
-
-#include <gpgme.h>
-
-extern "C" {
-
- void progress_callback(void *opaque, const char *what,
- int type, int current, int total);
- gpgme_error_t passphrase_callback(void *opaque, const char *uid_hint,
- const char *desc, int prev_was_bad, int fd);
-}
-
-namespace GpgME
-{
-extern const gpgme_data_cbs data_provider_callbacks;
-extern const gpgme_edit_cb_t edit_interactor_callback;
-}
-
-#endif // __GPGME_CALLBACKS_H__
diff --git a/lang/cpp/src/configuration.cpp b/lang/cpp/src/configuration.cpp
deleted file mode 100644
index b3b62d6f..00000000
--- a/lang/cpp/src/configuration.cpp
+++ /dev/null
@@ -1,788 +0,0 @@
-/*
- configuration.cpp - wraps gpgme configuration components
- Copyright (C) 2010 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "configuration.h"
-#include "error.h"
-#include "util.h"
-
-#include <gpgme.h>
-
-#include <iterator>
-#include <algorithm>
-#include <ostream>
-#include <cstring>
-#include <assert.h>
-
-using namespace GpgME;
-using namespace GpgME::Configuration;
-
-typedef std::shared_ptr< std::remove_pointer<gpgme_conf_opt_t>::type > shared_gpgme_conf_opt_t;
-typedef std::weak_ptr< std::remove_pointer<gpgme_conf_opt_t>::type > weak_gpgme_conf_opt_t;
-
-typedef std::shared_ptr< std::remove_pointer<gpgme_conf_arg_t>::type > shared_gpgme_conf_arg_t;
-typedef std::weak_ptr< std::remove_pointer<gpgme_conf_arg_t>::type > weak_gpgme_conf_arg_t;
-
-typedef std::shared_ptr< std::remove_pointer<gpgme_ctx_t>::type > shared_gpgme_ctx_t;
-typedef std::weak_ptr< std::remove_pointer<gpgme_ctx_t>::type > weak_gpgme_ctx_t;
-
-namespace
-{
-struct nodelete {
- template <typename T> void operator()(T *) {}
-};
-}
-
-// static
-std::vector<Component> Component::load(Error &returnedError)
-{
-
- //
- // 1. get a context:
- //
- gpgme_ctx_t ctx_native = nullptr;
- if (const gpgme_error_t err = gpgme_new(&ctx_native)) {
- returnedError = Error(err);
- return std::vector<Component>();
- }
- const shared_gpgme_ctx_t ctx(ctx_native, &gpgme_release);
-
- //
- // 2. load the config:
- //
- gpgme_conf_comp_t conf_list_native = nullptr;
- if (const gpgme_error_t err = gpgme_op_conf_load(ctx_native, &conf_list_native)) {
- returnedError = Error(err);
- return std::vector<Component>();
- }
- shared_gpgme_conf_comp_t head(conf_list_native, &gpgme_conf_release);
-
- //
- // 3. convert to vector<Component>:
- //
- std::vector<Component> result;
-
- while (head) {
- // secure 'head->next' (if any) against memleaks:
- shared_gpgme_conf_comp_t next;
- if (head->next) {
- next.reset(head->next, &gpgme_conf_release);
- }
-
- // now prevent double-free of next.get() and following:
- head->next = nullptr;
-
- // now add a new Component to 'result' (may throw):
- result.resize(result.size() + 1);
- result.back().comp.swap(head); // .comp = std::move( head );
- head.swap(next); // head = std::move( next );
- }
-
- return result;
-}
-
-Error Component::save() const
-{
-
- if (isNull()) {
- return Error(make_error(GPG_ERR_INV_ARG));
- }
-
- //
- // 1. get a context:
- //
- gpgme_ctx_t ctx_native = nullptr;
- if (const gpgme_error_t err = gpgme_new(&ctx_native)) {
- return Error(err);
- }
- const shared_gpgme_ctx_t ctx(ctx_native, &gpgme_release);
-
- //
- // 2. save the config:
- //
- return Error(gpgme_op_conf_save(ctx.get(), comp.get()));
-}
-
-const char *Component::name() const
-{
- return comp ? comp->name : nullptr;
-}
-
-const char *Component::description() const
-{
- return comp ? comp->description : nullptr ;
-}
-
-const char *Component::programName() const
-{
- return comp ? comp->program_name : nullptr ;
-}
-
-Option Component::option(unsigned int idx) const
-{
- gpgme_conf_opt_t opt = nullptr;
- if (comp) {
- opt = comp->options;
- }
- while (opt && idx) {
- opt = opt->next;
- --idx;
- }
- if (opt) {
- return Option(comp, opt);
- }
- return Option();
-}
-
-Option Component::option(const char *name) const
-{
- gpgme_conf_opt_t opt = nullptr;
- if (comp) {
- opt = comp->options;
- }
- using namespace std; // for strcmp
- while (opt && strcmp(name, opt->name) != 0) {
- opt = opt->next;
- }
- if (opt) {
- return Option(comp, opt);
- }
- return Option();
-}
-
-unsigned int Component::numOptions() const
-{
- unsigned int result = 0;
- for (gpgme_conf_opt_t opt = comp ? comp->options : nullptr ; opt ; opt = opt->next) {
- ++result;
- }
- return result;
-}
-
-std::vector<Option> Component::options() const
-{
- std::vector<Option> result;
- for (gpgme_conf_opt_t opt = comp ? comp->options : nullptr ; opt ; opt = opt->next) {
- result.push_back(Option(comp, opt));
- }
- return result;
-}
-
-static gpgme_conf_arg_t mygpgme_conf_arg_copy(gpgme_conf_arg_t other, gpgme_conf_type_t type)
-{
- gpgme_conf_arg_t result = nullptr, last = nullptr;
- for (gpgme_conf_arg_t a = other ; a ; a = a->next) {
- gpgme_conf_arg_t arg = nullptr;
- const gpgme_error_t err
- = gpgme_conf_arg_new(&arg, type,
- a->no_arg ? nullptr :
- type == GPGME_CONF_STRING ? a->value.string :
- /* else */ static_cast<void *>(&a->value));
- if (err) {
- gpgme_conf_arg_release(result, type);
- return nullptr;
- }
- assert(arg);
- if (result) {
- last->next = arg;
- } else {
- result = arg;
- }
- last = arg;
- }
- return result;
-}
-
-Component Option::parent() const
-{
- return Component(comp.lock());
-}
-
-unsigned int Option::flags() const
-{
- return isNull() ? 0 : opt->flags;
-}
-
-Level Option::level() const
-{
- return isNull() ? Internal : static_cast<Level>(opt->level) ;
-}
-
-const char *Option::name() const
-{
- return isNull() ? nullptr : opt->name ;
-}
-
-const char *Option::description() const
-{
- return isNull() ? nullptr : opt->description ;
-}
-
-const char *Option::argumentName() const
-{
- return isNull() ? nullptr : opt->argname ;
-}
-
-Type Option::type() const
-{
- return isNull() ? NoType : static_cast<Type>(opt->type) ;
-}
-
-Type Option::alternateType() const
-{
- return isNull() ? NoType : static_cast<Type>(opt->alt_type) ;
-}
-
-Argument Option::defaultValue() const
-{
- if (isNull()) {
- return Argument();
- } else {
- return Argument(comp.lock(), opt, opt->default_value, false);
- }
-}
-
-const char *Option::defaultDescription() const
-{
- return isNull() ? nullptr : opt->default_description ;
-}
-
-Argument Option::noArgumentValue() const
-{
- if (isNull()) {
- return Argument();
- } else {
- return Argument(comp.lock(), opt, opt->no_arg_value, false);
- }
-}
-
-const char *Option::noArgumentDescription() const
-{
- return isNull() ? nullptr : opt->no_arg_description ;
-}
-
-Argument Option::activeValue() const
-{
- if (isNull()) {
- return Argument();
- } else {
- return Argument(comp.lock(), opt, opt->value, false);
- }
-}
-
-Argument Option::currentValue() const
-{
- if (isNull()) {
- return Argument();
- }
- const gpgme_conf_arg_t arg =
- opt->change_value ? opt->new_value ? opt->new_value : opt->default_value :
- opt->value ? opt->value :
- /* else */ opt->default_value ;
- return Argument(comp.lock(), opt, arg, false);
-}
-
-Argument Option::newValue() const
-{
- if (isNull()) {
- return Argument();
- } else {
- return Argument(comp.lock(), opt, opt->new_value, false);
- }
-}
-
-bool Option::set() const
-{
- if (isNull()) {
- return false;
- } else if (opt->change_value) {
- return opt->new_value;
- } else {
- return opt->value;
- }
-}
-
-bool Option::dirty() const
-{
- return !isNull() && opt->change_value ;
-}
-
-Error Option::setNewValue(const Argument &argument)
-{
- if (isNull()) {
- return Error(make_error(GPG_ERR_INV_ARG));
- } else if (argument.isNull()) {
- return resetToDefaultValue();
- } else if (const gpgme_conf_arg_t arg = mygpgme_conf_arg_copy(argument.arg, opt->alt_type)) {
- return Error(gpgme_conf_opt_change(opt, 0, arg));
- } else {
- return Error(make_error(GPG_ERR_ENOMEM));
- }
-}
-
-Error Option::resetToActiveValue()
-{
- if (isNull()) {
- return Error(make_error(GPG_ERR_INV_ARG));
- } else {
- return Error(gpgme_conf_opt_change(opt, 1, nullptr));
- }
-}
-
-Error Option::resetToDefaultValue()
-{
- if (isNull()) {
- return Error(make_error(GPG_ERR_INV_ARG));
- } else {
- return Error(gpgme_conf_opt_change(opt, 0, nullptr));
- }
-}
-
-static gpgme_conf_arg_t make_argument(gpgme_conf_type_t type, const void *value)
-{
- gpgme_conf_arg_t arg = nullptr;
- if (const gpgme_error_t err = gpgme_conf_arg_new(&arg, type, value)) {
- return nullptr;
- } else {
- return arg;
- }
-}
-
-Argument Option::createNoneArgument(bool set) const
-{
- if (isNull() || alternateType() != NoType) {
- return Argument();
- } else {
- if (set) {
- return createNoneListArgument(1);
- }
- }
- return Argument();
-}
-
-Argument Option::createStringArgument(const char *value) const
-{
- if (isNull() || alternateType() != StringType) {
- return Argument();
- } else {
- return Argument(comp.lock(), opt, make_argument(GPGME_CONF_STRING, value), true);
- }
-}
-
-Argument Option::createStringArgument(const std::string &value) const
-{
- if (isNull() || alternateType() != StringType) {
- return Argument();
- } else {
- return Argument(comp.lock(), opt, make_argument(GPGME_CONF_STRING, value.c_str()), true);
- }
-}
-
-Argument Option::createIntArgument(int value) const
-{
- if (isNull() || alternateType() != IntegerType) {
- return Argument();
- } else {
- return Argument(comp.lock(), opt, make_argument(GPGME_CONF_INT32, &value), true);
- }
-}
-
-Argument Option::createUIntArgument(unsigned int value) const
-{
- if (isNull() || alternateType() != UnsignedIntegerType) {
- return Argument();
- } else {
- return Argument(comp.lock(), opt, make_argument(GPGME_CONF_UINT32, &value), true);
- }
-}
-
-namespace
-{
-const void *to_void_star(const char *s)
-{
- return s;
-}
-const void *to_void_star(const std::string &s)
-{
- return s.c_str();
-}
-const void *to_void_star(const int &i)
-{
- return &i; // const-&: sic!
-}
-const void *to_void_star(const unsigned int &i)
-{
- return &i; // const-&: sic!
-}
-
-template <typename T>
-gpgme_conf_arg_t make_argument(gpgme_conf_type_t type, const std::vector<T> &value)
-{
- gpgme_conf_arg_t result = nullptr;
- gpgme_conf_arg_t last = nullptr;
- for (typename std::vector<T>::const_iterator it = value.begin(), end = value.end() ; it != end ; ++it) {
- if (gpgme_conf_arg_t arg = make_argument(type, to_void_star(*it))) {
- if (last) {
- last = last->next = arg;
- } else {
- result = last = arg;
- }
- }
- }
- return result;
-}
-}
-
-Argument Option::createNoneListArgument(unsigned int value) const
-{
- if (value) {
- return Argument(comp.lock(), opt, make_argument(GPGME_CONF_NONE, &value), true);
- }
- return Argument();
-}
-
-Argument Option::createStringListArgument(const std::vector<const char *> &value) const
-{
- return Argument(comp.lock(), opt, make_argument(GPGME_CONF_STRING, value), true);
-}
-
-Argument Option::createStringListArgument(const std::vector<std::string> &value) const
-{
- return Argument(comp.lock(), opt, make_argument(GPGME_CONF_STRING, value), true);
-}
-
-Argument Option::createIntListArgument(const std::vector<int> &value) const
-{
- return Argument(comp.lock(), opt, make_argument(GPGME_CONF_INT32, value), true);
-}
-
-Argument Option::createUIntListArgument(const std::vector<unsigned int> &value) const
-{
- return Argument(comp.lock(), opt, make_argument(GPGME_CONF_UINT32, value), true);
-}
-
-Argument::Argument(const shared_gpgme_conf_comp_t &comp, gpgme_conf_opt_t opt, gpgme_conf_arg_t arg, bool owns)
- : comp(comp),
- opt(opt),
- arg(owns ? arg : mygpgme_conf_arg_copy(arg, opt ? opt->alt_type : GPGME_CONF_NONE))
-{
-
-}
-
-#if 0
-Argument::Argument(const shared_gpgme_conf_comp_t &comp, gpgme_conf_opt_t opt, gpgme_conf_arg_t arg)
- : comp(comp),
- opt(opt),
- arg(mygpgme_conf_arg_copy(arg, opt ? opt->alt_type : GPGME_CONF_NONE))
-{
-
-}
-#endif
-
-Argument::Argument(const Argument &other)
- : comp(other.comp),
- opt(other.opt),
- arg(mygpgme_conf_arg_copy(other.arg, opt ? opt->alt_type : GPGME_CONF_NONE))
-{
-
-}
-
-Argument::~Argument()
-{
- gpgme_conf_arg_release(arg, opt ? opt->alt_type : GPGME_CONF_NONE);
-}
-
-Option Argument::parent() const
-{
- return Option(comp.lock(), opt);
-}
-
-bool Argument::boolValue() const
-{
- return numberOfTimesSet();
-}
-
-unsigned int Argument::numElements() const
-{
- if (isNull()) {
- return 0;
- }
- unsigned int result = 0;
- for (gpgme_conf_arg_t a = arg ; a ; a = a->next) {
- ++result;
- }
- return result;
-}
-
-const char *Argument::stringValue(unsigned int idx) const
-{
- if (isNull() || opt->alt_type != GPGME_CONF_STRING) {
- return nullptr;
- }
- gpgme_conf_arg_t a = arg;
- while (a && idx) {
- a = a->next;
- --idx;
- }
- return a ? a->value.string : nullptr ;
-}
-
-int Argument::intValue(unsigned int idx) const
-{
- if (isNull() || opt->alt_type != GPGME_CONF_INT32) {
- return 0;
- }
- gpgme_conf_arg_t a = arg;
- while (a && idx) {
- a = a->next;
- --idx;
- }
- return a ? a->value.int32 : 0 ;
-}
-
-unsigned int Argument::uintValue(unsigned int idx) const
-{
- if (isNull() || opt->alt_type != GPGME_CONF_UINT32) {
- return 0;
- }
- gpgme_conf_arg_t a = arg;
- while (a && idx) {
- a = a->next;
- --idx;
- }
- return a ? a->value.uint32 : 0 ;
-}
-
-unsigned int Argument::numberOfTimesSet() const
-{
- if (isNull() || opt->alt_type != GPGME_CONF_NONE) {
- return 0;
- }
- return arg->value.count;
-}
-
-std::vector<const char *> Argument::stringValues() const
-{
- if (isNull() || opt->alt_type != GPGME_CONF_STRING) {
- return std::vector<const char *>();
- }
- std::vector<const char *> result;
- for (gpgme_conf_arg_t a = arg ; a ; a = a->next) {
- result.push_back(a->value.string);
- }
- return result;
-}
-
-std::vector<int> Argument::intValues() const
-{
- if (isNull() || opt->alt_type != GPGME_CONF_INT32) {
- return std::vector<int>();
- }
- std::vector<int> result;
- for (gpgme_conf_arg_t a = arg ; a ; a = a->next) {
- result.push_back(a->value.int32);
- }
- return result;
-}
-
-std::vector<unsigned int> Argument::uintValues() const
-{
- if (isNull() || opt->alt_type != GPGME_CONF_UINT32) {
- return std::vector<unsigned int>();
- }
- std::vector<unsigned int> result;
- for (gpgme_conf_arg_t a = arg ; a ; a = a->next) {
- result.push_back(a->value.uint32);
- }
- return result;
-}
-
-std::ostream &Configuration::operator<<(std::ostream &os, Level level)
-{
- switch (level) {
- case Basic: return os << "Basic";
- case Advanced: return os << "Advanced";
- case Expert: return os << "Expert";
- case Invisible: return os << "Invisible";
- case Internal: return os << "Internal";
- case NumLevels: ;
- }
- return os << "<unknown>";
-}
-
-std::ostream &Configuration::operator<<(std::ostream &os, Type type)
-{
- switch (type) {
- case NoType: return os << "None";
- case StringType: return os << "String";
- case IntegerType: return os << "Integer";
- case UnsignedIntegerType: return os << "UnsignedInteger";
- case FilenameType: return os << "Filename";
- case LdapServerType: return os << "LdapServer";
- case KeyFingerprintType: return os << "KeyFingerprint";
- case PublicKeyType: return os << "PublicKey";
- case SecretKeyType: return os << "SecretKey";
- case AliasListType: return os << "AliasList";
- case MaxType: ;
- }
- return os << "<unknown>";
-}
-
-std::ostream &Configuration::operator<<(std::ostream &os, Flag f)
-{
- unsigned int flags = f;
- std::vector<const char *> s;
- if (flags & Group) {
- s.push_back("Group");
- }
- if (flags & Optional) {
- s.push_back("Optional");
- }
- if (flags & List) {
- s.push_back("List");
- }
- if (flags & Runtime) {
- s.push_back("Runtime");
- }
- if (flags & Default) {
- s.push_back("Default");
- }
- if (flags & DefaultDescription) {
- s.push_back("DefaultDescription");
- }
- if (flags & NoArgumentDescription) {
- s.push_back("NoArgumentDescription");
- }
- if (flags & NoChange) {
- s.push_back("NoChange");
- }
- flags &= ~(Group | Optional | List | Runtime | Default | DefaultDescription | NoArgumentDescription | NoChange);
- if (flags) {
- s.push_back("other flags(");
- }
- std::copy(s.begin(), s.end(),
- std::ostream_iterator<const char *>(os, "|"));
- if (flags) {
- os << flags << ')';
- }
- return os;
-}
-
-std::ostream &Configuration::operator<<(std::ostream &os, const Component &c)
-{
- os << "Component["
- << "\n name : " << protect(c.name())
- << "\n description: " << protect(c.description())
- << "\n programName: " << protect(c.programName())
- << "\n options : \n";
- const std::vector<Option> options = c.options();
- std::copy(options.begin(), options.end(),
- std::ostream_iterator<Option>(os, "\n"));
- os << "\n]";
- return os;
-}
-
-std::ostream &Configuration::operator<<(std::ostream &os, const Option &o)
-{
- return os << "Option["
- << "\n name: : " << protect(o.name())
- << "\n description : " << protect(o.description())
- << "\n argName : " << protect(o.argumentName())
- << "\n flags : " << static_cast<Flag>(o.flags())
- << "\n level : " << o.level()
- << "\n type : " << o.type()
- << "\n alt_type : " << o.alternateType()
- << "\n default_val : " << o.defaultValue()
- << "\n default_desc: " << protect(o.defaultDescription())
- << "\n no_arg_value: " << o.noArgumentValue()
- << "\n no_arg_desc : " << protect(o.noArgumentDescription())
- << "\n active_value: " << o.activeValue()
- << "\n new_value : " << o.newValue()
- << "\n --> cur_val : " << o.currentValue()
- << "\n set : " << o.set()
- << "\n dirty : " << o.dirty()
- << "\n]"
- ;
-}
-
-std::ostream &Configuration::operator<<(std::ostream &os, const Argument &a)
-{
- const Option o = a.parent();
- const bool list = o.flags() & List;
- os << "Argument[";
- if (a) {
- switch (o.alternateType()) {
- case NoType:
- if (list) {
- os << a.numberOfTimesSet() << 'x';
- } else {
- os << a.boolValue();
- }
- break;
- default:
- case StringType:
- if (list) {
- const std::vector<const char *> v = a.stringValues();
- os << v.size() << ':';
- // can't use std::copy + ostream_iterator here, since we need the protect() call
- bool first = true;
- std::for_each(v.begin(), v.end(), [&first, &os](const char *s) {
- if (first) {
- first = false;
- } else {
- os << ',';
- }
- os << protect(s);
- });
- } else {
- os << protect(a.stringValue());
- }
- break;
- case IntegerType:
- if (list) {
- const std::vector<int> v = a.intValues();
- os << v.size() << ':';
- std::copy(v.begin(), v.end(),
- std::ostream_iterator<int>(os, ","));
- } else {
- os << a.intValue();
- }
- break;
- case UnsignedIntegerType:
- if (list) {
- const std::vector<unsigned int> v = a.uintValues();
- os << v.size() << ':';
- std::copy(v.begin(), v.end(),
- std::ostream_iterator<unsigned int>(os, ","));
- } else {
- os << a.intValue();
- }
- break;
- }
- }
- return os << ']';
-}
diff --git a/lang/cpp/src/configuration.h b/lang/cpp/src/configuration.h
deleted file mode 100644
index 286b7c02..00000000
--- a/lang/cpp/src/configuration.h
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- configuration.h - wraps gpgme configuration components
- Copyright (C) 2010 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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.
-*/
-
-// -*- c++ -*-
-#ifndef __GPGMEPP_CONFIGURATION_H__
-#define __GPGMEPP_CONFIGURATION_H__
-
-#include "global.h"
-
-#include "gpgmefw.h"
-
-#include <iosfwd>
-#include <vector>
-#include <string>
-#include <algorithm>
-#include <memory>
-
-namespace GpgME
-{
-namespace Configuration
-{
-
-typedef std::shared_ptr< std::remove_pointer<gpgme_conf_comp_t>::type > shared_gpgme_conf_comp_t;
-typedef std::weak_ptr< std::remove_pointer<gpgme_conf_comp_t>::type > weak_gpgme_conf_comp_t;
-
-class Argument;
-class Option;
-class Component;
-
-enum Level {
- Basic,
- Advanced,
- Expert,
- Invisible,
- Internal,
-
- NumLevels
-};
-
-enum Type {
- NoType,
- StringType,
- IntegerType,
- UnsignedIntegerType,
-
- FilenameType = 32,
- LdapServerType,
- KeyFingerprintType,
- PublicKeyType,
- SecretKeyType,
- AliasListType,
-
- MaxType
-};
-
-enum Flag {
- Group = (1 << 0),
- Optional = (1 << 1),
- List = (1 << 2),
- Runtime = (1 << 3),
- Default = (1 << 4),
- DefaultDescription = (1 << 5),
- NoArgumentDescription = (1 << 6),
- NoChange = (1 << 7),
-
- LastFlag = NoChange
-};
-
-//
-// class Component
-//
-
-class GPGMEPP_EXPORT Component
-{
-public:
- Component() : comp() {}
- explicit Component(const shared_gpgme_conf_comp_t &gpgme_comp)
- : comp(gpgme_comp) {}
-
- Component(const Component &other) = default;
- const Component &operator=(const Component &other)
- {
- if (this != &other) {
- Component(other).swap(*this);
- }
- return *this;
- }
-
- void swap(Component &other)
- {
- using std::swap;
- swap(this->comp, other.comp);
- }
-
- bool isNull() const
- {
- return !comp;
- }
-
- static std::vector<Component> load(Error &err);
- Error save() const;
-
- const char *name() const;
- const char *description() const;
- const char *programName() const;
-
- Option option(unsigned int index) const;
- Option option(const char *name) const;
-
- unsigned int numOptions() const;
-
- std::vector<Option> options() const;
-
- GPGMEPP_MAKE_SAFE_BOOL_OPERATOR(!isNull())
-private:
- shared_gpgme_conf_comp_t comp;
-};
-
-//
-// class Option
-//
-
-class GPGMEPP_EXPORT Option
-{
-public:
- Option() : comp(), opt(nullptr) {}
- Option(const shared_gpgme_conf_comp_t &gpgme_comp, gpgme_conf_opt_t gpgme_opt)
- : comp(gpgme_comp), opt(gpgme_opt) {}
-
- Option(const Option &other) = default;
- const Option &operator=(const Option &other)
- {
- if (this != &other) {
- Option(other).swap(*this);
- }
- return *this;
- }
-
- void swap(Option &other)
- {
- using std::swap;
- swap(this->comp, other.comp);
- swap(this->opt, other.opt);
- }
-
- bool isNull() const
- {
- return comp.expired() || !opt;
- }
-
- Component parent() const;
-
- unsigned int flags() const;
-
- Level level() const;
-
- const char *name() const;
- const char *description() const;
- const char *argumentName() const;
-
- Type type() const;
- Type alternateType() const;
-
- Argument defaultValue() const;
- const char *defaultDescription() const;
-
- Argument noArgumentValue() const;
- const char *noArgumentDescription() const;
-
- /*! The value that is in the config file (or null, if it's not set). */
- Argument activeValue() const;
- /*! The value that is in this object, i.e. either activeValue(), newValue(), or defaultValue() */
- Argument currentValue() const;
-
- Argument newValue() const;
- bool set() const;
- bool dirty() const;
-
- Error setNewValue(const Argument &argument);
- Error resetToDefaultValue();
- Error resetToActiveValue();
-
- Argument createNoneArgument(bool set) const;
- Argument createStringArgument(const char *value) const;
- Argument createStringArgument(const std::string &value) const;
- Argument createIntArgument(int value) const;
- Argument createUIntArgument(unsigned int value) const;
-
- Argument createNoneListArgument(unsigned int count) const;
- Argument createStringListArgument(const std::vector<const char *> &value) const;
- Argument createStringListArgument(const std::vector<std::string> &value) const;
- Argument createIntListArgument(const std::vector<int> &values) const;
- Argument createUIntListArgument(const std::vector<unsigned int> &values) const;
-
- GPGMEPP_MAKE_SAFE_BOOL_OPERATOR(!isNull())
-private:
- weak_gpgme_conf_comp_t comp;
- gpgme_conf_opt_t opt;
-};
-
-//
-// class Argument
-//
-
-class GPGMEPP_EXPORT Argument
-{
- friend class ::GpgME::Configuration::Option;
- Argument(const shared_gpgme_conf_comp_t &comp, gpgme_conf_opt_t opt, gpgme_conf_arg_t arg, bool owns);
-public:
- Argument() : comp(), opt(nullptr), arg(nullptr) {}
- //Argument( const shared_gpgme_conf_comp_t & comp, gpgme_conf_opt_t opt, gpgme_conf_arg_t arg );
- Argument(const Argument &other);
- ~Argument();
-
- const Argument &operator=(const Argument &other)
- {
- if (this != &other) {
- Argument(other).swap(*this);
- }
- return *this;
- }
-
- void swap(Argument &other)
- {
- using std::swap;
- swap(this->comp, other.comp);
- swap(this->opt, other.opt);
- swap(this->arg, other.arg);
- }
-
- bool isNull() const
- {
- return comp.expired() || !opt || !arg;
- }
-
- Option parent() const;
-
- unsigned int numElements() const;
-
- bool boolValue() const;
- const char *stringValue(unsigned int index = 0) const;
- int intValue(unsigned int index = 0) const;
- unsigned int uintValue(unsigned int index = 0) const;
-
- unsigned int numberOfTimesSet() const;
- std::vector<const char *> stringValues() const;
- std::vector<int> intValues() const;
- std::vector<unsigned int> uintValues() const;
-
- GPGMEPP_MAKE_SAFE_BOOL_OPERATOR(!isNull())
-private:
- weak_gpgme_conf_comp_t comp;
- gpgme_conf_opt_t opt;
- gpgme_conf_arg_t arg;
-};
-
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, Level level);
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, Type type);
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, Flag flag);
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const Component &component);
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const Option &option);
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const Argument &argument);
-
-} // namespace Configuration
-} // namespace GpgME
-
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(Configuration::Component)
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(Configuration::Option)
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(Configuration::Argument)
-
-#endif // __GPGMEPP_CONFIGURATION_H__
diff --git a/lang/cpp/src/context.cpp b/lang/cpp/src/context.cpp
deleted file mode 100644
index 7a0fb23f..00000000
--- a/lang/cpp/src/context.cpp
+++ /dev/null
@@ -1,2138 +0,0 @@
-/*
- context.cpp - wraps a gpgme key context
- Copyright (C) 2003, 2007 Klarälvdalens Datakonsult AB
- 2017, 2018 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 <context.h>
-#include <eventloopinteractor.h>
-#include <trustitem.h>
-#include <keylistresult.h>
-#include <keygenerationresult.h>
-#include <importresult.h>
-#include <decryptionresult.h>
-#include <verificationresult.h>
-#include <signingresult.h>
-#include <encryptionresult.h>
-#include <engineinfo.h>
-#include <editinteractor.h>
-#include <vfsmountresult.h>
-
-#include <interfaces/assuantransaction.h>
-#include <defaultassuantransaction.h>
-
-#include "callbacks.h"
-#include "data_p.h"
-#include "context_p.h"
-#include "util.h"
-#include "tofuinfo.h"
-
-#include <gpgme.h>
-
-#include <functional>
-#include <istream>
-#include <numeric>
-#ifndef NDEBUG
-#include <iostream>
-using std::cerr;
-using std::endl;
-#endif
-
-#include <cassert>
-
-namespace GpgME
-{
-
-static inline unsigned int xtoi_1(const char *str)
-{
- const unsigned int ch = *str;
- const unsigned int result =
- ch <= '9' ? ch - '0' :
- ch <= 'F' ? ch - 'A' + 10 :
- /* else */ ch - 'a' + 10 ;
- return result < 16 ? result : 0 ;
-}
-static inline int xtoi_2(const char *str)
-{
- return xtoi_1(str) * 16U + xtoi_1(str + 1);
-}
-
-static void percent_unescape(std::string &s, bool plus2space)
-{
- std::string::iterator src = s.begin(), dest = s.begin(), end = s.end();
- while (src != end) {
- if (*src == '%' && end - src > 2) {
- *dest++ = xtoi_2(&*++src);
- src += 2;
- } else if (*src == '+' && plus2space) {
- *dest++ = ' ';
- ++src;
- } else {
- *dest++ = *src++;
- }
- }
- s.erase(dest, end);
-}
-
-void initializeLibrary()
-{
- gpgme_check_version(nullptr);
-}
-
-Error initializeLibrary(int)
-{
- if (gpgme_check_version(GPGME_VERSION)) {
- return Error();
- } else {
- return Error::fromCode(GPG_ERR_USER_1);
- }
-}
-
-static void format_error(gpgme_error_t err, std::string &str)
-{
- char buffer[ 1024 ];
- gpgme_strerror_r(err, buffer, sizeof buffer);
- buffer[ sizeof buffer - 1 ] = '\0';
- str = buffer;
-}
-
-const char *Error::source() const
-{
- return gpgme_strsource((gpgme_error_t)mErr);
-}
-
-const char *Error::asString() const
-{
- if (mMessage.empty()) {
- format_error(static_cast<gpgme_error_t>(mErr), mMessage);
- }
- return mMessage.c_str();
-}
-
-std::string Error::asStdString() const
-{
- std::string message;
- format_error(static_cast<gpgme_error_t>(mErr), message);
- return message;
-}
-
-int Error::code() const
-{
- return gpgme_err_code(mErr);
-}
-
-int Error::sourceID() const
-{
- return gpgme_err_source(mErr);
-}
-
-bool Error::isCanceled() const
-{
- return code() == GPG_ERR_CANCELED || code() == GPG_ERR_FULLY_CANCELED;
-}
-
-int Error::toErrno() const
-{
- return gpgme_err_code_to_errno(static_cast<gpgme_err_code_t>(code()));
-}
-
-// static
-bool Error::hasSystemError()
-{
- return gpgme_err_code_from_syserror() != GPG_ERR_MISSING_ERRNO ;
-}
-
-// static
-void Error::setSystemError(gpg_err_code_t err)
-{
- setErrno(gpgme_err_code_to_errno(err));
-}
-
-// static
-void Error::setErrno(int err)
-{
- gpgme_err_set_errno(err);
-}
-
-// static
-Error Error::fromSystemError(unsigned int src)
-{
- return Error(gpgme_err_make(static_cast<gpgme_err_source_t>(src), gpgme_err_code_from_syserror()));
-}
-
-// static
-Error Error::fromErrno(int err, unsigned int src)
-{
- return Error(gpgme_err_make(static_cast<gpgme_err_source_t>(src), gpgme_err_code_from_errno(err)));
-}
-
-// static
-Error Error::fromCode(unsigned int err, unsigned int src)
-{
- return Error(gpgme_err_make(static_cast<gpgme_err_source_t>(src), static_cast<gpgme_err_code_t>(err)));
-}
-
-std::ostream &operator<<(std::ostream &os, const Error &err)
-{
- return os << "GpgME::Error(" << err.encodedError() << " (" << err.asStdString() << "))";
-}
-
-Context::KeyListModeSaver::KeyListModeSaver(Context *ctx)
- : mCtx{ctx}
- , mKeyListMode{ctx ? ctx->keyListMode() : 0}
-{
-}
-
-Context::KeyListModeSaver::~KeyListModeSaver()
-{
- if (mCtx) {
- mCtx->setKeyListMode(mKeyListMode);
- }
-}
-
-Context::Context(gpgme_ctx_t ctx) : d(new Private(ctx))
-{
-}
-
-Context::~Context()
-{
- delete d;
-}
-
-Context *Context::createForProtocol(Protocol proto)
-{
- gpgme_ctx_t ctx = nullptr;
- if (gpgme_new(&ctx) != 0) {
- return nullptr;
- }
-
- switch (proto) {
- case OpenPGP:
- if (gpgme_set_protocol(ctx, GPGME_PROTOCOL_OpenPGP) != 0) {
- gpgme_release(ctx);
- return nullptr;
- }
- break;
- case CMS:
- if (gpgme_set_protocol(ctx, GPGME_PROTOCOL_CMS) != 0) {
- gpgme_release(ctx);
- return nullptr;
- }
- break;
- default:
- return nullptr;
- }
-
- return new Context(ctx);
-}
-
-std::unique_ptr<Context> Context::create(Protocol proto)
-{
- return std::unique_ptr <Context> (createForProtocol(proto));
-}
-
-std::unique_ptr<Context> Context::createForEngine(Engine eng, Error *error)
-{
- gpgme_ctx_t ctx = nullptr;
- if (const gpgme_error_t err = gpgme_new(&ctx)) {
- if (error) {
- *error = Error(err);
- }
- return std::unique_ptr<Context>();
- }
-
- switch (eng) {
- case AssuanEngine:
- if (const gpgme_error_t err = gpgme_set_protocol(ctx, GPGME_PROTOCOL_ASSUAN)) {
- gpgme_release(ctx);
- if (error) {
- *error = Error(err);
- }
- return std::unique_ptr<Context>();
- }
- break;
- case G13Engine:
- if (const gpgme_error_t err = gpgme_set_protocol(ctx, GPGME_PROTOCOL_G13)) {
- gpgme_release(ctx);
- if (error) {
- *error = Error(err);
- }
- return std::unique_ptr<Context>();
- }
- break;
- case SpawnEngine:
- if (const gpgme_error_t err = gpgme_set_protocol(ctx, GPGME_PROTOCOL_SPAWN)) {
- gpgme_release(ctx);
- if (error) {
- *error = Error(err);
- }
- return std::unique_ptr<Context>();
- }
- break;
- default:
- if (error) {
- *error = Error::fromCode(GPG_ERR_INV_ARG);
- }
- return std::unique_ptr<Context>();
- }
-
- if (error) {
- *error = Error();
- }
-
- return std::unique_ptr<Context>(new Context(ctx));
-}
-
-void Context::setDecryptionFlags(DecryptionFlags flags)
-{
- d->decryptFlags = flags;
-}
-
-//
-//
-// Context::Private
-//
-//
-
-Context::Private::Private(gpgme_ctx_t c)
- : ctx(c),
- iocbs(nullptr),
- lastop(None),
- lasterr(GPG_ERR_NO_ERROR),
- lastAssuanInquireData(Data::null),
- lastAssuanTransaction(),
- lastEditInteractor(),
- lastCardEditInteractor(),
- decryptFlags(DecryptNone)
-{
-
-}
-
-Context::Private::~Private()
-{
- if (ctx) {
- gpgme_release(ctx);
- }
- ctx = nullptr;
- delete iocbs;
-}
-
-//
-//
-// Context attributes:
-//
-//
-
-Protocol Context::protocol() const
-{
- gpgme_protocol_t p = gpgme_get_protocol(d->ctx);
- switch (p) {
- case GPGME_PROTOCOL_OpenPGP: return OpenPGP;
- case GPGME_PROTOCOL_CMS: return CMS;
- default: return UnknownProtocol;
- }
-}
-
-void Context::setArmor(bool useArmor)
-{
- gpgme_set_armor(d->ctx, int(useArmor));
-}
-bool Context::armor() const
-{
- return gpgme_get_armor(d->ctx);
-}
-
-void Context::setTextMode(bool useTextMode)
-{
- gpgme_set_textmode(d->ctx, int(useTextMode));
-}
-bool Context::textMode() const
-{
- return gpgme_get_textmode(d->ctx);
-}
-
-void Context::setOffline(bool useOfflineMode)
-{
- gpgme_set_offline(d->ctx, int(useOfflineMode));
-}
-bool Context::offline() const
-{
- return gpgme_get_offline(d->ctx);
-}
-
-void Context::setIncludeCertificates(int which)
-{
- if (which == DefaultCertificates) {
- which = GPGME_INCLUDE_CERTS_DEFAULT;
- }
- gpgme_set_include_certs(d->ctx, which);
-}
-
-int Context::includeCertificates() const
-{
- return gpgme_get_include_certs(d->ctx);
-}
-
-void Context::setKeyListMode(unsigned int mode)
-{
- gpgme_set_keylist_mode(d->ctx, add_to_gpgme_keylist_mode_t(0, mode));
-}
-
-void Context::addKeyListMode(unsigned int mode)
-{
- const unsigned int cur = gpgme_get_keylist_mode(d->ctx);
- gpgme_set_keylist_mode(d->ctx, add_to_gpgme_keylist_mode_t(cur, mode));
-}
-
-unsigned int Context::keyListMode() const
-{
- return convert_from_gpgme_keylist_mode_t(gpgme_get_keylist_mode(d->ctx));
-}
-
-void Context::setProgressProvider(ProgressProvider *provider)
-{
- gpgme_set_progress_cb(d->ctx, provider ? &progress_callback : nullptr, provider);
-}
-ProgressProvider *Context::progressProvider() const
-{
- void *pp = nullptr;
- gpgme_progress_cb_t pcb = &progress_callback;
- gpgme_get_progress_cb(d->ctx, &pcb, &pp);
- return static_cast<ProgressProvider *>(pp);
-}
-
-void Context::setPassphraseProvider(PassphraseProvider *provider)
-{
- gpgme_set_passphrase_cb(d->ctx, provider ? &passphrase_callback : nullptr, provider);
-}
-
-PassphraseProvider *Context::passphraseProvider() const
-{
- void *pp = nullptr;
- gpgme_passphrase_cb_t pcb = &passphrase_callback;
- gpgme_get_passphrase_cb(d->ctx, &pcb, &pp);
- return static_cast<PassphraseProvider *>(pp);
-}
-
-void Context::setManagedByEventLoopInteractor(bool manage)
-{
- if (!EventLoopInteractor::instance()) {
-#ifndef NDEBUG
- cerr << "Context::setManagedByEventLoopInteractor(): "
- "You must create an instance of EventLoopInteractor "
- "before using anything that needs one." << endl;
-#endif
- return;
- }
- if (manage) {
- EventLoopInteractor::instance()->manage(this);
- } else {
- EventLoopInteractor::instance()->unmanage(this);
- }
-}
-bool Context::managedByEventLoopInteractor() const
-{
- return d->iocbs != nullptr;
-}
-
-void Context::installIOCallbacks(gpgme_io_cbs *iocbs)
-{
- if (!iocbs) {
- uninstallIOCallbacks();
- return;
- }
- gpgme_set_io_cbs(d->ctx, iocbs);
- delete d->iocbs; d->iocbs = iocbs;
-}
-
-void Context::uninstallIOCallbacks()
-{
- static gpgme_io_cbs noiocbs = { nullptr, nullptr, nullptr, nullptr, nullptr };
- // io.add == 0 means disable io callbacks:
- gpgme_set_io_cbs(d->ctx, &noiocbs);
- delete d->iocbs; d->iocbs = nullptr;
-}
-
-Error Context::setLocale(int cat, const char *val)
-{
- return Error(d->lasterr = gpgme_set_locale(d->ctx, cat, val));
-}
-
-static GpgME::EngineInfo get_engine_info(gpgme_engine_info_t engineInfos, gpgme_protocol_t protocol)
-{
- if (!engineInfos) {
- return EngineInfo{};
- }
-
- for (gpgme_engine_info_t i = engineInfos ; i ; i = i->next) {
- if (i->protocol == protocol) {
- return EngineInfo{i};
- }
- }
-
- return EngineInfo{};
-}
-
-static GpgME::EngineInfo get_static_engine_info(gpgme_protocol_t protocol)
-{
- gpgme_engine_info_t ei = nullptr;
- if (gpgme_get_engine_info(&ei)) {
- return EngineInfo{};
- }
- return get_engine_info(ei, protocol);
-}
-
-EngineInfo Context::engineInfo() const
-{
- return get_engine_info(gpgme_ctx_get_engine_info(d->ctx), gpgme_get_protocol(d->ctx));
-}
-
-Error Context::setEngineFileName(const char *filename)
-{
- const char *const home_dir = engineInfo().homeDirectory();
- return Error(gpgme_ctx_set_engine_info(d->ctx, gpgme_get_protocol(d->ctx), filename, home_dir));
-}
-
-Error Context::setEngineHomeDirectory(const char *home_dir)
-{
- const char *const filename = engineInfo().fileName();
- 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
-//
-//
-
-Error Context::startKeyListing(const char *pattern, bool secretOnly)
-{
- d->lastop = (((keyListMode() & GpgME::Locate) == GpgME::Locate)
- ? Private::KeyListWithImport
- : Private::KeyList);
- return Error(d->lasterr = gpgme_op_keylist_start(d->ctx, pattern, int(secretOnly)));
-}
-
-Error Context::startKeyListing(const char *patterns[], bool secretOnly)
-{
- d->lastop = (((keyListMode() & GpgME::Locate) == GpgME::Locate)
- ? Private::KeyListWithImport
- : Private::KeyList);
- return Error(d->lasterr = gpgme_op_keylist_ext_start(d->ctx, patterns, int(secretOnly), 0));
-}
-
-Key Context::nextKey(GpgME::Error &e)
-{
- d->lastop = (((keyListMode() & GpgME::Locate) == GpgME::Locate)
- ? Private::KeyListWithImport
- : Private::KeyList);
- gpgme_key_t key = nullptr;
- e = Error(d->lasterr = gpgme_op_keylist_next(d->ctx, &key));
- return Key(key, false);
-}
-
-KeyListResult Context::endKeyListing()
-{
- d->lasterr = gpgme_op_keylist_end(d->ctx);
- return keyListResult();
-}
-
-KeyListResult Context::keyListResult() const
-{
- return KeyListResult(d->ctx, Error(d->lasterr));
-}
-
-Key Context::key(const char *fingerprint, GpgME::Error &e , bool secret /*, bool forceUpdate*/)
-{
- d->lastop = Private::KeyList;
- gpgme_key_t key = nullptr;
- e = Error(d->lasterr = gpgme_get_key(d->ctx, fingerprint, &key, int(secret)/*, int( forceUpdate )*/));
- return Key(key, false);
-}
-
-KeyGenerationResult Context::generateKey(const char *parameters, Data &pubKey)
-{
- d->lastop = Private::KeyGen;
- Data::Private *const dp = pubKey.impl();
- d->lasterr = gpgme_op_genkey(d->ctx, parameters, dp ? dp->data : nullptr, nullptr);
- return KeyGenerationResult(d->ctx, Error(d->lasterr));
-}
-
-Error Context::startKeyGeneration(const char *parameters, Data &pubKey)
-{
- d->lastop = Private::KeyGen;
- Data::Private *const dp = pubKey.impl();
- return Error(d->lasterr = gpgme_op_genkey_start(d->ctx, parameters, dp ? dp->data : nullptr, nullptr));
-}
-
-KeyGenerationResult Context::keyGenerationResult() const
-{
- if (d->lastop & Private::KeyGen) {
- return KeyGenerationResult(d->ctx, Error(d->lasterr));
- } else {
- return KeyGenerationResult();
- }
-}
-
-Error Context::exportKeys(const char *pattern, Data &keyData, unsigned int mode)
-{
- d->lastop = Private::Export;
- Data::Private *const dp = keyData.impl();
- return Error(d->lasterr = gpgme_op_export(d->ctx, pattern, mode, dp ? dp->data : nullptr));
-}
-
-Error Context::exportKeys(const char *patterns[], Data &keyData, unsigned int mode)
-{
- d->lastop = Private::Export;
- Data::Private *const dp = keyData.impl();
- return Error(d->lasterr = gpgme_op_export_ext(d->ctx, patterns, mode, dp ? dp->data : nullptr));
-}
-
-Error Context::startKeyExport(const char *pattern, Data &keyData, unsigned int mode)
-{
- d->lastop = Private::Export;
- Data::Private *const dp = keyData.impl();
- return Error(d->lasterr = gpgme_op_export_start(d->ctx, pattern, mode, dp ? dp->data : nullptr));
-}
-
-Error Context::startKeyExport(const char *patterns[], Data &keyData, unsigned int mode)
-{
- d->lastop = Private::Export;
- Data::Private *const dp = keyData.impl();
- return Error(d->lasterr = gpgme_op_export_ext_start(d->ctx, patterns, mode, dp ? dp->data : nullptr));
-}
-
-Error Context::exportPublicKeys(const char *pattern, Data &keyData, unsigned int mode)
-{
- if (mode & (ExportSecret | ExportSecretSubkey)) {
- return Error::fromCode(GPG_ERR_INV_FLAG);
- }
- return exportKeys(pattern, keyData, mode);
-}
-
-Error Context::exportPublicKeys(const char *patterns[], Data &keyData, unsigned int mode)
-{
- if (mode & (ExportSecret | ExportSecretSubkey)) {
- return Error::fromCode(GPG_ERR_INV_FLAG);
- }
- return exportKeys(patterns, keyData, mode);
-}
-
-Error Context::startPublicKeyExport(const char *pattern, Data &keyData, unsigned int mode)
-{
- if (mode & (ExportSecret | ExportSecretSubkey)) {
- return Error::fromCode(GPG_ERR_INV_FLAG);
- }
- return startKeyExport(pattern, keyData, mode);
-}
-
-Error Context::startPublicKeyExport(const char *patterns[], Data &keyData, unsigned int mode)
-{
- if (mode & (ExportSecret | ExportSecretSubkey)) {
- return Error::fromCode(GPG_ERR_INV_FLAG);
- }
- return startKeyExport(patterns, keyData, mode);
-}
-
-/* Same as above but without mode */
-Error Context::exportPublicKeys(const char *pattern, Data &keyData)
-{
- return exportPublicKeys(pattern, keyData, 0);
-}
-
-Error Context::exportPublicKeys(const char *patterns[], Data &keyData)
-{
- return exportPublicKeys(patterns, keyData, 0);
-}
-
-Error Context::startPublicKeyExport(const char *pattern, Data &keyData)
-{
- return startPublicKeyExport(pattern, keyData, 0);
-}
-
-Error Context::startPublicKeyExport(const char *patterns[], Data &keyData)
-{
- return startPublicKeyExport(patterns, keyData, 0);
-}
-
-Error Context::exportSecretKeys(const char *pattern, Data &keyData, unsigned int mode)
-{
- if (mode & ExportSecretSubkey) {
- return Error::fromCode(GPG_ERR_INV_FLAG);
- }
- return exportKeys(pattern, keyData, mode|ExportSecret);
-}
-
-Error Context::exportSecretKeys(const char *patterns[], Data &keyData, unsigned int mode)
-{
- if (mode & ExportSecretSubkey) {
- return Error::fromCode(GPG_ERR_INV_FLAG);
- }
- return exportKeys(patterns, keyData, mode|ExportSecret);
-}
-
-Error Context::startSecretKeyExport(const char *pattern, Data &keyData, unsigned int mode)
-{
- if (mode & ExportSecretSubkey) {
- return Error::fromCode(GPG_ERR_INV_FLAG);
- }
- return startKeyExport(pattern, keyData, mode|ExportSecret);
-}
-
-Error Context::startSecretKeyExport(const char *patterns[], Data &keyData, unsigned int mode)
-{
- if (mode & ExportSecretSubkey) {
- return Error::fromCode(GPG_ERR_INV_FLAG);
- }
- return startKeyExport(patterns, keyData, mode|ExportSecret);
-}
-
-Error Context::exportSecretSubkeys(const char *pattern, Data &keyData, unsigned int mode)
-{
- return exportKeys(pattern, keyData, mode|ExportSecretSubkey);
-}
-
-Error Context::exportSecretSubkeys(const char *patterns[], Data &keyData, unsigned int mode)
-{
- return exportKeys(patterns, keyData, mode|ExportSecretSubkey);
-}
-
-Error Context::startSecretSubkeyExport(const char *pattern, Data &keyData, unsigned int mode)
-{
- return startKeyExport(pattern, keyData, mode|ExportSecretSubkey);
-}
-
-Error Context::startSecretSubkeyExport(const char *patterns[], Data &keyData, unsigned int mode)
-{
- return startKeyExport(patterns, keyData, mode|ExportSecretSubkey);
-}
-
-ImportResult Context::importKeys(const Data &data)
-{
- d->lastop = Private::Import;
- const Data::Private *const dp = data.impl();
- d->lasterr = gpgme_op_import(d->ctx, dp ? dp->data : nullptr);
- return ImportResult(d->ctx, Error(d->lasterr));
-}
-
-ImportResult Context::importKeys(const std::vector<Key> &kk)
-{
- d->lastop = Private::Import;
- d->lasterr = make_error(GPG_ERR_NOT_IMPLEMENTED);
-
- bool shouldHaveResult = false;
- gpgme_key_t * const keys = new gpgme_key_t[ kk.size() + 1 ];
- gpgme_key_t *keys_it = &keys[0];
- for (std::vector<Key>::const_iterator it = kk.begin(), end = kk.end() ; it != end ; ++it) {
- if (it->impl()) {
- *keys_it++ = it->impl();
- }
- }
- *keys_it++ = nullptr;
- d->lasterr = gpgme_op_import_keys(d->ctx, keys);
- shouldHaveResult = true;
- if ((gpgme_err_code(d->lasterr) == GPG_ERR_NOT_IMPLEMENTED ||
- gpgme_err_code(d->lasterr) == GPG_ERR_NOT_SUPPORTED) &&
- protocol() == CMS) {
- // ok, try the workaround (export+import):
- std::vector<const char *> fprs;
- for (std::vector<Key>::const_iterator it = kk.begin(), end = kk.end() ; it != end ; ++it) {
- if (const char *fpr = it->primaryFingerprint()) {
- if (*fpr) {
- fprs.push_back(fpr);
- }
- } else if (const char *keyid = it->keyID()) {
- if (*keyid) {
- fprs.push_back(keyid);
- }
- }
- }
- fprs.push_back(nullptr);
- Data data;
- Data::Private *const dp = data.impl();
- const gpgme_keylist_mode_t oldMode = gpgme_get_keylist_mode(d->ctx);
- gpgme_set_keylist_mode(d->ctx, GPGME_KEYLIST_MODE_EXTERN);
- d->lasterr = gpgme_op_export_ext(d->ctx, &fprs[0], 0, dp ? dp->data : nullptr);
- gpgme_set_keylist_mode(d->ctx, oldMode);
- if (!d->lasterr) {
- data.seek(0, SEEK_SET);
- d->lasterr = gpgme_op_import(d->ctx, dp ? dp->data : nullptr);
- shouldHaveResult = true;
- }
- }
- delete[] keys;
- if (shouldHaveResult) {
- return ImportResult(d->ctx, Error(d->lasterr));
- } else {
- return ImportResult(Error(d->lasterr));
- }
-}
-
-Error Context::startKeyImport(const Data &data)
-{
- d->lastop = Private::Import;
- const Data::Private *const dp = data.impl();
- return Error(d->lasterr = gpgme_op_import_start(d->ctx, dp ? dp->data : nullptr));
-}
-
-Error Context::startKeyImport(const std::vector<Key> &kk)
-{
- d->lastop = Private::Import;
- gpgme_key_t * const keys = new gpgme_key_t[ kk.size() + 1 ];
- gpgme_key_t *keys_it = &keys[0];
- for (std::vector<Key>::const_iterator it = kk.begin(), end = kk.end() ; it != end ; ++it) {
- if (it->impl()) {
- *keys_it++ = it->impl();
- }
- }
- *keys_it++ = nullptr;
- Error err = Error(d->lasterr = gpgme_op_import_keys_start(d->ctx, keys));
- delete[] keys;
- return err;
-}
-
-ImportResult Context::importKeys(const std::vector<std::string> &keyIds)
-{
- d->lastop = Private::Import;
- const StringsToCStrings keyids{keyIds};
- d->lasterr = gpgme_op_receive_keys(d->ctx, keyids.c_strs());
- return ImportResult(d->ctx, Error(d->lasterr));
-}
-
-Error Context::startKeyImport(const std::vector<std::string> &keyIds)
-{
- d->lastop = Private::Import;
- const StringsToCStrings keyids{keyIds};
- d->lasterr = gpgme_op_receive_keys_start(d->ctx, keyids.c_strs());
- return Error(d->lasterr);
-}
-
-ImportResult Context::importResult() const
-{
- if (d->lastop & Private::Import) {
- return ImportResult(d->ctx, Error(d->lasterr));
- } else {
- return ImportResult();
- }
-}
-
-Error Context::deleteKey(const Key &key, bool allowSecretKeyDeletion)
-{
- d->lastop = Private::Delete;
- return Error(d->lasterr = gpgme_op_delete(d->ctx, key.impl(), int(allowSecretKeyDeletion)));
-}
-
-Error Context::startKeyDeletion(const Key &key, bool allowSecretKeyDeletion)
-{
- d->lastop = Private::Delete;
- return Error(d->lasterr = gpgme_op_delete_start(d->ctx, key.impl(), int(allowSecretKeyDeletion)));
-}
-
-Error Context::passwd(const Key &key)
-{
- d->lastop = Private::Passwd;
- return Error(d->lasterr = gpgme_op_passwd(d->ctx, key.impl(), 0U));
-}
-
-Error Context::startPasswd(const Key &key)
-{
- d->lastop = Private::Passwd;
- return Error(d->lasterr = gpgme_op_passwd_start(d->ctx, key.impl(), 0U));
-}
-
-
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-
-Error Context::edit(const Key &key, std::unique_ptr<EditInteractor> func, Data &data)
-{
- d->lastop = Private::Edit;
- d->lastEditInteractor = std::move(func);
- Data::Private *const dp = data.impl();
- return Error(d->lasterr = gpgme_op_edit(d->ctx, key.impl(),
- d->lastEditInteractor.get() ? edit_interactor_callback : nullptr,
- d->lastEditInteractor.get() ? d->lastEditInteractor->d : nullptr,
- dp ? dp->data : nullptr));
-}
-
-
-Error Context::startEditing(const Key &key, std::unique_ptr<EditInteractor> func, Data &data)
-{
- d->lastop = Private::Edit;
- d->lastEditInteractor = std::move(func);
- Data::Private *const dp = data.impl();
- return Error(d->lasterr = gpgme_op_edit_start(d->ctx, key.impl(),
- d->lastEditInteractor.get() ? edit_interactor_callback : nullptr,
- d->lastEditInteractor.get() ? d->lastEditInteractor->d : nullptr,
- dp ? dp->data : nullptr));
-}
-
-
-EditInteractor *Context::lastEditInteractor() const
-{
- return d->lastEditInteractor.get();
-}
-
-std::unique_ptr<EditInteractor> Context::takeLastEditInteractor()
-{
- return std::move(d->lastEditInteractor);
-}
-
-
-Error Context::cardEdit(const Key &key, std::unique_ptr<EditInteractor> func, Data &data)
-{
- d->lastop = Private::CardEdit;
- d->lastCardEditInteractor = std::move(func);
- Data::Private *const dp = data.impl();
- return Error(d->lasterr = gpgme_op_card_edit(d->ctx, key.impl(),
- d->lastCardEditInteractor.get() ? edit_interactor_callback : nullptr,
- d->lastCardEditInteractor.get() ? d->lastCardEditInteractor->d : nullptr,
- dp ? dp->data : nullptr));
-}
-
-Error Context::startCardEditing(const Key &key, std::unique_ptr<EditInteractor> func, Data &data)
-{
- d->lastop = Private::CardEdit;
- d->lastCardEditInteractor = std::move(func);
- Data::Private *const dp = data.impl();
- return Error(d->lasterr = gpgme_op_card_edit_start(d->ctx, key.impl(),
- d->lastCardEditInteractor.get() ? edit_interactor_callback : nullptr,
- d->lastCardEditInteractor.get() ? d->lastCardEditInteractor->d : nullptr,
- dp ? dp->data : nullptr));
-}
-
-#pragma GCC diagnostic pop
-
-EditInteractor *Context::lastCardEditInteractor() const
-{
- return d->lastCardEditInteractor.get();
-}
-
-std::unique_ptr<EditInteractor> Context::takeLastCardEditInteractor()
-{
- return std::move(d->lastCardEditInteractor);
-}
-
-Error Context::startTrustItemListing(const char *pattern, int maxLevel)
-{
- d->lastop = Private::TrustList;
- return Error(d->lasterr = gpgme_op_trustlist_start(d->ctx, pattern, maxLevel));
-}
-
-TrustItem Context::nextTrustItem(Error &e)
-{
- gpgme_trust_item_t ti = nullptr;
- e = Error(d->lasterr = gpgme_op_trustlist_next(d->ctx, &ti));
- return TrustItem(ti);
-}
-
-Error Context::endTrustItemListing()
-{
- return Error(d->lasterr = gpgme_op_trustlist_end(d->ctx));
-}
-
-static gpgme_error_t assuan_transaction_data_callback(void *opaque, const void *data, size_t datalen)
-{
- assert(opaque);
- AssuanTransaction *t = static_cast<AssuanTransaction *>(opaque);
- return t->data(static_cast<const char *>(data), datalen).encodedError();
-}
-
-static gpgme_error_t assuan_transaction_inquire_callback(void *opaque, const char *name, const char *args, gpgme_data_t *r_data)
-{
- assert(opaque);
- Context::Private *p = static_cast<Context::Private *>(opaque);
- AssuanTransaction *t = p->lastAssuanTransaction.get();
- assert(t);
- Error err;
- if (name) {
- p->lastAssuanInquireData = t->inquire(name, args, err);
- } else {
- p->lastAssuanInquireData = Data::null;
- }
- if (!p->lastAssuanInquireData.isNull()) {
- *r_data = p->lastAssuanInquireData.impl()->data;
- }
- return err.encodedError();
-}
-
-static gpgme_error_t assuan_transaction_status_callback(void *opaque, const char *status, const char *args)
-{
- assert(opaque);
- AssuanTransaction *t = static_cast<AssuanTransaction *>(opaque);
- std::string a = args;
- percent_unescape(a, true); // ### why doesn't gpgme do this??
- return t->status(status, a.c_str()).encodedError();
-}
-
-Error Context::assuanTransact(const char *command)
-{
- return assuanTransact(command, std::unique_ptr<AssuanTransaction>(new DefaultAssuanTransaction));
-}
-
-Error Context::assuanTransact(const char *command, std::unique_ptr<AssuanTransaction> transaction)
-{
- gpgme_error_t err, operr;
-
- d->lastop = Private::AssuanTransact;
- d->lastAssuanTransaction = std::move(transaction);
- if (!d->lastAssuanTransaction.get()) {
- return Error(d->lasterr = make_error(GPG_ERR_INV_ARG));
- }
- err = gpgme_op_assuan_transact_ext
- (d->ctx,
- command,
- assuan_transaction_data_callback,
- d->lastAssuanTransaction.get(),
- assuan_transaction_inquire_callback,
- d,
- assuan_transaction_status_callback,
- d->lastAssuanTransaction.get(),
- &operr);
-
- if (!err)
- err = operr;
- d->lasterr = err;
-
- return Error(d->lasterr);
-}
-
-Error Context::startAssuanTransaction(const char *command)
-{
- return startAssuanTransaction(command, std::unique_ptr<AssuanTransaction>(new DefaultAssuanTransaction));
-}
-
-Error Context::startAssuanTransaction(const char *command, std::unique_ptr<AssuanTransaction> transaction)
-{
- gpgme_error_t err;
-
- d->lastop = Private::AssuanTransact;
- d->lastAssuanTransaction = std::move(transaction);
- if (!d->lastAssuanTransaction.get()) {
- return Error(d->lasterr = make_error(GPG_ERR_INV_ARG));
- }
- err = gpgme_op_assuan_transact_start
- (d->ctx,
- command,
- assuan_transaction_data_callback,
- d->lastAssuanTransaction.get(),
- assuan_transaction_inquire_callback,
- d,
- assuan_transaction_status_callback,
- d->lastAssuanTransaction.get());
-
- d->lasterr = err;
-
- return Error(d->lasterr);
-}
-
-AssuanTransaction *Context::lastAssuanTransaction() const
-{
- return d->lastAssuanTransaction.get();
-}
-
-std::unique_ptr<AssuanTransaction> Context::takeLastAssuanTransaction()
-{
- return std::move(d->lastAssuanTransaction);
-}
-
-DecryptionResult Context::decrypt(const Data &cipherText, Data &plainText, const DecryptionFlags flags)
-{
- d->lastop = Private::Decrypt;
- const Data::Private *const cdp = cipherText.impl();
- Data::Private *const pdp = plainText.impl();
- d->lasterr = gpgme_op_decrypt_ext(d->ctx, static_cast<gpgme_decrypt_flags_t> (d->decryptFlags | flags), cdp ? cdp->data : nullptr, pdp ? pdp->data : nullptr);
- return decryptionResult();
-}
-
-DecryptionResult Context::decrypt(const Data &cipherText, Data &plainText)
-{
- return decrypt(cipherText, plainText, DecryptNone);
-}
-
-Error Context::startDecryption(const Data &cipherText, Data &plainText, const DecryptionFlags flags)
-{
- d->lastop = Private::Decrypt;
- const Data::Private *const cdp = cipherText.impl();
- Data::Private *const pdp = plainText.impl();
- return Error(d->lasterr = gpgme_op_decrypt_ext_start(d->ctx, static_cast<gpgme_decrypt_flags_t> (d->decryptFlags | flags),
- cdp ? cdp->data : nullptr, pdp ? pdp->data : nullptr));
-}
-
-Error Context::startDecryption(const Data &cipherText, Data &plainText)
-{
- return startDecryption(cipherText, plainText, DecryptNone);
-}
-
-DecryptionResult Context::decryptionResult() const
-{
- if (d->lastop & Private::Decrypt) {
- return DecryptionResult(d->ctx, Error(d->lasterr));
- } else {
- return DecryptionResult();
- }
-}
-
-VerificationResult Context::verifyDetachedSignature(const Data &signature, const Data &signedText)
-{
- d->lastop = Private::Verify;
- const Data::Private *const sdp = signature.impl();
- const Data::Private *const tdp = signedText.impl();
- d->lasterr = gpgme_op_verify(d->ctx, sdp ? sdp->data : nullptr, tdp ? tdp->data : nullptr, nullptr);
- return verificationResult();
-}
-
-VerificationResult Context::verifyOpaqueSignature(const Data &signedData, Data &plainText)
-{
- d->lastop = Private::Verify;
- const Data::Private *const sdp = signedData.impl();
- Data::Private *const pdp = plainText.impl();
- d->lasterr = gpgme_op_verify(d->ctx, sdp ? sdp->data : nullptr, nullptr, pdp ? pdp->data : nullptr);
- return verificationResult();
-}
-
-Error Context::startDetachedSignatureVerification(const Data &signature, const Data &signedText)
-{
- d->lastop = Private::Verify;
- const Data::Private *const sdp = signature.impl();
- const Data::Private *const tdp = signedText.impl();
- return Error(d->lasterr = gpgme_op_verify_start(d->ctx, sdp ? sdp->data : nullptr, tdp ? tdp->data : nullptr, nullptr));
-}
-
-Error Context::startOpaqueSignatureVerification(const Data &signedData, Data &plainText)
-{
- d->lastop = Private::Verify;
- const Data::Private *const sdp = signedData.impl();
- Data::Private *const pdp = plainText.impl();
- return Error(d->lasterr = gpgme_op_verify_start(d->ctx, sdp ? sdp->data : nullptr, nullptr, pdp ? pdp->data : nullptr));
-}
-
-VerificationResult Context::verificationResult() const
-{
- if (d->lastop & Private::Verify) {
- const auto res = VerificationResult{d->ctx, Error(d->lasterr)};
- if ((d->lastop == Private::DecryptAndVerify)
- && (res.error().code() == GPG_ERR_NO_DATA)
- && (res.numSignatures() > 0)) {
- // ignore "no data" error for verification if there are signatures and
- // the operation was a combined (tentative) decryption and verification
- // because then "no data" just indicates that there was nothing to decrypt
- return VerificationResult{d->ctx, Error{}};
- }
- return res;
- } else {
- return {};
- }
-}
-
-std::pair<DecryptionResult, VerificationResult> Context::decryptAndVerify(const Data &cipherText, Data &plainText, DecryptionFlags flags)
-{
- d->lastop = Private::DecryptAndVerify;
- const Data::Private *const cdp = cipherText.impl();
- Data::Private *const pdp = plainText.impl();
- d->lasterr = gpgme_op_decrypt_ext(d->ctx, static_cast<gpgme_decrypt_flags_t> (d->decryptFlags | flags | DecryptVerify),
- cdp ? cdp->data : nullptr, pdp ? pdp->data : nullptr);
- return std::make_pair(decryptionResult(), verificationResult());
-}
-
-std::pair<DecryptionResult, VerificationResult> Context::decryptAndVerify(const Data &cipherText, Data &plainText)
-{
- return decryptAndVerify(cipherText, plainText, DecryptNone);
-}
-
-Error Context::startCombinedDecryptionAndVerification(const Data &cipherText, Data &plainText, DecryptionFlags flags)
-{
- d->lastop = Private::DecryptAndVerify;
- const Data::Private *const cdp = cipherText.impl();
- Data::Private *const pdp = plainText.impl();
- return Error(d->lasterr = gpgme_op_decrypt_ext_start(d->ctx, static_cast<gpgme_decrypt_flags_t> (d->decryptFlags | flags | DecryptVerify), cdp ? cdp->data : nullptr, pdp ? pdp->data : nullptr));
-}
-
-Error Context::startCombinedDecryptionAndVerification(const Data &cipherText, Data &plainText)
-{
- return startCombinedDecryptionAndVerification(cipherText, plainText, DecryptNone);
-}
-
-namespace {
-unsigned int to_auditlog_flags(unsigned int flags)
-{
- unsigned int result = 0;
- if (flags & Context::HtmlAuditLog) {
- result |= GPGME_AUDITLOG_HTML;
- }
- if (flags & Context::AuditLogWithHelp) {
- result |= GPGME_AUDITLOG_WITH_HELP;
- }
- if (flags & Context::DiagnosticAuditLog) {
- result |= GPGME_AUDITLOG_DIAG;
- }
- return result;
-}
-}
-
-Error Context::startGetAuditLog(Data &output, unsigned int flags)
-{
- d->lastop = Private::GetAuditLog;
- Data::Private *const odp = output.impl();
- return Error(d->lasterr = gpgme_op_getauditlog_start(d->ctx, odp ? odp->data : nullptr, to_auditlog_flags(flags)));
-}
-
-Error Context::getAuditLog(Data &output, unsigned int flags)
-{
- d->lastop = Private::GetAuditLog;
- Data::Private *const odp = output.impl();
- return Error(d->lasterr = gpgme_op_getauditlog(d->ctx, odp ? odp->data : nullptr, to_auditlog_flags(flags)));
-}
-
-void Context::clearSigningKeys()
-{
- gpgme_signers_clear(d->ctx);
-}
-
-Error Context::addSigningKey(const Key &key)
-{
- return Error(d->lasterr = gpgme_signers_add(d->ctx, key.impl()));
-}
-
-Key Context::signingKey(unsigned int idx) const
-{
- gpgme_key_t key = gpgme_signers_enum(d->ctx, idx);
- return Key(key, false);
-}
-
-std::vector<Key> Context::signingKeys() const
-{
- std::vector<Key> result;
- gpgme_key_t key = nullptr;
- for (unsigned int i = 0 ; (key = gpgme_signers_enum(d->ctx, i)) ; ++i) {
- result.push_back(Key(key, false));
- }
- return result;
-}
-
-void Context::clearSignatureNotations()
-{
- gpgme_sig_notation_clear(d->ctx);
-}
-
-GpgME::Error Context::addSignatureNotation(const char *name, const char *value, unsigned int flags)
-{
- return Error(gpgme_sig_notation_add(d->ctx, name, value, add_to_gpgme_sig_notation_flags_t(0, flags)));
-}
-
-GpgME::Error Context::addSignaturePolicyURL(const char *url, bool critical)
-{
- return Error(gpgme_sig_notation_add(d->ctx, nullptr, url, critical ? GPGME_SIG_NOTATION_CRITICAL : 0));
-}
-
-const char *Context::signaturePolicyURL() const
-{
- for (gpgme_sig_notation_t n = gpgme_sig_notation_get(d->ctx) ; n ; n = n->next) {
- if (!n->name) {
- return n->value;
- }
- }
- return nullptr;
-}
-
-Notation Context::signatureNotation(unsigned int idx) const
-{
- for (gpgme_sig_notation_t n = gpgme_sig_notation_get(d->ctx) ; n ; n = n->next) {
- if (n->name) {
- if (idx-- == 0) {
- return Notation(n);
- }
- }
- }
- return Notation();
-}
-
-std::vector<Notation> Context::signatureNotations() const
-{
- std::vector<Notation> result;
- for (gpgme_sig_notation_t n = gpgme_sig_notation_get(d->ctx) ; n ; n = n->next) {
- if (n->name) {
- result.push_back(Notation(n));
- }
- }
- return result;
-}
-
-static gpgme_sig_mode_t sigflags2sigflags(SignatureMode flags)
-{
- unsigned int result = 0;
- if (flags & SignatureMode::NormalSignatureMode) {
- result |= GPGME_SIG_MODE_NORMAL;
- }
- if (flags & SignatureMode::Detached) {
- result |= GPGME_SIG_MODE_DETACH;
- }
- if (flags & SignatureMode::Clearsigned) {
- result |= GPGME_SIG_MODE_CLEAR;
- }
- if (flags & SignatureMode::SignArchive) {
- result |= GPGME_SIG_MODE_ARCHIVE;
- }
- if (flags & SignatureMode::SignFile) {
- result |= GPGME_SIG_MODE_FILE;
- }
- return static_cast<gpgme_sig_mode_t>(result);
-}
-
-SigningResult Context::sign(const Data &plainText, Data &signature, SignatureMode mode)
-{
- d->lastop = Private::Sign;
- const Data::Private *const pdp = plainText.impl();
- Data::Private *const sdp = signature.impl();
- d->lasterr = gpgme_op_sign(d->ctx, pdp ? pdp->data : nullptr, sdp ? sdp->data : nullptr, sigflags2sigflags(mode));
- return SigningResult(d->ctx, Error(d->lasterr));
-}
-
-Error Context::startSigning(const Data &plainText, Data &signature, SignatureMode mode)
-{
- d->lastop = Private::Sign;
- const Data::Private *const pdp = plainText.impl();
- Data::Private *const sdp = signature.impl();
- return Error(d->lasterr = gpgme_op_sign_start(d->ctx, pdp ? pdp->data : nullptr, sdp ? sdp->data : nullptr, sigflags2sigflags(mode)));
-}
-
-SigningResult Context::signingResult() const
-{
- if (d->lastop & Private::Sign) {
- return SigningResult(d->ctx, Error(d->lasterr));
- } else {
- return SigningResult();
- }
-}
-
-static gpgme_encrypt_flags_t encryptflags2encryptflags(Context::EncryptionFlags flags)
-{
- unsigned int result = 0;
- if (flags & Context::AlwaysTrust) {
- result |= GPGME_ENCRYPT_ALWAYS_TRUST;
- }
- if (flags & Context::NoEncryptTo) {
- result |= GPGME_ENCRYPT_NO_ENCRYPT_TO;
- }
- if (flags & Context::Prepare) {
- result |= GPGME_ENCRYPT_PREPARE;
- }
- if (flags & Context::ExpectSign) {
- result |= GPGME_ENCRYPT_EXPECT_SIGN;
- }
- if (flags & Context::NoCompress) {
- result |= GPGME_ENCRYPT_NO_COMPRESS;
- }
- if (flags & Context::Symmetric) {
- result |= GPGME_ENCRYPT_SYMMETRIC;
- }
- if (flags & Context::ThrowKeyIds) {
- result |= GPGME_ENCRYPT_THROW_KEYIDS;
- }
- if (flags & Context::EncryptWrap) {
- result |= GPGME_ENCRYPT_WRAP;
- }
- if (flags & Context::WantAddress) {
- result |= GPGME_ENCRYPT_WANT_ADDRESS;
- }
- if (flags & Context::EncryptArchive) {
- result |= GPGME_ENCRYPT_ARCHIVE;
- }
- if (flags & Context::EncryptFile) {
- result |= GPGME_ENCRYPT_FILE;
- }
- return static_cast<gpgme_encrypt_flags_t>(result);
-}
-
-gpgme_key_t *Context::getKeysFromRecipients(const std::vector<Key> &recipients)
-{
- if (recipients.empty()) {
- return nullptr;
- }
- gpgme_key_t *ret = new gpgme_key_t[ recipients.size() + 1 ];
- gpgme_key_t *keys_it = ret;
- for (std::vector<Key>::const_iterator it = recipients.begin() ; it != recipients.end() ; ++it) {
- if (it->impl()) {
- *keys_it++ = it->impl();
- }
- }
- *keys_it++ = nullptr;
- return ret;
-}
-
-EncryptionResult Context::encrypt(const std::vector<Key> &recipients, const Data &plainText, Data &cipherText, EncryptionFlags flags)
-{
- d->lastop = Private::Encrypt;
- if (flags & NoEncryptTo) {
- return EncryptionResult(Error(d->lasterr = make_error(GPG_ERR_NOT_IMPLEMENTED)));
- }
- const Data::Private *const pdp = plainText.impl();
- Data::Private *const cdp = cipherText.impl();
- gpgme_key_t *const keys = getKeysFromRecipients(recipients);
- d->lasterr = gpgme_op_encrypt(d->ctx, keys, encryptflags2encryptflags(flags),
- pdp ? pdp->data : nullptr, cdp ? cdp->data : nullptr);
- if (keys) {
- delete[] keys;
- }
- return EncryptionResult(d->ctx, Error(d->lasterr));
-}
-
-Error Context::encryptSymmetrically(const Data &plainText, Data &cipherText)
-{
- d->lastop = Private::Encrypt;
- const Data::Private *const pdp = plainText.impl();
- Data::Private *const cdp = cipherText.impl();
- return Error(d->lasterr = gpgme_op_encrypt(d->ctx, nullptr, (gpgme_encrypt_flags_t)0,
- pdp ? pdp->data : nullptr, cdp ? cdp->data : nullptr));
-}
-
-Error Context::startEncryption(const std::vector<Key> &recipients, const Data &plainText, Data &cipherText, EncryptionFlags flags)
-{
- d->lastop = Private::Encrypt;
- if (flags & NoEncryptTo) {
- return Error(d->lasterr = make_error(GPG_ERR_NOT_IMPLEMENTED));
- }
- const Data::Private *const pdp = plainText.impl();
- Data::Private *const cdp = cipherText.impl();
- gpgme_key_t *const keys = getKeysFromRecipients(recipients);
- d->lasterr = gpgme_op_encrypt_start(d->ctx, keys, encryptflags2encryptflags(flags),
- pdp ? pdp->data : nullptr, cdp ? cdp->data : nullptr);
- if (keys) {
- delete[] keys;
- }
- return Error(d->lasterr);
-}
-
-EncryptionResult Context::encryptionResult() const
-{
- if (d->lastop & Private::Encrypt) {
- return EncryptionResult(d->ctx, Error(d->lasterr));
- } else {
- return EncryptionResult();
- }
-}
-
-std::pair<SigningResult, EncryptionResult> Context::signAndEncrypt(const std::vector<Key> &recipients, const Data &plainText, Data &cipherText, EncryptionFlags flags)
-{
- d->lastop = Private::SignAndEncrypt;
- const Data::Private *const pdp = plainText.impl();
- Data::Private *const cdp = cipherText.impl();
- gpgme_key_t *const keys = getKeysFromRecipients(recipients);
- d->lasterr = gpgme_op_encrypt_sign(d->ctx, keys, encryptflags2encryptflags(flags),
- pdp ? pdp->data : nullptr, cdp ? cdp->data : nullptr);
- if (keys) {
- delete[] keys;
- }
- return std::make_pair(SigningResult(d->ctx, Error(d->lasterr)),
- EncryptionResult(d->ctx, Error(d->lasterr)));
-}
-
-Error Context::startCombinedSigningAndEncryption(const std::vector<Key> &recipients, const Data &plainText, Data &cipherText, EncryptionFlags flags)
-{
- d->lastop = Private::SignAndEncrypt;
- const Data::Private *const pdp = plainText.impl();
- Data::Private *const cdp = cipherText.impl();
- gpgme_key_t *const keys = getKeysFromRecipients(recipients);
- d->lasterr = gpgme_op_encrypt_sign_start(d->ctx, keys, encryptflags2encryptflags(flags),
- pdp ? pdp->data : nullptr, cdp ? cdp->data : nullptr);
- if (keys) {
- delete[] keys;
- }
- return Error(d->lasterr);
-}
-
-Error Context::createVFS(const char *containerFile, const std::vector< Key > &recipients)
-{
- d->lastop = Private::CreateVFS;
- gpgme_key_t *const keys = new gpgme_key_t[ recipients.size() + 1 ];
- gpgme_key_t *keys_it = keys;
- for (std::vector<Key>::const_iterator it = recipients.begin() ; it != recipients.end() ; ++it) {
- if (it->impl()) {
- *keys_it++ = it->impl();
- }
- }
- *keys_it++ = nullptr;
-
- gpgme_error_t op_err;
- d->lasterr = gpgme_op_vfs_create(d->ctx, keys, containerFile, 0, &op_err);
- delete[] keys;
- Error error(d->lasterr);
- if (error) {
- return error;
- }
- return Error(d->lasterr = op_err);
-}
-
-VfsMountResult Context::mountVFS(const char *containerFile, const char *mountDir)
-{
- d->lastop = Private::MountVFS;
- gpgme_error_t op_err;
- d->lasterr = gpgme_op_vfs_mount(d->ctx, containerFile, mountDir, 0, &op_err);
- return VfsMountResult(d->ctx, Error(d->lasterr), Error(op_err));
-}
-
-Error Context::cancelPendingOperation()
-{
- return Error(gpgme_cancel_async(d->ctx));
-}
-
-Error Context::cancelPendingOperationImmediately()
-{
- return Error(gpgme_cancel(d->ctx));
-}
-
-bool Context::poll()
-{
- gpgme_error_t e = GPG_ERR_NO_ERROR;
- const bool finished = gpgme_wait(d->ctx, &e, 0);
- if (finished) {
- d->lasterr = e;
- }
- return finished;
-}
-
-Error Context::wait()
-{
- gpgme_error_t e = GPG_ERR_NO_ERROR;
- gpgme_wait(d->ctx, &e, 1);
- return Error(d->lasterr = e);
-}
-
-Error Context::lastError() const
-{
- return Error(d->lasterr);
-}
-
-Context::PinentryMode Context::pinentryMode() const
-{
- switch (gpgme_get_pinentry_mode (d->ctx)) {
- case GPGME_PINENTRY_MODE_ASK:
- return PinentryAsk;
- case GPGME_PINENTRY_MODE_CANCEL:
- return PinentryCancel;
- case GPGME_PINENTRY_MODE_ERROR:
- return PinentryError;
- case GPGME_PINENTRY_MODE_LOOPBACK:
- return PinentryLoopback;
- case GPGME_PINENTRY_MODE_DEFAULT:
- default:
- return PinentryDefault;
- }
-}
-
-Error Context::setPinentryMode(PinentryMode which)
-{
- gpgme_pinentry_mode_t mode;
- switch (which) {
- case PinentryAsk:
- mode = GPGME_PINENTRY_MODE_ASK;
- break;
- case PinentryCancel:
- mode = GPGME_PINENTRY_MODE_CANCEL;
- break;
- case PinentryError:
- mode = GPGME_PINENTRY_MODE_ERROR;
- break;
- case PinentryLoopback:
- mode = GPGME_PINENTRY_MODE_LOOPBACK;
- break;
- case PinentryDefault:
- default:
- mode = GPGME_PINENTRY_MODE_DEFAULT;
- }
- return Error(d->lasterr = gpgme_set_pinentry_mode(d->ctx, mode));
-}
-
-static gpgme_tofu_policy_t to_tofu_policy_t(unsigned int policy)
-{
- switch (policy) {
- case TofuInfo::PolicyNone:
- return GPGME_TOFU_POLICY_NONE;
- case TofuInfo::PolicyAuto:
- return GPGME_TOFU_POLICY_AUTO;
- case TofuInfo::PolicyGood:
- return GPGME_TOFU_POLICY_GOOD;
- case TofuInfo::PolicyBad:
- return GPGME_TOFU_POLICY_BAD;
- case TofuInfo::PolicyAsk:
- return GPGME_TOFU_POLICY_ASK;
- case TofuInfo::PolicyUnknown:
- default:
- return GPGME_TOFU_POLICY_UNKNOWN;
- }
-}
-
-Error Context::setTofuPolicy(const Key &k, unsigned int policy)
-{
- return Error(d->lasterr = gpgme_op_tofu_policy(d->ctx,
- k.impl(), to_tofu_policy_t(policy)));
-}
-
-Error Context::setTofuPolicyStart(const Key &k, unsigned int policy)
-{
- return Error(d->lasterr = gpgme_op_tofu_policy_start(d->ctx,
- k.impl(), to_tofu_policy_t(policy)));
-}
-
-Error Context::startCreateKey (const char *userid,
- const char *algo,
- unsigned long reserved,
- unsigned long expires,
- const Key &certkey,
- unsigned int flags)
-{
- return Error(d->lasterr = gpgme_op_createkey_start(d->ctx,
- userid,
- algo,
- reserved,
- expires,
- certkey.impl(),
- flags));
-}
-
-Error Context::createKey (const char *userid,
- const char *algo,
- unsigned long reserved,
- unsigned long expires,
- const Key &certkey,
- unsigned int flags)
-{
- return Error(d->lasterr = gpgme_op_createkey(d->ctx,
- userid,
- algo,
- reserved,
- expires,
- certkey.impl(),
- flags));
-}
-
-KeyGenerationResult Context::createKeyEx (const char *userid,
- const char *algo,
- unsigned long reserved,
- unsigned long expires,
- const Key &certkey,
- unsigned int flags)
-{
- d->lasterr = gpgme_op_createkey(d->ctx,
- userid,
- algo,
- reserved,
- expires,
- certkey.impl(),
- flags);
- return KeyGenerationResult(d->ctx, Error(d->lasterr));
-}
-
-Error Context::addUid(const Key &k, const char *userid)
-{
- return Error(d->lasterr = gpgme_op_adduid(d->ctx,
- k.impl(), userid, 0));
-}
-
-Error Context::startAddUid(const Key &k, const char *userid)
-{
- return Error(d->lasterr = gpgme_op_adduid_start(d->ctx,
- k.impl(), userid, 0));
-}
-
-Error Context::revUid(const Key &k, const char *userid)
-{
- return Error(d->lasterr = gpgme_op_revuid(d->ctx,
- k.impl(), userid, 0));
-}
-
-Error Context::startRevUid(const Key &k, const char *userid)
-{
- return Error(d->lasterr = gpgme_op_revuid_start(d->ctx,
- k.impl(), userid, 0));
-}
-
-Error Context::setPrimaryUid(const Key &k, const char *userid)
-{
- return Error(d->lasterr = gpgme_op_set_uid_flag(d->ctx, k.impl(), userid, "primary", nullptr));
-}
-
-Error Context::startSetPrimaryUid(const Key &k, const char *userid)
-{
- return Error(d->lasterr = gpgme_op_set_uid_flag_start(d->ctx, k.impl(), userid, "primary", nullptr));
-}
-
-Error Context::createSubkey(const Key &k, const char *algo,
- unsigned long reserved,
- unsigned long expires,
- unsigned int flags)
-{
- return Error(d->lasterr = gpgme_op_createsubkey(d->ctx,
- k.impl(), algo, reserved, expires, flags));
-}
-
-Error Context::startCreateSubkey(const Key &k, const char *algo,
- unsigned long reserved,
- unsigned long expires,
- unsigned int flags)
-{
- return Error(d->lasterr = gpgme_op_createsubkey_start(d->ctx,
- k.impl(), algo, reserved, expires, flags));
-}
-
-static std::string getLFSeparatedListOfStrings(const std::vector<std::string> &strings)
-{
- if (strings.empty()) {
- return std::string();
- }
-
- return std::accumulate(
- std::next(strings.begin()),
- strings.end(),
- strings[0],
- [](const std::string &a, const std::string &b) {
- return a + '\n' + b;
- }
- );
-}
-
-static std::string getLFSeparatedListOfFingerprintsFromSubkeys(const std::vector<Subkey> &subkeys)
-{
- if (subkeys.empty()) {
- return std::string();
- }
-
- std::vector<std::string> fprs;
- fprs.reserve(subkeys.size());
- for (auto &it : subkeys) {
- if (it.fingerprint()) {
- fprs.push_back(std::string(it.fingerprint()));
- }
- }
-
- return getLFSeparatedListOfStrings(fprs);
-}
-
-Error Context::setExpire(const Key &k, unsigned long expires,
- const std::vector<Subkey> &subkeys,
- const Context::SetExpireFlags flags)
-{
- std::string subfprs;
- if (flags & Context::SetExpireAllSubkeys) {
- subfprs = "*";
- } else {
- subfprs = getLFSeparatedListOfFingerprintsFromSubkeys(subkeys);
- }
- return Error(d->lasterr = gpgme_op_setexpire(d->ctx,
- k.impl(), expires, subfprs.c_str(), 0));
-}
-
-Error Context::startSetExpire(const Key &k, unsigned long expires,
- const std::vector<Subkey> &subkeys,
- const Context::SetExpireFlags flags)
-{
- std::string subfprs;
- if (flags & Context::SetExpireAllSubkeys) {
- subfprs = "*";
- } else {
- subfprs = getLFSeparatedListOfFingerprintsFromSubkeys(subkeys);
- }
- return Error(d->lasterr = gpgme_op_setexpire_start(d->ctx,
- k.impl(), expires, subfprs.c_str(), 0));
-}
-
-static const char *owner_trust_to_string(Key::OwnerTrust trust)
-{
- static const char *const owner_trust_strings[] = {
- "undefined", // --quick-set-ownertrust wants "undefined" for Unknown
- "undefined", // Undefined is never used for key->owner_trust
- "never",
- "marginal",
- "full",
- "ultimate",
- };
-
- if (Key::OwnerTrust::Unknown <= trust && trust <= Key::OwnerTrust::Ultimate) {
- return owner_trust_strings[trust];
- }
- return nullptr;
-}
-
-Error Context::setOwnerTrust(const Key &key, Key::OwnerTrust trust)
-{
- d->lasterr = gpgme_op_setownertrust(d->ctx, key.impl(),
- owner_trust_to_string(trust));
- return Error(d->lasterr);
-}
-
-Error Context::startSetOwnerTrust(const Key &key, Key::OwnerTrust trust)
-{
- d->lasterr = gpgme_op_setownertrust_start(d->ctx, key.impl(),
- owner_trust_to_string(trust));
- return Error(d->lasterr);
-}
-
-Error Context::setKeyEnabled(const Key &key, bool enabled)
-{
- d->lasterr = gpgme_op_setownertrust(d->ctx, key.impl(),
- enabled ? "enable" : "disable");
- return Error(d->lasterr);
-}
-
-Error Context::startSetKeyEnabled(const Key &key, bool enabled)
-{
- d->lasterr = gpgme_op_setownertrust_start(d->ctx, key.impl(),
- enabled ? "enable" : "disable");
- return Error(d->lasterr);
-}
-
-static std::string getLFSeparatedListOfUserIds(const std::vector<UserID> &userIds)
-{
- if (userIds.empty()) {
- return std::string();
- }
-
- std::vector<std::string> uids;
- uids.reserve(userIds.size());
- for (auto &userId : userIds) {
- if (userId.id()) {
- uids.push_back(std::string(userId.id()));
- }
- }
-
- return getLFSeparatedListOfStrings(uids);
-}
-
-Error Context::revokeSignature(const Key &key, const Key &signingKey,
- const std::vector<UserID> &userIds)
-{
- const unsigned int flags = userIds.size() > 1 ? GPGME_REVSIG_LFSEP : 0;
- const std::string uids = getLFSeparatedListOfUserIds(userIds);
- return Error(d->lasterr = gpgme_op_revsig(d->ctx,
- key.impl(), signingKey.impl(), uids.c_str(), flags));
-}
-
-Error Context::startRevokeSignature(const Key &key, const Key &signingKey,
- const std::vector<UserID> &userIds)
-{
- const unsigned int flags = userIds.size() > 1 ? GPGME_REVSIG_LFSEP : 0;
- const std::string uids = getLFSeparatedListOfUserIds(userIds);
- return Error(d->lasterr = gpgme_op_revsig_start(d->ctx,
- key.impl(), signingKey.impl(), uids.c_str(), flags));
-}
-
-Error Context::addAdsk(const Key &k, const char *adsk)
-{
- return Error(d->lasterr = gpgme_op_createsubkey(d->ctx, k.impl(), adsk, 0, 0, GPGME_CREATE_ADSK));
-}
-
-Error Context::startAddAdsk(const Key &k, const char *adsk)
-{
- return Error(d->lasterr = gpgme_op_createsubkey_start(d->ctx, k.impl(), adsk, 0, 0, GPGME_CREATE_ADSK));
-}
-
-Error Context::setFlag(const char *name, const char *value)
-{
- return Error(d->lasterr = gpgme_set_ctx_flag(d->ctx, name, value));
-}
-
-const char *Context::getFlag(const char *name) const
-{
- return gpgme_get_ctx_flag(d->ctx, name);
-}
-
-// Engine Spawn stuff
-Error Context::spawn(const char *file, const char *argv[],
- Data &input, Data &output, Data &err,
- SpawnFlags flags)
-{
- return Error(d->lasterr = gpgme_op_spawn (d->ctx, file, argv,
- input.impl() ? input.impl()->data : nullptr,
- output.impl() ? output.impl()->data : nullptr,
- err.impl() ? err.impl()->data : nullptr,
- static_cast<int>(flags)));
-}
-
-Error Context::spawnAsync(const char *file, const char *argv[],
- Data &input, Data &output, Data &err,
- SpawnFlags flags)
-{
- return Error(d->lasterr = gpgme_op_spawn_start (d->ctx, file, argv,
- input.impl() ? input.impl()->data : nullptr,
- output.impl() ? output.impl()->data : nullptr,
- err.impl() ? err.impl()->data : nullptr,
- static_cast<int>(flags)));
-}
-
-std::ostream &operator<<(std::ostream &os, Protocol proto)
-{
- os << "GpgME::Protocol(";
- switch (proto) {
- case OpenPGP:
- os << "OpenPGP";
- break;
- case CMS:
- os << "CMS";
- break;
- default:
- case UnknownProtocol:
- os << "UnknownProtocol";
- break;
- }
- return os << ')';
-}
-
-std::ostream &operator<<(std::ostream &os, Engine eng)
-{
- os << "GpgME::Engine(";
- switch (eng) {
- case GpgEngine:
- os << "GpgEngine";
- break;
- case GpgSMEngine:
- os << "GpgSMEngine";
- break;
- case GpgConfEngine:
- os << "GpgConfEngine";
- break;
- case AssuanEngine:
- os << "AssuanEngine";
- break;
- case SpawnEngine:
- os << "SpawnEngine";
- break;
- default:
- case UnknownEngine:
- os << "UnknownEngine";
- break;
- }
- return os << ')';
-}
-
-std::ostream &operator<<(std::ostream &os, Context::CertificateInclusion incl)
-{
- os << "GpgME::Context::CertificateInclusion(" << static_cast<int>(incl);
- switch (incl) {
- case Context::DefaultCertificates:
- os << "(DefaultCertificates)";
- break;
- case Context::AllCertificatesExceptRoot:
- os << "(AllCertificatesExceptRoot)";
- break;
- case Context::AllCertificates:
- os << "(AllCertificates)";
- break;
- case Context::NoCertificates:
- os << "(NoCertificates)";
- break;
- case Context::OnlySenderCertificate:
- os << "(OnlySenderCertificate)";
- break;
- }
- return os << ')';
-}
-
-std::ostream &operator<<(std::ostream &os, KeyListMode mode)
-{
- os << "GpgME::KeyListMode(";
-#define CHECK( x ) if ( !(mode & (x)) ) {} else do { os << #x " "; } while (0)
- CHECK(Local);
- CHECK(Extern);
- CHECK(Signatures);
- CHECK(Validate);
- CHECK(Ephemeral);
- CHECK(WithTofu);
- CHECK(WithKeygrip);
- CHECK(WithSecret);
- CHECK(ForceExtern);
-#undef CHECK
- return os << ')';
-}
-
-std::ostream &operator<<(std::ostream &os, SignatureMode mode)
-{
- os << "GpgME::SignatureMode(";
-#undef CHECK
- switch (mode & (NormalSignatureMode|Detached|Clearsigned)) {
-#define CHECK( x ) case x: os << #x; break
- CHECK(NormalSignatureMode);
- CHECK(Detached);
- CHECK(Clearsigned);
-#undef CHECK
- default:
- os << "???" "(" << static_cast<int>(mode) << ')';
- break;
- }
-#define CHECK( x ) if ( !(mode & (x)) ) {} else do { os << #x " "; } while (0)
- CHECK(SignArchive);
- CHECK(SignFile);
-#undef CHECK
- return os << ')';
-}
-
-std::ostream &operator<<(std::ostream &os, Context::EncryptionFlags flags)
-{
- os << "GpgME::Context::EncryptionFlags(";
-#define CHECK( x ) if ( !(flags & (Context::x)) ) {} else do { os << #x " "; } while (0)
- CHECK(AlwaysTrust);
- CHECK(NoEncryptTo);
- CHECK(Prepare);
- CHECK(ExpectSign);
- CHECK(NoCompress);
- CHECK(Symmetric);
- CHECK(ThrowKeyIds);
- CHECK(EncryptWrap);
- CHECK(WantAddress);
- CHECK(EncryptArchive);
- CHECK(EncryptFile);
-#undef CHECK
- return os << ')';
-}
-
-std::ostream &operator<<(std::ostream &os, Context::AuditLogFlags flags)
-{
- os << "GpgME::Context::AuditLogFlags(";
-#define CHECK( x ) if ( !(flags & (Context::x)) ) {} else do { os << #x " "; } while (0)
- CHECK(HtmlAuditLog);
- CHECK(AuditLogWithHelp);
-#undef CHECK
- return os << ')';
-}
-
-} // namespace GpgME
-
-GpgME::Error GpgME::setDefaultLocale(int cat, const char *val)
-{
- return Error(gpgme_set_locale(nullptr, cat, val));
-}
-
-GpgME::EngineInfo GpgME::engineInfo(GpgME::Protocol proto)
-{
- return get_static_engine_info(proto == CMS ? GPGME_PROTOCOL_CMS : GPGME_PROTOCOL_OpenPGP);
-}
-
-const char *GpgME::dirInfo(const char *what)
-{
- return gpgme_get_dirinfo(what);
-}
-
-GpgME::Error GpgME::checkEngine(GpgME::Protocol proto)
-{
- const gpgme_protocol_t p = proto == CMS ? GPGME_PROTOCOL_CMS : GPGME_PROTOCOL_OpenPGP ;
-
- return Error(gpgme_engine_check_version(p));
-}
-
-static const gpgme_protocol_t UNKNOWN_PROTOCOL = static_cast<gpgme_protocol_t>(255);
-
-static gpgme_protocol_t engine2protocol(const GpgME::Engine engine)
-{
- switch (engine) {
- case GpgME::GpgEngine: return GPGME_PROTOCOL_OpenPGP;
- case GpgME::GpgSMEngine: return GPGME_PROTOCOL_CMS;
- case GpgME::GpgConfEngine:
- return GPGME_PROTOCOL_GPGCONF;
- case GpgME::AssuanEngine:
- return GPGME_PROTOCOL_ASSUAN;
- case GpgME::G13Engine:
- return GPGME_PROTOCOL_G13;
- case GpgME::SpawnEngine:
- return GPGME_PROTOCOL_SPAWN;
- case GpgME::UnknownEngine:
- ;
- }
- return UNKNOWN_PROTOCOL;
-}
-
-GpgME::EngineInfo GpgME::engineInfo(GpgME::Engine engine)
-{
- return get_static_engine_info(engine2protocol(engine));
-}
-
-GpgME::Error GpgME::checkEngine(GpgME::Engine engine)
-{
- const gpgme_protocol_t p = engine2protocol(engine);
-
- return Error(gpgme_engine_check_version(p));
-}
-
-static const unsigned long supported_features = 0
- | GpgME::ValidatingKeylistModeFeature
- | GpgME::CancelOperationFeature
- | GpgME::WrongKeyUsageFeature
- | GpgME::DefaultCertificateInclusionFeature
- | GpgME::GetSetEngineInfoFeature
- | GpgME::ClearAddGetSignatureNotationsFeature
- | GpgME::SetDataFileNameFeeature
- | GpgME::SignatureNotationsKeylistModeFeature
- | GpgME::KeySignatureNotationsFeature
- | GpgME::KeyIsQualifiedFeature
- | GpgME::SignatureNotationsCriticalFlagFeature
- | GpgME::SignatureNotationsFlagsFeature
- | GpgME::SignatureNotationsHumanReadableFlagFeature
- | GpgME::SubkeyIsQualifiedFeature
- | GpgME::EngineInfoHomeDirFeature
- | GpgME::DecryptionResultFileNameFeature
- | GpgME::DecryptionResultRecipientsFeature
- | GpgME::VerificationResultFileNameFeature
- | GpgME::SignaturePkaFieldsFeature
- | GpgME::SignatureAlgorithmFieldsFeature
- | GpgME::FdPointerFeature
- | GpgME::AuditLogFeature
- | GpgME::GpgConfEngineFeature
- | GpgME::CancelOperationAsyncFeature
- | GpgME::NoEncryptToEncryptionFlagFeature
- | GpgME::CardKeyFeature
- | GpgME::AssuanEngineFeature
- | GpgME::EphemeralKeylistModeFeature
- | GpgME::ImportFromKeyserverFeature
- | GpgME::G13VFSFeature
- | GpgME::PasswdFeature
- ;
-
-static const unsigned long supported_features2 = 0
- | GpgME::BinaryAndFineGrainedIdentify
- ;
-
-bool GpgME::hasFeature(unsigned long features)
-{
- return features == (features & supported_features);
-}
-
-bool GpgME::hasFeature(unsigned long features, unsigned long features2)
-{
- return features == (features & supported_features)
- && features2 == (features2 & supported_features2)
- ;
-}
-
-int GpgME::setGlobalFlag(const char *name, const char *value)
-{
- return gpgme_set_global_flag(name, value);
-}
diff --git a/lang/cpp/src/context.h b/lang/cpp/src/context.h
deleted file mode 100644
index e2c73b64..00000000
--- a/lang/cpp/src/context.h
+++ /dev/null
@@ -1,586 +0,0 @@
-/*
- context.h - wraps a gpgme key context
- Copyright (C) 2003, 2007 Klarälvdalens Datakonsult AB
-
- 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.
-*/
-
-// -*- c++ -*-
-#ifndef __GPGMEPP_CONTEXT_H__
-#define __GPGMEPP_CONTEXT_H__
-
-#include "global.h"
-
-#include "error.h"
-#include "key.h"
-#include "verificationresult.h" // for Signature::Notation
-
-#include <memory>
-#include <string>
-#include <vector>
-#include <utility>
-#include <iosfwd>
-
-namespace GpgME
-{
-
-class Data;
-class TrustItem;
-class ProgressProvider;
-class PassphraseProvider;
-class EventLoopInteractor;
-class EditInteractor;
-class AssuanTransaction;
-
-class KeyListResult;
-class KeyGenerationResult;
-class ImportResult;
-class DecryptionResult;
-class VerificationResult;
-class SigningResult;
-class EncryptionResult;
-class VfsMountResult;
-
-class EngineInfo;
-
-class GPGMEPP_EXPORT Context
-{
- explicit Context(gpgme_ctx_t);
-public:
- //using GpgME::Protocol;
-
- /// RAII-style class for saving/restoring the key list mode.
- class GPGMEPP_EXPORT KeyListModeSaver
- {
- public:
- explicit KeyListModeSaver(Context *ctx);
- ~KeyListModeSaver();
- private:
- Context *mCtx;
- unsigned int mKeyListMode;
- };
-
- //
- // Creation and destruction:
- //
-
- static Context *createForProtocol(Protocol proto);
- /** Same as above but returning a unique ptr. */
- static std::unique_ptr<Context> create(Protocol proto);
- static std::unique_ptr<Context> createForEngine(Engine engine, Error *err = nullptr);
- virtual ~Context();
-
- //
- // Context Attributes
- //
-
- Protocol protocol() const;
-
- void setArmor(bool useArmor);
- bool armor() const;
-
- void setTextMode(bool useTextMode);
- bool textMode() const;
-
- void setOffline(bool useOfflineMode);
- bool offline() const;
-
- const char *getFlag(const char *name) const;
- Error setFlag(const char *name, const char *value);
-
- enum CertificateInclusion {
- DefaultCertificates = -256,
- AllCertificatesExceptRoot = -2,
- AllCertificates = -1,
- NoCertificates = 0,
- OnlySenderCertificate = 1
- };
- void setIncludeCertificates(int which);
- int includeCertificates() const;
-
- //using GpgME::KeyListMode;
- void setKeyListMode(unsigned int keyListMode);
- void addKeyListMode(unsigned int keyListMode);
- unsigned int keyListMode() const;
-
- /** Set the passphrase provider
- *
- * To avoid problems where a class using a context registers
- * itself as the provider the Context does not take ownership
- * of the provider and the caller must ensure that the provider
- * is deleted if it is no longer needed.
- */
- void setPassphraseProvider(PassphraseProvider *provider);
- PassphraseProvider *passphraseProvider() const;
-
- /** Set the progress provider
- *
- * To avoid problems where a class using a context registers
- * itself as the provider the Context does not take ownership
- * of the provider and the caller must ensure that the provider
- * is deleted if it is no longer needed.
- */
- void setProgressProvider(ProgressProvider *provider);
- ProgressProvider *progressProvider() const;
-
- void setManagedByEventLoopInteractor(bool managed);
- bool managedByEventLoopInteractor() const;
-
- GpgME::Error setLocale(int category, const char *value);
-
- EngineInfo engineInfo() const;
- GpgME::Error setEngineFileName(const char *filename);
- GpgME::Error setEngineHomeDirectory(const char *filename);
-
- enum PinentryMode{
- PinentryDefault = 0,
- PinentryAsk = 1,
- PinentryCancel = 2,
- PinentryError = 3,
- PinentryLoopback = 4
- };
- GpgME::Error setPinentryMode(PinentryMode which);
- PinentryMode pinentryMode() const;
-
-private:
- friend class ::GpgME::EventLoopInteractor;
- void installIOCallbacks(gpgme_io_cbs *iocbs);
- void uninstallIOCallbacks();
-
-public:
- //
- //
- // Key Management
- //
- //
-
- //
- // Key Listing
- //
-
- GpgME::Error startKeyListing(const char *pattern = nullptr, bool secretOnly = false);
- GpgME::Error startKeyListing(const char *patterns[], bool secretOnly = false);
-
- Key nextKey(GpgME::Error &e);
-
- KeyListResult endKeyListing();
- KeyListResult keyListResult() const;
-
- Key key(const char *fingerprint, GpgME::Error &e, bool secret = false);
-
- //
- // Key Generation
- //
-
- KeyGenerationResult generateKey(const char *parameters, Data &pubKey);
- GpgME::Error startKeyGeneration(const char *parameters, Data &pubkey);
- KeyGenerationResult keyGenerationResult() const;
-
- //
- // Key Export
- //
- enum ExportMode {
- ExportDefault = 0,
- ExportExtern = 2,
- ExportMinimal = 4,
- ExportSecret = 16,
- ExportRaw = 32,
- ExportPKCS12 = 64,
- ExportNoUID = 128, // obsolete; has no effect
- ExportSSH = 256,
- ExportSecretSubkey = 512,
- };
-
- GpgME::Error exportPublicKeys(const char *pattern, Data &keyData);
- GpgME::Error exportPublicKeys(const char *pattern, Data &keyData, unsigned int mode);
- GpgME::Error exportPublicKeys(const char *pattern[], Data &keyData);
- GpgME::Error exportPublicKeys(const char *pattern[], Data &keyData, unsigned int mode);
- GpgME::Error startPublicKeyExport(const char *pattern, Data &keyData);
- GpgME::Error startPublicKeyExport(const char *pattern, Data &keyData, unsigned int mode);
- GpgME::Error startPublicKeyExport(const char *pattern[], Data &keyData);
- GpgME::Error startPublicKeyExport(const char *pattern[], Data &keyData, unsigned int mode);
-
- GpgME::Error exportSecretKeys(const char *pattern, Data &keyData, unsigned int mode = ExportSecret);
- GpgME::Error exportSecretKeys(const char *pattern[], Data &keyData, unsigned int mode = ExportSecret);
- GpgME::Error startSecretKeyExport(const char *pattern, Data &keyData, unsigned int mode = ExportSecret);
- GpgME::Error startSecretKeyExport(const char *pattern[], Data &keyData, unsigned int mode = ExportSecret);
-
- GpgME::Error exportSecretSubkeys(const char *pattern, Data &keyData, unsigned int mode = ExportSecretSubkey);
- GpgME::Error exportSecretSubkeys(const char *pattern[], Data &keyData, unsigned int mode = ExportSecretSubkey);
- GpgME::Error startSecretSubkeyExport(const char *pattern, Data &keyData, unsigned int mode = ExportSecretSubkey);
- GpgME::Error startSecretSubkeyExport(const char *pattern[], Data &keyData, unsigned int mode = ExportSecretSubkey);
-
- // generic export functions; prefer using the specific public/secret key export functions
- GpgME::Error exportKeys(const char *pattern, Data &keyData, unsigned int mode = ExportDefault);
- GpgME::Error exportKeys(const char *pattern[], Data &keyData, unsigned int mode = ExportDefault);
- GpgME::Error startKeyExport(const char *pattern, Data &keyData, unsigned int mode = ExportDefault);
- GpgME::Error startKeyExport(const char *pattern[], Data &keyData, unsigned int mode = ExportDefault);
-
- //
- // Key Import
- //
-
- ImportResult importKeys(const Data &data);
- ImportResult importKeys(const std::vector<Key> &keys);
- ImportResult importKeys(const std::vector<std::string> &keyIds);
- GpgME::Error startKeyImport(const Data &data);
- GpgME::Error startKeyImport(const std::vector<Key> &keys);
- GpgME::Error startKeyImport(const std::vector<std::string> &keyIds);
- ImportResult importResult() const;
-
- //
- // Key Deletion
- //
-
- GpgME::Error deleteKey(const Key &key, bool allowSecretKeyDeletion = false);
- GpgME::Error startKeyDeletion(const Key &key, bool allowSecretKeyDeletion = false);
-
- //
- // Passphrase changing
- //
-
- GpgME::Error passwd(const Key &key);
- GpgME::Error startPasswd(const Key &key);
-
- //
- // Key Editing
- //
-
- GpgME::Error edit(const Key &key, std::unique_ptr<EditInteractor> function, Data &out);
- GpgME::Error startEditing(const Key &key, std::unique_ptr<EditInteractor> function, Data &out);
-
-
- //
- // Modern Interface actions. Require 2.1.x
- //
- Error startCreateKey (const char *userid,
- const char *algo,
- unsigned long reserved,
- unsigned long expires,
- const Key &certkey,
- unsigned int flags);
- Error createKey (const char *userid,
- const char *algo,
- unsigned long reserved,
- unsigned long expires,
- const Key &certkey,
- unsigned int flags);
-
- // Same as create key but returning a result
- GpgME::KeyGenerationResult createKeyEx (const char *userid,
- const char *algo,
- unsigned long reserved,
- unsigned long expires,
- const Key &certkey,
- unsigned int flags);
-
- Error addUid(const Key &key, const char *userid);
- Error startAddUid(const Key &key, const char *userid);
-
- Error revUid(const Key &key, const char *userid);
- Error startRevUid(const Key &key, const char *userid);
-
- Error setPrimaryUid(const Key &key, const char *userid);
- Error startSetPrimaryUid(const Key &key, const char *userid);
-
- Error createSubkey(const Key &key, const char *algo,
- unsigned long reserved = 0,
- unsigned long expires = 0,
- unsigned int flags = 0);
- Error startCreateSubkey(const Key &key, const char *algo,
- unsigned long reserved = 0,
- unsigned long expires = 0,
- unsigned int flags = 0);
-
- enum SetExpireFlags {
- SetExpireDefault = 0,
- SetExpireAllSubkeys = 1
- };
-
- Error setExpire(const Key &k, unsigned long expires,
- const std::vector<Subkey> &subkeys = std::vector<Subkey>(),
- const SetExpireFlags flags = SetExpireDefault);
- Error startSetExpire(const Key &k, unsigned long expires,
- const std::vector<Subkey> &subkeys = std::vector<Subkey>(),
- const SetExpireFlags flags = SetExpireDefault);
-
- /**
- * Sets the owner trust of the key \a key to the value \a trust.
- * Requires gpg 2.4.6.
- */
- Error setOwnerTrust(const Key &key, Key::OwnerTrust trust);
- /**
- * Starts the operation to set the owner trust of the key \a key to the value \a trust.
- * Requires gpg 2.4.6.
- */
- Error startSetOwnerTrust(const Key &key, Key::OwnerTrust trust);
-
- /**
- * Enables or disables the key \a key.
- * Requires gpg 2.4.6.
- */
- Error setKeyEnabled(const Key &key, bool enabled);
- /**
- * Starts the operation to enable or disable the key \a key.
- * Requires gpg 2.4.6.
- */
- Error startSetKeyEnabled(const Key &key, bool enabled);
-
- Error revokeSignature(const Key &key, const Key &signingKey,
- const std::vector<UserID> &userIds = std::vector<UserID>());
- Error startRevokeSignature(const Key &key, const Key &signingKey,
- const std::vector<UserID> &userIds = std::vector<UserID>());
-
- Error addAdsk(const Key &k, const char *adsk);
- Error startAddAdsk(const Key &k, const char *adsk);
-
- // using TofuInfo::Policy
- Error setTofuPolicy(const Key &k, unsigned int policy);
- Error setTofuPolicyStart(const Key &k, unsigned int policy);
-
- EditInteractor *lastEditInteractor() const;
- std::unique_ptr<EditInteractor> takeLastEditInteractor();
-
- //
- // SmartCard Editing
- //
-
- GpgME::Error cardEdit(const Key &key, std::unique_ptr<EditInteractor> function, Data &out);
- GpgME::Error startCardEditing(const Key &key, std::unique_ptr<EditInteractor> function, Data &out);
-
- EditInteractor *lastCardEditInteractor() const;
- std::unique_ptr<EditInteractor> takeLastCardEditInteractor();
-
- //
- // Trust Item Management
- //
-
- GpgME::Error startTrustItemListing(const char *pattern, int maxLevel);
- TrustItem nextTrustItem(GpgME::Error &e);
- GpgME::Error endTrustItemListing();
-
- //
- // Assuan Transactions
- //
-
- GpgME::Error assuanTransact(const char *command, std::unique_ptr<AssuanTransaction> transaction);
- GpgME::Error assuanTransact(const char *command);
- GpgME::Error startAssuanTransaction(const char *command, std::unique_ptr<AssuanTransaction> transaction);
- GpgME::Error startAssuanTransaction(const char *command);
-
- AssuanTransaction *lastAssuanTransaction() const;
- std::unique_ptr<AssuanTransaction> takeLastAssuanTransaction();
-
- //
- //
- // Crypto Operations
- //
-
- enum DecryptionFlags {
- // Keep in line with core's flags
- DecryptNone = 0,
- DecryptVerify = 1,
- DecryptArchive = 2,
- DecryptUnwrap = 128,
- DecryptMaxValue = 0x80000000
- };
-
- //
- // Decryption
- //
-
- // Alternative way to set decryption flags as they were added only in
- // 1.9.0 and so other API can still be used but with 1.9.0 additionally
- // flags can be set.
- void setDecryptionFlags (const DecryptionFlags flags);
-
- DecryptionResult decrypt(const Data &cipherText, Data &plainText);
- GpgME::Error startDecryption(const Data &cipherText, Data &plainText);
- DecryptionResult decrypt(const Data &cipherText, Data &plainText, const DecryptionFlags flags);
- GpgME::Error startDecryption(const Data &cipherText, Data &plainText, const DecryptionFlags flags);
- DecryptionResult decryptionResult() const;
-
- //
- // Signature Verification
- //
-
- VerificationResult verifyDetachedSignature(const Data &signature, const Data &signedText);
- VerificationResult verifyOpaqueSignature(const Data &signedData, Data &plainText);
- GpgME::Error startDetachedSignatureVerification(const Data &signature, const Data &signedText);
- GpgME::Error startOpaqueSignatureVerification(const Data &signedData, Data &plainText);
- VerificationResult verificationResult() const;
-
- //
- // Combined Decryption and Signature Verification
- //
-
- std::pair<DecryptionResult, VerificationResult> decryptAndVerify(const Data &cipherText, Data &plainText);
- std::pair<DecryptionResult, VerificationResult> decryptAndVerify(const Data &cipherText, Data &plainText, const DecryptionFlags flags);
- GpgME::Error startCombinedDecryptionAndVerification(const Data &cipherText, Data &plainText);
- GpgME::Error startCombinedDecryptionAndVerification(const Data &cipherText, Data &plainText, const DecryptionFlags flags);
- // use verificationResult() and decryptionResult() to retrieve the result objects...
-
- //
- // Signing
- //
-
- void clearSigningKeys();
- GpgME::Error addSigningKey(const Key &signer);
- Key signingKey(unsigned int index) const;
- std::vector<Key> signingKeys() const;
-
- void clearSignatureNotations();
- GpgME::Error addSignatureNotation(const char *name, const char *value, unsigned int flags = 0);
- GpgME::Error addSignaturePolicyURL(const char *url, bool critical = false);
- const char *signaturePolicyURL() const;
- Notation signatureNotation(unsigned int index) const;
- std::vector<Notation> signatureNotations() const;
-
- //using GpgME::SignatureMode;
- SigningResult sign(const Data &plainText, Data &signature, SignatureMode mode);
- 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
- //
-
- enum EncryptionFlags {
- None = 0,
- AlwaysTrust = 1,
- NoEncryptTo = 2,
- Prepare = 4,
- ExpectSign = 8,
- NoCompress = 16,
- Symmetric = 32,
- ThrowKeyIds = 64,
- EncryptWrap = 128,
- WantAddress = 256,
- EncryptArchive = 512,
- EncryptFile = 1024
- };
- EncryptionResult encrypt(const std::vector<Key> &recipients, const Data &plainText, Data &cipherText, EncryptionFlags flags);
- GpgME::Error encryptSymmetrically(const Data &plainText, Data &cipherText);
- GpgME::Error startEncryption(const std::vector<Key> &recipients, const Data &plainText, Data &cipherText, EncryptionFlags flags);
- EncryptionResult encryptionResult() const;
-
- //
- // Combined Signing and Encryption
- //
-
- std::pair<SigningResult, EncryptionResult> signAndEncrypt(const std::vector<Key> &recipients, const Data &plainText, Data &cipherText, EncryptionFlags flags);
- GpgME::Error startCombinedSigningAndEncryption(const std::vector<Key> &recipients, const Data &plainText, Data &cipherText, EncryptionFlags flags);
- // use encryptionResult() and signingResult() to retrieve the result objects...
-
- //
- //
- // Audit Log
- //
- //
- enum AuditLogFlags {
- DefaultAuditLog = 0,
- HtmlAuditLog = 1,
- DiagnosticAuditLog = 2,
- AuditLogWithHelp = 128
- };
- GpgME::Error startGetAuditLog(Data &output, unsigned int flags = 0);
- GpgME::Error getAuditLog(Data &output, unsigned int flags = 0);
-
- //
- //
- // G13 crypto container operations
- //
- //
- GpgME::Error createVFS(const char *containerFile, const std::vector<Key> &recipients);
- VfsMountResult mountVFS(const char *containerFile, const char *mountDir);
-
- // Spawn Engine
- enum SpawnFlags {
- SpawnNone = 0,
- SpawnDetached = 1,
- SpawnAllowSetFg = 2,
- SpawnShowWindow = 4
- };
- /** Spwan the process \a file with arguments \a argv.
- *
- * If a data parameter is null the /dev/null will be
- * used. (Or other platform stuff).
- *
- * @param file The executable to start.
- * @param argv list of arguments file should be argv[0].
- * @param input The data to be sent through stdin.
- * @param output The data to be receive the stdout.
- * @param err The data to receive stderr.
- * @param flags Additional flags.
- *
- * @returns An error or empty error.
- */
- GpgME::Error spawn(const char *file, const char *argv[],
- Data &input, Data &output, Data &err,
- SpawnFlags flags);
- /** Async variant of spawn. Immediately returns after starting the
- * process. */
- GpgME::Error spawnAsync(const char *file, const char *argv[],
- Data &input, Data &output,
- Data &err, SpawnFlags flags);
- //
- //
- // Run Control
- //
- //
-
- bool poll();
- GpgME::Error wait();
- GpgME::Error lastError() const;
- GpgME::Error cancelPendingOperation();
- GpgME::Error cancelPendingOperationImmediately();
-
- class Private;
- const Private *impl() const
- {
- return d;
- }
- Private *impl()
- {
- return d;
- }
-
-private:
- // Helper functions that need to be context because they rely
- // on the "Friendlyness" of context to access the gpgme types.
- gpgme_key_t *getKeysFromRecipients(const std::vector<Key> &recipients);
-
-private:
- Private *const d;
-
-private: // disable...
- Context(const Context &);
- const Context &operator=(const Context &);
-};
-
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, Context::CertificateInclusion incl);
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, Context::EncryptionFlags flags);
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, Context::AuditLogFlags flags);
-
-} // namespace GpgME
-
-#endif // __GPGMEPP_CONTEXT_H__
diff --git a/lang/cpp/src/context_p.h b/lang/cpp/src/context_p.h
deleted file mode 100644
index 8782609c..00000000
--- a/lang/cpp/src/context_p.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- context_p.h - wraps a gpgme context (private part)
- Copyright (C) 2003, 2007 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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.
-*/
-
-// -*- c++ -*-
-#ifndef __GPGMEPP_CONTEXT_P_H__
-#define __GPGMEPP_CONTEXT_P_H__
-
-#include <context.h>
-#include <data.h>
-
-#include <gpgme.h>
-
-namespace GpgME
-{
-
-class Context::Private
-{
-public:
- enum Operation {
- None = 0,
-
- Encrypt = 0x001,
- Decrypt = 0x002,
- Sign = 0x004,
- Verify = 0x008,
- DecryptAndVerify = Decrypt | Verify,
- SignAndEncrypt = Sign | Encrypt,
-
- Import = 0x010,
- Export = 0x020, // no gpgme_export_result_t, but nevertheless...
- Delete = 0x040, // no gpgme_delete_result_t, but nevertheless...
-
- KeyGen = 0x080,
- KeyList = 0x100,
- KeyListWithImport = KeyList | Import, // gpgme_keylist_result_t and gpgme_import_result_t
- TrustList = 0x200, // no gpgme_trustlist_result_t, but nevertheless...
-
- Edit = 0x400, // no gpgme_edit_result_t, but nevertheless...
- CardEdit = 0x800, // no gpgme_card_edit_result_t, but nevertheless...
-
- GetAuditLog = 0x1000, // no gpgme_getauditlog_result_t, but nevertheless...
-
- AssuanTransact = 0x2000,
- Passwd = 0x4000, // no gpgme_passwd_result_t, but nevertheless...
-
- CreateVFS = 0x4000,
- MountVFS = 0x8000,
-
- EndMarker
- };
-
- Private(gpgme_ctx_t c = nullptr);
- ~Private();
-
- gpgme_ctx_t ctx;
- gpgme_io_cbs *iocbs;
- Operation lastop;
- gpgme_error_t lasterr;
- Data lastAssuanInquireData;
- std::unique_ptr<AssuanTransaction> lastAssuanTransaction;
- std::unique_ptr<EditInteractor> lastEditInteractor, lastCardEditInteractor;
- DecryptionFlags decryptFlags;
-};
-
-} // namespace GpgME
-
-#endif // __GPGMEPP_CONTEXT_P_H__
diff --git a/lang/cpp/src/context_vanilla.cpp b/lang/cpp/src/context_vanilla.cpp
deleted file mode 100644
index 1d7d14d5..00000000
--- a/lang/cpp/src/context_vanilla.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- context_vanilla.cpp - wraps a gpgme key context, gpgme (vanilla)-specific functions
- Copyright (C) 2007 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 <global.h>
-
-GIOChannel *GpgME::getGIOChannel(int)
-{
- return nullptr;
-}
-
-QIODevice *GpgME::getQIODevice(int)
-{
- return nullptr;
-}
diff --git a/lang/cpp/src/data.cpp b/lang/cpp/src/data.cpp
deleted file mode 100644
index cf43b5bd..00000000
--- a/lang/cpp/src/data.cpp
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- data.cpp - wraps a gpgme data object
- Copyright (C) 2003 Klarälvdalens Datakonsult AB
-
- 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 "data_p.h"
-#include "context_p.h"
-#include <error.h>
-#include <interfaces/dataprovider.h>
-
-#include <gpgme.h>
-
-#ifndef NDEBUG
-#include <iostream>
-#endif
-
-GpgME::Data::Private::~Private()
-{
- if (data) {
- gpgme_data_release(data);
- }
-}
-
-const GpgME::Data::Null GpgME::Data::null;
-
-GpgME::Data::Data()
-{
- gpgme_data_t data;
- const gpgme_error_t e = gpgme_data_new(&data);
- d.reset(new Private(e ? nullptr : data));
-}
-
-GpgME::Data::Data(const Null &)
- : d(new Private(nullptr))
-{
-
-}
-
-GpgME::Data::Data(gpgme_data_t data)
- : d(new Private(data))
-{
-
-}
-
-GpgME::Data::Data(const char *buffer, size_t size, bool copy)
-{
- gpgme_data_t data;
- const gpgme_error_t e = gpgme_data_new_from_mem(&data, buffer, size, int(copy));
- std::string sizestr = std::to_string(size);
- // Ignore errors as this is optional
- gpgme_data_set_flag(data, "size-hint", sizestr.c_str());
- d.reset(new Private(e ? nullptr : data));
-}
-
-GpgME::Data::Data(const char *filename)
-{
- gpgme_data_t data;
- const gpgme_error_t e = gpgme_data_new(&data);
- d.reset(new Private(e ? nullptr : data));
- if (!e) {
- setFileName(filename);
- }
-}
-
-GpgME::Data::Data(const char *filename, off_t offset, size_t length)
-{
- gpgme_data_t data;
- const gpgme_error_t e = gpgme_data_new_from_filepart(&data, filename, nullptr, offset, length);
- d.reset(new Private(e ? nullptr : data));
-}
-
-GpgME::Data::Data(FILE *fp)
-{
- gpgme_data_t data;
- const gpgme_error_t e = gpgme_data_new_from_stream(&data, fp);
- d.reset(new Private(e ? nullptr : data));
-}
-
-GpgME::Data::Data(FILE *fp, off_t offset, size_t length)
-{
- gpgme_data_t data;
- const gpgme_error_t e = gpgme_data_new_from_filepart(&data, nullptr, fp, offset, length);
- d.reset(new Private(e ? nullptr : data));
-}
-
-GpgME::Data::Data(int fd)
-{
- gpgme_data_t data;
- const gpgme_error_t e = gpgme_data_new_from_fd(&data, fd);
- d.reset(new Private(e ? nullptr : data));
-}
-
-GpgME::Data::Data(DataProvider *dp)
-{
- d.reset(new Private);
- if (!dp) {
- return;
- }
- if (!dp->isSupported(DataProvider::Read)) {
- d->cbs.read = nullptr;
- }
- if (!dp->isSupported(DataProvider::Write)) {
- d->cbs.write = nullptr;
- }
- if (!dp->isSupported(DataProvider::Seek)) {
- d->cbs.seek = nullptr;
- }
- if (!dp->isSupported(DataProvider::Release)) {
- d->cbs.release = nullptr;
- }
- const gpgme_error_t e = gpgme_data_new_from_cbs(&d->data, &d->cbs, dp);
- if (e) {
- d->data = nullptr;
- }
- if (dp->isSupported(DataProvider::Seek)) {
- off_t size = seek(0, SEEK_END);
- seek(0, SEEK_SET);
- std::string sizestr = std::to_string(size);
- // Ignore errors as this is optional
- gpgme_data_set_flag(d->data, "size-hint", sizestr.c_str());
- }
-#ifndef NDEBUG
- //std::cerr << "GpgME::Data(): DataProvider supports: "
- // << ( d->cbs.read ? "read" : "no read" ) << ", "
- // << ( d->cbs.write ? "write" : "no write" ) << ", "
- // << ( d->cbs.seek ? "seek" : "no seek" ) << ", "
- // << ( d->cbs.release ? "release" : "no release" ) << std::endl;
-#endif
-}
-
-bool GpgME::Data::isNull() const
-{
- return !d || !d->data;
-}
-
-GpgME::Data::Encoding GpgME::Data::encoding() const
-{
- switch (gpgme_data_get_encoding(d->data)) {
- case GPGME_DATA_ENCODING_NONE: return AutoEncoding;
- case GPGME_DATA_ENCODING_BINARY: return BinaryEncoding;
- case GPGME_DATA_ENCODING_BASE64: return Base64Encoding;
- case GPGME_DATA_ENCODING_ARMOR: return ArmorEncoding;
- case GPGME_DATA_ENCODING_MIME: return MimeEncoding;
- case GPGME_DATA_ENCODING_URL: return UrlEncoding;
- case GPGME_DATA_ENCODING_URLESC: return UrlEscEncoding;
- case GPGME_DATA_ENCODING_URL0: return Url0Encoding;
- }
- return AutoEncoding;
-}
-
-GpgME::Error GpgME::Data::setEncoding(Encoding enc)
-{
- gpgme_data_encoding_t ge = GPGME_DATA_ENCODING_NONE;
- switch (enc) {
- case AutoEncoding: ge = GPGME_DATA_ENCODING_NONE; break;
- case BinaryEncoding: ge = GPGME_DATA_ENCODING_BINARY; break;
- case Base64Encoding: ge = GPGME_DATA_ENCODING_BASE64; break;
- case ArmorEncoding: ge = GPGME_DATA_ENCODING_ARMOR; break;
- case MimeEncoding: ge = GPGME_DATA_ENCODING_MIME; break;
- case UrlEncoding: ge = GPGME_DATA_ENCODING_URL; break;
- case UrlEscEncoding: ge = GPGME_DATA_ENCODING_URLESC; break;
- case Url0Encoding: ge = GPGME_DATA_ENCODING_URL0; break;
- }
- return Error(gpgme_data_set_encoding(d->data, ge));
-}
-
-GpgME::Data::Type GpgME::Data::type() const
-{
- if (isNull()) {
- return Invalid;
- }
- switch (gpgme_data_identify(d->data, 0)) {
- case GPGME_DATA_TYPE_INVALID: return Invalid;
- case GPGME_DATA_TYPE_UNKNOWN: return Unknown;
- case GPGME_DATA_TYPE_PGP_SIGNED: return PGPSigned;
- case GPGME_DATA_TYPE_PGP_OTHER: return PGPOther;
- case GPGME_DATA_TYPE_PGP_KEY: return PGPKey;
- case GPGME_DATA_TYPE_CMS_SIGNED: return CMSSigned;
- case GPGME_DATA_TYPE_CMS_ENCRYPTED: return CMSEncrypted;
- case GPGME_DATA_TYPE_CMS_OTHER: return CMSOther;
- case GPGME_DATA_TYPE_X509_CERT: return X509Cert;
- case GPGME_DATA_TYPE_PKCS12: return PKCS12;
- case GPGME_DATA_TYPE_PGP_ENCRYPTED: return PGPEncrypted;
- case GPGME_DATA_TYPE_PGP_SIGNATURE: return PGPSignature;
- }
- return Invalid;
-}
-
-char *GpgME::Data::fileName() const
-{
- return gpgme_data_get_file_name(d->data);
-}
-
-GpgME::Error GpgME::Data::setFileName(const char *name)
-{
- return Error(gpgme_data_set_file_name(d->data, name));
-}
-
-GpgME::Error GpgME::Data::setFileName(const std::string &name)
-{
- return Error(gpgme_data_set_file_name(d->data, name.c_str()));
-}
-
-ssize_t GpgME::Data::read(void *buffer, size_t length)
-{
- return gpgme_data_read(d->data, buffer, length);
-}
-
-ssize_t GpgME::Data::write(const void *buffer, size_t length)
-{
- return gpgme_data_write(d->data, buffer, length);
-}
-
-off_t GpgME::Data::seek(off_t offset, int whence)
-{
- return gpgme_data_seek(d->data, offset, whence);
-}
-
-GpgME::Error GpgME::Data::rewind()
-{
- return Error(gpgme_data_rewind(d->data));
-}
-
-std::vector<GpgME::Key> GpgME::Data::toKeys(Protocol proto) const
-{
- std::vector<GpgME::Key> ret;
- if (isNull()) {
- return ret;
- }
- auto ctx = GpgME::Context::createForProtocol(proto);
- if (!ctx) {
- return ret;
- }
-
- if (gpgme_op_keylist_from_data_start (ctx->impl()->ctx, d->data, 0)) {
- return ret;
- }
-
- gpgme_key_t key;
- while (!gpgme_op_keylist_next (ctx->impl()->ctx, &key)) {
- ret.push_back(GpgME::Key(key, false));
- }
- gpgme_data_seek (d->data, 0, SEEK_SET);
-
- delete ctx;
- return ret;
-}
-
-std::string GpgME::Data::toString()
-{
- std::string ret;
- char buf[4096];
- size_t nread;
- seek (0, SEEK_SET);
- while ((nread = read (buf, 4096)) > 0)
- {
- ret += std::string (buf, nread);
- }
- seek (0, SEEK_SET);
- return ret;
-}
-
-GpgME::Error GpgME::Data::setFlag(const char *name, const char *value)
-{
- return Error(gpgme_data_set_flag(d->data, name, value));
-}
-
-GpgME::Error GpgME::Data::setSizeHint(uint64_t size)
-{
- const std::string val = std::to_string(size);
- return Error(gpgme_data_set_flag(d->data, "size-hint", val.c_str()));
-}
diff --git a/lang/cpp/src/data.h b/lang/cpp/src/data.h
deleted file mode 100644
index 178bc309..00000000
--- a/lang/cpp/src/data.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- data.h - wraps a gpgme data object
- Copyright (C) 2003,2004 Klarälvdalens Datakonsult AB
-
- 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_DATA_H__
-#define __GPGMEPP_DATA_H__
-
-#include "global.h"
-#include "key.h"
-
-#include <sys/types.h> // for size_t, off_t
-#include <cstdint> // unit64_t
-#include <cstdio> // FILE
-#include <algorithm>
-#include <memory>
-
-namespace GpgME
-{
-
-class DataProvider;
-class Error;
-
-class GPGMEPP_EXPORT Data
-{
- struct Null {
- Null() {}
- };
-public:
- /* implicit */ Data(const Null &);
- Data();
- explicit Data(gpgme_data_t data);
-
- // Memory-Based Data Buffers:
- Data(const char *buffer, size_t size, bool copy = true);
- explicit Data(const char *filename);
- Data(const char *filename, off_t offset, size_t length);
- Data(std::FILE *fp, off_t offset, size_t length);
- // File-Based Data Buffers:
- explicit Data(std::FILE *fp);
- explicit Data(int fd);
- // Callback-Based Data Buffers:
- explicit Data(DataProvider *provider);
-
- static const Null null;
-
- Data(const Data &other) = default;
- const Data &operator=(Data other)
- {
- swap(other);
- return *this;
- }
-
- void swap(Data &other)
- {
- using std::swap;
- swap(this->d, other.d);
- }
-
- bool isNull() const;
-
- enum Encoding {
- AutoEncoding,
- BinaryEncoding,
- Base64Encoding,
- ArmorEncoding,
- MimeEncoding,
- UrlEncoding,
- UrlEscEncoding,
- Url0Encoding,
- };
- Encoding encoding() const;
- Error setEncoding(Encoding encoding);
-
- enum Type {
- Invalid,
- Unknown,
- PGPSigned,
- PGPOther,
- PGPKey,
- CMSSigned,
- CMSEncrypted,
- CMSOther,
- X509Cert,
- PKCS12,
- PGPEncrypted,
- PGPSignature,
- };
- Type type() const;
-
- char *fileName() const;
- Error setFileName(const char *name);
- Error setFileName(const std::string &name);
-
- ssize_t read(void *buffer, size_t length);
- ssize_t write(const void *buffer, size_t length);
- off_t seek(off_t offset, int whence);
-
- /* Convenience function to do a seek (0, SEEK_SET). */
- Error rewind();
-
- /** Try to parse the data to a key object using the
- * Protocol proto. Returns an empty list on error.*/
- std::vector<Key> toKeys(const Protocol proto = Protocol::OpenPGP) const;
-
- /** Return a copy of the data as std::string. Sets seek pos to 0 */
- std::string toString();
-
- /** See gpgme_data_set_flag */
- Error setFlag(const char *name, const char *value);
-
- /** Set a size hint for this data e.g. for progress calculations. */
- Error setSizeHint(uint64_t size);
-
- class Private;
- Private *impl()
- {
- return d.get();
- }
- const Private *impl() const
- {
- return d.get();
- }
-private:
- std::shared_ptr<Private> d;
-};
-
-}
-
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(Data)
-
-#endif // __GPGMEPP_DATA_H__
diff --git a/lang/cpp/src/data_p.h b/lang/cpp/src/data_p.h
deleted file mode 100644
index b52940c6..00000000
--- a/lang/cpp/src/data_p.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- data_p.h - wraps a gpgme data object, private part -*- c++ -*-
- Copyright (C) 2003,2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_DATA_P_H__
-#define __GPGMEPP_DATA_P_H__
-
-#include <data.h>
-#include "callbacks.h"
-
-class GpgME::Data::Private
-{
-public:
- explicit Private(gpgme_data_t d = nullptr)
- : data(d), cbs(data_provider_callbacks) {}
- ~Private();
-
- gpgme_data_t data;
- gpgme_data_cbs cbs;
-};
-
-#endif // __GPGMEPP_DATA_P_H__
diff --git a/lang/cpp/src/decryptionresult.cpp b/lang/cpp/src/decryptionresult.cpp
deleted file mode 100644
index dd515015..00000000
--- a/lang/cpp/src/decryptionresult.cpp
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- decryptionresult.cpp - wraps a gpgme keygen result
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 <decryptionresult.h>
-#include "result_p.h"
-#include "util.h"
-
-#include <gpgme.h>
-
-#include <algorithm>
-#include <iterator>
-#include <cstring>
-#include <cstdlib>
-#include <istream>
-
-#include <string.h>
-
-class GpgME::DecryptionResult::Private
-{
-public:
- explicit Private(const _gpgme_op_decrypt_result &r) : res(r)
- {
- if (res.unsupported_algorithm) {
- res.unsupported_algorithm = strdup(res.unsupported_algorithm);
- }
- if (res.file_name) {
- res.file_name = strdup(res.file_name);
- }
- if (res.symkey_algo) {
- res.symkey_algo = strdup(res.symkey_algo);
- }
- //FIXME: copying gpgme_recipient_t objects invalidates the keyid member,
- //thus we use _keyid for now (internal API)
- for (gpgme_recipient_t r = res.recipients ; r ; r = r->next) {
- recipients.push_back(*r);
- }
- res.recipients = nullptr;
- }
- ~Private()
- {
- if (res.unsupported_algorithm) {
- std::free(res.unsupported_algorithm);
- }
- res.unsupported_algorithm = nullptr;
- if (res.file_name) {
- std::free(res.file_name);
- }
- res.file_name = nullptr;
- if (res.symkey_algo) {
- std::free(res.symkey_algo);
- }
- res.symkey_algo = nullptr;
- }
-
- _gpgme_op_decrypt_result res;
- std::vector<_gpgme_recipient> recipients;
-};
-
-GpgME::DecryptionResult::DecryptionResult(gpgme_ctx_t ctx, int error)
- : GpgME::Result(error), d()
-{
- init(ctx);
-}
-
-GpgME::DecryptionResult::DecryptionResult(gpgme_ctx_t ctx, const Error &error)
- : GpgME::Result(error), d()
-{
- init(ctx);
-}
-
-void GpgME::DecryptionResult::init(gpgme_ctx_t ctx)
-{
- if (!ctx) {
- return;
- }
- gpgme_decrypt_result_t res = gpgme_op_decrypt_result(ctx);
- if (!res) {
- return;
- }
- d.reset(new Private(*res));
-}
-
-make_standard_stuff(DecryptionResult)
-
-const char *GpgME::DecryptionResult::unsupportedAlgorithm() const
-{
- return d ? d->res.unsupported_algorithm : nullptr ;
-}
-
-bool GpgME::DecryptionResult::isWrongKeyUsage() const
-{
- return d && d->res.wrong_key_usage;
-}
-
-bool GpgME::DecryptionResult::isDeVs() const
-{
- return d && d->res.is_de_vs;
-}
-
-bool GpgME::DecryptionResult::isBetaCompliance() const
-{
- return d && d->res.beta_compliance;
-}
-
-bool GpgME::DecryptionResult::isMime() const
-{
- return d && d->res.is_mime;
-}
-
-const char *GpgME::DecryptionResult::fileName() const
-{
- return d ? d->res.file_name : nullptr ;
-}
-
-unsigned int GpgME::DecryptionResult::numRecipients() const
-{
- return d ? d->recipients.size() : 0 ;
-}
-
-GpgME::DecryptionResult::Recipient GpgME::DecryptionResult::recipient(unsigned int idx) const
-{
- if (d && idx < d->recipients.size()) {
- return Recipient(&d->recipients[idx]);
- }
- return Recipient();
-}
-
-namespace
-{
-struct make_recipient {
- GpgME::DecryptionResult::Recipient operator()(_gpgme_recipient &t)
- {
- return GpgME::DecryptionResult::Recipient(&t);
- }
-};
-}
-
-std::vector<GpgME::DecryptionResult::Recipient> GpgME::DecryptionResult::recipients() const
-{
- std::vector<Recipient> result;
- if (d) {
- result.reserve(d->recipients.size());
- std::transform(d->recipients.begin(), d->recipients.end(),
- std::back_inserter(result),
- make_recipient());
- }
- return result;
-}
-
-const char *GpgME::DecryptionResult::sessionKey() const
-{
- return d ? d->res.session_key : nullptr;
-}
-
-const char *GpgME::DecryptionResult::symkeyAlgo() const
-{
- return d ? d->res.symkey_algo : nullptr;
-}
-
-bool GpgME::DecryptionResult::isLegacyCipherNoMDC() const
-{
- return d && d->res.legacy_cipher_nomdc;
-}
-
-class GpgME::DecryptionResult::Recipient::Private : public _gpgme_recipient
-{
-public:
- Private(gpgme_recipient_t reci) : _gpgme_recipient(*reci) {}
-};
-
-GpgME::DecryptionResult::Recipient::Recipient()
- : d()
-{
-
-}
-
-GpgME::DecryptionResult::Recipient::Recipient(gpgme_recipient_t r)
- : d()
-{
- if (r) {
- d.reset(new Private(r));
- }
-}
-
-bool GpgME::DecryptionResult::Recipient::isNull() const
-{
- return !d;
-}
-
-const char *GpgME::DecryptionResult::Recipient::keyID() const
-{
- //_keyid is internal API, but the public keyid is invalid after copying (see above)
- if (d) {
- return d->_keyid;
- }
- return nullptr;
-}
-
-const char *GpgME::DecryptionResult::Recipient::shortKeyID() const
-{
- //_keyid is internal API, but the public keyid is invalid after copying (see above)
- if (d) {
- return d->_keyid + 8;
- }
- return nullptr;
-}
-
-unsigned int GpgME::DecryptionResult::Recipient::publicKeyAlgorithm() const
-{
- if (d) {
- return d->pubkey_algo;
- }
- return 0;
-}
-
-const char *GpgME::DecryptionResult::Recipient::publicKeyAlgorithmAsString() const
-{
- if (d) {
- return gpgme_pubkey_algo_name(d->pubkey_algo);
- }
- return nullptr;
-}
-
-GpgME::Error GpgME::DecryptionResult::Recipient::status() const
-{
- if (d) {
- return Error(d->status);
- }
- return Error();
-}
-
-std::ostream &GpgME::operator<<(std::ostream &os, const DecryptionResult &result)
-{
- os << "GpgME::DecryptionResult(";
- if (!result.isNull()) {
- os << "\n error: " << result.error()
- << "\n fileName: " << protect(result.fileName())
- << "\n unsupportedAlgorithm: " << protect(result.unsupportedAlgorithm())
- << "\n isWrongKeyUsage: " << result.isWrongKeyUsage()
- << "\n isDeVs: " << result.isDeVs()
- << "\n isBetaCompliance: " << result.isBetaCompliance()
- << "\n legacyCipherNoMDC: " << result.isLegacyCipherNoMDC()
- << "\n symkeyAlgo: " << protect(result.symkeyAlgo())
- << "\n recipients:\n";
- const std::vector<DecryptionResult::Recipient> recipients = result.recipients();
- std::copy(recipients.begin(), recipients.end(),
- std::ostream_iterator<DecryptionResult::Recipient>(os, "\n"));
- }
- return os << ')';
-}
-
-std::ostream &GpgME::operator<<(std::ostream &os, const DecryptionResult::Recipient &reci)
-{
- os << "GpgME::DecryptionResult::Recipient(";
- if (!reci.isNull()) {
- os << "\n keyID: " << protect(reci.keyID())
- << "\n shortKeyID: " << protect(reci.shortKeyID())
- << "\n publicKeyAlgorithm: " << protect(reci.publicKeyAlgorithmAsString())
- << "\n status: " << reci.status();
- }
- return os << ')';
-}
diff --git a/lang/cpp/src/decryptionresult.h b/lang/cpp/src/decryptionresult.h
deleted file mode 100644
index 3a87e181..00000000
--- a/lang/cpp/src/decryptionresult.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- decryptionresult.h - wraps a gpgme keygen result
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_DECRYPTIONRESULT_H__
-#define __GPGMEPP_DECRYPTIONRESULT_H__
-
-#include "gpgmefw.h"
-#include "result.h"
-#include "gpgmepp_export.h"
-
-#include <vector>
-#include <algorithm>
-#include <iosfwd>
-#include <memory>
-
-namespace GpgME
-{
-
-class Error;
-
-class GPGMEPP_EXPORT DecryptionResult : public Result
-{
-public:
- DecryptionResult();
- DecryptionResult(gpgme_ctx_t ctx, int error);
- DecryptionResult(gpgme_ctx_t ctx, const Error &err);
- explicit DecryptionResult(const Error &err);
-
- DecryptionResult(const DecryptionResult &other) = default;
- const DecryptionResult &operator=(DecryptionResult other)
- {
- swap(other);
- return *this;
- }
-
- void swap(DecryptionResult &other)
- {
- Result::swap(other);
- using std::swap;
- swap(this->d, other.d);
- }
-
- bool isNull() const;
-
- GPGMEPP_DEPRECATED const char *unsupportedAlgortihm() const
- {
- return unsupportedAlgorithm();
- }
- const char *unsupportedAlgorithm() const;
-
- GPGMEPP_DEPRECATED bool wrongKeyUsage() const
- {
- return isWrongKeyUsage();
- }
- bool isWrongKeyUsage() const;
- bool isDeVs() const;
- bool isBetaCompliance() const;
- bool isMime() const;
-
- const char *fileName() const;
-
- const char *sessionKey() const;
-
- const char *symkeyAlgo() const;
-
- class Recipient;
-
- unsigned int numRecipients() const;
- Recipient recipient(unsigned int idx) const;
- std::vector<Recipient> recipients() const;
-
- bool isLegacyCipherNoMDC() const;
-
-private:
- class Private;
- void init(gpgme_ctx_t ctx);
- std::shared_ptr<Private> d;
-};
-
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const DecryptionResult &result);
-
-class GPGMEPP_EXPORT DecryptionResult::Recipient
-{
-public:
- Recipient();
- explicit Recipient(gpgme_recipient_t reci);
-
- Recipient(const Recipient &other) = default;
- const Recipient &operator=(Recipient other)
- {
- swap(other);
- return *this;
- }
-
- void swap(Recipient &other)
- {
- using std::swap;
- swap(this->d, other.d);
- }
-
- bool isNull() const;
-
- const char *keyID() const;
- const char *shortKeyID() const;
-
- unsigned int publicKeyAlgorithm() const;
- const char *publicKeyAlgorithmAsString() const;
-
- Error status() const;
-
-private:
- class Private;
- std::shared_ptr<Private> d;
-};
-
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const DecryptionResult::Recipient &reci);
-
-}
-
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(DecryptionResult)
-
-#endif // __GPGMEPP_DECRYPTIONRESULT_H__
diff --git a/lang/cpp/src/defaultassuantransaction.cpp b/lang/cpp/src/defaultassuantransaction.cpp
deleted file mode 100644
index 7a52c153..00000000
--- a/lang/cpp/src/defaultassuantransaction.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- defaultassuantransaction.cpp - default Assuan Transaction that just stores data and status lines
- Copyright (C) 2009 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "defaultassuantransaction.h"
-#include "error.h"
-#include "data.h"
-
-using namespace GpgME;
-
-DefaultAssuanTransaction::DefaultAssuanTransaction()
- : AssuanTransaction(),
- m_status(),
- m_data()
-{
-
-}
-
-DefaultAssuanTransaction::~DefaultAssuanTransaction() {}
-
-Error DefaultAssuanTransaction::data(const char *data, size_t len)
-{
- m_data.append(data, len);
- return Error();
-}
-
-Data DefaultAssuanTransaction::inquire(const char *name, const char *args, Error &err)
-{
- (void)name; (void)args; (void)err;
- return Data::null;
-}
-
-Error DefaultAssuanTransaction::status(const char *status, const char *args)
-{
- m_status.push_back(std::pair<std::string, std::string>(status, args));
- return Error();
-}
-
-std::vector<std::string> DefaultAssuanTransaction::statusLine(const char *tag) const
-{
- std::vector<std::string> result;
- for (std::vector< std::pair<std::string, std::string> >::const_iterator it = m_status.begin(), end = m_status.end() ; it != end ; ++it) {
- if (it->first == tag) {
- result.push_back(it->second);
- }
- }
- return result;
-}
-
-std::string DefaultAssuanTransaction::firstStatusLine(const char *tag) const
-{
- for (std::vector< std::pair<std::string, std::string> >::const_iterator it = m_status.begin(), end = m_status.end() ; it != end ; ++it) {
- if (it->first == tag) {
- return it->second;
- }
- }
- return std::string();
-}
diff --git a/lang/cpp/src/defaultassuantransaction.h b/lang/cpp/src/defaultassuantransaction.h
deleted file mode 100644
index a7cac3c1..00000000
--- a/lang/cpp/src/defaultassuantransaction.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- defaultassuantransaction.h - default Assuan Transaction that just stores data and status lines
- Copyright (C) 2009 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_DEFAULTASSUANTRANSACTION_H__
-#define __GPGMEPP_DEFAULTASSUANTRANSACTION_H__
-
-#include "interfaces/assuantransaction.h"
-
-#include <string>
-#include <vector>
-#include <utility>
-
-namespace GpgME
-{
-
-class GPGMEPP_EXPORT DefaultAssuanTransaction : public AssuanTransaction
-{
-public:
- explicit DefaultAssuanTransaction();
- ~DefaultAssuanTransaction();
-
- const std::vector< std::pair<std::string, std::string> > &statusLines() const
- {
- return m_status;
- }
- std::vector<std::string> statusLine(const char *tag) const;
- std::string firstStatusLine(const char *tag) const;
-
- const std::string &data() const
- {
- return m_data;
- }
-
-private:
- Error data(const char *data, size_t datalen) override;
- Data inquire(const char *name, const char *args, Error &err) override;
- Error status(const char *status, const char *args) override;
-
-private:
- std::vector< std::pair<std::string, std::string> > m_status;
- std::string m_data;
-};
-
-} // namespace GpgME
-
-#endif // __GPGMEPP_DEFAULTASSUANTRANSACTION_H__
diff --git a/lang/cpp/src/editinteractor.cpp b/lang/cpp/src/editinteractor.cpp
deleted file mode 100644
index 5f9236cb..00000000
--- a/lang/cpp/src/editinteractor.cpp
+++ /dev/null
@@ -1,436 +0,0 @@
-/*
- editinteractor.cpp - Interface for edit interactors
- Copyright (C) 2007 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "editinteractor.h"
-#include "callbacks.h"
-#include "error.h"
-#include "util.h"
-
-#include <gpgme.h>
-
-#ifdef _WIN32
-# include <io.h>
-#include <windows.h>
-#else
-# include <unistd.h>
-#endif
-
-#include <cerrno>
-#include <cstring>
-#include <cstdlib>
-
-#ifndef GPG_ERR_ALREADY_SIGNED
-# define GPG_ERR_ALREADY_SIGNED GPG_ERR_USER_1
-#endif
-
-using namespace GpgME;
-
-static const char *status_to_string(unsigned int status);
-static Error status_to_error(unsigned int status);
-static Error parse_sc_op_failure(const char *args);
-
-class EditInteractor::Private
-{
- friend class ::GpgME::EditInteractor;
- friend class ::GpgME::CallbackHelper;
- EditInteractor *const q;
-public:
- explicit Private(EditInteractor *qq);
- ~Private();
-
-private:
- unsigned int state = StartState;
- Error error;
- std::FILE *debug = nullptr;
- bool debugNeedsClosing = false;
-};
-
-class GpgME::CallbackHelper
-{
-private:
- static int writeAll(int fd, const void *buf, size_t count)
- {
- size_t toWrite = count;
- while (toWrite > 0) {
- const int n = gpgme_io_write(fd, buf, toWrite);
- if (n < 0) {
- return n;
- }
- toWrite -= n;
- }
- return count;
- }
-
-public:
- static int edit_interactor_callback_impl(void *opaque, gpgme_status_code_t status, const char *args, int fd)
- {
- EditInteractor::Private *ei = (EditInteractor::Private *)opaque;
-
- Error err = status_to_error(status);
-
- if (!err) {
-
- // advance to next state based on input:
- const unsigned int oldState = ei->state;
-
- if (ei->q->needsNoResponse(status)) {
- // keep state
- } else if (status == GPGME_STATUS_ERROR) {
- err = ei->q->parseStatusError(args);
- ei->state = EditInteractor::ErrorState;
- } else if (status == GPGME_STATUS_SC_OP_FAILURE) {
- err = parse_sc_op_failure(args);
- ei->state = EditInteractor::ErrorState;
- } else {
- ei->state = ei->q->nextState(status, args, err);
- }
-
- if (ei->debug) {
- std::fprintf(ei->debug, "EditInteractor: %u -> nextState( %s, %s ) -> %u\n",
- oldState, status_to_string(status), args ? args : "<null>", ei->state);
- }
- if (err || err.isCanceled()) {
- ei->state = oldState;
- goto error;
- }
-
- if (ei->state != oldState &&
- // if there was an error from before, we stop here (### this looks weird, can this happen at all?)
- ei->error.code() == GPG_ERR_NO_ERROR) {
-
- // successful state change -> call action
- if (const char *const result = ei->q->action(err)) {
- if (err) {
- goto error;
- }
- if (ei->debug) {
- std::fprintf(ei->debug, "EditInteractor: action result \"%s\"\n", result);
- }
- // if there's a result, write it:
- if (*result) {
- gpgme_err_set_errno(0);
- const ssize_t len = std::strlen(result);
- if (writeAll(fd, result, len) != len) {
- err = Error::fromSystemError();
- if (ei->debug) {
- std::fprintf(ei->debug, "EditInteractor: Could not write to fd %d (%s)\n", fd, err.asStdString().c_str());
- }
- goto error;
- }
- }
- gpgme_err_set_errno(0);
- if (writeAll(fd, "\n", 1) != 1) {
- err = Error::fromSystemError();
- if (ei->debug) {
- std::fprintf(ei->debug, "EditInteractor: Could not write to fd %d (%s)\n", fd, err.asStdString().c_str());
- }
- goto error;
- }
- } else {
- if (err) {
- goto error;
- }
- if (ei->debug) {
- std::fprintf(ei->debug, "EditInteractor: no action result\n");
- }
- }
- } else {
- if (ei->debug) {
- std::fprintf(ei->debug, "EditInteractor: no action executed\n");
- }
- }
- }
-
- error:
- if (err.code() == GPG_ERR_GENERAL) {
- // gpg may have asked an unknown question; try to use the default answer
- if (ei->debug) {
- std::fprintf(ei->debug, "EditInteractor: action result \"%s\" (go with the default answer)\n", "");
- }
- if (writeAll(fd, "\n", 1) != 1) {
- err = Error::fromSystemError();
- if (ei->debug) {
- std::fprintf(ei->debug, "EditInteractor: Could not write to fd %d (%s)\n", fd, err.asStdString().c_str());
- }
- } else {
- err = Error();
- }
- }
- if (err || err.isCanceled()) {
- ei->error = err;
- ei->state = EditInteractor::ErrorState;
- }
-
- if (ei->debug) {
- std::fprintf(ei->debug, "EditInteractor: error now %u (%s)\n",
- ei->error.encodedError(), gpgme_strerror(ei->error.encodedError()));
- }
-
- return ei->error.encodedError();
- }
-};
-
-static gpgme_error_t edit_interactor_callback(void *opaque, gpgme_status_code_t status, const char *args, int fd)
-{
- return CallbackHelper::edit_interactor_callback_impl(opaque, status, args, fd);
-}
-
-const gpgme_edit_cb_t GpgME::edit_interactor_callback = ::edit_interactor_callback;
-
-EditInteractor::Private::Private(EditInteractor *qq)
- : q(qq)
-{
- const char *debug_env = std::getenv("GPGMEPP_INTERACTOR_DEBUG");
- if (!debug_env) {
- return;
- }
- if (!strcmp(debug_env, "stdout")) {
- debug = stdout;
- } else if (!strcmp(debug_env, "stderr")) {
- debug = stderr;
- } else if (debug_env) {
- debug = std::fopen(debug_env, "a+");
- debugNeedsClosing = true;
- }
-}
-
-EditInteractor::Private::~Private()
-{
- if (debug && debugNeedsClosing) {
- std::fclose(debug);
- }
-}
-
-EditInteractor::EditInteractor()
- : d(new Private(this))
-{
-
-}
-
-EditInteractor::~EditInteractor()
-{
- delete d;
-}
-
-unsigned int EditInteractor::state() const
-{
- return d->state;
-}
-
-Error EditInteractor::lastError() const
-{
- return d->error;
-}
-
-bool EditInteractor::needsNoResponse(unsigned int status) const
-{
- switch (status) {
- case GPGME_STATUS_ALREADY_SIGNED:
- case GPGME_STATUS_ERROR:
- case GPGME_STATUS_GET_BOOL:
- case GPGME_STATUS_GET_LINE:
- case GPGME_STATUS_KEY_CREATED:
- case GPGME_STATUS_NEED_PASSPHRASE_SYM:
- case GPGME_STATUS_SC_OP_FAILURE:
- case GPGME_STATUS_CARDCTRL:
- case GPGME_STATUS_BACKUP_KEY_CREATED:
- return false;
- default:
- return true;
- }
-}
-
-// static
-Error status_to_error(unsigned int status)
-{
- switch (status) {
- case GPGME_STATUS_MISSING_PASSPHRASE:
- return Error::fromCode(GPG_ERR_NO_PASSPHRASE);
- case GPGME_STATUS_ALREADY_SIGNED:
- return Error::fromCode(GPG_ERR_ALREADY_SIGNED);
- case GPGME_STATUS_SIGEXPIRED:
- return Error::fromCode(GPG_ERR_SIG_EXPIRED);
- }
- return Error();
-}
-
-void EditInteractor::setDebugChannel(std::FILE *debug)
-{
- d->debug = debug;
-}
-
-GpgME::Error EditInteractor::parseStatusError(const char *args)
-{
- Error err;
-
- const auto fields = split(args, ' ');
- if (fields.size() >= 2) {
- err = Error{static_cast<unsigned int>(std::stoul(fields[1]))};
- } else {
- err = Error::fromCode(GPG_ERR_GENERAL);
- }
-
- return err;
-}
-
-static Error sc_op_failure_to_error(unsigned int status)
-{
- switch (status) {
- case 1:
- // GPG_ERR_CANCELED or GPG_ERR_FULLY_CANCELED
- return Error::fromCode(GPG_ERR_CANCELED);
- case 2:
- // GPG_ERR_BAD_PIN or GPG_ERR_BAD_RESET_CODE [sic]
- return Error::fromCode(GPG_ERR_BAD_PIN);
- case 3:
- return Error::fromCode(GPG_ERR_PIN_BLOCKED);
- case 4:
- return Error::fromCode(GPG_ERR_NO_RESET_CODE);
- }
- return Error::fromCode(GPG_ERR_CARD);
-}
-
-// static
-Error parse_sc_op_failure(const char *args)
-{
- Error err;
-
- const auto fields = split(args, ' ');
- if (fields.size() >= 1) {
- err = sc_op_failure_to_error(static_cast<unsigned int>(std::stoul(fields[0])));
- } else {
- err = Error::fromCode(GPG_ERR_CARD);
- }
-
- return err;
-}
-
-static const char *const status_strings[] = {
- "EOF",
- /* mkstatus processing starts here */
- "ENTER",
- "LEAVE",
- "ABORT",
-
- "GOODSIG",
- "BADSIG",
- "ERRSIG",
-
- "BADARMOR",
-
- "RSA_OR_IDEA",
- "KEYEXPIRED",
- "KEYREVOKED",
-
- "TRUST_UNDEFINED",
- "TRUST_NEVER",
- "TRUST_MARGINAL",
- "TRUST_FULLY",
- "TRUST_ULTIMATE",
-
- "SHM_INFO",
- "SHM_GET",
- "SHM_GET_BOOL",
- "SHM_GET_HIDDEN",
-
- "NEED_PASSPHRASE",
- "VALIDSIG",
- "SIG_ID",
- "ENC_TO",
- "NODATA",
- "BAD_PASSPHRASE",
- "NO_PUBKEY",
- "NO_SECKEY",
- "NEED_PASSPHRASE_SYM",
- "DECRYPTION_FAILED",
- "DECRYPTION_OKAY",
- "MISSING_PASSPHRASE",
- "GOOD_PASSPHRASE",
- "GOODMDC",
- "BADMDC",
- "ERRMDC",
- "IMPORTED",
- "IMPORT_OK",
- "IMPORT_PROBLEM",
- "IMPORT_RES",
- "FILE_START",
- "FILE_DONE",
- "FILE_ERROR",
-
- "BEGIN_DECRYPTION",
- "END_DECRYPTION",
- "BEGIN_ENCRYPTION",
- "END_ENCRYPTION",
-
- "DELETE_PROBLEM",
- "GET_BOOL",
- "GET_LINE",
- "GET_HIDDEN",
- "GOT_IT",
- "PROGRESS",
- "SIG_CREATED",
- "SESSION_KEY",
- "NOTATION_NAME",
- "NOTATION_DATA",
- "POLICY_URL",
- "BEGIN_STREAM",
- "END_STREAM",
- "KEY_CREATED",
- "USERID_HINT",
- "UNEXPECTED",
- "INV_RECP",
- "NO_RECP",
- "ALREADY_SIGNED",
- "SIGEXPIRED",
- "EXPSIG",
- "EXPKEYSIG",
- "TRUNCATED",
- "ERROR",
- "NEWSIG",
- "REVKEYSIG",
- "SIG_SUBPACKET",
- "NEED_PASSPHRASE_PIN",
- "SC_OP_FAILURE",
- "SC_OP_SUCCESS",
- "CARDCTRL",
- "BACKUP_KEY_CREATED",
- "PKA_TRUST_BAD",
- "PKA_TRUST_GOOD",
-
- "PLAINTEXT",
-};
-static const unsigned int num_status_strings = sizeof status_strings / sizeof * status_strings ;
-
-const char *status_to_string(unsigned int idx)
-{
- if (idx < num_status_strings) {
- return status_strings[idx];
- } else {
- return "(unknown)";
- }
-}
diff --git a/lang/cpp/src/editinteractor.h b/lang/cpp/src/editinteractor.h
deleted file mode 100644
index 2505b028..00000000
--- a/lang/cpp/src/editinteractor.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- editinteractor.h - Interface for edit interactors
- Copyright (C) 2007 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_EDITINTERACTOR_H__
-#define __GPGMEPP_EDITINTERACTOR_H__
-
-#include "gpgmepp_export.h"
-
-#include <cstdio>
-
-namespace GpgME
-{
-
-class Error;
-class Context;
-class CallbackHelper;
-
-class GPGMEPP_EXPORT EditInteractor
-{
- friend class ::GpgME::Context;
- friend class ::GpgME::CallbackHelper;
- EditInteractor(const EditInteractor &);
- EditInteractor &operator=(const EditInteractor &);
-public:
- EditInteractor();
- virtual ~EditInteractor();
-
- enum {
- StartState = 0,
- ErrorState = 0xFFFFFFFF
- };
-
- virtual const char *action(Error &err) const = 0;
- virtual unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const = 0;
-
- unsigned int state() const;
- Error lastError() const;
- bool needsNoResponse(unsigned int statusCode) const;
-
- void setDebugChannel(std::FILE *file);
-
-protected:
- Error parseStatusError(const char *args);
-
-private:
- class Private;
- Private *const d;
-};
-
-} // namespace GpgME
-
-#endif // __GPGMEPP_EDITINTERACTOR_H__
diff --git a/lang/cpp/src/encryptionresult.cpp b/lang/cpp/src/encryptionresult.cpp
deleted file mode 100644
index 95dcb22e..00000000
--- a/lang/cpp/src/encryptionresult.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- encryptionresult.cpp - wraps a gpgme verify result
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 <encryptionresult.h>
-#include "result_p.h"
-#include "util.h"
-
-#include <gpgme.h>
-
-#include <cstring>
-#include <cstdlib>
-#include <istream>
-#include <algorithm>
-#include <iterator>
-
-#include <string.h>
-
-class GpgME::EncryptionResult::Private
-{
-public:
- explicit Private(const gpgme_encrypt_result_t r)
- {
- if (!r) {
- return;
- }
- for (gpgme_invalid_key_t ik = r->invalid_recipients ; ik ; ik = ik->next) {
- gpgme_invalid_key_t copy = new _gpgme_invalid_key(*ik);
- if (ik->fpr) {
- copy->fpr = strdup(ik->fpr);
- }
- copy->next = nullptr;
- invalid.push_back(copy);
- }
- }
- ~Private()
- {
- for (std::vector<gpgme_invalid_key_t>::iterator it = invalid.begin() ; it != invalid.end() ; ++it) {
- std::free((*it)->fpr);
- delete *it; *it = nullptr;
- }
- }
-
- std::vector<gpgme_invalid_key_t> invalid;
-};
-
-GpgME::EncryptionResult::EncryptionResult(gpgme_ctx_t ctx, int error)
- : GpgME::Result(error), d()
-{
- init(ctx);
-}
-
-GpgME::EncryptionResult::EncryptionResult(gpgme_ctx_t ctx, const Error &error)
- : GpgME::Result(error), d()
-{
- init(ctx);
-}
-
-void GpgME::EncryptionResult::init(gpgme_ctx_t ctx)
-{
- if (!ctx) {
- return;
- }
- gpgme_encrypt_result_t res = gpgme_op_encrypt_result(ctx);
- if (!res) {
- return;
- }
- d.reset(new Private(res));
-}
-
-make_standard_stuff(EncryptionResult)
-
-unsigned int GpgME::EncryptionResult::numInvalidRecipients() const
-{
- return d ? d->invalid.size() : 0 ;
-}
-
-GpgME::InvalidRecipient GpgME::EncryptionResult::invalidEncryptionKey(unsigned int idx) const
-{
- return InvalidRecipient(d, idx);
-}
-
-std::vector<GpgME::InvalidRecipient> GpgME::EncryptionResult::invalidEncryptionKeys() const
-{
- if (!d) {
- return std::vector<GpgME::InvalidRecipient>();
- }
- std::vector<GpgME::InvalidRecipient> result;
- result.reserve(d->invalid.size());
- for (unsigned int i = 0 ; i < d->invalid.size() ; ++i) {
- result.push_back(InvalidRecipient(d, i));
- }
- return result;
-}
-
-GpgME::InvalidRecipient::InvalidRecipient(const std::shared_ptr<EncryptionResult::Private> &parent, unsigned int i)
- : d(parent), idx(i)
-{
-
-}
-
-GpgME::InvalidRecipient::InvalidRecipient() : d(), idx(0) {}
-
-bool GpgME::InvalidRecipient::isNull() const
-{
- return !d || idx >= d->invalid.size() ;
-}
-
-const char *GpgME::InvalidRecipient::fingerprint() const
-{
- return isNull() ? nullptr : d->invalid[idx]->fpr ;
-}
-
-GpgME::Error GpgME::InvalidRecipient::reason() const
-{
- return Error(isNull() ? 0 : d->invalid[idx]->reason);
-}
-
-std::ostream &GpgME::operator<<(std::ostream &os, const EncryptionResult &result)
-{
- os << "GpgME::EncryptionResult(";
- if (!result.isNull()) {
- os << "\n error: " << result.error()
- << "\n invalid recipients:\n";
- const std::vector<InvalidRecipient> ir = result.invalidEncryptionKeys();
- std::copy(ir.begin(), ir.end(),
- std::ostream_iterator<InvalidRecipient>(os, "\n"));
- }
- return os << ')';
-}
-
-std::ostream &GpgME::operator<<(std::ostream &os, const InvalidRecipient &ir)
-{
- os << "GpgME::InvalidRecipient(";
- if (!ir.isNull()) {
- os << "\n fingerprint: " << protect(ir.fingerprint())
- << "\n reason: " << ir.reason()
- << '\n';
- }
- return os << ')';
-}
diff --git a/lang/cpp/src/encryptionresult.h b/lang/cpp/src/encryptionresult.h
deleted file mode 100644
index 1aea6bb8..00000000
--- a/lang/cpp/src/encryptionresult.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- encryptionresult.h - wraps a gpgme sign result
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_ENCRYPTIONRESULT_H__
-#define __GPGMEPP_ENCRYPTIONRESULT_H__
-
-#include "gpgmefw.h"
-#include "result.h"
-#include "gpgmepp_export.h"
-
-#include <memory>
-
-#include <vector>
-#include <iosfwd>
-
-namespace GpgME
-{
-
-class Error;
-class InvalidRecipient;
-
-class GPGMEPP_EXPORT EncryptionResult : public Result
-{
-public:
- EncryptionResult();
- EncryptionResult(gpgme_ctx_t ctx, int error);
- EncryptionResult(gpgme_ctx_t ctx, const Error &error);
- EncryptionResult(const Error &err);
-
- EncryptionResult(const EncryptionResult &other) = default;
- const EncryptionResult &operator=(EncryptionResult other)
- {
- swap(other);
- return *this;
- }
-
- void swap(EncryptionResult &other)
- {
- Result::swap(other);
- using std::swap;
- swap(this->d, other.d);
- }
-
- bool isNull() const;
-
- unsigned int numInvalidRecipients() const;
-
- InvalidRecipient invalidEncryptionKey(unsigned int index) const;
- std::vector<InvalidRecipient> invalidEncryptionKeys() const;
-
- class Private;
-private:
- void init(gpgme_ctx_t ctx);
- std::shared_ptr<Private> d;
-};
-
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const EncryptionResult &result);
-
-class GPGMEPP_EXPORT InvalidRecipient
-{
- friend class ::GpgME::EncryptionResult;
- InvalidRecipient(const std::shared_ptr<EncryptionResult::Private> &parent, unsigned int index);
-public:
- InvalidRecipient();
-
- InvalidRecipient(const InvalidRecipient &other) = default;
- const InvalidRecipient &operator=(InvalidRecipient other)
- {
- swap(other);
- return *this;
- }
-
- void swap(InvalidRecipient &other)
- {
- using std::swap;
- swap(this->d, other.d);
- }
-
- bool isNull() const;
-
- const char *fingerprint() const;
- Error reason() const;
-
-private:
- std::shared_ptr<EncryptionResult::Private> d;
- unsigned int idx;
-};
-
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const InvalidRecipient &recipient);
-
-}
-
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(EncryptionResult)
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(InvalidRecipient)
-
-#endif // __GPGMEPP_ENCRYPTIONRESULT_H__
diff --git a/lang/cpp/src/engineinfo.cpp b/lang/cpp/src/engineinfo.cpp
deleted file mode 100644
index c4ad5300..00000000
--- a/lang/cpp/src/engineinfo.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- engineinfo.h
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "engineinfo.h"
-
-#include <gpgme.h>
-
-class GpgME::EngineInfo::Private
-{
-public:
- Private(gpgme_engine_info_t engine = nullptr) : info(engine) {}
- ~Private()
- {
- info = nullptr;
- }
-
- gpgme_engine_info_t info;
-};
-
-GpgME::EngineInfo::EngineInfo() : d() {}
-
-GpgME::EngineInfo::EngineInfo(gpgme_engine_info_t engine)
- : d(new Private(engine))
-{
-
-}
-
-bool GpgME::EngineInfo::isNull() const
-{
- return !d || !d->info;
-}
-
-GpgME::Protocol GpgME::EngineInfo::protocol() const
-{
- if (isNull()) {
- return UnknownProtocol;
- }
- switch (d->info->protocol) {
- case GPGME_PROTOCOL_OpenPGP: return OpenPGP;
- case GPGME_PROTOCOL_CMS: return CMS;
- default:
- return UnknownProtocol;
- }
-}
-
-const char *GpgME::EngineInfo::fileName() const
-{
- return isNull() ? nullptr : d->info->file_name;
-}
-
-const char *GpgME::EngineInfo::version() const
-{
- return isNull() ? nullptr : d->info->version;
-}
-
-GpgME::EngineInfo::Version GpgME::EngineInfo::engineVersion() const
-{
- return Version(version());
-}
-
-const char *GpgME::EngineInfo::requiredVersion() const
-{
- return isNull() ? nullptr : d->info->req_version;
-}
-
-const char *GpgME::EngineInfo::homeDirectory() const
-{
- return isNull() ? nullptr : d->info->home_dir;
-}
diff --git a/lang/cpp/src/engineinfo.h b/lang/cpp/src/engineinfo.h
deleted file mode 100644
index 5dc5370c..00000000
--- a/lang/cpp/src/engineinfo.h
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- engineinfo.h
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_ENGINEINFO_H__
-#define __GPGMEPP_ENGINEINFO_H__
-
-#include "global.h"
-
-#include <memory>
-
-#include <algorithm>
-#include <string>
-#include <iostream>
-
-namespace GpgME
-{
-
-class GPGMEPP_EXPORT EngineInfo
-{
-public:
- struct Version
- {
- int major, minor, patch;
- Version()
- {
- major = 0;
- minor = 0;
- patch = 0;
- }
-
- Version(const std::string& version)
- {
- if (version.empty() ||
- std::sscanf(version.c_str(), "%d.%d.%d", &major, &minor, &patch) != 3) {
- major = 0;
- minor = 0;
- patch = 0;
- }
- }
-
- 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) const
- {
- if (major > other.major ||
- (major == other.major && minor > other.minor) ||
- (major == other.major && minor == other.minor && patch > other.patch) ||
- (major >= other.major && minor >= other.minor && patch >= other.patch)) {
- return false;
- }
- return true;
- }
-
- bool operator < (const char* other) const
- {
- return operator<(Version(other));
- }
-
- bool operator <= (const Version &other) const
- {
- return !operator>(other);
- }
-
- bool operator <= (const char *other) const
- {
- return operator<=(Version(other));
- }
-
- bool operator > (const char* other) const
- {
- return operator>(Version(other));
- }
-
- bool operator > (const Version & other) const
- {
- return !operator<(other) && !operator==(other);
- }
-
- bool operator >= (const Version &other) const
- {
- return !operator<(other);
- }
-
- bool operator >= (const char *other) const
- {
- return operator>=(Version(other));
- }
-
- bool operator == (const Version& other) const
- {
- return major == other.major
- && minor == other.minor
- && patch == other.patch;
- }
-
- bool operator == (const char* other) const
- {
- return operator==(Version(other));
- }
-
- bool operator != (const Version &other) const
- {
- return !operator==(other);
- }
-
- bool operator != (const char *other) const
- {
- return operator!=(Version(other));
- }
-
- // the non-const overloads of the comparison operators are kept for
- // binary compatibility
- bool operator < (const Version& other)
- {
- if (major > other.major ||
- (major == other.major && minor > other.minor) ||
- (major == other.major && minor == other.minor && patch > other.patch) ||
- (major >= other.major && minor >= other.minor && patch >= other.patch)) {
- return false;
- }
- return true;
- }
-
- bool operator < (const char* other)
- {
- return operator<(Version(other));
- }
-
- bool operator <= (const Version &other)
- {
- return !operator>(other);
- }
-
- bool operator <= (const char *other)
- {
- return operator<=(Version(other));
- }
-
- bool operator > (const char* other)
- {
- return operator>(Version(other));
- }
-
- bool operator > (const Version & other)
- {
- return !operator<(other) && !operator==(other);
- }
-
- bool operator >= (const Version &other)
- {
- return !operator<(other);
- }
-
- bool operator >= (const char *other)
- {
- return operator>=(Version(other));
- }
-
- bool operator == (const Version& other)
- {
- return major == other.major
- && minor == other.minor
- && patch == other.patch;
- }
-
- bool operator == (const char* other)
- {
- return operator==(Version(other));
- }
-
- bool operator != (const Version &other)
- {
- return !operator==(other);
- }
-
- bool operator != (const char *other)
- {
- return operator!=(Version(other));
- }
-
- friend std::ostream& operator << (std::ostream& stream, const Version& ver)
- {
- stream << ver.major;
- stream << '.';
- stream << ver.minor;
- stream << '.';
- stream << ver.patch;
- return stream;
- }
- };
-
- EngineInfo();
- explicit EngineInfo(gpgme_engine_info_t engine);
-
- EngineInfo(const EngineInfo &other) = default;
- const EngineInfo &operator=(EngineInfo other)
- {
- swap(other);
- return *this;
- }
-
- void swap(EngineInfo &other)
- {
- using std::swap;
- swap(this->d, other.d);
- }
-
- bool isNull() const;
-
- Protocol protocol() const;
- const char *fileName() const;
- const char *version() const;
- Version engineVersion() const;
- const char *requiredVersion() const;
- const char *homeDirectory() const;
-
-private:
- class Private;
- std::shared_ptr<Private> d;
-};
-
-}
-
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(EngineInfo)
-
-#endif // __GPGMEPP_ENGINEINFO_H__
diff --git a/lang/cpp/src/error.h b/lang/cpp/src/error.h
deleted file mode 100644
index 000b562b..00000000
--- a/lang/cpp/src/error.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- error.h - wraps a gpgme error
- Copyright (C) 2003, 2007 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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.
-*/
-
-// -*- c++ -*-
-#ifndef __GPGMEPP_ERROR_H__
-#define __GPGMEPP_ERROR_H__
-
-#include "global.h"
-
-#include <string>
-#include <iosfwd>
-
-#include <gpg-error.h>
-
-#ifndef GPGMEPP_ERR_SOURCE_DEFAULT
-# define GPGMEPP_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_USER_1
-#endif
-
-namespace GpgME
-{
-
-class GPGMEPP_EXPORT Error
-{
-public:
- Error() : mErr(0), mMessage() {}
- explicit Error(unsigned int e) : mErr(e), mMessage() {}
-
- const char *source() const;
- /* This function is deprecated. Use asStdString() instead. asString() may
- * return wrongly encoded (i.e. not UTF-8) results on Windows for the main
- * thread if the function was first called from a secondary thread. */
- GPGMEPP_DEPRECATED const char *asString() const;
- std::string asStdString() const;
-
- int code() const;
- int sourceID() const;
-
- bool isCanceled() const;
-
- unsigned int encodedError() const
- {
- return mErr;
- }
- int toErrno() const;
-
- static bool hasSystemError();
- static Error fromSystemError(unsigned int src = GPGMEPP_ERR_SOURCE_DEFAULT);
- static void setSystemError(gpg_err_code_t err);
- static void setErrno(int err);
- static Error fromErrno(int err, unsigned int src = GPGMEPP_ERR_SOURCE_DEFAULT);
- static Error fromCode(unsigned int err, unsigned int src = GPGMEPP_ERR_SOURCE_DEFAULT);
-
- GPGMEPP_MAKE_SAFE_BOOL_OPERATOR(mErr &&!isCanceled())
-private:
- unsigned int mErr;
- mutable std::string mMessage;
-};
-
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const Error &err);
-
-} // namespace GpgME
-
-#endif /* __GPGMEPP_ERROR_H__ */
diff --git a/lang/cpp/src/eventloopinteractor.cpp b/lang/cpp/src/eventloopinteractor.cpp
deleted file mode 100644
index 09710ad4..00000000
--- a/lang/cpp/src/eventloopinteractor.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- eventloopinteractor.cpp
- Copyright (C) 2003,2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 <eventloopinteractor.h>
-
-#include <context.h>
-#include "context_p.h"
-#include <key.h>
-#include <trustitem.h>
-
-#include <gpgme.h>
-
-#include <vector>
-using std::vector;
-#ifndef NDEBUG
-# include <iostream>
-#endif
-#include <cassert>
-
-namespace GpgME
-{
-
-//
-// EventLoopInteractor::Private Declaration
-//
-
-class EventLoopInteractor::Private
-{
-public:
- struct OneFD {
- OneFD(int aFd, int aDir, gpgme_io_cb_t aFnc,
- void *aFncData, void *aExternalTag)
- : fd(aFd), dir(aDir), fnc(aFnc),
- fncData(aFncData), externalTag(aExternalTag) {}
- int fd;
- int dir;
- gpgme_io_cb_t fnc;
- void *fncData;
- void *externalTag;
- };
-
- vector<OneFD *> mCallbacks;
-
- static void removeIOCb(void *tag);
- static gpgme_error_t registerIOCb(void *data, int fd, int dir,
- gpgme_io_cb_t fnc, void *fnc_data,
- void **r_tag);
- static void eventIOCb(void *, gpgme_event_io_t type, void *type_data);
-
- static const gpgme_io_cbs iocbs;
-};
-
-const gpgme_io_cbs EventLoopInteractor::Private::iocbs = {
- &EventLoopInteractor::Private::registerIOCb,
- nullptr,
- &EventLoopInteractor::Private::removeIOCb,
- &EventLoopInteractor::Private::eventIOCb,
- nullptr
-};
-
-//
-// EventLoopInteractor::Private IO Callback Implementations
-//
-
-gpgme_error_t EventLoopInteractor::Private::registerIOCb(void *, int fd, int dir,
- gpgme_io_cb_t fnc, void *fnc_data,
- void **r_tag)
-{
- assert(instance()); assert(instance()->d);
- bool ok = false;
- void *etag = instance()->registerWatcher(fd, dir ? Read : Write, ok);
- if (!ok) {
- return gpgme_error(GPG_ERR_GENERAL);
- }
- instance()->d->mCallbacks.push_back(new OneFD(fd, dir, fnc, fnc_data, etag));
- if (r_tag) {
- *r_tag = instance()->d->mCallbacks.back();
- }
- return GPG_ERR_NO_ERROR;
-}
-
-void EventLoopInteractor::Private::removeIOCb(void *tag)
-{
-
- if (!instance() || !instance()->d) {
- return;
- }
- for (vector<OneFD *>::iterator it = instance()->d->mCallbacks.begin();
- it != instance()->d->mCallbacks.end() ; ++it) {
- if (*it == tag) {
- instance()->unregisterWatcher((*it)->externalTag);
- delete *it; *it = nullptr;
- instance()->d->mCallbacks.erase(it);
- return;
- }
- }
-}
-
-void EventLoopInteractor::Private::eventIOCb(void *data, gpgme_event_io_t type, void *type_data)
-{
- assert(instance());
- Context *ctx = static_cast<Context *>(data);
- switch (type) {
- case GPGME_EVENT_START: {
- instance()->operationStartEvent(ctx);
- // TODO: what's in type_data?
- }
- break;
- case GPGME_EVENT_DONE: {
- gpgme_error_t e = *static_cast<gpgme_error_t *>(type_data);
- if (ctx && ctx->impl()) {
- ctx->impl()->lasterr = e;
- }
- instance()->operationDoneEvent(ctx, Error(e));
- }
- break;
- case GPGME_EVENT_NEXT_KEY: {
- gpgme_key_t key = static_cast<gpgme_key_t>(type_data);
- instance()->nextKeyEvent(ctx, Key(key, false));
- }
- break;
- case GPGME_EVENT_NEXT_TRUSTITEM: {
- gpgme_trust_item_t item = static_cast<gpgme_trust_item_t>(type_data);
- instance()->nextTrustItemEvent(ctx, TrustItem(item));
- gpgme_trust_item_unref(item);
- }
- break;
- default: // warn
- ;
- }
-}
-
-//
-// EventLoopInteractor Implementation
-//
-
-EventLoopInteractor *EventLoopInteractor::mSelf = nullptr;
-
-EventLoopInteractor::EventLoopInteractor() : d(new Private)
-{
- assert(!mSelf);
- mSelf = this;
-}
-
-EventLoopInteractor::~EventLoopInteractor()
-{
- // warn if there are still callbacks registered
- mSelf = nullptr;
- delete d;
-}
-
-void EventLoopInteractor::manage(Context *context)
-{
- if (!context || context->managedByEventLoopInteractor()) {
- return;
- }
- gpgme_io_cbs *iocbs = new gpgme_io_cbs(Private::iocbs);
- iocbs->event_priv = context;
- context->installIOCallbacks(iocbs);
-}
-
-void EventLoopInteractor::unmanage(Context *context)
-{
- if (context) {
- context->uninstallIOCallbacks();
- }
-}
-
-void EventLoopInteractor::actOn(int fd, Direction dir)
-{
- for (vector<Private::OneFD *>::const_iterator it = d->mCallbacks.begin();
- it != d->mCallbacks.end() ; ++it) {
- if ((*it)->fd == fd && ((*it)->dir ? Read : Write) == dir) {
- (*((*it)->fnc))((*it)->fncData, fd);
- break;
- }
- }
-}
-
-} // namespace GpgME
diff --git a/lang/cpp/src/eventloopinteractor.h b/lang/cpp/src/eventloopinteractor.h
deleted file mode 100644
index 79f6b632..00000000
--- a/lang/cpp/src/eventloopinteractor.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- eventloopinteractor.h
- Copyright (C) 2003,2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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.
-*/
-
-// -*- c++ -*-
-#ifndef __GPGMEPP_EVENTLOOPINTERACTOR_H__
-#define __GPGMEPP_EVENTLOOPINTERACTOR_H__
-
-#include "gpgmepp_export.h"
-
-namespace GpgME
-{
-
-class Context;
-class Error;
-class TrustItem;
-class Key;
-
-/*! \file eventloopinteractor.h
- \brief Abstract base class for gpgme's external event loop support
-
- This class does most of the work involved with hooking GpgME++
- up with external event loops, such as the GTK or Qt ones.
-
- It actually provides two interfaces: An interface to the gpgme
- IO Callback handling and one for gpgme events. The IO Callback
- interface consists of the three methods \c actOn(), \c
- registerWatcher() and \c unregisterWatcher(). The event
- interface consists of the three methods \c nextTrustItemEvent(),
- \c nextKeyEvent() and \c operationDoneEvent().
-
- \sect General Usage
-
- \c EventLoopInteractor is designed to be used as a
- singleton. However, in order to make any use of it, you have to
- subclass it and reimplement it's pure virtual methods (see
- below). We suggest you keep the constructor protected and
- provide a static \c instance() method that returns the single
- instance. Alternatively, you can create an instance on the
- stack, e.g. in \c main().
-
- If you want \c EventLoopInteractor to manage a particular \c
- Context, just call \c manage() on the \c Context. OTOH, if you
- want to disable IO callbacks for a \c Context, use \c unmanage().
-
- \sect IO Callback Interface
-
- One part of this interface is represented by \c
- registerWatcher() and \c unregisterWatcher(), both of which are
- pure virtual. \c registerWatcher() should do anything necessary
- to hook up watching of file descriptor \c fd for reading (\c dir
- = \c Read) or writing (\c dir = Write) to the event loop you use
- and return a tag identifying that particular watching process
- uniquely. This could be the index into an array of objects you
- use for that purpose or the address of such an object. E.g. in
- Qt, you'd essentially just create a new \c QSocketNotifier:
-
- \verbatim
- void * registerWatcher( int fd, Direction dir ) {
- return new QSocketNotifier( fd, dir == Read ? QSocketNotifier::Read : QSocketNotifier::Write );
- // misses connecting to the activated() signal...
- }
- \endverbatim
-
- which uses the address of the created object as unique tag. The
- tag returned by \c registerWatcher is stored by \c
- EventLoopInteractor and passed as argument to \c
- unregisterWatcher(). So, in the picture above, you'd implement \c
- unregisterWatcher() like this:
-
- \verbatim
- void unregisterWatcher( void * tag ) {
- delete static_cast<QSocketNotifier*>( tag );
- }
- \endverbatim
-
- The other part of the IO callback interface is \c actOn(), which
- you should call if you receive notification from your event loop
- about activity on file descriptor \c fd in direction \c dir. In
- the picture above, you'd call this from the slot connected to
- the socket notifier's \c activated() signal.
-
- \note \c registerWatcher() as well as \c unregisterWatcher() may
- be called from within \c actOn(), so be careful with
- e.g. locking in threaded environments and keep in mind that the
- object you used to find the \c fd and \c dir fo the \c actOn()
- call might be deleted when \c actOn() returns!
-
- \sect Event Handler Interface
-
-*/
-class GPGMEPP_EXPORT EventLoopInteractor
-{
-protected:
- EventLoopInteractor();
-public:
- virtual ~EventLoopInteractor();
-
- static EventLoopInteractor *instance()
- {
- return mSelf;
- }
-
- void manage(Context *context);
- void unmanage(Context *context);
-
- enum Direction { Read, Write };
-protected:
- //
- // IO Notification Interface
- //
-
- /** Call this if your event loop detected activity on file
- descriptor fd, with direction dir */
- void actOn(int fd, Direction dir);
-
- virtual void *registerWatcher(int fd, Direction dir, bool &ok) = 0;
- virtual void unregisterWatcher(void *tag) = 0;
-
- //
- // Event Handler Interface
- //
-
- virtual void operationStartEvent(Context *context) = 0;
- virtual void nextTrustItemEvent(Context *context, const TrustItem &item) = 0;
- virtual void nextKeyEvent(Context *context, const Key &key) = 0;
- virtual void operationDoneEvent(Context *context, const Error &e) = 0;
-
-private:
- class Private;
- friend class Private;
- Private *const d;
- static EventLoopInteractor *mSelf;
-};
-
-}
-
-#endif // __GPGMEPP_EVENTLOOPINTERACTOR_H__
diff --git a/lang/cpp/src/exception.cpp b/lang/cpp/src/exception.cpp
deleted file mode 100644
index 7751c3ea..00000000
--- a/lang/cpp/src/exception.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- exception.cpp - exception wrapping a gpgme error
- Copyright (C) 2007 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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.
-*/
-
-// -*- c++ -*-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "exception.h"
-
-#include <gpgme.h>
-
-#include <sstream>
-
-using namespace GpgME;
-using namespace std; // only safe b/c it's so small a file!
-
-Exception::~Exception() throw() {}
-
-// static
-string Exception::make_message(const Error &err, const string &msg)
-{
- return make_message(err, msg, NoOptions);
-}
-
-// static
-string Exception::make_message(const Error &err, const string &msg, Options opt)
-{
- if (opt & MessageOnly) {
- return msg;
- }
- char error_string[128];
- error_string[0] = '\0';
- gpgme_strerror_r(err.encodedError(), error_string, sizeof error_string);
- error_string[sizeof error_string - 1] = '\0';
- stringstream ss;
- ss << gpgme_strsource(err.encodedError()) << ": ";
- if (!msg.empty()) {
- ss << msg << ": ";
- }
- ss << error_string << " (" << static_cast<unsigned long>(err.encodedError()) << ')';
- return ss.str();
-}
diff --git a/lang/cpp/src/exception.h b/lang/cpp/src/exception.h
deleted file mode 100644
index 85169d83..00000000
--- a/lang/cpp/src/exception.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- exception.h - exception wrapping a gpgme error
- Copyright (C) 2007 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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.
-*/
-
-// -*- c++ -*-
-#ifndef __GPGMEPP_EXCEPTION_H__
-#define __GPGMEPP_EXCEPTION_H__
-
-#include "error.h"
-
-#include <stdexcept>
-#include <string>
-
-namespace GpgME
-{
-
-class GPGMEPP_EXPORT Exception : public std::runtime_error
-{
-public:
- enum Options {
- NoOptions = 0x0,
- MessageOnly = 0x1,
-
- AllOptions = MessageOnly
- };
-
- explicit Exception(const GpgME::Error &err, const std::string &msg = std::string(), Options opt = NoOptions)
- : std::runtime_error(make_message(err, msg, opt)), m_error(err), m_message(msg) {}
-
- ~Exception() throw();
-
- Error error() const
- {
- return m_error;
- }
- const std::string &message() const
- {
- return m_message;
- }
-private:
- static std::string make_message(const GpgME::Error &err, const std::string &msg);
- static std::string make_message(const GpgME::Error &err, const std::string &msg, Options opt);
-private:
- const GpgME::Error m_error;
- const std::string m_message;
-};
-
-} // namespace GpgME
-
-#endif /* __GPGMEPP_EXCEPTION_H__ */
diff --git a/lang/cpp/src/global.h b/lang/cpp/src/global.h
deleted file mode 100644
index d297defc..00000000
--- a/lang/cpp/src/global.h
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- global.h - global gpgme functions and enums
- Copyright (C) 2003, 2007 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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.
-*/
-
-// -*- c++ -*-
-#ifndef __GPGMEPP_GLOBAL_H__
-#define __GPGMEPP_GLOBAL_H__
-
-#include "gpgmefw.h"
-#include "gpgmepp_export.h"
-
-#include <iosfwd>
-#include <cstring>
-
-namespace GpgME
-{
-class Error;
-class EngineInfo;
-class Context;
-}
-
-struct _GIOChannel;
-typedef struct _GIOChannel GIOChannel;
-class QIODevice;
-
-namespace GpgME
-{
-
-GPGMEPP_EXPORT void initializeLibrary();
-/*!
- Initializes the library, returns Error::code() ==
- GPG_ERR_USER_1 if underlying gpgme is too old.
-*/
-GPGMEPP_EXPORT Error initializeLibrary(int);
-
-enum Protocol { OpenPGP, CMS, UnknownProtocol };
-
-enum Engine { GpgEngine, GpgSMEngine, GpgConfEngine, UnknownEngine, AssuanEngine, G13Engine, SpawnEngine };
-
-enum KeyListMode {
- Local = 0x1,
- Extern = 0x2,
- Locate = Local|Extern,
- Signatures = 0x4,
- SignatureNotations = 0x8,
- Validate = 0x10,
- Ephemeral = 0x20,
- WithTofu = 0x40,
- WithKeygrip = 0x80,
- WithSecret = 0x100,
- ForceExtern = 0x200,
- LocateExternal = Locate|ForceExtern,
-
- KeyListModeMask = 0x3ff
-};
-
-enum SignatureMode {
- NormalSignatureMode = 0,
- Detached = 1,
- Clearsigned = 2,
- SignArchive = 4,
- SignFile = 8,
-};
-
-enum class RevocationReason {
- Unspecified = 0,
- Compromised = 1,
- Superseded = 2,
- NoLongerUsed = 3
-};
-
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, Protocol proto);
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, Engine eng);
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, KeyListMode mode);
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, SignatureMode mode);
-
-GPGMEPP_EXPORT Error setDefaultLocale(int category, const char *value);
-
-GPGMEPP_EXPORT Context *wait(Error &e, bool hang = true);
-typedef void (*IdleFunction)(void);
-GPGMEPP_EXPORT IdleFunction registerIdleFunction(IdleFunction idleFunction);
-
-typedef void (*IOCallback)(void *data, int fd);
-
-GPGMEPP_EXPORT EngineInfo engineInfo(Protocol proto);
-GPGMEPP_EXPORT EngineInfo engineInfo(Engine engine);
-/** Wrapper around gpgme_get_dirinfo. What can be:
-homedir, sysconfdir, bindir, libexecdir, libdir,
-datadir, localedir, agent-socket, agent-ssh-socket,
-dirmngr-socket, uiserver-socket, gpgconf-name, gpg-name,
-gpgsm-name, g13-name, keyboxd-name, agent-name, scdaemon-name,
-dirmngr-name, pinentry-name, socketdir, gpg-wks-client-name, gpgtar-name.
-
-This may be extended in the future.
-*/
-GPGMEPP_EXPORT const char *dirInfo(const char *what);
-
-GPGMEPP_EXPORT Error checkEngine(Protocol proto);
-GPGMEPP_EXPORT Error checkEngine(Engine engine);
-
-/* Wrapper for gpgme_set_global_flag */
-GPGMEPP_EXPORT int setGlobalFlag(const char *name, const char *value);
-
-GPGMEPP_EXPORT GIOChannel *getGIOChannel(int fd);
-GPGMEPP_EXPORT QIODevice *getQIODevice(int fd);
-
-enum Feature {
- ValidatingKeylistModeFeature = 0x00000001,
- CancelOperationFeature = 0x00000002,
- WrongKeyUsageFeature = 0x00000004,
- DefaultCertificateInclusionFeature = 0x00000008,
-
- GetSetEngineInfoFeature = 0x00000010,
- EngineInfoHomeDirFeature = 0x00000020,
- NoEncryptToEncryptionFlagFeature = 0x00000040,
- EphemeralKeylistModeFeature = 0x00000080,
-
- SetDataFileNameFeeature = 0x00000100,
- VerificationResultFileNameFeature = 0x00000200,
- DecryptionResultFileNameFeature = 0x00000400,
- DecryptionResultRecipientsFeature = 0x00000800,
-
- AuditLogFeature = 0x00001000,
- GpgConfEngineFeature = 0x00002000,
- CancelOperationAsyncFeature = 0x00004000,
- AssuanEngineFeature = 0x00008000,
-
- ClearAddGetSignatureNotationsFeature = 0x00010000,
- SignatureNotationsKeylistModeFeature = 0x00020000,
- KeySignatureNotationsFeature = 0x00040000,
- SignatureNotationsFlagsFeature = 0x00080000,
- SignatureNotationsCriticalFlagFeature = 0x00100000,
- SignatureNotationsHumanReadableFlagFeature = 0x00200000,
- CardKeyFeature = 0x00400000,
- ImportFromKeyserverFeature = 0x00800000,
-
- KeyIsQualifiedFeature = 0x01000200,
- SubkeyIsQualifiedFeature = 0x02000000,
- SignaturePkaFieldsFeature = 0x04000000,
- SignatureAlgorithmFieldsFeature = 0x08000000,
-
- FdPointerFeature = 0x10000000,
- G13VFSFeature = 0x20000000,
- PasswdFeature = 0x40000000, // gpgme >= 1.3.0
- // unusable (max value)
-
- FeatureMaxValue = 0x80000000
-};
-enum Feature2 {
- BinaryAndFineGrainedIdentify = 0x00000001, // gpgme >= 1.7.0
- Feature2MaxValue = 0x80000000
-};
-
-// use hasFeature( unsigned long, unsigned long ) instead
-GPGMEPP_DEPRECATED_EXPORT bool hasFeature(unsigned long feature);
-GPGMEPP_EXPORT bool hasFeature(unsigned long feature, unsigned long feature2);
-
-} // namespace GpgME
-
-# ifndef GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION
-# define GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION( Class ) \
- namespace std { template <> inline void swap< GpgME::Class >( GpgME::Class & lhs, GpgME::Class & rhs ) { lhs.swap( rhs ); } }
-# endif
-
-# ifndef GPGMEPP_MAKE_SAFE_BOOL_OPERATOR
-# define GPGMEPP_MAKE_SAFE_BOOL_OPERATOR( Cond ) \
- private: \
- struct __safe_bool_dummy__ { void nonnull() {} }; \
- typedef void ( __safe_bool_dummy__::*unspecified_bool_type )(); \
- public: \
- operator unspecified_bool_type() const { return ( Cond ) ? &__safe_bool_dummy__::nonnull : nullptr; }
-# endif
-
-inline int _gpgmepp_strcmp(const char *s1, const char *s2)
-{
- return s1 ? s2 ? std::strcmp(s1, s2) : 1 : s2 ? -1 : 0;
-}
-
-#define _GPGMEPP_MAKE_STRCMP( Name, expr, cmp ) \
- template <template <typename U> class Op> \
- struct Name { \
- typedef bool result_type; \
- \
- bool operator()( const char * lhs, const char * rhs ) const { \
- return Op<int>()( cmp, 0 ); \
- } \
- \
- bool operator()( const std::string & lhs, const std::string & rhs ) const { \
- return operator()( lhs.c_str(), rhs.c_str() ); \
- } \
- bool operator()( const char * lhs, const std::string & rhs ) const { \
- return operator()( lhs, rhs.c_str() ); \
- } \
- bool operator()( const std::string & lhs, const char * rhs ) const { \
- return operator()( lhs.c_str(), rhs ); \
- } \
- \
- template <typename T> \
- bool operator()( const T & lhs, const T & rhs ) const { \
- return operator()( (lhs expr), (rhs expr) ); \
- } \
- template <typename T> \
- bool operator()( const T & lhs, const char * rhs ) const { \
- return operator()( (lhs expr), rhs ); \
- } \
- template <typename T> \
- bool operator()( const char * lhs, const T & rhs ) const { \
- return operator()( lhs, (rhs expr) ); \
- } \
- template <typename T> \
- bool operator()( const T & lhs, const std::string & rhs ) const { \
- return operator()( (lhs expr), rhs ); \
- } \
- template <typename T> \
- bool operator()( const std::string & lhs, const T & rhs ) const { \
- return operator()( lhs, (rhs expr) ); \
- } \
- }
-
-#define GPGMEPP_MAKE_STRCMP( Name, expr ) \
- _GPGMEPP_MAKE_STRCMP( Name, expr, _gpgmepp_strcmp( lhs, rhs ) )
-
-
-#endif // __GPGMEPP_GLOBAL_H__
diff --git a/lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp b/lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp
deleted file mode 100644
index 49e98def..00000000
--- a/lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- gpgaddexistingsubkeyeditinteractor.cpp - Edit Interactor to add an existing subkey to an OpenPGP key
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "gpgaddexistingsubkeyeditinteractor.h"
-
-#include "error.h"
-
-#include <gpgme.h>
-
-// avoid conflict (msvc)
-#ifdef ERROR
-# undef ERROR
-#endif
-
-using namespace GpgME;
-
-class GpgAddExistingSubkeyEditInteractor::Private
-{
- enum {
- START = EditInteractor::StartState,
- COMMAND,
- ADD_EXISTING_KEY,
- KEYGRIP,
- FLAGS,
- VALID,
- KEY_CREATED,
- QUIT,
- SAVE,
-
- ERROR = EditInteractor::ErrorState
- };
-
- GpgAddExistingSubkeyEditInteractor *const q = nullptr;
-
-public:
- Private(GpgAddExistingSubkeyEditInteractor *q, const std::string &keygrip)
- : q{q}
- , keygrip{keygrip}
- {
- }
-
- const char *action(Error &err) const;
- unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const;
-
- std::string keygrip;
- std::string expiry;
-};
-
-const char *GpgAddExistingSubkeyEditInteractor::Private::action(Error &err) const
-{
- switch (q->state()) {
- case COMMAND:
- return "addkey";
- case ADD_EXISTING_KEY:
- return "keygrip";
- case KEYGRIP:
- return keygrip.c_str();
- case FLAGS:
- return "Q"; // do not toggle any usage flags
- case VALID:
- return expiry.empty() ? "0" : expiry.c_str();
- case QUIT:
- return "quit";
- case SAVE:
- return "Y";
- case START:
- case KEY_CREATED:
- case ERROR:
- return nullptr;
- default:
- err = Error::fromCode(GPG_ERR_GENERAL);
- return nullptr;
- }
-}
-
-unsigned int GpgAddExistingSubkeyEditInteractor::Private::nextState(unsigned int status, const char *args, Error &err) const
-{
- using std::strcmp;
-
- static const Error GENERAL_ERROR = Error::fromCode(GPG_ERR_GENERAL);
- static const Error NO_KEY_ERROR = Error::fromCode(GPG_ERR_NO_KEY);
- static const Error INV_TIME_ERROR = Error::fromCode(GPG_ERR_INV_TIME);
-
- switch (q->state()) {
- case START:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keyedit.prompt") == 0) {
- return COMMAND;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case COMMAND:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.algo") == 0) {
- return ADD_EXISTING_KEY;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case ADD_EXISTING_KEY:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.keygrip") == 0) {
- return KEYGRIP;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case KEYGRIP:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.flags") == 0) {
- return FLAGS;
- } else if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.keygrip") == 0) {
- err = NO_KEY_ERROR;
- return ERROR;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case FLAGS:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.valid") == 0) {
- return VALID;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case VALID:
- if (status == GPGME_STATUS_KEY_CREATED) {
- return KEY_CREATED;
- }
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keyedit.prompt") == 0) {
- return QUIT;
- } else if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.valid") == 0) {
- err = INV_TIME_ERROR;
- return ERROR;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case KEY_CREATED:
- return QUIT;
- case QUIT:
- if (status == GPGME_STATUS_GET_BOOL &&
- strcmp(args, "keyedit.save.okay") == 0) {
- return SAVE;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case ERROR:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keyedit.prompt") == 0) {
- return QUIT;
- }
- err = q->lastError();
- return ERROR;
- default:
- err = GENERAL_ERROR;
- return ERROR;
- }
-}
-
-GpgAddExistingSubkeyEditInteractor::GpgAddExistingSubkeyEditInteractor(const std::string &keygrip)
- : EditInteractor{}
- , d{new Private{this, keygrip}}
-{
-}
-
-GpgAddExistingSubkeyEditInteractor::~GpgAddExistingSubkeyEditInteractor() = default;
-
-void GpgAddExistingSubkeyEditInteractor::setExpiry(const std::string &timeString)
-{
- d->expiry = timeString;
-}
-
-const char *GpgAddExistingSubkeyEditInteractor::action(Error &err) const
-{
- return d->action(err);
-}
-
-unsigned int GpgAddExistingSubkeyEditInteractor::nextState(unsigned int status, const char *args, Error &err) const
-{
- return d->nextState(status, args, err);
-}
diff --git a/lang/cpp/src/gpgaddexistingsubkeyeditinteractor.h b/lang/cpp/src/gpgaddexistingsubkeyeditinteractor.h
deleted file mode 100644
index 2a580b6e..00000000
--- a/lang/cpp/src/gpgaddexistingsubkeyeditinteractor.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- gpgaddexistingsubkeyeditinteractor.h - Edit Interactor to add an existing subkey to an OpenPGP key
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_GPGADDEXISTINGSUBKEYEDITINTERACTOR_H__
-#define __GPGMEPP_GPGADDEXISTINGSUBKEYEDITINTERACTOR_H__
-
-#include "editinteractor.h"
-
-#include <memory>
-#include <string>
-
-namespace GpgME
-{
-
-class GPGMEPP_EXPORT GpgAddExistingSubkeyEditInteractor : public EditInteractor
-{
-public:
- /** Edit interactor to add the existing subkey with keygrip \a keygrip
- * to the key a key edit operation is working on.
- **/
- explicit GpgAddExistingSubkeyEditInteractor(const std::string &keygrip);
- ~GpgAddExistingSubkeyEditInteractor() override;
-
- /** Sets the validity period of the added subkey. Use "0" for no expiration
- * or a simplified ISO date string ("yyyymmddThhmmss") for setting an
- * expiration date. */
- void setExpiry(const std::string &timeString);
-
-private:
- const char *action(Error &err) const override;
- unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const override;
-
-private:
- class Private;
- const std::unique_ptr<Private> d;
-};
-
-} // namespace GpgME
-
-#endif // __GPGMEPP_GPGADDEXISTINGSUBKEYEDITINTERACTOR_H__
diff --git a/lang/cpp/src/gpgadduserideditinteractor.cpp b/lang/cpp/src/gpgadduserideditinteractor.cpp
deleted file mode 100644
index 1f27c84f..00000000
--- a/lang/cpp/src/gpgadduserideditinteractor.cpp
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- gpgadduserideditinteractor.cpp - Edit Interactor to add a new UID to an OpenPGP key
- Copyright (C) 2008 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "gpgadduserideditinteractor.h"
-
-#include "error.h"
-
-#include <gpgme.h>
-
-#include <cstring>
-
-using std::strcmp;
-
-// avoid conflict (msvc)
-#ifdef ERROR
-# undef ERROR
-#endif
-
-using namespace GpgME;
-
-GpgAddUserIDEditInteractor::GpgAddUserIDEditInteractor()
- : EditInteractor(),
- m_name(),
- m_email(),
- m_comment()
-{
-
-}
-
-GpgAddUserIDEditInteractor::~GpgAddUserIDEditInteractor() {}
-
-void GpgAddUserIDEditInteractor::setNameUtf8(const std::string &name)
-{
- m_name = name;
-}
-
-void GpgAddUserIDEditInteractor::setEmailUtf8(const std::string &email)
-{
- m_email = email;
-}
-
-void GpgAddUserIDEditInteractor::setCommentUtf8(const std::string &comment)
-{
- m_comment = comment;
-}
-
-// work around --enable-final
-namespace GpgAddUserIDEditInteractor_Private
-{
-enum {
- START = EditInteractor::StartState,
- COMMAND,
- NAME,
- EMAIL,
- COMMENT,
- QUIT,
- SAVE,
-
- ERROR = EditInteractor::ErrorState
-};
-}
-
-const char *GpgAddUserIDEditInteractor::action(Error &err) const
-{
-
- using namespace GpgAddUserIDEditInteractor_Private;
-
- switch (state()) {
- case COMMAND:
- return "adduid";
- case NAME:
- return m_name.c_str();
- case EMAIL:
- return m_email.c_str();
- case COMMENT:
- return m_comment.c_str();
- case QUIT:
- return "quit";
- case SAVE:
- return "Y";
- case START:
- case ERROR:
- return nullptr;
- default:
- err = Error::fromCode(GPG_ERR_GENERAL);
- return nullptr;
- }
-}
-
-unsigned int GpgAddUserIDEditInteractor::nextState(unsigned int status, const char *args, Error &err) const
-{
-
- static const Error GENERAL_ERROR = Error::fromCode(GPG_ERR_GENERAL);
- static const Error INV_NAME_ERROR = Error::fromCode(GPG_ERR_INV_NAME);
- static const Error INV_EMAIL_ERROR = Error::fromCode(GPG_ERR_INV_USER_ID);
- static const Error INV_COMMENT_ERROR = Error::fromCode(GPG_ERR_INV_USER_ID);
-
- using namespace GpgAddUserIDEditInteractor_Private;
-
- switch (state()) {
- case START:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keyedit.prompt") == 0) {
- return COMMAND;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case COMMAND:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.name") == 0) {
- return NAME;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case NAME:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.email") == 0) {
- return EMAIL;
- }
- err = GENERAL_ERROR;
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.name") == 0) {
- err = INV_NAME_ERROR;
- }
- return ERROR;
- case EMAIL:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.comment") == 0) {
- return COMMENT;
- }
- err = GENERAL_ERROR;
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.email") == 0) {
- err = INV_EMAIL_ERROR;
- }
- return ERROR;
- case COMMENT:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keyedit.prompt") == 0) {
- return QUIT;
- }
- err = GENERAL_ERROR;
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.comment") == 0) {
- err = INV_COMMENT_ERROR;
- }
- return ERROR;
- case QUIT:
- if (status == GPGME_STATUS_GET_BOOL &&
- strcmp(args, "keyedit.save.okay") == 0) {
- return SAVE;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case ERROR:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keyedit.prompt") == 0) {
- return QUIT;
- }
- err = lastError();
- return ERROR;
- default:
- err = GENERAL_ERROR;
- return ERROR;
- }
-}
diff --git a/lang/cpp/src/gpgadduserideditinteractor.h b/lang/cpp/src/gpgadduserideditinteractor.h
deleted file mode 100644
index 68db32f2..00000000
--- a/lang/cpp/src/gpgadduserideditinteractor.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- gpgadduserideditinteractor.h - Edit Interactor to add a new UID to an OpenPGP key
- Copyright (C) 2008 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_GPGADDUSERIDEDITINTERACTOR_H__
-#define __GPGMEPP_GPGADDUSERIDEDITINTERACTOR_H__
-
-#include "editinteractor.h"
-
-#include <string>
-
-namespace GpgME
-{
-
-class GPGMEPP_EXPORT GpgAddUserIDEditInteractor : public EditInteractor
-{
-public:
- explicit GpgAddUserIDEditInteractor();
- ~GpgAddUserIDEditInteractor();
-
- void setNameUtf8(const std::string &name);
- const std::string &nameUtf8() const
- {
- return m_name;
- }
-
- void setEmailUtf8(const std::string &email);
- const std::string &emailUtf8() const
- {
- return m_email;
- }
-
- void setCommentUtf8(const std::string &comment);
- const std::string &commentUtf8() const
- {
- return m_comment;
- }
-
-private:
- const char *action(Error &err) const override;
- unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const override;
-
-private:
- std::string m_name, m_email, m_comment;
-};
-
-} // namespace GpgME
-
-#endif // __GPGMEPP_GPGADDUSERIDEDITINTERACTOR_H__
diff --git a/lang/cpp/src/gpgagentgetinfoassuantransaction.cpp b/lang/cpp/src/gpgagentgetinfoassuantransaction.cpp
deleted file mode 100644
index e8524054..00000000
--- a/lang/cpp/src/gpgagentgetinfoassuantransaction.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- gpgagentgetinfoassuantransaction.cpp - Assuan Transaction to get information from gpg-agent
- Copyright (C) 2009 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "gpgagentgetinfoassuantransaction.h"
-#include "error.h"
-#include "data.h"
-#include "util.h"
-
-#include <assert.h>
-
-using namespace GpgME;
-
-GpgAgentGetInfoAssuanTransaction::GpgAgentGetInfoAssuanTransaction(InfoItem item)
- : AssuanTransaction(),
- m_item(item),
- m_command(),
- m_data()
-{
-
-}
-
-GpgAgentGetInfoAssuanTransaction::~GpgAgentGetInfoAssuanTransaction() {}
-
-std::string GpgAgentGetInfoAssuanTransaction::version() const
-{
- if (m_item == Version) {
- return m_data;
- } else {
- return std::string();
- }
-}
-
-unsigned int GpgAgentGetInfoAssuanTransaction::pid() const
-{
- if (m_item == Pid) {
- return to_pid(m_data);
- } else {
- return 0U;
- }
-}
-
-std::string GpgAgentGetInfoAssuanTransaction::socketName() const
-{
- if (m_item == SocketName) {
- return m_data;
- } else {
- return std::string();
- }
-}
-
-std::string GpgAgentGetInfoAssuanTransaction::sshSocketName() const
-{
- if (m_item == SshSocketName) {
- return m_data;
- } else {
- return std::string();
- }
-}
-
-static const char *const gpgagent_getinfo_tokens[] = {
- "version",
- "pid",
- "socket_name",
- "ssh_socket_name",
- "scd_running",
-};
-
-void GpgAgentGetInfoAssuanTransaction::makeCommand() const
-{
- assert(m_item >= 0);
- assert(m_item < LastInfoItem);
- m_command = "GETINFO ";
- m_command += gpgagent_getinfo_tokens[m_item];
-}
-
-const char *GpgAgentGetInfoAssuanTransaction::command() const
-{
- makeCommand();
- return m_command.c_str();
-}
-
-Error GpgAgentGetInfoAssuanTransaction::data(const char *data, size_t len)
-{
- m_data.append(data, len);
- return Error();
-}
-
-Data GpgAgentGetInfoAssuanTransaction::inquire(const char *name, const char *args, Error &err)
-{
- (void)name; (void)args; (void)err;
- return Data::null;
-}
-
-Error GpgAgentGetInfoAssuanTransaction::status(const char *status, const char *args)
-{
- (void)status; (void)args;
- return Error();
-}
diff --git a/lang/cpp/src/gpgagentgetinfoassuantransaction.h b/lang/cpp/src/gpgagentgetinfoassuantransaction.h
deleted file mode 100644
index b7178e42..00000000
--- a/lang/cpp/src/gpgagentgetinfoassuantransaction.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- gpgagentgetinfoassuantransaction.h - Assuan Transaction to get information from gpg-agent
- Copyright (C) 2009 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_GPGAGENTGETINFOASSUANTRANSACTION_H__
-#define __GPGMEPP_GPGAGENTGETINFOASSUANTRANSACTION_H__
-
-#include "interfaces/assuantransaction.h"
-
-#include <string>
-#include <vector>
-
-namespace GpgME
-{
-
-class GPGMEPP_EXPORT GpgAgentGetInfoAssuanTransaction : public AssuanTransaction
-{
-public:
- enum InfoItem {
- Version, // string
- Pid, // unsigned long
- SocketName, // string (path)
- SshSocketName, // string (path)
- ScdRunning, // (none, returns GPG_ERR_GENERAL when scdaemon isn't running)
- //CommandHasOption, // not supported
-
- LastInfoItem
- };
-
- explicit GpgAgentGetInfoAssuanTransaction(InfoItem item);
- ~GpgAgentGetInfoAssuanTransaction();
-
- std::string version() const;
- unsigned int pid() const;
- std::string socketName() const;
- std::string sshSocketName() const;
-
-private:
- const char *command() const;
- Error data(const char *data, size_t datalen) override;
- Data inquire(const char *name, const char *args, Error &err) override;
- Error status(const char *status, const char *args) override;
-
-private:
- void makeCommand() const;
-
-private:
- InfoItem m_item;
- mutable std::string m_command;
- std::string m_data;
-};
-
-} // namespace GpgME
-
-#endif // __GPGMEPP_GPGAGENTGETINFOASSUANTRANSACTION_H__
diff --git a/lang/cpp/src/gpggencardkeyinteractor.cpp b/lang/cpp/src/gpggencardkeyinteractor.cpp
deleted file mode 100644
index cd226c27..00000000
--- a/lang/cpp/src/gpggencardkeyinteractor.cpp
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- gpggencardkeyinteractor.cpp - Edit Interactor to generate a key on a card
- Copyright (C) 2017 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "gpggencardkeyinteractor.h"
-
-#include "error.h"
-
-#include <gpgme.h>
-
-using namespace GpgME;
-
-class GpgGenCardKeyInteractor::Private
-{
-public:
- Private() : keysize("2048")
- {
- }
-
- std::string name, email, backupFileName, expiry, serial, keysize;
- bool backup = false;
- Algo algo = RSA;
- std::string curve;
-};
-
-GpgGenCardKeyInteractor::~GpgGenCardKeyInteractor() = default;
-
-GpgGenCardKeyInteractor::GpgGenCardKeyInteractor(const std::string &serial):
- d(new Private)
-{
- d->serial = serial;
-}
-
-void GpgGenCardKeyInteractor::setNameUtf8(const std::string &name)
-{
- d->name = name;
-}
-
-void GpgGenCardKeyInteractor::setEmailUtf8(const std::string &email)
-{
- d->email = email;
-}
-
-void GpgGenCardKeyInteractor::setDoBackup(bool value)
-{
- d->backup = value;
-}
-
-void GpgGenCardKeyInteractor::setKeySize(int value)
-{
- d->keysize = std::to_string(value);
-}
-
-void GpgGenCardKeyInteractor::setExpiry(const std::string &timeStr)
-{
- d->expiry = timeStr;
-}
-
-std::string GpgGenCardKeyInteractor::backupFileName() const
-{
- return d->backupFileName;
-}
-
-void GpgGenCardKeyInteractor::setAlgo(Algo algo)
-{
- d->algo = algo;
-}
-
-void GpgGenCardKeyInteractor::setCurve(Curve curve)
-{
- if (curve == DefaultCurve) {
- d->curve.clear();
- } else if (curve >= 1 && curve <= LastCurve) {
- d->curve = std::to_string(static_cast<int>(curve));
- }
-}
-
-namespace GpgGenCardKeyInteractor_Private
-{
-enum {
- START = EditInteractor::StartState,
- DO_ADMIN,
- EXPIRE,
-
- GOT_SERIAL,
- COMMAND,
- NAME,
- EMAIL,
- COMMENT,
- BACKUP,
- REPLACE,
- SIZE,
- SIZE2,
- SIZE3,
- BACKUP_KEY_CREATED,
- KEY_CREATED,
- QUIT,
- SAVE,
-
- KEY_ATTR,
- KEY_ALGO1,
- KEY_ALGO2,
- KEY_ALGO3,
- KEY_CURVE1,
- KEY_CURVE2,
- KEY_CURVE3,
-
- ERROR = EditInteractor::ErrorState
-};
-}
-
-const char *GpgGenCardKeyInteractor::action(Error &err) const
-{
-
- using namespace GpgGenCardKeyInteractor_Private;
-
- switch (state()) {
- case DO_ADMIN:
- return "admin";
- case COMMAND:
- return "generate";
- case KEY_ATTR:
- return "key-attr";
- case KEY_ALGO1:
- case KEY_ALGO2:
- case KEY_ALGO3:
- return d->algo == RSA ? "1" : "2";
- case KEY_CURVE1:
- case KEY_CURVE2:
- case KEY_CURVE3:
- return d->curve.empty() ? "1" : d->curve.c_str(); // default is Curve25519
- case NAME:
- return d->name.c_str();
- case EMAIL:
- return d->email.c_str();
- case EXPIRE:
- return d->expiry.c_str();
- case BACKUP:
- return d->backup ? "Y" : "N";
- case REPLACE:
- return "Y";
- case SIZE:
- case SIZE2:
- case SIZE3:
- return d->keysize.c_str();
- case COMMENT:
- return "";
- case SAVE:
- return "Y";
- case QUIT:
- return "quit";
- case KEY_CREATED:
- case START:
- case GOT_SERIAL:
- case BACKUP_KEY_CREATED:
- case ERROR:
- return nullptr;
- default:
- err = Error::fromCode(GPG_ERR_GENERAL);
- return nullptr;
- }
-}
-
-unsigned int GpgGenCardKeyInteractor::nextState(unsigned int status, const char *args, Error &err) const
-{
-
- static const Error GENERAL_ERROR = Error::fromCode(GPG_ERR_GENERAL);
- static const Error INV_NAME_ERROR = Error::fromCode(GPG_ERR_INV_NAME);
- static const Error INV_EMAIL_ERROR = Error::fromCode(GPG_ERR_INV_USER_ID);
- static const Error INV_COMMENT_ERROR = Error::fromCode(GPG_ERR_INV_USER_ID);
-
- using namespace GpgGenCardKeyInteractor_Private;
-
- switch (state()) {
- case START:
- if (status == GPGME_STATUS_CARDCTRL &&
- !d->serial.empty()) {
- const std::string sArgs = args;
- if (sArgs.find(d->serial) == std::string::npos) {
- // Wrong smartcard
- err = Error::fromCode(GPG_ERR_WRONG_CARD);
- return ERROR;
- } else {
- printf("EditInteractor: Confirmed S/N: %s %s\n",
- d->serial.c_str(), sArgs.c_str());
- }
- return GOT_SERIAL;
- } else if (d->serial.empty()) {
- return GOT_SERIAL;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case GOT_SERIAL:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.prompt") == 0) {
- return DO_ADMIN;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case DO_ADMIN:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.prompt") == 0) {
- return KEY_ATTR;
- }
- err = GENERAL_ERROR;
- return ERROR;
- // Handling for key-attr subcommand
- case KEY_ATTR:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.prompt") == 0) {
- // Happens if key attr is not yet supported.
- return COMMAND;
- }
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.genkeys.algo") == 0) {
- return KEY_ALGO1;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case KEY_ALGO1:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.genkeys.size") == 0) {
- return SIZE;
- }
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.curve") == 0) {
- return KEY_CURVE1;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case KEY_ALGO2:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.genkeys.size") == 0) {
- return SIZE2;
- }
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.curve") == 0) {
- return KEY_CURVE2;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case KEY_ALGO3:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.genkeys.size") == 0) {
- return SIZE3;
- }
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.curve") == 0) {
- return KEY_CURVE3;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case KEY_CURVE1:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.genkeys.algo") == 0) {
- return KEY_ALGO2;
- }
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.prompt") == 0) {
- return COMMAND;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case KEY_CURVE2:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.genkeys.algo") == 0) {
- return KEY_ALGO3;
- }
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.prompt") == 0) {
- return COMMAND;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case KEY_CURVE3:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.genkeys.algo") == 0) {
- return KEY_ALGO3;
- }
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.prompt") == 0) {
- return COMMAND;
- }
- err = GENERAL_ERROR;
- return ERROR;
- // End key-attr handling
- case COMMAND:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.genkeys.backup_enc") == 0) {
- return BACKUP;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case BACKUP:
- if (status == GPGME_STATUS_GET_BOOL &&
- strcmp(args, "cardedit.genkeys.replace_keys") == 0) {
- return REPLACE;
- }
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.genkeys.size") == 0) {
- return SIZE;
- }
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.valid") == 0) {
- return EXPIRE;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case REPLACE:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.genkeys.size") == 0) {
- return SIZE;
- }
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.valid") == 0) {
- return EXPIRE;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case SIZE:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.genkeys.size") == 0) {
- return SIZE2;
- }
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.valid") == 0) {
- return EXPIRE;
- }
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.genkeys.algo") == 0) {
- return KEY_ALGO2;
- }
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.prompt") == 0) {
- return COMMAND;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case SIZE2:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.genkeys.size") == 0) {
- return SIZE3;
- }
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.valid") == 0) {
- return EXPIRE;
- }
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.genkeys.algo") == 0) {
- return KEY_ALGO3;
- }
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.prompt") == 0) {
- return COMMAND;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case SIZE3:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.valid") == 0) {
- return EXPIRE;
- }
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.prompt") == 0) {
- return COMMAND;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case EXPIRE:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.name") == 0) {
- return NAME;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case NAME:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.email") == 0) {
- return EMAIL;
- }
- err = GENERAL_ERROR;
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.name") == 0) {
- err = INV_NAME_ERROR;
- }
- return ERROR;
- case EMAIL:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.comment") == 0) {
- return COMMENT;
- }
- err = GENERAL_ERROR;
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.email") == 0) {
- err = INV_EMAIL_ERROR;
- }
- return ERROR;
- case COMMENT:
- if (status == GPGME_STATUS_BACKUP_KEY_CREATED) {
- std::string sArgs = args;
- const auto pos = sArgs.rfind(" ");
- if (pos != std::string::npos) {
- d->backupFileName = sArgs.substr(pos + 1);
- return BACKUP_KEY_CREATED;
- }
- }
- if (status == GPGME_STATUS_KEY_CREATED) {
- return KEY_CREATED;
- }
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keyedit.prompt") == 0) {
- return QUIT;
- }
- err = GENERAL_ERROR;
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.comment") == 0) {
- err = INV_COMMENT_ERROR;
- }
- return ERROR;
- case BACKUP_KEY_CREATED:
- if (status == GPGME_STATUS_KEY_CREATED) {
- return KEY_CREATED;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case KEY_CREATED:
- return QUIT;
- case QUIT:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "cardedit.prompt") == 0) {
- return QUIT;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case ERROR:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keyedit.prompt") == 0) {
- return QUIT;
- }
- err = lastError();
- return ERROR;
- default:
- err = GENERAL_ERROR;
- return ERROR;
- }
-}
diff --git a/lang/cpp/src/gpggencardkeyinteractor.h b/lang/cpp/src/gpggencardkeyinteractor.h
deleted file mode 100644
index 25cfa6b1..00000000
--- a/lang/cpp/src/gpggencardkeyinteractor.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- gpggencardkeyinteractor.h - Edit Interactor to generate a key on a card
- Copyright (C) 2017 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_GPGGENCARDKEYEDITINTERACTOR_H__
-#define __GPGMEPP_GPGGENCARDKEYEDITINTERACTOR_H__
-
-#include "editinteractor.h"
-
-#include <string>
-#include <memory>
-
-namespace GpgME
-{
-
-class GPGMEPP_EXPORT GpgGenCardKeyInteractor: public EditInteractor
-{
-public:
- /** Edit interactor to generate a key on a smartcard.
- *
- * The \a serialnumber argument is intended to safeguard
- * against accidentally working on the wrong smartcard.
- *
- * The edit interactor will fail if the card did not match.
- *
- * @param serialnumber: Serialnumber of the intended card.
- **/
- explicit GpgGenCardKeyInteractor(const std::string &serialnumber);
- ~GpgGenCardKeyInteractor();
-
- /** Set the key sizes for the subkeys (default 2048) */
- void setKeySize(int size);
-
- void setNameUtf8(const std::string &name);
- void setEmailUtf8(const std::string &email);
-
- void setDoBackup(bool value);
- void setExpiry(const std::string &timeString);
-
- enum Algo {
- RSA = 1,
- ECC = 2,
- };
- void setAlgo(Algo algo);
-
- // the enum values minus 1 have to match the indexes of the curves used by
- // ask_curve() in gnupg's g10/keygen.c
- enum Curve {
- DefaultCurve = 0, // currently Curve25519
- Curve25519 = 1,
- Curve448,
- NISTP256,
- NISTP384,
- NISTP521,
- BrainpoolP256,
- BrainpoolP384,
- BrainpoolP512,
- Secp256k1,
- LastCurve = Secp256k1,
- };
- void setCurve(Curve curve);
-
- std::string backupFileName() const;
-
-private:
- const char *action(Error &err) const override;
- unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const override;
-
-private:
- class Private;
- std::shared_ptr<Private> d;
-};
-
-} // namespace GpgME
-
-#endif // __GPGMEPP_GPGGENCARDKEYEDITINTERACTOR_H__
diff --git a/lang/cpp/src/gpgmefw.h b/lang/cpp/src/gpgmefw.h
deleted file mode 100644
index c6166d2c..00000000
--- a/lang/cpp/src/gpgmefw.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- gpgmefw.h - Forwards declarations for gpgme (0.3 and 0.4)
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_GPGMEFW_H__
-#define __GPGMEPP_GPGMEFW_H__
-
-struct gpgme_context;
-typedef gpgme_context *gpgme_ctx_t;
-
-struct gpgme_data;
-typedef gpgme_data *gpgme_data_t;
-
-struct gpgme_io_cbs;
-
-struct _gpgme_key;
-typedef struct _gpgme_key *gpgme_key_t;
-
-struct _gpgme_trust_item;
-typedef struct _gpgme_trust_item *gpgme_trust_item_t;
-
-struct _gpgme_subkey;
-typedef struct _gpgme_subkey *gpgme_sub_key_t;
-
-struct _gpgme_user_id;
-typedef struct _gpgme_user_id *gpgme_user_id_t;
-
-struct _gpgme_key_sig;
-typedef struct _gpgme_key_sig *gpgme_key_sig_t;
-
-struct _gpgme_sig_notation;
-typedef struct _gpgme_sig_notation *gpgme_sig_notation_t;
-
-struct _gpgme_engine_info;
-typedef struct _gpgme_engine_info *gpgme_engine_info_t;
-
-struct _gpgme_op_keylist_result;
-typedef struct _gpgme_op_keylist_result *gpgme_keylist_result_t;
-
-struct _gpgme_recipient;
-typedef struct _gpgme_recipient *gpgme_recipient_t;
-
-struct gpgme_conf_opt;
-typedef struct gpgme_conf_opt *gpgme_conf_opt_t;
-
-struct gpgme_conf_comp;
-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;
-
-struct _gpgme_revocation_key;
-typedef struct _gpgme_revocation_key *gpgme_revocation_key_t;
-
-#endif // __GPGMEPP_GPGMEFW_H__
diff --git a/lang/cpp/src/gpgmepp.pc.in b/lang/cpp/src/gpgmepp.pc.in
deleted file mode 100644
index 37c15357..00000000
--- a/lang/cpp/src/gpgmepp.pc.in
+++ /dev/null
@@ -1,13 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-includedir=@includedir@
-libdir=@libdir@
-host=@GPGMEPP_PKGCONFIG_HOST@
-
-Name: gpgmepp
-Description: GnuPG Made Easy (C++ binding)
-Requires.private: gpg-error, gpgme
-Version: @PACKAGE_VERSION@
-Cflags: @GPGMEPP_PKGCONFIG_CFLAGS@
-Libs: @GPGMEPP_PKGCONFIG_LIBS@
-URL: https://www.gnupg.org/software/gpgme/index.html
diff --git a/lang/cpp/src/gpgmepp_export.h b/lang/cpp/src/gpgmepp_export.h
deleted file mode 100644
index 0e5302f2..00000000
--- a/lang/cpp/src/gpgmepp_export.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*gpgmepp_export.h - Export macros for gpgmepp
- Copyright (C) 2016, by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_EXPORT_H
-#define GPGMEPP_EXPORT_H
-
-#ifdef GPGMEPP_STATIC_DEFINE
-# define GPGMEPP_EXPORT
-# define GPGMEPP_NO_EXPORT
-#else
-# ifndef GPGMEPP_EXPORT
-# ifdef BUILDING_GPGMEPP
- /* We are building this library */
-# ifdef WIN32
-# define GPGMEPP_EXPORT __declspec(dllexport)
-# else
-# define GPGMEPP_EXPORT __attribute__((visibility("default")))
-# endif
-# else
- /* We are using this library */
-# ifdef WIN32
-# define GPGMEPP_EXPORT __declspec(dllimport)
-# else
-# define GPGMEPP_EXPORT __attribute__((visibility("default")))
-# endif
-# endif
-# endif
-
-# ifndef GPGMEPP_NO_EXPORT
-# ifdef WIN32
-# define GPGMEPP_NO_EXPORT
-# else
-# define GPGMEPP_NO_EXPORT __attribute__((visibility("hidden")))
-# endif
-# endif
-#endif
-
-#ifndef GPGMEPP_DEPRECATED
-# define GPGMEPP_DEPRECATED __attribute__ ((__deprecated__))
-#endif
-
-#ifndef GPGMEPP_DEPRECATED_EXPORT
-# define GPGMEPP_DEPRECATED_EXPORT GPGMEPP_EXPORT GPGMEPP_DEPRECATED
-#endif
-
-#ifndef GPGMEPP_DEPRECATED_NO_EXPORT
-# define GPGMEPP_DEPRECATED_NO_EXPORT GPGMEPP_NO_EXPORT GPGMEPP_DEPRECATED
-#endif
-
-#define DEFINE_NO_DEPRECATED 0
-#if DEFINE_NO_DEPRECATED
-# define GPGMEPP_NO_DEPRECATED
-#endif
-
-#endif
diff --git a/lang/cpp/src/gpgmepp_version.h.in b/lang/cpp/src/gpgmepp_version.h.in
deleted file mode 100644
index 9cf6aeb0..00000000
--- a/lang/cpp/src/gpgmepp_version.h.in
+++ /dev/null
@@ -1,31 +0,0 @@
-/*gpgmepp_version.h - Version macros for gpgmepp
- 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_VERSION_H
-#define GPGMEPP_VERSION_H
-
-#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/gpgrevokekeyeditinteractor.cpp b/lang/cpp/src/gpgrevokekeyeditinteractor.cpp
deleted file mode 100644
index dfa3be16..00000000
--- a/lang/cpp/src/gpgrevokekeyeditinteractor.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- gpgrevokekeyeditinteractor.cpp - Edit Interactor to revoke own OpenPGP keys
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "gpgrevokekeyeditinteractor.h"
-
-#include "error.h"
-
-#include <gpgme.h>
-
-#include <vector>
-
-// avoid conflict (msvc)
-#ifdef ERROR
-# undef ERROR
-#endif
-
-using namespace GpgME;
-
-class GpgRevokeKeyEditInteractor::Private
-{
- enum {
- START = EditInteractor::StartState,
- COMMAND,
- CONFIRM_REVOKING_ENTIRE_KEY,
- REASON_CODE,
- REASON_TEXT,
- // all these free slots belong to REASON_TEXT, too; we increase state()
- // by one for each line of text, so that action() is called
- REASON_TEXT_DONE = REASON_TEXT + 1000,
- CONFIRM_REASON,
- QUIT,
- CONFIRM_SAVE,
-
- ERROR = EditInteractor::ErrorState
- };
-
- GpgRevokeKeyEditInteractor *const q = nullptr;
-
-public:
- Private(GpgRevokeKeyEditInteractor *q)
- : q{q}
- , reasonCode{"0"}
- {
- }
-
- const char *action(Error &err) const;
- unsigned int nextState(unsigned int statusCode, const char *args, Error &err);
-
- std::string reasonCode;
- std::vector<std::string> reasonLines;
- int nextLine = -1;
-};
-
-const char *GpgRevokeKeyEditInteractor::Private::action(Error &err) const
-{
- switch (const auto state = q->state()) {
- case COMMAND:
- return "revkey";
- case CONFIRM_REVOKING_ENTIRE_KEY:
- return "Y";
- case REASON_CODE:
- return reasonCode.c_str();
- case REASON_TEXT_DONE:
- return "";
- case CONFIRM_REASON:
- return "Y";
- case QUIT:
- return "quit";
- case CONFIRM_SAVE:
- return "Y";
- case START:
- return nullptr;
- default:
- if (state >= REASON_TEXT && state < REASON_TEXT_DONE) {
- return reasonLines[nextLine].c_str();
- }
- // fall through
- case ERROR:
- err = Error::fromCode(GPG_ERR_GENERAL);
- return nullptr;
- }
-}
-
-unsigned int GpgRevokeKeyEditInteractor::Private::nextState(unsigned int status, const char *args, Error &err)
-{
- using std::strcmp;
-
- static const Error GENERAL_ERROR = Error::fromCode(GPG_ERR_GENERAL);
-
- switch (const auto state = q->state()) {
- case START:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keyedit.prompt") == 0) {
- return COMMAND;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case COMMAND:
- if (status == GPGME_STATUS_GET_BOOL &&
- strcmp(args, "keyedit.revoke.subkey.okay") == 0) {
- return CONFIRM_REVOKING_ENTIRE_KEY;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case CONFIRM_REVOKING_ENTIRE_KEY:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "ask_revocation_reason.code") == 0) {
- return REASON_CODE;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case REASON_CODE:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "ask_revocation_reason.text") == 0) {
- nextLine++;
- return static_cast<std::size_t>(nextLine) < reasonLines.size() ? REASON_TEXT : REASON_TEXT_DONE;
- }
- err = GENERAL_ERROR;
- return ERROR;
- default:
- if (state >= REASON_TEXT && state < REASON_TEXT_DONE) {
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "ask_revocation_reason.text") == 0) {
- nextLine++;
- return static_cast<std::size_t>(nextLine) < reasonLines.size() ? state + 1 : REASON_TEXT_DONE;
- }
- }
- err = GENERAL_ERROR;
- return ERROR;
- case REASON_TEXT_DONE:
- if (status == GPGME_STATUS_GET_BOOL &&
- strcmp(args, "ask_revocation_reason.okay") == 0) {
- return CONFIRM_REASON;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case CONFIRM_REASON:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keyedit.prompt") == 0) {
- return QUIT;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case QUIT:
- if (status == GPGME_STATUS_GET_BOOL &&
- strcmp(args, "keyedit.save.okay") == 0) {
- return CONFIRM_SAVE;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case ERROR:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keyedit.prompt") == 0) {
- return QUIT;
- }
- err = q->lastError();
- return ERROR;
- }
-}
-
-GpgRevokeKeyEditInteractor::GpgRevokeKeyEditInteractor()
- : EditInteractor{}
- , d{new Private{this}}
-{
-}
-
-GpgRevokeKeyEditInteractor::~GpgRevokeKeyEditInteractor() = default;
-
-void GpgRevokeKeyEditInteractor::setReason(RevocationReason reason, const std::vector<std::string> &description)
-{
- d->reasonCode = std::to_string(static_cast<int>(reason));
- d->reasonLines = description;
-}
-
-const char *GpgRevokeKeyEditInteractor::action(Error &err) const
-{
- return d->action(err);
-}
-
-unsigned int GpgRevokeKeyEditInteractor::nextState(unsigned int status, const char *args, Error &err) const
-{
- return d->nextState(status, args, err);
-}
diff --git a/lang/cpp/src/gpgrevokekeyeditinteractor.h b/lang/cpp/src/gpgrevokekeyeditinteractor.h
deleted file mode 100644
index 60c764d4..00000000
--- a/lang/cpp/src/gpgrevokekeyeditinteractor.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- gpgrevokekeyeditinteractor.h - Edit Interactor to revoke own OpenPGP keys
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_GPGREVOKEKEYEDITINTERACTOR_H__
-#define __GPGMEPP_GPGREVOKEKEYEDITINTERACTOR_H__
-
-#include "editinteractor.h"
-#include "global.h"
-
-#include <memory>
-#include <string>
-#include <vector>
-
-namespace GpgME
-{
-
-/** Edit interactor to revoke the key a key edit operation is working on.
- * Supports revocation of own keys only. */
-class GPGMEPP_EXPORT GpgRevokeKeyEditInteractor : public EditInteractor
-{
-public:
- GpgRevokeKeyEditInteractor();
- ~GpgRevokeKeyEditInteractor() override;
-
- /** Sets the reason for the revocation. The reason defaults to \c Unspecified.
- * \a description can be used for adding a comment for the revocation. The
- * individual elements of \a description must be non-empty strings and they
- * must not contain any endline characters.
- */
- void setReason(RevocationReason reason, const std::vector<std::string> &description = {});
-
-private:
- const char *action(Error &err) const override;
- unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const override;
-
-private:
- class GPGMEPP_NO_EXPORT Private;
- const std::unique_ptr<Private> d;
-};
-
-} // namespace GpgME
-
-#endif // __GPGMEPP_GPGREVOKEKEYEDITINTERACTOR_H__
diff --git a/lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp b/lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp
deleted file mode 100644
index 2409ef19..00000000
--- a/lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- gpgsetexpirytimeeditinteractor.cpp - Edit Interactor to change the expiry time of an OpenPGP key
- Copyright (C) 2007 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "gpgsetexpirytimeeditinteractor.h"
-#include "error.h"
-
-#include <gpgme.h>
-
-#include <cstring>
-
-using std::strcmp;
-
-// avoid conflict (msvc)
-#ifdef ERROR
-# undef ERROR
-#endif
-
-using namespace GpgME;
-
-GpgSetExpiryTimeEditInteractor::GpgSetExpiryTimeEditInteractor(const std::string &t)
- : EditInteractor(),
- m_strtime(t)
-{
-
-}
-
-GpgSetExpiryTimeEditInteractor::~GpgSetExpiryTimeEditInteractor() {}
-
-// work around --enable-final
-namespace GpgSetExpiryTimeEditInteractor_Private
-{
-enum {
- START = EditInteractor::StartState,
- COMMAND,
- DATE,
- QUIT,
- SAVE,
-
- ERROR = EditInteractor::ErrorState
-};
-}
-
-const char *GpgSetExpiryTimeEditInteractor::action(Error &err) const
-{
-
- using namespace GpgSetExpiryTimeEditInteractor_Private;
-
- switch (state()) {
- case COMMAND:
- return "expire";
- case DATE:
- return m_strtime.c_str();
- case QUIT:
- return "quit";
- case SAVE:
- return "Y";
- case START:
- case ERROR:
- return nullptr;
- default:
- err = Error::fromCode(GPG_ERR_GENERAL);
- return nullptr;
- }
-}
-
-unsigned int GpgSetExpiryTimeEditInteractor::nextState(unsigned int status, const char *args, Error &err) const
-{
-
- static const Error GENERAL_ERROR = Error::fromCode(GPG_ERR_GENERAL);
- static const Error INV_TIME_ERROR = Error::fromCode(GPG_ERR_INV_TIME);
-
- using namespace GpgSetExpiryTimeEditInteractor_Private;
-
- switch (state()) {
- case START:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keyedit.prompt") == 0) {
- return COMMAND;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case COMMAND:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.valid") == 0) {
- return DATE;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case DATE:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keyedit.prompt") == 0) {
- return QUIT;
- } else if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keygen.valid")) {
- err = INV_TIME_ERROR;
- return ERROR;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case QUIT:
- if (status == GPGME_STATUS_GET_BOOL &&
- strcmp(args, "keyedit.save.okay") == 0) {
- return SAVE;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case ERROR:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keyedit.prompt") == 0) {
- return QUIT;
- }
- err = lastError();
- return ERROR;
- default:
- err = GENERAL_ERROR;
- return ERROR;
- }
-}
diff --git a/lang/cpp/src/gpgsetexpirytimeeditinteractor.h b/lang/cpp/src/gpgsetexpirytimeeditinteractor.h
deleted file mode 100644
index c7221bad..00000000
--- a/lang/cpp/src/gpgsetexpirytimeeditinteractor.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- gpgsetexpirytimeeditinteractor.h - Edit Interactor to change the expiry time of an OpenPGP key
- Copyright (C) 2007 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_GPGSETEXPIRYTIMEEDITINTERACTOR_H__
-#define __GPGMEPP_GPGSETEXPIRYTIMEEDITINTERACTOR_H__
-
-#include "editinteractor.h"
-
-#include <string>
-
-namespace GpgME
-{
-
-class GPGMEPP_EXPORT GpgSetExpiryTimeEditInteractor : public EditInteractor
-{
-public:
- explicit GpgSetExpiryTimeEditInteractor(const std::string &timeString = "0");
- ~GpgSetExpiryTimeEditInteractor();
-
-private:
- const char *action(Error &err) const override;
- unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const override;
-
-private:
- const std::string m_strtime;
-};
-
-} // namespace GpgME
-
-#endif // __GPGMEPP_GPGSETEXPIRYTIMEEDITINTERACTOR_H___
diff --git a/lang/cpp/src/gpgsetownertrusteditinteractor.cpp b/lang/cpp/src/gpgsetownertrusteditinteractor.cpp
deleted file mode 100644
index e28951ba..00000000
--- a/lang/cpp/src/gpgsetownertrusteditinteractor.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- gpgsetownertrusteditinteractor.cpp - Edit Interactor to change the expiry time of an OpenPGP key
- Copyright (C) 2007 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "gpgsetownertrusteditinteractor.h"
-#include "error.h"
-
-#include <gpgme.h>
-
-#include <cstring>
-
-using std::strcmp;
-
-// avoid conflict (msvc)
-#ifdef ERROR
-# undef ERROR
-#endif
-
-using namespace GpgME;
-
-GpgSetOwnerTrustEditInteractor::GpgSetOwnerTrustEditInteractor(Key::OwnerTrust ot)
- : EditInteractor(),
- m_ownertrust(ot)
-{
-
-}
-
-GpgSetOwnerTrustEditInteractor::~GpgSetOwnerTrustEditInteractor() {}
-
-// work around --enable-final
-namespace GpgSetOwnerTrustEditInteractor_Private
-{
-enum {
- START = EditInteractor::StartState,
- COMMAND,
- VALUE,
- REALLY_ULTIMATE,
- QUIT,
- SAVE,
-
- ERROR = EditInteractor::ErrorState
-};
-}
-
-const char *GpgSetOwnerTrustEditInteractor::action(Error &err) const
-{
- static const char truststrings[][2] = { "1", "1", "2", "3", "4", "5" };
-
- using namespace GpgSetOwnerTrustEditInteractor_Private;
-
- switch (state()) {
- case COMMAND:
- return "trust";
- case VALUE:
- return truststrings[m_ownertrust];
- case REALLY_ULTIMATE:
- return "Y";
- case QUIT:
- return "quit";
- case SAVE:
- return "Y";
- case START:
- case ERROR:
- return nullptr;
- default:
- err = Error::fromCode(GPG_ERR_GENERAL);
- return nullptr;
- }
-}
-
-unsigned int GpgSetOwnerTrustEditInteractor::nextState(unsigned int status, const char *args, Error &err) const
-{
-
- static const Error GENERAL_ERROR = Error::fromCode(GPG_ERR_GENERAL);
- //static const Error INV_TIME_ERROR = Error::fromCode( GPG_ERR_INV_TIME );
-
- using namespace GpgSetOwnerTrustEditInteractor_Private;
-
- switch (state()) {
- case START:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keyedit.prompt") == 0) {
- return COMMAND;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case COMMAND:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "edit_ownertrust.value") == 0) {
- return VALUE;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case VALUE:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keyedit.prompt") == 0) {
- return QUIT;
- } else if (status == GPGME_STATUS_GET_BOOL &&
- strcmp(args, "edit_ownertrust.set_ultimate.okay") == 0) {
- return REALLY_ULTIMATE;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case REALLY_ULTIMATE:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keyedit.prompt") == 0) {
- return QUIT;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case QUIT:
- if (status == GPGME_STATUS_GET_BOOL &&
- strcmp(args, "keyedit.save.okay") == 0) {
- return SAVE;
- }
- err = GENERAL_ERROR;
- return ERROR;
- case ERROR:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keyedit.prompt") == 0) {
- return QUIT;
- }
- err = lastError();
- return ERROR;
- default:
- err = GENERAL_ERROR;
- return ERROR;
- };
-}
diff --git a/lang/cpp/src/gpgsetownertrusteditinteractor.h b/lang/cpp/src/gpgsetownertrusteditinteractor.h
deleted file mode 100644
index a1ddb1ba..00000000
--- a/lang/cpp/src/gpgsetownertrusteditinteractor.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- gpgsetownertrusteditinteractor.h - Edit Interactor to change the owner trust of an OpenPGP key
- Copyright (C) 2007 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_GPGSETOWNERTRUSTEDITINTERACTOR_H__
-#define __GPGMEPP_GPGSETOWNERTRUSTEDITINTERACTOR_H__
-
-#include "editinteractor.h"
-#include "key.h"
-
-#include <string>
-
-namespace GpgME
-{
-
-class GPGMEPP_EXPORT GpgSetOwnerTrustEditInteractor : public EditInteractor
-{
-public:
- explicit GpgSetOwnerTrustEditInteractor(Key::OwnerTrust ownertrust);
- ~GpgSetOwnerTrustEditInteractor();
-
-private:
- const char *action(Error &err) const override;
- unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const override;
-
-private:
- const Key::OwnerTrust m_ownertrust;
-};
-
-} // namespace GpgME
-
-#endif // __GPGMEPP_GPGSETOWNERTRUSTEDITINTERACTOR_H__
diff --git a/lang/cpp/src/gpgsignkeyeditinteractor.cpp b/lang/cpp/src/gpgsignkeyeditinteractor.cpp
deleted file mode 100644
index 164cfc03..00000000
--- a/lang/cpp/src/gpgsignkeyeditinteractor.cpp
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- gpgsignkeyeditinteractor.cpp - Edit Interactor to change the expiry time of an OpenPGP key
- Copyright (C) 2007 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "gpgsignkeyeditinteractor.h"
-#include "error.h"
-#include "key.h"
-
-#include <gpgme.h>
-
-#include <map>
-#include <string>
-#include <sstream>
-
-#include <cassert>
-#include <cstring>
-
-using std::strcmp;
-
-// avoid conflict (msvc)
-#ifdef ERROR
-# undef ERROR
-#endif
-
-#ifdef _MSC_VER
-#undef snprintf
-#define snprintf _snprintf
-#endif
-
-using namespace GpgME;
-
-class GpgSignKeyEditInteractor::Private
-{
-public:
- Private();
-
- std::string scratch;
- bool started;
- int options;
- std::vector<unsigned int> userIDs;
- std::vector<unsigned int>::const_iterator currentId, nextId;
- unsigned int checkLevel;
- bool dupeOk;
- Key key;
- struct {
- TrustSignatureTrust trust;
- std::string depth;
- std::string scope;
- } trustSignature;
-
- const char *command() const
- {
- const bool local = (options & Exportable) == 0;
- const bool nonRevoc = options & NonRevocable;
- const bool trust = options & Trust;
- //TODO: check if all combinations are valid
- if (local && nonRevoc && trust) {
- return "ltnrsign";
- }
- if (local && nonRevoc) {
- return "lnrsign";
- }
- if (local && trust) {
- return "ltsign";
- }
- if (local) {
- return "lsign";
- }
- if (nonRevoc && trust) {
- return "tnrsign";
- }
- if (nonRevoc) {
- return "nrsign";
- }
- if (trust) {
- return "tsign";
- }
- return "sign";
- }
-
- bool signAll() const
- {
- return userIDs.empty();
- }
- unsigned int nextUserID()
- {
- assert(nextId != userIDs.end());
- currentId = nextId++;
- return currentUserID();
- }
-
- bool allUserIDsListed() const
- {
- return nextId == userIDs.end();
- }
-
- unsigned int currentUserID() const
- {
- assert(currentId != userIDs.end());
- return *currentId + 1;
- }
-
-};
-
-GpgSignKeyEditInteractor::Private::Private()
- :
- started(false),
- options(0),
- userIDs(),
- currentId(),
- nextId(),
- checkLevel(0),
- dupeOk(false),
- trustSignature{TrustSignatureTrust::None, "0", {}}
-{
-}
-
-GpgSignKeyEditInteractor::GpgSignKeyEditInteractor()
- : EditInteractor(), d(new Private)
-{
-
-}
-
-GpgSignKeyEditInteractor::~GpgSignKeyEditInteractor()
-{
- delete d;
-}
-
-// work around --enable-final
-namespace GpgSignKeyEditInteractor_Private
-{
-enum SignKeyState {
- START = EditInteractor::StartState,
- COMMAND,
- UIDS_ANSWER_SIGN_ALL,
- UIDS_LIST_SEPARATELY,
- // all these free slots belong to UIDS_LIST_SEPARATELY, too
- // (we increase state() by one for each UID, so that action() is called)
- UIDS_LIST_SEPARATELY_DONE = 1000000,
- SET_EXPIRE,
- SET_CHECK_LEVEL,
- SET_TRUST_VALUE,
- SET_TRUST_DEPTH,
- SET_TRUST_REGEXP,
- CONFIRM,
- CONFIRM2,
- DUPE_OK,
- DUPE_OK2,
- REJECT_SIGN_EXPIRED,
- QUIT,
- SAVE,
- ERROR = EditInteractor::ErrorState
-};
-
-typedef std::map<std::tuple<SignKeyState, unsigned int, std::string>, SignKeyState> TransitionMap;
-
-}
-
-static const char *answer(bool b)
-{
- return b ? "Y" : "N";
-}
-
-static GpgSignKeyEditInteractor_Private::TransitionMap makeTable()
-{
- using namespace GpgSignKeyEditInteractor_Private;
- TransitionMap tab;
- const unsigned int GET_BOOL = GPGME_STATUS_GET_BOOL;
- const unsigned int GET_LINE = GPGME_STATUS_GET_LINE;
-#define addEntry( s1, status, str, s2 ) tab[std::make_tuple( s1, status, str)] = s2
- addEntry(START, GET_LINE, "keyedit.prompt", COMMAND);
- addEntry(COMMAND, GET_BOOL, "keyedit.sign_all.okay", UIDS_ANSWER_SIGN_ALL);
- addEntry(COMMAND, GET_BOOL, "sign_uid.expired_okay", REJECT_SIGN_EXPIRED);
- addEntry(COMMAND, GET_BOOL, "sign_uid.okay", CONFIRM);
- addEntry(COMMAND, GET_BOOL, "sign_uid.local_promote_okay", CONFIRM2);
- addEntry(COMMAND, GET_BOOL, "sign_uid.dupe_okay", DUPE_OK);
- addEntry(COMMAND, GET_LINE, "trustsig_prompt.trust_value", SET_TRUST_VALUE);
- addEntry(UIDS_ANSWER_SIGN_ALL, GET_BOOL, "sign_uid.okay", CONFIRM);
- addEntry(UIDS_ANSWER_SIGN_ALL, GET_BOOL, "sign_uid.dupe_okay", DUPE_OK);
- addEntry(UIDS_ANSWER_SIGN_ALL, GET_LINE, "sign_uid.expire", SET_EXPIRE);
- addEntry(UIDS_ANSWER_SIGN_ALL, GET_LINE, "sign_uid.class", SET_CHECK_LEVEL);
- addEntry(UIDS_ANSWER_SIGN_ALL, GET_LINE, "trustsig_prompt.trust_value", SET_TRUST_VALUE);
- addEntry(SET_TRUST_VALUE, GET_LINE, "trustsig_prompt.trust_depth", SET_TRUST_DEPTH);
- addEntry(SET_TRUST_DEPTH, GET_LINE, "trustsig_prompt.trust_regexp", SET_TRUST_REGEXP);
- addEntry(SET_TRUST_REGEXP, GET_BOOL, "sign_uid.okay", CONFIRM);
- addEntry(SET_CHECK_LEVEL, GET_BOOL, "sign_uid.okay", CONFIRM);
- addEntry(SET_EXPIRE, GET_BOOL, "sign_uid.class", SET_CHECK_LEVEL);
- addEntry(CONFIRM, GET_BOOL, "sign_uid.local_promote_okay", CONFIRM);
- addEntry(DUPE_OK, GET_BOOL, "sign_uid.okay", CONFIRM);
- addEntry(DUPE_OK2, GET_BOOL, "sign_uid.okay", CONFIRM);
- addEntry(DUPE_OK, GET_LINE, "trustsig_prompt.trust_value", SET_TRUST_VALUE);
- addEntry(DUPE_OK2, GET_LINE, "trustsig_prompt.trust_value", SET_TRUST_VALUE);
- addEntry(CONFIRM, GET_BOOL, "sign_uid.okay", CONFIRM);
- addEntry(CONFIRM2, GET_BOOL, "sign_uid.okay", CONFIRM);
- addEntry(CONFIRM, GET_LINE, "keyedit.prompt", COMMAND);
- addEntry(CONFIRM, GET_LINE, "trustsig_prompt.trust_value", SET_TRUST_VALUE);
- addEntry(CONFIRM, GET_LINE, "sign_uid.expire", SET_EXPIRE);
- addEntry(CONFIRM, GET_LINE, "sign_uid.class", SET_CHECK_LEVEL);
- addEntry(UIDS_LIST_SEPARATELY_DONE, GET_BOOL, "sign_uid.local_promote_okay", CONFIRM);
- addEntry(UIDS_LIST_SEPARATELY_DONE, GET_LINE, "keyedit.prompt", COMMAND);
- addEntry(UIDS_LIST_SEPARATELY_DONE, GET_LINE, "trustsig_prompt.trust_value", SET_TRUST_VALUE);
- addEntry(UIDS_LIST_SEPARATELY_DONE, GET_LINE, "sign_uid.expire", SET_EXPIRE);
- addEntry(UIDS_LIST_SEPARATELY_DONE, GET_LINE, "sign_uid.class", SET_CHECK_LEVEL);
- addEntry(UIDS_LIST_SEPARATELY_DONE, GET_BOOL, "sign_uid.okay", CONFIRM);
- addEntry(UIDS_LIST_SEPARATELY_DONE, GET_BOOL, "sign_uid.dupe_okay", DUPE_OK);
- addEntry(DUPE_OK, GET_BOOL, "sign_uid.dupe_okay", DUPE_OK2);
- addEntry(DUPE_OK2, GET_BOOL, "sign_uid.dupe_okay", DUPE_OK);
- addEntry(CONFIRM, GET_LINE, "keyedit.prompt", QUIT);
- addEntry(REJECT_SIGN_EXPIRED, GET_LINE, "keyedit.prompt", QUIT);
- addEntry(ERROR, GET_LINE, "keyedit.prompt", QUIT);
- addEntry(QUIT, GET_BOOL, "keyedit.save.okay", SAVE);
-#undef addEntry
- return tab;
-}
-
-const char *GpgSignKeyEditInteractor::action(Error &err) const
-{
- static const char check_level_strings[][2] = { "0", "1", "2", "3" };
- using namespace GpgSignKeyEditInteractor_Private;
- using namespace std;
-
- switch (const unsigned int st = state()) {
- case COMMAND:
- return d->command();
- case UIDS_ANSWER_SIGN_ALL:
- return answer(d->signAll());
- case UIDS_LIST_SEPARATELY_DONE:
- return d->command();
- case SET_EXPIRE:
- return answer(true);
- case SET_TRUST_VALUE:
- return d->trustSignature.trust == TrustSignatureTrust::Partial ? "1" : "2";
- case SET_TRUST_DEPTH:
- return d->trustSignature.depth.c_str();
- case SET_TRUST_REGEXP:
- return d->trustSignature.scope.c_str();
- case SET_CHECK_LEVEL:
- return check_level_strings[d->checkLevel];
- case DUPE_OK:
- case DUPE_OK2:
- return answer(d->dupeOk);
- case CONFIRM2:
- case CONFIRM:
- return answer(true);
- case REJECT_SIGN_EXPIRED:
- err = Error::fromCode(GPG_ERR_KEY_EXPIRED);
- return answer(false);
- case QUIT:
- return "quit";
- case SAVE:
- return answer(true);
- default:
- if (st >= UIDS_LIST_SEPARATELY && st < UIDS_LIST_SEPARATELY_DONE) {
- std::stringstream ss;
- auto nextID = d->nextUserID();
- const char *hash;
- assert (nextID);
- if (!d->key.isNull() && (hash = d->key.userID(nextID - 1).uidhash())) {
- /* Prefer uidhash if it is available as it might happen
- * that uidattrs break the ordering of the uids in the
- * edit-key interface */
- ss << "uid " << hash;
- } else {
- ss << nextID;
- }
- d->scratch = ss.str();
- return d->scratch.c_str();
- }
- // fall through
- case ERROR:
- err = Error::fromCode(GPG_ERR_GENERAL);
- return nullptr;
- }
-}
-
-unsigned int GpgSignKeyEditInteractor::nextState(unsigned int status, const char *args, Error &err) const
-{
- d->started = true;
- using namespace GpgSignKeyEditInteractor_Private;
- static const Error GENERAL_ERROR = Error::fromCode(GPG_ERR_GENERAL);
- //static const Error INV_TIME_ERROR = Error::fromCode( GPG_ERR_INV_TIME );
- static const TransitionMap table(makeTable());
-
- using namespace GpgSignKeyEditInteractor_Private;
-
- //lookup transition in map
- const TransitionMap::const_iterator it = table.find(std::make_tuple(static_cast<SignKeyState>(state()), status, std::string(args)));
- if (it != table.end()) {
- return it->second;
- }
-
- //handle cases that cannot be handled via the map
- switch (const unsigned int st = state()) {
- case UIDS_ANSWER_SIGN_ALL:
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keyedit.prompt") == 0) {
- if (!d->signAll()) {
- return UIDS_LIST_SEPARATELY;
- }
- err = Error::fromCode(GPG_ERR_UNUSABLE_PUBKEY);
- return ERROR;
- }
- break;
- default:
- if (st >= UIDS_LIST_SEPARATELY && st < UIDS_LIST_SEPARATELY_DONE) {
- if (status == GPGME_STATUS_GET_LINE &&
- strcmp(args, "keyedit.prompt") == 0) {
- return d->allUserIDsListed() ? UIDS_LIST_SEPARATELY_DONE : st + 1 ;
- }
- }
- break;
- case CONFIRM:
- case ERROR:
- err = lastError();
- return ERROR;
- }
-
- err = GENERAL_ERROR;
- return ERROR;
-}
-void GpgSignKeyEditInteractor::setKey(const Key &key)
-{
- d->key = key;
-}
-
-void GpgSignKeyEditInteractor::setCheckLevel(unsigned int checkLevel)
-{
- assert(!d->started);
- assert(checkLevel <= 3);
- d->checkLevel = checkLevel;
-}
-
-void GpgSignKeyEditInteractor::setUserIDsToSign(const std::vector<unsigned int> &userIDsToSign)
-{
- assert(!d->started);
- d->userIDs = userIDsToSign;
- d->nextId = d->userIDs.begin();
- d->currentId = d->userIDs.end();
-
-}
-void GpgSignKeyEditInteractor::setSigningOptions(int options)
-{
- assert(!d->started);
- d->options = options;
-}
-
-void GpgSignKeyEditInteractor::setDupeOk(bool value)
-{
- assert(!d->started);
- d->dupeOk = value;
-}
-
-void GpgSignKeyEditInteractor::setTrustSignatureTrust(GpgME::TrustSignatureTrust trust)
-{
- assert(!d->started);
- assert(trust != TrustSignatureTrust::None);
- d->trustSignature.trust = trust;
-}
-
-void GpgSignKeyEditInteractor::setTrustSignatureDepth(unsigned short depth)
-{
- assert(!d->started);
- assert(depth <= 255);
- d->trustSignature.depth = std::to_string(depth);
-}
-
-void GpgSignKeyEditInteractor::setTrustSignatureScope(const std::string &scope)
-{
- assert(!d->started);
- d->trustSignature.scope = scope;
-}
diff --git a/lang/cpp/src/gpgsignkeyeditinteractor.h b/lang/cpp/src/gpgsignkeyeditinteractor.h
deleted file mode 100644
index 8b8a2b52..00000000
--- a/lang/cpp/src/gpgsignkeyeditinteractor.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- gpgsignkeyeditinteractor.h - Edit Interactor to change the owner trust of an OpenPGP key
- Copyright (C) 2008 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_GPGSIGNKEYEDITINTERACTOR_H__
-#define __GPGMEPP_GPGSIGNKEYEDITINTERACTOR_H__
-
-#include "editinteractor.h"
-
-#include <string>
-#include <vector>
-
-namespace GpgME
-{
-
-class Key;
-class UserID;
-enum class TrustSignatureTrust : char;
-
-class GPGMEPP_EXPORT GpgSignKeyEditInteractor : public EditInteractor
-{
-public:
- enum SignOption {
- Exportable = 0x1,
- NonRevocable = 0x2,
- Trust = 0x4
- };
-
- GpgSignKeyEditInteractor();
- ~GpgSignKeyEditInteractor();
-
- void setCheckLevel(unsigned int checkLevel);
- void setUserIDsToSign(const std::vector<unsigned int> &userIDsToSign);
- void setKey(const Key &key);
- void setSigningOptions(int options);
-
- /* Set this if it is ok to overwrite an existing signature. In that
- * case the context has to have the flag "extended-edit" set to 1 through
- * Context::setFlag before calling edit.*/
- void setDupeOk(bool value);
-
- void setTrustSignatureTrust(TrustSignatureTrust trust);
- void setTrustSignatureDepth(unsigned short depth);
- void setTrustSignatureScope(const std::string &scope);
-
-private:
- const char *action(Error &err) const override;
- unsigned int nextState(unsigned int statusCode, const char *args, Error &err) const override;
-
-private:
- class Private;
- Private *const d;
-};
-
-} // namespace GpgME
-
-#endif // __GPGMEPP_GPGSIGNKEYEDITINTERACTOR_H__
diff --git a/lang/cpp/src/importresult.cpp b/lang/cpp/src/importresult.cpp
deleted file mode 100644
index 0a7ad03d..00000000
--- a/lang/cpp/src/importresult.cpp
+++ /dev/null
@@ -1,395 +0,0 @@
-/*
- importresult.cpp - wraps a gpgme import result
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 <importresult.h>
-#include "result_p.h"
-
-#include <gpgme.h>
-#include <cstdlib>
-#include <cstring>
-
-#include <string.h>
-#include <strings.h>
-#include <istream>
-#include <iterator>
-
-class GpgME::ImportResult::Private
-{
-public:
- Private(const _gpgme_op_import_result &r) : res(r)
- {
- // copy recursively, using compiler-generated copy ctor.
- // We just need to handle the pointers in the structs:
- for (gpgme_import_status_t is = r.imports ; is ; is = is->next) {
- gpgme_import_status_t copy = new _gpgme_import_status(*is);
- if (is->fpr) {
- copy->fpr = strdup(is->fpr);
- }
- copy->next = nullptr;
- imports.push_back(copy);
- }
- res.imports = nullptr;
- }
- ~Private()
- {
- for (std::vector<gpgme_import_status_t>::iterator it = imports.begin() ; it != imports.end() ; ++it) {
- std::free((*it)->fpr);
- delete *it; *it = nullptr;
- }
- }
-
- _gpgme_op_import_result res;
- std::vector<gpgme_import_status_t> imports;
-};
-
-GpgME::ImportResult::ImportResult(gpgme_ctx_t ctx, int error)
- : GpgME::Result(error), d()
-{
- init(ctx);
-}
-
-GpgME::ImportResult::ImportResult(gpgme_ctx_t ctx, const Error &error)
- : GpgME::Result(error), d()
-{
- init(ctx);
-}
-
-void GpgME::ImportResult::init(gpgme_ctx_t ctx)
-{
- if (!ctx) {
- return;
- }
- gpgme_import_result_t res = gpgme_op_import_result(ctx);
- if (!res) {
- return;
- }
- d.reset(new Private(*res));
-}
-
-make_standard_stuff(ImportResult)
-
-void GpgME::ImportResult::mergeWith(const ImportResult &other)
-{
- if (other.isNull()) {
- return;
- }
- if (isNull()) { // just assign
- operator=(other);
- return;
- }
-
- // Add the numbers of considered keys; the number will be corrected when
- // merging the imports to account for duplicates
- d->res.considered += other.d->res.considered;
- // Add the numbers of keys without user ID; may count duplicates
- d->res.no_user_id += other.d->res.no_user_id;
- // Add the numbers of imported keys
- d->res.imported += other.d->res.imported;
- // Add the numbers of imported RSA keys
- d->res.imported_rsa += other.d->res.imported_rsa;
- // Add the numbers of unchanged keys; the number will be corrected when
- // merging the imports to account for keys changed by this import
- d->res.unchanged += other.d->res.unchanged;
- // Add the numbers of new user IDs
- d->res.new_user_ids += other.d->res.new_user_ids;
- // Add the numbers of new subkeys
- d->res.new_sub_keys += other.d->res.new_sub_keys;
- // Add the numbers of new signatures
- d->res.new_signatures += other.d->res.new_signatures;
- // Add the numbers of new revocations
- d->res.new_revocations += other.d->res.new_revocations;
-
- // Add the numbers of considered secret keys; the number will be corrected when
- // merging the imports to account for duplicates
- d->res.secret_read += other.d->res.secret_read;
- // Add the numbers of imported secret keys
- d->res.secret_imported += other.d->res.secret_imported;
- // Add the numbers of unchanged secret keys; the number will be corrected when
- // merging the imports to account for keys changed by this import
- d->res.secret_unchanged += other.d->res.secret_unchanged;
-
- // Add the numbers of new keys that were skipped; may count duplicates
- d->res.skipped_new_keys += other.d->res.skipped_new_keys;
- // Add the numbers of keys that were not imported; may count duplicates
- d->res.not_imported += other.d->res.not_imported;
- // Add the numbers of v3 keys that were skipped; may count duplicates
- d->res.skipped_v3_keys += other.d->res.skipped_v3_keys;
-
- // Look at the list of keys for which an import was attempted during the
- // other import to correct some of the consolidated numbers
- for (auto it = std::begin(other.d->imports), end = std::end(other.d->imports); it != end; ++it) {
- const char *fpr = (*it)->fpr;
- if (!fpr || !*fpr) {
- // we cannot derive any useful information about an import if the
- // fingerprint is null or empty
- continue;
- }
- // was this key also considered during the first import
- const auto consideredInFirstImports =
- std::any_of(std::begin(d->imports), std::end(d->imports), [fpr](const gpgme_import_status_t i) {
- return i->fpr && !strcmp(i->fpr, fpr);
- });
- // did we see this key already in the list of keys of the other import
- const auto consideredInPreviousOtherImports =
- std::any_of(std::begin(other.d->imports), it, [fpr](const gpgme_import_status_t i) {
- return i->fpr && !strcmp(i->fpr, fpr);
- });
- // was anything added to this key during the other import
- const auto changedInOtherImports =
- std::any_of(std::begin(other.d->imports), std::end(other.d->imports), [fpr](const gpgme_import_status_t i) {
- return i->fpr && !strcmp(i->fpr, fpr) && (i->status != 0);
- });
- if (consideredInFirstImports && !consideredInPreviousOtherImports) {
- // key was also considered during first import, but not before in the list of other imports
- d->res.considered -= 1;
- if (!changedInOtherImports) {
- // key was (most likely) counted as unchanged in the second import;
- // this needs to be corrected (regardless of whether it was changed in the first import)
- d->res.unchanged -= 1;
- }
- }
-
- // now do the same for the secret key counts
- const auto secretKeyConsideredInFirstImports =
- std::any_of(std::begin(d->imports), std::end(d->imports), [fpr](const gpgme_import_status_t i) {
- return i->fpr && !strcmp(i->fpr, fpr) && (i->status & GPGME_IMPORT_SECRET);
- });
- const auto secretKeyConsideredInPreviousOtherImports =
- std::any_of(std::begin(other.d->imports), it, [fpr](const gpgme_import_status_t i) {
- return i->fpr && !strcmp(i->fpr, fpr) && (i->status & GPGME_IMPORT_SECRET);
- });
- const auto secretKeyChangedInOtherImports =
- std::any_of(std::begin(other.d->imports), std::end(other.d->imports), [fpr](const gpgme_import_status_t i) {
- return i->fpr && !strcmp(i->fpr, fpr) && (i->status & GPGME_IMPORT_SECRET) && (i->status != GPGME_IMPORT_SECRET);
- });
- if (secretKeyConsideredInFirstImports && !secretKeyConsideredInPreviousOtherImports) {
- // key was also considered during first import, but not before in the list of other imports
- d->res.secret_read -= 1;
- if (!secretKeyChangedInOtherImports) {
- // key was (most likely) counted as unchanged in the second import;
- // this needs to be corrected (regardless of whether it was changed in the first import)
- d->res.secret_unchanged -= 1;
- }
- }
- }
-
- // Now append the list of keys for which an import was attempted during the
- // other import
- d->imports.reserve(d->imports.size() + other.d->imports.size());
- std::transform(std::begin(other.d->imports), std::end(other.d->imports),
- std::back_inserter(d->imports),
- [](const gpgme_import_status_t import) {
- gpgme_import_status_t copy = new _gpgme_import_status{*import};
- if (import->fpr) {
- copy->fpr = strdup(import->fpr);
- }
- copy->next = nullptr; // should already be null, but better safe than sorry
- return copy;
- });
-
- // Finally, merge the error if there was none yet
- if (!bool(error())) {
- Result::operator=(other);
- }
-}
-
-int GpgME::ImportResult::numConsidered() const
-{
- return d ? d->res.considered : 0 ;
-}
-
-int GpgME::ImportResult::numKeysWithoutUserID() const
-{
- return d ? d->res.no_user_id : 0 ;
-}
-
-int GpgME::ImportResult::numImported() const
-{
- return d ? d->res.imported : 0 ;
-}
-
-int GpgME::ImportResult::numRSAImported() const
-{
- return d ? d->res.imported_rsa : 0 ;
-}
-
-int GpgME::ImportResult::numUnchanged() const
-{
- return d ? d->res.unchanged : 0 ;
-}
-
-int GpgME::ImportResult::newUserIDs() const
-{
- return d ? d->res.new_user_ids : 0 ;
-}
-
-int GpgME::ImportResult::newSubkeys() const
-{
- return d ? d->res.new_sub_keys : 0 ;
-}
-
-int GpgME::ImportResult::newSignatures() const
-{
- return d ? d->res.new_signatures : 0 ;
-}
-
-int GpgME::ImportResult::newRevocations() const
-{
- return d ? d->res.new_revocations : 0 ;
-}
-
-int GpgME::ImportResult::numSecretKeysConsidered() const
-{
- return d ? d->res.secret_read : 0 ;
-}
-
-int GpgME::ImportResult::numSecretKeysImported() const
-{
- return d ? d->res.secret_imported : 0 ;
-}
-
-int GpgME::ImportResult::numSecretKeysUnchanged() const
-{
- return d ? d->res.secret_unchanged : 0 ;
-}
-
-int GpgME::ImportResult::notImported() const
-{
- return d ? d->res.not_imported : 0 ;
-}
-
-int GpgME::ImportResult::numV3KeysSkipped() const
-{
- return d ? d->res.skipped_v3_keys : 0 ;
-}
-
-GpgME::Import GpgME::ImportResult::import(unsigned int idx) const
-{
- return Import(d, idx);
-}
-
-std::vector<GpgME::Import> GpgME::ImportResult::imports() const
-{
- if (!d) {
- return std::vector<Import>();
- }
- std::vector<Import> result;
- result.reserve(d->imports.size());
- for (unsigned int i = 0 ; i < d->imports.size() ; ++i) {
- result.push_back(Import(d, i));
- }
- return result;
-}
-
-GpgME::Import::Import(const std::shared_ptr<ImportResult::Private> &parent, unsigned int i)
- : d(parent), idx(i)
-{
-
-}
-
-GpgME::Import::Import() : d(), idx(0) {}
-
-bool GpgME::Import::isNull() const
-{
- return !d || idx >= d->imports.size() ;
-}
-
-const char *GpgME::Import::fingerprint() const
-{
- return isNull() ? nullptr : d->imports[idx]->fpr ;
-}
-
-GpgME::Error GpgME::Import::error() const
-{
- return Error(isNull() ? 0 : d->imports[idx]->result);
-}
-
-GpgME::Import::Status GpgME::Import::status() const
-{
- if (isNull()) {
- return Unknown;
- }
- const unsigned int s = d->imports[idx]->status;
- unsigned int result = Unknown;
- if (s & GPGME_IMPORT_NEW) {
- result |= NewKey;
- }
- if (s & GPGME_IMPORT_UID) {
- result |= NewUserIDs;
- }
- if (s & GPGME_IMPORT_SIG) {
- result |= NewSignatures;
- }
- if (s & GPGME_IMPORT_SUBKEY) {
- result |= NewSubkeys;
- }
- if (s & GPGME_IMPORT_SECRET) {
- result |= ContainedSecretKey;
- }
- return static_cast<Status>(result);
-}
-
-std::ostream &GpgME::operator<<(std::ostream &os,
- const GpgME::ImportResult &result)
-{
- os << "GpgME::ImportResult(";
- if (!result.isNull()) {
- os << "\n considered: " << result.numConsidered()
- << "\n without UID: " << result.numKeysWithoutUserID()
- << "\n imported: " << result.numImported()
- << "\n RSA Imported: " << result.numRSAImported()
- << "\n unchanged: " << result.numUnchanged()
- << "\n newUserIDs: " << result.newUserIDs()
- << "\n newSubkeys: " << result.newSubkeys()
- << "\n newSignatures: " << result.newSignatures()
- << "\n newRevocations: " << result.newRevocations()
- << "\n numSecretKeysConsidered: " << result.numSecretKeysConsidered()
- << "\n numSecretKeysImported: " << result.numSecretKeysImported()
- << "\n numSecretKeysUnchanged: " << result.numSecretKeysUnchanged()
- << "\n"
- << "\n notImported: " << result.notImported()
- << "\n numV3KeysSkipped: " << result.numV3KeysSkipped()
- << "\n imports:\n";
- const std::vector<Import> imp = result.imports();
- std::copy(imp.begin(), imp.end(),
- std::ostream_iterator<Import>(os, "\n"));
- }
- return os << ')';
-}
-
-std::ostream &GpgME::operator<<(std::ostream &os, const GpgME::Import &imp)
-{
- os << "GpgME::Import(";
- if (!imp.isNull()) {
- os << "\n fpr: " << (imp.fingerprint() ? imp.fingerprint() : "null")
- << "\n status: " << imp.status()
- << "\n err: " << imp.error();
- }
- return os << ')';
-}
diff --git a/lang/cpp/src/importresult.h b/lang/cpp/src/importresult.h
deleted file mode 100644
index a2749331..00000000
--- a/lang/cpp/src/importresult.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- importresult.h - wraps a gpgme import result
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_IMPORTRESULT_H__
-#define __GPGMEPP_IMPORTRESULT_H__
-
-#include "gpgmefw.h"
-#include "result.h"
-#include "gpgmepp_export.h"
-
-#include <memory>
-
-#include <vector>
-
-namespace GpgME
-{
-
-class Error;
-class Import;
-
-class GPGMEPP_EXPORT ImportResult : public Result
-{
-public:
- ImportResult();
- ImportResult(gpgme_ctx_t ctx, int error);
- ImportResult(gpgme_ctx_t ctx, const Error &error);
- explicit ImportResult(const Error &error);
-
- ImportResult(const ImportResult &other) = default;
- const ImportResult &operator=(ImportResult other)
- {
- swap(other);
- return *this;
- }
-
- void swap(ImportResult &other)
- {
- Result::swap(other);
- using std::swap;
- swap(this->d, other.d);
- }
-
- /**
- * Merges the result @p other into this result (and all of its copies).
- *
- * @note The merge algorithm assumes that @p other is the result of an
- * import that was performed after the import of this result.
- * @note Some numbers cannot be consolidated reliably, e.g. the number of
- * keys without user ID.
- */
- void mergeWith(const ImportResult &other);
-
- bool isNull() const;
-
- int numConsidered() const;
- int numKeysWithoutUserID() const;
- int numImported() const;
- int numRSAImported() const;
- int numUnchanged() const;
-
- int newUserIDs() const;
- int newSubkeys() const;
- int newSignatures() const;
- int newRevocations() const;
-
- int numSecretKeysConsidered() const;
- int numSecretKeysImported() const;
- int numSecretKeysUnchanged() const;
-
- int notImported() const;
- int numV3KeysSkipped() const;
-
- Import import(unsigned int idx) const;
- std::vector<Import> imports() const;
-
- class Private;
-private:
- void init(gpgme_ctx_t ctx);
- std::shared_ptr<Private> d;
-};
-
-class GPGMEPP_EXPORT Import
-{
- friend class ::GpgME::ImportResult;
- Import(const std::shared_ptr<ImportResult::Private> &parent, unsigned int idx);
-public:
- Import();
-
- Import(const Import &other) = default;
- const Import &operator=(Import other)
- {
- swap(other);
- return *this;
- }
-
- void swap(Import &other)
- {
- using std::swap;
- swap(this->d, other.d);
- swap(this->idx, other.idx);
- }
-
- bool isNull() const;
-
- const char *fingerprint() const;
- Error error() const;
-
- enum Status {
- Unknown = 0x0,
- NewKey = 0x1,
- NewUserIDs = 0x2,
- NewSignatures = 0x4,
- NewSubkeys = 0x8,
- ContainedSecretKey = 0x10
- };
- Status status() const;
-
-private:
- std::shared_ptr<ImportResult::Private> d;
- unsigned int idx;
-};
-
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const ImportResult &irs);
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const Import &imp);
-
-} // namespace GpgME
-
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(ImportResult)
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(Import)
-
-#endif // __GPGMEPP_IMPORTRESULT_H__
diff --git a/lang/cpp/src/interfaces/assuantransaction.h b/lang/cpp/src/interfaces/assuantransaction.h
deleted file mode 100644
index 35682f55..00000000
--- a/lang/cpp/src/interfaces/assuantransaction.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- assuantransaction.h - Interface for ASSUAN transactions
- Copyright (C) 2009 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH <[email protected]>
- Author: Marc Mutz <[email protected]>
-
- 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_INTERFACES_ASSUANTRANSACTION_H__
-#define __GPGMEPP_INTERFACES_ASSUANTRANSACTION_H__
-
-#include "../gpgmepp_export.h"
-
-#include <stddef.h>
-
-namespace GpgME
-{
-
-class Error;
-class Data;
-
-class GPGMEPP_EXPORT AssuanTransaction
-{
-public:
- virtual ~AssuanTransaction() {}
-
- virtual Error data(const char *data, size_t datalen) = 0;
- virtual Data inquire(const char *name, const char *args, Error &err) = 0;
- virtual Error status(const char *status, const char *args) = 0;
-};
-
-} // namespace GpgME
-
-#endif // __GPGMEPP_INTERFACES_ASSUANTRANSACTION_H__
diff --git a/lang/cpp/src/interfaces/dataprovider.h b/lang/cpp/src/interfaces/dataprovider.h
deleted file mode 100644
index 22dc459b..00000000
--- a/lang/cpp/src/interfaces/dataprovider.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- interface/dataprovider.h - Interface for data sources
- Copyright (C) 2003 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_INTERFACES_DATAPROVIDER_H__
-#define __GPGMEPP_INTERFACES_DATAPROVIDER_H__
-
-#include <sys/types.h>
-
-#include "../gpgmepp_export.h"
-
-#include <gpg-error.h>
-
-namespace GpgME
-{
-
-class GPGMEPP_EXPORT DataProvider
-{
-public:
- virtual ~DataProvider() {}
-
- enum Operation {
- Read, Write, Seek, Release
- };
- virtual bool isSupported(Operation op) const = 0;
-
- virtual ssize_t read(void *buffer, size_t bufSize) = 0;
- virtual ssize_t write(const void *buffer, size_t bufSize) = 0;
- virtual off_t seek(off_t offset, int whence) = 0;
- virtual void release() = 0;
-};
-
-} // namespace GpgME
-
-#endif // __GPGMEPP_INTERFACES_DATAPROVIDER_H__
diff --git a/lang/cpp/src/interfaces/passphraseprovider.h b/lang/cpp/src/interfaces/passphraseprovider.h
deleted file mode 100644
index c97aa542..00000000
--- a/lang/cpp/src/interfaces/passphraseprovider.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- interface/passphraseprovider.h - Interface for passphrase callbacks
- Copyright (C) 2003,2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_INTERFACES_PASSPHRASEPROVIDER_H__
-#define __GPGMEPP_INTERFACES_PASSPHRASEPROVIDER_H__
-
-namespace GpgME
-{
-
-class PassphraseProvider
-{
-public:
- virtual ~PassphraseProvider() {}
-
- virtual char *getPassphrase(const char *useridHint, const char *description,
- bool previousWasBad, bool &canceled) = 0;
-};
-
-} // namespace GpgME
-
-#endif // __GPGMEPP_INTERFACES_PASSPHRASEPROVIDER_H__
diff --git a/lang/cpp/src/interfaces/progressprovider.h b/lang/cpp/src/interfaces/progressprovider.h
deleted file mode 100644
index ef4ca3cf..00000000
--- a/lang/cpp/src/interfaces/progressprovider.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- interface/progressprovider.h - Interface for progress reports
- Copyright (C) 2003 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_INTERFACES_PROGRESSPROVIDER_H__
-#define __GPGMEPP_INTERFACES_PROGRESSPROVIDER_H__
-
-namespace GpgME
-{
-
-class ProgressProvider
-{
-public:
- virtual ~ProgressProvider() {}
-
- virtual void showProgress(const char *what, int type,
- int current, int total) = 0;
-};
-
-} // namespace GpgME
-
-#endif // __GPGMEPP_INTERFACES_PROGRESSPROVIDER_H__
diff --git a/lang/cpp/src/interfaces/statusconsumer.h b/lang/cpp/src/interfaces/statusconsumer.h
deleted file mode 100644
index 65e7ea4a..00000000
--- a/lang/cpp/src/interfaces/statusconsumer.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- statusconsumer.h - Interface for status callbacks
- Copyright (c) 2020 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_INTERFACES_STATUSCONSUMER_H__
-#define __GPGMEPP_INTERFACES_STATUSCONSUMER_H__
-
-#include "../gpgmepp_export.h"
-
-namespace GpgME
-{
-
-class GPGMEPP_EXPORT StatusConsumer
-{
-public:
- virtual ~StatusConsumer() {}
-
- virtual void status(const char *status, const char *details) = 0;
-};
-
-} // namespace GpgME
-
-#endif // __GPGMEPP_INTERFACES_STATUSCONSUMER_H__
diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp
deleted file mode 100644
index 42046aa0..00000000
--- a/lang/cpp/src/key.cpp
+++ /dev/null
@@ -1,1455 +0,0 @@
-/*
- key.cpp - wraps a gpgme key
- Copyright (C) 2003, 2005 Klarälvdalens Datakonsult AB
-
- 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 <key.h>
-
-#include "util.h"
-#include "tofuinfo.h"
-#include "context.h"
-#include "engineinfo.h"
-
-#include <gpgme.h>
-
-#include <string.h>
-#include <strings.h>
-#include <cassert>
-#include <istream>
-#include <iterator>
-
-const GpgME::Key::Null GpgME::Key::null;
-
-namespace GpgME
-{
-
-Key::Key() : key() {}
-
-Key::Key(const Null &) : key() {}
-
-Key::Key(const shared_gpgme_key_t &k) : key(k) {}
-
-Key::Key(gpgme_key_t k, bool ref)
- : key(k
- ? shared_gpgme_key_t(k, &gpgme_key_unref)
- : shared_gpgme_key_t())
-{
- if (ref && impl()) {
- gpgme_key_ref(impl());
- }
-}
-
-UserID Key::userID(unsigned int index) const
-{
- return UserID(key, index);
-}
-
-Subkey Key::subkey(unsigned int index) const
-{
- return Subkey(key, index);
-}
-
-unsigned int Key::numUserIDs() const
-{
- if (!key) {
- return 0;
- }
- unsigned int count = 0;
- for (gpgme_user_id_t uid = key->uids ; uid ; uid = uid->next) {
- ++count;
- }
- return count;
-}
-
-unsigned int Key::numSubkeys() const
-{
- if (!key) {
- return 0;
- }
- unsigned int count = 0;
- for (gpgme_sub_key_t subkey = key->subkeys ; subkey ; subkey = subkey->next) {
- ++count;
- }
- return count;
-}
-
-std::vector<UserID> Key::userIDs() const
-{
- if (!key) {
- return std::vector<UserID>();
- }
-
- std::vector<UserID> v;
- v.reserve(numUserIDs());
- for (gpgme_user_id_t uid = key->uids ; uid ; uid = uid->next) {
- v.push_back(UserID(key, uid));
- }
- return v;
-}
-
-std::vector<Subkey> Key::subkeys() const
-{
- if (!key) {
- return std::vector<Subkey>();
- }
-
- std::vector<Subkey> v;
- v.reserve(numSubkeys());
- for (gpgme_sub_key_t subkey = key->subkeys ; subkey ; subkey = subkey->next) {
- v.push_back(Subkey(key, subkey));
- }
- return v;
-}
-
-RevocationKey Key::revocationKey(unsigned int index) const
-{
- return RevocationKey(key, index);
-}
-
-unsigned int Key::numRevocationKeys() const
-{
- if (!key) {
- return 0;
- }
- unsigned int count = 0;
- for (auto revkey = key->revocation_keys; revkey; revkey = revkey->next) {
- ++count;
- }
- return count;
-}
-
-std::vector<RevocationKey> Key::revocationKeys() const
-{
- if (!key) {
- return std::vector<RevocationKey>();
- }
-
- std::vector<RevocationKey> v;
- v.reserve(numRevocationKeys());
- for (auto revkey = key->revocation_keys; revkey; revkey = revkey->next) {
- v.push_back(RevocationKey(key, revkey));
- }
- return v;
-}
-
-Key::OwnerTrust Key::ownerTrust() const
-{
- if (!key) {
- return Unknown;
- }
- switch (key->owner_trust) {
- default:
- case GPGME_VALIDITY_UNKNOWN: return Unknown;
- case GPGME_VALIDITY_UNDEFINED: return Undefined;
- case GPGME_VALIDITY_NEVER: return Never;
- case GPGME_VALIDITY_MARGINAL: return Marginal;
- case GPGME_VALIDITY_FULL: return Full;
- case GPGME_VALIDITY_ULTIMATE: return Ultimate;
- }
-}
-char Key::ownerTrustAsString() const
-{
- if (!key) {
- return '?';
- }
- switch (key->owner_trust) {
- default:
- case GPGME_VALIDITY_UNKNOWN: return '?';
- case GPGME_VALIDITY_UNDEFINED: return 'q';
- case GPGME_VALIDITY_NEVER: return 'n';
- case GPGME_VALIDITY_MARGINAL: return 'm';
- case GPGME_VALIDITY_FULL: return 'f';
- case GPGME_VALIDITY_ULTIMATE: return 'u';
- }
-}
-
-Protocol Key::protocol() const
-{
- if (!key) {
- return UnknownProtocol;
- }
- switch (key->protocol) {
- case GPGME_PROTOCOL_CMS: return CMS;
- case GPGME_PROTOCOL_OpenPGP: return OpenPGP;
- default: return UnknownProtocol;
- }
-}
-
-const char *Key::protocolAsString() const
-{
- return key ? gpgme_get_protocol_name(key->protocol) : nullptr ;
-}
-
-bool Key::isRevoked() const
-{
- return key && key->revoked;
-}
-
-bool Key::isExpired() const
-{
- return key && key->expired;
-}
-
-bool Key::isDisabled() const
-{
- return key && key->disabled;
-}
-
-bool Key::isInvalid() const
-{
- return key && key->invalid;
-}
-
-bool Key::hasSecret() const
-{
- return key && key->secret;
-}
-
-bool Key::isRoot() const
-{
- return key && key->subkeys && key->subkeys->fpr && key->chain_id &&
- strcasecmp(key->subkeys->fpr, key->chain_id) == 0;
-}
-
-bool Key::canEncrypt() const
-{
- return key && key->can_encrypt;
-}
-
-bool Key::canSign() const
-{
- return key && key->can_sign;
-}
-
-bool Key::canReallySign() const
-{
- return canSign();
-}
-
-bool Key::canCertify() const
-{
- return key && key->can_certify;
-}
-
-bool Key::canAuthenticate() const
-{
- return key && key->can_authenticate;
-}
-
-bool Key::isQualified() const
-{
- return key && key->is_qualified;
-}
-
-bool Key::isDeVs() const
-{
- if (!key || !key->subkeys) {
- return false;
- }
- for (gpgme_sub_key_t subkey = key->subkeys ; subkey ; subkey = subkey->next) {
- if (!subkey->is_de_vs) {
- return false;
- }
- }
- return true;
-}
-
-bool Key::isBetaCompliance() const
-{
- if (!key || !key->subkeys) {
- return false;
- }
- for (gpgme_sub_key_t subkey = key->subkeys ; subkey ; subkey = subkey->next) {
- if (!subkey->beta_compliance) {
- return false;
- }
- }
- return true;
-}
-
-bool Key::hasCertify() const
-{
- return key && key->has_certify;
-}
-
-bool Key::hasSign() const
-{
- return key && key->has_sign;
-}
-
-bool Key::hasEncrypt() const
-{
- return key && key->has_encrypt;
-}
-
-bool Key::hasAuthenticate() const
-{
- return key && key->has_authenticate;
-}
-
-const char *Key::issuerSerial() const
-{
- return key ? key->issuer_serial : nullptr ;
-}
-const char *Key::issuerName() const
-{
- return key ? key->issuer_name : nullptr ;
-}
-const char *Key::chainID() const
-{
- return key ? key->chain_id : nullptr ;
-}
-
-const char *Key::keyID() const
-{
- return key && key->subkeys ? key->subkeys->keyid : nullptr ;
-}
-
-const char *Key::shortKeyID() const
-{
- if (!key || !key->subkeys || !key->subkeys->keyid) {
- return nullptr;
- }
- const int len = strlen(key->subkeys->keyid);
- if (len > 8) {
- return key->subkeys->keyid + len - 8; // return the last 8 bytes (in hex notation)
- } else {
- return key->subkeys->keyid;
- }
-}
-
-const char *Key::primaryFingerprint() const
-{
- if (!key) {
- return nullptr;
- }
- if (key->fpr) {
- /* Return what gpgme thinks is the primary fingerprint */
- return key->fpr;
- }
- if (key->subkeys) {
- /* Return the first subkeys fingerprint */
- return key->subkeys->fpr;
- }
- return nullptr;
-}
-
-unsigned int Key::keyListMode() const
-{
- return key ? convert_from_gpgme_keylist_mode_t(key->keylist_mode) : 0;
-}
-
-const Key &Key::mergeWith(const Key &other)
-{
- // ### incomplete. Just merges has* and can*, nothing else atm
- // ### detach also missing
-
- if (!this->primaryFingerprint() ||
- !other.primaryFingerprint() ||
- strcasecmp(this->primaryFingerprint(), other.primaryFingerprint()) != 0) {
- return *this; // only merge the Key object which describe the same key
- }
-
- const gpgme_key_t me = impl();
- const gpgme_key_t him = other.impl();
-
- if (!me || !him) {
- return *this;
- }
-
- me->revoked |= him->revoked;
- me->expired |= him->expired;
- me->disabled |= him->disabled;
- me->invalid |= him->invalid;
- me->can_encrypt |= him->can_encrypt;
- me->can_sign |= him->can_sign;
- me->can_certify |= him->can_certify;
- me->secret |= him->secret;
- me->can_authenticate |= him->can_authenticate;
- me->is_qualified |= him->is_qualified;
- me->keylist_mode |= him->keylist_mode;
-
- // make sure the gpgme_sub_key_t::is_cardkey flag isn't lost:
- for (gpgme_sub_key_t mysk = me->subkeys ; mysk ; mysk = mysk->next) {
- for (gpgme_sub_key_t hissk = him->subkeys ; hissk ; hissk = hissk->next) {
- if (strcmp(mysk->fpr, hissk->fpr) == 0) {
- mysk->is_cardkey |= hissk->is_cardkey;
- mysk->secret |= hissk->secret;
- if (hissk->keygrip && !mysk->keygrip) {
- mysk->keygrip = strdup(hissk->keygrip);
- }
- break;
- }
- }
- }
-
- return *this;
-}
-
-void Key::update()
-{
- if (isNull() || !primaryFingerprint()) {
- return;
- }
- auto ctx = Context::createForProtocol(protocol());
- if (!ctx) {
- return;
- }
- ctx->setKeyListMode(KeyListMode::Local |
- KeyListMode::Signatures |
- KeyListMode::SignatureNotations |
- KeyListMode::Validate |
- KeyListMode::WithTofu |
- KeyListMode::WithKeygrip |
- KeyListMode::WithSecret);
- Error err;
- Key newKey;
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.0") {
- newKey = ctx->key(primaryFingerprint(), err, true);
- // Not secret so we get the information from the pubring.
- if (newKey.isNull()) {
- newKey = ctx->key(primaryFingerprint(), err, false);
- }
- } else {
- newKey = ctx->key(primaryFingerprint(), err, false);
- }
- delete ctx;
- if (err) {
- return;
- }
- swap(newKey);
-}
-
-// static
-Key Key::locate(const char *mbox)
-{
- if (!mbox) {
- return Key();
- }
-
- auto ctx = Context::createForProtocol(OpenPGP);
- if (!ctx) {
- return Key();
- }
-
- ctx->setKeyListMode (Extern | Local);
-
- Error e = ctx->startKeyListing (mbox);
- auto ret = ctx->nextKey (e);
- delete ctx;
-
- return ret;
-}
-
-//
-//
-// class Subkey
-//
-//
-
-static gpgme_sub_key_t find_subkey(const shared_gpgme_key_t &key, unsigned int idx)
-{
- if (key) {
- for (gpgme_sub_key_t s = key->subkeys ; s ; s = s->next, --idx) {
- if (idx == 0) {
- return s;
- }
- }
- }
- return nullptr;
-}
-
-static gpgme_sub_key_t verify_subkey(const shared_gpgme_key_t &key, gpgme_sub_key_t subkey)
-{
- if (key) {
- for (gpgme_sub_key_t s = key->subkeys ; s ; s = s->next) {
- if (s == subkey) {
- return subkey;
- }
- }
- }
- return nullptr;
-}
-
-Subkey::Subkey() : key(), subkey(nullptr) {}
-
-Subkey::Subkey(const shared_gpgme_key_t &k, unsigned int idx)
- : key(k), subkey(find_subkey(k, idx))
-{
-
-}
-
-Subkey::Subkey(const shared_gpgme_key_t &k, gpgme_sub_key_t sk)
- : key(k), subkey(verify_subkey(k, sk))
-{
-
-}
-
-Key Subkey::parent() const
-{
- return Key(key);
-}
-
-const char *Subkey::keyID() const
-{
- return subkey ? subkey->keyid : nullptr ;
-}
-
-const char *Subkey::fingerprint() const
-{
- return subkey ? subkey->fpr : nullptr ;
-}
-
-Subkey::PubkeyAlgo Subkey::publicKeyAlgorithm() const
-{
- return subkey ? static_cast<PubkeyAlgo>(subkey->pubkey_algo) : AlgoUnknown;
-}
-
-const char *Subkey::publicKeyAlgorithmAsString() const
-{
- return gpgme_pubkey_algo_name(subkey ? subkey->pubkey_algo : (gpgme_pubkey_algo_t)0);
-}
-
-/* static */
-const char *Subkey::publicKeyAlgorithmAsString(PubkeyAlgo algo)
-{
- if (algo == AlgoUnknown) {
- return NULL;
- }
- return gpgme_pubkey_algo_name(static_cast<gpgme_pubkey_algo_t>(algo));
-}
-
-std::string Subkey::algoName() const
-{
- char *gpgmeStr;
- if (subkey && (gpgmeStr = gpgme_pubkey_algo_string(subkey))) {
- std::string ret = std::string(gpgmeStr);
- gpgme_free(gpgmeStr);
- return ret;
- }
- return std::string();
-}
-
-bool Subkey::canEncrypt() const
-{
- return subkey && subkey->can_encrypt;
-}
-
-bool Subkey::canSign() const
-{
- return subkey && subkey->can_sign;
-}
-
-bool Subkey::canCertify() const
-{
- return subkey && subkey->can_certify;
-}
-
-bool Subkey::canAuthenticate() const
-{
- return subkey && subkey->can_authenticate;
-}
-
-bool Subkey::canRenc() const
-{
- return subkey && subkey->can_renc;
-}
-
-bool Subkey::canTimestamp() const
-{
- return subkey && subkey->can_timestamp;
-}
-
-bool Subkey::isGroupOwned() const
-{
- return subkey && subkey->is_group_owned;
-}
-
-bool Subkey::isQualified() const
-{
- return subkey && subkey->is_qualified;
-}
-
-bool Subkey::isDeVs() const
-{
- return subkey && subkey->is_de_vs;
-}
-
-bool Subkey::isBetaCompliance() const
-{
- return subkey && subkey->beta_compliance;
-}
-
-bool Subkey::isCardKey() const
-{
- return subkey && subkey->is_cardkey;
-}
-
-const char *Subkey::cardSerialNumber() const
-{
- return subkey ? subkey->card_number : nullptr;
-}
-
-const char *Subkey::keyGrip() const
-{
- return subkey ? subkey->keygrip : nullptr;
-}
-
-bool Subkey::isSecret() const
-{
- return subkey && subkey->secret;
-}
-
-unsigned int Subkey::length() const
-{
- return subkey ? subkey->length : 0 ;
-}
-
-time_t Subkey::creationTime() const
-{
- return static_cast<time_t>(subkey ? subkey->timestamp : 0);
-}
-
-time_t Subkey::expirationTime() const
-{
- return static_cast<time_t>(subkey ? subkey->expires : 0);
-}
-
-bool Subkey::neverExpires() const
-{
- return expirationTime() == time_t(0);
-}
-
-bool Subkey::isRevoked() const
-{
- return subkey && subkey->revoked;
-}
-
-bool Subkey::isInvalid() const
-{
- return subkey && subkey->invalid;
-}
-
-bool Subkey::isExpired() const
-{
- return subkey && subkey->expired;
-}
-
-bool Subkey::isDisabled() const
-{
- return subkey && subkey->disabled;
-}
-
-//
-//
-// class UserID
-//
-//
-
-static gpgme_user_id_t find_uid(const shared_gpgme_key_t &key, unsigned int idx)
-{
- if (key) {
- for (gpgme_user_id_t u = key->uids ; u ; u = u->next, --idx) {
- if (idx == 0) {
- return u;
- }
- }
- }
- return nullptr;
-}
-
-static gpgme_user_id_t verify_uid(const shared_gpgme_key_t &key, gpgme_user_id_t uid)
-{
- if (key) {
- for (gpgme_user_id_t u = key->uids ; u ; u = u->next) {
- if (u == uid) {
- return uid;
- }
- }
- }
- return nullptr;
-}
-
-UserID::UserID() : key(), uid(nullptr) {}
-
-UserID::UserID(const shared_gpgme_key_t &k, gpgme_user_id_t u)
- : key(k), uid(verify_uid(k, u))
-{
-
-}
-
-UserID::UserID(const shared_gpgme_key_t &k, unsigned int idx)
- : key(k), uid(find_uid(k, idx))
-{
-
-}
-
-Key UserID::parent() const
-{
- return Key(key);
-}
-
-UserID::Signature UserID::signature(unsigned int index) const
-{
- return Signature(key, uid, index);
-}
-
-unsigned int UserID::numSignatures() const
-{
- if (!uid) {
- return 0;
- }
- unsigned int count = 0;
- for (gpgme_key_sig_t sig = uid->signatures ; sig ; sig = sig->next) {
- ++count;
- }
- return count;
-}
-
-std::vector<UserID::Signature> UserID::signatures() const
-{
- if (!uid) {
- return std::vector<Signature>();
- }
-
- std::vector<Signature> v;
- v.reserve(numSignatures());
- for (gpgme_key_sig_t sig = uid->signatures ; sig ; sig = sig->next) {
- v.push_back(Signature(key, uid, sig));
- }
- return v;
-}
-
-const char *UserID::id() const
-{
- return uid ? uid->uid : nullptr ;
-}
-
-const char *UserID::name() const
-{
- return uid ? uid->name : nullptr ;
-}
-
-const char *UserID::email() const
-{
- return uid ? uid->email : nullptr ;
-}
-
-const char *UserID::comment() const
-{
- return uid ? uid->comment : nullptr ;
-}
-
-const char *UserID::uidhash() const
-{
- return uid ? uid->uidhash : nullptr ;
-}
-
-UserID::Validity UserID::validity() const
-{
- if (!uid) {
- return Unknown;
- }
- switch (uid->validity) {
- default:
- case GPGME_VALIDITY_UNKNOWN: return Unknown;
- case GPGME_VALIDITY_UNDEFINED: return Undefined;
- case GPGME_VALIDITY_NEVER: return Never;
- case GPGME_VALIDITY_MARGINAL: return Marginal;
- case GPGME_VALIDITY_FULL: return Full;
- case GPGME_VALIDITY_ULTIMATE: return Ultimate;
- }
-}
-
-char UserID::validityAsString() const
-{
- if (!uid) {
- return '?';
- }
- switch (uid->validity) {
- default:
- case GPGME_VALIDITY_UNKNOWN: return '?';
- case GPGME_VALIDITY_UNDEFINED: return 'q';
- case GPGME_VALIDITY_NEVER: return 'n';
- case GPGME_VALIDITY_MARGINAL: return 'm';
- case GPGME_VALIDITY_FULL: return 'f';
- case GPGME_VALIDITY_ULTIMATE: return 'u';
- }
-}
-
-bool UserID::isRevoked() const
-{
- return uid && uid->revoked;
-}
-
-bool UserID::isInvalid() const
-{
- return uid && uid->invalid;
-}
-
-TofuInfo UserID::tofuInfo() const
-{
- if (!uid) {
- return TofuInfo();
- }
- return TofuInfo(uid->tofu);
-}
-
-static gpgme_key_sig_t find_last_valid_sig_for_keyid (gpgme_user_id_t uid,
- const char *keyid)
-{
- if (!keyid) {
- return nullptr;
- }
- gpgme_key_sig_t ret = NULL;
- for (gpgme_key_sig_t s = uid->signatures ; s ; s = s->next) {
- if (s->keyid && !strcmp(keyid, s->keyid)) {
- if (!s->expired && !s->revoked && !s->invalid && !s->status) {
- if (!ret) {
- ret = s;
- } else if (ret && ret->timestamp <= s->timestamp) {
- /* Equals because when the timestamps are the same we prefer
- the last in the list */
- ret = s;
- }
- }
- }
- }
- return ret;
-}
-
-const char *UserID::remark(const Key &remarker, Error &err) const
-{
- if (!uid || remarker.isNull()) {
- err = Error::fromCode(GPG_ERR_GENERAL);
- return nullptr;
- }
-
- if (key->protocol != GPGME_PROTOCOL_OpenPGP) {
- return nullptr;
- }
-
- if (!(key->keylist_mode & GPGME_KEYLIST_MODE_SIG_NOTATIONS) ||
- !(key->keylist_mode & GPGME_KEYLIST_MODE_SIGS)) {
- err = Error::fromCode(GPG_ERR_NO_DATA);
- return nullptr;
- }
-
- gpgme_key_sig_t s = find_last_valid_sig_for_keyid(uid, remarker.keyID());
-
- if (!s) {
- return nullptr;
- }
-
- for (gpgme_sig_notation_t n = s->notations; n ; n = n->next) {
- if (n->name && !strcmp(n->name, "[email protected]")) {
- return n->value;
- }
- }
- return nullptr;
-}
-
-std::vector<std::string> UserID::remarks(std::vector<Key> keys, Error &err) const
-{
- std::vector<std::string> ret;
-
- for (const auto &key: keys) {
- const char *rem = remark(key, err);
- if (err) {
- return ret;
- }
- if (rem) {
- ret.push_back(rem);
- }
- }
- return ret;
-}
-
-//
-//
-// class Signature
-//
-//
-
-static gpgme_key_sig_t find_signature(gpgme_user_id_t uid, unsigned int idx)
-{
- if (uid) {
- for (gpgme_key_sig_t s = uid->signatures ; s ; s = s->next, --idx) {
- if (idx == 0) {
- return s;
- }
- }
- }
- return nullptr;
-}
-
-static gpgme_key_sig_t verify_signature(gpgme_user_id_t uid, gpgme_key_sig_t sig)
-{
- if (uid) {
- for (gpgme_key_sig_t s = uid->signatures ; s ; s = s->next) {
- if (s == sig) {
- return sig;
- }
- }
- }
- return nullptr;
-}
-
-static int signature_index(gpgme_user_id_t uid, gpgme_key_sig_t sig)
-{
- if (uid) {
- int i = 0;
- for (gpgme_key_sig_t s = uid->signatures ; s ; s = s->next, ++i) {
- if (s == sig) {
- return i;
- }
- }
- }
- return -1;
-}
-
-UserID::Signature::Signature() : key(), uid(nullptr), sig(nullptr) {}
-
-UserID::Signature::Signature(const shared_gpgme_key_t &k, gpgme_user_id_t u, unsigned int idx)
- : key(k), uid(verify_uid(k, u)), sig(find_signature(uid, idx))
-{
-}
-
-UserID::Signature::Signature(const shared_gpgme_key_t &k, gpgme_user_id_t u, gpgme_key_sig_t s)
- : key(k), uid(verify_uid(k, u)), sig(verify_signature(uid, s))
-{
-}
-
-bool UserID::Signature::operator<(const Signature &other)
-{
- // kept for binary compatibility
- return static_cast<const UserID::Signature *>(this)->operator<(other);
-}
-
-bool UserID::Signature::operator<(const Signature &other) const
-{
- // based on cmp_signodes() in g10/keylist.c
-
- // both signatures must belong to the same user ID
- assert(uid == other.uid);
-
- // self-signatures are ordered first
- const char *primaryKeyId = parent().parent().keyID();
- const bool thisIsSelfSignature = strcmp(signerKeyID(), primaryKeyId) == 0;
- const bool otherIsSelfSignature = strcmp(other.signerKeyID(), primaryKeyId) == 0;
- if (thisIsSelfSignature && !otherIsSelfSignature) {
- return true;
- }
- if (otherIsSelfSignature && !thisIsSelfSignature) {
- return false;
- }
-
- // then sort by signer key ID (which are or course the same for self-sigs)
- const int keyIdComparison = strcmp(signerKeyID(), other.signerKeyID());
- if (keyIdComparison < 0) {
- return true;
- }
- if (keyIdComparison > 0) {
- return false;
- }
-
- // followed by creation time
- if (creationTime() < other.creationTime()) {
- return true;
- }
- if (creationTime() > other.creationTime()) {
- return false;
- }
-
- // followed by the class in a way that a rev comes first
- if (certClass() < other.certClass()) {
- return true;
- }
- if (certClass() > other.certClass()) {
- return false;
- }
-
- // to make the sort stable we compare the indexes of the signatures as last resort
- return signature_index(uid, sig) < signature_index(uid, other.sig);
-}
-
-UserID UserID::Signature::parent() const
-{
- return UserID(key, uid);
-}
-
-const char *UserID::Signature::signerKeyID() const
-{
- return sig ? sig->keyid : nullptr ;
-}
-
-const char *UserID::Signature::algorithmAsString() const
-{
- return gpgme_pubkey_algo_name(sig ? sig->pubkey_algo : (gpgme_pubkey_algo_t)0);
-}
-
-unsigned int UserID::Signature::algorithm() const
-{
- return sig ? sig->pubkey_algo : 0 ;
-}
-
-time_t UserID::Signature::creationTime() const
-{
- return static_cast<time_t>(sig ? sig->timestamp : 0);
-}
-
-time_t UserID::Signature::expirationTime() const
-{
- return static_cast<time_t>(sig ? sig->expires : 0);
-}
-
-bool UserID::Signature::neverExpires() const
-{
- return expirationTime() == time_t(0);
-}
-
-bool UserID::Signature::isRevokation() const
-{
- return sig && sig->revoked;
-}
-
-bool UserID::Signature::isInvalid() const
-{
- return sig && sig->invalid;
-}
-
-bool UserID::Signature::isExpired() const
-{
- return sig && sig->expired;
-}
-
-bool UserID::Signature::isExportable() const
-{
- return sig && sig->exportable;
-}
-
-const char *UserID::Signature::signerUserID() const
-{
- return sig ? sig->uid : nullptr ;
-}
-
-const char *UserID::Signature::signerName() const
-{
- return sig ? sig->name : nullptr ;
-}
-
-const char *UserID::Signature::signerEmail() const
-{
- return sig ? sig->email : nullptr ;
-}
-
-const char *UserID::Signature::signerComment() const
-{
- return sig ? sig->comment : nullptr ;
-}
-
-unsigned int UserID::Signature::certClass() const
-{
- return sig ? sig->sig_class : 0 ;
-}
-
-UserID::Signature::Status UserID::Signature::status() const
-{
- if (!sig) {
- return GeneralError;
- }
-
- switch (gpgme_err_code(sig->status)) {
- case GPG_ERR_NO_ERROR: return NoError;
- case GPG_ERR_SIG_EXPIRED: return SigExpired;
- case GPG_ERR_KEY_EXPIRED: return KeyExpired;
- case GPG_ERR_BAD_SIGNATURE: return BadSignature;
- case GPG_ERR_NO_PUBKEY: return NoPublicKey;
- default:
- case GPG_ERR_GENERAL: return GeneralError;
- }
-}
-
-std::string UserID::Signature::statusAsString() const
-{
- if (!sig) {
- return std::string();
- }
- char buf[ 1024 ];
- gpgme_strerror_r(sig->status, buf, sizeof buf);
- buf[ sizeof buf - 1 ] = '\0';
- return std::string(buf);
-}
-
-GpgME::Notation UserID::Signature::notation(unsigned int idx) const
-{
- if (!sig) {
- return GpgME::Notation();
- }
- for (gpgme_sig_notation_t nota = sig->notations ; nota ; nota = nota->next) {
- if (nota->name) {
- if (idx-- == 0) {
- return GpgME::Notation(nota);
- }
- }
- }
- return GpgME::Notation();
-}
-
-unsigned int UserID::Signature::numNotations() const
-{
- if (!sig) {
- return 0;
- }
- unsigned int count = 0;
- for (gpgme_sig_notation_t nota = sig->notations ; nota ; nota = nota->next) {
- if (nota->name) {
- ++count; // others are policy URLs...
- }
- }
- return count;
-}
-
-std::vector<Notation> UserID::Signature::notations() const
-{
- if (!sig) {
- return std::vector<GpgME::Notation>();
- }
- std::vector<GpgME::Notation> v;
- v.reserve(numNotations());
- for (gpgme_sig_notation_t nota = sig->notations ; nota ; nota = nota->next) {
- if (nota->name) {
- v.push_back(GpgME::Notation(nota));
- }
- }
- return v;
-}
-
-const char *UserID::Signature::policyURL() const
-{
- if (!sig) {
- return nullptr;
- }
- for (gpgme_sig_notation_t nota = sig->notations ; nota ; nota = nota->next) {
- if (!nota->name) {
- return nota->value;
- }
- }
- return nullptr;
-}
-
-bool UserID::Signature::isTrustSignature() const
-{
- return sig && sig->trust_depth > 0;
-}
-
-TrustSignatureTrust UserID::Signature::trustValue() const
-{
- if (!sig || !isTrustSignature()) {
- return TrustSignatureTrust::None;
- }
- return sig->trust_value >= 120 ? TrustSignatureTrust::Complete : TrustSignatureTrust::Partial;
-}
-
-unsigned int UserID::Signature::trustDepth() const
-{
- return sig ? sig->trust_depth : 0;
-}
-
-const char *UserID::Signature::trustScope() const
-{
- return sig ? sig->trust_scope : nullptr;
-}
-
-std::string UserID::addrSpecFromString(const char *userid)
-{
- if (!userid) {
- return std::string();
- }
- char *normalized = gpgme_addrspec_from_uid (userid);
- if (normalized) {
- std::string ret(normalized);
- gpgme_free(normalized);
- return ret;
- }
- return std::string();
-}
-
-std::string UserID::addrSpec() const
-{
- if (!uid || !uid->address) {
- return std::string();
- }
-
- return uid->address;
-}
-
-Error UserID::revoke()
-{
- if (isNull()) {
- return Error::fromCode(GPG_ERR_GENERAL);
- }
- auto ctx = Context::createForProtocol(parent().protocol());
- if (!ctx) {
- return Error::fromCode(GPG_ERR_INV_ENGINE);
- }
- Error ret = ctx->revUid(key, id());
- delete ctx;
- return ret;
-}
-
-static Key::Origin gpgme_origin_to_pp_origin (const unsigned int origin)
-{
- switch (origin) {
- case GPGME_KEYORG_KS:
- return Key::OriginKS;
- case GPGME_KEYORG_DANE:
- return Key::OriginDane;
- case GPGME_KEYORG_WKD:
- return Key::OriginWKD;
- case GPGME_KEYORG_URL:
- return Key::OriginURL;
- case GPGME_KEYORG_FILE:
- return Key::OriginFile;
- case GPGME_KEYORG_SELF:
- return Key::OriginSelf;
- case GPGME_KEYORG_OTHER:
- return Key::OriginOther;
- case GPGME_KEYORG_UNKNOWN:
- default:
- return Key::OriginUnknown;
- }
-}
-
-Key::Origin UserID::origin() const
-{
- if (isNull()) {
- return Key::OriginUnknown;
- }
- return gpgme_origin_to_pp_origin(uid->origin);
-}
-
-time_t UserID::lastUpdate() const
-{
- return static_cast<time_t>(uid ? uid->last_update : 0);
-}
-
-Error Key::addUid(const char *uid)
-{
- if (isNull()) {
- return Error::fromCode(GPG_ERR_GENERAL);
- }
- auto ctx = Context::createForProtocol(protocol());
- if (!ctx) {
- return Error::fromCode(GPG_ERR_INV_ENGINE);
- }
- Error ret = ctx->addUid(key, uid);
- delete ctx;
- return ret;
-}
-
-Key::Origin Key::origin() const
-{
- if (isNull()) {
- return OriginUnknown;
- }
- return gpgme_origin_to_pp_origin(key->origin);
-}
-
-time_t Key::lastUpdate() const
-{
- return static_cast<time_t>(key ? key->last_update : 0);
-}
-
-bool Key::isBad() const
-{
- return isNull() || isRevoked() || isExpired() || isDisabled() || isInvalid();
-}
-
-bool Subkey::isBad() const
-{
- return isNull() || isRevoked() || isExpired() || isDisabled() || isInvalid();
-}
-
-bool UserID::isBad() const
-{
- return isNull() || isRevoked() || isInvalid();
-}
-
-bool UserID::Signature::isBad() const
-{
- return isNull() || isExpired() || isInvalid();
-}
-
-//
-//
-// class RevocationKey
-//
-//
-
-static gpgme_revocation_key_t find_revkey(const shared_gpgme_key_t &key, unsigned int idx)
-{
- if (key) {
- for (gpgme_revocation_key_t s = key->revocation_keys; s; s = s->next, --idx) {
- if (idx == 0) {
- return s;
- }
- }
- }
- return nullptr;
-}
-
-static gpgme_revocation_key_t verify_revkey(const shared_gpgme_key_t &key, gpgme_revocation_key_t revkey)
-{
- if (key) {
- for (gpgme_revocation_key_t s = key->revocation_keys; s; s = s->next) {
- if (s == revkey) {
- return revkey;
- }
- }
- }
- return nullptr;
-}
-
-RevocationKey::RevocationKey() : key(), revkey(nullptr) {}
-
-RevocationKey::RevocationKey(const shared_gpgme_key_t &k, unsigned int idx)
- : key(k), revkey(find_revkey(k, idx))
-{
-}
-
-RevocationKey::RevocationKey(const shared_gpgme_key_t &k, gpgme_revocation_key_t sk)
- : key(k), revkey(verify_revkey(k, sk))
-{
-}
-
-Key RevocationKey::parent() const
-{
- return Key(key);
-}
-
-const char *RevocationKey::fingerprint() const
-{
- return revkey ? revkey->fpr : nullptr;
-}
-
-bool RevocationKey::isSensitive() const
-{
- return revkey ? revkey->sensitive : false;
-}
-
-int RevocationKey::algorithm() const
-{
- return revkey ? revkey->pubkey_algo : 0;
-}
-
-std::ostream &operator<<(std::ostream &os, const UserID &uid)
-{
- os << "GpgME::UserID(";
- if (!uid.isNull()) {
- os << "\n name: " << protect(uid.name())
- << "\n email: " << protect(uid.email())
- << "\n mbox: " << uid.addrSpec()
- << "\n comment: " << protect(uid.comment())
- << "\n validity: " << uid.validityAsString()
- << "\n revoked: " << uid.isRevoked()
- << "\n invalid: " << uid.isInvalid()
- << "\n numsigs: " << uid.numSignatures()
- << "\n origin: " << uid.origin()
- << "\n updated: " << uid.lastUpdate()
- << "\n tofuinfo:\n" << uid.tofuInfo();
- }
- return os << ')';
-}
-
-std::ostream &operator<<(std::ostream &os, const Subkey &subkey)
-{
- os << "GpgME::Subkey(";
- if (!subkey.isNull()) {
- os << "\n fingerprint: " << protect(subkey.fingerprint())
- << "\n keyGrip: " << protect(subkey.keyGrip())
- << "\n creationTime: " << subkey.creationTime()
- << "\n expirationTime:" << subkey.expirationTime()
- << "\n isRevoked: " << subkey.isRevoked()
- << "\n isExpired: " << subkey.isExpired()
- << "\n isInvalid: " << subkey.isInvalid()
- << "\n isDisabled: " << subkey.isDisabled()
- << "\n canSign: " << subkey.canSign()
- << "\n canEncrypt: " << subkey.canEncrypt()
- << "\n canCertify: " << subkey.canCertify()
- << "\n canAuth: " << subkey.canAuthenticate()
- << "\n canRenc: " << subkey.canRenc()
- << "\n canTimestanp: " << subkey.canTimestamp()
- << "\n isSecret: " << subkey.isSecret()
- << "\n isGroupOwned: " << subkey.isGroupOwned()
- << "\n isQualified: " << subkey.isQualified()
- << "\n isDeVs: " << subkey.isDeVs()
- << "\n isBetaCompliance:" << subkey.isBetaCompliance()
- << "\n isCardKey: " << subkey.isCardKey()
- << "\n cardSerialNumber:" << protect(subkey.cardSerialNumber());
- }
- return os << ')';
-}
-
-std::ostream &operator<<(std::ostream &os, const Key &key)
-{
- os << "GpgME::Key(";
- if (!key.isNull()) {
- os << "\n protocol: " << protect(key.protocolAsString())
- << "\n ownertrust: " << key.ownerTrustAsString()
- << "\n issuer: " << protect(key.issuerName())
- << "\n fingerprint:" << protect(key.primaryFingerprint())
- << "\n listmode: " << key.keyListMode()
- << "\n canSign: " << key.canSign()
- << "\n canEncrypt: " << key.canEncrypt()
- << "\n canCertify: " << key.canCertify()
- << "\n canAuth: " << key.canAuthenticate()
- << "\n origin: " << key.origin()
- << "\n updated: " << key.lastUpdate()
- << "\n uids:\n";
- const std::vector<UserID> uids = key.userIDs();
- std::copy(uids.begin(), uids.end(),
- std::ostream_iterator<UserID>(os, "\n"));
- const std::vector<Subkey> subkeys = key.subkeys();
- std::copy(subkeys.begin(), subkeys.end(),
- std::ostream_iterator<Subkey>(os, "\n"));
- os << " revocationKeys:\n";
- const std::vector<RevocationKey> revkeys = key.revocationKeys();
- std::copy(revkeys.begin(), revkeys.end(),
- std::ostream_iterator<RevocationKey>(os, "\n"));
- }
- return os << ')';
-}
-
-std::ostream &operator<<(std::ostream &os, const RevocationKey &revkey)
-{
- os << "GpgME::RevocationKey(";
- if (!revkey.isNull()) {
- os << "\n fingerprint: " << protect(revkey.fingerprint())
- << "\n isSensitive: " << revkey.isSensitive();
- }
- return os << ')';
-}
-
-} // namespace GpgME
diff --git a/lang/cpp/src/key.h b/lang/cpp/src/key.h
deleted file mode 100644
index ddcd3bb8..00000000
--- a/lang/cpp/src/key.h
+++ /dev/null
@@ -1,618 +0,0 @@
-/*
- key.h - wraps a gpgme key
- Copyright (C) 2003, 2005 Klarälvdalens Datakonsult AB
-
- 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.
-*/
-
-// -*- c++ -*-
-#ifndef __GPGMEPP_KEY_H__
-#define __GPGMEPP_KEY_H__
-
-#include "global.h"
-#include "notation.h"
-
-#include "gpgmefw.h"
-
-#include <algorithm>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <ctime>
-
-namespace GpgME
-{
-
-class Context;
-
-class Subkey;
-class UserID;
-class TofuInfo;
-class RevocationKey;
-
-typedef std::shared_ptr< std::remove_pointer<gpgme_key_t>::type > shared_gpgme_key_t;
-
-enum class TrustSignatureTrust : char {
- None = 0,
- Partial,
- Complete,
-};
-
-//
-// class Key
-//
-
-class GPGMEPP_EXPORT Key
-{
- friend class ::GpgME::Context;
- struct Null {
- Null() {}
- };
-public:
- Key();
- /* implicit */ Key(const Null &);
- Key(const shared_gpgme_key_t &key);
- Key(gpgme_key_t key, bool acquireRef);
-
- static const Null null;
-
- Key(const Key &other) = default;
- const Key &operator=(Key other)
- {
- swap(other);
- return *this;
- }
-
- const Key &mergeWith(const Key &other);
-
- void swap(Key &other)
- {
- using std::swap;
- swap(this->key, other.key);
- }
-
- bool isNull() const
- {
- return !key;
- }
-
- UserID userID(unsigned int index) const;
- Subkey subkey(unsigned int index) const;
-
- unsigned int numUserIDs() const;
- unsigned int numSubkeys() const;
-
- std::vector<UserID> userIDs() const;
- std::vector<Subkey> subkeys() const;
-
- RevocationKey revocationKey(unsigned int index) const;
- unsigned int numRevocationKeys() const;
- std::vector<RevocationKey> revocationKeys() const;
-
- bool isRevoked() const;
- bool isExpired() const;
- bool isDisabled() const;
- bool isInvalid() const;
-
- /*! Shorthand for isNull || isRevoked || isExpired ||
- * isDisabled || isInvalid */
- bool isBad() const;
-
- /** Returns true, if the key can be used for encryption (i.e. it's not bad
- * and has an encryption subkey) or if the primary subkey can encrypt. */
- bool canEncrypt() const;
- /** Returns true, if the key can be used for signing (i.e. it's not bad
- * and has a signing subkey) or if the primary subkey can sign. */
- bool canSign() const;
- GPGMEPP_DEPRECATED bool canReallySign() const;
- /** Returns true, if the key can be used for certification (i.e. it's not bad
- * and has a certification subkey) or if the primary subkey can certify. */
- bool canCertify() const;
- /** Returns true, if the key can be used for authentication (i.e. it's not bad
- * and has a authentication subkey) or if the primary subkey can authenticate. */
- bool canAuthenticate() const;
- bool isQualified() const;
- bool isDeVs() const;
- bool isBetaCompliance() const;
-
- /** Returns true, if the key has a certification subkey. */
- bool hasCertify() const;
- /** Returns true, if the key has a signing subkey. */
- bool hasSign() const;
- /** Returns true, if the key has an encryption subkey. */
- bool hasEncrypt() const;
- /** Returns true, if the key has an authentication subkey. */
- bool hasAuthenticate() const;
-
- bool hasSecret() const;
- GPGMEPP_DEPRECATED bool isSecret() const
- {
- return hasSecret();
- }
-
- /*!
- @return true if this is a X.509 root certificate (currently
- equivalent to something like
- strcmp( chainID(), subkey(0).fingerprint() ) == 0 )
- */
- bool isRoot() const;
-
- enum OwnerTrust { Unknown = 0, Undefined = 1, Never = 2,
- Marginal = 3, Full = 4, Ultimate = 5
- };
-
- OwnerTrust ownerTrust() const;
- char ownerTrustAsString() const;
-
- Protocol protocol() const;
- const char *protocolAsString() const;
-
- const char *issuerSerial() const;
- const char *issuerName() const;
- const char *chainID() const;
-
- const char *keyID() const;
- const char *shortKeyID() const;
- const char *primaryFingerprint() const;
-
- unsigned int keyListMode() const;
-
- /*! Update information about this key.
- * Starts a keylisting for this key with validity
- * and tofu information gathering. Blocks for
- * how long the keylisting takes.*/
- void update();
-
- /**
- * @brief Add a user id to this key.
- *
- * Needs gnupg 2.1.13 and the key needs to be updated
- * afterwards to see the new uid.
- *
- * @param uid should be fully formatted and UTF-8 encoded.
- *
- * @returns a possible error.
- **/
- Error addUid(const char *uid);
-
- /**
- * @brief try to locate the best pgp key for a given mailbox.
- *
- * Boils down to gpg --locate-key <mbox>
- * This may take some time if remote sources are also
- * used.
- *
- * @param mbox should be a mail address does not need to be normalized.
- *
- * @returns The best key for a mailbox or a null key.
- */
- static Key locate(const char *mbox);
-
- /* @enum Origin
- * @brief The Origin of the key. */
- enum Origin : unsigned int {
- OriginUnknown = 0,
- OriginKS = 1,
- OriginDane = 3,
- OriginWKD = 4,
- OriginURL = 5,
- OriginFile = 6,
- OriginSelf = 7,
- OriginOther = 31,
- };
- /*! Get the origin of the key.
- *
- * @returns the Origin. */
- Origin origin() const;
-
- /*! Get the last update time.
- *
- * @returns the last update time. */
- time_t lastUpdate() const;
-private:
- gpgme_key_t impl() const
- {
- return key.get();
- }
- shared_gpgme_key_t key;
-};
-
-//
-// class Subkey
-//
-
-class GPGMEPP_EXPORT Subkey
-{
-public:
- Subkey();
- Subkey(const shared_gpgme_key_t &key, gpgme_sub_key_t subkey);
- Subkey(const shared_gpgme_key_t &key, unsigned int idx);
-
- Subkey(const Subkey &other) = default;
- const Subkey &operator=(Subkey other)
- {
- swap(other);
- return *this;
- }
-
- void swap(Subkey &other)
- {
- using std::swap;
- swap(this->key, other.key);
- swap(this->subkey, other.subkey);
- }
-
- bool isNull() const
- {
- return !key || !subkey;
- }
-
- Key parent() const;
-
- const char *keyID() const;
- const char *fingerprint() const;
-
- time_t creationTime() const;
- time_t expirationTime() const;
- bool neverExpires() const;
-
- bool isRevoked() const;
- bool isExpired() const;
- bool isInvalid() const;
- bool isDisabled() const;
-
- /*! Shorthand for isNull || isRevoked || isExpired ||
- * isDisabled || isInvalid */
- bool isBad() const;
-
- bool canEncrypt() const;
- bool canSign() const;
- bool canCertify() const;
- bool canAuthenticate() const;
- bool canRenc() const;
- bool canTimestamp() const;
- bool isGroupOwned() const;
- bool isQualified() const;
- bool isDeVs() const;
- bool isBetaCompliance() const;
- bool isCardKey() const;
-
- bool isSecret() const;
-
- /** Same as gpgme_pubkey_algo_t */
- enum PubkeyAlgo {
- AlgoUnknown = 0,
- AlgoRSA = 1,
- AlgoRSA_E = 2,
- AlgoRSA_S = 3,
- AlgoKyber = 8,
- AlgoELG_E = 16,
- AlgoDSA = 17,
- AlgoECC = 18,
- AlgoELG = 20,
- AlgoECDSA = 301,
- AlgoECDH = 302,
- AlgoEDDSA = 303,
- AlgoMax = 1 << 31
- };
-
- PubkeyAlgo publicKeyAlgorithm() const;
-
- /**
- @brief Get the public key algorithm name.
-
- This only works for the pre 2.1 algorithms for ECC NULL is returned.
-
- @returns a statically allocated string with the name of the public
- key algorithm, or NULL if that name is not known.
- */
- const char *publicKeyAlgorithmAsString() const;
-
- /** @brief Same as publicKeyAlgorithmAsString but static. */
- static const char *publicKeyAlgorithmAsString(PubkeyAlgo algo);
-
- /**
- @brief Get the key algo string like GnuPG 2.1 prints it.
-
- This returns combinations of size and algorithm. Like
- bp512 or rsa2048. Misnamed because publicKeyAlgorithmAsString
- already used the older pubkey_algo_name.
- Actually uses gpgme_pubkey_algo_string.
-
- @returns the key algorithm as string. Empty string on error.
- */
- std::string algoName() const;
-
- unsigned int length() const;
-
- const char *cardSerialNumber() const;
-
- const char *keyGrip() const;
-
-private:
- shared_gpgme_key_t key;
- gpgme_sub_key_t subkey;
-};
-
-//
-// class UserID
-//
-
-class GPGMEPP_EXPORT UserID
-{
-public:
- class Signature;
-
- UserID();
- UserID(const shared_gpgme_key_t &key, gpgme_user_id_t uid);
- UserID(const shared_gpgme_key_t &key, unsigned int idx);
-
- UserID(const UserID &other) = default;
- const UserID &operator=(UserID other)
- {
- swap(other);
- return *this;
- }
-
- void swap(UserID &other)
- {
- using std::swap;
- swap(this->key, other.key);
- swap(this->uid, other.uid);
- }
-
- bool isNull() const
- {
- return !key || !uid;
- }
-
- Key parent() const;
-
- unsigned int numSignatures() const;
- Signature signature(unsigned int index) const;
- std::vector<Signature> signatures() const;
-
- const char *id() const;
- const char *name() const;
- const char *email() const;
- const char *comment() const;
- const char *uidhash() const;
-
- enum Validity { Unknown = 0, Undefined = 1, Never = 2,
- Marginal = 3, Full = 4, Ultimate = 5
- };
-
- Validity validity() const;
- char validityAsString() const;
-
- bool isRevoked() const;
- bool isInvalid() const;
-
- /*! Shorthand for isNull || isRevoked || isInvalid */
- bool isBad() const;
-
- /** TOFU info for this userid.
- * @returns The TOFU stats or a null TofuInfo.
- */
- GpgME::TofuInfo tofuInfo() const;
-
- /*! Wrapper around gpgme_addrspec_from_uid.
- *
- * The input string should match the format of
- * a user id string.
- *
- * @returns a normalized mail address if found
- * or an empty string. */
- static std::string addrSpecFromString(const char *uid);
-
- /*! Wrapper around gpgme_addrspec_from_uid.
- *
- * @returns a normalized mail address for this userid
- * or an empty string. */
- std::string addrSpec() const;
-
- /*! Revoke the user id.
- *
- * Key needs update afterwards.
- *
- * @returns an error on error.*/
- Error revoke();
-
- /*! Get the origin of the key.
- *
- * @returns the Origin. */
- Key::Origin origin() const;
-
- /*! Get the last update time.
- *
- * @returns the last update time. */
- time_t lastUpdate() const;
-
- /*! Get a remark made by the key provided.
- * A remark is a signature notation on
- * this user id made by the key with the
- * name "[email protected]". Returns an error if the
- * parent key of this user id was not listed with the
- * keylist mode flags for signatures and signature notations.
- *
- * @param key The key for which comments should be searched.
- * @param error Set to GPG_ERR_NO_DATA if the keylist did
- * not include signature notations.
- *
- * @returns The value of the comment or NULL if none exists.
- **/
- const char *remark(const Key &key,
- Error &error) const;
-
- /*! Get multiple remarks made by potentially multiple keys. */
- std::vector <std::string> remarks(std::vector<GpgME::Key> remarkers,
- Error &error) const;
-
-private:
- shared_gpgme_key_t key;
- gpgme_user_id_t uid;
-};
-
-//
-// class UserID::Signature
-//
-
-class GPGMEPP_EXPORT UserID::Signature
-{
-public:
- GPGMEPP_DEPRECATED typedef GpgME::Notation Notation;
-
- Signature();
- Signature(const shared_gpgme_key_t &key, gpgme_user_id_t uid, gpgme_key_sig_t sig);
- Signature(const shared_gpgme_key_t &key, gpgme_user_id_t uid, unsigned int idx);
-
- Signature(const Signature &other) = default;
- const Signature &operator=(Signature other)
- {
- swap(other);
- return *this;
- }
-
- void swap(Signature &other)
- {
- using std::swap;
- swap(this->key, other.key);
- swap(this->uid, other.uid);
- swap(this->sig, other.sig);
- }
-
- /*! Defines a canonical sort order for signatures of the same user ID. */
- bool operator<(const Signature &other) const;
-
- GPGMEPP_DEPRECATED bool operator<(const Signature &other);
-
- bool isNull() const
- {
- return !sig || !uid || !key ;
- }
-
- UserID parent() const;
-
- const char *signerKeyID() const;
-
- const char *algorithmAsString() const;
- unsigned int algorithm() const;
- time_t creationTime() const;
- time_t expirationTime() const;
- bool neverExpires() const;
-
- bool isRevokation() const;
- bool isInvalid() const;
- bool isExpired() const;
- bool isExportable() const;
-
- /*! Shorthand for isNull || isExpired || isInvalid */
- bool isBad() const;
-
- const char *signerUserID() const;
- const char *signerName() const;
- const char *signerEmail() const;
- const char *signerComment() const;
-
- unsigned int certClass() const;
-
- enum Status { NoError = 0, SigExpired, KeyExpired,
- BadSignature, NoPublicKey, GeneralError
- };
- Status status() const;
- std::string statusAsString() const;
-
- const char *policyURL() const;
-
- unsigned int numNotations() const;
- GpgME::Notation notation(unsigned int idx) const;
- std::vector<GpgME::Notation> notations() const;
-
- bool isTrustSignature() const;
- TrustSignatureTrust trustValue() const;
- unsigned int trustDepth() const;
- const char *trustScope() const;
-
-private:
- shared_gpgme_key_t key;
- gpgme_user_id_t uid;
- gpgme_key_sig_t sig;
-};
-
-//
-// class RevocationKey
-//
-
-class GPGMEPP_EXPORT RevocationKey
-{
-public:
- RevocationKey();
- RevocationKey(const shared_gpgme_key_t &key, gpgme_revocation_key_t revkey);
- RevocationKey(const shared_gpgme_key_t &key, unsigned int idx);
-
- // Rule of Zero
-
- void swap(RevocationKey &other)
- {
- using std::swap;
- swap(this->key, other.key);
- swap(this->revkey, other.revkey);
- }
-
- bool isNull() const
- {
- return !key || !revkey;
- }
-
- Key parent() const;
-
- const char *fingerprint() const;
-
- bool isSensitive() const;
-
- int algorithm() const;
-
-private:
- shared_gpgme_key_t key;
- gpgme_revocation_key_t revkey;
-};
-
-inline void swap(RevocationKey& v1, RevocationKey& v2)
-{
- v1.swap(v2);
-}
-
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const UserID &uid);
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const Subkey &subkey);
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const Key &key);
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const RevocationKey &revkey);
-
-} // namespace GpgME
-
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(Key)
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(Subkey)
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(UserID)
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(UserID::Signature)
-
-GPGMEPP_MAKE_STRCMP(ByFingerprint, .primaryFingerprint());
-GPGMEPP_MAKE_STRCMP(ByKeyID, .keyID());
-GPGMEPP_MAKE_STRCMP(ByShortKeyID, .shortKeyID());
-GPGMEPP_MAKE_STRCMP(ByChainID, .chainID());
-
-#endif // __GPGMEPP_KEY_H__
diff --git a/lang/cpp/src/keygenerationresult.cpp b/lang/cpp/src/keygenerationresult.cpp
deleted file mode 100644
index 49342f42..00000000
--- a/lang/cpp/src/keygenerationresult.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- keygenerationresult.cpp - wraps a gpgme keygen result
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 <keygenerationresult.h>
-#include "result_p.h"
-
-#include <gpgme.h>
-
-#include <cstring>
-#include <cstdlib>
-
-#include <string.h>
-
-class GpgME::KeyGenerationResult::Private
-{
-public:
- Private(const _gpgme_op_genkey_result &r) : res(r)
- {
- if (res.fpr) {
- res.fpr = strdup(res.fpr);
- }
- }
- ~Private()
- {
- if (res.fpr) {
- std::free(res.fpr);
- }
- res.fpr = nullptr;
- }
-
- _gpgme_op_genkey_result res;
-};
-
-GpgME::KeyGenerationResult::KeyGenerationResult(gpgme_ctx_t ctx, int error)
- : GpgME::Result(error), d()
-{
- init(ctx);
-}
-
-GpgME::KeyGenerationResult::KeyGenerationResult(gpgme_ctx_t ctx, const Error &error)
- : GpgME::Result(error), d()
-{
- init(ctx);
-}
-
-void GpgME::KeyGenerationResult::init(gpgme_ctx_t ctx)
-{
- if (!ctx) {
- return;
- }
- gpgme_genkey_result_t res = gpgme_op_genkey_result(ctx);
- if (!res) {
- return;
- }
- d.reset(new Private(*res));
-}
-
-make_standard_stuff(KeyGenerationResult)
-
-bool GpgME::KeyGenerationResult::isPrimaryKeyGenerated() const
-{
- return d && d->res.primary;
-}
-
-bool GpgME::KeyGenerationResult::isSubkeyGenerated() const
-{
- return d && d->res.sub;
-}
-
-const char *GpgME::KeyGenerationResult::fingerprint() const
-{
- return d ? d->res.fpr : nullptr ;
-}
diff --git a/lang/cpp/src/keygenerationresult.h b/lang/cpp/src/keygenerationresult.h
deleted file mode 100644
index 1cbc9dd3..00000000
--- a/lang/cpp/src/keygenerationresult.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- keygenerationresult.h - wraps a gpgme keygen result
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_KEYGENERATIONRESULT_H__
-#define __GPGMEPP_KEYGENERATIONRESULT_H__
-
-#include "gpgmefw.h"
-#include "result.h"
-#include "gpgmepp_export.h"
-
-#include <memory>
-
-namespace GpgME
-{
-
-class Error;
-
-class GPGMEPP_EXPORT KeyGenerationResult : public Result
-{
-public:
- KeyGenerationResult();
- KeyGenerationResult(gpgme_ctx_t ctx, int error);
- KeyGenerationResult(gpgme_ctx_t ctx, const Error &error);
- explicit KeyGenerationResult(const Error &err);
-
- KeyGenerationResult(const KeyGenerationResult &other) = default;
- const KeyGenerationResult &operator=(KeyGenerationResult other)
- {
- swap(other);
- return *this;
- }
-
- void swap(KeyGenerationResult &other)
- {
- Result::swap(other);
- using std::swap;
- swap(this->d, other.d);
- }
-
- bool isNull() const;
-
- GPGMEPP_DEPRECATED bool primaryKeyGenerated() const
- {
- return isPrimaryKeyGenerated();
- }
- GPGMEPP_DEPRECATED bool subkeyGenerated() const
- {
- return isSubkeyGenerated();
- }
- bool isPrimaryKeyGenerated() const;
- bool isSubkeyGenerated() const;
- const char *fingerprint() const;
-
-private:
- class Private;
- void init(gpgme_ctx_t ctx);
- std::shared_ptr<Private> d;
-};
-
-}
-
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(KeyGenerationResult)
-
-#endif // __GPGMEPP_KEYGENERATIONRESULT_H__
diff --git a/lang/cpp/src/keylistresult.cpp b/lang/cpp/src/keylistresult.cpp
deleted file mode 100644
index 6e6b001b..00000000
--- a/lang/cpp/src/keylistresult.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- keylistresult.cpp - wraps a gpgme keylist result
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 <keylistresult.h>
-#include "result_p.h"
-
-#include <gpgme.h>
-
-#include <cstring>
-#include <cassert>
-
-class GpgME::KeyListResult::Private
-{
-public:
- Private(const _gpgme_op_keylist_result &r) : res(r) {}
- Private(const Private &other) : res(other.res) {}
-
- _gpgme_op_keylist_result res;
-};
-
-GpgME::KeyListResult::KeyListResult(gpgme_ctx_t ctx, int error)
- : GpgME::Result(error), d()
-{
- init(ctx);
-}
-
-GpgME::KeyListResult::KeyListResult(gpgme_ctx_t ctx, const Error &error)
- : GpgME::Result(error), d()
-{
- init(ctx);
-}
-
-void GpgME::KeyListResult::init(gpgme_ctx_t ctx)
-{
- if (!ctx) {
- return;
- }
- gpgme_keylist_result_t res = gpgme_op_keylist_result(ctx);
- if (!res) {
- return;
- }
- d.reset(new Private(*res));
-}
-
-GpgME::KeyListResult::KeyListResult(const Error &error, const _gpgme_op_keylist_result &res)
- : GpgME::Result(error), d(new Private(res))
-{
-
-}
-
-make_standard_stuff(KeyListResult)
-
-void GpgME::KeyListResult::detach()
-{
- if (!d || d.unique()) {
- return;
- }
- d.reset(new Private(*d));
-}
-
-void GpgME::KeyListResult::mergeWith(const KeyListResult &other)
-{
- if (other.isNull()) {
- return;
- }
- if (isNull()) { // just assign
- operator=(other);
- return;
- }
- // merge the truncated flag (try to keep detaching to a minimum):
- if (other.isTruncated() && !this->isTruncated()) {
- assert(other.d);
- detach();
- if (!d) {
- d.reset(new Private(*other.d));
- } else {
- d->res.truncated = true;
- }
- }
- if (! bool(error())) { // only merge the error when there was none yet.
- Result::operator=(other);
- }
-}
-
-bool GpgME::KeyListResult::isTruncated() const
-{
- return d && d->res.truncated;
-}
diff --git a/lang/cpp/src/keylistresult.h b/lang/cpp/src/keylistresult.h
deleted file mode 100644
index 68e2a17b..00000000
--- a/lang/cpp/src/keylistresult.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- keylistresult.h - wraps a gpgme keylist result
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_KEYLISTRESULT_H__
-#define __GPGMEPP_KEYLISTRESULT_H__
-
-#include "gpgmefw.h"
-#include "result.h"
-#include "gpgmepp_export.h"
-
-#include <memory>
-
-namespace GpgME
-{
-
-class Error;
-
-class GPGMEPP_EXPORT KeyListResult : public Result
-{
-public:
- KeyListResult();
- KeyListResult(gpgme_ctx_t ctx, int error);
- KeyListResult(gpgme_ctx_t ctx, const Error &error);
- explicit KeyListResult(const Error &err);
- KeyListResult(const Error &err, const _gpgme_op_keylist_result &res);
-
- KeyListResult(const KeyListResult &other) = default;
- const KeyListResult &operator=(KeyListResult other)
- {
- swap(other);
- return *this;
- }
- void swap(KeyListResult &other)
- {
- Result::swap(other);
- using std::swap;
- swap(this->d, other.d);
- }
-
- const KeyListResult &operator+=(const KeyListResult &other)
- {
- mergeWith(other);
- return *this;
- }
-
- void mergeWith(const KeyListResult &other);
-
- bool isNull() const;
-
- bool isTruncated() const;
-
-private:
- void detach();
- void init(gpgme_ctx_t ctx);
- class Private;
- std::shared_ptr<Private> d;
-};
-
-}
-
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(KeyListResult)
-
-#endif // __GPGMEPP_KEYLISTRESULT_H__
diff --git a/lang/cpp/src/notation.h b/lang/cpp/src/notation.h
deleted file mode 100644
index b1ff2d50..00000000
--- a/lang/cpp/src/notation.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- notation.h - wraps a gpgme verify result
- Copyright (C) 2004, 2007 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_NOTATION_H__
-#define __GPGMEPP_NOTATION_H__
-
-#include "gpgmefw.h"
-#include "verificationresult.h"
-#include "gpgmepp_export.h"
-
-#include <memory>
-
-#include <iosfwd>
-
-namespace GpgME
-{
-
-class GPGMEPP_EXPORT Notation
-{
- friend class ::GpgME::Signature;
- Notation(const std::shared_ptr<VerificationResult::Private> &parent, unsigned int sindex, unsigned int nindex);
-public:
- Notation();
- explicit Notation(gpgme_sig_notation_t nota);
-
- Notation(const Notation &other) = default;
- const Notation &operator=(Notation other)
- {
- swap(other);
- return *this;
- }
-
- void swap(Notation &other)
- {
- using std::swap;
- swap(this->d, other.d);
- }
-
- bool isNull() const;
-
- const char *name() const;
- const char *value() const;
-
- enum Flags {
- NoFlags = 0,
- HumanReadable = 1,
- Critical = 2
- };
- Flags flags() const;
-
- bool isHumanReadable() const;
- bool isCritical() const;
-
-private:
- class Private;
- std::shared_ptr<Private> d;
-};
-
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const Notation &nota);
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, Notation::Flags flags);
-
-}
-
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(Notation)
-
-#endif // __GPGMEPP_NOTATION_H__
diff --git a/lang/cpp/src/result.h b/lang/cpp/src/result.h
deleted file mode 100644
index a587afbe..00000000
--- a/lang/cpp/src/result.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- result.h - base class for results
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_RESULT_H__
-#define __GPGMEPP_RESULT_H__
-
-#include "gpgmefw.h"
-#include "error.h"
-
-#include <algorithm> // std::swap
-
-namespace GpgME
-{
-
-class GPGMEPP_EXPORT Result
-{
-protected:
- explicit Result() : mError() {}
- explicit Result(int err) : mError(err) {}
- explicit Result(const Error &err) : mError(err) {}
-
- void swap(Result &other)
- {
- std::swap(other.mError, mError);
- }
-
-public:
- const Error &error() const
- {
- return mError;
- }
- /**
- * Replaces the error set during construction with \p error.
- * Use with care, e.g. to set a more suitable error.
- */
- void setError(const Error &error)
- {
- mError = error;
- }
-
-protected:
- Error mError;
-};
-
-}
-
-#endif // __GPGMEPP_RESULT_H__
diff --git a/lang/cpp/src/result_p.h b/lang/cpp/src/result_p.h
deleted file mode 100644
index 70c45c47..00000000
--- a/lang/cpp/src/result_p.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- result.h - base class for results
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_RESULT_P_H__
-#define __GPGMEPP_RESULT_P_H__
-
-#define make_default_ctor(x) \
- GpgME::x::x() : GpgME::Result(), d() {}
-
-#define make_error_ctor(x) \
- GpgME::x::x( const Error & error ) \
- : GpgME::Result( error ), d() \
- { \
- \
- }
-
-#define make_isNull(x) bool GpgME::x::isNull() const { return !d && !bool(error()); }
-
-#define make_standard_stuff(x) \
- make_default_ctor(x) \
- make_error_ctor(x) \
- make_isNull(x)
-
-#endif // __GPGMEPP_RESULT_P_H__
diff --git a/lang/cpp/src/scdgetinfoassuantransaction.cpp b/lang/cpp/src/scdgetinfoassuantransaction.cpp
deleted file mode 100644
index 4a024905..00000000
--- a/lang/cpp/src/scdgetinfoassuantransaction.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- scdgetinfoassuantransaction.cpp - Assuan Transaction to get information from scdaemon
- Copyright (C) 2009 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "scdgetinfoassuantransaction.h"
-#include "error.h"
-#include "data.h"
-#include "util.h"
-
-#include <assert.h>
-
-using namespace GpgME;
-
-ScdGetInfoAssuanTransaction::ScdGetInfoAssuanTransaction(InfoItem item)
- : AssuanTransaction(),
- m_item(item),
- m_command(),
- m_data()
-{
-
-}
-
-ScdGetInfoAssuanTransaction::~ScdGetInfoAssuanTransaction() {}
-
-static std::vector<std::string> to_reader_list(const std::string &s)
-{
- std::vector<std::string> result;
- std::stringstream ss(s);
- std::string tok;
- while (std::getline(ss, tok, '\n')) {
- result.push_back(tok);
- }
- return result;
-}
-
-static std::vector<std::string> to_app_list(const std::string &s)
-{
- return to_reader_list(s);
-}
-
-std::string ScdGetInfoAssuanTransaction::version() const
-{
- if (m_item == Version) {
- return m_data;
- } else {
- return std::string();
- }
-}
-
-unsigned int ScdGetInfoAssuanTransaction::pid() const
-{
- if (m_item == Pid) {
- return to_pid(m_data);
- } else {
- return 0U;
- }
-}
-
-std::string ScdGetInfoAssuanTransaction::socketName() const
-{
- if (m_item == SocketName) {
- return m_data;
- } else {
- return std::string();
- }
-}
-
-char ScdGetInfoAssuanTransaction::status() const
-{
- if (m_item == Status && !m_data.empty()) {
- return m_data[0];
- } else {
- return '\0';
- }
-}
-
-std::vector<std::string> ScdGetInfoAssuanTransaction::readerList() const
-{
- if (m_item == ReaderList) {
- return to_reader_list(m_data);
- } else {
- return std::vector<std::string>();
- }
-}
-
-std::vector<std::string> ScdGetInfoAssuanTransaction::applicationList() const
-{
- if (m_item == ApplicationList) {
- return to_app_list(m_data);
- } else {
- return std::vector<std::string>();
- }
-}
-
-static const char *const scd_getinfo_tokens[] = {
- "version",
- "pid",
- "socket_name",
- "status",
- "reader_list",
- "deny_admin",
- "app_list",
-};
-static_assert((sizeof scd_getinfo_tokens / sizeof * scd_getinfo_tokens == ScdGetInfoAssuanTransaction::LastInfoItem),
- "getinfo_tokens size mismatch");
-
-void ScdGetInfoAssuanTransaction::makeCommand() const
-{
- assert(m_item >= 0);
- assert(m_item < LastInfoItem);
- m_command = "SCD GETINFO ";
- m_command += scd_getinfo_tokens[m_item];
-}
-
-const char *ScdGetInfoAssuanTransaction::command() const
-{
- makeCommand();
- return m_command.c_str();
-}
-
-Error ScdGetInfoAssuanTransaction::data(const char *data, size_t len)
-{
- m_data.append(data, len);
- return Error();
-}
-
-Data ScdGetInfoAssuanTransaction::inquire(const char *name, const char *args, Error &err)
-{
- (void)name; (void)args; (void)err;
- return Data::null;
-}
-
-Error ScdGetInfoAssuanTransaction::status(const char *status, const char *args)
-{
- (void)status; (void)args;
- return Error();
-}
diff --git a/lang/cpp/src/scdgetinfoassuantransaction.h b/lang/cpp/src/scdgetinfoassuantransaction.h
deleted file mode 100644
index d1ff0987..00000000
--- a/lang/cpp/src/scdgetinfoassuantransaction.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- scdgetinfoassuantransaction.h - Assuan Transaction to get information from scdaemon
- Copyright (C) 2009 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_SCDGETINFOASSUANTRANSACTION_H__
-#define __GPGMEPP_SCDGETINFOASSUANTRANSACTION_H__
-
-#include "interfaces/assuantransaction.h"
-
-#include <string>
-#include <vector>
-
-namespace GpgME
-{
-
-class GPGMEPP_EXPORT ScdGetInfoAssuanTransaction : public AssuanTransaction
-{
-public:
- enum InfoItem {
- Version, // string
- Pid, // unsigned long
- SocketName, // string (path)
- Status, // char (status)
- ReaderList, // string list
- DenyAdmin, // (none, returns GPG_ERR_GENERAL when admin commands are allowed)
- ApplicationList, // string list
-
- LastInfoItem
- };
-
- explicit ScdGetInfoAssuanTransaction(InfoItem item);
- ~ScdGetInfoAssuanTransaction();
-
- std::string version() const;
- unsigned int pid() const;
- std::string socketName() const;
- char status() const;
- std::vector<std::string> readerList() const;
- std::vector<std::string> applicationList() const;
-
-private:
- const char *command() const;
- Error data(const char *data, size_t datalen) override;
- Data inquire(const char *name, const char *args, Error &err) override;
- Error status(const char *status, const char *args) override;
-
-private:
- void makeCommand() const;
-
-private:
- InfoItem m_item;
- mutable std::string m_command;
- std::string m_data;
-};
-
-} // namespace GpgME
-
-#endif // __GPGMEPP_SCDGETINFOASSUANTRANSACTION_H__
diff --git a/lang/cpp/src/signingresult.cpp b/lang/cpp/src/signingresult.cpp
deleted file mode 100644
index c92a6e3e..00000000
--- a/lang/cpp/src/signingresult.cpp
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- signingresult.cpp - wraps a gpgme verify result
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 <signingresult.h>
-#include "result_p.h"
-#include "util.h"
-
-#include <gpgme.h>
-
-#include <cstring>
-#include <cstdlib>
-#include <algorithm>
-#include <istream>
-#include <iterator>
-
-#include <string.h>
-
-class GpgME::SigningResult::Private
-{
-public:
- Private(const gpgme_sign_result_t r)
- {
- if (!r) {
- return;
- }
- for (gpgme_new_signature_t is = r->signatures ; is ; is = is->next) {
- gpgme_new_signature_t copy = new _gpgme_new_signature(*is);
- if (is->fpr) {
- copy->fpr = strdup(is->fpr);
- }
- copy->next = nullptr;
- created.push_back(copy);
- }
- for (gpgme_invalid_key_t ik = r->invalid_signers ; ik ; ik = ik->next) {
- gpgme_invalid_key_t copy = new _gpgme_invalid_key(*ik);
- if (ik->fpr) {
- copy->fpr = strdup(ik->fpr);
- }
- copy->next = nullptr;
- invalid.push_back(copy);
- }
- }
- ~Private()
- {
- for (std::vector<gpgme_new_signature_t>::iterator it = created.begin() ; it != created.end() ; ++it) {
- std::free((*it)->fpr);
- delete *it; *it = nullptr;
- }
- for (std::vector<gpgme_invalid_key_t>::iterator it = invalid.begin() ; it != invalid.end() ; ++it) {
- std::free((*it)->fpr);
- delete *it; *it = nullptr;
- }
- }
-
- std::vector<gpgme_new_signature_t> created;
- std::vector<gpgme_invalid_key_t> invalid;
-};
-
-GpgME::SigningResult::SigningResult(gpgme_ctx_t ctx, int error)
- : GpgME::Result(error), d()
-{
- init(ctx);
-}
-
-GpgME::SigningResult::SigningResult(gpgme_ctx_t ctx, const Error &error)
- : GpgME::Result(error), d()
-{
- init(ctx);
-}
-
-void GpgME::SigningResult::init(gpgme_ctx_t ctx)
-{
- if (!ctx) {
- return;
- }
- gpgme_sign_result_t res = gpgme_op_sign_result(ctx);
- if (!res) {
- return;
- }
- d.reset(new Private(res));
-}
-
-make_standard_stuff(SigningResult)
-
-GpgME::CreatedSignature GpgME::SigningResult::createdSignature(unsigned int idx) const
-{
- return CreatedSignature(d, idx);
-}
-
-std::vector<GpgME::CreatedSignature> GpgME::SigningResult::createdSignatures() const
-{
- if (!d) {
- return std::vector<CreatedSignature>();
- }
- std::vector<CreatedSignature> result;
- result.reserve(d->created.size());
- for (unsigned int i = 0 ; i < d->created.size() ; ++i) {
- result.push_back(CreatedSignature(d, i));
- }
- return result;
-}
-
-GpgME::InvalidSigningKey GpgME::SigningResult::invalidSigningKey(unsigned int idx) const
-{
- return InvalidSigningKey(d, idx);
-}
-
-std::vector<GpgME::InvalidSigningKey> GpgME::SigningResult::invalidSigningKeys() const
-{
- if (!d) {
- return std::vector<GpgME::InvalidSigningKey>();
- }
- std::vector<GpgME::InvalidSigningKey> result;
- result.reserve(d->invalid.size());
- for (unsigned int i = 0 ; i < d->invalid.size() ; ++i) {
- result.push_back(InvalidSigningKey(d, i));
- }
- return result;
-}
-
-GpgME::InvalidSigningKey::InvalidSigningKey(const std::shared_ptr<SigningResult::Private> &parent, unsigned int i)
- : d(parent), idx(i)
-{
-
-}
-
-GpgME::InvalidSigningKey::InvalidSigningKey() : d(), idx(0) {}
-
-bool GpgME::InvalidSigningKey::isNull() const
-{
- return !d || idx >= d->invalid.size() ;
-}
-
-const char *GpgME::InvalidSigningKey::fingerprint() const
-{
- return isNull() ? nullptr : d->invalid[idx]->fpr ;
-}
-
-GpgME::Error GpgME::InvalidSigningKey::reason() const
-{
- return Error(isNull() ? 0 : d->invalid[idx]->reason);
-}
-
-GpgME::CreatedSignature::CreatedSignature(const std::shared_ptr<SigningResult::Private> &parent, unsigned int i)
- : d(parent), idx(i)
-{
-
-}
-
-GpgME::CreatedSignature::CreatedSignature() : d(), idx(0) {}
-
-bool GpgME::CreatedSignature::isNull() const
-{
- return !d || idx >= d->created.size() ;
-}
-
-const char *GpgME::CreatedSignature::fingerprint() const
-{
- return isNull() ? nullptr : d->created[idx]->fpr ;
-}
-
-time_t GpgME::CreatedSignature::creationTime() const
-{
- return static_cast<time_t>(isNull() ? 0 : d->created[idx]->timestamp);
-}
-
-GpgME::SignatureMode GpgME::CreatedSignature::mode() const
-{
- if (isNull()) {
- return NormalSignatureMode;
- }
- switch (d->created[idx]->type) {
- default:
- case GPGME_SIG_MODE_NORMAL: return NormalSignatureMode;
- case GPGME_SIG_MODE_DETACH: return Detached;
- case GPGME_SIG_MODE_CLEAR: return Clearsigned;
- case GPGME_SIG_MODE_ARCHIVE: return SignArchive; // cannot happen
- case GPGME_SIG_MODE_FILE: return SignFile; // cannot happen
- }
-}
-
-unsigned int GpgME::CreatedSignature::publicKeyAlgorithm() const
-{
- return isNull() ? 0 : d->created[idx]->pubkey_algo ;
-}
-
-const char *GpgME::CreatedSignature::publicKeyAlgorithmAsString() const
-{
- return gpgme_pubkey_algo_name(isNull() ? (gpgme_pubkey_algo_t)0 : d->created[idx]->pubkey_algo);
-}
-
-unsigned int GpgME::CreatedSignature::hashAlgorithm() const
-{
- return isNull() ? 0 : d->created[idx]->hash_algo ;
-}
-
-const char *GpgME::CreatedSignature::hashAlgorithmAsString() const
-{
- return gpgme_hash_algo_name(isNull() ? (gpgme_hash_algo_t)0 : d->created[idx]->hash_algo);
-}
-
-unsigned int GpgME::CreatedSignature::signatureClass() const
-{
- return isNull() ? 0 : d->created[idx]->sig_class ;
-}
-
-std::ostream &GpgME::operator<<(std::ostream &os, const SigningResult &result)
-{
- os << "GpgME::SigningResult(";
- if (!result.isNull()) {
- os << "\n error: " << result.error()
- << "\n createdSignatures:\n";
- const std::vector<CreatedSignature> cs = result.createdSignatures();
- std::copy(cs.begin(), cs.end(),
- std::ostream_iterator<CreatedSignature>(os, "\n"));
- os << " invalidSigningKeys:\n";
- const std::vector<InvalidSigningKey> isk = result.invalidSigningKeys();
- std::copy(isk.begin(), isk.end(),
- std::ostream_iterator<InvalidSigningKey>(os, "\n"));
- }
- return os << ')';
-}
-
-std::ostream &GpgME::operator<<(std::ostream &os, const CreatedSignature &sig)
-{
- os << "GpgME::CreatedSignature(";
- if (!sig.isNull()) {
- os << "\n fingerprint: " << protect(sig.fingerprint())
- << "\n creationTime: " << sig.creationTime()
- << "\n mode: " << sig.mode()
- << "\n publicKeyAlgorithm: " << protect(sig.publicKeyAlgorithmAsString())
- << "\n hashAlgorithm: " << protect(sig.hashAlgorithmAsString())
- << "\n signatureClass: " << sig.signatureClass()
- << '\n';
- }
- return os << ')';
-}
-
-std::ostream &GpgME::operator<<(std::ostream &os, const InvalidSigningKey &key)
-{
- os << "GpgME::InvalidSigningKey(";
- if (!key.isNull()) {
- os << "\n fingerprint: " << protect(key.fingerprint())
- << "\n reason: " << key.reason()
- << '\n';
- }
- return os << ')';
-}
diff --git a/lang/cpp/src/signingresult.h b/lang/cpp/src/signingresult.h
deleted file mode 100644
index 0c2994c7..00000000
--- a/lang/cpp/src/signingresult.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- signingresult.h - wraps a gpgme sign result
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_SIGNINGRESULT_H__
-#define __GPGMEPP_SIGNINGRESULT_H__
-
-#include "global.h"
-#include "result.h"
-
-#include <time.h>
-
-#include <memory>
-
-#include <vector>
-#include <iosfwd>
-
-namespace GpgME
-{
-
-class Error;
-class CreatedSignature;
-class InvalidSigningKey;
-
-class GPGMEPP_EXPORT SigningResult : public Result
-{
-public:
- SigningResult();
- SigningResult(gpgme_ctx_t ctx, int error);
- SigningResult(gpgme_ctx_t ctx, const Error &error);
- explicit SigningResult(const Error &err);
-
- SigningResult(const SigningResult &other) = default;
- const SigningResult &operator=(SigningResult other)
- {
- swap(other);
- return *this;
- }
-
- void swap(SigningResult &other)
- {
- Result::swap(other);
- using std::swap;
- swap(this->d, other.d);
- }
-
- bool isNull() const;
-
- CreatedSignature createdSignature(unsigned int index) const;
- std::vector<CreatedSignature> createdSignatures() const;
-
- InvalidSigningKey invalidSigningKey(unsigned int index) const;
- std::vector<InvalidSigningKey> invalidSigningKeys() const;
-
- class Private;
-private:
- void init(gpgme_ctx_t ctx);
- std::shared_ptr<Private> d;
-};
-
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const SigningResult &result);
-
-class GPGMEPP_EXPORT InvalidSigningKey
-{
- friend class ::GpgME::SigningResult;
- InvalidSigningKey(const std::shared_ptr<SigningResult::Private> &parent, unsigned int index);
-public:
- InvalidSigningKey();
-
- InvalidSigningKey(const InvalidSigningKey &other) = default;
- const InvalidSigningKey &operator=(InvalidSigningKey other)
- {
- swap(other);
- return *this;
- }
-
- void swap(InvalidSigningKey &other)
- {
- using std::swap;
- swap(this->d, other.d);
- swap(this->idx, other.idx);
- }
-
- bool isNull() const;
-
- const char *fingerprint() const;
- Error reason() const;
-
-private:
- std::shared_ptr<SigningResult::Private> d;
- unsigned int idx;
-};
-
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const InvalidSigningKey &key);
-
-class GPGMEPP_EXPORT CreatedSignature
-{
- friend class ::GpgME::SigningResult;
- CreatedSignature(const std::shared_ptr<SigningResult::Private> &parent, unsigned int index);
-public:
-
- CreatedSignature();
-
- CreatedSignature(const CreatedSignature &other) = default;
- const CreatedSignature &operator=(CreatedSignature other)
- {
- swap(other);
- return *this;
- }
-
- void swap(CreatedSignature &other)
- {
- using std::swap;
- swap(this->d, other.d);
- swap(this->idx, other.idx);
- }
-
- bool isNull() const;
-
- const char *fingerprint() const;
-
- time_t creationTime() const;
-
- SignatureMode mode() const;
-
- unsigned int publicKeyAlgorithm() const;
- const char *publicKeyAlgorithmAsString() const;
-
- unsigned int hashAlgorithm() const;
- const char *hashAlgorithmAsString() const;
-
- unsigned int signatureClass() const;
-
-private:
- std::shared_ptr<SigningResult::Private> d;
- unsigned int idx;
-};
-
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const CreatedSignature &sig);
-
-}
-
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(SigningResult)
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(InvalidSigningKey)
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(CreatedSignature)
-
-#endif // __GPGMEPP_SIGNINGRESULT_H__
diff --git a/lang/cpp/src/statusconsumerassuantransaction.cpp b/lang/cpp/src/statusconsumerassuantransaction.cpp
deleted file mode 100644
index 7adfac03..00000000
--- a/lang/cpp/src/statusconsumerassuantransaction.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- statusconsumerassuantransaction.cpp
- Copyright (c) 2020 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "statusconsumerassuantransaction.h"
-
-#include "data.h"
-#include "error.h"
-
-#include "interfaces/statusconsumer.h"
-
-using namespace GpgME;
-
-StatusConsumerAssuanTransaction::StatusConsumerAssuanTransaction(StatusConsumer *statusConsumer)
- : AssuanTransaction()
- , m_consumer(statusConsumer)
-{
-}
-
-StatusConsumerAssuanTransaction::~StatusConsumerAssuanTransaction()
-{
-}
-
-Error StatusConsumerAssuanTransaction::data(const char *data, size_t datalen)
-{
- (void) data;
- (void) datalen;
- return Error();
-}
-
-Data StatusConsumerAssuanTransaction::inquire(const char *name, const char *args, Error &err)
-{
- (void)name;
- (void)args;
- (void)err;
- return Data::null;
-}
-
-Error StatusConsumerAssuanTransaction::status(const char *status, const char *args)
-{
- m_consumer->status(status, args);
-
- return Error();
-}
diff --git a/lang/cpp/src/statusconsumerassuantransaction.h b/lang/cpp/src/statusconsumerassuantransaction.h
deleted file mode 100644
index 0724069d..00000000
--- a/lang/cpp/src/statusconsumerassuantransaction.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- statusconsumerassuantransaction.h - Assuan transaction that forwards status lines to a consumer
- Copyright (c) 2020 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_STATUSCONSUMERASSUANTRANSACTION_H__
-#define __GPGMEPP_STATUSCONSUMERASSUANTRANSACTION_H__
-
-#include "interfaces/assuantransaction.h"
-
-namespace GpgME
-{
-
-class StatusConsumer;
-
-class GPGMEPP_EXPORT StatusConsumerAssuanTransaction: public AssuanTransaction
-{
-public:
- explicit StatusConsumerAssuanTransaction(StatusConsumer *statusConsumer);
- ~StatusConsumerAssuanTransaction();
-
-private:
- Error data(const char *data, size_t datalen) override;
- Data inquire(const char *name, const char *args, Error &err) override;
- Error status(const char *status, const char *args) override;
-
-private:
- StatusConsumer *m_consumer;
-};
-
-} // namespace GpgME
-
-#endif // __GPGMEPP_STATUSCONSUMERASSUANTRANSACTION_H__
diff --git a/lang/cpp/src/swdbresult.cpp b/lang/cpp/src/swdbresult.cpp
deleted file mode 100644
index 202a107f..00000000
--- a/lang/cpp/src/swdbresult.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/* swdbresult.cpp - wraps gpgme swdb result / query
- Copyright (C) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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
deleted file mode 100644
index d4340fe1..00000000
--- a/lang/cpp/src/swdbresult.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- swdbresult.h - wraps a gpgme swdb query / rsult
- Copyright (C) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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);
-
- SwdbResult(const SwdbResult &other) = default;
- 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 occurred 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.cpp b/lang/cpp/src/tofuinfo.cpp
deleted file mode 100644
index f0132f7b..00000000
--- a/lang/cpp/src/tofuinfo.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/* tofuinfo.cpp - wraps gpgme tofu info
- Copyright (C) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "tofuinfo.h"
-
-#include <istream>
-#include "util.h"
-
-class GpgME::TofuInfo::Private
-{
-public:
- Private() {}
- Private(gpgme_tofu_info_t info)
- : mInfo(info ? new _gpgme_tofu_info(*info) : nullptr)
- {
- if (mInfo && mInfo->description) {
- mInfo->description = strdup(mInfo->description);
- }
- }
-
- Private(const Private &other)
- : mInfo(other.mInfo)
- {
- if (mInfo && mInfo->description) {
- mInfo->description = strdup(mInfo->description);
- }
- }
-
- ~Private()
- {
- if (mInfo) {
- std::free(mInfo->description);
- mInfo->description = nullptr;
-
- delete mInfo;
- }
- }
-
- gpgme_tofu_info_t mInfo;
-};
-
-GpgME::TofuInfo::TofuInfo(gpgme_tofu_info_t info)
- : d(new Private(info))
-{
-}
-
-GpgME::TofuInfo::TofuInfo() : d()
-{
-}
-
-bool GpgME::TofuInfo::isNull() const
-{
- return !d || !d->mInfo;
-}
-
-GpgME::TofuInfo::Validity GpgME::TofuInfo::validity() const
-{
- if (isNull()) {
- return ValidityUnknown;
- }
- switch (d->mInfo->validity) {
- case 0:
- return Conflict;
- case 1:
- return NoHistory;
- case 2:
- return LittleHistory;
- case 3:
- return BasicHistory;
- case 4:
- return LargeHistory;
- default:
- return ValidityUnknown;
- }
-}
-
-GpgME::TofuInfo::Policy GpgME::TofuInfo::policy() const
-{
- if (isNull()) {
- return PolicyUnknown;
- }
- switch (d->mInfo->policy) {
- case GPGME_TOFU_POLICY_NONE:
- return PolicyNone;
- case GPGME_TOFU_POLICY_AUTO:
- return PolicyAuto;
- case GPGME_TOFU_POLICY_GOOD:
- return PolicyGood;
- case GPGME_TOFU_POLICY_BAD:
- return PolicyBad;
- case GPGME_TOFU_POLICY_ASK:
- return PolicyAsk;
- case GPGME_TOFU_POLICY_UNKNOWN:
- default:
- return PolicyUnknown;
- }
-}
-
-const char *GpgME::TofuInfo::description() const
-{
- return isNull() ? nullptr : d->mInfo->description;
-}
-
-unsigned short GpgME::TofuInfo::signCount() const
-{
- return isNull() ? 0 : d->mInfo->signcount;
-}
-
-unsigned short GpgME::TofuInfo::encrCount() const
-{
- return isNull() ? 0 : d->mInfo->encrcount;
-}
-
-unsigned long GpgME::TofuInfo::signFirst() const
-{
- return isNull() ? 0 : d->mInfo->signfirst;
-}
-
-unsigned long GpgME::TofuInfo::signLast() const
-{
- return isNull() ? 0 : d->mInfo->signlast;
-}
-
-unsigned long GpgME::TofuInfo::encrFirst() const
-{
- return isNull() ? 0 : d->mInfo->encrfirst;
-}
-
-unsigned long GpgME::TofuInfo::encrLast() const
-{
- return isNull() ? 0 : d->mInfo->encrlast;
-}
-
-std::ostream &GpgME::operator<<(std::ostream &os, const GpgME::TofuInfo &info)
-{
- os << "GpgME::Signature::TofuInfo(";
- if (!info.isNull()) {
- os << "\n desc: " << protect(info.description())
- << "\n validity: " << info.validity()
- << "\n policy: " << info.policy()
- << "\n signcount: "<< info.signCount()
- << "\n signfirst: "<< info.signFirst()
- << "\n signlast: " << info.signLast()
- << "\n encrcount: "<< info.encrCount()
- << "\n encrfirst: "<< info.encrFirst()
- << "\n encrlast: " << info.encrLast()
- << '\n';
- }
- return os << ")";
-}
diff --git a/lang/cpp/src/tofuinfo.h b/lang/cpp/src/tofuinfo.h
deleted file mode 100644
index 67ed62a5..00000000
--- a/lang/cpp/src/tofuinfo.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- tofuinfo.h - wraps gpgme tofu info
- Copyright (C) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_TOFUINFO_H__
-#define __GPGMEPP_TOFUINFO_H__
-
-#include "gpgmepp_export.h"
-
-#include "global.h"
-
-#include <memory>
-
-namespace GpgME
-{
-
-class GPGMEPP_EXPORT TofuInfo
-{
-public:
- TofuInfo();
- explicit TofuInfo(gpgme_tofu_info_t info);
-
- TofuInfo(const TofuInfo &other) = default;
- const TofuInfo &operator=(TofuInfo other)
- {
- swap(other);
- return *this;
- }
-
- void swap(TofuInfo &other)
- {
- using std::swap;
- swap(this->d, other.d);
- }
-
- bool isNull() const;
-
- /* @enum Validity
- * @brief The TOFU Validity. */
- enum Validity : unsigned int {
- /*! Unknown (uninitialized).*/
- ValidityUnknown,
- /*! TOFU Conflict.*/
- Conflict,
- /*! Key without history.*/
- NoHistory,
- /*! Key with too little history.*/
- LittleHistory,
- /*! Key with enough history for basic trust.*/
- BasicHistory,
- /*! Key with a lot of history.*/
- LargeHistory,
- };
- Validity validity() const;
-
- /* @enum Policy
- * @brief The TOFU Validity. */
- enum Policy : unsigned int {
- /*! GPGME_TOFU_POLICY_NONE */
- PolicyNone,
- /*! GPGME_TOFU_POLICY_AUTO */
- PolicyAuto,
- /*! GPGME_TOFU_POLICY_GOOD */
- PolicyGood,
- /*! GPGME_TOFU_POLICY_UNKNOWN */
- PolicyUnknown,
- /*! GPGME_TOFU_POLICY_BAD */
- PolicyBad,
- /*! GPGME_TOFU_POLICY_ASK */
- PolicyAsk,
- };
- Policy policy() const;
-
- /* Number of signatures seen for this binding. Capped at USHRT_MAX. */
- unsigned short signCount() const;
-
- /* Number of encryption done to this binding. Capped at USHRT_MAX. */
- unsigned short encrCount() const;
-
- /** Number of seconds since epoch when the first message was verified */
- unsigned long signFirst() const;
-
- /** Number of seconds since epoch when the last message was verified */
- unsigned long signLast() const;
-
- /** Number of seconds since epoch when the first message was encrypted */
- unsigned long encrFirst() const;
-
- /** Number of seconds since epoch when the last message was encrypted */
- unsigned long encrLast() const;
-
- /* If non-NULL a human readable string summarizing the TOFU data. */
- const char *description() const;
-
-private:
- class Private;
- std::shared_ptr<Private> d;
-};
-
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const TofuInfo &info);
-
-} // namespace GpgME
-
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(TofuInfo)
-#endif // __GPGMEPP_TOFUINFO_H__
diff --git a/lang/cpp/src/trustitem.cpp b/lang/cpp/src/trustitem.cpp
deleted file mode 100644
index 4302f657..00000000
--- a/lang/cpp/src/trustitem.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- trustitem.cpp - wraps a gpgme trust item
- Copyright (C) 2003 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 <trustitem.h>
-
-#include <gpgme.h>
-
-#include <cassert>
-
-namespace GpgME
-{
-
-class TrustItem::Private
-{
-public:
- Private(gpgme_trust_item_t aItem)
- : item(aItem)
- {
- }
-
- gpgme_trust_item_t item;
-};
-
-TrustItem::TrustItem(gpgme_trust_item_t item)
-{
- d = new Private(item);
- if (d->item) {
- gpgme_trust_item_ref(d->item);
- }
-}
-
-TrustItem::TrustItem(const TrustItem &other)
-{
- d = new Private(other.d->item);
- if (d->item) {
- gpgme_trust_item_ref(d->item);
- }
-}
-
-TrustItem::~TrustItem()
-{
- if (d->item) {
- gpgme_trust_item_unref(d->item);
- }
- delete d; d = nullptr;
-}
-
-bool TrustItem::isNull() const
-{
- return !d || !d->item;
-}
-
-gpgme_trust_item_t TrustItem::impl() const
-{
- return d->item;
-}
-
-const char *TrustItem::keyID() const
-{
- return d->item ? d->item->keyid : nullptr ;
-}
-
-const char *TrustItem::userID() const
-{
- return d->item ? d->item->name : nullptr ;
-}
-
-const char *TrustItem::ownerTrustAsString() const
-{
- return d->item ? d->item->owner_trust : nullptr ;
-}
-
-const char *TrustItem::validityAsString() const
-{
- return d->item ? d->item->validity : nullptr ;
-}
-
-int TrustItem::trustLevel() const
-{
- return d->item ? d->item->level : 0 ;
-}
-
-TrustItem::Type TrustItem::type() const
-{
- if (!d->item) {
- return Unknown;
- } else {
- return
- d->item->type == 1 ? Key :
- d->item->type == 2 ? UserID :
- Unknown ;
- }
-}
-
-} // namespace GpgME
diff --git a/lang/cpp/src/trustitem.h b/lang/cpp/src/trustitem.h
deleted file mode 100644
index a951bdf9..00000000
--- a/lang/cpp/src/trustitem.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- trustitem.h - wraps a gpgme trust item
- Copyright (C) 2003 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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.
-*/
-
-// -*- c++ -*-
-#ifndef __GPGMEPP_TRUSTITEM_H__
-#define __GPGMEPP_TRUSTITEM_H__
-
-#include "gpgmefw.h"
-#include "key.h"
-#include "gpgmepp_export.h"
-
-#include <algorithm>
-
-namespace GpgME
-{
-
-class Context;
-
-class GPGMEPP_EXPORT TrustItem
-{
- friend class ::GpgME::Context;
-public:
- explicit TrustItem(gpgme_trust_item_t item = nullptr);
- TrustItem(const TrustItem &other);
- virtual ~TrustItem();
-
- const TrustItem &operator=(TrustItem other)
- {
- swap(other);
- return *this;
- }
-
- void swap(TrustItem &other)
- {
- using std::swap;
- swap(this->d, other.d);
- }
-
- bool isNull() const;
-
- const char *keyID() const;
- const char *userID() const;
-
- const char *ownerTrustAsString() const;
- const char *validityAsString() const;
-
- int trustLevel() const;
-
- enum Type { Unknown = 0, Key = 1, UserID = 2 };
- Type type() const;
-
-private:
- gpgme_trust_item_t impl() const;
- class Private;
- Private *d;
-};
-
-} // namepace GpgME
-
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(TrustItem)
-
-#endif // __GPGMEPP_TRUSTITEM_H__
diff --git a/lang/cpp/src/util.cpp b/lang/cpp/src/util.cpp
deleted file mode 100644
index 9104435f..00000000
--- a/lang/cpp/src/util.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- util.cpp - some internal helpers
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "util.h"
-
-#include <functional>
-
-StringsToCStrings::StringsToCStrings(const std::vector<std::string>& v)
- : m_strings{v}
-{
-}
-
-const char **StringsToCStrings::c_strs() const
-{
- if (m_cstrings.empty()) {
- m_cstrings.reserve(m_strings.size() + 1);
- std::transform(std::begin(m_strings), std::end(m_strings),
- std::back_inserter(m_cstrings),
- std::mem_fn(&std::string::c_str));
- m_cstrings.push_back(nullptr);
- }
- return m_cstrings.data();
-}
diff --git a/lang/cpp/src/util.h b/lang/cpp/src/util.h
deleted file mode 100644
index cb6df0d0..00000000
--- a/lang/cpp/src/util.h
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- util.h - some internal helpers
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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.
-*/
-
-// -*- c++ -*-
-#ifndef __GPGMEPP_UTIL_H__
-#define __GPGMEPP_UTIL_H__
-
-#include "global.h"
-#include "notation.h"
-
-#include <gpgme.h>
-
-#ifndef NDEBUG
-#include <iostream>
-#endif
-#include <sstream>
-#include <string>
-
-static inline const char *protect(const char *s)
-{
- return s ? s : "<null>" ;
-}
-
-static inline gpgme_error_t make_error(gpgme_err_code_t code)
-{
- return gpgme_err_make((gpgme_err_source_t)22, code);
-}
-
-static inline unsigned long to_pid(const std::string &s)
-{
- std::stringstream ss(s);
- unsigned int result;
- if (ss >> result) {
- return result;
- } else {
- return 0U;
- }
-}
-
-static inline gpgme_keylist_mode_t add_to_gpgme_keylist_mode_t(unsigned int oldmode, unsigned int newmodes)
-{
- if (newmodes & GpgME::Local) {
- oldmode |= GPGME_KEYLIST_MODE_LOCAL;
- }
- if (newmodes & GpgME::Extern) {
- oldmode |= GPGME_KEYLIST_MODE_EXTERN;
- }
- if (newmodes & GpgME::Signatures) {
- oldmode |= GPGME_KEYLIST_MODE_SIGS;
- }
- if (newmodes & GpgME::SignatureNotations) {
- oldmode |= GPGME_KEYLIST_MODE_SIG_NOTATIONS;
- }
- if (newmodes & GpgME::Validate) {
- oldmode |= GPGME_KEYLIST_MODE_VALIDATE;
- }
- if (newmodes & GpgME::Ephemeral) {
- oldmode |= GPGME_KEYLIST_MODE_EPHEMERAL;
- }
- if (newmodes & GpgME::WithTofu) {
- oldmode |= GPGME_KEYLIST_MODE_WITH_TOFU;
- }
- if (newmodes & GpgME::WithKeygrip) {
- oldmode |= GPGME_KEYLIST_MODE_WITH_KEYGRIP;
- }
- if (newmodes & GpgME::WithSecret) {
- oldmode |= GPGME_KEYLIST_MODE_WITH_SECRET;
- }
- if (newmodes & GpgME::ForceExtern) {
- oldmode |= GPGME_KEYLIST_MODE_FORCE_EXTERN;
- }
-#ifndef NDEBUG
- if (newmodes & ~(GpgME::KeyListModeMask)) {
- //std::cerr << "GpgME::Context: keylist mode must be one of Local, "
- //"Extern, Signatures, SignatureNotations, Validate, Ephemeral, WithTofu, "
- //"WithKeygrip, WithSecret, ForceExtern, or a combination thereof!"
- //<< std::endl;
- }
-#endif
- return static_cast<gpgme_keylist_mode_t>(oldmode);
-}
-
-static inline unsigned int convert_from_gpgme_keylist_mode_t(unsigned int mode)
-{
- unsigned int result = 0;
- if (mode & GPGME_KEYLIST_MODE_LOCAL) {
- result |= GpgME::Local;
- }
- if (mode & GPGME_KEYLIST_MODE_EXTERN) {
- result |= GpgME::Extern;
- }
- if (mode & GPGME_KEYLIST_MODE_SIGS) {
- result |= GpgME::Signatures;
- }
- if (mode & GPGME_KEYLIST_MODE_SIG_NOTATIONS) {
- result |= GpgME::SignatureNotations;
- }
- if (mode & GPGME_KEYLIST_MODE_WITH_SECRET) {
- result |= GpgME::WithSecret;
- }
- if (mode & GPGME_KEYLIST_MODE_WITH_TOFU) {
- result |= GpgME::WithTofu;
- }
- if (mode & GPGME_KEYLIST_MODE_WITH_KEYGRIP) {
- result |= GpgME::WithKeygrip;
- }
- if (mode & GPGME_KEYLIST_MODE_EPHEMERAL) {
- result |= GpgME::Ephemeral;
- }
- if (mode & GPGME_KEYLIST_MODE_VALIDATE) {
- result |= GpgME::Validate;
- }
- if (mode & GPGME_KEYLIST_MODE_FORCE_EXTERN) {
- result |= GpgME::ForceExtern;
- }
-#ifndef NDEBUG
- if (mode & ~(GPGME_KEYLIST_MODE_LOCAL |
- GPGME_KEYLIST_MODE_EXTERN |
- GPGME_KEYLIST_MODE_SIGS |
- GPGME_KEYLIST_MODE_SIG_NOTATIONS |
- GPGME_KEYLIST_MODE_WITH_SECRET |
- GPGME_KEYLIST_MODE_WITH_TOFU |
- GPGME_KEYLIST_MODE_WITH_KEYGRIP |
- GPGME_KEYLIST_MODE_EPHEMERAL |
- GPGME_KEYLIST_MODE_VALIDATE |
- GPGME_KEYLIST_MODE_FORCE_EXTERN)) {
- //std::cerr << "GpgME: WARNING: gpgme_get_keylist_mode() returned an unknown flag!" << std::endl;
- }
-#endif // NDEBUG
- return result;
-}
-
-static inline GpgME::Notation::Flags convert_from_gpgme_sig_notation_flags_t(unsigned int flags)
-{
- unsigned int result = 0;
- if (flags & GPGME_SIG_NOTATION_HUMAN_READABLE) {
- result |= GpgME::Notation::HumanReadable ;
- }
- if (flags & GPGME_SIG_NOTATION_CRITICAL) {
- result |= GpgME::Notation::Critical ;
- }
- return static_cast<GpgME::Notation::Flags>(result);
-}
-
-static inline gpgme_sig_notation_flags_t add_to_gpgme_sig_notation_flags_t(unsigned int oldflags, unsigned int newflags)
-{
- unsigned int result = oldflags;
- if (newflags & GpgME::Notation::HumanReadable) {
- result |= GPGME_SIG_NOTATION_HUMAN_READABLE;
- }
- if (newflags & GpgME::Notation::Critical) {
- result |= GPGME_SIG_NOTATION_CRITICAL;
- }
- return static_cast<gpgme_sig_notation_flags_t>(result);
-}
-
-static inline std::vector<std::string> split(const std::string &text, char delimiter)
-{
- std::vector<std::string> result;
- if (!text.empty()) {
- std::istringstream stream{text};
- std::string line;
- while (std::getline(stream, line, delimiter)) {
- result.push_back(line);
- }
- }
- return result;
-}
-
-/**
- * Adapter for passing a vector of strings as NULL-terminated array of
- * const char* to the C-interface of gpgme.
- */
-class StringsToCStrings
-{
-public:
- explicit StringsToCStrings(const std::vector<std::string> &v);
- ~StringsToCStrings() = default;
-
- StringsToCStrings(const StringsToCStrings &) = delete;
- StringsToCStrings &operator=(const StringsToCStrings &) = delete;
- StringsToCStrings(StringsToCStrings &&) = delete;
- StringsToCStrings &operator=(StringsToCStrings &&) = delete;
-
- const char **c_strs() const;
-private:
- const std::vector<std::string> m_strings;
- mutable std::vector<const char *> m_cstrings;
-};
-
-#endif // __GPGMEPP_UTIL_H__
diff --git a/lang/cpp/src/verificationresult.cpp b/lang/cpp/src/verificationresult.cpp
deleted file mode 100644
index 0299fcec..00000000
--- a/lang/cpp/src/verificationresult.cpp
+++ /dev/null
@@ -1,642 +0,0 @@
-/*
- verificationresult.cpp - wraps a gpgme verify result
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 <verificationresult.h>
-#include <notation.h>
-#include "result_p.h"
-#include "util.h"
-#include "key.h"
-#include "context.h"
-
-#include <gpgme.h>
-
-#include <istream>
-#include <algorithm>
-#include <iterator>
-#include <string>
-#include <cstring>
-#include <cstdlib>
-
-#include <string.h>
-
-class GpgME::VerificationResult::Private
-{
-public:
- explicit Private(const gpgme_verify_result_t r)
- {
- if (!r) {
- return;
- }
- if (r->file_name) {
- file_name = r->file_name;
- }
- // copy recursively, using compiler-generated copy ctor.
- // We just need to handle the pointers in the structs:
- for (gpgme_signature_t is = r->signatures ; is ; is = is->next) {
- gpgme_signature_t scopy = new _gpgme_signature(*is);
- if (is->fpr) {
- scopy->fpr = strdup(is->fpr);
- }
-// PENDING(marc) why does this crash on Windows in strdup()?
-# ifndef _WIN32
- if (is->pka_address) {
- scopy->pka_address = strdup(is->pka_address);
- }
-# else
- scopy->pka_address = nullptr;
-# endif
- scopy->next = nullptr;
- sigs.push_back(scopy);
- // copy keys
- if (scopy->key) {
- keys.push_back(Key(scopy->key, true));
- } else {
- keys.push_back(Key());
- }
- // copy notations:
- nota.push_back(std::vector<Nota>());
- purls.push_back(nullptr);
- for (gpgme_sig_notation_t in = is->notations ; in ; in = in->next) {
- if (!in->name) {
- if (in->value) {
- purls.back() = strdup(in->value); // policy url
- }
- continue;
- }
- Nota n = { nullptr, nullptr, in->flags };
- n.name = strdup(in->name);
- if (in->value) {
- n.value = strdup(in->value);
- }
- nota.back().push_back(n);
- }
- }
- }
- ~Private()
- {
- for (std::vector<gpgme_signature_t>::iterator it = sigs.begin() ; it != sigs.end() ; ++it) {
- std::free((*it)->fpr);
- std::free((*it)->pka_address);
- delete *it; *it = nullptr;
- }
- for (std::vector< std::vector<Nota> >::iterator it = nota.begin() ; it != nota.end() ; ++it) {
- for (std::vector<Nota>::iterator jt = it->begin() ; jt != it->end() ; ++jt) {
- std::free(jt->name); jt->name = nullptr;
- std::free(jt->value); jt->value = nullptr;
- }
- }
- std::for_each(purls.begin(), purls.end(), &std::free);
- }
-
- struct Nota {
- char *name;
- char *value;
- gpgme_sig_notation_flags_t flags;
- };
-
- std::vector<gpgme_signature_t> sigs;
- std::vector< std::vector<Nota> > nota;
- std::vector<GpgME::Key> keys;
- std::vector<char *> purls;
- std::string file_name;
- Protocol proto;
-};
-
-GpgME::VerificationResult::VerificationResult(gpgme_ctx_t ctx, int error)
- : GpgME::Result(error), d()
-{
- init(ctx);
-}
-
-GpgME::VerificationResult::VerificationResult(gpgme_ctx_t ctx, const Error &error)
- : GpgME::Result(error), d()
-{
- init(ctx);
-}
-
-void GpgME::VerificationResult::init(gpgme_ctx_t ctx)
-{
- if (!ctx) {
- return;
- }
- gpgme_verify_result_t res = gpgme_op_verify_result(ctx);
- if (!res) {
- return;
- }
- d.reset(new Private(res));
- gpgme_protocol_t proto = gpgme_get_protocol(ctx);
- d->proto = proto == GPGME_PROTOCOL_OpenPGP ? OpenPGP :
- proto == GPGME_PROTOCOL_CMS ? CMS :
- UnknownProtocol;
-}
-
-make_standard_stuff(VerificationResult)
-
-const char *GpgME::VerificationResult::fileName() const
-{
- return d ? d->file_name.c_str() : nullptr ;
-}
-
-unsigned int GpgME::VerificationResult::numSignatures() const
-{
- return d ? d->sigs.size() : 0 ;
-}
-
-GpgME::Signature GpgME::VerificationResult::signature(unsigned int idx) const
-{
- return Signature(d, idx);
-}
-
-std::vector<GpgME::Signature> GpgME::VerificationResult::signatures() const
-{
- if (!d) {
- return std::vector<Signature>();
- }
- std::vector<Signature> result;
- result.reserve(d->sigs.size());
- for (unsigned int i = 0 ; i < d->sigs.size() ; ++i) {
- result.push_back(Signature(d, i));
- }
- return result;
-}
-
-GpgME::Signature::Signature(const std::shared_ptr<VerificationResult::Private> &parent, unsigned int i)
- : d(parent), idx(i)
-{
-}
-
-GpgME::Signature::Signature() : d(), idx(0) {}
-
-bool GpgME::Signature::isNull() const
-{
- return !d || idx >= d->sigs.size() ;
-}
-
-GpgME::Signature::Summary GpgME::Signature::summary() const
-{
- if (isNull()) {
- return None;
- }
- gpgme_sigsum_t sigsum = d->sigs[idx]->summary;
- unsigned int result = 0;
- if (sigsum & GPGME_SIGSUM_VALID) {
- result |= Valid;
- }
- if (sigsum & GPGME_SIGSUM_GREEN) {
- result |= Green;
- }
- if (sigsum & GPGME_SIGSUM_RED) {
- result |= Red;
- }
- if (sigsum & GPGME_SIGSUM_KEY_REVOKED) {
- result |= KeyRevoked;
- }
- if (sigsum & GPGME_SIGSUM_KEY_EXPIRED) {
- result |= KeyExpired;
- }
- if (sigsum & GPGME_SIGSUM_SIG_EXPIRED) {
- result |= SigExpired;
- }
- if (sigsum & GPGME_SIGSUM_KEY_MISSING) {
- result |= KeyMissing;
- }
- if (sigsum & GPGME_SIGSUM_CRL_MISSING) {
- result |= CrlMissing;
- }
- if (sigsum & GPGME_SIGSUM_CRL_TOO_OLD) {
- result |= CrlTooOld;
- }
- if (sigsum & GPGME_SIGSUM_BAD_POLICY) {
- result |= BadPolicy;
- }
- if (sigsum & GPGME_SIGSUM_SYS_ERROR) {
- result |= SysError;
- }
- if (sigsum & GPGME_SIGSUM_TOFU_CONFLICT) {
- result |= TofuConflict;
- }
- return static_cast<Summary>(result);
-}
-
-const char *GpgME::Signature::fingerprint() const
-{
- return isNull() ? nullptr : d->sigs[idx]->fpr ;
-}
-
-GpgME::Error GpgME::Signature::status() const
-{
- return Error(isNull() ? 0 : d->sigs[idx]->status);
-}
-
-time_t GpgME::Signature::creationTime() const
-{
- return static_cast<time_t>(isNull() ? 0 : d->sigs[idx]->timestamp);
-}
-
-time_t GpgME::Signature::expirationTime() const
-{
- return static_cast<time_t>(isNull() ? 0 : d->sigs[idx]->exp_timestamp);
-}
-
-bool GpgME::Signature::neverExpires() const
-{
- return expirationTime() == (time_t)0;
-}
-
-bool GpgME::Signature::isWrongKeyUsage() const
-{
- return !isNull() && d->sigs[idx]->wrong_key_usage;
-}
-
-bool GpgME::Signature::isVerifiedUsingChainModel() const
-{
- return !isNull() && d->sigs[idx]->chain_model;
-}
-
-bool GpgME::Signature::isDeVs() const
-{
- return !isNull() && d->sigs[idx]->is_de_vs;
-}
-
-bool GpgME::Signature::isBetaCompliance() const
-{
- return !isNull() && d->sigs[idx]->beta_compliance;
-}
-
-GpgME::Signature::PKAStatus GpgME::Signature::pkaStatus() const
-{
- if (!isNull()) {
- return static_cast<PKAStatus>(d->sigs[idx]->pka_trust);
- }
- return UnknownPKAStatus;
-}
-
-const char *GpgME::Signature::pkaAddress() const
-{
- if (!isNull()) {
- return d->sigs[idx]->pka_address;
- }
- return nullptr;
-}
-
-GpgME::Signature::Validity GpgME::Signature::validity() const
-{
- if (isNull()) {
- return Unknown;
- }
- switch (d->sigs[idx]->validity) {
- default:
- case GPGME_VALIDITY_UNKNOWN: return Unknown;
- case GPGME_VALIDITY_UNDEFINED: return Undefined;
- case GPGME_VALIDITY_NEVER: return Never;
- case GPGME_VALIDITY_MARGINAL: return Marginal;
- case GPGME_VALIDITY_FULL: return Full;
- case GPGME_VALIDITY_ULTIMATE: return Ultimate;
- }
-}
-
-char GpgME::Signature::validityAsString() const
-{
- if (isNull()) {
- return '?';
- }
- switch (d->sigs[idx]->validity) {
- default:
- case GPGME_VALIDITY_UNKNOWN: return '?';
- case GPGME_VALIDITY_UNDEFINED: return 'q';
- case GPGME_VALIDITY_NEVER: return 'n';
- case GPGME_VALIDITY_MARGINAL: return 'm';
- case GPGME_VALIDITY_FULL: return 'f';
- case GPGME_VALIDITY_ULTIMATE: return 'u';
- }
-}
-
-GpgME::Error GpgME::Signature::nonValidityReason() const
-{
- return Error(isNull() ? 0 : d->sigs[idx]->validity_reason);
-}
-
-unsigned int GpgME::Signature::publicKeyAlgorithm() const
-{
- if (!isNull()) {
- return d->sigs[idx]->pubkey_algo;
- }
- return 0;
-}
-
-const char *GpgME::Signature::publicKeyAlgorithmAsString() const
-{
- if (!isNull()) {
- return gpgme_pubkey_algo_name(d->sigs[idx]->pubkey_algo);
- }
- return nullptr;
-}
-
-unsigned int GpgME::Signature::hashAlgorithm() const
-{
- if (!isNull()) {
- return d->sigs[idx]->hash_algo;
- }
- return 0;
-}
-
-const char *GpgME::Signature::hashAlgorithmAsString() const
-{
- if (!isNull()) {
- return gpgme_hash_algo_name(d->sigs[idx]->hash_algo);
- }
- return nullptr;
-}
-
-const char *GpgME::Signature::policyURL() const
-{
- return isNull() ? nullptr : d->purls[idx] ;
-}
-
-GpgME::Notation GpgME::Signature::notation(unsigned int nidx) const
-{
- return GpgME::Notation(d, idx, nidx);
-}
-
-std::vector<GpgME::Notation> GpgME::Signature::notations() const
-{
- if (isNull()) {
- return std::vector<GpgME::Notation>();
- }
- std::vector<GpgME::Notation> result;
- result.reserve(d->nota[idx].size());
- for (unsigned int i = 0 ; i < d->nota[idx].size() ; ++i) {
- result.push_back(GpgME::Notation(d, idx, i));
- }
- return result;
-}
-
-GpgME::Key GpgME::Signature::key() const
-{
- if (isNull()) {
- return Key();
- }
- return d->keys[idx];
-}
-
-GpgME::Key GpgME::Signature::key(bool search, bool update) const
-{
- if (isNull()) {
- return Key();
- }
-
- GpgME::Key ret = key();
- if (ret.isNull() && search && fingerprint ()) {
- auto ctx = Context::createForProtocol (d->proto);
- if (ctx) {
- ctx->setKeyListMode(KeyListMode::Local |
- KeyListMode::Signatures |
- KeyListMode::SignatureNotations |
- KeyListMode::Validate |
- KeyListMode::WithTofu |
- KeyListMode::WithKeygrip);
- Error e;
- ret = d->keys[idx] = ctx->key(fingerprint(), e, false);
- delete ctx;
- }
- }
- if (update) {
- d->keys[idx].update();
- ret = d->keys[idx];
- }
- return ret;
-}
-
-class GpgME::Notation::Private
-{
-public:
- Private() : d(), sidx(0), nidx(0), nota(nullptr) {}
- Private(const std::shared_ptr<VerificationResult::Private> &priv, unsigned int sindex, unsigned int nindex)
- : d(priv), sidx(sindex), nidx(nindex), nota(nullptr)
- {
-
- }
- Private(gpgme_sig_notation_t n)
- : d(), sidx(0), nidx(0), nota(n ? new _gpgme_sig_notation(*n) : nullptr)
- {
- if (nota && nota->name) {
- nota->name = strdup(nota->name);
- }
- if (nota && nota->value) {
- nota->value = strdup(nota->value);
- }
- }
- Private(const Private &other)
- : d(other.d), sidx(other.sidx), nidx(other.nidx), nota(other.nota)
- {
- if (nota) {
- nota->name = strdup(nota->name);
- nota->value = strdup(nota->value);
- }
- }
- ~Private()
- {
- if (nota) {
- std::free(nota->name); nota->name = nullptr;
- std::free(nota->value); nota->value = nullptr;
- delete nota;
- }
- }
-
- std::shared_ptr<VerificationResult::Private> d;
- unsigned int sidx, nidx;
- gpgme_sig_notation_t nota;
-};
-
-GpgME::Notation::Notation(const std::shared_ptr<VerificationResult::Private> &parent, unsigned int sindex, unsigned int nindex)
- : d(new Private(parent, sindex, nindex))
-{
-
-}
-
-GpgME::Notation::Notation(gpgme_sig_notation_t nota)
- : d(new Private(nota))
-{
-
-}
-
-GpgME::Notation::Notation() : d() {}
-
-bool GpgME::Notation::isNull() const
-{
- if (!d) {
- return true;
- }
- if (d->d) {
- return d->sidx >= d->d->nota.size() || d->nidx >= d->d->nota[d->sidx].size() ;
- }
- return !d->nota;
-}
-
-const char *GpgME::Notation::name() const
-{
- return
- isNull() ? nullptr :
- d->d ? d->d->nota[d->sidx][d->nidx].name :
- d->nota ? d->nota->name : nullptr ;
-}
-
-const char *GpgME::Notation::value() const
-{
- return
- isNull() ? nullptr :
- d->d ? d->d->nota[d->sidx][d->nidx].value :
- d->nota ? d->nota->value : nullptr ;
-}
-
-GpgME::Notation::Flags GpgME::Notation::flags() const
-{
- return
- convert_from_gpgme_sig_notation_flags_t(
- isNull() ? 0:
- d->d ? d->d->nota[d->sidx][d->nidx].flags :
- d->nota ? d->nota->flags : 0);
-}
-
-bool GpgME::Notation::isHumanReadable() const
-{
- return flags() & HumanReadable;
-}
-
-bool GpgME::Notation::isCritical() const
-{
- return flags() & Critical;
-}
-
-std::ostream &GpgME::operator<<(std::ostream &os, const VerificationResult &result)
-{
- os << "GpgME::VerificationResult(";
- if (!result.isNull()) {
- os << "\n error: " << result.error()
- << "\n fileName: " << protect(result.fileName())
- << "\n signatures:\n";
- const std::vector<Signature> sigs = result.signatures();
- std::copy(sigs.begin(), sigs.end(),
- std::ostream_iterator<Signature>(os, "\n"));
- }
- return os << ')';
-}
-
-std::ostream &GpgME::operator<<(std::ostream &os, Signature::PKAStatus pkaStatus)
-{
- os << "GpgME::Signature::PKAStatus(";
- switch (pkaStatus) {
-#define OUTPUT( x ) case GpgME::Signature:: x: os << #x; break
- OUTPUT(UnknownPKAStatus);
- OUTPUT(PKAVerificationFailed);
- OUTPUT(PKAVerificationSucceeded);
-#undef OUTPUT
- default:
- os << "??? (" << static_cast<int>(pkaStatus) << ')';
- break;
- }
- return os << ')';
-}
-
-std::ostream &GpgME::operator<<(std::ostream &os, Signature::Summary summary)
-{
- os << "GpgME::Signature::Summary(";
- if (summary == Signature::None) {
- os << "None";
- } else {
-#define OUTPUT( x ) if ( !(summary & (GpgME::Signature:: x)) ) {} else do { os << #x " "; } while(0)
- OUTPUT(Valid);
- OUTPUT(Green);
- OUTPUT(Red);
- OUTPUT(KeyRevoked);
- OUTPUT(KeyExpired);
- OUTPUT(SigExpired);
- OUTPUT(KeyMissing);
- OUTPUT(CrlMissing);
- OUTPUT(CrlTooOld);
- OUTPUT(BadPolicy);
- OUTPUT(SysError);
- OUTPUT(TofuConflict);
-#undef OUTPUT
- }
- return os << ')';
-}
-
-std::ostream &GpgME::operator<<(std::ostream &os, const Signature &sig)
-{
- os << "GpgME::Signature(";
- if (!sig.isNull()) {
- os << "\n Summary: " << sig.summary()
- << "\n Fingerprint: " << protect(sig.fingerprint())
- << "\n Status: " << sig.status()
- << "\n creationTime: " << sig.creationTime()
- << "\n expirationTime: " << sig.expirationTime()
- << "\n isWrongKeyUsage: " << sig.isWrongKeyUsage()
- << "\n isVerifiedUsingChainModel: " << sig.isVerifiedUsingChainModel()
- << "\n pkaStatus: " << sig.pkaStatus()
- << "\n pkaAddress: " << protect(sig.pkaAddress())
- << "\n validity: " << sig.validityAsString()
- << "\n nonValidityReason: " << sig.nonValidityReason()
- << "\n publicKeyAlgorithm: " << protect(sig.publicKeyAlgorithmAsString())
- << "\n hashAlgorithm: " << protect(sig.hashAlgorithmAsString())
- << "\n policyURL: " << protect(sig.policyURL())
- << "\n isDeVs: " << sig.isDeVs()
- << "\n isBetaCompliance: " << sig.isBetaCompliance()
- << "\n notations:\n";
- const std::vector<Notation> nota = sig.notations();
- std::copy(nota.begin(), nota.end(),
- std::ostream_iterator<Notation>(os, "\n"));
- }
- return os << ')';
-}
-
-std::ostream &GpgME::operator<<(std::ostream &os, Notation::Flags flags)
-{
- os << "GpgME::Notation::Flags(";
- if (flags == Notation::NoFlags) {
- os << "NoFlags";
- } else {
-#define OUTPUT( x ) if ( !(flags & (GpgME::Notation:: x)) ) {} else do { os << #x " "; } while(0)
- OUTPUT(HumanReadable);
- OUTPUT(Critical);
-#undef OUTPUT
- }
- return os << ')';
-}
-
-std::ostream &GpgME::operator<<(std::ostream &os, const Notation &nota)
-{
- os << "GpgME::Signature::Notation(";
- if (!nota.isNull()) {
- os << "\n name: " << protect(nota.name())
- << "\n value: " << protect(nota.value())
- << "\n flags: " << nota.flags()
- << '\n';
- }
- return os << ")";
-}
diff --git a/lang/cpp/src/verificationresult.h b/lang/cpp/src/verificationresult.h
deleted file mode 100644
index cd455d31..00000000
--- a/lang/cpp/src/verificationresult.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- verificationresult.h - wraps a gpgme verify result
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_VERIFICATIONRESULT_H__
-#define __GPGMEPP_VERIFICATIONRESULT_H__
-
-#include "gpgmefw.h"
-#include "result.h"
-#include "gpgmepp_export.h"
-
-#include <time.h>
-
-#include <memory>
-
-#include <vector>
-#include <iosfwd>
-
-namespace GpgME
-{
-
-class Error;
-class Signature;
-class Notation;
-class Key;
-
-class GPGMEPP_EXPORT VerificationResult : public Result
-{
-public:
- VerificationResult();
- VerificationResult(gpgme_ctx_t ctx, int error);
- VerificationResult(gpgme_ctx_t ctx, const Error &error);
- explicit VerificationResult(const Error &err);
-
- VerificationResult(const VerificationResult &other) = default;
- const VerificationResult &operator=(VerificationResult other)
- {
- swap(other);
- return *this;
- }
-
- void swap(VerificationResult &other)
- {
- Result::swap(other);
- using std::swap;
- swap(this->d, other.d);
- }
-
- bool isNull() const;
-
- const char *fileName() const;
-
- unsigned int numSignatures() const;
- Signature signature(unsigned int index) const;
- std::vector<Signature> signatures() const;
-
- class Private;
-private:
- void init(gpgme_ctx_t ctx);
- std::shared_ptr<Private> d;
-};
-
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const VerificationResult &result);
-
-class GPGMEPP_EXPORT Signature
-{
- friend class ::GpgME::VerificationResult;
- Signature(const std::shared_ptr<VerificationResult::Private> &parent, unsigned int index);
-public:
- GPGMEPP_DEPRECATED typedef GpgME::Notation Notation;
-
- Signature();
-
- Signature(const Signature &other) = default;
- const Signature &operator=(Signature other)
- {
- swap(other);
- return *this;
- }
-
- void swap(Signature &other)
- {
- using std::swap;
- swap(this->d, other.d);
- swap(this->idx, other.idx);
- }
-
- bool isNull() const;
-
- enum Summary {
- None = 0x000,
- Valid = 0x001,
- Green = 0x002,
- Red = 0x004,
- KeyRevoked = 0x008,
- KeyExpired = 0x010,
- SigExpired = 0x020,
- KeyMissing = 0x040,
- CrlMissing = 0x080,
- CrlTooOld = 0x100,
- BadPolicy = 0x200,
- SysError = 0x400,
- TofuConflict= 0x800
- };
- Summary summary() const;
-
- const char *fingerprint() const;
-
- Error status() const;
-
- time_t creationTime() const;
- time_t expirationTime() const;
- bool neverExpires() const;
-
- GPGMEPP_DEPRECATED bool wrongKeyUsage() const
- {
- return isWrongKeyUsage();
- }
- bool isWrongKeyUsage() const;
- bool isVerifiedUsingChainModel() const;
- bool isDeVs() const;
- bool isBetaCompliance() const;
-
- enum PKAStatus {
- UnknownPKAStatus, PKAVerificationFailed, PKAVerificationSucceeded
- };
- PKAStatus pkaStatus() const;
- const char *pkaAddress() const;
-
- enum Validity {
- Unknown, Undefined, Never, Marginal, Full, Ultimate
- };
- Validity validity() const;
- char validityAsString() const;
- Error nonValidityReason() const;
-
- unsigned int publicKeyAlgorithm() const;
- const char *publicKeyAlgorithmAsString() const;
-
- unsigned int hashAlgorithm() const;
- const char *hashAlgorithmAsString() const;
-
- const char *policyURL() const;
- GpgME::Notation notation(unsigned int index) const;
- std::vector<GpgME::Notation> notations() const;
-
- /** Returns the key object associated with this signature.
- * May be incomplete but will have at least the fingerprint
- * set or the associated TOFU Information if applicable. */
- GpgME::Key key() const;
-
- /* Search / Update the key of this signature.
- *
- * Same as above but if search is set to true this will
- * either update the key provided by the engine or search
- * the key in the engine. The key is cached.
- *
- * As this involves an engine call it might take some time
- * to finish so it should be avoided to do this in a UI
- * thread. The result will be cached and no engine call
- * will be done if update is set to false and a key is
- * already cached.
- *
- * If no key was provided by the engine this will look
- * up the key so this call might block while the engine
- * is called to obtain the key.
- *
- * If both search and update are false this is the same
- * as calling key()
- */
- GpgME::Key key(bool search, bool update) const;
-
-private:
- std::shared_ptr<VerificationResult::Private> d;
- unsigned int idx;
-};
-
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const Signature &sig);
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, Signature::PKAStatus pkaStatus);
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, Signature::Summary summary);
-
-}
-
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(VerificationResult)
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(Signature)
-
-#endif // __GPGMEPP_VERIFICATIONRESULT_H__
diff --git a/lang/cpp/src/vfsmountresult.cpp b/lang/cpp/src/vfsmountresult.cpp
deleted file mode 100644
index 901ccfe2..00000000
--- a/lang/cpp/src/vfsmountresult.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- vfsmountresult.cpp - wraps a gpgme vfs mount result
- Copyright (C) 2009 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH <[email protected]>
- Author: Marc Mutz <[email protected]>, Volker Krause <[email protected]>
-
- 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 <vfsmountresult.h>
-#include "result_p.h"
-
-#include <gpgme.h>
-
-#include <istream>
-#include <string.h>
-
-using namespace GpgME;
-
-class VfsMountResult::Private
-{
-public:
- explicit Private(const gpgme_vfs_mount_result_t r) : mountDir(nullptr)
- {
- if (r && r->mount_dir) {
- mountDir = strdup(r->mount_dir);
- }
- }
-
- ~Private()
- {
- std::free(mountDir);
- }
-
- char *mountDir;
-};
-
-VfsMountResult::VfsMountResult(gpgme_ctx_t ctx, const Error &error, const Error &opError)
- : Result(error ? error : opError), d()
-{
- init(ctx);
-}
-
-void VfsMountResult::init(gpgme_ctx_t ctx)
-{
- (void)ctx;
- if (!ctx) {
- return;
- }
- gpgme_vfs_mount_result_t res = gpgme_op_vfs_mount_result(ctx);
- if (!res) {
- return;
- }
- d.reset(new Private(res));
-}
-
-make_standard_stuff(VfsMountResult)
-
-const char *VfsMountResult::mountDir() const
-{
- if (d) {
- return d->mountDir;
- }
- return nullptr;
-}
-
-std::ostream &GpgME::operator<<(std::ostream &os, const VfsMountResult &result)
-{
- os << "GpgME::VfsMountResult(";
- if (!result.isNull()) {
- os << "\n error: " << result.error()
- << "\n mount dir: " << result.mountDir()
- << "\n";
- }
- return os << ')';
-}
diff --git a/lang/cpp/src/vfsmountresult.h b/lang/cpp/src/vfsmountresult.h
deleted file mode 100644
index 6bc67ba3..00000000
--- a/lang/cpp/src/vfsmountresult.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- vfsmountresult.h - wraps a gpgme vfs mount result
- Copyright (C) 2009 Klarälvdalens Datakonsult AB <[email protected]>
- Author: Marc Mutz <[email protected]>, Volker Krause <[email protected]>
-
- 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_VFSMOUNTRESULT_H__
-#define __GPGMEPP_VFSMOUNTRESULT_H__
-
-#include "gpgmefw.h"
-#include "result.h"
-#include "gpgmepp_export.h"
-
-#include <memory>
-
-#include <vector>
-#include <iosfwd>
-
-namespace GpgME
-{
-
-class Error;
-
-class GPGMEPP_EXPORT VfsMountResult : public Result
-{
-public:
- VfsMountResult();
- VfsMountResult(gpgme_ctx_t ctx, const Error &error, const Error &opError);
- explicit VfsMountResult(const Error &err);
-
- VfsMountResult(const VfsMountResult &other) = default;
- const VfsMountResult &operator=(VfsMountResult other)
- {
- swap(other);
- return *this;
- }
-
- void swap(VfsMountResult &other)
- {
- Result::swap(other);
- using std::swap;
- swap(this->d, other.d);
- }
-
- bool isNull() const;
- const char *mountDir() const;
-
- class Private;
-private:
- void init(gpgme_ctx_t ctx);
- std::shared_ptr<Private> d;
-};
-
-GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const VfsMountResult &result);
-
-}
-
-GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(VfsMountResult)
-
-#endif // __GPGMEPP_VFSMOUNTRESULT_H__
diff --git a/lang/cpp/tests/Makefile.am b/lang/cpp/tests/Makefile.am
deleted file mode 100644
index 9e67dff3..00000000
--- a/lang/cpp/tests/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-# Makefile.am - Makefile for GPGME Cpp tests.
-# Copyright (C) 2018 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 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 <https://www.gnu.org/licenses/>.
-
-## Process this file with automake to produce Makefile.in
-
-AM_LDFLAGS = -no-install
-
-LDADD = ../../cpp/src/libgpgmepp.la \
- ../../../src/libgpgme.la @GPG_ERROR_LIBS@ \
- @LDADD_FOR_TESTS_KLUDGE@ -lstdc++
-
-AM_CPPFLAGS = -I$(top_srcdir)/lang/cpp/src -I$(top_builddir)/src \
- @GPG_ERROR_CFLAGS@ @GPG_ERROR_CFLAGS@ \
- @LIBASSUAN_CFLAGS@ -DBUILDING_GPGMEPP \
- -DTOP_SRCDIR="$(top_srcdir)"
-
-run_getkey_SOURCES = run-getkey.cpp
-run_keylist_SOURCES = run-keylist.cpp
-run_verify_SOURCES = run-verify.cpp
-if !HAVE_W32_SYSTEM
-run_wkdlookup_SOURCES = run-wkdlookup.cpp
-endif
-
-if HAVE_W32_SYSTEM
-programs_unix =
-else
-programs_unix = run-wkdlookup
-endif
-
-noinst_PROGRAMS = run-getkey run-keylist run-verify $(programs_unix)
diff --git a/lang/cpp/tests/README b/lang/cpp/tests/README
deleted file mode 100644
index ac74ab00..00000000
--- a/lang/cpp/tests/README
+++ /dev/null
@@ -1,4 +0,0 @@
-Tests for the C++ bindings.
-
-Most autotests for the C++ bindings use the QTest framework
-and live in lang/qt/tests.
diff --git a/lang/cpp/tests/run-getkey.cpp b/lang/cpp/tests/run-getkey.cpp
deleted file mode 100644
index 97d863e1..00000000
--- a/lang/cpp/tests/run-getkey.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- run-getkey.cpp
-
- This file is part of GpgMEpp's test suite.
- Copyright (c) 2018 Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License,
- version 2, as published by the Free Software Foundation.
-
- 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 "context.h"
-#include "key.h"
-
-#include <memory>
-#include <sstream>
-#include <iostream>
-
-using namespace GpgME;
-
-static int
-show_usage (int ex)
-{
- fputs ("usage: run-getkey [options] [keyIdOrFingerprint]\n\n"
- "Options:\n"
- " --verbose run in verbose mode\n"
- " --openpgp use the OpenPGP protocol (default)\n"
- " --cms use the CMS protocol\n"
- " --secret list only secret keys\n"
- " --with-secret list pubkeys with secret info filled\n"
- " --local use GPGME_KEYLIST_MODE_LOCAL\n"
- " --extern use GPGME_KEYLIST_MODE_EXTERN\n"
- " --sigs use GPGME_KEYLIST_MODE_SIGS\n"
- " --tofu use GPGME_KEYLIST_MODE_TOFU\n"
- " --sig-notations use GPGME_KEYLIST_MODE_SIG_NOTATIONS\n"
- " --ephemeral use GPGME_KEYLIST_MODE_EPHEMERAL\n"
- " --validate use GPGME_KEYLIST_MODE_VALIDATE\n"
- " --locate use GPGME_KEYLIST_MODE_LOCATE\n"
- " --force-extern use GPGME_KEYLIST_MODE_FORCE_EXTERN\n"
- " --locate-external use GPGME_KEYLIST_MODE_LOCATE_EXTERNAL\n"
- , stderr);
- exit (ex);
-}
-
-int
-main (int argc, char **argv)
-{
- int last_argc = -1;
- Protocol protocol = OpenPGP;
- unsigned int mode = 0;
- bool only_secret = false;
-
- if (argc) {
- argc--; argv++;
- }
-
- while (argc && last_argc != argc ) {
- last_argc = argc;
- if (!strcmp (*argv, "--")) {
- argc--; argv++;
- break;
- } else if (!strcmp (*argv, "--help")) {
- show_usage (0);
- } else if (!strcmp (*argv, "--openpgp")) {
- protocol = OpenPGP;
- argc--; argv++;
- } else if (!strcmp (*argv, "--cms")) {
- protocol = CMS;
- argc--; argv++;
- } else if (!strcmp (*argv, "--secret")) {
- only_secret = true;
- argc--; argv++;
- } else if (!strcmp (*argv, "--local")) {
- mode |= KeyListMode::Local;
- argc--; argv++;
- } else if (!strcmp (*argv, "--extern")) {
- mode |= KeyListMode::Extern;
- argc--; argv++;
- }else if (!strcmp (*argv, "--tofu")) {
- mode |= KeyListMode::WithTofu;
- argc--; argv++;
- } else if (!strcmp (*argv, "--sigs")) {
- mode |= KeyListMode::Signatures;
- argc--; argv++;
- } else if (!strcmp (*argv, "--sig-notations")) {
- mode |= KeyListMode::SignatureNotations;
- argc--; argv++;
- } else if (!strcmp (*argv, "--ephemeral")) {
- mode |= KeyListMode::Ephemeral;
- argc--; argv++;
- } else if (!strcmp (*argv, "--validate")) {
- mode |= KeyListMode::Validate;
- argc--; argv++;
- } else if (!strcmp (*argv, "--locate")) {
- argc--; argv++;
- mode |= KeyListMode::Locate;
- } else if (!strcmp (*argv, "--force-extern")) {
- argc--; argv++;
- mode |= KeyListMode::ForceExtern;
- } else if (!strcmp (*argv, "--locate-external")) {
- argc--; argv++;
- mode |= KeyListMode::LocateExternal;
- } else if (!strncmp (*argv, "--", 2)) {
- show_usage (1);
- }
- }
-
- if (argc != 1) {
- show_usage (1);
- }
-
- GpgME::initializeLibrary();
- auto ctx = std::unique_ptr<Context> (Context::createForProtocol(protocol));
- if (!ctx) {
- std::cerr << "Failed to get Context";
- return -1;
- }
- ctx->setKeyListMode (mode);
- if (ctx->keyListMode() != mode) {
- // unfortunately, Context::setKeyListMode() does not return the error
- // returned by gpgme
- std::cerr << "Failed to set keylist mode. You may have used an invalid combination of options.";
- return -1;
- }
- Error err;
- const GpgME::Key key = ctx->key (*argv, err, only_secret);
- std::stringstream ss;
-
- ss << "Key " << key << " Err: " << err.asStdString() << "\n";
-
- std::cout << ss.str();
-
- return 0;
-}
diff --git a/lang/cpp/tests/run-keylist.cpp b/lang/cpp/tests/run-keylist.cpp
deleted file mode 100644
index 6581567c..00000000
--- a/lang/cpp/tests/run-keylist.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- run-keylist.cpp
-
- This file is part of GpgMEpp's test suite.
- Copyright (c) 2018 Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License,
- version 2, as published by the Free Software Foundation.
-
- 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 "context.h"
-#include "key.h"
-#include "keylistresult.h"
-
-#include <memory>
-#include <sstream>
-#include <iostream>
-
-using namespace GpgME;
-
-static int
-show_usage (int ex)
-{
- fputs ("usage: run-keylist [options] [pattern]\n\n"
- "Options:\n"
- " --verbose run in verbose mode\n"
- " --openpgp use the OpenPGP protocol (default)\n"
- " --cms use the CMS protocol\n"
- " --secret list only secret keys\n"
- " --with-secret list pubkeys with secret info filled\n"
- " --local use GPGME_KEYLIST_MODE_LOCAL\n"
- " --extern use GPGME_KEYLIST_MODE_EXTERN\n"
- " --sigs use GPGME_KEYLIST_MODE_SIGS\n"
- " --tofu use GPGME_KEYLIST_MODE_TOFU\n"
- " --sig-notations use GPGME_KEYLIST_MODE_SIG_NOTATIONS\n"
- " --ephemeral use GPGME_KEYLIST_MODE_EPHEMERAL\n"
- " --validate use GPGME_KEYLIST_MODE_VALIDATE\n"
- " --locate use GPGME_KEYLIST_MODE_LOCATE\n"
- " --force-extern use GPGME_KEYLIST_MODE_FORCE_EXTERN\n"
- " --locate-external use GPGME_KEYLIST_MODE_LOCATE_EXTERNAL\n"
- , stderr);
- exit (ex);
-}
-
-int
-main (int argc, char **argv)
-{
- int last_argc = -1;
- Protocol protocol = OpenPGP;
- unsigned int mode = 0;
- bool only_secret = false;
-
- if (argc) {
- argc--; argv++;
- }
-
- while (argc && last_argc != argc ) {
- last_argc = argc;
- if (!strcmp (*argv, "--")) {
- argc--; argv++;
- break;
- } else if (!strcmp (*argv, "--help")) {
- show_usage (0);
- } else if (!strcmp (*argv, "--openpgp")) {
- protocol = OpenPGP;
- argc--; argv++;
- } else if (!strcmp (*argv, "--cms")) {
- protocol = CMS;
- argc--; argv++;
- } else if (!strcmp (*argv, "--secret")) {
- only_secret = true;
- argc--; argv++;
- } else if (!strcmp (*argv, "--local")) {
- mode |= KeyListMode::Local;
- argc--; argv++;
- } else if (!strcmp (*argv, "--extern")) {
- mode |= KeyListMode::Extern;
- argc--; argv++;
- }else if (!strcmp (*argv, "--tofu")) {
- mode |= KeyListMode::WithTofu;
- argc--; argv++;
- } else if (!strcmp (*argv, "--sigs")) {
- mode |= KeyListMode::Signatures;
- argc--; argv++;
- } else if (!strcmp (*argv, "--sig-notations")) {
- mode |= KeyListMode::SignatureNotations;
- argc--; argv++;
- } else if (!strcmp (*argv, "--ephemeral")) {
- mode |= KeyListMode::Ephemeral;
- argc--; argv++;
- } else if (!strcmp (*argv, "--validate")) {
- mode |= KeyListMode::Validate;
- argc--; argv++;
- } else if (!strcmp (*argv, "--locate")) {
- argc--; argv++;
- mode |= KeyListMode::Locate;
- } else if (!strcmp (*argv, "--with-secret")) {
- argc--; argv++;
- mode |= KeyListMode::WithSecret;
- } else if (!strcmp (*argv, "--force-extern")) {
- argc--; argv++;
- mode |= KeyListMode::ForceExtern;
- } else if (!strcmp (*argv, "--locate-external")) {
- argc--; argv++;
- mode |= KeyListMode::LocateExternal;
- } else if (!strncmp (*argv, "--", 2)) {
- std::cerr << "Error: Unknown option: " << *argv << std::endl;
- show_usage (1);
- }
- }
-
- if (argc > 1) {
- show_usage (1);
- }
-
- GpgME::initializeLibrary();
- auto ctx = std::unique_ptr<Context> (Context::createForProtocol(protocol));
- if (!ctx) {
- std::cerr << "Failed to get Context";
- return -1;
- }
- ctx->setKeyListMode (mode);
- if (ctx->keyListMode() != mode) {
- // unfortunately, Context::setKeyListMode() does not return the error
- // returned by gpgme
- std::cerr << "Failed to set keylist mode. You may have used an invalid combination of options.\n";
- return -1;
- }
- Error err = ctx->startKeyListing (*argv, only_secret);
- if (err) {
- std::cout << "Error: " << err.asStdString() << "\n";
- return -1;
- }
- GpgME::Key key;
- std::stringstream ss;
- do {
- key = ctx->nextKey(err);
- if (!err)
- {
- ss << key << "\n\n";
- }
- } while (!err && !key.isNull());
-
- std::cout << ss.str();
-
- return 0;
-}
diff --git a/lang/cpp/tests/run-verify.cpp b/lang/cpp/tests/run-verify.cpp
deleted file mode 100644
index 50131fb8..00000000
--- a/lang/cpp/tests/run-verify.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- run-keylist.cpp
-
- This file is part of GpgMEpp's test suite.
- Copyright (c) 2018 Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License,
- version 2, as published by the Free Software Foundation.
-
- 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 "context.h"
-#include "key.h"
-#include "data.h"
-#include "verificationresult.h"
-
-#include <memory>
-#include <iostream>
-
-using namespace GpgME;
-static int
-show_usage (int ex)
-{
- fputs ("usage: run-verify [options] [DETACHEDSIGFILE] FILE\n\n"
- "Options:\n"
- " --verbose run in verbose mode\n"
- " --openpgp use the OpenPGP protocol (default)\n"
- " --cms use the CMS protocol\n"
- " --sender MBOX use MBOX as sender address\n"
- " --repeat N repeat it N times\n"
- " --list-key list the signing key afterwards\n"
- , stderr);
- exit (ex);
-}
-
-int
-main (int argc, char **argv)
-{
- int last_argc = -1;
- Protocol protocol = OpenPGP;
- std::string sender;
- int repeats = 1;
- bool verbose = false;
- bool list_key = false;
-
- if (argc)
- { argc--; argv++; }
-
- while (argc && last_argc != argc )
- {
- last_argc = argc;
- if (!strcmp (*argv, "--"))
- {
- argc--; argv++;
- break;
- }
- else if (!strcmp (*argv, "--help"))
- show_usage (0);
- else if (!strcmp (*argv, "--verbose"))
- {
- verbose = true;
- argc--; argv++;
- }
- else if (!strcmp (*argv, "--list-key"))
- {
- list_key = true;
- argc--; argv++;
- }
- else if (!strcmp (*argv, "--openpgp"))
- {
- protocol = OpenPGP;
- argc--; argv++;
- }
- else if (!strcmp (*argv, "--cms"))
- {
- protocol = CMS;
- argc--; argv++;
- }
- else if (!strcmp (*argv, "--sender"))
- {
- argc--; argv++;
- if (!argc)
- show_usage (1);
- sender = *argv;
- argc--; argv++;
- }
- else if (!strcmp (*argv, "--repeat"))
- {
- argc--; argv++;
- if (!argc)
- show_usage (1);
- repeats = atoi (*argv);
- argc--; argv++;
- }
- else if (!strncmp (*argv, "--", 2))
- show_usage (1);
- }
-
- if (argc < 1 || argc > 2)
- show_usage (1);
-
- GpgME::initializeLibrary();
-
- for (int i = 0; i < repeats; i++) {
- std::cout << "Starting run: " << i << std::endl;
- auto ctx = std::unique_ptr<Context> (Context::createForProtocol(protocol));
- if (!ctx) {
- std::cerr << "Failed to get Context";
- return -1;
- }
-
- std::FILE *fp_sig = fopen (argv[0], "rb");
- if (!fp_sig) {
- std::cerr << "Failed to open sig file";
- exit (1);
- }
-
- std::FILE *fp_msg = nullptr;
- if (argc > 1)
- {
- fp_msg = fopen (argv[1], "rb");
- if (!fp_msg) {
- std::cerr << "Failed to open msg file";
- exit (1);
- }
- }
- Data dSig(fp_sig);
- Data dMsg;
- bool is_opaque = true;
- if (fp_msg) {
- dMsg = Data(fp_msg);
- is_opaque = false;
- }
-
- if (!sender.empty()) {
- ctx->setSender(sender.c_str());
- }
-
- Data output;
- VerificationResult result;
- if (is_opaque) {
- result = ctx->verifyOpaqueSignature(dSig, output);
- } else {
- result = ctx->verifyDetachedSignature(dSig, dMsg);
- }
-
- Signature sig;
- if (result.numSignatures()) {
- sig = result.signature(0);
- }
-
- if (list_key && !sig.isNull()) {
- sig.key(true, false);
- }
-
- if (verbose) {
- std::cout << "Result: " << result << std::endl;
- } else {
- std::cout << "Err:" << result.error() << std::endl;
- }
- }
-}
diff --git a/lang/cpp/tests/run-wkdlookup.cpp b/lang/cpp/tests/run-wkdlookup.cpp
deleted file mode 100644
index 1e18c9a8..00000000
--- a/lang/cpp/tests/run-wkdlookup.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- run-wkdlookup.cpp
-
- This file is part of GpgMEpp's test suite.
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "context.h"
-#include "data.h"
-#include "defaultassuantransaction.h"
-#include "key.h"
-
-#include <memory>
-#include <iostream>
-#include <thread>
-
-using namespace GpgME;
-
-static int
-show_usage (int ex)
-{
- fputs ("usage: run-wkdlookup <email address>\n\n"
- , stderr);
- exit (ex);
-}
-
-int
-main (int argc, char **argv)
-{
- int last_argc = -1;
-
- if (argc) {
- argc--; argv++;
- }
-
- while (argc && last_argc != argc ) {
- last_argc = argc;
- if (!strcmp (*argv, "--")) {
- argc--; argv++;
- break;
- } else if (!strcmp (*argv, "--help")) {
- show_usage (0);
- } else if (!strncmp (*argv, "--", 2)) {
- show_usage (1);
- }
- }
-
- if (argc != 1) {
- show_usage (1);
- }
-
- const std::string email{*argv};
-
- GpgME::initializeLibrary();
- Error err;
- auto ctx = std::unique_ptr<Context>{Context::createForEngine(AssuanEngine, &err)};
- if (!ctx) {
- std::cerr << "Failed to get context (Error: " << err.asStdString() << ")\n";
- return -1;
- }
-
- const std::string dirmngrSocket = GpgME::dirInfo("dirmngr-socket");
- if ((err = ctx->setEngineFileName(dirmngrSocket.c_str()))) {
- std::cerr << "Failed to set engine file name (Error: " << err.asStdString() << ")\n";
- return -1;
- }
- if ((err = ctx->setEngineHomeDirectory(""))) {
- std::cerr << "Failed to set engine home directory (Error: " << err.asStdString() << ")\n";
- return -1;
- }
-
- // try to connect to dirmngr
- err = ctx->assuanTransact("GETINFO version");
- if (err && err.code() != GPG_ERR_ASS_CONNECT_FAILED) {
- std::cerr << "Failed to start assuan transaction (Error: " << err.asStdString() << ")\n";
- return -1;
- }
- if (err.code() == GPG_ERR_ASS_CONNECT_FAILED) {
- std::cerr << "Starting dirmngr ...\n";
- auto spawnCtx = std::unique_ptr<Context>{Context::createForEngine(SpawnEngine, &err)};
- if (!spawnCtx) {
- std::cerr << "Failed to get context for spawn engine (Error: " << err.asStdString() << ")\n";
- return -1;
- }
-
- const auto gpgconfProgram = GpgME::dirInfo("gpgconf-name");
- // replace backslashes with forward slashes in homedir to work around bug T6833
- std::string homedir{GpgME::dirInfo("homedir")};
- std::replace(homedir.begin(), homedir.end(), '\\', '/');
- const char *argv[] = {
- gpgconfProgram,
- "--homedir",
- homedir.c_str(),
- "--launch",
- "dirmngr",
- NULL
- };
- auto ignoreIO = Data{Data::null};
- err = spawnCtx->spawn(gpgconfProgram, argv,
- ignoreIO, ignoreIO, ignoreIO,
- Context::SpawnDetached);
- if (err) {
- std::cerr << "Failed to start dirmngr (Error: " << err.asStdString() << ")\n";
- return -1;
- }
-
- // wait for socket to become available
- int cnt = 0;
- do {
- ++cnt;
- std::cerr << "Waiting for dirmngr to start ...\n";
- std::this_thread::sleep_for(std::chrono::milliseconds{250 * cnt});
- err = ctx->assuanTransact("GETINFO version");
- } while (err.code() == GPG_ERR_ASS_CONNECT_FAILED && cnt < 5);
- }
-
- const auto cmd = std::string{"WKD_GET "} + email;
- err = ctx->assuanTransact(cmd.c_str());
- if (err && err.code() != GPG_ERR_NO_NAME && err.code() != GPG_ERR_NO_DATA) {
- std::cerr << "Error: WKD_GET returned " << err.asStdString() << "\n";
- return -1;
- }
-
- const auto transaction = std::unique_ptr<DefaultAssuanTransaction>(dynamic_cast<DefaultAssuanTransaction*>(ctx->takeLastAssuanTransaction().release()));
- const auto source = transaction->firstStatusLine("SOURCE");
- const auto rawData = transaction->data();
- if (rawData.size() == 0) {
- std::cout << "No key found for " << email << "\n";
- } else {
- const auto data = GpgME::Data{rawData.c_str(), rawData.size()};
- const auto keys = data.toKeys(GpgME::OpenPGP);
- for (const auto &key : keys) {
- std::cout << "Found key for " << email << " at " << source << ":\n" << key << "\n";
- }
- }
-
- return 0;
-}
diff --git a/lang/qt/Makefile.am b/lang/qt/Makefile.am
deleted file mode 100644
index 9c93c101..00000000
--- a/lang/qt/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-# Makefile.am - Makefile for QGpgME.
-# Copyright (C) 2016 Bundesamt für Sicherheit in der Informationstechnik
-# Software engineering by Intevation GmbH
-#
-# This file is part of QGpgME, the Qt API binding for GpgME.
-#
-# 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, see <https://gnu.org/licenses/>.
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-if RUN_GPG_TESTS
-tests = tests
-else
-tests =
-endif
-
-SUBDIRS = src ${tests} doc
-
-EXTRA_DIST = README
diff --git a/lang/qt/README b/lang/qt/README
deleted file mode 100644
index ea185a81..00000000
--- a/lang/qt/README
+++ /dev/null
@@ -1,130 +0,0 @@
-Qt API bindings/wrapper for GPGME
----------------------------------
-Based on KF5gpgmepp QGpgME and libkleo/backends/qgpgme
-
-Please note that QGpgME has a different license (GPL only)
-then GPGME itself. See the License section in this
-document for more information.
-
-Overview
---------
-QGpgme provides a very high level Qt API around GpgMEpp.
-As such it depends on GpgMEpp additionally to GpgME.
-
-There are two general concepts in QGpgME. Data abstraction
-through GpgMEpp's Dataprovider interface and the Job pattern.
-
-Data can be provided with QByteArrayDataProvider or
-QIODeviceDataProvider which can be constructed from their
-respective types. This means you can pass a QFile, QProcess,
-QString, etc.. directly to GPGME.
-
-To provide a stable API / ABI and because of historic reasons
-in libkleo (Where QGpgME was originally developed as an abstract
-crypto backend) QGpgME only provides abstract interfaces as
-public API while the actual implementation happens in the
-private QGpgME prefixed classes.
-
-Usage
------
-
-To use QGpgME first you need to obtain a Protocol class
-either for CMS (S/MIME) or OpenPGP. This Protocol class
-can then be used to create a Job.
-
-Each Job can be started asynchronously and emits a result
-signal when done. The jobs are deleted automatically
-with QObject::deleteLater so they can be started without
-result handlers.
-
-The result signal provides a tuple of objects with the
-appropriate result information for this job. For historic
-reasons each result signal also includes an AuditLog
-and an AuditLog Error. These are only useful for
-S/MIME signature validation but are part of other jobs
-for API stability reasons.
-
-Some jobs like the verification or decryption jobs have
-dedicated result classes. Each result class at least
-has the member function error() that can be used
-to check if a job failed. Additionally errors are emitted
-in the result signal.
-
-Jobs also provide progress signal whenever GnuPG emits
-a progress status line.
-
-Most jobs also provide a way synchronously execute them.
-Please not that synchronous use does not cause the autodeletion
-to take place so you have to manually delete them.
-
-Async usage:
-
- /* Create a job */
- EncryptJob *job = openpgp()->encryptJob(/*ASCII Armor */false, /* Textmode */ false);
- /* Connect something to the result signal */
- connect(job, &EncryptJob::result, this, [] (const GpgME::EncryptionResult &result,
- const QByteArray &cipherText,
- const QString,
- const GpgME::Error) {
- /* Handle the result / do something with the ciphertext */
- });
- /* Start the job */
- job->start(keys, inptr, outptr, Context::AlwaysTrust);
- /* Do not delete the job as it is autodeleted. */
-
-Synchronous usage:
-
- /* Create a job */
- KeyListJob *listjob = openpgp()->keyListJob(false, false, false);
- /* Prepare result vector */
- std::vector<Key> keys;
- /* Execute it synchronusly */
- KeyListResult result = listjob->exec(QStringList() << QStringLiteral("[email protected]"),
- false, keys);
- /* Delete the job */
- delete listjob;
- /* Work with the result */
-
-See the generated documentation for more info on the classes
-in QGpgME. (Subdir doc)
-
-Examples / Tests
-----------------
-
-The tests in the tests subdir can be used to get a better
-idea of QGpgME's usage. They also serve to test the C++
-API. Kleopatra and KMails Messagelib also make extensive
-use of QGpgME and can be used as further examples.
-
-Hacking
--------
-QGpgME comes from a KDE background. As such it does not use
-GNU Coding styles but KDE Coding styles. See:
-https://techbase.kde.org/Policies/Frameworks_Coding_Style
-
-License
--------
-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.
diff --git a/lang/qt/doc/Doxyfile.in b/lang/qt/doc/Doxyfile.in
deleted file mode 100644
index ccccbc4a..00000000
--- a/lang/qt/doc/Doxyfile.in
+++ /dev/null
@@ -1,2352 +0,0 @@
-# Doxyfile 1.8.8
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project.
-#
-# All text after a double hash (##) is considered a comment and is placed in
-# front of the TAG it is preceding.
-#
-# All text after a single hash (#) is considered a comment and will be ignored.
-# The format is:
-# TAG = value [value, ...]
-# For lists, items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (\" \").
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all text
-# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
-# built into libc) for the transcoding. See https://www.gnu.org/software/libiconv
-# for the list of possible encodings.
-# The default value is: UTF-8.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
-# double-quotes, unless you are using Doxywizard) that should identify the
-# project for which the documentation is generated. This name is used in the
-# title of most generated pages and in a few other places.
-# The default value is: My Project.
-
-PROJECT_NAME = "QGpgME"
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
-# could be handy for archiving the generated documentation or if some version
-# control system is used.
-
-PROJECT_NUMBER = "@LIBQGPGME_LT_CURRENT@.@LIBQGPGME_LT_AGE@.@LIBQGPGME_LT_REVISION@.@BUILD_REVISION@"
-
-# Using the PROJECT_BRIEF tag one can provide an optional one line description
-# for a project that appears at the top of each page and should give viewer a
-# quick idea about the purpose of the project. Keep the description short.
-
-PROJECT_BRIEF = "Qt API for GpgME"
-
-# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
-# the documentation. The maximum height of the logo should not exceed 55 pixels
-# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
-# to the output directory.
-
-PROJECT_LOGO =
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
-# into which the generated documentation will be written. If a relative path is
-# entered, it will be relative to the location where doxygen was started. If
-# left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = "@abs_builddir@/generated"
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
-# directories (in 2 levels) under the output directory of each output format and
-# will distribute the generated files over these directories. Enabling this
-# option can be useful when feeding doxygen a huge amount of source files, where
-# putting all generated files in the same directory would otherwise causes
-# performance problems for the file system.
-# The default value is: NO.
-
-CREATE_SUBDIRS = NO
-
-# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
-# characters to appear in the names of generated files. If set to NO, non-ASCII
-# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
-# U+3044.
-# The default value is: NO.
-
-ALLOW_UNICODE_NAMES = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
-# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
-# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
-# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
-# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
-# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
-# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
-# Ukrainian and Vietnamese.
-# The default value is: English.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
-# descriptions after the members that are listed in the file and class
-# documentation (similar to Javadoc). Set to NO to disable this.
-# The default value is: YES.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
-# description of a member or function before the detailed description
-#
-# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-# The default value is: YES.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator that is
-# used to form the text in various listings. Each string in this list, if found
-# as the leading text of the brief description, will be stripped from the text
-# and the result, after processing the whole list, is used as the annotated
-# text. Otherwise, the brief description is used as-is. If left blank, the
-# following values are used ($name is automatically replaced with the name of
-# the entity):The $name class, The $name widget, The $name file, is, provides,
-# specifies, contains, represents, a, an and the.
-
-ABBREVIATE_BRIEF =
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# doxygen will generate a detailed section even if there is only a brief
-# description.
-# The default value is: NO.
-
-ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-# The default value is: NO.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
-# before files name in the file list and in the header files. If set to NO the
-# shortest path that makes the file name unique will be used
-# The default value is: YES.
-
-FULL_PATH_NAMES = NO
-
-# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
-# Stripping is only done if one of the specified strings matches the left-hand
-# part of the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the path to
-# strip.
-#
-# Note that you can specify absolute paths here, but also relative paths, which
-# will be relative from the directory where doxygen is started.
-# This tag requires that the tag FULL_PATH_NAMES is set to YES.
-
-STRIP_FROM_PATH =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
-# path mentioned in the documentation of a class, which tells the reader which
-# header file to include in order to use a class. If left blank only the name of
-# the header file containing the class definition is used. Otherwise one should
-# specify the list of include paths that are normally passed to the compiler
-# using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
-# less readable) file names. This can be useful is your file systems doesn't
-# support long names like on DOS, Mac, or CD-ROM.
-# The default value is: NO.
-
-SHORT_NAMES = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
-# first line (until the first dot) of a Javadoc-style comment as the brief
-# description. If set to NO, the Javadoc-style will behave just like regular Qt-
-# style comments (thus requiring an explicit @brief command for a brief
-# description.)
-# The default value is: NO.
-
-JAVADOC_AUTOBRIEF = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
-# line (until the first dot) of a Qt-style comment as the brief description. If
-# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
-# requiring an explicit \brief command for a brief description.)
-# The default value is: NO.
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
-# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
-# a brief description. This used to be the default behavior. The new default is
-# to treat a multi-line C++ comment block as a detailed description. Set this
-# tag to YES if you prefer the old behavior instead.
-#
-# Note that setting this tag to YES also means that rational rose comments are
-# not recognized any more.
-# The default value is: NO.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
-# documentation from any documented member that it re-implements.
-# The default value is: YES.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
-# new page for each member. If set to NO, the documentation of a member will be
-# part of the file/class/namespace that contains it.
-# The default value is: NO.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
-# uses this value to replace tabs by spaces in code fragments.
-# Minimum value: 1, maximum value: 16, default value: 4.
-
-TAB_SIZE = 4
-
-# This tag can be used to specify a number of aliases that act as commands in
-# the documentation. An alias has the form:
-# name=value
-# For example adding
-# "sideeffect=@par Side Effects:\n"
-# will allow you to put the command \sideeffect (or @sideeffect) in the
-# documentation, which will result in a user-defined paragraph with heading
-# "Side Effects:". You can put \n's in the value part of an alias to insert
-# newlines.
-
-ALIASES =
-
-# This tag can be used to specify a number of word-keyword mappings (TCL only).
-# A mapping has the form "name=value". For example adding "class=itcl::class"
-# will allow you to use the command class in the itcl::class meaning.
-
-TCL_SUBST =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
-# only. Doxygen will then generate output that is more tailored for C. For
-# instance, some of the names that are used will be different. The list of all
-# members will be omitted, etc.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_FOR_C = NO
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
-# Python sources only. Doxygen will then generate output that is more tailored
-# for that language. For instance, namespaces will be presented as packages,
-# qualified scopes will look different, etc.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources. Doxygen will then generate output that is tailored for Fortran.
-# The default value is: NO.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for VHDL.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it
-# parses. With this tag you can assign which parser to use for a given
-# extension. Doxygen has a built-in mapping, but you can override or extend it
-# using this tag. The format is ext=language, where ext is a file extension, and
-# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
-# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
-# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
-# Fortran. In the later case the parser tries to guess whether the code is fixed
-# or free formatted code, this is the default for Fortran type files), VHDL. For
-# instance to make doxygen treat .inc files as Fortran files (default is PHP),
-# and .f files as C (default is Fortran), use: inc=Fortran f=C.
-#
-# Note For files without extension you can use no_extension as a placeholder.
-#
-# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
-# the files are not read by doxygen.
-
-EXTENSION_MAPPING =
-
-# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
-# according to the Markdown format, which allows for more readable
-# documentation. See http://daringfireball.net/projects/markdown/ for details.
-# The output of markdown processing is further processed by doxygen, so you can
-# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
-# case of backward compatibilities issues.
-# The default value is: YES.
-
-MARKDOWN_SUPPORT = YES
-
-# When enabled doxygen tries to link words that correspond to documented
-# classes, or namespaces to their corresponding documentation. Such a link can
-# be prevented in individual cases by by putting a % sign in front of the word
-# or globally by setting AUTOLINK_SUPPORT to NO.
-# The default value is: YES.
-
-AUTOLINK_SUPPORT = YES
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should set this
-# tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string);
-# versus func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-# The default value is: NO.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-# The default value is: NO.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
-# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
-# will parse them like normal C++ but will assume all classes use public instead
-# of private inheritance when no explicit protection keyword is present.
-# The default value is: NO.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate
-# getter and setter methods for a property. Setting this option to YES will make
-# doxygen to replace the get and set methods by a property in the documentation.
-# This will only work if the methods are indeed getting or setting a simple
-# type. If this is not the case, or you want to show the methods anyway, you
-# should set this option to NO.
-# The default value is: YES.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-# The default value is: NO.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES to allow class member groups of the same type
-# (for instance a group of public functions) to be put as a subgroup of that
-# type (e.g. under the Public Functions section). Set it to NO to prevent
-# subgrouping. Alternatively, this can be done per class using the
-# \nosubgrouping command.
-# The default value is: YES.
-
-SUBGROUPING = YES
-
-# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
-# are shown inside the group in which they are included (e.g. using \ingroup)
-# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
-# and RTF).
-#
-# Note that this feature does not work in combination with
-# SEPARATE_MEMBER_PAGES.
-# The default value is: NO.
-
-INLINE_GROUPED_CLASSES = NO
-
-# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
-# with only public data fields or simple typedef fields will be shown inline in
-# the documentation of the scope in which they are defined (i.e. file,
-# namespace, or group documentation), provided this scope is documented. If set
-# to NO, structs, classes, and unions are shown on a separate page (for HTML and
-# Man pages) or section (for LaTeX and RTF).
-# The default value is: NO.
-
-INLINE_SIMPLE_STRUCTS = NO
-
-# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
-# enum is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically be
-# useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-# The default value is: NO.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
-# cache is used to resolve symbols given their name and scope. Since this can be
-# an expensive process and often the same symbol appears multiple times in the
-# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
-# doxygen will become slower. If the cache is too large, memory is wasted. The
-# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
-# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
-# symbols. At the end of a run doxygen will report the cache usage and suggest
-# the optimal cache size from a speed point of view.
-# Minimum value: 0, maximum value: 9, default value: 0.
-
-LOOKUP_CACHE_SIZE = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available. Private
-# class members and static file members will be hidden unless the
-# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
-# Note: This will also disable the warnings about undocumented members that are
-# normally produced when WARNINGS is set to YES.
-# The default value is: NO.
-
-EXTRACT_ALL = NO
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
-# be included in the documentation.
-# The default value is: NO.
-
-EXTRACT_PRIVATE = NO
-
-# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
-# scope will be included in the documentation.
-# The default value is: NO.
-
-EXTRACT_PACKAGE = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
-# included in the documentation.
-# The default value is: NO.
-
-EXTRACT_STATIC = NO
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
-# locally in source files will be included in the documentation. If set to NO
-# only classes defined in header files are included. Does not have any effect
-# for Java sources.
-# The default value is: YES.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local methods,
-# which are defined in the implementation section but not in the interface are
-# included in the documentation. If set to NO only methods in the interface are
-# included.
-# The default value is: NO.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base name of
-# the file that contains the anonymous namespace. By default anonymous namespace
-# are hidden.
-# The default value is: NO.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
-# undocumented members inside documented classes or files. If set to NO these
-# members will be included in the various overviews, but no documentation
-# section is generated. This option has no effect if EXTRACT_ALL is enabled.
-# The default value is: NO.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy. If set
-# to NO these classes will be included in the various overviews. This option has
-# no effect if EXTRACT_ALL is enabled.
-# The default value is: NO.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
-# (class|struct|union) declarations. If set to NO these declarations will be
-# included in the documentation.
-# The default value is: NO.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
-# documentation blocks found inside the body of a function. If set to NO these
-# blocks will be appended to the function's detailed documentation block.
-# The default value is: NO.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation that is typed after a
-# \internal command is included. If the tag is set to NO then the documentation
-# will be excluded. Set it to YES to include the internal documentation.
-# The default value is: NO.
-
-INTERNAL_DOCS = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
-# names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-# The default value is: system dependent.
-
-CASE_SENSE_NAMES = YES
-
-# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
-# their full class and namespace scopes in the documentation. If set to YES the
-# scope will be hidden.
-# The default value is: NO.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
-# the files that are included by a file in the documentation of that file.
-# The default value is: YES.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
-# grouped member an include statement to the documentation, telling the reader
-# which file to include in order to use the member.
-# The default value is: NO.
-
-SHOW_GROUPED_MEMB_INC = NO
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
-# files with double quotes in the documentation rather than with sharp brackets.
-# The default value is: NO.
-
-FORCE_LOCAL_INCLUDES = NO
-
-# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
-# documentation for inline members.
-# The default value is: YES.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
-# (detailed) documentation of file and class members alphabetically by member
-# name. If set to NO the members will appear in declaration order.
-# The default value is: YES.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
-# descriptions of file, namespace and class members alphabetically by member
-# name. If set to NO the members will appear in declaration order. Note that
-# this will also influence the order of the classes in the class list.
-# The default value is: NO.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
-# (brief and detailed) documentation of class members so that constructors and
-# destructors are listed first. If set to NO the constructors will appear in the
-# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
-# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
-# member documentation.
-# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
-# detailed member documentation.
-# The default value is: NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
-# of group names into alphabetical order. If set to NO the group names will
-# appear in their defined order.
-# The default value is: NO.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
-# fully-qualified names, including namespaces. If set to NO, the class list will
-# be sorted only by class name, not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the alphabetical
-# list.
-# The default value is: NO.
-
-SORT_BY_SCOPE_NAME = NO
-
-# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
-# type resolution of all parameters of a function it will reject a match between
-# the prototype and the implementation of a member function even if there is
-# only one candidate or it is obvious which candidate to choose by doing a
-# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
-# accept a match between prototype and implementation in such cases.
-# The default value is: NO.
-
-STRICT_PROTO_MATCHING = NO
-
-# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
-# todo list. This list is created by putting \todo commands in the
-# documentation.
-# The default value is: YES.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
-# test list. This list is created by putting \test commands in the
-# documentation.
-# The default value is: YES.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
-# list. This list is created by putting \bug commands in the documentation.
-# The default value is: YES.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
-# the deprecated list. This list is created by putting \deprecated commands in
-# the documentation.
-# The default value is: YES.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional documentation
-# sections, marked by \if <section_label> ... \endif and \cond <section_label>
-# ... \endcond blocks.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
-# initial value of a variable or macro / define can have for it to appear in the
-# documentation. If the initializer consists of more lines than specified here
-# it will be hidden. Use a value of 0 to hide initializers completely. The
-# appearance of the value of individual variables and macros / defines can be
-# controlled using \showinitializer or \hideinitializer command in the
-# documentation regardless of this setting.
-# Minimum value: 0, maximum value: 10000, default value: 30.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
-# the bottom of the documentation of classes and structs. If set to YES the list
-# will mention the files that were used to generate the documentation.
-# The default value is: YES.
-
-SHOW_USED_FILES = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
-# will remove the Files entry from the Quick Index and from the Folder Tree View
-# (if specified).
-# The default value is: YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
-# page. This will remove the Namespaces entry from the Quick Index and from the
-# Folder Tree View (if specified).
-# The default value is: YES.
-
-SHOW_NAMESPACES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command command input-file, where command is the value of the
-# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
-# by doxygen. Whatever the program writes to standard output is used as the file
-# version. For an example see the documentation.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
-# by doxygen. The layout file controls the global structure of the generated
-# output files in an output format independent way. To create the layout file
-# that represents doxygen's defaults, run doxygen with the -l option. You can
-# optionally specify a file name after the option, if omitted DoxygenLayout.xml
-# will be used as the name of the layout file.
-#
-# Note that if you run doxygen from a directory containing a file called
-# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
-# tag is left empty.
-
-LAYOUT_FILE =
-
-# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
-# the reference definitions. This must be a list of .bib files. The .bib
-# extension is automatically appended if omitted. This requires the bibtex tool
-# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
-# For LaTeX the style of the bibliography can be controlled using
-# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
-# search path. See also \cite for info how to create references.
-
-CITE_BIB_FILES =
-
-#---------------------------------------------------------------------------
-# Configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated to
-# standard output by doxygen. If QUIET is set to YES this implies that the
-# messages are off.
-# The default value is: NO.
-
-QUIET = YES
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
-# this implies that the warnings are on.
-#
-# Tip: Turn warnings on while writing the documentation.
-# The default value is: YES.
-
-WARNINGS = YES
-
-# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
-# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
-# will automatically be disabled.
-# The default value is: YES.
-
-WARN_IF_UNDOCUMENTED = NO
-
-# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some parameters
-# in a documented function, or documenting parameters that don't exist or using
-# markup commands wrongly.
-# The default value is: YES.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
-# are documented, but have no documentation for their parameters or return
-# value. If set to NO doxygen will only warn about wrong or incomplete parameter
-# documentation, but not about the absence of documentation.
-# The default value is: NO.
-
-WARN_NO_PARAMDOC = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that doxygen
-# can produce. The string should contain the $file, $line, and $text tags, which
-# will be replaced by the file and line number from which the warning originated
-# and the warning text. Optionally the format may contain $version, which will
-# be replaced by the version of the file (if it could be obtained via
-# FILE_VERSION_FILTER)
-# The default value is: $file:$line: $text.
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning and error
-# messages should be written. If left blank the output is written to standard
-# error (stderr).
-
-WARN_LOGFILE =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag is used to specify the files and/or directories that contain
-# documented source files. You may enter file names like myfile.cpp or
-# directories like /usr/src/myproject. Separate the files or directories with
-# spaces.
-# Note: If this tag is empty the current directory is searched.
-
-INPUT = "@top_srcdir@/lang/qt/src"
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
-# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
-# documentation (see: https://www.gnu.org/software/libiconv) for the list of
-# possible encodings.
-# The default value is: UTF-8.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
-# *.h) to filter out the source-files in the directories. If left blank the
-# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
-# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
-# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
-# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
-# *.qsf, *.as and *.js.
-
-FILE_PATTERNS =
-
-# The RECURSIVE tag can be used to specify whether or not subdirectories should
-# be searched for input files as well.
-# The default value is: NO.
-
-RECURSIVE = NO
-
-# The EXCLUDE tag can be used to specify files and/or directories that should be
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-#
-# Note that relative paths are relative to the directory from which doxygen is
-# run.
-
-EXCLUDE =
-
-# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
-# directories that are symbolic links (a Unix file system feature) are excluded
-# from the input.
-# The default value is: NO.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories.
-#
-# Note that the wildcards are matched against the file with absolute path, so to
-# exclude all test directories for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-#
-# Note that the wildcards are matched against the file with absolute path, so to
-# exclude all test directories use the pattern */test/*
-
-EXCLUDE_SYMBOLS =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or directories
-# that contain example code fragments that are included (see the \include
-# command).
-
-EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
-# *.h) to filter out the source-files in the directories. If left blank all
-# files are included.
-
-EXAMPLE_PATTERNS =
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude commands
-# irrespective of the value of the RECURSIVE tag.
-# The default value is: NO.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or directories
-# that contain images that are to be included in the documentation (see the
-# \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command:
-#
-# <filter> <input-file>
-#
-# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
-# name of an input file. Doxygen will then use the output that the filter
-# program writes to standard output. If FILTER_PATTERNS is specified, this tag
-# will be ignored.
-#
-# Note that the filter must not add or remove lines; it is applied before the
-# code is scanned, but not when the output code is generated. If lines are added
-# or removed, the anchors will not be placed correctly.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form: pattern=filter
-# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
-# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
-# patterns match the file name, INPUT_FILTER is applied.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER ) will also be used to filter the input files that are used for
-# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
-# The default value is: NO.
-
-FILTER_SOURCE_FILES = NO
-
-# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
-# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
-# it is also possible to disable source filtering for a specific pattern using
-# *.ext= (so without naming a filter).
-# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
-
-FILTER_SOURCE_PATTERNS =
-
-# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
-# is part of the input, its contents will be placed on the main page
-# (index.html). This can be useful if you have a project on for instance GitHub
-# and want to reuse the introduction page also for the doxygen output.
-
-USE_MDFILE_AS_MAINPAGE =
-
-#---------------------------------------------------------------------------
-# Configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
-# generated. Documented entities will be cross-referenced with these sources.
-#
-# Note: To get rid of all source code in the generated output, make sure that
-# also VERBATIM_HEADERS is set to NO.
-# The default value is: NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body of functions,
-# classes and enums directly into the documentation.
-# The default value is: NO.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
-# special comment blocks from generated source code fragments. Normal C, C++ and
-# Fortran comments will always remain visible.
-# The default value is: YES.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
-# function all documented functions referencing it will be listed.
-# The default value is: NO.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES then for each documented function
-# all documented entities called/used by that function will be listed.
-# The default value is: NO.
-
-REFERENCES_RELATION = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
-# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
-# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
-# link to the documentation.
-# The default value is: YES.
-
-REFERENCES_LINK_SOURCE = YES
-
-# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
-# source code will show a tooltip with additional information such as prototype,
-# brief description and links to the definition and documentation. Since this
-# will make the HTML file larger and loading of large files a bit slower, you
-# can opt to disable this feature.
-# The default value is: YES.
-# This tag requires that the tag SOURCE_BROWSER is set to YES.
-
-SOURCE_TOOLTIPS = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code will
-# point to the HTML generated by the htags(1) tool instead of doxygen built-in
-# source browser. The htags tool is part of GNU's global source tagging system
-# (see https://www.gnu.org/software/global/global.html). You will need version
-# 4.8.6 or higher.
-#
-# To use it do the following:
-# - Install the latest version of global
-# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
-# - Make sure the INPUT points to the root of the source tree
-# - Run doxygen as normal
-#
-# Doxygen will invoke htags (and that will in turn invoke gtags), so these
-# tools must be available from the command line (i.e. in the search path).
-#
-# The result: instead of the source browser generated by doxygen, the links to
-# source code will now point to the output of htags.
-# The default value is: NO.
-# This tag requires that the tag SOURCE_BROWSER is set to YES.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
-# verbatim copy of the header file for each class for which an include is
-# specified. Set to NO to disable this.
-# See also: Section \class.
-# The default value is: YES.
-
-VERBATIM_HEADERS = YES
-
-# If the CLANG_ASSISTED_PARSING tag is set to YES, then doxygen will use the
-# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
-# cost of reduced performance. This can be particularly helpful with template
-# rich C++ code for which doxygen's built-in parser lacks the necessary type
-# information.
-# Note: The availability of this option depends on whether or not doxygen was
-# compiled with the --with-libclang option.
-# The default value is: NO.
-
-CLANG_ASSISTED_PARSING = NO
-
-# If clang assisted parsing is enabled you can provide the compiler with command
-# line options that you would normally use when invoking the compiler. Note that
-# the include paths will already be set by doxygen for the files and directories
-# specified with INPUT and INCLUDE_PATH.
-# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
-
-CLANG_OPTIONS =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
-# compounds will be generated. Enable this if the project contains a lot of
-# classes, structs, unions or interfaces.
-# The default value is: YES.
-
-ALPHABETICAL_INDEX = YES
-
-# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
-# which the alphabetical index list will be split.
-# Minimum value: 1, maximum value: 20, default value: 5.
-# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all classes will
-# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
-# can be used to specify a prefix (or a list of prefixes) that should be ignored
-# while generating the index headers.
-# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
-# The default value is: YES.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: html.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
-# generated HTML page (for example: .htm, .php, .asp).
-# The default value is: .html.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
-# each generated HTML page. If the tag is left blank doxygen will generate a
-# standard header.
-#
-# To get valid HTML the header file that includes any scripts and style sheets
-# that doxygen needs, which is dependent on the configuration options used (e.g.
-# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
-# default header using
-# doxygen -w html new_header.html new_footer.html new_stylesheet.css
-# YourConfigFile
-# and then modify the file new_header.html. See also section "Doxygen usage"
-# for information on how to generate the default header that doxygen normally
-# uses.
-# Note: The header is subject to change so you typically have to regenerate the
-# default header when upgrading to a newer version of doxygen. For a description
-# of the possible markers and block names see the documentation.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
-# generated HTML page. If the tag is left blank doxygen will generate a standard
-# footer. See HTML_HEADER for more information on how to generate a default
-# footer and what special commands can be used inside the footer. See also
-# section "Doxygen usage" for information on how to generate the default footer
-# that doxygen normally uses.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
-# sheet that is used by each HTML page. It can be used to fine-tune the look of
-# the HTML output. If left blank doxygen will generate a default style sheet.
-# See also section "Doxygen usage" for information on how to generate the style
-# sheet that doxygen normally uses.
-# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
-# it is more robust and this tag (HTML_STYLESHEET) will in the future become
-# obsolete.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_STYLESHEET =
-
-# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
-# cascading style sheets that are included after the standard style sheets
-# created by doxygen. Using this option one can overrule certain style aspects.
-# This is preferred over using HTML_STYLESHEET since it does not replace the
-# standard style sheet and is therefore more robust against future updates.
-# Doxygen will copy the style sheet files to the output directory.
-# Note: The order of the extra stylesheet files is of importance (e.g. the last
-# stylesheet in the list overrules the setting of the previous ones in the
-# list). For an example see the documentation.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_EXTRA_STYLESHEET =
-
-# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
-# other source files which should be copied to the HTML output directory. Note
-# that these files will be copied to the base HTML output directory. Use the
-# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
-# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
-# files will be copied as-is; there are no commands or markers available.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_EXTRA_FILES =
-
-# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
-# will adjust the colors in the stylesheet and background images according to
-# this color. Hue is specified as an angle on a colorwheel, see
-# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
-# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
-# purple, and 360 is red again.
-# Minimum value: 0, maximum value: 359, default value: 220.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_HUE = 220
-
-# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
-# in the HTML output. For a value of 0 the output will use grayscales only. A
-# value of 255 will produce the most vivid colors.
-# Minimum value: 0, maximum value: 255, default value: 100.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_SAT = 100
-
-# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
-# luminance component of the colors in the HTML output. Values below 100
-# gradually make the output lighter, whereas values above 100 make the output
-# darker. The value divided by 100 is the actual gamma applied, so 80 represents
-# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
-# change the gamma.
-# Minimum value: 40, maximum value: 240, default value: 80.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_GAMMA = 80
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting this
-# to NO can help when comparing the output of multiple runs.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_TIMESTAMP = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_DYNAMIC_SECTIONS = NO
-
-# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
-# shown in the various tree structured indices initially; the user can expand
-# and collapse entries dynamically later on. Doxygen will expand the tree to
-# such a level that at most the specified number of entries are visible (unless
-# a fully collapsed tree already exceeds this amount). So setting the number of
-# entries 1 will produce a full collapsed tree by default. 0 is a special value
-# representing an infinite number of entries and will result in a full expanded
-# tree by default.
-# Minimum value: 0, maximum value: 9999, default value: 100.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_INDEX_NUM_ENTRIES = 100
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files will be
-# generated that can be used as input for Apple's Xcode 3 integrated development
-# environment (see: http://developer.apple.com/tools/xcode/), introduced with
-# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
-# Makefile in the HTML output directory. Running make will produce the docset in
-# that directory and running make install will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
-# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
-# for more information.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_DOCSET = NO
-
-# This tag determines the name of the docset feed. A documentation feed provides
-# an umbrella under which multiple documentation sets from a single provider
-# (such as a company or product suite) can be grouped.
-# The default value is: Doxygen generated docs.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_FEEDNAME = "Doxygen generated docs"
-
-# This tag specifies a string that should uniquely identify the documentation
-# set bundle. This should be a reverse domain-name style string, e.g.
-# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_BUNDLE_ID = org.doxygen.Project
-
-# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
-# the documentation publisher. This should be a reverse domain-name style
-# string, e.g. com.mycompany.MyDocSet.documentation.
-# The default value is: org.doxygen.Publisher.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_PUBLISHER_ID = org.doxygen.Publisher
-
-# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
-# The default value is: Publisher.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_PUBLISHER_NAME = Publisher
-
-# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
-# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
-# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
-# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
-# Windows.
-#
-# The HTML Help Workshop contains a compiler that can convert all HTML output
-# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
-# files are now used as the Windows 98 help format, and will replace the old
-# Windows help format (.hlp) on all Windows platforms in the future. Compressed
-# HTML files also contain an index, a table of contents, and you can search for
-# words in the documentation. The HTML workshop also contains a viewer for
-# compressed HTML files.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_HTMLHELP = NO
-
-# The CHM_FILE tag can be used to specify the file name of the resulting .chm
-# file. You can add a path in front of the file if the result should not be
-# written to the html output directory.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-CHM_FILE =
-
-# The HHC_LOCATION tag can be used to specify the location (absolute path
-# including file name) of the HTML help compiler ( hhc.exe). If non-empty
-# doxygen will try to run the HTML help compiler on the generated index.hhp.
-# The file has to be specified with full path.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-HHC_LOCATION =
-
-# The GENERATE_CHI flag controls if a separate .chi index file is generated (
-# YES) or that it should be included in the master .chm file ( NO).
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-GENERATE_CHI = NO
-
-# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
-# and project file content.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-CHM_INDEX_ENCODING =
-
-# The BINARY_TOC flag controls whether a binary table of contents is generated (
-# YES) or a normal table of contents ( NO) in the .chm file. Furthermore it
-# enables the Previous and Next buttons.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members to
-# the table of contents of the HTML help documentation and to the tree view.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-TOC_EXPAND = NO
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
-# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
-# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
-# (.qch) of the generated HTML documentation.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
-# the file name of the resulting .qch file. The path specified is relative to
-# the HTML output folder.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
-# Project output. For more information please see Qt Help Project / Namespace
-# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_NAMESPACE = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
-# Help Project output. For more information please see Qt Help Project / Virtual
-# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
-# folders).
-# The default value is: doc.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
-# filter to add. For more information please see Qt Help Project / Custom
-# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
-# filters).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
-# custom filter to add. For more information please see Qt Help Project / Custom
-# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
-# filters).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
-# project's filter section matches. Qt Help Project / Filter Attributes (see:
-# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_SECT_FILTER_ATTRS =
-
-# The QHG_LOCATION tag can be used to specify the location of Qt's
-# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
-# generated .qhp file.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHG_LOCATION =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
-# generated, together with the HTML files, they form an Eclipse help plugin. To
-# install this plugin and make it available under the help contents menu in
-# Eclipse, the contents of the directory containing the HTML and XML files needs
-# to be copied into the plugins directory of eclipse. The name of the directory
-# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
-# After copying Eclipse needs to be restarted before the help appears.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_ECLIPSEHELP = NO
-
-# A unique identifier for the Eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have this
-# name. Each documentation set should have its own identifier.
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
-
-ECLIPSE_DOC_ID = org.doxygen.Project
-
-# If you want full control over the layout of the generated HTML pages it might
-# be necessary to disable the index and replace it with your own. The
-# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
-# of each HTML page. A value of NO enables the index and the value YES disables
-# it. Since the tabs in the index contain the same information as the navigation
-# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-DISABLE_INDEX = NO
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information. If the tag
-# value is set to YES, a side panel will be generated containing a tree-like
-# index structure (just like the one that is generated for HTML Help). For this
-# to work a browser that supports JavaScript, DHTML, CSS and frames is required
-# (i.e. any modern browser). Windows users are probably better off using the
-# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
-# further fine-tune the look of the index. As an example, the default style
-# sheet generated by doxygen has an example that shows how to put an image at
-# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
-# the same information as the tab index, you could consider setting
-# DISABLE_INDEX to YES when enabling this option.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_TREEVIEW = NO
-
-# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
-# doxygen will group on one line in the generated HTML documentation.
-#
-# Note that a value of 0 will completely suppress the enum values from appearing
-# in the overview section.
-# Minimum value: 0, maximum value: 20, default value: 4.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-ENUM_VALUES_PER_LINE = 4
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
-# to set the initial width (in pixels) of the frame in which the tree is shown.
-# Minimum value: 0, maximum value: 1500, default value: 250.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-TREEVIEW_WIDTH = 250
-
-# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
-# external symbols imported via tag files in a separate window.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-EXT_LINKS_IN_WINDOW = NO
-
-# Use this tag to change the font size of LaTeX formulas included as images in
-# the HTML documentation. When you change the font size after a successful
-# doxygen run you need to manually remove any form_*.png images from the HTML
-# output directory to force them to be regenerated.
-# Minimum value: 8, maximum value: 50, default value: 10.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-FORMULA_FONTSIZE = 10
-
-# Use the FORMULA_TRANPARENT tag to determine whether or not the images
-# generated for formulas are transparent PNGs. Transparent PNGs are not
-# supported properly for IE 6.0, but are supported on all modern browsers.
-#
-# Note that when changing this option you need to delete any form_*.png files in
-# the HTML output directory before the changes have effect.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-FORMULA_TRANSPARENT = YES
-
-# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
-# http://www.mathjax.org) which uses client side Javascript for the rendering
-# instead of using prerendered bitmaps. Use this if you do not have LaTeX
-# installed or if you want to formulas look prettier in the HTML output. When
-# enabled you may also need to install MathJax separately and configure the path
-# to it using the MATHJAX_RELPATH option.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-USE_MATHJAX = NO
-
-# When MathJax is enabled you can set the default output format to be used for
-# the MathJax output. See the MathJax site (see:
-# http://docs.mathjax.org/en/latest/output.html) for more details.
-# Possible values are: HTML-CSS (which is slower, but has the best
-# compatibility), NativeMML (i.e. MathML) and SVG.
-# The default value is: HTML-CSS.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_FORMAT = HTML-CSS
-
-# When MathJax is enabled you need to specify the location relative to the HTML
-# output directory using the MATHJAX_RELPATH option. The destination directory
-# should contain the MathJax.js script. For instance, if the mathjax directory
-# is located at the same level as the HTML output directory, then
-# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
-# Content Delivery Network so you can quickly see the result without installing
-# MathJax. However, it is strongly recommended to install a local copy of
-# MathJax from http://www.mathjax.org before deployment.
-# The default value is: http://cdn.mathjax.org/mathjax/latest.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
-
-# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
-# extension names that should be enabled during MathJax rendering. For example
-# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_EXTENSIONS =
-
-# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
-# of code that will be used on startup of the MathJax code. See the MathJax site
-# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
-# example see the documentation.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_CODEFILE =
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
-# the HTML output. The underlying search engine uses javascript and DHTML and
-# should work on any modern browser. Note that when using HTML help
-# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
-# there is already a search function so this one should typically be disabled.
-# For large projects the javascript based search engine can be slow, then
-# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
-# search using the keyboard; to jump to the search box use <access key> + S
-# (what the <access key> is depends on the OS and browser, but it is typically
-# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
-# key> to jump into the search results window, the results can be navigated
-# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
-# the search. The filter options can be selected when the cursor is inside the
-# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
-# to select a filter and <Enter> or <escape> to activate or cancel the filter
-# option.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-SEARCHENGINE = YES
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
-# implemented using a web server instead of a web client using Javascript. There
-# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
-# setting. When disabled, doxygen will generate a PHP script for searching and
-# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
-# and searching needs to be provided by external tools. See the section
-# "External Indexing and Searching" for details.
-# The default value is: NO.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SERVER_BASED_SEARCH = NO
-
-# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
-# script for searching. Instead the search results are written to an XML file
-# which needs to be processed by an external indexer. Doxygen will invoke an
-# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
-# search results.
-#
-# Doxygen ships with an example indexer ( doxyindexer) and search engine
-# (doxysearch.cgi) which are based on the open source search engine library
-# Xapian (see: http://xapian.org/).
-#
-# See the section "External Indexing and Searching" for details.
-# The default value is: NO.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTERNAL_SEARCH = NO
-
-# The SEARCHENGINE_URL should point to a search engine hosted by a web server
-# which will return the search results when EXTERNAL_SEARCH is enabled.
-#
-# Doxygen ships with an example indexer ( doxyindexer) and search engine
-# (doxysearch.cgi) which are based on the open source search engine library
-# Xapian (see: http://xapian.org/). See the section "External Indexing and
-# Searching" for details.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SEARCHENGINE_URL =
-
-# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
-# search data is written to a file for indexing by an external tool. With the
-# SEARCHDATA_FILE tag the name of this file can be specified.
-# The default file is: searchdata.xml.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SEARCHDATA_FILE = searchdata.xml
-
-# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
-# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
-# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
-# projects and redirect the results back to the right project.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTERNAL_SEARCH_ID =
-
-# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
-# projects other than the one defined by this configuration file, but that are
-# all added to the same external search index. Each project needs to have a
-# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
-# to a relative location where the documentation can be found. The format is:
-# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTRA_SEARCH_MAPPINGS =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
-# The default value is: YES.
-
-GENERATE_LATEX = YES
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: latex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked.
-#
-# Note that when enabling USE_PDFLATEX this option is only used for generating
-# bitmaps for formulas in the HTML output, but not in the Makefile that is
-# written to the output directory.
-# The default file is: latex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
-# index for LaTeX.
-# The default file is: makeindex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
-# documents. This may be useful for small projects and may help to save some
-# trees in general.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used by the
-# printer.
-# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
-# 14 inches) and executive (7.25 x 10.5 inches).
-# The default value is: a4.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-PAPER_TYPE = a4
-
-# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
-# that should be included in the LaTeX output. To get the times font for
-# instance you can specify
-# EXTRA_PACKAGES=times
-# If left blank no extra packages will be included.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
-# generated LaTeX document. The header should contain everything until the first
-# chapter. If it is left blank doxygen will generate a standard header. See
-# section "Doxygen usage" for information on how to let doxygen write the
-# default header to a separate file.
-#
-# Note: Only use a user-defined header if you know what you are doing! The
-# following commands have a special meaning inside the header: $title,
-# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
-# $projectbrief, $projectlogo. Doxygen will replace $title with the empty string,
-# for the replacement values of the other commands the user is referred to
-# HTML_HEADER.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_HEADER =
-
-# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
-# generated LaTeX document. The footer should contain everything after the last
-# chapter. If it is left blank doxygen will generate a standard footer. See
-# LATEX_HEADER for more information on how to generate a default footer and what
-# special commands can be used inside the footer.
-#
-# Note: Only use a user-defined footer if you know what you are doing!
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_FOOTER =
-
-# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
-# other source files which should be copied to the LATEX_OUTPUT output
-# directory. Note that the files will be copied as-is; there are no commands or
-# markers available.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_EXTRA_FILES =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
-# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
-# contain links (just like the HTML output) instead of page references. This
-# makes the output suitable for online browsing using a PDF viewer.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-PDF_HYPERLINKS = YES
-
-# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
-# the PDF file directly from the LaTeX files. Set this option to YES to get a
-# higher quality PDF documentation.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-USE_PDFLATEX = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
-# command to the generated LaTeX files. This will instruct LaTeX to keep running
-# if errors occur, instead of asking the user for help. This option is also used
-# when generating formulas in HTML.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_BATCHMODE = NO
-
-# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
-# index chapters (such as File Index, Compound Index, etc.) in the output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_HIDE_INDICES = NO
-
-# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
-# code with syntax highlighting in the LaTeX output.
-#
-# Note that which sources are shown also depends on other settings such as
-# SOURCE_BROWSER.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_SOURCE_CODE = NO
-
-# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
-# bibliography, e.g. plainnat, or ieeetr. See
-# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
-# The default value is: plain.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_BIB_STYLE = plain
-
-#---------------------------------------------------------------------------
-# Configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
-# RTF output is optimized for Word 97 and may not look too pretty with other RTF
-# readers/editors.
-# The default value is: NO.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: rtf.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
-# documents. This may be useful for small projects and may help to save some
-# trees in general.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
-# contain hyperlink fields. The RTF file will contain links (just like the HTML
-# output) instead of page references. This makes the output suitable for online
-# browsing using Word or some other Word compatible readers that support those
-# fields.
-#
-# Note: WordPad (write) and others do not support links.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's config
-# file, i.e. a series of assignments. You only have to provide replacements,
-# missing definitions are set to their default value.
-#
-# See also section "Doxygen usage" for information on how to generate the
-# default style sheet that doxygen normally uses.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an RTF document. Syntax is
-# similar to doxygen's config file. A template extensions file can be generated
-# using doxygen -e rtf extensionFile.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
-# classes and files.
-# The default value is: NO.
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it. A directory man3 will be created inside the directory specified by
-# MAN_OUTPUT.
-# The default directory is: man.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to the generated
-# man pages. In case the manual section does not start with a number, the number
-# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
-# optional.
-# The default value is: .3.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_EXTENSION = .3
-
-# The MAN_SUBDIR tag determines the name of the directory created within
-# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
-# MAN_EXTENSION with the initial . removed.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_SUBDIR =
-
-# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
-# will generate one additional man file for each entity documented in the real
-# man page(s). These additional files only source the real man page, but without
-# them the man command would be unable to find the correct page.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
-# captures the structure of the code including all documentation.
-# The default value is: NO.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: xml.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_OUTPUT = xml
-
-# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
-# listings (including syntax highlighting and cross-referencing information) to
-# the XML output. Note that enabling this will significantly increase the size
-# of the XML output.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# Configuration options related to the DOCBOOK output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
-# that can be used to generate PDF.
-# The default value is: NO.
-
-GENERATE_DOCBOOK = NO
-
-# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
-# front of it.
-# The default directory is: docbook.
-# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
-
-DOCBOOK_OUTPUT = docbook
-
-# If the DOCBOOK_PROGRAMLISTING tag is set to YES doxygen will include the
-# program listings (including syntax highlighting and cross-referencing
-# information) to the DOCBOOK output. Note that enabling this will significantly
-# increase the size of the DOCBOOK output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
-
-DOCBOOK_PROGRAMLISTING = NO
-
-#---------------------------------------------------------------------------
-# Configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
-# Definitions (see http://autogen.sf.net) file that captures the structure of
-# the code including all documentation. Note that this feature is still
-# experimental and incomplete at the moment.
-# The default value is: NO.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
-# file that captures the structure of the code including all documentation.
-#
-# Note that this feature is still experimental and incomplete at the moment.
-# The default value is: NO.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
-# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
-# output from the Perl module output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
-# formatted so it can be parsed by a human reader. This is useful if you want to
-# understand what is going on. On the other hand, if this tag is set to NO the
-# size of the Perl module output will be much smaller and Perl will parse it
-# just the same.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file are
-# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
-# so different doxyrules.make files included by the same Makefile don't
-# overwrite each other's variables.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
-# C-preprocessor directives found in the sources and include files.
-# The default value is: YES.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
-# in the source code. If set to NO only conditional compilation will be
-# performed. Macro expansion can be done in a controlled way by setting
-# EXPAND_ONLY_PREDEF to YES.
-# The default value is: NO.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-MACRO_EXPANSION = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
-# the macro expansion is limited to the macros specified with the PREDEFINED and
-# EXPAND_AS_DEFINED tags.
-# The default value is: NO.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-EXPAND_ONLY_PREDEF = NO
-
-# If the SEARCH_INCLUDES tag is set to YES the includes files in the
-# INCLUDE_PATH will be searched if a #include is found.
-# The default value is: YES.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by the
-# preprocessor.
-# This tag requires that the tag SEARCH_INCLUDES is set to YES.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will be
-# used.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that are
-# defined before the preprocessor is started (similar to the -D option of e.g.
-# gcc). The argument of the tag is a list of macros of the form: name or
-# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
-# is assumed. To prevent a macro definition from being undefined via #undef or
-# recursively expanded use the := operator instead of the = operator.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-PREDEFINED =
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
-# tag can be used to specify a list of macro names that should be expanded. The
-# macro definition that is found in the sources will be used. Use the PREDEFINED
-# tag if you want to use a different macro definition that overrules the
-# definition found in the source code.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
-# remove all references to function-like macros that are alone on a line, have
-# an all uppercase name, and do not end with a semicolon. Such function macros
-# are typically used for boiler-plate code, and will confuse the parser if not
-# removed.
-# The default value is: YES.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration options related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES tag can be used to specify one or more tag files. For each tag
-# file the location of the external documentation should be added. The format of
-# a tag file without this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where loc1 and loc2 can be relative or absolute paths or URLs. See the
-# section "Linking to external documentation" for more information about the use
-# of tag files.
-# Note: Each tag file must have a unique name (where the name does NOT include
-# the path). If a tag file is not located in the directory in which doxygen is
-# run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
-# tag file that is based on the input files it reads. See section "Linking to
-# external documentation" for more information about the usage of tag files.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
-# class index. If set to NO only the inherited external classes will be listed.
-# The default value is: NO.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
-# the modules index. If set to NO, only the current project's groups will be
-# listed.
-# The default value is: YES.
-
-EXTERNAL_GROUPS = YES
-
-# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
-# the related pages index. If set to NO, only the current project's pages will
-# be listed.
-# The default value is: YES.
-
-EXTERNAL_PAGES = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of 'which perl').
-# The default file (with absolute path) is: /usr/bin/perl.
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
-# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
-# NO turns the diagrams off. Note that this option also works with HAVE_DOT
-# disabled, but it is recommended to install and use dot, since it yields more
-# powerful graphs.
-# The default value is: YES.
-
-CLASS_DIAGRAMS = YES
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see:
-# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
-# You can include diagrams made with dia in doxygen documentation. Doxygen will
-# then run dia to produce the diagram and insert it in the documentation. The
-# DIA_PATH tag allows you to specify the directory where the dia binary resides.
-# If left empty dia is assumed to be found in the default search path.
-
-DIA_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide inheritance
-# and usage relations if the target is undocumented or is not a class.
-# The default value is: YES.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz (see:
-# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
-# Bell Labs. The other options in this section have no effect if this option is
-# set to NO
-# The default value is: YES.
-
-HAVE_DOT = @HAVE_DOT@
-
-# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
-# to run in parallel. When set to 0 doxygen will base this on the number of
-# processors available in the system. You can set it explicitly to a value
-# larger than 0 to get control over the balance between CPU load and processing
-# speed.
-# Minimum value: 0, maximum value: 32, default value: 0.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_NUM_THREADS = 0
-
-# When you want a differently looking font in the dot files that doxygen
-# generates you can specify the font name using DOT_FONTNAME. You need to make
-# sure dot is able to find the font, which can be done by putting it in a
-# standard location or by setting the DOTFONTPATH environment variable or by
-# setting DOT_FONTPATH to the directory containing the font.
-# The default value is: Helvetica.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_FONTNAME = Helvetica
-
-# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
-# dot graphs.
-# Minimum value: 4, maximum value: 24, default value: 10.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the default font as specified with
-# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
-# the path where dot can find it using this tag.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
-# each documented class showing the direct and indirect inheritance relations.
-# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
-# graph for each documented class showing the direct and indirect implementation
-# dependencies (inheritance, containment, and class references variables) of the
-# class with other documented classes.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-COLLABORATION_GRAPH = YES
-
-# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
-# groups, showing the direct groups dependencies.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-GROUP_GRAPHS = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-UML_LOOK = NO
-
-# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
-# class node. If there are many fields or methods and many nodes the graph may
-# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
-# number of items for each type to make the size more manageable. Set this to 0
-# for no limit. Note that the threshold may be exceeded by 50% before the limit
-# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
-# but if the number exceeds 15, the total amount of fields shown is limited to
-# 10.
-# Minimum value: 0, maximum value: 100, default value: 10.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-UML_LIMIT_NUM_FIELDS = 10
-
-# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
-# collaboration graphs will show the relations between templates and their
-# instances.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-TEMPLATE_RELATIONS = NO
-
-# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
-# YES then doxygen will generate a graph for each documented file showing the
-# direct and indirect include dependencies of the file with other documented
-# files.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-INCLUDE_GRAPH = YES
-
-# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
-# set to YES then doxygen will generate a graph for each documented file showing
-# the direct and indirect include dependencies of the file with other documented
-# files.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
-# dependency graph for every global function or class method.
-#
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable call graphs for selected
-# functions only using the \callgraph command.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
-# dependency graph for every global function or class method.
-#
-# Note that enabling this option will significantly increase the time of a run.
-# So in most cases it will be better to enable caller graphs for selected
-# functions only using the \callergraph command.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
-# hierarchy of all classes instead of a textual one.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-GRAPHICAL_HIERARCHY = YES
-
-# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
-# dependencies a directory has on other directories in a graphical way. The
-# dependency relations are determined by the #include relations between the
-# files in the directories.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DIRECTORY_GRAPH = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot.
-# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
-# to make the SVG files visible in IE 9+ (other browsers do not have this
-# requirement).
-# Possible values are: png, png:cairo, png:cairo:cairo, png:cairo:gd, png:gd,
-# png:gd:gd, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, gif, gif:cairo,
-# gif:cairo:gd, gif:gd, gif:gd:gd and svg.
-# The default value is: png.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_IMAGE_FORMAT = png
-
-# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
-# enable generation of interactive SVG images that allow zooming and panning.
-#
-# Note that this requires a modern browser other than Internet Explorer. Tested
-# and working are Firefox, Chrome, Safari, and Opera.
-# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
-# the SVG files visible. Older versions of IE do not have SVG support.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-INTERACTIVE_SVG = NO
-
-# The DOT_PATH tag can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the \dotfile
-# command).
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOTFILE_DIRS =
-
-# The MSCFILE_DIRS tag can be used to specify one or more directories that
-# contain msc files that are included in the documentation (see the \mscfile
-# command).
-
-MSCFILE_DIRS =
-
-# The DIAFILE_DIRS tag can be used to specify one or more directories that
-# contain dia files that are included in the documentation (see the \diafile
-# command).
-
-DIAFILE_DIRS =
-
-# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
-# path where java can find the plantuml.jar file. If left blank, it is assumed
-# PlantUML is not used or called during a preprocessing step. Doxygen will
-# generate a warning when it encounters a \startuml command in this case and
-# will not generate output for the diagram.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-PLANTUML_JAR_PATH =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
-# that will be shown in the graph. If the number of nodes in a graph becomes
-# larger than this value, doxygen will truncate the graph, which is visualized
-# by representing a node as a red box. Note that doxygen if the number of direct
-# children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
-# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-# Minimum value: 0, maximum value: 10000, default value: 50.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_GRAPH_MAX_NODES = 50
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
-# generated by dot. A depth value of 3 means that only nodes reachable from the
-# root by following a path via at most 3 edges will be shown. Nodes that lay
-# further from the root node will be omitted. Note that setting this option to 1
-# or 2 may greatly reduce the computation time needed for large code bases. Also
-# note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-# Minimum value: 0, maximum value: 1000, default value: 0.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-MAX_DOT_GRAPH_DEPTH = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not seem
-# to support this out of the box.
-#
-# Warning: Depending on the platform used, enabling this option may lead to
-# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
-# read).
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_TRANSPARENT = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10) support
-# this, this feature is disabled by default.
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
-# explaining the meaning of the various boxes and arrows in the dot generated
-# graphs.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
-# files that are used to generate the various graphs.
-# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_CLEANUP = YES
diff --git a/lang/qt/doc/Makefile.am b/lang/qt/doc/Makefile.am
deleted file mode 100644
index 73267278..00000000
--- a/lang/qt/doc/Makefile.am
+++ /dev/null
@@ -1,33 +0,0 @@
-# Makefile.am - Makefile for QGpgME docs.
-# Copyright (C) 2016 Bundesamt für Sicherheit in der Informationstechnik
-# Software engineering by Intevation GmbH
-#
-# This file is part of QGpgME.
-#
-# 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, see <https://gnu.org/licenses/>.
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-## Process this file with automake to produce Makefile.in
-
-if HAVE_DOXYGEN
-doxyfile.stamp:
- $(DOXYGEN) Doxyfile
- touch doxyfile.stamp
-
-CLEANFILES = doxyfile.stamp
-
-all-local: doxyfile.stamp
-clean-local:
- rm -rf $(abs_builddir)/generated
-endif
diff --git a/lang/qt/src/Makefile.am b/lang/qt/src/Makefile.am
deleted file mode 100644
index 9b904e2d..00000000
--- a/lang/qt/src/Makefile.am
+++ /dev/null
@@ -1,509 +0,0 @@
-# Makefile.am for QGpgME.
-# Copyright (C) 2016 Bundesamt für Sicherheit in der Informationstechnik
-# Software engineering by Intevation GmbH
-#
-# This file is part of QGpgME, the Qt API binding for GpgME.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA
-
-if WANT_QT5
-libqgpgme_la = libqgpgme.la
-endif
-if WANT_QT6
-libqgpgmeqt6_la = libqgpgmeqt6.la
-endif
-lib_LTLIBRARIES = $(libqgpgme_la) $(libqgpgmeqt6_la)
-
-EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \
- qgpgme_debug.h qgpgme_version.h.in \
- QGpgmeConfig-w32.cmake.in.in QGpgmeQt6Config.cmake.in.in \
- QGpgmeQt6Config-w32.cmake.in.in QGpgmeQt6ConfigVersion.cmake.in
-
-qgpgme_sources = \
- cleaner.cpp \
- dataprovider.cpp \
- debug.cpp \
- decryptverifyarchivejob.cpp \
- decryptverifyjob.cpp \
- encryptarchivejob.cpp \
- filelistdataprovider.cpp \
- job.cpp multideletejob.cpp qgpgmeadduseridjob.cpp \
- qgpgmeaddexistingsubkeyjob.cpp \
- qgpgmebackend.cpp qgpgmechangeexpiryjob.cpp qgpgmechangeownertrustjob.cpp \
- qgpgmechangepasswdjob.cpp qgpgmedecryptjob.cpp \
- qgpgmedecryptverifyarchivejob.cpp \
- qgpgmedecryptverifyjob.cpp qgpgmedeletejob.cpp qgpgmedownloadjob.cpp \
- qgpgmeencryptarchivejob.cpp \
- qgpgmeencryptjob.cpp qgpgmeexportjob.cpp qgpgmeimportfromkeyserverjob.cpp \
- qgpgmeimportjob.cpp qgpgmekeygenerationjob.cpp qgpgmekeylistjob.cpp \
- listallkeysjob.cpp qgpgmelistallkeysjob.cpp qgpgmenewcryptoconfig.cpp \
- qgpgmereceivekeysjob.cpp \
- qgpgmerefreshsmimekeysjob.cpp \
- qgpgmerevokekeyjob.cpp \
- qgpgmesetprimaryuseridjob.cpp \
- qgpgmesignarchivejob.cpp \
- qgpgmesignencryptjob.cpp \
- qgpgmesignencryptarchivejob.cpp \
- qgpgmesignjob.cpp qgpgmesignkeyjob.cpp qgpgmeverifydetachedjob.cpp \
- qgpgmeverifyopaquejob.cpp qgpgmewkdlookupjob.cpp threadedjobmixin.cpp \
- qgpgmewkdrefreshjob.cpp \
- qgpgmekeyformailboxjob.cpp qgpgme_debug.cpp \
- qgpgmetofupolicyjob.cpp qgpgmequickjob.cpp \
- defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp \
- qgpgmegpgcardjob.cpp changeexpiryjob.cpp encryptjob.cpp importjob.cpp \
- quickjob.cpp \
- signarchivejob.cpp \
- signencryptjob.cpp \
- signencryptarchivejob.cpp \
- signjob.cpp \
- dn.cpp cryptoconfig.cpp wkdlookupresult.cpp \
- util.cpp \
- verifydetachedjob.cpp \
- verifyopaquejob.cpp \
- wkdrefreshjob.cpp
-
-# If you add one here make sure that you also add one in camelcase
-qgpgme_headers= \
- abstractimportjob.h \
- addexistingsubkeyjob.h \
- adduseridjob.h \
- changeexpiryjob.h \
- changeownertrustjob.h \
- changepasswdjob.h \
- dataprovider.h \
- debug.h \
- decryptjob.h \
- decryptverifyarchivejob.h \
- decryptverifyjob.h \
- downloadjob.h \
- encryptarchivejob.h \
- encryptjob.h \
- exportjob.h \
- filelistdataprovider.h \
- hierarchicalkeylistjob.h \
- job.h \
- keyformailboxjob.h \
- multideletejob.h \
- protocol.h \
- qgpgme_export.h \
- qgpgmenewcryptoconfig.h \
- quickjob.h \
- receivekeysjob.h \
- revokekeyjob.h \
- setprimaryuseridjob.h \
- specialjob.h \
- signarchivejob.h \
- signjob.h \
- signkeyjob.h \
- signencryptjob.h \
- signencryptarchivejob.h \
- verifyopaquejob.h \
- refreshkeysjob.h \
- cryptoconfig.h \
- deletejob.h \
- importfromkeyserverjob.h \
- importjob.h \
- keygenerationjob.h \
- keylistjob.h \
- listallkeysjob.h \
- verifydetachedjob.h \
- defaultkeygenerationjob.h \
- tofupolicyjob.h \
- wkdlookupjob.h \
- wkdlookupresult.h \
- wkdrefreshjob.h \
- wkspublishjob.h \
- gpgcardjob.h \
- dn.h
-
-camelcase_headers= \
- AddExistingSubkeyJob \
- AddUserIDJob \
- AbstractImportJob \
- ChangeExpiryJob \
- ChangeOwnerTrustJob \
- ChangePasswdJob \
- DataProvider \
- Debug \
- DecryptJob \
- DecryptVerifyArchiveJob \
- DecryptVerifyJob \
- DN \
- DownloadJob \
- EncryptArchiveJob \
- EncryptJob \
- ExportJob \
- FileListDataProvider \
- HierarchicalKeyListJob \
- Job \
- MultiDeleteJob \
- Protocol \
- QGpgMENewCryptoConfig \
- QuickJob \
- ReceiveKeysJob \
- RevokeKeyJob \
- SetPrimaryUserIDJob \
- SpecialJob \
- SignArchiveJob \
- SignJob \
- SignKeyJob \
- SignEncryptArchiveJob \
- SignEncryptJob \
- VerifyOpaqueJob \
- RefreshKeysJob \
- CryptoConfig \
- DeleteJob \
- ImportFromKeyserverJob \
- ImportJob \
- KeyGenerationJob \
- KeyListJob \
- ListAllKeysJob \
- VerifyDetachedJob \
- KeyForMailboxJob \
- DefaultKeyGenerationJob \
- WKDLookupJob \
- WKDLookupResult \
- WKDRefreshJob \
- WKSPublishJob \
- TofuPolicyJob \
- GpgCardJob
-
-private_qgpgme_headers = \
- changeexpiryjob_p.h \
- cleaner.h \
- decryptverifyarchivejob_p.h \
- decryptverifyjob_p.h \
- encryptarchivejob_p.h \
- encryptjob_p.h \
- importjob_p.h \
- listallkeysjob_p.h \
- qgpgme_export.h \
- protocol_p.h \
- job_p.h \
- qgpgmeaddexistingsubkeyjob.h \
- qgpgmeadduseridjob.h \
- qgpgmebackend.h \
- qgpgmechangeexpiryjob.h \
- qgpgmechangeownertrustjob.h \
- qgpgmechangepasswdjob.h \
- qgpgmedecryptjob.h \
- qgpgmedecryptverifyarchivejob.h \
- qgpgmedecryptverifyjob.h \
- qgpgmedeletejob.h \
- qgpgmedownloadjob.h \
- qgpgmeencryptarchivejob.h \
- qgpgmeencryptjob.h \
- qgpgmeexportjob.h \
- qgpgmeimportfromkeyserverjob.h \
- qgpgmeimportjob.h \
- qgpgmekeygenerationjob.h \
- qgpgmekeylistjob.h \
- qgpgmelistallkeysjob.h \
- qgpgmereceivekeysjob.h \
- qgpgmerefreshsmimekeysjob.h \
- qgpgmerevokekeyjob.h \
- qgpgmesetprimaryuseridjob.h \
- qgpgmesignarchivejob.h \
- qgpgmesignencryptjob.h \
- qgpgmesignencryptarchivejob.h \
- qgpgmesignjob.h \
- qgpgmesignkeyjob.h \
- qgpgmeverifydetachedjob.h \
- qgpgmeverifyopaquejob.h \
- qgpgmewkdlookupjob.h \
- qgpgmewkdrefreshjob.h \
- qgpgmekeyformailboxjob.h \
- qgpgmewkspublishjob.h \
- qgpgmetofupolicyjob.h \
- qgpgmegpgcardjob.h \
- qgpgmequickjob.h \
- quickjob_p.h \
- signarchivejob_p.h \
- signencryptjob_p.h \
- signencryptarchivejob_p.h \
- signjob_p.h \
- threadedjobmixin.h \
- util.h \
- verifydetachedjob_p.h \
- verifyopaquejob_p.h \
- wkdrefreshjob_p.h
-
-qgpgme_moc_sources = \
- abstractimportjob.moc \
- addexistingsubkeyjob.moc \
- adduseridjob.moc \
- changeexpiryjob.moc \
- changeownertrustjob.moc \
- changepasswdjob.moc \
- cleaner.moc \
- decryptjob.moc \
- decryptverifyarchivejob.moc \
- decryptverifyjob.moc \
- deletejob.moc \
- downloadjob.moc \
- encryptarchivejob.moc \
- encryptjob.moc \
- exportjob.moc \
- hierarchicalkeylistjob.moc \
- importfromkeyserverjob.moc \
- importjob.moc \
- job.moc \
- keygenerationjob.moc \
- keylistjob.moc \
- listallkeysjob.moc \
- multideletejob.moc \
- qgpgmeaddexistingsubkeyjob.moc \
- qgpgmeadduseridjob.moc \
- qgpgmechangeexpiryjob.moc \
- qgpgmechangeownertrustjob.moc \
- qgpgmechangepasswdjob.moc \
- qgpgmedecryptjob.moc \
- qgpgmedecryptverifyarchivejob.moc \
- qgpgmedecryptverifyjob.moc \
- qgpgmedeletejob.moc \
- qgpgmedownloadjob.moc \
- qgpgmeencryptarchivejob.moc \
- qgpgmeencryptjob.moc \
- qgpgmeexportjob.moc \
- qgpgmeimportfromkeyserverjob.moc \
- qgpgmeimportjob.moc \
- qgpgmekeygenerationjob.moc \
- qgpgmekeylistjob.moc \
- qgpgmelistallkeysjob.moc \
- qgpgmereceivekeysjob.moc \
- qgpgmerefreshsmimekeysjob.moc \
- qgpgmerevokekeyjob.moc \
- qgpgmesetprimaryuseridjob.moc \
- qgpgmesignarchivejob.moc \
- qgpgmesignencryptjob.moc \
- qgpgmesignencryptarchivejob.moc \
- qgpgmesignjob.moc \
- qgpgmesignkeyjob.moc \
- qgpgmeverifydetachedjob.moc \
- qgpgmeverifyopaquejob.moc \
- qgpgmewkdlookupjob.moc \
- qgpgmewkdrefreshjob.moc \
- qgpgmewkspublishjob.moc \
- tofupolicyjob.moc \
- qgpgmetofupolicyjob.moc \
- receivekeysjob.moc \
- refreshkeysjob.moc \
- revokekeyjob.moc \
- setprimaryuseridjob.moc \
- signarchivejob.moc \
- signencryptjob.moc \
- signencryptarchivejob.moc \
- signjob.moc \
- signkeyjob.moc \
- specialjob.moc \
- verifydetachedjob.moc \
- verifyopaquejob.moc \
- wkdlookupjob.moc \
- wkdrefreshjob.moc \
- keyformailboxjob.moc \
- wkspublishjob.moc \
- qgpgmekeyformailboxjob.moc \
- defaultkeygenerationjob.moc \
- quickjob.moc \
- qgpgmequickjob.moc \
- gpgcardjob.moc \
- qgpgmegpgcardjob.moc
-
-if WANT_QT5
-includeprefix5 = qgpgme-qt5
-qgpgme5includedir = $(includedir)/$(includeprefix5)/qgpgme
-qgpgme5include_HEADERS = $(qgpgme_headers)
-nodist_qgpgme5include_HEADERS = qgpgme_version.h
-camelcase5includedir = $(includedir)/$(includeprefix5)/QGpgME
-nodist_camelcase5include_HEADERS = $(camelcase_headers)
-endif
-if WANT_QT6
-includeprefix6 = qgpgme-qt6
-qgpgme6includedir = $(includedir)/$(includeprefix6)/qgpgme
-qgpgme6include_HEADERS = $(qgpgme_headers)
-nodist_qgpgme6include_HEADERS = qgpgme_version.h
-camelcase6includedir = $(includedir)/$(includeprefix6)/QGpgME
-nodist_camelcase6include_HEADERS = $(camelcase_headers)
-endif
-
-# generate the moc files in two steps:
-# 1. generate Qt 5/6-specific moc files in builddir with extension .moc5/.moc6;
-# this ensures correct dependencies on the source files
-# 2. generate forwarding headers in subfolders moc5/moc6 with extension .moc;
-# this ensures that the "foo.moc" includes in the source files work and
-# include the correct version of the generated moc files for Qt 5/6
-# GNU make's pattern rules would make this easier, but we don't want to use them
-if WANT_QT5
-moc5_dir = moc5
-qgpgme_moc5_sources = $(qgpgme_moc_sources:%.moc=%.moc5)
-qgpgme_moc5_forward_headers = $(qgpgme_moc_sources:%=$(moc5_dir)/%)
-
-.h.moc5:
- $(MOC5) `test -f '$<' || echo '$(srcdir)/'`$< -o $@
-
-$(moc5_dir):
- mkdir $(moc5_dir)
-
-$(qgpgme_moc5_forward_headers): Makefile.am | $(moc5_dir)
- echo "#include \"../$(notdir $@)5\"" > "$@"
-endif
-if WANT_QT6
-moc6_dir = moc6
-qgpgme_moc6_sources = $(qgpgme_moc_sources:%.moc=%.moc6)
-qgpgme_moc6_forward_headers = $(qgpgme_moc_sources:%=$(moc6_dir)/%)
-
-.h.moc6:
- $(MOC6) `test -f '$<' || echo '$(srcdir)/'`$< -o $@
-
-$(moc6_dir):
- mkdir $(moc6_dir)
-
-$(qgpgme_moc6_forward_headers): Makefile.am | $(moc6_dir)
- echo "#include \"../$(notdir $@)6\"" > "$@"
-endif
-
-if WANT_QT5
-libqgpgme_la_CPPFLAGS = -I./moc5 -I$(top_builddir)/lang/cpp/src -I$(top_builddir)/src \
- @GPGME_QT5_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
- -DBUILDING_QGPGME -Wsuggest-override \
- -Wzero-as-null-pointer-constant
-
-libqgpgme_la_SOURCES = $(qgpgme_sources) $(qgpgme_headers) $(private_qgpgme_headers)
-
-nodist_libqgpgme_la_SOURCES = $(qgpgme_moc5_sources) $(qgpgme_moc5_forward_headers)
-
-libqgpgme_la_LIBADD = ../../cpp/src/libgpgmepp.la ../../../src/libgpgme.la \
- @LIBASSUAN_LIBS@ @GPG_ERROR_LIBS@ @GPGME_QT5_LIBS@
-libqgpgme_la_LDFLAGS = -no-undefined -version-info \
- @LIBQGPGME_LT_CURRENT@:@LIBQGPGME_LT_REVISION@:@LIBQGPGME_LT_AGE@
-endif
-if WANT_QT6
-libqgpgmeqt6_la_CPPFLAGS = -I./moc6 -I$(top_builddir)/lang/cpp/src -I$(top_builddir)/src \
- @GPGME_QT6_CFLAGS@ @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \
- -DBUILDING_QGPGME -Wsuggest-override \
- -Wzero-as-null-pointer-constant
-
-libqgpgmeqt6_la_SOURCES = $(qgpgme_sources) $(qgpgme_headers) $(private_qgpgme_headers)
-
-nodist_libqgpgmeqt6_la_SOURCES = $(qgpgme_moc6_sources) $(qgpgme_moc6_forward_headers)
-
-libqgpgmeqt6_la_LIBADD = ../../cpp/src/libgpgmepp.la ../../../src/libgpgme.la \
- @LIBASSUAN_LIBS@ @GPG_ERROR_LIBS@ @GPGME_QT6_LIBS@
-libqgpgmeqt6_la_LDFLAGS = -no-undefined -version-info \
- @LIBQGPGME_LT_CURRENT@:@LIBQGPGME_LT_REVISION@:@LIBQGPGME_LT_AGE@
-endif
-
-if HAVE_MACOS_SYSTEM
-libsuffix=.dylib
-else
-libsuffix=.so
-endif
-
-if WANT_QT5
-if HAVE_W32_SYSTEM
-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)/$(includeprefix5)|g' > $@
-else
-QGpgmeConfig.cmake: QGpgmeConfig.cmake.in
- sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
- sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
- sed -e 's|[@]resolved_includedir@|$(includedir)/$(includeprefix5)|g' > $@
-endif
-endif
-if WANT_QT6
-if HAVE_W32_SYSTEM
-QGpgmeQt6Config.cmake: QGpgmeQt6Config-w32.cmake.in
- sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \
- sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \
- sed -e 's|[@]resolved_includedir@|$(includedir)/$(includeprefix6)|g' > $@
-else
-QGpgmeQt6Config.cmake: QGpgmeQt6Config.cmake.in
- sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \
- sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \
- sed -e 's|[@]resolved_includedir@|$(includedir)/$(includeprefix6)|g' > $@
-endif
-endif
-
-$(camelcase_headers): Makefile.am
- echo -n "#include \"qgpgme/" > "$@"
- echo -n "$@" | tr '[:upper:]' '[:lower:]' >> "$@"
- echo ".h\"" >> "$@"
-
-if WANT_QT5
-install-cmake-files-qt5: QGpgmeConfig.cmake QGpgmeConfigVersion.cmake
- -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/QGpgme
- $(INSTALL) -m 644 QGpgmeConfig.cmake \
- $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake
- $(INSTALL) -m 644 QGpgmeConfigVersion.cmake \
- $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake
-install_cmake_files_qt5 = install-cmake-files-qt5
-
-uninstall-cmake-files-qt5:
- -rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake
- -rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake
- -rmdir $(DESTDIR)$(libdir)/cmake/QGpgme/
-uninstall_cmake_files_qt5 = uninstall-cmake-files-qt5
-
-uninstall-include-dirs-qt5:
- -rmdir $(DESTDIR)$(qgpgme5includedir)
- -rmdir $(DESTDIR)$(camelcase5includedir)
- -rmdir $(DESTDIR)$(includedir)/$(includeprefix5)
-uninstall_include_dirs_qt5 = uninstall-include-dirs-qt5
-endif
-if WANT_QT6
-install-cmake-files-qt6: QGpgmeQt6Config.cmake QGpgmeQt6ConfigVersion.cmake
- -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/QGpgmeQt6
- $(INSTALL) -m 644 QGpgmeQt6Config.cmake \
- $(DESTDIR)$(libdir)/cmake/QGpgmeQt6/QGpgmeQt6Config.cmake
- $(INSTALL) -m 644 QGpgmeQt6ConfigVersion.cmake \
- $(DESTDIR)$(libdir)/cmake/QGpgmeQt6/QGpgmeQt6ConfigVersion.cmake
-install_cmake_files_qt6 = install-cmake-files-qt6
-
-uninstall-cmake-files-qt6:
- -rm $(DESTDIR)$(libdir)/cmake/QGpgmeQt6/QGpgmeQt6ConfigVersion.cmake
- -rm $(DESTDIR)$(libdir)/cmake/QGpgmeQt6/QGpgmeQt6Config.cmake
- -rmdir $(DESTDIR)$(libdir)/cmake/QGpgmeQt6/
-uninstall_cmake_files_qt6 = uninstall-cmake-files-qt6
-
-uninstall-include-dirs-qt6:
- -rmdir $(DESTDIR)$(qgpgme6includedir)
- -rmdir $(DESTDIR)$(camelcase6includedir)
- -rmdir $(DESTDIR)$(includedir)/$(includeprefix6)
-uninstall_include_dirs_qt6 = uninstall-include-dirs-qt6
-endif
-
-install-data-local: $(install_cmake_files_qt5) $(install_cmake_files_qt6)
-
-uninstall-hook: $(uninstall_cmake_files_qt5) $(uninstall_cmake_files_qt6) \
- $(uninstall_include_dirs_qt5) $(uninstall_include_dirs_qt6)
-
-BUILT_SOURCES = $(qgpgme_moc5_sources) $(qgpgme_moc5_forward_headers) \
- $(qgpgme_moc6_sources) $(qgpgme_moc6_forward_headers) \
- $(camelcase_headers)
-
-CLEANFILES = $(qgpgme_moc5_sources) $(qgpgme_moc5_forward_headers) \
- $(qgpgme_moc6_sources) $(qgpgme_moc6_forward_headers) \
- $(camelcase_headers) QGpgmeConfig.cmake \
- qgpgme_version.h QGpgmeConfig.cmake.in \
- QGpgmeConfig-w32.cmake.in QGpgmeConfigVersion.cmake \
- QGpgmeQt6Config.cmake.in QGpgmeQt6Config-w32.cmake.in \
- QGpgmeQt6Config.cmake QGpgmeQt6ConfigVersion.cmake
-
-clean-local:
- -test -z "$(moc5_dir)" || rm -rf $(moc5_dir)
- -test -z "$(moc6_dir)" || rm -rf $(moc6_dir)
diff --git a/lang/qt/src/QGpgmeConfig-w32.cmake.in.in b/lang/qt/src/QGpgmeConfig-w32.cmake.in.in
deleted file mode 100644
index 709f5fc3..00000000
--- a/lang/qt/src/QGpgmeConfig-w32.cmake.in.in
+++ /dev/null
@@ -1,109 +0,0 @@
-# CMake Config file for QGPGME.
-# Copyright (C) 2016 Intevation GmbH
-#
-# This file is part of QGpgME.
-#
-# 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., 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_bindir@/libqgpgme-15.dll"
-)
-get_target_property(_libpath QGpgme IMPORTED_IMPLIB_RELEASE)
-get_target_property(_dllpath QGpgme IMPORTED_LOCATION)
-
-list(APPEND _IMPORT_CHECK_TARGETS QGpgme )
-list(APPEND _IMPORT_CHECK_FILES_FOR_QGpgme "${_libpath}" "${_dllpath}" )
-
-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)
-unset(_dllpath)
-unset(_libpath)
-
-# 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
deleted file mode 100644
index fc13bfb7..00000000
--- a/lang/qt/src/QGpgmeConfig.cmake.in.in
+++ /dev/null
@@ -1,101 +0,0 @@
-# CMake Config file for QGPGME.
-# Copyright (C) 2016 Intevation GmbH
-#
-# This file is part of QGpgME.
-#
-# 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., 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
- INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/qgpgme;@resolved_includedir@"
- INTERFACE_LINK_LIBRARIES "Gpgmepp;Qt5::Core"
- IMPORTED_LOCATION "@resolved_libdir@/libqgpgme@libsuffix@"
-)
-
-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/QGpgmeConfigVersion.cmake.in b/lang/qt/src/QGpgmeConfigVersion.cmake.in
deleted file mode 100644
index cbc21856..00000000
--- a/lang/qt/src/QGpgmeConfigVersion.cmake.in
+++ /dev/null
@@ -1,31 +0,0 @@
-# CMake Version file for QGPGME.
-# Copyright (C) 2016 Intevation GmbH
-#
-# This file is part of QGpgME.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA
-
-# based on a generated file from cmake.
-set(PACKAGE_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_MICRO@")
-
-if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
- set(PACKAGE_VERSION_COMPATIBLE FALSE)
-else()
- set(PACKAGE_VERSION_COMPATIBLE TRUE)
- if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
- set(PACKAGE_VERSION_EXACT TRUE)
- endif()
-endif()
diff --git a/lang/qt/src/QGpgmeQt6Config-w32.cmake.in.in b/lang/qt/src/QGpgmeQt6Config-w32.cmake.in.in
deleted file mode 100644
index 520ce62d..00000000
--- a/lang/qt/src/QGpgmeQt6Config-w32.cmake.in.in
+++ /dev/null
@@ -1,109 +0,0 @@
-# CMake Config file for QGpgME for Qt 6
-# Copyright (C) 2016 Intevation GmbH
-#
-# This file is part of QGpgME.
-#
-# 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., 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 QGpgmeQt6)
- 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 QGpgmeQt6
-add_library(QGpgmeQt6 SHARED IMPORTED)
-
-set_target_properties(QGpgmeQt6 PROPERTIES
- IMPORTED_IMPLIB_RELEASE "@resolved_libdir@/libqgpgmeqt6.dll.a"
- INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/qgpgme;@resolved_includedir@"
- INTERFACE_LINK_LIBRARIES "Gpgmepp;Qt6::Core"
- IMPORTED_LOCATION "@resolved_bindir@/libqgpgmeqt6-15.dll"
-)
-get_target_property(_libpath QGpgmeQt6 IMPORTED_IMPLIB_RELEASE)
-get_target_property(_dllpath QGpgmeQt6 IMPORTED_LOCATION)
-
-list(APPEND _IMPORT_CHECK_TARGETS QGpgmeQt6 )
-list(APPEND _IMPORT_CHECK_FILES_FOR_QGpgmeQt6 "${_libpath}" "${_dllpath}" )
-
-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)
-unset(_dllpath)
-unset(_libpath)
-
-# 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/QGpgmeQt6Config.cmake.in.in b/lang/qt/src/QGpgmeQt6Config.cmake.in.in
deleted file mode 100644
index 14fa54e1..00000000
--- a/lang/qt/src/QGpgmeQt6Config.cmake.in.in
+++ /dev/null
@@ -1,101 +0,0 @@
-# CMake Config file for QGpgME for Qt 6
-# Copyright (C) 2016 Intevation GmbH
-#
-# This file is part of QGpgME.
-#
-# 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., 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 QGpgmeQt6)
- 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 QGpgmeQt6
-add_library(QGpgmeQt6 SHARED IMPORTED)
-
-set_target_properties(QGpgmeQt6 PROPERTIES
- INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/qgpgme;@resolved_includedir@"
- INTERFACE_LINK_LIBRARIES "Gpgmepp;Qt6::Core"
- IMPORTED_LOCATION "@resolved_libdir@/libqgpgmeqt6@libsuffix@"
-)
-
-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/QGpgmeQt6ConfigVersion.cmake.in b/lang/qt/src/QGpgmeQt6ConfigVersion.cmake.in
deleted file mode 100644
index a0ba9505..00000000
--- a/lang/qt/src/QGpgmeQt6ConfigVersion.cmake.in
+++ /dev/null
@@ -1,31 +0,0 @@
-# CMake Version file for QGpgME for Qt 6
-# Copyright (C) 2016 Intevation GmbH
-#
-# This file is part of QGpgME.
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA
-
-# based on a generated file from cmake.
-set(PACKAGE_VERSION "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_MICRO@")
-
-if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
- set(PACKAGE_VERSION_COMPATIBLE FALSE)
-else()
- set(PACKAGE_VERSION_COMPATIBLE TRUE)
- if("${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
- set(PACKAGE_VERSION_EXACT TRUE)
- endif()
-endif()
diff --git a/lang/qt/src/abstractimportjob.h b/lang/qt/src/abstractimportjob.h
deleted file mode 100644
index ab6b530d..00000000
--- a/lang/qt/src/abstractimportjob.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- abstractimportjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2009 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_ABSTRACTIMPORTJOB_H__
-#define __KLEO_ABSTRACTIMPORTJOB_H__
-
-#include "job.h"
-
-#include "qgpgme_export.h"
-
-namespace GpgME
-{
-class Error;
-class ImportResult;
-}
-
-namespace QGpgME
-{
-
-class QGPGME_EXPORT AbstractImportJob : public Job
-{
- Q_OBJECT
-protected:
- explicit AbstractImportJob(QObject *parent);
-public:
- ~AbstractImportJob();
-
-Q_SIGNALS:
- void result(const GpgME::ImportResult &result, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_IMPORTJOB_H__
diff --git a/lang/qt/src/addexistingsubkeyjob.h b/lang/qt/src/addexistingsubkeyjob.h
deleted file mode 100644
index 5465778c..00000000
--- a/lang/qt/src/addexistingsubkeyjob.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- addexistingsubkeyjob.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 <[email protected]>
-
- 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_ADDEXISTINGSUBKEYJOB_H__
-#define __QGPGME_ADDEXISTINGSUBKEYJOB_H__
-
-#include "job.h"
-#include "qgpgme_export.h"
-
-class QString;
-
-namespace GpgME
-{
-class Error;
-class Key;
-class Subkey;
-}
-
-namespace QGpgME
-{
-
-class QGPGME_EXPORT AddExistingSubkeyJob : public Job
-{
- Q_OBJECT
-protected:
- explicit AddExistingSubkeyJob(QObject *parent);
-
-public:
- ~AddExistingSubkeyJob();
-
- /**
- Starts the operation. \a key is the key to add the subkey \a subkey to.
-
- The job deletes itself after it has completed the operation.
- */
- virtual GpgME::Error start(const GpgME::Key &key, const GpgME::Subkey &subkey) = 0;
-
- /**
- Runs the operation. \a key is the key to add the subkey \a subkey to.
- */
- virtual GpgME::Error exec(const GpgME::Key &key, const GpgME::Subkey &subkey) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QString &auditLogAsHtml = {}, const GpgME::Error &auditLogError = {});
-};
-
-}
-
-#endif // __QGPGME_ADDEXISTINGSUBKEYJOB_H__
diff --git a/lang/qt/src/adduseridjob.h b/lang/qt/src/adduseridjob.h
deleted file mode 100644
index cc3963c9..00000000
--- a/lang/qt/src/adduseridjob.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- adduseridjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_ADDUSERIDJOB_H__
-#define __KLEO_ADDUSERIDJOB_H__
-
-#include "job.h"
-
-#include <QtCore/QString>
-
-namespace GpgME
-{
-class Error;
-class Key;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class to asynchronously add UIDs to OpenPGP keys
-
- To use a AddUserIDJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the job with a call
- to start(). This call might fail, in which case the AddUserIDJob
- instance will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the AddUserIDJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT AddUserIDJob : public Job
-{
- Q_OBJECT
-protected:
- explicit AddUserIDJob(QObject *parent);
-public:
- ~AddUserIDJob();
-
- /**
- Starts the operation. \a key is the key to add the UID to. \a
- name, \a email and \a comment are the components of the user id.
- */
- virtual GpgME::Error start(const GpgME::Key &key, const QString &name,
- const QString &email, const QString &comment = QString()) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_ADDUSERIDJOB_H__
diff --git a/lang/qt/src/changeexpiryjob.cpp b/lang/qt/src/changeexpiryjob.cpp
deleted file mode 100644
index 333fbabe..00000000
--- a/lang/qt/src/changeexpiryjob.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- changeexpiryjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "changeexpiryjob.h"
-#include "changeexpiryjob_p.h"
-
-#include <gpgme++/context.h>
-
-using namespace GpgME;
-using namespace QGpgME;
-
-void ChangeExpiryJob::setOptions(ChangeExpiryJob::Options options)
-{
- auto d = jobPrivate<ChangeExpiryJobPrivate>(this);
- d->m_options = options;
-}
-
-ChangeExpiryJob::Options ChangeExpiryJob::options() const
-{
- auto d = jobPrivate<ChangeExpiryJobPrivate>(this);
- return d->m_options;
-}
-
-/* For ABI compat not pure virtual. */
-Error ChangeExpiryJob::start(const Key &, const QDateTime &, const std::vector<Subkey> &)
-{
- return {};
-}
diff --git a/lang/qt/src/changeexpiryjob.h b/lang/qt/src/changeexpiryjob.h
deleted file mode 100644
index abec51ea..00000000
--- a/lang/qt/src/changeexpiryjob.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- changeexpiryjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_CHANGEEXPIRYJOB_H__
-#define __KLEO_CHANGEEXPIRYJOB_H__
-
-#include "job.h"
-
-#include <gpgme++/key.h>
-
-#include <vector>
-
-namespace GpgME
-{
-class Error;
-}
-
-class QDateTime;
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class to change expiry asynchronously
-
- To use a ChangeExpiryJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the job with a call
- to start(). This call might fail, in which case the ChangeExpiryJob
- instance will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the ChangeExpiryJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT ChangeExpiryJob : public Job
-{
- Q_OBJECT
-public:
- enum Option {
- Default = 0x00,
- UpdatePrimaryKey = 0x01,
- UpdateAllSubkeys = 0x02,
- };
- Q_DECLARE_FLAGS(Options, Option)
-
-protected:
- explicit ChangeExpiryJob(QObject *parent);
-public:
- ~ChangeExpiryJob();
-
- void setOptions(Options options);
- Options options() const;
-
- /**
- Starts the change-expiry operation. \a key is the key to change
- the expiry of. \a expiry is the new expiry time. If \a expiry
- is not valid, \a key is set to never expire.
- */
- virtual GpgME::Error start(const GpgME::Key &key, const QDateTime &expiry) = 0;
-
- /**
- Starts the change-expiry operation. \a key is the key to change,
- \a subkeys is a list of subkeys of the key, and \a expiry is the
- new expiry time. If \a subkeys is empty, then the expiry of \a key
- is changed. Otherwise, the expiry of \a subkeys is changed. If
- \a expiry is not valid, then \a key or \a subkeys are set to never expire.
- */
- virtual GpgME::Error start(const GpgME::Key &key, const QDateTime &expiry,
- const std::vector<GpgME::Subkey> &subkeys);
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(ChangeExpiryJob::Options)
-
-}
-
-#endif // __KLEO_CHANGEEXPIRYJOB_H__
diff --git a/lang/qt/src/changeexpiryjob_p.h b/lang/qt/src/changeexpiryjob_p.h
deleted file mode 100644
index c6c91c25..00000000
--- a/lang/qt/src/changeexpiryjob_p.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- changeexpiryjob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_CHANGEEXPIRYJOB_P_H__
-#define __QGPGME_CHANGEEXPIRYJOB_P_H__
-
-#include "job_p.h"
-
-#include "changeexpiryjob.h"
-
-namespace QGpgME
-{
-
-struct ChangeExpiryJobPrivate : public JobPrivate
-{
- ChangeExpiryJob::Options m_options = ChangeExpiryJob::Default;
-};
-
-}
-
-#endif // __QGPGME_CHANGEEXPIRYJOB_P_H__
diff --git a/lang/qt/src/changeownertrustjob.h b/lang/qt/src/changeownertrustjob.h
deleted file mode 100644
index 6e4613ee..00000000
--- a/lang/qt/src/changeownertrustjob.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- changeownertrustjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_CHANGEOWNERTRUST_H__
-#define __KLEO_CHANGEOWNERTRUST_H__
-
-#include "job.h"
-
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class to change owner trust asynchronously
-
- To use a ChangeOwnerTrustJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the job with a call
- to start(). This call might fail, in which case the ChangeOwnerTrustJob
- instance will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the ChangeOwnerTrustJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT ChangeOwnerTrustJob : public Job
-{
- Q_OBJECT
-protected:
- explicit ChangeOwnerTrustJob(QObject *parent);
-public:
- ~ChangeOwnerTrustJob();
-
- /**
- Starts the change-owner trust operation. \a key is the key to change
- the owner trust of . \a trust is the new trust level.
- */
- virtual GpgME::Error start(const GpgME::Key &key, GpgME::Key::OwnerTrust trust) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_CHANGEOWNERTRUSTJOB_H__
diff --git a/lang/qt/src/changepasswdjob.h b/lang/qt/src/changepasswdjob.h
deleted file mode 100644
index 44de77c4..00000000
--- a/lang/qt/src/changepasswdjob.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- changepasswdjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2010 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_CHANGEPASSWDJOB_H__
-#define __KLEO_CHANGEPASSWDJOB_H__
-
-#include "job.h"
-
-namespace GpgME
-{
-class Error;
-class Key;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class to change a key's passphrase asynchronously
-
- To use a ChangePasswdJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the job with a call
- to start(). This call might fail, in which case the ChangePasswdJob
- instance will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the ChangePasswdJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT ChangePasswdJob : public Job
-{
- Q_OBJECT
-protected:
- explicit ChangePasswdJob(QObject *parent);
-public:
- ~ChangePasswdJob();
-
- /**
- Starts the passphrase-change operation. \a key is the key to
- change the passphrase of. The passphrase is queried by the
- backend directly, you cannot give it to the job beforehand.
- */
- virtual GpgME::Error start(const GpgME::Key &key) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_CHANGEPASSWDJOB_H__
diff --git a/lang/qt/src/cleaner.cpp b/lang/qt/src/cleaner.cpp
deleted file mode 100644
index b46d1a23..00000000
--- a/lang/qt/src/cleaner.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- cleaner.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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.
-*/
-
-#include "cleaner.h"
-
-#include <qgpgme_debug.h>
-
-#include <QCoreApplication>
-#include <QFile>
-
-#include <chrono>
-
-static const auto timeout = std::chrono::seconds{10};
-
-static bool remove_file(const QString &filePath)
-{
- if (filePath.isEmpty()) {
- qCWarning(QGPGME_LOG) << __func__ << "- called with empty file path";
- return true;
- }
- if (QFile::exists(filePath)) {
- qCDebug(QGPGME_LOG) << __func__ << "- Removing file" << filePath;
- if (!QFile::remove(filePath)) {
- qCDebug(QGPGME_LOG) << __func__ << "- Removing file" << filePath << "failed";
- return false;
- }
- } else {
- qCDebug(QGPGME_LOG) << __func__ << "- File" << filePath << "doesn't exist";
- }
- return true;
-}
-
-void Cleaner::removeFile(const QString &filePath)
-{
- if (!remove_file(filePath)) {
- // use invokeMethod because we might not be called from the GUI thread
- // but we want to delegate the Cleaner's clean-up to the application instance
- QMetaObject::invokeMethod(qApp, [filePath]() {
- new Cleaner{filePath, qApp};
- }, Qt::QueuedConnection);
- }
-}
-
-Cleaner::Cleaner(const QString &filePath, QObject *parent)
- : QObject{parent}
- , mFilePath{filePath}
-{
- qCDebug(QGPGME_LOG) << this << __func__ << filePath;
- mTimer.setSingleShot(true);
- mTimer.callOnTimeout([this]() {
- if (remove_file(mFilePath)) {
- mFilePath.clear();
- deleteLater();
- } else {
- mTimer.start(timeout);
- }
- });
- mTimer.start(timeout);
-}
-
-Cleaner::~Cleaner()
-{
- qCDebug(QGPGME_LOG) << this << __func__;
- if (!mFilePath.isEmpty()) {
- remove_file(mFilePath);
- }
-}
-
-#include "cleaner.moc"
diff --git a/lang/qt/src/cleaner.h b/lang/qt/src/cleaner.h
deleted file mode 100644
index 2307c34e..00000000
--- a/lang/qt/src/cleaner.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- cleaner.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_CLEANER_H__
-#define __QGPGME_CLEANER_H__
-
-#include <QObject>
-#include <QString>
-#include <QTimer>
-
-/** Helper class that tries to remove files at regular intervals and on destruction. */
-class Cleaner : public QObject
-{
- Q_OBJECT
-public:
- /** Tries to remove the file. If this fails it creates a Cleaner for the file. */
- static void removeFile(const QString &filePath);
-
-private:
- explicit Cleaner(const QString &filePath, QObject *parent=nullptr);
- ~Cleaner() override;
-
- Q_DISABLE_COPY_MOVE(Cleaner)
-
-private:
- QString mFilePath;
- QTimer mTimer;
-};
-
-#endif // __QGPGME_CLEANER_H__
diff --git a/lang/qt/src/cryptoconfig.cpp b/lang/qt/src/cryptoconfig.cpp
deleted file mode 100644
index fe808827..00000000
--- a/lang/qt/src/cryptoconfig.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- cryptoconfig.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2017 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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.
-*/
-#include "cryptoconfig.h"
-#include "qgpgmenewcryptoconfig.h"
-
-using namespace QGpgME;
-
-QStringList CryptoConfigEntry::stringValueList() const
-{
- const QGpgMENewCryptoConfigEntry *entry = dynamic_cast <const QGpgMENewCryptoConfigEntry*> (this);
- if (!entry) {
- return QStringList();
- }
- return entry->stringValueList();
-}
-
-QVariant CryptoConfigEntry::defaultValue() const
-{
- const QGpgMENewCryptoConfigEntry *entry = dynamic_cast <const QGpgMENewCryptoConfigEntry*>(this);
- if (!entry) {
- return {};
- }
- return entry->defaultValue();
-}
-
-QGpgME::CryptoConfigEntry *CryptoConfig::entry(const QString &componentName, const QString &entryName) const
-{
- const CryptoConfigComponent *comp = component(componentName);
- const QStringList groupNames = comp ? comp->groupList() : QStringList();
- for (const auto &groupName : groupNames) {
- const CryptoConfigGroup *group = comp->group(groupName);
- CryptoConfigEntry *entry = group ? group->entry(entryName) : nullptr;
- if (entry) {
- return entry;
- }
- }
- return nullptr;
-}
-
-QGpgME::CryptoConfigEntry *CryptoConfig::entry(const QString &componentName, const QString &groupName, const QString &entryName) const
-{
- const CryptoConfigComponent *comp = component(componentName);
- const CryptoConfigGroup *group = comp ? comp->group(groupName) : nullptr;
- return group ? group->entry(entryName) : nullptr;
-}
diff --git a/lang/qt/src/cryptoconfig.h b/lang/qt/src/cryptoconfig.h
deleted file mode 100644
index d87f7d46..00000000
--- a/lang/qt/src/cryptoconfig.h
+++ /dev/null
@@ -1,424 +0,0 @@
-/*
- cryptoconfig.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 CRYPTOCONFIG_H
-#define CRYPTOCONFIG_H
-
-#include "qgpgme_export.h"
-#ifdef __cplusplus
-/* we read this file from a C compiler, and are only interested in the
- * enums... */
-
-#include <QUrl>
-
-#include <vector>
-
-class QVariant;
-
-/* Start reading this file from the bottom up :) */
-
-namespace QGpgME
-{
-
-/**
- * Description of a single option
- */
-class QGPGME_EXPORT CryptoConfigEntry
-{
-
-public:
-#endif /* __cplusplus */
- /**
- @li basic This option should always be offered to the user.
- @li advanced This option may be offered to advanced users.
- @li expert This option should only be offered to expert users.
- */
- enum Level { Level_Basic = 0,
- Level_Advanced = 1,
- Level_Expert = 2
- };
-
- /**
- Type of the argument
- @li ArgType_None The option is set or not set, but no argument.
- @li ArgType_String An unformatted string.
- @li ArgType_Int A signed integer number.
- @li ArgType_UInt An unsigned integer number.
- @li ArgType_Path A string that describes the pathname of a file.
- The file does not necessarily need to exist.
- Separated from string so that e.g. a FileDialog can be used.
- @li ArgType_DirPath A string that describes the pathname of a directory.
- The directory does not necessarily need to exist.
- Separated from path so that e.g. a FileDialog can be used which only
- allows directories to be selected.
- @li ArgType_LDAPURL A LDAP URL
- Separated from URL so that a more specific widget can be shown, hiding the url syntax
- */
- enum ArgType { ArgType_None = 0,
- ArgType_String = 1,
- ArgType_Int = 2,
- ArgType_UInt = 3,
- ArgType_Path = 4,
- /* Nr. 5 was URL historically. */
- ArgType_LDAPURL = 6,
- ArgType_DirPath = 7,
-
- NumArgType
- };
-
-#ifdef __cplusplus
- virtual ~CryptoConfigEntry() {}
-
- /**
- * Return the internal name of this entry
- */
- virtual QString name() const = 0;
-
- /**
- * @return user-visible description of this entry
- */
- virtual QString description() const = 0;
-
- /**
- * @return "component/group/name"
- */
- virtual QString path() const = 0;
-
- /**
- * @return true if the argument is optional
- */
- virtual bool isOptional() const = 0;
-
- /**
- * @return true if the entry is readonly
- */
- virtual bool isReadOnly() const = 0;
-
- /**
- * @return true if the argument can be given multiple times
- */
- virtual bool isList() const = 0;
-
- /**
- * @return true if the argument can be changed at runtime
- */
- virtual bool isRuntime() const = 0;
-
- /**
- * User level
- */
- virtual Level level() const = 0;
-
- /**
- * Argument type
- */
- virtual ArgType argType() const = 0;
-
- /**
- * Return true if the option is set, i.e. different from default
- */
- virtual bool isSet() const = 0;
-
- /**
- * Return value as a bool (only allowed for ArgType_None)
- */
- virtual bool boolValue() const = 0;
-
- /**
- * Return value as a string (available for all argtypes)
- * The returned string can be empty (explicitly set to empty) or null (not set).
- */
- virtual QString stringValue() const = 0;
-
- /**
- * Return value as a signed int
- */
- virtual int intValue() const = 0;
-
- /**
- * Return value as an unsigned int
- */
- virtual unsigned int uintValue() const = 0;
-
- /**
- * Return value as a URL (only meaningful for Path and URL argtypes)
- */
- virtual QUrl urlValue() const = 0;
-
- /**
- * Return number of times the option is set (only valid for ArgType_None, if isList())
- */
- virtual unsigned int numberOfTimesSet() const = 0;
-
- /**
- * Return value as a list of signed ints
- */
- virtual std::vector<int> intValueList() const = 0;
-
- /**
- * Return value as a list of unsigned ints
- */
- virtual std::vector<unsigned int> uintValueList() const = 0;
-
- /**
- * Return value as a list of URLs (only meaningful for Path and URL argtypes, if isList())
- */
- virtual QList<QUrl> urlValueList() const = 0;
-
- /**
- * Reset an option to its default value
- */
- virtual void resetToDefault() = 0;
-
- /**
- * Define whether the option is set or not (only allowed for ArgType_None)
- * #### TODO: and for options with optional args
- */
- virtual void setBoolValue(bool) = 0;
-
- /**
- * Set string value (allowed for all argtypes)
- */
- virtual void setStringValue(const QString &) = 0;
-
- /**
- * Set a new signed int value
- */
- virtual void setIntValue(int) = 0;
-
- /**
- * Set a new unsigned int value
- */
- virtual void setUIntValue(unsigned int) = 0;
-
- /**
- * Set value as a URL (only meaningful for Path (if local) and URL argtypes)
- */
- virtual void setURLValue(const QUrl &) = 0;
-
- /**
- * Set the number of times the option is set (only valid for ArgType_None, if isList())
- */
- virtual void setNumberOfTimesSet(unsigned int) = 0;
-
- /**
- * Set a new list of signed int values
- */
- virtual void setIntValueList(const std::vector<int> &) = 0;
-
- /**
- * Set a new list of unsigned int values
- */
- virtual void setUIntValueList(const std::vector<unsigned int> &) = 0;
-
- /**
- * Set value as a URL list (only meaningful for Path (if all URLs are local) and URL argtypes, if isList())
- */
- virtual void setURLValueList(const QList<QUrl> &) = 0;
-
- /**
- * @return true if the value was changed
- */
- virtual bool isDirty() const = 0;
-
- // Design change from here on we are closely bound to one implementation
- // of cryptoconfig. To avoid ABI breaks with every new function we
- // add real functions from now on.
-
- /**
- * @return a stringValueList.
- */
- QStringList stringValueList() const;
-
- /**
- * Return the default value as a variant (available for all argtypes).
- */
- QVariant defaultValue() const;
-};
-
-/**
- * Group containing a set of config options
- */
-class QGPGME_EXPORT CryptoConfigGroup
-{
-
-public:
- virtual ~CryptoConfigGroup() {}
-
- /**
- * Return the internal name of this group
- */
- virtual QString name() const = 0;
-
- /**
- * Return the name of the icon for this group
- */
- virtual QString iconName() const = 0;
-
- /**
- * @return user-visible description of this group
- */
- virtual QString description() const = 0;
-
- /**
- * @return "component/group"
- */
- virtual QString path() const = 0;
-
- /**
- * User level
- */
- virtual CryptoConfigEntry::Level level() const = 0;
-
- /**
- * Returns the list of entries that are known by this group.
- *
- * @return list of group entry names.
- **/
- virtual QStringList entryList() const = 0;
-
- /**
- * @return the configuration object for a given entry in this group
- * The object is owned by CryptoConfigGroup, don't delete it.
- * Groups cannot be nested, so all entries returned here are pure entries, no groups.
- */
- virtual CryptoConfigEntry *entry(const QString &name) const = 0;
-};
-
-/**
- * Crypto config for one component (e.g. gpg-agent, dirmngr etc.)
- */
-class QGPGME_EXPORT CryptoConfigComponent
-{
-
-public:
- virtual ~CryptoConfigComponent() {}
-
- /**
- * Return the internal name of this component
- */
- virtual QString name() const = 0;
-
- /**
- * Return the name of the icon for this component
- */
- virtual QString iconName() const = 0;
-
- /**
- * Return user-visible description of this component
- */
- virtual QString description() const = 0;
-
- /**
- * Returns the list of groups that are known about.
- *
- * @return list of group names. One of them can be "<nogroup>", which is the group where all
- * "toplevel" options (belonging to no group) are.
- */
- virtual QStringList groupList() const = 0;
-
- /**
- * @return the configuration object for a given group
- * The object is owned by CryptoConfigComponent, don't delete it.
- */
- virtual CryptoConfigGroup *group(const QString &name) const = 0;
-
-};
-
-/**
- * Main interface to crypto configuration.
- */
-class QGPGME_EXPORT CryptoConfig
-{
-
-public:
- virtual ~CryptoConfig() {}
-
- /**
- * Returns the list of known components (e.g. "gpg-agent", "dirmngr" etc.).
- * Use @ref component() to retrieve more information about each one.
- * @return list of component names.
- **/
- virtual QStringList componentList() const = 0;
-
- /**
- * @return the configuration object for a given component
- * The object is owned by CryptoConfig, don't delete it.
- */
- virtual CryptoConfigComponent *component(const QString &name) const = 0;
-
- /**
- * Convenience method to get hold of a single configuration entry when
- * its component and name are known. This can be used to read
- * the value and/or to set a value to it.
- *
- * @return the configuration object for a single configuration entry, 0 if not found.
- * The object is owned by CryptoConfig, don't delete it.
- */
- CryptoConfigEntry *entry(const QString &componentName, const QString &entryName) const;
-
- /**
- * This function is obsolete. It is provided to keep old source code working.
- * We strongly advise against using it in new code.
- *
- * This function overloads @ref entry().
- *
- * Use the entry overload that does not require a group name instead. The group name
- * is not needed to identify a configuration entry because it only provides logical
- * grouping for user interfaces. Sometimes configuration entries are moved to different
- * groups to improve usability.
- */
- QGPGME_DEPRECATED CryptoConfigEntry *entry(const QString &componentName, const QString &groupName, const QString &entryName) const;
-
- /**
- * Write back changes
- *
- * @param runtime this parameter is ignored. Changes will always
- * be made with --runtime set.
- */
- virtual void sync(bool runtime) = 0;
-
- /**
- * Tells the CryptoConfig to discard any cached information, including
- * all components, groups and entries.
- * Call this to free some memory when you won't be using the object
- * for some time.
- * DON'T call this if you're holding pointers to components, groups or entries.
- */
- virtual void clear() = 0;
-};
-
-}
-#endif /* __cplusplus */
-#endif /* CRYPTOCONFIG_H */
diff --git a/lang/qt/src/dataprovider.cpp b/lang/qt/src/dataprovider.cpp
deleted file mode 100644
index e376ca8d..00000000
--- a/lang/qt/src/dataprovider.cpp
+++ /dev/null
@@ -1,301 +0,0 @@
-/* dataprovider.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (C) 2004 Klarävdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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
-*/
-
-// -*- c++ -*-
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include <dataprovider.h>
-
-#include <gpgme++/error.h>
-
-#include <QIODevice>
-#include <QProcess>
-
-#include <cstdio>
-#include <cstring>
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-//
-//
-// QByteArrayDataProvider
-//
-//
-
-static bool resizeAndInit(QByteArray &ba, size_t newSize)
-{
- const size_t oldSize = ba.size();
- ba.resize(newSize);
- const bool ok = (newSize == static_cast<size_t>(ba.size()));
- if (ok) {
- memset(ba.data() + oldSize, 0, newSize - oldSize);
- }
- return ok;
-}
-
-QByteArrayDataProvider::QByteArrayDataProvider()
- : GpgME::DataProvider(), mOff(0) {}
-
-QByteArrayDataProvider::QByteArrayDataProvider(const QByteArray &initialData)
- : GpgME::DataProvider(), mArray(initialData), mOff(0) {}
-
-QByteArrayDataProvider::~QByteArrayDataProvider() {}
-
-ssize_t QByteArrayDataProvider::read(void *buffer, size_t bufSize)
-{
-#ifndef NDEBUG
- //qDebug( "QByteArrayDataProvider::read( %p, %d )", buffer, bufSize );
-#endif
- if (bufSize == 0) {
- return 0;
- }
- if (!buffer) {
- Error::setSystemError(GPG_ERR_EINVAL);
- return -1;
- }
- if (mOff >= mArray.size()) {
- return 0; // EOF
- }
- size_t amount = qMin(bufSize, static_cast<size_t>(mArray.size() - mOff));
- assert(amount > 0);
- memcpy(buffer, mArray.data() + mOff, amount);
- mOff += amount;
- return amount;
-}
-
-ssize_t QByteArrayDataProvider::write(const void *buffer, size_t bufSize)
-{
-#ifndef NDEBUG
- //qDebug( "QByteArrayDataProvider::write( %p, %lu )", buffer, static_cast<unsigned long>( bufSize ) );
-#endif
- if (bufSize == 0) {
- return 0;
- }
- if (!buffer) {
- Error::setSystemError(GPG_ERR_EINVAL);
- return -1;
- }
- if (mOff >= mArray.size()) {
- resizeAndInit(mArray, mOff + bufSize);
- }
- if (mOff >= mArray.size()) {
- Error::setSystemError(GPG_ERR_EIO);
- return -1;
- }
- assert(bufSize <= static_cast<size_t>(mArray.size()) - mOff);
- memcpy(mArray.data() + mOff, buffer, bufSize);
- mOff += bufSize;
- return bufSize;
-}
-
-off_t QByteArrayDataProvider::seek(off_t offset, int whence)
-{
-#ifndef NDEBUG
- //qDebug( "QByteArrayDataProvider::seek( %d, %d )", int(offset), whence );
-#endif
- int newOffset = mOff;
- switch (whence) {
- case SEEK_SET:
- newOffset = offset;
- break;
- case SEEK_CUR:
- newOffset += offset;
- break;
- case SEEK_END:
- newOffset = mArray.size() + offset;
- break;
- default:
- Error::setSystemError(GPG_ERR_EINVAL);
- return (off_t) - 1;
- }
- return mOff = newOffset;
-}
-
-void QByteArrayDataProvider::release()
-{
-#ifndef NDEBUG
- //qDebug( "QByteArrayDataProvider::release()" );
-#endif
- mArray = QByteArray();
-}
-
-//
-//
-// QIODeviceDataProvider
-//
-//
-
-QIODeviceDataProvider::QIODeviceDataProvider(const std::shared_ptr<QIODevice> &io)
- : GpgME::DataProvider(),
- mIO(io),
- mErrorOccurred(false),
- mHaveQProcess(qobject_cast<QProcess *>(io.get()))
-{
- assert(mIO);
-}
-
-QIODeviceDataProvider::~QIODeviceDataProvider() {}
-
-bool QIODeviceDataProvider::isSupported(Operation op) const
-{
- const QProcess *const proc = qobject_cast<QProcess *>(mIO.get());
- bool canRead = true;
- if (proc) {
- canRead = proc->readChannel() == QProcess::StandardOutput;
- }
-
- switch (op) {
- case Read: return mIO->isReadable() && canRead;
- case Write: return mIO->isWritable();
- case Seek: return !mIO->isSequential();
- case Release: return true;
- default: return false;
- }
-}
-
-static qint64 blocking_read(const std::shared_ptr<QIODevice> &io, char *buffer, qint64 maxSize)
-{
- while (!io->bytesAvailable()) {
- if (!io->waitForReadyRead(-1)) {
- if (const QProcess *const p = qobject_cast<QProcess *>(io.get())) {
- if (p->error() == QProcess::UnknownError &&
- p->exitStatus() == QProcess::NormalExit &&
- p->exitCode() == 0) {
- if (io->atEnd()) {
- // EOF
- return 0;
- } // continue reading even if process ended to ensure
- // everything is read.
- } else {
- Error::setSystemError(GPG_ERR_EIO);
- return -1;
- }
- } else {
- return 0; // assume EOF (loses error cases :/ )
- }
- }
- }
- return io->read(buffer, maxSize);
-}
-
-ssize_t QIODeviceDataProvider::read(void *buffer, size_t bufSize)
-{
-#ifndef NDEBUG
- //qDebug( "QIODeviceDataProvider::read( %p, %lu )", buffer, bufSize );
-#endif
- if (bufSize == 0) {
- return 0;
- }
- if (!buffer) {
- Error::setSystemError(GPG_ERR_EINVAL);
- return -1;
- }
- const qint64 numRead = mHaveQProcess
- ? blocking_read(mIO, static_cast<char *>(buffer), bufSize)
- : mIO->read(static_cast<char *>(buffer), bufSize);
-
- //workaround: some QIODevices (known example: QProcess) might not return 0 (EOF), but immediately -1 when finished. If no
- //errno is set, gpgme doesn't detect the error and loops forever. So return 0 on the very first -1 in case errno is 0
-
- ssize_t rc = numRead;
- if (numRead < 0 && !Error::hasSystemError()) {
- if (mErrorOccurred) {
- Error::setSystemError(GPG_ERR_EIO);
- } else {
- rc = 0;
- }
- }
- if (numRead < 0) {
- mErrorOccurred = true;
- }
- return rc;
-}
-
-ssize_t QIODeviceDataProvider::write(const void *buffer, size_t bufSize)
-{
-#ifndef NDEBUG
- //qDebug( "QIODeviceDataProvider::write( %p, %lu )", buffer, static_cast<unsigned long>( bufSize ) );
-#endif
- if (bufSize == 0) {
- return 0;
- }
- if (!buffer) {
- Error::setSystemError(GPG_ERR_EINVAL);
- return -1;
- }
-
- ssize_t ret = mIO->write(static_cast<const char *>(buffer), bufSize);
- if (mHaveQProcess) {
- /* XXX: With at least Qt 5.12 we have the problem that the acutal write
- * would be triggered by an event / slot. So as we have moved the io
- * device to our thread this is never triggered until the job is finished
- * calling waitForBytesWritten internally triggers a _q_canWrite which will
- * actually write. This is what we want as we want to stream and not to
- * buffer endlessly. */
- qobject_cast<QProcess *>(mIO.get())->waitForBytesWritten(0);
- }
- return ret;
-}
-
-off_t QIODeviceDataProvider::seek(off_t offset, int whence)
-{
-#ifndef NDEBUG
- //qDebug( "QIODeviceDataProvider::seek( %d, %d )", int(offset), whence );
-#endif
- if (mIO->isSequential()) {
- Error::setSystemError(GPG_ERR_ESPIPE);
- return (off_t) - 1;
- }
- qint64 newOffset = mIO->pos();
- switch (whence) {
- case SEEK_SET:
- newOffset = offset;
- break;
- case SEEK_CUR:
- newOffset += offset;
- break;
- case SEEK_END:
- newOffset = mIO->size() + offset;
- break;
- default:
- Error::setSystemError(GPG_ERR_EINVAL);
- return (off_t) - 1;
- }
- if (!mIO->seek(newOffset)) {
- Error::setSystemError(GPG_ERR_EINVAL);
- return (off_t) - 1;
- }
- return newOffset;
-}
-
-void QIODeviceDataProvider::release()
-{
-#ifndef NDEBUG
- //qDebug( "QIODeviceDataProvider::release()" );
-#endif
- mIO->close();
-}
diff --git a/lang/qt/src/dataprovider.h b/lang/qt/src/dataprovider.h
deleted file mode 100644
index c0bd361b..00000000
--- a/lang/qt/src/dataprovider.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* dataprovider.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (C) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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
-*/
-
-// -*- c++ -*-
-#ifndef __QGPGME_DATAPROVIDER_H__
-#define __QGPGME_DATAPROVIDER_H__
-
-#include "qgpgme_export.h"
-
-#include <gpgme++/interfaces/dataprovider.h>
-
-#include <memory>
-
-#include <QtCore/QByteArray>
-
-
-class QIODevice;
-
-namespace QGpgME
-{
-
-class QGPGME_EXPORT QByteArrayDataProvider : public GpgME::DataProvider
-{
-public:
- QByteArrayDataProvider();
- explicit QByteArrayDataProvider(const QByteArray &initialData);
- ~QByteArrayDataProvider();
-
- const QByteArray &data() const
- {
- return mArray;
- }
-
-private:
- // these shall only be accessed through the dataprovider
- // interface, where they're public:
- bool isSupported(Operation) const override
- {
- return true;
- }
- ssize_t read(void *buffer, size_t bufSize) override;
- ssize_t write(const void *buffer, size_t bufSize) override;
- off_t seek(off_t offset, int whence) override;
- void release() override;
-
-private:
- QByteArray mArray;
- off_t mOff;
-};
-
-class QGPGME_EXPORT QIODeviceDataProvider : public GpgME::DataProvider
-{
-public:
- explicit QIODeviceDataProvider(const std::shared_ptr<QIODevice> &initialData);
- ~QIODeviceDataProvider();
-
- const std::shared_ptr<QIODevice> &ioDevice() const
- {
- return mIO;
- }
-
-private:
- // these shall only be accessed through the dataprovider
- // interface, where they're public:
- bool isSupported(Operation) const override;
- ssize_t read(void *buffer, size_t bufSize) override;
- ssize_t write(const void *buffer, size_t bufSize) override;
- off_t seek(off_t offset, int whence) override;
- void release() override;
-
-private:
- const std::shared_ptr<QIODevice> mIO;
- bool mErrorOccurred : 1;
- bool mHaveQProcess : 1;
-};
-
-} // namespace QGpgME
-
-#endif
diff --git a/lang/qt/src/debug.cpp b/lang/qt/src/debug.cpp
deleted file mode 100644
index acde9d42..00000000
--- a/lang/qt/src/debug.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- debug.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2020 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 <gpgme++/error.h>
-#include "debug.h"
-
-#include <QDebug>
-
-QDebug operator<<(QDebug debug, const GpgME::Error &err)
-{
-#ifdef Q_OS_WIN
- // On Windows, we tell libgpg-error to return (translated) error messages as UTF-8
- const auto errAsString = QString::fromStdString(err.asStdString());
-#else
- const auto errAsString = QString::fromLocal8Bit(err.asStdString().c_str());
-#endif
- const bool oldSetting = debug.autoInsertSpaces();
- debug.nospace() << errAsString << " (code: " << err.code() << ", source: " << err.source() << ")";
- debug.setAutoInsertSpaces(oldSetting);
- return debug.maybeSpace();
-}
diff --git a/lang/qt/src/debug.h b/lang/qt/src/debug.h
deleted file mode 100644
index 03894768..00000000
--- a/lang/qt/src/debug.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- debug.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2020 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_DEBUG_H
-#define QGPGME_DEBUG_H
-
-#include "qgpgme_export.h"
-
-#include <sstream>
-
-namespace GpgME
-{
-class Error;
-}
-
-class QDebug;
-
-QGPGME_EXPORT QDebug operator<<(QDebug debug, const GpgME::Error &err);
-
-namespace QGpgME
-{
-/**
- * Helper to log GpgME objects which provide the output stream operator.
- */
-template<class GpgMEClass>
-std::string toLogString(const GpgMEClass &object)
-{
- std::stringstream stream;
- stream << object;
- return stream.str();
-}
-}
-
-#endif // QGPGME_DEBUG_H
diff --git a/lang/qt/src/decryptjob.h b/lang/qt/src/decryptjob.h
deleted file mode 100644
index 51954074..00000000
--- a/lang/qt/src/decryptjob.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- decryptjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_DECRYPTJOB_H__
-#define __KLEO_DECRYPTJOB_H__
-
-#include "job.h"
-
-#include <memory>
-
-class QByteArray;
-class QIODevice;
-
-namespace GpgME
-{
-class Error;
-class DecryptionResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous decrypters
-
- To use a DecryptJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the decryption with a
- call to start(). This call might fail, in which case the
- DecryptJob instance will have scheduled it's own destruction with
- a call to QObject::deleteLater().
-
- After result() is emitted, the DecryptJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT DecryptJob : public Job
-{
- Q_OBJECT
-protected:
- explicit DecryptJob(QObject *parent);
-public:
- ~DecryptJob();
-
- /**
- Starts the decryption operation. \a cipherText is the data to
- decrypt.
- */
- virtual GpgME::Error start(const QByteArray &cipherText) = 0;
-
- /*!
- \overload
-
- If \a plainText is non-null, the plaintext is written
- there. Otherwise, it will be delivered in the second argument
- of result().
- */
- virtual void start(const std::shared_ptr<QIODevice> &cipherText, const std::shared_ptr<QIODevice> &plainText = std::shared_ptr<QIODevice>()) = 0;
-
- virtual GpgME::DecryptionResult exec(const QByteArray &cipherText,
- QByteArray &plainText) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::DecryptionResult &result, const QByteArray &plainText, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_DECRYPTJOB_H__
diff --git a/lang/qt/src/decryptverifyarchivejob.cpp b/lang/qt/src/decryptverifyarchivejob.cpp
deleted file mode 100644
index d427e1fd..00000000
--- a/lang/qt/src/decryptverifyarchivejob.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- decryptverifyarchivejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "decryptverifyarchivejob.h"
-#include "decryptverifyarchivejob_p.h"
-
-#include <gpgme++/engineinfo.h>
-
-using namespace QGpgME;
-
-DecryptVerifyArchiveJob::DecryptVerifyArchiveJob(QObject *parent)
- : Job{parent}
-{
-}
-
-DecryptVerifyArchiveJob::~DecryptVerifyArchiveJob() = default;
-
-// static
-bool DecryptVerifyArchiveJob::isSupported()
-{
- static const auto gpgVersion = GpgME::engineInfo(GpgME::GpgEngine).engineVersion();
- return (gpgVersion >= "2.4.1") || (gpgVersion >= "2.2.42" && gpgVersion < "2.3.0");
-}
-
-void DecryptVerifyArchiveJob::setProcessAllSignatures (bool processAll)
-{
- auto d = jobPrivate<DecryptVerifyArchiveJobPrivate>(this);
- d->m_processAllSignatures = processAll;
-}
-
-bool DecryptVerifyArchiveJob::processAllSignatures() const
-{
- auto d = jobPrivate<DecryptVerifyArchiveJobPrivate>(this);
- return d->m_processAllSignatures;
-}
-
-void DecryptVerifyArchiveJob::setInputFile(const QString &path)
-{
- auto d = jobPrivate<DecryptVerifyArchiveJobPrivate>(this);
- d->m_inputFilePath = path;
-}
-
-QString DecryptVerifyArchiveJob::inputFile() const
-{
- auto d = jobPrivate<DecryptVerifyArchiveJobPrivate>(this);
- return d->m_inputFilePath;
-}
-
-void DecryptVerifyArchiveJob::setOutputDirectory(const QString &outputDirectory)
-{
- auto d = jobPrivate<DecryptVerifyArchiveJobPrivate>(this);
- d->m_outputDirectory = outputDirectory;
-}
-
-QString DecryptVerifyArchiveJob::outputDirectory() const
-{
- auto d = jobPrivate<DecryptVerifyArchiveJobPrivate>(this);
- return d->m_outputDirectory;
-}
-
-#include "decryptverifyarchivejob.moc"
diff --git a/lang/qt/src/decryptverifyarchivejob.h b/lang/qt/src/decryptverifyarchivejob.h
deleted file mode 100644
index 3139ae66..00000000
--- a/lang/qt/src/decryptverifyarchivejob.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- decryptverifyarchivejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_DECRYPTVERIFYARCHIVEJOB_H__
-#define __QGPGME_DECRYPTVERIFYARCHIVEJOB_H__
-
-#include "job.h"
-
-#include <gpgme++/context.h>
-
-namespace GpgME
-{
-class Key;
-}
-
-namespace QGpgME
-{
-
-/**
- * Abstract base class for job for decrypting encrypted (signed) archives
- */
-class QGPGME_EXPORT DecryptVerifyArchiveJob : public Job
-{
- Q_OBJECT
-protected:
- explicit DecryptVerifyArchiveJob(QObject *parent);
-public:
- ~DecryptVerifyArchiveJob() override;
-
- static bool isSupported();
-
- /**
- * Enables processing of all signatures if \a processAll is true.
- *
- * By default, gpg (in batch mode used by GpgME) stops the verification of
- * data signatures when a bad signature is encountered. This can be changed
- * by setting this flag. It's equivalent to setting the context flag
- * "proc-all-sigs".
- *
- * This is only supported for OpenPGP and requires GnuPG 2.2.45, 2.4.6, or
- * 2.5.1.
- */
- void setProcessAllSignatures(bool processAll);
- bool processAllSignatures() const;
-
- /**
- * Sets the path of the file to read the archive from.
- *
- * Used if the job is started with startIt().
- */
- void setInputFile(const QString &path);
- QString inputFile() const;
-
- /**
- * Sets the directory the content of the decrypted archive shall be
- * written to.
- */
- void setOutputDirectory(const QString &outputDirectory);
- QString outputDirectory() const;
-
- /**
- * Starts the decryption of an encrypted (and signed) archive.
- *
- * Decrypts and extracts the encrypted archive in \a cipherText. If the
- * archive is signed, then the signature is verified.
- * If a non-empty output directory was set, then the content of the archive
- * is extracted into this directory. Otherwise, it is extracted into a
- * directory named \c GPGARCH_n_ (where \c n is a number).
- *
- * Emits result() when the job has finished.
- */
- virtual GpgME::Error start(const std::shared_ptr<QIODevice> &cipherText) = 0;
-
-Q_SIGNALS:
- /**
- * This signal is emitted whenever gpgtar sends a progress status update for
- * the number of files. In the scanning phase (i.e. while gpgtar checks
- * which files to put into the archive), \a current is the current number of
- * files and \a total is 0. In the writing phase, \a current is the number
- * of processed files and \a total is the total number of files.
- */
- void fileProgress(int current, int total);
-
- /**
- * This signal is emitted whenever gpgtar sends a progress status update for
- * the amount of processed data. It is only emitted in the writing phase.
- * \a current is the processed amount data and \a total is the total amount
- * of data to process. Both values never exceed 2^20.
- */
- void dataProgress(int current, int total);
-
- void result(const GpgME::DecryptionResult &decryptionResult,
- const GpgME::VerificationResult &verificationResult,
- const QString &auditLogAsHtml = {},
- const GpgME::Error &auditLogError = {});
-};
-
-}
-
-#endif // __QGPGME_DECRYPTVERIFYARCHIVEJOB_H__
diff --git a/lang/qt/src/decryptverifyarchivejob_p.h b/lang/qt/src/decryptverifyarchivejob_p.h
deleted file mode 100644
index bce093db..00000000
--- a/lang/qt/src/decryptverifyarchivejob_p.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- decryptverifyarchivejob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_DECRYPTVERIFYARCHIVEJOB_P_H__
-#define __QGPGME_DECRYPTVERIFYARCHIVEJOB_P_H__
-
-#include "job_p.h"
-
-namespace QGpgME
-{
-
-struct DecryptVerifyArchiveJobPrivate : public JobPrivate
-{
- QString m_inputFilePath;
- QString m_outputDirectory;
- bool m_processAllSignatures = false;
-};
-
-}
-
-#endif // __QGPGME_DECRYPTVERIFYARCHIVEJOB_P_H__
diff --git a/lang/qt/src/decryptverifyjob.cpp b/lang/qt/src/decryptverifyjob.cpp
deleted file mode 100644
index f96305b9..00000000
--- a/lang/qt/src/decryptverifyjob.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- decryptverifyjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "decryptverifyjob.h"
-#include "decryptverifyjob_p.h"
-
-using namespace QGpgME;
-
-DecryptVerifyJob::DecryptVerifyJob(QObject *parent)
- : Job{parent}
-{
-}
-
-DecryptVerifyJob::~DecryptVerifyJob() = default;
-
-void DecryptVerifyJob::setProcessAllSignatures (bool processAll)
-{
- auto d = jobPrivate<DecryptVerifyJobPrivate>(this);
- d->m_processAllSignatures = processAll;
-}
-
-bool DecryptVerifyJob::processAllSignatures() const
-{
- auto d = jobPrivate<DecryptVerifyJobPrivate>(this);
- return d->m_processAllSignatures;
-}
-
-void DecryptVerifyJob::setInputFile(const QString &path)
-{
- auto d = jobPrivate<DecryptVerifyJobPrivate>(this);
- d->m_inputFilePath = path;
-}
-
-QString DecryptVerifyJob::inputFile() const
-{
- auto d = jobPrivate<DecryptVerifyJobPrivate>(this);
- return d->m_inputFilePath;
-}
-
-void DecryptVerifyJob::setOutputFile(const QString &path)
-{
- auto d = jobPrivate<DecryptVerifyJobPrivate>(this);
- d->m_outputFilePath = path;
-}
-
-QString DecryptVerifyJob::outputFile() const
-{
- auto d = jobPrivate<DecryptVerifyJobPrivate>(this);
- return d->m_outputFilePath;
-}
-
-#include "decryptverifyjob.moc"
diff --git a/lang/qt/src/decryptverifyjob.h b/lang/qt/src/decryptverifyjob.h
deleted file mode 100644
index 73dbea15..00000000
--- a/lang/qt/src/decryptverifyjob.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- decryptverifyjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_DECRYPTVERIFYJOB_H__
-#define __KLEO_DECRYPTVERIFYJOB_H__
-
-#include "job.h"
-
-#include <memory>
-
-class QByteArray;
-class QIODevice;
-
-namespace GpgME
-{
-class Error;
-class DecryptionResult;
-class VerificationResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous combined decrypters and verifiers
-
- To use a DecryptVerifyJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the operation with a
- call to start(). This call might fail, in which case the
- DecryptVerifyJob instance will have scheduled it's own destruction with
- a call to QObject::deleteLater().
-
- Alternatively, the job can be started with startIt() after setting
- an input file and an output file. If the job is started this way then
- the backend reads the input and writes the output directly from/to the
- specified input file and output file. In this case the plainText value of
- the result signal will always be empty. This direct IO mode is currently
- only supported for OpenPGP. Note that startIt() does not schedule the job's
- destruction if starting the job failed.
-
- After result() is emitted, the DecryptVerifyJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT DecryptVerifyJob : public Job
-{
- Q_OBJECT
-protected:
- explicit DecryptVerifyJob(QObject *parent);
-public:
- ~DecryptVerifyJob() override;
-
- /**
- * Enables processing of all signatures if \a processAll is true.
- *
- * By default, gpg (in batch mode used by GpgME) stops the verification of
- * data signatures when a bad signature is encountered. This can be changed
- * by setting this flag. It's equivalent to setting the context flag
- * "proc-all-sigs".
- *
- * This is only supported for OpenPGP and requires GnuPG 2.2.45, 2.4.6, or
- * 2.5.1.
- */
- void setProcessAllSignatures(bool processAll);
- bool processAllSignatures() const;
-
- /**
- * Sets the path of the file to decrypt (and verify).
- *
- * Used if the job is started with startIt().
- */
- void setInputFile(const QString &path);
- QString inputFile() const;
-
- /**
- * Sets the path of the file to write the result to.
- *
- * Used if the job is started with startIt().
- *
- * \note If a file with this path exists, then the job will fail, i.e. you
- * need to delete an existing file that shall be overwritten before you
- * start the job.
- */
- void setOutputFile(const QString &path);
- QString outputFile() const;
-
- /**
- Starts the combined decryption and verification operation.
- \a cipherText is the data to decrypt and later verify.
- */
- virtual GpgME::Error start(const QByteArray &cipherText) = 0;
-
- /*!
- \overload
-
- If \a plainText is non-null, the plaintext is written
- there. Otherwise, it will be delivered in the third argument
- of result().
- */
- virtual void start(const std::shared_ptr<QIODevice> &cipherText, const std::shared_ptr<QIODevice> &plainText = std::shared_ptr<QIODevice>()) = 0;
-
- /** Synchronous equivalent of start() */
- virtual std::pair<GpgME::DecryptionResult, GpgME::VerificationResult>
- exec(const QByteArray &cipherText, QByteArray &plainText) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::DecryptionResult &decryptionresult,
- const GpgME::VerificationResult &verificationresult,
- const QByteArray &plainText, const QString &auditLogAsHtml = QString(),
- const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_DECRYPTVERIFYJOB_H__
diff --git a/lang/qt/src/decryptverifyjob_p.h b/lang/qt/src/decryptverifyjob_p.h
deleted file mode 100644
index 10701da1..00000000
--- a/lang/qt/src/decryptverifyjob_p.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- decryptverifyjob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_DECRYPTVERIFYJOB_P_H__
-#define __QGPGME_DECRYPTVERIFYJOB_P_H__
-
-#include "job_p.h"
-
-namespace QGpgME
-{
-
-struct DecryptVerifyJobPrivate : public JobPrivate
-{
- QString m_inputFilePath;
- QString m_outputFilePath;
- bool m_processAllSignatures = false;
-};
-
-}
-
-#endif // __QGPGME_DECRYPTVERIFYJOB_P_H__
diff --git a/lang/qt/src/defaultkeygenerationjob.cpp b/lang/qt/src/defaultkeygenerationjob.cpp
deleted file mode 100644
index f589384e..00000000
--- a/lang/qt/src/defaultkeygenerationjob.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/* defaultkeygenerationjob.cpp
-
- Copyright (c) 2016 Klarälvdalens Datakonsult AB
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "defaultkeygenerationjob.h"
-#include "protocol.h"
-#include "keygenerationjob.h"
-
-#include <QPointer>
-#include <QEvent>
-
-using namespace QGpgME;
-
-namespace QGpgME {
-
-class DefaultKeyGenerationJob::Private
-{
-public:
- Private()
- {}
-
- ~Private()
- {
- if (job) {
- job->deleteLater();
- }
- }
-
- QPointer<KeyGenerationJob> job;
-};
-}
-
-
-DefaultKeyGenerationJob::DefaultKeyGenerationJob(QObject* parent)
- : Job(parent)
- , d(new DefaultKeyGenerationJob::Private())
-{
-}
-
-DefaultKeyGenerationJob::~DefaultKeyGenerationJob()
-{
- delete d;
-}
-
-QString DefaultKeyGenerationJob::auditLogAsHtml() const
-{
- return d->job ? d->job->auditLogAsHtml() : QString();
-}
-
-GpgME::Error DefaultKeyGenerationJob::auditLogError() const
-{
- return d->job ? d->job->auditLogError() : GpgME::Error();
-}
-
-void DefaultKeyGenerationJob::slotCancel()
-{
- if (d->job) {
- d->job->slotCancel();
- }
-}
-
-GpgME::Error DefaultKeyGenerationJob::start(const QString &email, const QString &name)
-{
- const QString namePart = name.isEmpty() ? QString() :
- QStringLiteral("name-real: %1\n").arg(name);
- const QString mailPart = email.isEmpty() ? QString() :
- QStringLiteral("name-email: %1\n").arg(email);
-
- const QString args = QStringLiteral("<GnupgKeyParms format=\"internal\">\n"
- "%ask-passphrase\n"
- "key-type: RSA\n"
- "key-length: 2048\n"
- "key-usage: sign\n"
- "subkey-type: RSA\n"
- "subkey-length: 2048\n"
- "subkey-usage: encrypt\n"
- "%1"
- "%2"
- "</GnupgKeyParms>").arg(mailPart, namePart);
-
- d->job = openpgp()->keyGenerationJob();
- d->job->installEventFilter(this);
- connect(d->job.data(), &KeyGenerationJob::result,
- this, &DefaultKeyGenerationJob::result);
- connect(d->job.data(), &KeyGenerationJob::done,
- this, &DefaultKeyGenerationJob::done);
- connect(d->job.data(), &KeyGenerationJob::done,
- this, &QObject::deleteLater);
- return d->job->start(args);
-}
-
-bool DefaultKeyGenerationJob::eventFilter(QObject *watched, QEvent *event)
-{
- // Intercept the KeyGenerationJob's deferred delete event. We want the job
- // to live at least as long as we do so we can delegate calls to it. We will
- // delete the job manually afterwards.
- if (watched == d->job && event->type() == QEvent::DeferredDelete) {
- return true;
- }
-
- return Job::eventFilter(watched, event);
-}
-
-#include "defaultkeygenerationjob.moc"
diff --git a/lang/qt/src/defaultkeygenerationjob.h b/lang/qt/src/defaultkeygenerationjob.h
deleted file mode 100644
index c59e0c6d..00000000
--- a/lang/qt/src/defaultkeygenerationjob.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* defaultkeygenerationjob.h
-
- Copyright (c) 2016 Klarälvdalens Datakonsult AB
- 2016 Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_DEFAULTKEYGENERATION_H
-#define QGPGME_DEFAULTKEYGENERATION_H
-
-#include "job.h"
-
-#include "qgpgme_export.h"
-
-namespace GpgME {
-class KeyGenerationResult;
-}
-
-namespace QGpgME{
-
-/**
- * Generates a PGP RSA/2048 bit key pair for given name and email address.
- *
- * This job is deprecated. Use QuickJob::startCreate instead.
- */
-class QGPGME_DEPRECATED_EXPORT DefaultKeyGenerationJob : public Job
-{
- Q_OBJECT
-public:
- explicit DefaultKeyGenerationJob(QObject *parent = nullptr);
- ~DefaultKeyGenerationJob();
-
- GpgME::Error start(const QString &email, const QString &name);
-
- QString auditLogAsHtml() const override;
- GpgME::Error auditLogError() const override;
-
-
-public Q_SLOTS:
- void slotCancel() override;
-
-Q_SIGNALS:
- void result(const GpgME::KeyGenerationResult &result, const QByteArray &pubkeyData,
- const QString &auditLogAsHtml, const GpgME::Error &auditLogError);
-
-protected:
- bool eventFilter(QObject *watched, QEvent *event) override;
-
-private:
- class Private;
- Private * const d;
-};
-
-}
-
-#endif
diff --git a/lang/qt/src/deletejob.h b/lang/qt/src/deletejob.h
deleted file mode 100644
index 7ab0dd05..00000000
--- a/lang/qt/src/deletejob.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- deletejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_DELETEJOB_H__
-#define __KLEO_DELETEJOB_H__
-
-#include "qgpgme_export.h"
-#include "job.h"
-
-namespace GpgME
-{
-class Error;
-class Key;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous deleters
-
- To use a DeleteJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the delete with a call
- to start(). This call might fail, in which case the DeleteJob
- instance will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the DeleteJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT DeleteJob : public Job
-{
- Q_OBJECT
-protected:
- explicit DeleteJob(QObject *parent);
-public:
- ~DeleteJob();
-
- /**
- Starts the delete operation. \a key represents the key to
- delete, \a allowSecretKeyDeletion specifies if a key may also
- be deleted if the secret key part is available, too.
- */
- virtual GpgME::Error start(const GpgME::Key &key, bool allowSecretKeyDeletion = false) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_DELETEJOB_H__
diff --git a/lang/qt/src/dn.cpp b/lang/qt/src/dn.cpp
deleted file mode 100644
index 836158b0..00000000
--- a/lang/qt/src/dn.cpp
+++ /dev/null
@@ -1,497 +0,0 @@
-/*
- dn.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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"
-
-#include <gpg-error.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);
- gpgrt_asprintf(&p, "%s", oidmap[i].name);
- break;
- }
- array->key = p;
- string = s + 1;
-
- if (*string == '#') {
- /* hexstring */
- string++;
- for (s = string; hexdigitp(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 = { nullptr, nullptr };
- 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
deleted file mode 100644
index 2d655c55..00000000
--- a/lang/qt/src/dn.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- dn.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 Attributes. */
- 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/downloadjob.h b/lang/qt/src/downloadjob.h
deleted file mode 100644
index dc1201ee..00000000
--- a/lang/qt/src/downloadjob.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- downloadjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_DOWNLOADJOB_H__
-#define __KLEO_DOWNLOADJOB_H__
-
-#include "job.h"
-
-#include <QtCore/QByteArray>
-#include <QtCore/QStringList>
-
-#include <memory>
-
-namespace GpgME
-{
-class Error;
-}
-
-class QIODevice;
-class QByteArray;
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous downloaders
-
- To use a DownloadJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the download with a call
- to start(). This call might fail, in which case the DownloadJob
- instance will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the DownloadJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT DownloadJob : public Job
-{
- Q_OBJECT
-protected:
- explicit DownloadJob(QObject *parent);
-public:
- ~DownloadJob();
-
- /**
- Starts the download operation. \a fingerprint is the
- fingerprint of the key to download. If \a fingerprint is empty,
- contains only whitespace or anything other than a fingerprint,
- the result is undefined.
-
- Output is written to \a keyData, if given. Otherwise, it is
- passed as the second argument of result().
- */
- virtual GpgME::Error start(const QByteArray &fingerprint,
- const std::shared_ptr<QIODevice> &keyData) = 0;
-
- /**
- Starts the download operation. \a fingerprints is a list of
- fingerprints used to specify the list of keys downloaded. Empty
- patterns are ignored. If \a fingerprints is empty, contains
- only empty strings or anything other than fingerprints, the
- result is undefined.
- */
- QGPGME_DEPRECATED virtual GpgME::Error start(const QStringList &fingerprints) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QByteArray &keyData, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_DOWNLOADJOB_H__
diff --git a/lang/qt/src/encryptarchivejob.cpp b/lang/qt/src/encryptarchivejob.cpp
deleted file mode 100644
index f4cf288f..00000000
--- a/lang/qt/src/encryptarchivejob.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- encryptarchivejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "encryptarchivejob.h"
-#include "encryptarchivejob_p.h"
-
-#include <gpgme++/engineinfo.h>
-
-using namespace QGpgME;
-
-EncryptArchiveJob::EncryptArchiveJob(QObject *parent)
- : Job{parent}
-{
-}
-
-EncryptArchiveJob::~EncryptArchiveJob() = default;
-
-// static
-bool EncryptArchiveJob::isSupported()
-{
- static const auto gpgVersion = GpgME::engineInfo(GpgME::GpgEngine).engineVersion();
- return (gpgVersion >= "2.4.1") || (gpgVersion >= "2.2.42" && gpgVersion < "2.3.0");
-}
-
-void EncryptArchiveJob::setRecipients(const std::vector<GpgME::Key> &recipients)
-{
- auto d = jobPrivate<EncryptArchiveJobPrivate>(this);
- d->m_recipients = recipients;
-}
-
-std::vector<GpgME::Key> EncryptArchiveJob::recipients() const
-{
- auto d = jobPrivate<EncryptArchiveJobPrivate>(this);
- return d->m_recipients;
-}
-
-void EncryptArchiveJob::setInputPaths(const std::vector<QString> &paths)
-{
- auto d = jobPrivate<EncryptArchiveJobPrivate>(this);
- d->m_inputPaths = paths;
-}
-
-std::vector<QString> EncryptArchiveJob::inputPaths() const
-{
- auto d = jobPrivate<EncryptArchiveJobPrivate>(this);
- return d->m_inputPaths;
-}
-
-void EncryptArchiveJob::setOutputFile(const QString &path)
-{
- auto d = jobPrivate<EncryptArchiveJobPrivate>(this);
- d->m_outputFilePath = path;
-}
-
-QString EncryptArchiveJob::outputFile() const
-{
- auto d = jobPrivate<EncryptArchiveJobPrivate>(this);
- return d->m_outputFilePath;
-}
-
-void EncryptArchiveJob::setEncryptionFlags(GpgME::Context::EncryptionFlags flags)
-{
- auto d = jobPrivate<EncryptArchiveJobPrivate>(this);
- d->m_encryptionFlags = static_cast<GpgME::Context::EncryptionFlags>(flags | GpgME::Context::EncryptArchive);
-}
-
-GpgME::Context::EncryptionFlags EncryptArchiveJob::encryptionFlags() const
-{
- auto d = jobPrivate<EncryptArchiveJobPrivate>(this);
- return d->m_encryptionFlags;
-}
-
-void EncryptArchiveJob::setBaseDirectory(const QString &baseDirectory)
-{
- auto d = jobPrivate<EncryptArchiveJobPrivate>(this);
- d->m_baseDirectory = baseDirectory;
-}
-
-QString EncryptArchiveJob::baseDirectory() const
-{
- auto d = jobPrivate<EncryptArchiveJobPrivate>(this);
- return d->m_baseDirectory;
-}
-
-#include "encryptarchivejob.moc"
diff --git a/lang/qt/src/encryptarchivejob.h b/lang/qt/src/encryptarchivejob.h
deleted file mode 100644
index bba8acb6..00000000
--- a/lang/qt/src/encryptarchivejob.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- encryptarchivejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_ENCRYPTARCHIVEJOB_H__
-#define __QGPGME_ENCRYPTARCHIVEJOB_H__
-
-#include "job.h"
-
-#include <gpgme++/context.h>
-
-namespace GpgME
-{
-class Key;
-}
-
-namespace QGpgME
-{
-
-/**
- * Abstract base class for job for creating encrypted archives
- */
-class QGPGME_EXPORT EncryptArchiveJob : public Job
-{
- Q_OBJECT
-protected:
- explicit EncryptArchiveJob(QObject *parent);
-public:
- ~EncryptArchiveJob() override;
-
- static bool isSupported();
-
- /**
- * Sets the keys to use for encrypting the archive.
- *
- * Used if the job is started with startIt().
- */
- void setRecipients(const std::vector<GpgME::Key> &recipients);
- std::vector<GpgME::Key> recipients() const;
-
- /**
- * Sets the paths of the files and folders to put into the archive.
- *
- * If base directory is set, then the paths must be relative to the
- * base directory.
- *
- * Used if the job is started with startIt().
- */
- void setInputPaths(const std::vector<QString> &paths);
- std::vector<QString> inputPaths() const;
-
- /**
- * Sets the path of the file to write the created archive to.
- *
- * If \a path is a relative path and base directory is set, then the
- * path is interpreted relative to the base directory.
- *
- * Used if the job is started with startIt().
- *
- * \note If a file with this path exists, then the job will fail, i.e. you
- * need to delete an existing file that shall be overwritten before you
- * start the job.
- */
- void setOutputFile(const QString &path);
- QString outputFile() const;
-
- /**
- * Sets the flags to use for encryption. Defaults to \c EncryptArchive.
- * The \c EncryptArchive flag is always assumed set for this job.
- *
- * Used if the job is started with startIt().
- */
- void setEncryptionFlags(GpgME::Context::EncryptionFlags flags);
- GpgME::Context::EncryptionFlags encryptionFlags() const;
-
- /**
- * Sets the base directory for the relative paths of the input files and
- * the output file.
- */
- void setBaseDirectory(const QString &baseDirectory);
- QString baseDirectory() const;
-
- /**
- * Starts the creation of an encrypted archive.
- *
- * Encrypts the files and directories in \a paths into an archive for the
- * keys in \a recipients. If \a recipients is empty, then symmetric
- * encryption is performed. The encrypted archive is written to \a cipherText.
- *
- * Emits result() when the job has finished.
- */
- virtual GpgME::Error start(const std::vector<GpgME::Key> &recipients,
- const std::vector<QString> &paths,
- const std::shared_ptr<QIODevice> &cipherText,
- const GpgME::Context::EncryptionFlags flags) = 0;
-
-Q_SIGNALS:
- /**
- * This signal is emitted whenever gpgtar sends a progress status update for
- * the number of files. In the scanning phase (i.e. while gpgtar checks
- * which files to put into the archive), \a current is the current number of
- * files and \a total is 0. In the writing phase, \a current is the number
- * of processed files and \a total is the total number of files.
- */
- void fileProgress(int current, int total);
-
- /**
- * This signal is emitted whenever gpgtar sends a progress status update for
- * the amount of processed data. It is only emitted in the writing phase.
- * \a current is the processed amount data and \a total is the total amount
- * of data to process. Both values never exceed 2^20.
- */
- void dataProgress(int current, int total);
-
- void result(const GpgME::EncryptionResult &result,
- const QString &auditLogAsHtml = {},
- const GpgME::Error &auditLogError = {});
-};
-
-}
-
-#endif // __QGPGME_ENCRYPTARCHIVEJOB_H__
diff --git a/lang/qt/src/encryptarchivejob_p.h b/lang/qt/src/encryptarchivejob_p.h
deleted file mode 100644
index f2d5eea9..00000000
--- a/lang/qt/src/encryptarchivejob_p.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- encryptarchivejob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_ENCRYPTARCHIVEJOB_P_H__
-#define __QGPGME_ENCRYPTARCHIVEJOB_P_H__
-
-#include "job_p.h"
-
-namespace QGpgME
-{
-
-struct EncryptArchiveJobPrivate : public JobPrivate
-{
- std::vector<GpgME::Key> m_recipients;
- std::vector<QString> m_inputPaths;
- QString m_outputFilePath;
- QString m_baseDirectory;
- GpgME::Context::EncryptionFlags m_encryptionFlags = GpgME::Context::EncryptArchive;
-};
-
-}
-
-#endif // __QGPGME_ENCRYPTARCHIVEJOB_P_H__
diff --git a/lang/qt/src/encryptjob.cpp b/lang/qt/src/encryptjob.cpp
deleted file mode 100644
index d4337bad..00000000
--- a/lang/qt/src/encryptjob.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- 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 <[email protected]>
-
- 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 "encryptjob_p.h"
-
-using namespace QGpgME;
-
-EncryptJob::EncryptJob(QObject *parent)
- : Job{parent}
-{
-}
-
-EncryptJob::~EncryptJob() = default;
-
-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;
-}
-
-void EncryptJob::setInputEncoding(GpgME::Data::Encoding inputEncoding)
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- d->m_inputEncoding = inputEncoding;
-}
-
-GpgME::Data::Encoding EncryptJob::inputEncoding() const
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- return d->m_inputEncoding;
-}
-
-void EncryptJob::setRecipients(const std::vector<GpgME::Key> &recipients)
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- d->m_recipients = recipients;
-}
-
-std::vector<GpgME::Key> EncryptJob::recipients() const
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- return d->m_recipients;
-}
-
-void EncryptJob::setInputFile(const QString &path)
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- d->m_inputFilePath = path;
-}
-
-QString EncryptJob::inputFile() const
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- return d->m_inputFilePath;
-}
-
-void EncryptJob::setOutputFile(const QString &path)
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- d->m_outputFilePath = path;
-}
-
-QString EncryptJob::outputFile() const
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- return d->m_outputFilePath;
-}
-
-void EncryptJob::setEncryptionFlags(GpgME::Context::EncryptionFlags flags)
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- d->m_encryptionFlags = static_cast<GpgME::Context::EncryptionFlags>(flags | GpgME::Context::EncryptFile);
-}
-
-GpgME::Context::EncryptionFlags EncryptJob::encryptionFlags() const
-{
- auto d = jobPrivate<EncryptJobPrivate>(this);
- return d->m_encryptionFlags;
-}
-
-#include "encryptjob.moc"
diff --git a/lang/qt/src/encryptjob.h b/lang/qt/src/encryptjob.h
deleted file mode 100644
index dde9d6e8..00000000
--- a/lang/qt/src/encryptjob.h
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- encryptjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- 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 <[email protected]>
-
- 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 __KLEO_ENCRYPTJOB_H__
-#define __KLEO_ENCRYPTJOB_H__
-
-#include "job.h"
-#include <gpgme++/data.h>
-
-#include <memory>
-#include <vector>
-
-#include <gpgme++/context.h>
-
-class QByteArray;
-class QIODevice;
-
-namespace GpgME
-{
-class Error;
-class Key;
-class EncryptionResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous encrypters
-
- To use a EncryptJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the encryption with a
- call to start(). This call might fail, in which case the
- EncryptJob instance will have scheduled it's own destruction with
- a call to QObject::deleteLater().
-
- Alternatively, the job can be started with startIt() after setting
- an input file and an output file and, optionally, recipients or flags.
- If the job is started this way then the backend reads the input and
- writes the output directly from/to the specified input file and output
- file. In this case the cipherText value of the result signal will always
- be empty. This direct IO mode is currently only supported for OpenPGP.
- Note that startIt() does not schedule the job's destruction if starting
- the job failed.
-
- After result() is emitted, the EncryptJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT EncryptJob : public Job
-{
- Q_OBJECT
-protected:
- explicit EncryptJob(QObject *parent);
-public:
- ~EncryptJob() override;
-
- /**
- * Sets the file name to embed in the encryption result.
- *
- * This is only used if one of the start() functions is used.
- */
- void setFileName(const QString &fileName);
- QString fileName() const;
-
- /**
- * Sets the encoding of the plaintext.
- *
- * This is only used if one of the start() functions is used.
- */
- void setInputEncoding(GpgME::Data::Encoding);
- GpgME::Data::Encoding inputEncoding() const;
-
- /**
- * Sets the keys to use for encryption.
- *
- * Used if the job is started with startIt().
- */
- void setRecipients(const std::vector<GpgME::Key> &recipients);
- std::vector<GpgME::Key> recipients() const;
-
- /**
- * Sets the path of the file to encrypt.
- *
- * Used if the job is started with startIt().
- */
- void setInputFile(const QString &path);
- QString inputFile() const;
-
- /**
- * Sets the path of the file to write the encryption result to.
- *
- * Used if the job is started with startIt().
- *
- * \note If a file with this path exists, then the job will fail, i.e. you
- * need to delete an existing file that shall be overwritten before you
- * start the job.
- */
- void setOutputFile(const QString &path);
- QString outputFile() const;
-
- /**
- * Sets the flags to use for encryption.
- *
- * Defaults to \c EncryptFile.
- *
- * Used if the job is started with startIt(). The \c EncryptFile flag is
- * always assumed set.
- */
- void setEncryptionFlags(GpgME::Context::EncryptionFlags flags);
- GpgME::Context::EncryptionFlags encryptionFlags() const;
-
- /**
- Starts the encryption operation. \a recipients is the a list of
- keys to encrypt \a plainText to. Empty (null) keys are
- ignored. If \a recipients is empty, performs symmetric
- (passphrase) encryption.
-
- If \a alwaysTrust is true, validity checking for the keys will
- not be performed, but full validity assumed for all keys
- without further checks.
- */
- virtual GpgME::Error start(const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText, bool alwaysTrust = false) = 0;
-
- /*!
- \overload
-
- If \a cipherText is non-null, the ciphertext is written
- there. Otherwise, it will be delivered in the second argument of
- result().
- */
- virtual void start(const std::vector<GpgME::Key> &recipients,
- const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &cipherText = std::shared_ptr<QIODevice>(),
- bool alwaysTrust = false) = 0;
-
- virtual GpgME::EncryptionResult exec(const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText,
- bool alwaysTrust, QByteArray &cipherText) = 0;
- /*!
- This is a hack to request BASE64 output (instead of whatever
- comes out normally).
- */
- virtual void setOutputIsBase64Encoded(bool) = 0;
-
- /** Like start but with an additional argument for EncryptionFlags for
- * more flexibility. */
- virtual void start(const std::vector<GpgME::Key> &recipients,
- const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &cipherText = std::shared_ptr<QIODevice>(),
- const GpgME::Context::EncryptionFlags flags = GpgME::Context::None) = 0;
-
- /** Like exec but with an additional argument for EncryptionFlags for
- * more flexibility. */
- virtual GpgME::EncryptionResult exec(const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText,
- const GpgME::Context::EncryptionFlags flags, QByteArray &cipherText) = 0;
-Q_SIGNALS:
- void result(const GpgME::EncryptionResult &result, const QByteArray &cipherText, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_ENCRYPTJOB_H__
diff --git a/lang/qt/src/encryptjob_p.h b/lang/qt/src/encryptjob_p.h
deleted file mode 100644
index 95126e13..00000000
--- a/lang/qt/src/encryptjob_p.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- encryptjob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_ENCRYPTJOB_P_H__
-#define __QGPGME_ENCRYPTJOB_P_H__
-
-#include "job_p.h"
-
-#include <gpgme++/data.h>
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-struct EncryptJobPrivate : public JobPrivate
-{
- // used by start() functions
- QString m_fileName;
- GpgME::Data::Encoding m_inputEncoding;
-
- // used by startIt()
- std::vector<GpgME::Key> m_recipients;
- QString m_inputFilePath;
- QString m_outputFilePath;
- GpgME::Context::EncryptionFlags m_encryptionFlags = GpgME::Context::EncryptFile;
-};
-
-}
-
-#endif // __QGPGME_ENCRYPTJOB_P_H__
diff --git a/lang/qt/src/exportjob.h b/lang/qt/src/exportjob.h
deleted file mode 100644
index 91b5c90e..00000000
--- a/lang/qt/src/exportjob.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- exportjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_EXPORTJOB_H__
-#define __QGPGME_EXPORTJOB_H__
-
-#include "qgpgme_export.h"
-#include "job.h"
-
-#include <QtCore/QByteArray>
-#include <QtCore/QStringList>
-
-namespace GpgME
-{
-class Error;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous exporters
-
- To use a ExportJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the export with a call
- to start(). This call might fail, in which case the ExportJob
- instance will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the ExportJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT ExportJob : public Job
-{
- Q_OBJECT
-protected:
- explicit ExportJob(QObject *parent);
-public:
- ~ExportJob();
-
- /**
- Starts the export operation. \a patterns is a list of patterns
- used to restrict the list of keys exported. Empty patterns are
- ignored. If \a patterns is empty or contains only empty
- strings, all available keys are exported.
- */
- virtual GpgME::Error start(const QStringList &patterns) = 0;
-
- virtual void setExportFlags (unsigned int flags);
-
- /**
- * Starts the export operation synchronously, otherwise behaves identical to
- * ExportJob::start
- */
- virtual GpgME::Error exec(const QStringList &patterns, QByteArray &data);
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QByteArray &keyData, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __QGPGME_EXPORTJOB_H__
diff --git a/lang/qt/src/filelistdataprovider.cpp b/lang/qt/src/filelistdataprovider.cpp
deleted file mode 100644
index 004854ef..00000000
--- a/lang/qt/src/filelistdataprovider.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- filelistdataprovider.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "filelistdataprovider.h"
-
-#include "dataprovider.h"
-
-#include <QString>
-
-#include <gpgme++/error.h>
-
-#include <numeric>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-static QByteArray encodeFilenames(const std::vector<QString> &filenames)
-{
- QByteArray ret;
- if (filenames.empty()) {
- return ret;
- }
- // calculate and reserve the needed minimum size of the result
- const auto addSize = [](unsigned int n, const QString &s) { return n + s.size(); };
- const unsigned int minSize = filenames.size()
- + std::accumulate(filenames.cbegin(), filenames.cend(), 0u, addSize);
- ret.reserve(minSize);
- // pack the filenames into the byte array
- for (const auto &f : filenames) {
- if (!f.isEmpty()) {
- ret += f.toUtf8() + '\0';
- }
- }
- ret.chop(1); // remove the trailing nul
- return ret;
-}
-
-FileListDataProvider::FileListDataProvider(const std::vector<QString> &filenames)
- : mProvider{new QByteArrayDataProvider{encodeFilenames(filenames)}}
-{
-}
-
-FileListDataProvider::~FileListDataProvider() = default;
-
-ssize_t FileListDataProvider::read(void* buffer, size_t bufSize)
-{
- return mProvider->read(buffer, bufSize);
-}
-
-ssize_t FileListDataProvider::write(const void *, size_t)
-{
- Error::setSystemError(GPG_ERR_EBADF);
- return -1;
-}
-
-off_t FileListDataProvider::seek(off_t offset, int whence)
-{
- return mProvider->seek(offset, whence);
-}
-
-void FileListDataProvider::release()
-{
- mProvider->release();
-}
diff --git a/lang/qt/src/filelistdataprovider.h b/lang/qt/src/filelistdataprovider.h
deleted file mode 100644
index 60bb0548..00000000
--- a/lang/qt/src/filelistdataprovider.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- filelistdataprovider.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_FILELISTDATAPROVIDER_H__
-#define __QGPGME_FILELISTDATAPROVIDER_H__
-
-#include "qgpgme_export.h"
-
-#include <gpgme++/interfaces/dataprovider.h>
-
-#include <memory>
-#include <vector>
-
-class QString;
-
-namespace QGpgME
-{
-
-/**
- * This read-only data provider simplifies providing a nul-separated list of
- * UTF-8-encoded filenames, e.g. for creating signed or encrypted archives.
- */
-class QGPGME_EXPORT FileListDataProvider : public GpgME::DataProvider
-{
-public:
- explicit FileListDataProvider(const std::vector<QString> &filenames);
- ~FileListDataProvider() override;
-
-private:
- bool isSupported(Operation op) const override
- {
- return op != Operation::Write;
- }
- ssize_t read(void *buffer, size_t bufSize) override;
- ssize_t write(const void *buffer, size_t bufSize) override;
- off_t seek(off_t offset, int whence) override;
- void release() override;
-
-private:
- std::unique_ptr<GpgME::DataProvider> mProvider;
-};
-
-}
-
-#endif // __QGPGME_FILELISTDATAPROVIDER_H__
diff --git a/lang/qt/src/gpgcardjob.h b/lang/qt/src/gpgcardjob.h
deleted file mode 100644
index 3f1b2391..00000000
--- a/lang/qt/src/gpgcardjob.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- gpgcardjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2020 g10 Code 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 __KLEO_GPGCARDJOB_H__
-#define __KLEO_GPGCARDJOB_H__
-
-#include <QStringList>
-
-#include "job.h"
-
-namespace GpgME
-{
-class Error;
-}
-
-namespace QGpgME
-{
-
-class QGPGME_EXPORT GpgCardJob: public Job
-{
- Q_OBJECT
-protected:
- explicit GpgCardJob(QObject *parent);
-
-public:
- ~GpgCardJob();
-
- /**
- Starts the operation. \a cmds are the commands to
- execute.
- */
- virtual GpgME::Error start(const QStringList &cmds) = 0;
-
- virtual GpgME::Error exec(const QStringList &cmds, QString &std_out, QString &std_err, int &exitCode) = 0;
-
-Q_SIGNALS:
- /** The resulting stdout and stderr of gpgcard and the exitCode
- *
- * The auditlog params are always null / empty.
- */
- void result(const QString &std_out, const QString &std_err, int exitCode,
- const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-#endif
diff --git a/lang/qt/src/hierarchicalkeylistjob.h b/lang/qt/src/hierarchicalkeylistjob.h
deleted file mode 100644
index 431ff712..00000000
--- a/lang/qt/src/hierarchicalkeylistjob.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- hierarchicalkeylistjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_HIERARCHICALKEYLISTJOB_H__
-#define __KLEO_HIERARCHICALKEYLISTJOB_H__
-
-#include "qgpgme_export.h"
-#include "keylistjob.h"
-#include "cryptobackend.h"
-
-#include <gpgme++/keylistresult.h>
-
-#include <QPointer>
-
-#include <set>
-
-namespace GpgME
-{
-class Error;
-class Key;
-}
-
-namespace QGpgME
-{
-class KeyListJob;
-}
-
-namespace QGpgME
-{
-
-/**
- @short A convenience job that additionally fetches all available issuers.
-
- To use a HierarchicalKeyListJob, pass it a CryptoBackend
- implementation, connect the progress() and result() signals to
- suitable slots and then start the keylisting with a call to
- start(). This call might fail, in which case the
- HierarchicalKeyListJob instance will have scheduled it's own
- destruction with a call to QObject::deleteLater().
-
- After result() is emitted, the HierarchicalKeyListJob will
- schedule its own destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT HierarchicalKeyListJob : public KeyListJob
-{
- Q_OBJECT
-public:
- explicit HierarchicalKeyListJob(const Protocol *protocol,
- bool remote = false, bool includeSigs = false,
- bool validating = false);
- ~HierarchicalKeyListJob();
-
- /**
- Starts the keylist operation. \a patterns is a list of patterns
- used to restrict the list of keys returned. Empty patterns are
- ignored. \a patterns must not be empty or contain only empty
- patterns; use the normal KeyListJob for a full listing.
-
- The \a secretOnly parameter is ignored by
- HierarchicalKeyListJob and must be set to false.
- */
- GpgME::Error start(const QStringList &patterns, bool secretOnly = false) override;
-
- GpgME::KeyListResult exec(const QStringList &patterns, bool secretOnly,
- std::vector<GpgME::Key> &keys) override;
-
-private Q_SLOTS:
- void slotResult(const GpgME::KeyListResult &);
- void slotNextKey(const GpgME::Key &key);
- /* from Job */
- void slotCancel() override;
-
-private:
- GpgME::Error startAJob();
-
-private:
- const Protocol *const mProtocol;
- const bool mRemote;
- const bool mIncludeSigs;
- const bool mValidating;
- bool mTruncated;
- std::set<QString> mSentSet; // keys already sent (prevent duplicates even if the backend should return them)
- std::set<QString> mScheduledSet; // keys already scheduled (by starting a job for them)
- std::set<QString> mNextSet; // keys to schedule for the next iteraton
- GpgME::KeyListResult mIntermediateResult;
- QPointer<KeyListJob> mJob;
-};
-
-}
-
-#endif // __KLEO_HIERARCHICALKEYLISTJOB_H__
diff --git a/lang/qt/src/importfromkeyserverjob.h b/lang/qt/src/importfromkeyserverjob.h
deleted file mode 100644
index cc4a22da..00000000
--- a/lang/qt/src/importfromkeyserverjob.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- importfromkeyserverjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_IMPORTFROMKEYSERVERJOB_H__
-#define __KLEO_IMPORTFROMKEYSERVERJOB_H__
-
-#include "abstractimportjob.h"
-#include "qgpgme_export.h"
-
-namespace GpgME
-{
-class Key;
-class Error;
-class ImportResult;
-}
-
-#include <vector>
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous keyserver-importers
-
- To use a ImportJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the import with a call
- to start(). This call might fail, in which case the ImportJob
- instance will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the ImportJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT ImportFromKeyserverJob : public AbstractImportJob
-{
- Q_OBJECT
-protected:
- explicit ImportFromKeyserverJob(QObject *parent);
-public:
- ~ImportFromKeyserverJob();
-
- /**
- Starts the importing operation. \a keyData contains the data to
- import from.
- */
- virtual GpgME::Error start(const std::vector<GpgME::Key> &keys) = 0;
-
- virtual GpgME::ImportResult exec(const std::vector<GpgME::Key> &keys) = 0;
-};
-
-}
-
-#endif // __KLEO_IMPORTFROMKEYSERVERJOB_H__
diff --git a/lang/qt/src/importjob.cpp b/lang/qt/src/importjob.cpp
deleted file mode 100644
index f0ec63ca..00000000
--- a/lang/qt/src/importjob.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- importjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "importjob.h"
-#include "importjob_p.h"
-
-#include <gpgme++/context.h>
-
-using namespace GpgME;
-using namespace QGpgME;
-
-void QGpgME::ImportJob::setImportFilter(const QString &filter)
-{
- const auto d = jobPrivate<ImportJobPrivate>(this);
- d->m_importFilter = filter;
-}
-
-QString QGpgME::ImportJob::importFilter() const
-{
- const auto d = jobPrivate<ImportJobPrivate>(this);
- return d->m_importFilter;
-}
-
-void QGpgME::ImportJob::setImportOptions(const QStringList &options)
-{
- const auto d = jobPrivate<ImportJobPrivate>(this);
- d->m_importOptions = options;
-}
-
-QStringList QGpgME::ImportJob::importOptions() const
-{
- const auto d = jobPrivate<ImportJobPrivate>(this);
- return d->m_importOptions;
-}
-
-void ImportJob::setKeyOrigin(GpgME::Key::Origin origin, const QString &url)
-{
- const auto d = jobPrivate<ImportJobPrivate>(this);
- d->m_keyOrigin = origin;
- d->m_keyOriginUrl = url;
-}
-
-GpgME::Key::Origin ImportJob::keyOrigin() const
-{
- const auto d = jobPrivate<ImportJobPrivate>(this);
- return d->m_keyOrigin;
-}
-
-QString ImportJob::keyOriginUrl() const
-{
- const auto d = jobPrivate<ImportJobPrivate>(this);
- return d->m_keyOriginUrl;
-}
diff --git a/lang/qt/src/importjob.h b/lang/qt/src/importjob.h
deleted file mode 100644
index e92f7415..00000000
--- a/lang/qt/src/importjob.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- importjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 __KLEO_IMPORTJOB_H__
-#define __KLEO_IMPORTJOB_H__
-
-#include "abstractimportjob.h"
-#include "qgpgme_export.h"
-
-#include <gpgme++/key.h>
-
-namespace GpgME
-{
-class Error;
-class ImportResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous importers
-
- To use a ImportJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the import with a call
- to start(). This call might fail, in which case the ImportJob
- instance will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the ImportJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT ImportJob : public AbstractImportJob
-{
- Q_OBJECT
-protected:
- explicit ImportJob(QObject *parent);
-public:
- ~ImportJob() override;
-
- void setImportFilter(const QString &filter);
- QString importFilter() const;
-
- void setImportOptions(const QStringList &options);
- QStringList importOptions() const;
-
- void setKeyOrigin(GpgME::Key::Origin origin, const QString &url = {});
- GpgME::Key::Origin keyOrigin() const;
- QString keyOriginUrl() const;
-
- /**
- Starts the importing operation. \a keyData contains the data to
- import from.
- */
- virtual GpgME::Error start(const QByteArray &keyData) = 0;
-
- virtual GpgME::ImportResult exec(const QByteArray &keyData) = 0;
-
- virtual GpgME::Error startLater(const QByteArray &keyData) = 0;
-};
-
-}
-
-#endif // __KLEO_IMPORTJOB_H__
diff --git a/lang/qt/src/importjob_p.h b/lang/qt/src/importjob_p.h
deleted file mode 100644
index 7ee8f914..00000000
--- a/lang/qt/src/importjob_p.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- importjob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_IMPORTJOB_P_H__
-#define __QGPGME_IMPORTJOB_P_H__
-
-#include "job_p.h"
-
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-struct ImportJobPrivate : public JobPrivate
-{
- QString m_importFilter;
- QStringList m_importOptions;
- GpgME::Key::Origin m_keyOrigin = GpgME::Key::OriginUnknown;
- QString m_keyOriginUrl;
-};
-
-}
-
-#endif // __QGPGME_IMPORTJOB_P_H__
diff --git a/lang/qt/src/job.cpp b/lang/qt/src/job.cpp
deleted file mode 100644
index bbbca293..00000000
--- a/lang/qt/src/job.cpp
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- job.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2005 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "job.h"
-#include "job_p.h"
-
-#include "keylistjob.h"
-#include "listallkeysjob.h"
-#include "decryptjob.h"
-#include "signkeyjob.h"
-#include "keygenerationjob.h"
-#include "importjob.h"
-#include "importfromkeyserverjob.h"
-#include "exportjob.h"
-#include "changeexpiryjob.h"
-#include "changeownertrustjob.h"
-#include "changepasswdjob.h"
-#include "downloadjob.h"
-#include "deletejob.h"
-#include "refreshkeysjob.h"
-#include "addexistingsubkeyjob.h"
-#include "adduseridjob.h"
-#include "specialjob.h"
-#include "keyformailboxjob.h"
-#include "wkdlookupjob.h"
-#include "wkspublishjob.h"
-#include "tofupolicyjob.h"
-#include "threadedjobmixin.h"
-#include "gpgcardjob.h"
-#include "receivekeysjob.h"
-#include "revokekeyjob.h"
-#include "setprimaryuseridjob.h"
-
-#include <QCoreApplication>
-#include <QDebug>
-
-#include <gpg-error.h>
-
-#include <unordered_map>
-
-namespace
-{
-typedef std::unordered_map<const QGpgME::Job*, std::unique_ptr<QGpgME::JobPrivate>> JobPrivateHash;
-Q_GLOBAL_STATIC(JobPrivateHash, d_func)
-}
-
-void QGpgME::setJobPrivate(const Job *job, std::unique_ptr<JobPrivate> d)
-{
- auto &ref = d_func()->operator[](job);
- ref = std::move(d);
-}
-
-const QGpgME::JobPrivate *QGpgME::getJobPrivate(const Job *job)
-{
- return d_func()->operator[](job).get();
-}
-
-QGpgME::JobPrivate *QGpgME::getJobPrivate(Job *job)
-{
- return d_func()->operator[](job).get();
-}
-
-QGpgME::Job::Job(QObject *parent)
- : QObject(parent)
-{
- if (QCoreApplication *app = QCoreApplication::instance()) {
- connect(app, &QCoreApplication::aboutToQuit, this, &Job::slotCancel);
- }
-}
-
-QGpgME::Job::~Job()
-{
- ::d_func()->erase(this);
-}
-
-QString QGpgME::Job::auditLogAsHtml() const
-{
- qDebug() << "QGpgME::Job::auditLogAsHtml() should be reimplemented in Kleo::Job subclasses!";
- return QString();
-}
-
-GpgME::Error QGpgME::Job::auditLogError() const
-{
- qDebug() << "QGpgME::Job::auditLogError() should be reimplemented in Kleo::Job subclasses!";
- return GpgME::Error::fromCode(GPG_ERR_NOT_IMPLEMENTED);
-}
-
-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);
-}
-
-GpgME::Error QGpgME::Job::startIt()
-{
- auto d = getJobPrivate(this);
- Q_ASSERT(d && "This Job class has no JobPrivate class");
- return d->startIt();
-}
-
-void QGpgME::Job::startNow()
-{
- auto d = getJobPrivate(this);
- Q_ASSERT(d && "This Job class has no JobPrivate class");
- d->startNow();
-}
-
-#define make_job_subclass_ext(x,y) \
- QGpgME::x::x( QObject * parent ) : y( parent ) {} \
- QGpgME::x::~x() {}
-
-#define make_job_subclass(x) make_job_subclass_ext(x,Job)
-
-make_job_subclass(KeyListJob)
-make_job_subclass(ListAllKeysJob)
-make_job_subclass(DecryptJob)
-make_job_subclass(SignKeyJob)
-make_job_subclass(KeyGenerationJob)
-make_job_subclass(AbstractImportJob)
-make_job_subclass_ext(ImportJob, AbstractImportJob)
-make_job_subclass_ext(ImportFromKeyserverJob, AbstractImportJob)
-make_job_subclass_ext(ReceiveKeysJob, AbstractImportJob)
-make_job_subclass(ExportJob)
-make_job_subclass(ChangeExpiryJob)
-make_job_subclass(ChangeOwnerTrustJob)
-make_job_subclass(ChangePasswdJob)
-make_job_subclass(DownloadJob)
-make_job_subclass(DeleteJob)
-make_job_subclass(RefreshKeysJob)
-make_job_subclass(AddExistingSubkeyJob)
-make_job_subclass(AddUserIDJob)
-make_job_subclass(SpecialJob)
-make_job_subclass(KeyForMailboxJob)
-make_job_subclass(WKDLookupJob)
-make_job_subclass(WKSPublishJob)
-make_job_subclass(TofuPolicyJob)
-make_job_subclass(GpgCardJob)
-make_job_subclass(RevokeKeyJob)
-make_job_subclass(SetPrimaryUserIDJob)
-
-#undef make_job_subclass
-
-#include "job.moc"
-
-#include "keylistjob.moc"
-#include "listallkeysjob.moc"
-#include "decryptjob.moc"
-#include "signkeyjob.moc"
-#include "keygenerationjob.moc"
-#include "abstractimportjob.moc"
-#include "importjob.moc"
-#include "importfromkeyserverjob.moc"
-#include "exportjob.moc"
-#include "changeexpiryjob.moc"
-#include "changeownertrustjob.moc"
-#include "changepasswdjob.moc"
-#include "downloadjob.moc"
-#include "deletejob.moc"
-#include "refreshkeysjob.moc"
-#include "addexistingsubkeyjob.moc"
-#include "adduseridjob.moc"
-#include "specialjob.moc"
-#include "keyformailboxjob.moc"
-#include "wkdlookupjob.moc"
-#include "wkspublishjob.moc"
-#include "tofupolicyjob.moc"
-#include "gpgcardjob.moc"
-#include "receivekeysjob.moc"
-#include "revokekeyjob.moc"
-#include "setprimaryuseridjob.moc"
diff --git a/lang/qt/src/job.h b/lang/qt/src/job.h
deleted file mode 100644
index 56da33d7..00000000
--- a/lang/qt/src/job.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- job.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_JOB_H__
-#define __KLEO_JOB_H__
-
-#include "qgpgme_export.h"
-
-#include <QObject>
-#include <QString>
-#include <QMap>
-
-#include <gpgme++/error.h>
-
-class QWidget;
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous crypto operations
-
- During the operation, you might receive progress updates through
- the progress() signal as they arrive, but an implementation is
- free to not send progress information. You should show a busy
- progressbar until the first progress() signal is received.
-
- The done() signal is emitted _before_ the result() signals of
- subclasses and should be used to hide and/or reset progress bars,
- not to learn of the end of the operation. Use the result()
- signals for that.
-
- To cancel the operation, simply call slotCancel(). The result()
- signal of subclasses will still be emitted, though, and will
- carry the information that the operation was canceled.
-*/
-class QGPGME_EXPORT Job : public QObject
-{
- Q_OBJECT
-protected:
- explicit Job(QObject *parent);
-public:
- ~Job();
-
- virtual QString auditLogAsHtml() const;
- 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);
-
- /** Starts the job.
- *
- * Starts the job with the values set for the concrete job. If starting
- * the job failed then you are responsible for destroying it. Therefore,
- * it's recommended to store the job in a std::unique_ptr until it has
- * been started successfully.
- */
- GpgME::Error startIt();
-
- /** Starts a deferred job.
- *
- * The job needs to have been prepared for a deferred start by calling the
- * startLater() function instead of the start() function of a leaf class.
- */
- void startNow();
-
-public Q_SLOTS:
- virtual void slotCancel() = 0;
-
-Q_SIGNALS:
- /**
- * This signal is emitted whenever the backend sends a progress status
- * message. For most jobs, \a current is the amount of processed data
- * (or files) and \a total is the total amount of data (of files). If
- * \a total is 0, then the total amount is unknown or not yet known.
- * For GnuPG 2.1.13 and later, \a current and \a total do not exceed
- * 2^20, i.e. for larger values they are scaled down and you should not
- * assume that they represent absolute values.
- *
- * Check the documentation on progress in the GpgME manual for details.
- *
- * Note: Some jobs provide special progress signals, e.g. for file-count-
- * or data-based progress.
- */
- void jobProgress(int current, int total);
-
- /**
- * This signal is emitted whenever the backend sends a progress status
- * message. Compared to the jobProgress signal this signal also provides the
- * what value and the type value reported by the backend. Usually, these
- * values can safely be ignored, so that you are better off using the
- * simpler jobProgress signal.
- * Check the documentation on progress in the GpgME manual for details
- * on what and type.
- *
- * Note: Some jobs provide special progress signals, so that you do not
- * have to deal with what and type yourself.
- */
- void rawProgress(const QString &what, int type, int current, int total);
-
- QGPGME_DEPRECATED void progress(const QString &what, int current, int total);
-
- void done();
-};
-
-extern QMap <Job *, GpgME::Context *> g_context_map;
-}
-
-#endif // __KLEO_JOB_H__
diff --git a/lang/qt/src/job_p.h b/lang/qt/src/job_p.h
deleted file mode 100644
index 597b1a17..00000000
--- a/lang/qt/src/job_p.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- job_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_JOB_P_H__
-#define __QGPGME_JOB_P_H__
-
-#include "job.h"
-
-#include "qgpgme_debug.h"
-
-#include <memory>
-
-namespace QGpgME
-{
-
-// Base class for pimpl classes for Job subclasses
-class JobPrivate
-{
-public:
- virtual ~JobPrivate() {}
-
- virtual GpgME::Error startIt() = 0;
-
- virtual void startNow() = 0;
-};
-
-// Setter and getters for the externally stored pimpl instances of jobs
-// BCI: Add a real d-pointer to Job
-void setJobPrivate(const Job *job, std::unique_ptr<JobPrivate> d);
-
-const JobPrivate *getJobPrivate(const Job *job);
-
-JobPrivate *getJobPrivate(Job *job);
-
-template <typename T>
-static const T *jobPrivate(const Job *job) {
- auto d = getJobPrivate(job);
- return dynamic_cast<const T *>(d);
-}
-
-template <typename T>
-static T *jobPrivate(Job *job) {
- auto d = getJobPrivate(job);
- return dynamic_cast<T *>(d);
-}
-
-// Helper for the archive job classes
-template<class JobClass>
-void emitArchiveProgressSignals(JobClass *job, const QString &what, int type, int current, int total)
-{
- if (what != QLatin1String{"gpgtar"}) {
- return;
- }
- switch (type) {
- case 'c':
- Q_EMIT job->fileProgress(current, total);
- break;
- case 's':
- Q_EMIT job->dataProgress(current, total);
- break;
- default:
- qCDebug(QGPGME_LOG) << job << __func__ << "Received progress for gpgtar with unknown type" << char(type);
- };
-}
-
-}
-
-#endif // __QGPGME_JOB_P_H__
diff --git a/lang/qt/src/keyformailboxjob.h b/lang/qt/src/keyformailboxjob.h
deleted file mode 100644
index 33027c0c..00000000
--- a/lang/qt/src/keyformailboxjob.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- keyformailboxjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_KEYFORMAILBOX_H__
-#define __KLEO_KEYFORMAILBOX_H__
-
-#include <QString>
-
-#include "job.h"
-
-#include <gpgme++/key.h>
-
-namespace GpgME
-{
-class Error;
-class KeyListResult;
-}
-
-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
- 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 job will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT KeyForMailboxJob: public Job
-{
- Q_OBJECT
-protected:
- explicit KeyForMailboxJob(QObject *parent);
-
-public:
- ~KeyForMailboxJob();
-
- /**
- Starts the operation. \a mailbox is the mailbox to
- look for.
-
- The result is the same as for the LocateKeysJob.
-
- If \a canEncrypt is true, only keys that have a subkey for encryption
- usage are returned. Use this if you need to select a
- key for signing.
- */
- virtual GpgME::Error start(const QString &mailbox, bool canEncrypt = true) = 0;
-
- virtual GpgME::KeyListResult exec(const QString &mailbox, bool canEncrypt, GpgME::Key &key, GpgME::UserID &uid) = 0;
-
-Q_SIGNALS:
- /** The result. \a Key is the key found or a Null key.
- *
- * The userid is the uid where the mailbox matches.
- *
- * The auditlog params are always null / empty.
- */
- void result(const GpgME::KeyListResult &result, const GpgME::Key &key, const GpgME::UserID &uid, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-#endif
diff --git a/lang/qt/src/keygenerationjob.h b/lang/qt/src/keygenerationjob.h
deleted file mode 100644
index 04b97d9f..00000000
--- a/lang/qt/src/keygenerationjob.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- keygenerationjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_KEYGENERATIONJOB_H__
-#define __KLEO_KEYGENERATIONJOB_H__
-
-#include "job.h"
-#include "qgpgme_export.h"
-
-#include <QtCore/QByteArray>
-
-namespace GpgME
-{
-class Error;
-class KeyGenerationResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous key generation
-
- To use a KeyGenerationJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the key generation with
- a call to start(). This call might fail, in which case the
- KeyGenerationJob instance will have scheduled it's own
- destruction with a call to QObject::deleteLater().
-
- After result() is emitted, the KeyGenerationJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT KeyGenerationJob : public Job
-{
- Q_OBJECT
-protected:
- explicit KeyGenerationJob(QObject *parent);
-public:
- ~KeyGenerationJob();
-
- /**
- Starts the key generation operation. \a parameters is a
- backend-specific string containing the parameters of the key to
- create (length, capabilities, etc).
- */
- virtual GpgME::Error start(const QString &parameters) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::KeyGenerationResult &result, const QByteArray &pubKeyData, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_KEYGENERATIONJOB_H__
diff --git a/lang/qt/src/keylistjob.h b/lang/qt/src/keylistjob.h
deleted file mode 100644
index 7a4bd712..00000000
--- a/lang/qt/src/keylistjob.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- keylistjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_KEYLISTJOB_H__
-#define __KLEO_KEYLISTJOB_H__
-
-#include "job.h"
-#include "qgpgme_export.h"
-
-#include <gpgme++/key.h>
-
-#include <QtCore/QStringList>
-
-#include <vector>
-
-namespace GpgME
-{
-class Error;
-class KeyListResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous key listers
-
- To use a KeyListJob, first obtain an instance from the
- 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 scheduled it's own
- destruction with a call to QObject::deleteLater().
-
- During keylisting, you will receive new key objects through the
- nextKey() signal as they arrive. After result() is emitted, the
- KeyListJob will schedule it's own destruction by calling
- QObject::deleteLater().
-*/
-class QGPGME_EXPORT KeyListJob : public Job
-{
- Q_OBJECT
-protected:
- explicit KeyListJob(QObject *parent);
-
-public:
- ~KeyListJob();
-
- /**
- Starts the keylist 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).
-
- 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.
- */
- virtual GpgME::Error start(const QStringList &patterns, bool secretOnly = false) = 0;
-
- virtual GpgME::KeyListResult exec(const QStringList &patterns, bool secretOnly, std::vector<GpgME::Key> &keys) = 0;
-
- /** Add a flag to the keylistmode used. */
- virtual void addMode(GpgME::KeyListMode mode) = 0;
-
-Q_SIGNALS:
- void nextKey(const GpgME::Key &key);
- void result(const GpgME::KeyListResult &result, const std::vector<GpgME::Key> &keys = std::vector<GpgME::Key>(), const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_KEYLISTJOB_H__
diff --git a/lang/qt/src/listallkeysjob.cpp b/lang/qt/src/listallkeysjob.cpp
deleted file mode 100644
index 1dce75bf..00000000
--- a/lang/qt/src/listallkeysjob.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- listallkeysjob.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 <[email protected]>
-
- 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 "listallkeysjob.h"
-#include "listallkeysjob_p.h"
-
-using namespace QGpgME;
-
-void ListAllKeysJob::setOptions(ListAllKeysJob::Options options)
-{
- auto d = jobPrivate<ListAllKeysJobPrivate>(this);
- d->m_options = options;
-}
-
-ListAllKeysJob::Options ListAllKeysJob::options() const
-{
- auto d = jobPrivate<ListAllKeysJobPrivate>(this);
- return d->m_options;
-}
diff --git a/lang/qt/src/listallkeysjob.h b/lang/qt/src/listallkeysjob.h
deleted file mode 100644
index fa2f53a9..00000000
--- a/lang/qt/src/listallkeysjob.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- listallkeysjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 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 <[email protected]>
-
- 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 __KLEO_LISTALLKEYSJOB_H__
-#define __KLEO_LISTALLKEYSJOB_H__
-
-#include "job.h"
-#include "qgpgme_export.h"
-
-#include <gpgme++/key.h>
-
-#include <vector>
-
-namespace GpgME
-{
-class Error;
-class KeyListResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronously listing all keys
-
- To use a ListAllKeysJob, first obtain an instance from the
- CryptoBackend implementation, connect the 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 ListAllKeysJob instance will have schedules it's own
- destruction with a call to QObject::deleteLater().
-
- After result() is emitted, the ListAllKeysJob will schedule it's
- own destruction by calling QObject::deleteLater().
-
- This is potentially much faster than a KeyListJob with empty
- pattern.
-*/
-class QGPGME_EXPORT ListAllKeysJob : public Job
-{
- Q_OBJECT
-public:
- enum Option {
- Default = 0x00,
- DisableAutomaticTrustDatabaseCheck = 0x01,
- };
- Q_DECLARE_FLAGS(Options, Option)
-
-protected:
- explicit ListAllKeysJob(QObject *parent);
-
-public:
- ~ListAllKeysJob();
-
- void setOptions(Options options);
- Options options() const;
-
- /**
- Starts the listallkeys operation. In general, 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
- result object).
-
- If GnuPG 2.1 or later is used, then \a mergeKeys is ignored. Otherwise,
- if \a mergeKeys is true, then some (but not all) information of the
- secret keys is merged into public keys.
- */
- virtual GpgME::Error start(bool mergeKeys = false) = 0;
-
- /**
- Synchronous version of start().
- */
- virtual GpgME::KeyListResult exec(std::vector<GpgME::Key> &pub, std::vector<GpgME::Key> &sec, bool mergeKeys = false) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::KeyListResult &result, const std::vector<GpgME::Key> &pub = std::vector<GpgME::Key>(), const std::vector<GpgME::Key> &sec = std::vector<GpgME::Key>(), const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(ListAllKeysJob::Options)
-
-}
-
-#endif // __KLEO_LISTALLKEYSJOB_H__
diff --git a/lang/qt/src/listallkeysjob_p.h b/lang/qt/src/listallkeysjob_p.h
deleted file mode 100644
index 582f028b..00000000
--- a/lang/qt/src/listallkeysjob_p.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- listallkeysjob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_LISTALLKEYSJOB_P_H__
-#define __QGPGME_LISTALLKEYSJOB_P_H__
-
-#include "job_p.h"
-
-#include "listallkeysjob.h"
-
-namespace QGpgME
-{
-
-struct ListAllKeysJobPrivate : public JobPrivate
-{
- ListAllKeysJob::Options m_options = ListAllKeysJob::Default;
-};
-
-}
-
-#endif // __QGPGME_LISTALLKEYSJOB_P_H__
diff --git a/lang/qt/src/multideletejob.cpp b/lang/qt/src/multideletejob.cpp
deleted file mode 100644
index 1c1e15d0..00000000
--- a/lang/qt/src/multideletejob.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- multideletejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "multideletejob.h"
-#include "protocol.h"
-#include "deletejob.h"
-
-#include <gpgme++/key.h>
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-
-#include <iterator>
-
-#include <assert.h>
-
-QGpgME::MultiDeleteJob::MultiDeleteJob(const Protocol *protocol)
- : Job(nullptr),
- mProtocol(protocol),
- mJob(nullptr)
-{
- assert(protocol);
-}
-
-QGpgME::MultiDeleteJob::~MultiDeleteJob()
-{
-
-}
-
-GpgME::Error QGpgME::MultiDeleteJob::start(const std::vector<GpgME::Key> &keys, bool allowSecretKeyDeletion)
-{
- mKeys = keys;
- mAllowSecretKeyDeletion = allowSecretKeyDeletion;
- mIt = mKeys.begin();
-
- const GpgME::Error err = startAJob();
-
- if (err) {
- deleteLater();
- }
- return err;
-}
-
-void QGpgME::MultiDeleteJob::slotCancel()
-{
- if (mJob) {
- mJob->slotCancel();
- }
- mIt = mKeys.end();
-}
-
-void QGpgME::MultiDeleteJob::slotResult(const GpgME::Error &err)
-{
- mJob = nullptr;
- GpgME::Error error = err;
- if (error || // error in last op
- mIt == mKeys.end() || // (shouldn't happen)
- ++mIt == mKeys.end() || // was the last key
- (error = startAJob())) { // error starting the job for the new key
- Q_EMIT done();
- Q_EMIT result(error, error && mIt != mKeys.end() ? *mIt : GpgME::Key::null);
- deleteLater();
- return;
- }
-
- const int current = mIt - mKeys.begin();
- const int total = mKeys.size();
- const QString what = QStringLiteral("%1/%2").arg(current).arg(total);
- Q_EMIT jobProgress(current, total);
- Q_EMIT rawProgress(what, '?', current, total);
- QT_WARNING_PUSH
- QT_WARNING_DISABLE_DEPRECATED
- Q_EMIT progress(what, current, total);
- QT_WARNING_POP
-}
-
-GpgME::Error QGpgME::MultiDeleteJob::startAJob()
-{
- if (mIt == mKeys.end()) {
- return GpgME::Error(0);
- }
- mJob = mProtocol->deleteJob();
- assert(mJob); // FIXME: we need a way to generate errors ourselves,
- // but I don't like the dependency on gpg-error :/
-
- connect(mJob.data(), &DeleteJob::result, this, &MultiDeleteJob::slotResult);
-
- return mJob->start(*mIt, mAllowSecretKeyDeletion);
-}
-
-#include "multideletejob.moc"
diff --git a/lang/qt/src/multideletejob.h b/lang/qt/src/multideletejob.h
deleted file mode 100644
index 308490fa..00000000
--- a/lang/qt/src/multideletejob.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- multideletejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_MULTIDELETEJOB_H__
-#define __KLEO_MULTIDELETEJOB_H__
-
-#include "qgpgme_export.h"
-#include "job.h"
-#include "protocol.h"
-
-#include <QPointer>
-
-#include <vector>
-
-namespace GpgME
-{
-class Error;
-class Key;
-}
-
-namespace QGpgME
-{
-class DeleteJob;
-}
-
-namespace QGpgME
-{
-
-/**
- @short A convenience class bundling together multiple DeleteJobs.
-
- To use a MultiDeleteJob, pass it a CryptoBackend implementation,
- connect the progress() and result() signals to suitable slots and
- then start the delete with a call to start(). This call might
- fail, in which case the MultiDeleteJob instance will have scheduled
- it's own destruction with a call to QObject::deleteLater().
-
- After result() is emitted, the MultiDeleteJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT MultiDeleteJob : public Job
-{
- Q_OBJECT
-public:
- explicit MultiDeleteJob(const Protocol *protocol);
- ~MultiDeleteJob();
-
- /**
- Starts the delete operation. \a keys is the list of keys to
- delete, \a allowSecretKeyDeletion specifies if a key may also
- be deleted if the secret key part is available, too.
- */
- GpgME::Error start(const std::vector<GpgME::Key> &keys, bool allowSecretKeyDeletion = false);
-
- /* from Job */
- void slotCancel() override;
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const GpgME::Key &errorKey);
-
-private Q_SLOTS:
- void slotResult(const GpgME::Error &);
-
-private:
- GpgME::Error startAJob();
-
-private:
- const Protocol *mProtocol;
- QPointer<DeleteJob> mJob;
- std::vector<GpgME::Key> mKeys;
- std::vector<GpgME::Key>::const_iterator mIt;
- bool mAllowSecretKeyDeletion;
-};
-
-}
-
-#endif // __KLEO_MULTIDELETEJOB_H__
diff --git a/lang/qt/src/protocol.h b/lang/qt/src/protocol.h
deleted file mode 100644
index 74fb921d..00000000
--- a/lang/qt/src/protocol.h
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- protocol.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2005 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_PROTOCOL_H__
-#define __QGPGME_PROTOCOL_H__
-
-#include <QString>
-#include <QVariant>
-
-#include "qgpgme_export.h"
-
-namespace QGpgME {
-class AddExistingSubkeyJob;
-class CryptoConfig;
-class KeyListJob;
-class ListAllKeysJob;
-class KeyGenerationJob;
-class ImportJob;
-class ImportFromKeyserverJob;
-class ExportJob;
-class DownloadJob;
-class DeleteJob;
-class EncryptArchiveJob;
-class EncryptJob;
-class DecryptJob;
-class SignArchiveJob;
-class SignEncryptArchiveJob;
-class SignJob;
-class SignKeyJob;
-class VerifyDetachedJob;
-class VerifyOpaqueJob;
-class SignEncryptJob;
-class DecryptVerifyArchiveJob;
-class DecryptVerifyJob;
-class RefreshKeysJob;
-class ChangeExpiryJob;
-class ChangeOwnerTrustJob;
-class ChangePasswdJob;
-class AddUserIDJob;
-class SpecialJob;
-class KeyForMailboxJob;
-class WKDLookupJob;
-class WKSPublishJob;
-class TofuPolicyJob;
-class QuickJob;
-class GpgCardJob;
-class ReceiveKeysJob;
-class RevokeKeyJob;
-class SetPrimaryUserIDJob;
-class WKDRefreshJob;
-
-/** The main entry point for QGpgME Comes in OpenPGP and SMIME(CMS) flavors.
- *
- * Use the proctocol class to obtain an instance of a job. Jobs
- * provide async API for GnuPG that can be connected to signals / slots.
- *
- * A job is usually started with start() and emits a result signal.
- * The parameters of the result signal depend on the job but the last
- * two are always a QString for the auditlog and an GpgME::Error for
- * an eventual error.
- *
- * In case async API is used and the result signal is emitted a
- * job schedules its own deletion.
- *
- * Most jobs also provide a synchronous call exec in which case
- * you have to explicitly delete the job if you don't need it anymore.
- *
- * \code
- * // Async example:
- * KeyListJob *job = openpgp()->keyListJob();
- * connect(job, &KeyListJob::result, job, [this, job](KeyListResult, std::vector<Key> keys, QString, Error)
- * {
- * // keys and resuls can now be used.
- * });
- * job->start({QStringLiteral("[email protected]")}, false);
- * \endcode
- *
- * \code
- * // Sync eaxmple:
- * KeyListJob *job = openpgp()->keyListJob(false, false, false);
- * std::vector<GpgME::Key> keys;
- * GpgME::KeyListResult result = job->exec(QStringList() <<
- * QStringLiteral("[email protected]"),
- * false, keys);
- * delete job;
- * \endcode
- */
-class QGPGME_EXPORT Protocol
-{
-public:
- virtual ~Protocol() {}
-
- virtual QString name() const = 0;
-
- virtual QString displayName() const = 0;
-
- virtual KeyListJob *keyListJob(bool remote = false, bool includeSigs = false, bool validate = false) const = 0;
- virtual ListAllKeysJob *listAllKeysJob(bool includeSigs = false, bool validate = false) const = 0;
- virtual EncryptJob *encryptJob(bool armor = false, bool textmode = false) const = 0;
- virtual DecryptJob *decryptJob() const = 0;
- virtual SignJob *signJob(bool armor = false, bool textMode = false) const = 0;
- virtual VerifyDetachedJob *verifyDetachedJob(bool textmode = false) const = 0;
- virtual VerifyOpaqueJob *verifyOpaqueJob(bool textmode = false) const = 0;
- virtual KeyGenerationJob *keyGenerationJob() const = 0;
- virtual ImportJob *importJob() const = 0;
- virtual ImportFromKeyserverJob *importFromKeyserverJob() const = 0;
- virtual ExportJob *publicKeyExportJob(bool armor = false) const = 0;
- // the second parameter is ignored; the passphrase in the exported file is always utf-8 encoded
- virtual ExportJob *secretKeyExportJob(bool armor = false, const QString & = QString()) const = 0;
- virtual DownloadJob *downloadJob(bool armor = false) const = 0;
- 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;
- virtual ChangePasswdJob *changePasswdJob() const = 0;
- virtual ChangeOwnerTrustJob *changeOwnerTrustJob() const = 0;
- virtual AddUserIDJob *addUserIDJob() const = 0;
- virtual SpecialJob *specialJob(const char *type, const QMap<QString, QVariant> &args) const = 0;
-
- /** A key locate job.
- *
- * This tries to find a key in local
- * and remote sources, if the key was remote it is imported
- * by GnuPG. Same as KeyListJob but intended to be used
- * to locate keys automatically. This ends up calling --locate-keys.
- *
- * Only available for OpenPGP
- *
- * Results are validated. As if keyListJob was called
- * with both includeSigs and validate options.
- */
- virtual KeyListJob *locateKeysJob() const = 0;
- /** Find the best key to use for a mailbox. */
- virtual KeyForMailboxJob *keyForMailboxJob() const = 0;
-
- /** A Job for interacting with gnupg's wks tools. */
- virtual WKSPublishJob *wksPublishJob() const = 0;
-
- /** A Job to set tofu policy */
- virtual TofuPolicyJob *tofuPolicyJob() const = 0;
-
- /** A Job for the quick commands */
- virtual QuickJob *quickJob() const = 0;
-
- /** This job looks up a key via WKD without importing it. */
- virtual WKDLookupJob *wkdLookupJob() const = 0;
-
- 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;
-
- virtual EncryptArchiveJob *encryptArchiveJob(bool armor = false) const = 0;
- virtual SignArchiveJob *signArchiveJob(bool armor = false) const = 0;
- virtual SignEncryptArchiveJob *signEncryptArchiveJob(bool armor = false) const = 0;
- virtual DecryptVerifyArchiveJob *decryptVerifyArchiveJob() const = 0;
-
- virtual WKDRefreshJob *wkdRefreshJob() const = 0;
-};
-
-/** Obtain a reference to the OpenPGP Protocol.
- *
- * The reference is to a static object.
- * @returns Reference to the OpenPGP Protocol.
- */
-QGPGME_EXPORT Protocol *openpgp();
-
-/** Obtain a reference to the smime Protocol.
- *
- * The reference is to a static object.
- * @returns Reference to the smime Protocol.
- */
-QGPGME_EXPORT Protocol *smime();
-
-/** Obtain a reference to a cryptoConfig object.
- *
- * The reference is to a static object.
- * @returns reference to cryptoConfig object.
- */
-QGPGME_EXPORT CryptoConfig *cryptoConfig();
-
-/** Obtain a reference to a protocol agnostic GpgCardJob.
- *
- * The reference is to a static object.
- * @returns reference to a GpgCardJob following the job pattern.
- */
-QGPGME_EXPORT GpgCardJob *gpgCardJob();
-
-}
-#endif
diff --git a/lang/qt/src/protocol_p.h b/lang/qt/src/protocol_p.h
deleted file mode 100644
index b34b7a37..00000000
--- a/lang/qt/src/protocol_p.h
+++ /dev/null
@@ -1,575 +0,0 @@
-/*
- protocol_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2005 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2022 by g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_PROTOCOL_P_H__
-#define __QGPGME_PROTOCOL_P_H__
-#include "qgpgmenewcryptoconfig.h"
-
-#include "qgpgmekeygenerationjob.h"
-#include "qgpgmekeylistjob.h"
-#include "qgpgmelistallkeysjob.h"
-#include "qgpgmedecryptjob.h"
-#include "qgpgmedecryptverifyarchivejob.h"
-#include "qgpgmedecryptverifyjob.h"
-#include "qgpgmerefreshsmimekeysjob.h"
-#include "qgpgmedeletejob.h"
-#include "qgpgmedownloadjob.h"
-#include "qgpgmesignencryptjob.h"
-#include "qgpgmeencryptarchivejob.h"
-#include "qgpgmeencryptjob.h"
-#include "qgpgmesignarchivejob.h"
-#include "qgpgmesignencryptarchivejob.h"
-#include "qgpgmesignjob.h"
-#include "qgpgmesignkeyjob.h"
-#include "qgpgmeexportjob.h"
-#include "qgpgmeverifydetachedjob.h"
-#include "qgpgmeimportjob.h"
-#include "qgpgmeimportfromkeyserverjob.h"
-#include "qgpgmeverifyopaquejob.h"
-#include "qgpgmechangeexpiryjob.h"
-#include "qgpgmechangeownertrustjob.h"
-#include "qgpgmechangepasswdjob.h"
-#include "qgpgmeaddexistingsubkeyjob.h"
-#include "qgpgmeadduseridjob.h"
-#include "qgpgmekeyformailboxjob.h"
-#include "qgpgmewkdlookupjob.h"
-#include "qgpgmewkspublishjob.h"
-#include "qgpgmetofupolicyjob.h"
-#include "qgpgmequickjob.h"
-#include "qgpgmereceivekeysjob.h"
-#include "qgpgmerevokekeyjob.h"
-#include "qgpgmesetprimaryuseridjob.h"
-#include "qgpgmewkdrefreshjob.h"
-
-namespace
-{
-
-class Protocol : public QGpgME::Protocol
-{
- GpgME::Protocol mProtocol;
-public:
- explicit Protocol(GpgME::Protocol proto) : mProtocol(proto) {}
-
- QString name() const override
- {
- switch (mProtocol) {
- case GpgME::OpenPGP: return QStringLiteral("OpenPGP");
- case GpgME::CMS: return QStringLiteral("SMIME");
- default: return QString();
- }
- }
-
- QString displayName() const override
- {
- // ah (2.4.16): Where is this used and isn't this inverted
- // with name
- switch (mProtocol) {
- case GpgME::OpenPGP: return QStringLiteral("gpg");
- case GpgME::CMS: return QStringLiteral("gpgsm");
- default: return QStringLiteral("unknown");
- }
- }
-
- QGpgME::SpecialJob *specialJob(const char *, const QMap<QString, QVariant> &) const override
- {
- return nullptr;
- }
-
- QGpgME::KeyListJob *keyListJob(bool remote, bool includeSigs, bool validate) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- unsigned int mode = context->keyListMode();
- if (remote) {
- mode |= GpgME::Extern;
- mode &= ~GpgME::Local;
- } else {
- mode |= GpgME::Local;
- mode &= ~GpgME::Extern;
- }
- if (includeSigs) {
- mode |= GpgME::Signatures;
- }
- if (validate) {
- mode |= GpgME::Validate;
- }
- context->setKeyListMode(mode);
- return new QGpgME::QGpgMEKeyListJob(context);
- }
-
- QGpgME::ListAllKeysJob *listAllKeysJob(bool includeSigs, bool validate) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- unsigned int mode = context->keyListMode();
- mode |= GpgME::Local;
- mode &= ~GpgME::Extern;
- if (includeSigs) {
- mode |= GpgME::Signatures;
- }
- if (validate) {
- mode |= GpgME::Validate;
- /* Setting the context to offline mode disables CRL / OCSP checks in
- this Job. Otherwise we would try to fetch the CRL's for all CMS
- keys in the users keyring because GpgME::Validate includes remote
- resources by default in the validity check.
- This setting only has any effect if gpgsm >= 2.1.6 is used.
- */
- context->setOffline(true);
- }
- context->setKeyListMode(mode);
- return new QGpgME::QGpgMEListAllKeysJob(context);
- }
-
- QGpgME::EncryptJob *encryptJob(bool armor, bool textmode) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- context->setArmor(armor);
- context->setTextMode(textmode);
- return new QGpgME::QGpgMEEncryptJob(context);
- }
-
- QGpgME::DecryptJob *decryptJob() const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEDecryptJob(context);
- }
-
- QGpgME::SignJob *signJob(bool armor, bool textMode) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- context->setArmor(armor);
- context->setTextMode(textMode);
- return new QGpgME::QGpgMESignJob(context);
- }
-
- QGpgME::VerifyDetachedJob *verifyDetachedJob(bool textMode) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- context->setTextMode(textMode);
- return new QGpgME::QGpgMEVerifyDetachedJob(context);
- }
-
- QGpgME::VerifyOpaqueJob *verifyOpaqueJob(bool textMode) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- context->setTextMode(textMode);
- return new QGpgME::QGpgMEVerifyOpaqueJob(context);
- }
-
- QGpgME::KeyGenerationJob *keyGenerationJob() const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEKeyGenerationJob(context);
- }
-
- QGpgME::ImportJob *importJob() const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEImportJob(context);
- }
-
- QGpgME::ImportFromKeyserverJob *importFromKeyserverJob() const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEImportFromKeyserverJob(context);
- }
-
- QGpgME::ReceiveKeysJob *receiveKeysJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
-
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEReceiveKeysJob{context};
- }
-
- QGpgME::ExportJob *publicKeyExportJob(bool armor) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- context->setArmor(armor);
- return new QGpgME::QGpgMEExportJob(context);
- }
-
- QGpgME::ExportJob *secretKeyExportJob(bool armor, const QString &) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- context->setArmor(armor);
- return new QGpgME::QGpgMEExportJob(context, GpgME::Context::ExportSecret);
- }
-
- QGpgME::ExportJob *secretSubkeyExportJob(bool armor) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- context->setArmor(armor);
- return new QGpgME::QGpgMEExportJob(context, GpgME::Context::ExportSecretSubkey);
- }
-
- QGpgME::RefreshKeysJob *refreshKeysJob() const override
- {
- if (mProtocol != GpgME::CMS) {
- return nullptr;
- }
-
- return new QGpgME::QGpgMERefreshSMIMEKeysJob;
- }
-
- QGpgME::DownloadJob *downloadJob(bool armor) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- context->setArmor(armor);
- // this is the hackish interface for downloading from keyserers currently:
- context->setKeyListMode(GpgME::Extern);
- return new QGpgME::QGpgMEDownloadJob(context);
- }
-
- QGpgME::DeleteJob *deleteJob() const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEDeleteJob(context);
- }
-
- QGpgME::SignEncryptJob *signEncryptJob(bool armor, bool textMode) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- context->setArmor(armor);
- context->setTextMode(textMode);
- return new QGpgME::QGpgMESignEncryptJob(context);
- }
-
- QGpgME::DecryptVerifyJob *decryptVerifyJob(bool textMode) const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
-
- context->setTextMode(textMode);
- return new QGpgME::QGpgMEDecryptVerifyJob(context);
- }
-
- QGpgME::ChangeExpiryJob *changeExpiryJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr; // only supported by gpg
- }
-
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEChangeExpiryJob(context);
- }
-
- QGpgME::ChangePasswdJob *changePasswdJob() const override
- {
- if (!GpgME::hasFeature(GpgME::PasswdFeature, 0)) {
- return nullptr;
- }
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEChangePasswdJob(context);
- }
-
- QGpgME::SignKeyJob *signKeyJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr; // only supported by gpg
- }
-
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMESignKeyJob(context);
- }
-
- QGpgME::ChangeOwnerTrustJob *changeOwnerTrustJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr; // only supported by gpg
- }
-
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEChangeOwnerTrustJob(context);
- }
-
- QGpgME:: AddExistingSubkeyJob *addExistingSubkeyJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr; // only supported by gpg
- }
-
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEAddExistingSubkeyJob{context};
- }
-
- QGpgME::AddUserIDJob *addUserIDJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr; // only supported by gpg
- }
-
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEAddUserIDJob(context);
- }
-
- QGpgME::KeyListJob *locateKeysJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- context->setKeyListMode(GpgME::Locate | GpgME::Signatures | GpgME::Validate);
- return new QGpgME::QGpgMEKeyListJob(context);
- }
-
- QGpgME::KeyForMailboxJob *keyForMailboxJob() const override
- {
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEKeyForMailboxJob(context);
- }
-
- QGpgME::WKDLookupJob *wkdLookupJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- auto context = GpgME::Context::createForEngine(GpgME::AssuanEngine);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEWKDLookupJob(context.release());
- }
-
- QGpgME::WKSPublishJob *wksPublishJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- auto context = GpgME::Context::createForEngine(GpgME::SpawnEngine);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEWKSPublishJob(context.release());
- }
-
- QGpgME::TofuPolicyJob *tofuPolicyJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMETofuPolicyJob(context);
- }
-
- QGpgME::QuickJob *quickJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
- if (!context) {
- return nullptr;
- }
- return new QGpgME::QGpgMEQuickJob(context);
- }
-
- QGpgME::RevokeKeyJob *revokeKeyJob() const 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};
- }
-
- QGpgME::EncryptArchiveJob *encryptArchiveJob(bool armor) const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- if (auto context = GpgME::Context::createForProtocol(mProtocol)) {
- context->setArmor(armor);
- return new QGpgME::QGpgMEEncryptArchiveJob{context};
- }
- return nullptr;
- }
-
- QGpgME::SignArchiveJob *signArchiveJob(bool armor) const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- if (auto context = GpgME::Context::createForProtocol(mProtocol)) {
- context->setArmor(armor);
- return new QGpgME::QGpgMESignArchiveJob{context};
- }
- return nullptr;
- }
-
- QGpgME::SignEncryptArchiveJob *signEncryptArchiveJob(bool armor) const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- if (auto context = GpgME::Context::createForProtocol(mProtocol)) {
- context->setArmor(armor);
- return new QGpgME::QGpgMESignEncryptArchiveJob{context};
- }
- return nullptr;
- }
-
- QGpgME::DecryptVerifyArchiveJob *decryptVerifyArchiveJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- if (auto context = GpgME::Context::createForProtocol(mProtocol)) {
- return new QGpgME::QGpgMEDecryptVerifyArchiveJob{context};
- }
- return nullptr;
- }
-
- QGpgME::WKDRefreshJob *wkdRefreshJob() const override
- {
- if (mProtocol != GpgME::OpenPGP) {
- return nullptr;
- }
- if (auto context = GpgME::Context::createForProtocol(mProtocol)) {
- return new QGpgME::QGpgMEWKDRefreshJob{context};
- }
- return nullptr;
- }
-};
-
-}
-#endif
diff --git a/lang/qt/src/qgpgme_debug.cpp b/lang/qt/src/qgpgme_debug.cpp
deleted file mode 100644
index 513a9b08..00000000
--- a/lang/qt/src/qgpgme_debug.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgme_debug.h"
-
-
-#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
-Q_LOGGING_CATEGORY(QGPGME_LOG, "gpg.qgpgme", QtWarningMsg)
-Q_LOGGING_CATEGORY(QGPGME_CONFIG_LOADING_LOG, "gpg.qgpgme.config_loading", QtInfoMsg)
-#else
-Q_LOGGING_CATEGORY(QGPGME_LOG, "gpg.qgpgme")
-Q_LOGGING_CATEGORY(QGPGME_CONFIG_LOADING_LOG, "gpg.qgpgme.config_loading")
-#endif
diff --git a/lang/qt/src/qgpgme_debug.h b/lang/qt/src/qgpgme_debug.h
deleted file mode 100644
index 9cdd1a8c..00000000
--- a/lang/qt/src/qgpgme_debug.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef QGPGME_QGPGME_DEBUG_H
-#define QGPGME_QGPGME_DEBUG_H
-
-#include <QLoggingCategory>
-
-Q_DECLARE_LOGGING_CATEGORY(QGPGME_LOG)
-Q_DECLARE_LOGGING_CATEGORY(QGPGME_CONFIG_LOADING_LOG)
-
-
-#endif
diff --git a/lang/qt/src/qgpgme_export.h b/lang/qt/src/qgpgme_export.h
deleted file mode 100644
index 72927fe3..00000000
--- a/lang/qt/src/qgpgme_export.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* qgpgme_export.h - Export macros for qgpgme
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_EXPORT_H
-#define QGPGME_EXPORT_H
-
-#ifdef QGPGME_STATIC_DEFINE
-# define QGPGME_EXPORT
-# define QGPGME_NO_EXPORT
-#else
-# ifndef QGPGME_EXPORT
-# ifdef BUILDING_QGPGME
- /* We are building this library */
-# ifdef WIN32
-# define QGPGME_EXPORT __declspec(dllexport)
-# else
-# define QGPGME_EXPORT __attribute__((visibility("default")))
-# endif
-# else
- /* We are using this library */
-# ifdef WIN32
-# define QGPGME_EXPORT __declspec(dllimport)
-# else
-# define QGPGME_EXPORT __attribute__((visibility("default")))
-# endif
-# endif
-# endif
-
-# ifndef QGPGME_NO_EXPORT
-# ifdef WIN32
-# define QGPGME_NO_EXPORT
-# else
-# define QGPGME_NO_EXPORT __attribute__((visibility("hidden")))
-# endif
-# endif
-#endif
-
-#ifndef QGPGME_DEPRECATED
-# define QGPGME_DEPRECATED __attribute__ ((__deprecated__))
-#endif
-
-#ifndef QGPGME_DEPRECATED_EXPORT
-# define QGPGME_DEPRECATED_EXPORT QGPGME_EXPORT QGPGME_DEPRECATED
-#endif
-
-#ifndef QGPGME_DEPRECATED_NO_EXPORT
-# define QGPGME_DEPRECATED_NO_EXPORT QGPGME_NO_EXPORT QGPGME_DEPRECATED
-#endif
-
-#define DEFINE_NO_DEPRECATED 0
-#if DEFINE_NO_DEPRECATED
-# define QGPGME_NO_DEPRECATED
-#endif
-
-#endif
diff --git a/lang/qt/src/qgpgme_version.h.in b/lang/qt/src/qgpgme_version.h.in
deleted file mode 100644
index 1bc56949..00000000
--- a/lang/qt/src/qgpgme_version.h.in
+++ /dev/null
@@ -1,42 +0,0 @@
-/* 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 "@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/qgpgmeaddexistingsubkeyjob.cpp b/lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp
deleted file mode 100644
index 7750d36b..00000000
--- a/lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- qgpgmeaddexistingsubkeyjob.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 <[email protected]>
-
- 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 "qgpgmeaddexistingsubkeyjob.h"
-
-#include "dataprovider.h"
-
-#include <QDateTime>
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/gpgaddexistingsubkeyeditinteractor.h>
-#include <gpgme++/key.h>
-
-#include <gpg-error.h>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEAddExistingSubkeyJob::QGpgMEAddExistingSubkeyJob(Context *context)
- : mixin_type{context}
-{
- lateInitialization();
-}
-
-QGpgMEAddExistingSubkeyJob::~QGpgMEAddExistingSubkeyJob() = default;
-
-static QGpgMEAddExistingSubkeyJob::result_type add_subkey(Context *ctx, const Key &key, const Subkey &subkey)
-{
- std::unique_ptr<GpgAddExistingSubkeyEditInteractor> interactor{new GpgAddExistingSubkeyEditInteractor{subkey.keyGrip()}};
-
- if (!subkey.neverExpires()) {
- const auto expiry = QDateTime::fromSecsSinceEpoch(uint_least32_t(subkey.expirationTime()),
- Qt::UTC).toString(u"yyyyMMdd'T'hhmmss").toStdString();
- interactor->setExpiry(expiry);
- }
-
- QGpgME::QByteArrayDataProvider dp;
- Data data(&dp);
- assert(!data.isNull());
-
- ctx->setFlag("extended-edit", "1");
-
- const Error err = ctx->edit(key, std::unique_ptr<EditInteractor>(interactor.release()), data);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, log, ae);
-}
-
-Error QGpgMEAddExistingSubkeyJob::start(const GpgME::Key &key, const GpgME::Subkey &subkey)
-{
- run(std::bind(&add_subkey, std::placeholders::_1, key, subkey));
- return {};
-}
-
-Error QGpgMEAddExistingSubkeyJob::exec(const GpgME::Key &key, const GpgME::Subkey &subkey)
-{
- const result_type r = add_subkey(context(), key, subkey);
- return std::get<0>(r);
-}
-
-#include "qgpgmeaddexistingsubkeyjob.moc"
diff --git a/lang/qt/src/qgpgmeaddexistingsubkeyjob.h b/lang/qt/src/qgpgmeaddexistingsubkeyjob.h
deleted file mode 100644
index 15727552..00000000
--- a/lang/qt/src/qgpgmeaddexistingsubkeyjob.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- qgpgmeaddexistingsubkeyjob.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 <[email protected]>
-
- 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_QGPGMEADDEXISTINGSUBKEYJOB_H__
-#define __QGPGME_QGPGMEADDEXISTINGSUBKEYJOB_H__
-
-#include "threadedjobmixin.h"
-#include "addexistingsubkeyjob.h"
-
-namespace QGpgME
-{
-
-class QGpgMEAddExistingSubkeyJob
-#ifdef Q_MOC_RUN
- : public AddExistingSubkeyJob
-#else
- : public _detail::ThreadedJobMixin<AddExistingSubkeyJob>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEAddExistingSubkeyJob(GpgME::Context *context);
- ~QGpgMEAddExistingSubkeyJob();
-
- /* from AddExistingSubkeyJob */
- GpgME::Error start(const GpgME::Key &key, const GpgME::Subkey &subkey) override;
-
- /* from AddExistingSubkeyJob */
- GpgME::Error exec(const GpgME::Key &key, const GpgME::Subkey &subkey) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEADDEXISTINGSUBKEYJOB_H__
diff --git a/lang/qt/src/qgpgmeadduseridjob.cpp b/lang/qt/src/qgpgmeadduseridjob.cpp
deleted file mode 100644
index 3dec6581..00000000
--- a/lang/qt/src/qgpgmeadduseridjob.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- qgpgmeadduseridjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "qgpgmeadduseridjob.h"
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/gpgadduserideditinteractor.h>
-#include <gpgme++/key.h>
-
-#include <cassert>
-#include <memory>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEAddUserIDJob::QGpgMEAddUserIDJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMEAddUserIDJob::~QGpgMEAddUserIDJob() {}
-
-static QGpgMEAddUserIDJob::result_type add_user_id(Context *ctx, const Key &key, const QString &name, const QString &email, const QString &comment)
-{
-
- GpgAddUserIDEditInteractor *gau = new GpgAddUserIDEditInteractor;
-
- gau->setNameUtf8(name.toUtf8().constData());
- gau->setEmailUtf8(email.toUtf8().constData());
- gau->setCommentUtf8(comment.toUtf8().constData());
-
- QGpgME::QByteArrayDataProvider dp;
- Data data(&dp);
- assert(!data.isNull());
- const Error err = ctx->edit(key, std::unique_ptr<EditInteractor> (gau), data);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, log, ae);
-}
-
-Error QGpgMEAddUserIDJob::start(const Key &key, const QString &name, const QString &email, const QString &comment)
-{
- run(std::bind(&add_user_id, std::placeholders::_1, key, name, email, comment));
- return Error();
-}
-#include "qgpgmeadduseridjob.moc"
diff --git a/lang/qt/src/qgpgmeadduseridjob.h b/lang/qt/src/qgpgmeadduseridjob.h
deleted file mode 100644
index 26395ba5..00000000
--- a/lang/qt/src/qgpgmeadduseridjob.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- qgpgmeadduseridjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_QGPGMEADDUSERIDJOB_H__
-#define __QGPGME_QGPGMEADDUSERIDJOB_H__
-
-#include "adduseridjob.h"
-
-#include "threadedjobmixin.h"
-
-namespace QGpgME
-{
-
-class QGpgMEAddUserIDJob
-#ifdef Q_MOC_RUN
- : public AddUserIDJob
-#else
- : public _detail::ThreadedJobMixin<AddUserIDJob>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-private Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEAddUserIDJob(GpgME::Context *context);
- ~QGpgMEAddUserIDJob();
-
- /* from AddUserIDJob */
- GpgME::Error start(const GpgME::Key &key, const QString &name, const QString &email, const QString &comment) override;
-};
-}
-
-#endif // __QGPGME_QGPGMEADDUSERIDJOB_H__
diff --git a/lang/qt/src/qgpgmebackend.cpp b/lang/qt/src/qgpgmebackend.cpp
deleted file mode 100644
index 9cd34006..00000000
--- a/lang/qt/src/qgpgmebackend.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- qgpgmebackend.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2005 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "qgpgmebackend.h"
-
-#include "qgpgmegpgcardjob.h"
-
-#include <gpgme++/error.h>
-#include <gpgme++/engineinfo.h>
-
-#include "protocol_p.h"
-
-#include <QFile>
-#include <QString>
-
-const char QGpgME::QGpgMEBackend::OpenPGP[] = "OpenPGP";
-const char QGpgME::QGpgMEBackend::SMIME[] = "SMIME";
-
-
-QGpgME::QGpgMEBackend::QGpgMEBackend()
- : mCryptoConfig(nullptr),
- mOpenPGPProtocol(nullptr),
- mSMIMEProtocol(nullptr)
-{
- GpgME::initializeLibrary();
-}
-
-QGpgME::QGpgMEBackend::~QGpgMEBackend()
-{
- delete mCryptoConfig; mCryptoConfig = nullptr;
- delete mOpenPGPProtocol; mOpenPGPProtocol = nullptr;
- delete mSMIMEProtocol; mSMIMEProtocol = nullptr;
-}
-
-QString QGpgME::QGpgMEBackend::name() const
-{
- return QStringLiteral("gpgme");
-}
-
-QString QGpgME::QGpgMEBackend::displayName() const
-{
- return QStringLiteral("GpgME");
-}
-
-QGpgME::CryptoConfig *QGpgME::QGpgMEBackend::config() const
-{
- if (!mCryptoConfig) {
- if (GpgME::hasFeature(GpgME::GpgConfEngineFeature, 0)) {
- mCryptoConfig = new QGpgMENewCryptoConfig;
- }
- }
- return mCryptoConfig;
-}
-
-QGpgME::GpgCardJob *QGpgME::QGpgMEBackend::gpgCardJob() const
-{
- return new QGpgME::QGpgMEGpgCardJob();
-}
-
-static bool check(GpgME::Protocol proto, QString *reason)
-{
- if (!GpgME::checkEngine(proto)) {
- return true;
- }
- if (!reason) {
- return false;
- }
- // error, check why:
-#if 0
-Port away from localised string or delete.
- const GpgME::EngineInfo ei = GpgME::engineInfo(proto);
- if (ei.isNull()) {
- *reason = i18n("GPGME was compiled without support for %1.", proto == GpgME::CMS ? QLatin1String("S/MIME") : QLatin1String("OpenPGP"));
- } else if (ei.fileName() && !ei.version()) {
- *reason = i18n("Engine %1 is not installed properly.", QFile::decodeName(ei.fileName()));
- } else if (ei.fileName() && ei.version() && ei.requiredVersion())
- *reason = i18n("Engine %1 version %2 installed, "
- "but at least version %3 is required.",
- QFile::decodeName(ei.fileName()), QLatin1String(ei.version()), QLatin1String(ei.requiredVersion()));
- else {
- *reason = i18n("Unknown problem with engine for protocol %1.", proto == GpgME::CMS ? QLatin1String("S/MIME") : QLatin1String("OpenPGP"));
- }
-#endif
- return false;
-}
-
-bool QGpgME::QGpgMEBackend::checkForOpenPGP(QString *reason) const
-{
- return check(GpgME::OpenPGP, reason);
-}
-
-bool QGpgME::QGpgMEBackend::checkForSMIME(QString *reason) const
-{
- return check(GpgME::CMS, reason);
-}
-
-bool QGpgME::QGpgMEBackend::checkForProtocol(const char *name, QString *reason) const
-{
- if (qstricmp(name, OpenPGP) == 0) {
- return check(GpgME::OpenPGP, reason);
- }
- if (qstricmp(name, SMIME) == 0) {
- return check(GpgME::CMS, reason);
- }
- if (reason) {
- *reason = QStringLiteral("Unsupported protocol \"%1\"").arg(QLatin1String(name));
- }
- return false;
-}
-
-QGpgME::Protocol *QGpgME::QGpgMEBackend::openpgp() const
-{
- if (!mOpenPGPProtocol)
- if (checkForOpenPGP()) {
- mOpenPGPProtocol = new ::Protocol(GpgME::OpenPGP);
- }
- return mOpenPGPProtocol;
-}
-
-QGpgME::Protocol *QGpgME::QGpgMEBackend::smime() const
-{
- if (!mSMIMEProtocol)
- if (checkForSMIME()) {
- mSMIMEProtocol = new ::Protocol(GpgME::CMS);
- }
- return mSMIMEProtocol;
-}
-
-QGpgME::Protocol *QGpgME::QGpgMEBackend::protocol(const char *name) const
-{
- if (qstricmp(name, OpenPGP) == 0) {
- return openpgp();
- }
- if (qstricmp(name, SMIME) == 0) {
- return smime();
- }
- return nullptr;
-}
-
-bool QGpgME::QGpgMEBackend::supportsProtocol(const char *name) const
-{
- return qstricmp(name, OpenPGP) == 0 || qstricmp(name, SMIME) == 0;
-}
-
-const char *QGpgME::QGpgMEBackend::enumerateProtocols(int i) const
-{
- switch (i) {
- case 0: return OpenPGP;
- case 1: return SMIME;
- default: return nullptr;
- }
-}
-
-static QGpgME::QGpgMEBackend *gpgmeBackend;
-
-QGpgME::CryptoConfig *QGpgME::cryptoConfig()
-{
- if (!gpgmeBackend) {
- gpgmeBackend = new QGpgME::QGpgMEBackend();
- }
- return gpgmeBackend->config();
-
-}
-
-QGpgME::Protocol *QGpgME::openpgp()
-{
- if (!gpgmeBackend) {
- gpgmeBackend = new QGpgME::QGpgMEBackend();
- }
- return gpgmeBackend->openpgp();
-}
-
-QGpgME::Protocol *QGpgME::smime()
-{
- if (!gpgmeBackend) {
- gpgmeBackend = new QGpgME::QGpgMEBackend();
- }
- return gpgmeBackend->smime();
-}
-
-QGpgME::GpgCardJob *QGpgME::gpgCardJob ()
-{
- if (!gpgmeBackend) {
- gpgmeBackend = new QGpgME::QGpgMEBackend();
- }
- return gpgmeBackend->gpgCardJob();
-}
diff --git a/lang/qt/src/qgpgmebackend.h b/lang/qt/src/qgpgmebackend.h
deleted file mode 100644
index 2e26d4a3..00000000
--- a/lang/qt/src/qgpgmebackend.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- qgpgmebackend.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2005 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_QGPGMEBACKEND_H__
-#define __QGPGME_QGPGMEBACKEND_H__
-
-#include <QString>
-
-#include "protocol.h"
-
-class QString;
-template <typename T_Key, typename T_Value> class QMap;
-
-namespace QGpgME
-{
-class CryptoConfig;
-class Protocol;
-class GpgCardJob;
-
-
-class QGpgMEBackend
-{
-public:
- QGpgMEBackend();
- ~QGpgMEBackend();
-
- QString name() const;
- QString displayName() const;
-
- CryptoConfig *config() const;
- GpgCardJob *gpgCardJob() const;
-
- Protocol *openpgp() const;
- Protocol *smime() const;
- Protocol *protocol(const char *name) const;
-
- static const char OpenPGP[];
- static const char SMIME[];
-
- bool checkForOpenPGP(QString *reason = nullptr) const;
- bool checkForSMIME(QString *reason = nullptr) const;
- bool checkForProtocol(const char *name, QString *reason) const;
-
- bool supportsOpenPGP() const
- {
- return true;
- }
- bool supportsSMIME() const
- {
- return true;
- }
- bool supportsProtocol(const char *name) const;
-
- const char *enumerateProtocols(int i) const;
-
-private:
- mutable QGpgME::CryptoConfig *mCryptoConfig;
- mutable Protocol *mOpenPGPProtocol;
- mutable Protocol *mSMIMEProtocol;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEBACKEND_H__
diff --git a/lang/qt/src/qgpgmechangeexpiryjob.cpp b/lang/qt/src/qgpgmechangeexpiryjob.cpp
deleted file mode 100644
index 7f98a943..00000000
--- a/lang/qt/src/qgpgmechangeexpiryjob.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- qgpgmechangeexpiryjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2021,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "qgpgmechangeexpiryjob.h"
-
-#include "changeexpiryjob_p.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/key.h>
-
-#include <QDateTime>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEChangeExpiryJobPrivate : public ChangeExpiryJobPrivate
-{
- QGpgMEChangeExpiryJob *q = nullptr;
-
-public:
- QGpgMEChangeExpiryJobPrivate(QGpgMEChangeExpiryJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEChangeExpiryJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override
- {
- Q_ASSERT(!"Not supported by this Job class.");
- return Error::fromCode(GPG_ERR_NOT_SUPPORTED);
- }
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMEChangeExpiryJob::QGpgMEChangeExpiryJob(Context *context)
- : mixin_type(context)
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEChangeExpiryJobPrivate>{new QGpgMEChangeExpiryJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMEChangeExpiryJob::~QGpgMEChangeExpiryJob() {}
-
-static QGpgMEChangeExpiryJob::result_type change_expiry(Context *ctx, const Key &key, const QDateTime &expiry,
- const std::vector<Subkey> &subkeys, ChangeExpiryJob::Options options)
-{
- // convert expiry to "seconds from now"; use 1 second from now if expiry is before the current datetime
- const unsigned long expires = expiry.isValid()
- ? std::max<qint64>(QDateTime::currentDateTime().secsTo(expiry), 1)
- : 0;
-
- // updating the expiration date of the primary key and the subkeys needs to be done in two steps
- // because --quick-set-expire does not support updating the expiration date of both at the same time
-
- if (subkeys.empty() || (options & ChangeExpiryJob::UpdatePrimaryKey)) {
- // update the expiration date of the primary key
- auto err = ctx->setExpire(key, expires);
- if (err || err.isCanceled()) {
- return std::make_tuple(err, QString(), Error());
- }
- }
-
- GpgME::Error err;
- if (!subkeys.empty()) {
- // update the expiration date of the specified subkeys
- err = ctx->setExpire(key, expires, subkeys);
- } else if (options & ChangeExpiryJob::UpdateAllSubkeys) {
- // update the expiration date of all subkeys
- err = ctx->setExpire(key, expires, {}, Context::SetExpireAllSubkeys);
- }
- return std::make_tuple(err, QString(), Error());
-}
-
-Error QGpgMEChangeExpiryJob::start(const Key &key, const QDateTime &expiry)
-{
- return start(key, expiry, std::vector<Subkey>());
-}
-
-Error QGpgMEChangeExpiryJob::start(const Key &key, const QDateTime &expiry, const std::vector<Subkey> &subkeys)
-{
- run(std::bind(&change_expiry, std::placeholders::_1, key, expiry, subkeys, options()));
- return Error();
-}
-
-#include "qgpgmechangeexpiryjob.moc"
diff --git a/lang/qt/src/qgpgmechangeexpiryjob.h b/lang/qt/src/qgpgmechangeexpiryjob.h
deleted file mode 100644
index ac66e4f7..00000000
--- a/lang/qt/src/qgpgmechangeexpiryjob.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- qgpgmechangeexpiryjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_QGPGMECHANGEEXPIRYJOB_H__
-#define __QGPGME_QGPGMECHANGEEXPIRYJOB_H__
-
-#include "changeexpiryjob.h"
-
-#include "threadedjobmixin.h"
-
-namespace QGpgME
-{
-
-class QGpgMEChangeExpiryJob
-#ifdef Q_MOC_RUN
- : public ChangeExpiryJob
-#else
- : public _detail::ThreadedJobMixin<ChangeExpiryJob>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-private Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEChangeExpiryJob(GpgME::Context *context);
- ~QGpgMEChangeExpiryJob();
-
- /* from ChangeExpiryJob */
- GpgME::Error start(const GpgME::Key &key, const QDateTime &expiry) override;
-
- /* from ChangeExpiryJob */
- GpgME::Error start(const GpgME::Key &key, const QDateTime &expiry,
- const std::vector<GpgME::Subkey> &subkeys) override;
-
-};
-
-}
-
-#endif // __QGPGME_QGPGMECHANGEEXPIRYJOB_H__
diff --git a/lang/qt/src/qgpgmechangeownertrustjob.cpp b/lang/qt/src/qgpgmechangeownertrustjob.cpp
deleted file mode 100644
index 2c8c4e53..00000000
--- a/lang/qt/src/qgpgmechangeownertrustjob.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- qgpgmechangeownertrustjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2024 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "qgpgmechangeownertrustjob.h"
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/engineinfo.h>
-#include <gpgme++/gpgsetownertrusteditinteractor.h>
-#include <gpgme++/key.h>
-
-#include <cassert>
-#include <memory>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEChangeOwnerTrustJob::QGpgMEChangeOwnerTrustJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMEChangeOwnerTrustJob::~QGpgMEChangeOwnerTrustJob() {}
-
-static QGpgMEChangeOwnerTrustJob::result_type set_owner_trust(Context *ctx, const Key &key, Key::OwnerTrust trust)
-{
- const Error err = ctx->setOwnerTrust(key, trust);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, log, ae);
-}
-
-static QGpgMEChangeOwnerTrustJob::result_type change_ownertrust(Context *ctx, const Key &key, Key::OwnerTrust trust)
-{
- EditInteractor *ei = new GpgSetOwnerTrustEditInteractor(trust);
-
- QGpgME::QByteArrayDataProvider dp;
- Data data(&dp);
- assert(!data.isNull());
-
- const Error err = ctx->edit(key, std::unique_ptr<EditInteractor>(ei), data);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, log, ae);
-}
-
-Error QGpgMEChangeOwnerTrustJob::start(const Key &key, Key::OwnerTrust trust)
-{
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.4.6") {
- run(std::bind(&change_ownertrust, std::placeholders::_1, key, trust));
- } else {
- run(std::bind(&set_owner_trust, std::placeholders::_1, key, trust));
- }
- return Error();
-}
-#include "qgpgmechangeownertrustjob.moc"
diff --git a/lang/qt/src/qgpgmechangeownertrustjob.h b/lang/qt/src/qgpgmechangeownertrustjob.h
deleted file mode 100644
index 387166e2..00000000
--- a/lang/qt/src/qgpgmechangeownertrustjob.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- qgpgmechangeownertrustjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_QGPGMECHANGEOWNERTRUSTJOB_H__
-#define __QGPGME_QGPGMECHANGEOWNERTRUSTJOB_H__
-
-#include "changeownertrustjob.h"
-
-#include "threadedjobmixin.h"
-
-namespace QGpgME
-{
-
-class QGpgMEChangeOwnerTrustJob
-#ifdef Q_MOC_RUN
- : public ChangeOwnerTrustJob
-#else
- : public _detail::ThreadedJobMixin<ChangeOwnerTrustJob>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-private Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEChangeOwnerTrustJob(GpgME::Context *context);
- ~QGpgMEChangeOwnerTrustJob();
-
- /* from ChangeOwnerTrustJob */
- GpgME::Error start(const GpgME::Key &key, GpgME::Key::OwnerTrust trust) override;
-};
-}
-
-#endif // __QGPGME_QGPGMECHANGEOWNERTRUSTJOB_H__
diff --git a/lang/qt/src/qgpgmechangepasswdjob.cpp b/lang/qt/src/qgpgmechangepasswdjob.cpp
deleted file mode 100644
index 0607b6d3..00000000
--- a/lang/qt/src/qgpgmechangepasswdjob.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- qgpgmechangepasswdjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2010 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "qgpgmechangepasswdjob.h"
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/key.h>
-
-#include <cassert>
-#include <memory>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEChangePasswdJob::QGpgMEChangePasswdJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMEChangePasswdJob::~QGpgMEChangePasswdJob() {}
-
-static QGpgMEChangePasswdJob::result_type change_passwd(Context *ctx, const Key &key)
-{
-#if 0 // in case we want to fall back to edit interactor for gpg...
- std::unique_ptr<EditInteractor> ei(new GpgChangePasswdEditInteractor);
-
- QGpgME::QByteArrayDataProvider dp;
- Data data(&dp);
- assert(!data.isNull());
- const Error err = ctx->edit(key, ei, data);
-#else
- const Error err = ctx->passwd(key);
-#endif
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, log, ae);
-}
-
-Error QGpgMEChangePasswdJob::start(const Key &key)
-{
- run(std::bind(&change_passwd, std::placeholders::_1, key));
- return Error();
-}
-
-#include "qgpgmechangepasswdjob.moc"
diff --git a/lang/qt/src/qgpgmechangepasswdjob.h b/lang/qt/src/qgpgmechangepasswdjob.h
deleted file mode 100644
index fbd9caa5..00000000
--- a/lang/qt/src/qgpgmechangepasswdjob.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- qgpgmechangepasswdjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2010 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_QGPGMECHANGEPASSWDJOB_H__
-#define __QGPGME_QGPGMECHANGEPASSWDJOB_H__
-
-#include "changepasswdjob.h"
-
-#include "threadedjobmixin.h"
-
-namespace QGpgME
-{
-
-class QGpgMEChangePasswdJob
-#ifdef Q_MOC_RUN
- : public ChangePasswdJob
-#else
- : public _detail::ThreadedJobMixin<ChangePasswdJob>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-private Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEChangePasswdJob(GpgME::Context *context);
- ~QGpgMEChangePasswdJob();
-
- /* from ChangePasswdJob */
- GpgME::Error start(const GpgME::Key &key) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMECHANGEPASSWDJOB_H__
diff --git a/lang/qt/src/qgpgmedecryptjob.cpp b/lang/qt/src/qgpgmedecryptjob.cpp
deleted file mode 100644
index 95240a49..00000000
--- a/lang/qt/src/qgpgmedecryptjob.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- qgpgmedecryptjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "qgpgmedecryptjob.h"
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/decryptionresult.h>
-#include <gpgme++/data.h>
-
-#include <QBuffer>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEDecryptJob::QGpgMEDecryptJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMEDecryptJob::~QGpgMEDecryptJob() {}
-
-static QGpgMEDecryptJob::result_type decrypt(Context *ctx, QThread *thread,
- const std::weak_ptr<QIODevice> &cipherText_,
- const std::weak_ptr<QIODevice> &plainText_)
-{
-
- const std::shared_ptr<QIODevice> cipherText = cipherText_.lock();
- const std::shared_ptr<QIODevice> plainText = plainText_.lock();
-
- const _detail::ToThreadMover ctMover(cipherText, thread);
- const _detail::ToThreadMover ptMover(plainText, thread);
-
- QGpgME::QIODeviceDataProvider in(cipherText);
- Data indata(&in);
- if (!cipherText->isSequential()) {
- indata.setSizeHint(cipherText->size());
- }
-
- if (!plainText) {
- QGpgME::QByteArrayDataProvider out;
- Data outdata(&out);
-
- const DecryptionResult res = ctx->decrypt(indata, outdata);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, out.data(), log, ae);
- } else {
- QGpgME::QIODeviceDataProvider out(plainText);
- Data outdata(&out);
-
- const DecryptionResult res = ctx->decrypt(indata, outdata);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, QByteArray(), log, ae);
- }
-
-}
-
-static QGpgMEDecryptJob::result_type decrypt_qba(Context *ctx, const QByteArray &cipherText)
-{
- const std::shared_ptr<QBuffer> buffer(new QBuffer);
- buffer->setData(cipherText);
- if (!buffer->open(QIODevice::ReadOnly)) {
- assert(!"This should never happen: QBuffer::open() failed");
- }
- return decrypt(ctx, nullptr, buffer, std::shared_ptr<QIODevice>());
-}
-
-Error QGpgMEDecryptJob::start(const QByteArray &cipherText)
-{
- run(std::bind(&decrypt_qba, std::placeholders::_1, cipherText));
- return Error();
-}
-
-void QGpgMEDecryptJob::start(const std::shared_ptr<QIODevice> &cipherText, const std::shared_ptr<QIODevice> &plainText)
-{
- run(std::bind(&decrypt, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), cipherText, plainText);
-}
-
-GpgME::DecryptionResult QGpgME::QGpgMEDecryptJob::exec(const QByteArray &cipherText,
- QByteArray &plainText)
-{
- const result_type r = decrypt_qba(context(), cipherText);
- plainText = std::get<1>(r);
- return std::get<0>(r);
-}
-
-#include "qgpgmedecryptjob.moc"
diff --git a/lang/qt/src/qgpgmedecryptjob.h b/lang/qt/src/qgpgmedecryptjob.h
deleted file mode 100644
index ae489734..00000000
--- a/lang/qt/src/qgpgmedecryptjob.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- qgpgmedecryptjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_QGPGMEDECRYPTJOB_H__
-#define __QGPGME_QGPGMEDECRYPTJOB_H__
-
-#include "decryptjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/decryptionresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEDecryptJob
-#ifdef Q_MOC_RUN
- : public DecryptJob
-#else
- : public _detail::ThreadedJobMixin<DecryptJob, std::tuple<GpgME::DecryptionResult, QByteArray, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-private Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEDecryptJob(GpgME::Context *context);
- ~QGpgMEDecryptJob();
-
- /* from DecryptJob */
- GpgME::Error start(const QByteArray &cipherText) override;
-
- /* from DecryptJob */
- void start(const std::shared_ptr<QIODevice> &cipherText, const std::shared_ptr<QIODevice> &plainText) override;
-
- /* from DecryptJob */
- GpgME::DecryptionResult exec(const QByteArray &cipherText,
- QByteArray &plainText) override;
-};
-
-}
-#endif // __QGPGME_QGPGMEDECRYPTJOB_H__
diff --git a/lang/qt/src/qgpgmedecryptverifyarchivejob.cpp b/lang/qt/src/qgpgmedecryptverifyarchivejob.cpp
deleted file mode 100644
index 10f07e53..00000000
--- a/lang/qt/src/qgpgmedecryptverifyarchivejob.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- qgpgmedecryptverifyarchivejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "qgpgmedecryptverifyarchivejob.h"
-
-#include "dataprovider.h"
-#include "decryptverifyarchivejob_p.h"
-
-#include <QFile>
-
-#include <gpgme++/data.h>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEDecryptVerifyArchiveJobPrivate : public DecryptVerifyArchiveJobPrivate
-{
- QGpgMEDecryptVerifyArchiveJob *q = nullptr;
-
-public:
- QGpgMEDecryptVerifyArchiveJobPrivate(QGpgMEDecryptVerifyArchiveJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEDecryptVerifyArchiveJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMEDecryptVerifyArchiveJob::QGpgMEDecryptVerifyArchiveJob(Context *context)
- : mixin_type{context}
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEDecryptVerifyArchiveJobPrivate>{new QGpgMEDecryptVerifyArchiveJobPrivate{this}});
- lateInitialization();
- connect(this, &Job::rawProgress, this, [this](const QString &what, int type, int current, int total) {
- emitArchiveProgressSignals(this, what, type, current, total);
- });
-}
-
-static QGpgMEDecryptVerifyArchiveJob::result_type decrypt_verify(Context *ctx,
- const GpgME::Data &indata,
- const QString &outputDirectory)
-{
- Data outdata;
- if (!outputDirectory.isEmpty()) {
- outdata.setFileName(outputDirectory.toStdString());
- }
-
- const auto res = ctx->decryptAndVerify(indata, outdata, Context::DecryptArchive);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res.first, res.second, log, ae);
-}
-
-static QGpgMEDecryptVerifyArchiveJob::result_type decrypt_verify_from_io_device(Context *ctx,
- QThread *thread,
- const std::weak_ptr<QIODevice> &cipherText_,
- const QString &outputDirectory)
-{
- const std::shared_ptr<QIODevice> cipherText = cipherText_.lock();
- const _detail::ToThreadMover ctMover(cipherText, thread);
- QGpgME::QIODeviceDataProvider in{cipherText};
- Data indata(&in);
- if (!cipherText->isSequential()) {
- indata.setSizeHint(cipherText->size());
- }
-
- return decrypt_verify(ctx, indata, outputDirectory);
-}
-
-static QGpgMEDecryptVerifyArchiveJob::result_type decrypt_verify_from_file_name(Context *ctx,
- const QString &inputFile,
- const QString &outputDirectory,
- bool processAllSignatures)
-{
- Data indata;
-#ifdef Q_OS_WIN
- indata.setFileName(inputFile.toUtf8().constData());
-#else
- indata.setFileName(QFile::encodeName(inputFile).constData());
-#endif
-
- if (processAllSignatures) {
- ctx->setFlag("proc-all-sigs", "1");
- }
- return decrypt_verify(ctx, indata, outputDirectory);
-}
-
-GpgME::Error QGpgMEDecryptVerifyArchiveJob::start(const std::shared_ptr<QIODevice> &cipherText)
-{
- if (!cipherText) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- if (processAllSignatures()) {
- context()->setFlag("proc-all-sigs", "1");
- }
- run(std::bind(&decrypt_verify_from_io_device,
- std::placeholders::_1,
- std::placeholders::_2,
- std::placeholders::_3,
- outputDirectory()),
- cipherText);
- return {};
-}
-
-GpgME::Error QGpgMEDecryptVerifyArchiveJobPrivate::startIt()
-{
- if (m_inputFilePath.isEmpty()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return decrypt_verify_from_file_name(ctx, m_inputFilePath, m_outputDirectory, m_processAllSignatures);
- });
-
- return {};
-}
-
-#include "qgpgmedecryptverifyarchivejob.moc"
diff --git a/lang/qt/src/qgpgmedecryptverifyarchivejob.h b/lang/qt/src/qgpgmedecryptverifyarchivejob.h
deleted file mode 100644
index 50ca0839..00000000
--- a/lang/qt/src/qgpgmedecryptverifyarchivejob.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- qgpgmedecryptverifyarchivejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_QGPGMEDECRYPTVERIFYARCHIVEJOB_H__
-#define __QGPGME_QGPGMEDECRYPTVERIFYARCHIVEJOB_H__
-
-#include "decryptverifyarchivejob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/decryptionresult.h>
-#include <gpgme++/verificationresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEDecryptVerifyArchiveJob
-#ifdef Q_MOC_RUN
- : public DecryptVerifyArchiveJob
-#else
- : public _detail::ThreadedJobMixin<DecryptVerifyArchiveJob, std::tuple<GpgME::DecryptionResult, GpgME::VerificationResult, QString, GpgME::Error>>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEDecryptVerifyArchiveJob(GpgME::Context *context);
- ~QGpgMEDecryptVerifyArchiveJob() = default;
-
- GpgME::Error start(const std::shared_ptr<QIODevice> &cipherText) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEDECRYPTVERIFYARCHIVEJOB_H__
diff --git a/lang/qt/src/qgpgmedecryptverifyjob.cpp b/lang/qt/src/qgpgmedecryptverifyjob.cpp
deleted file mode 100644
index e8d2ad4e..00000000
--- a/lang/qt/src/qgpgmedecryptverifyjob.cpp
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- qgpgmedecryptverifyjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "qgpgmedecryptverifyjob.h"
-
-#include "dataprovider.h"
-#include "debug.h"
-#include "decryptverifyjob_p.h"
-#include "util.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/decryptionresult.h>
-#include <gpgme++/verificationresult.h>
-#include <gpgme++/data.h>
-
-#include <QDebug>
-#include "qgpgme_debug.h"
-
-#include <QBuffer>
-#include <QFile>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEDecryptVerifyJobPrivate : public DecryptVerifyJobPrivate
-{
- QGpgMEDecryptVerifyJob *q = nullptr;
-
-public:
- QGpgMEDecryptVerifyJobPrivate(QGpgMEDecryptVerifyJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEDecryptVerifyJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMEDecryptVerifyJob::QGpgMEDecryptVerifyJob(Context *context)
- : mixin_type(context)
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEDecryptVerifyJobPrivate>{new QGpgMEDecryptVerifyJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMEDecryptVerifyJob::~QGpgMEDecryptVerifyJob() {}
-
-static QGpgMEDecryptVerifyJob::result_type decrypt_verify(Context *ctx, QThread *thread,
- const std::weak_ptr<QIODevice> &cipherText_,
- const std::weak_ptr<QIODevice> &plainText_)
-{
- qCDebug(QGPGME_LOG) << __func__;
-
- const std::shared_ptr<QIODevice> cipherText = cipherText_.lock();
- const std::shared_ptr<QIODevice> plainText = plainText_.lock();
-
- const _detail::ToThreadMover ctMover(cipherText, thread);
- const _detail::ToThreadMover ptMover(plainText, thread);
-
- QGpgME::QIODeviceDataProvider in(cipherText);
- Data indata(&in);
- if (!cipherText->isSequential()) {
- indata.setSizeHint(cipherText->size());
- }
-
- if (!plainText) {
- QGpgME::QByteArrayDataProvider out;
- Data outdata(&out);
-
- 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) << __func__ << "- End no plainText. Error:" << ae;
- return std::make_tuple(res.first, res.second, out.data(), log, ae);
- } else {
- QGpgME::QIODeviceDataProvider out(plainText);
- Data outdata(&out);
-
- 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) << __func__ << "- End plainText. Error:" << ae;
- return std::make_tuple(res.first, res.second, QByteArray(), log, ae);
- }
-}
-
-static QGpgMEDecryptVerifyJob::result_type decrypt_verify_qba(Context *ctx, const QByteArray &cipherText)
-{
- const std::shared_ptr<QBuffer> buffer(new QBuffer);
- buffer->setData(cipherText);
- if (!buffer->open(QIODevice::ReadOnly)) {
- assert(!"This should never happen: QBuffer::open() failed");
- }
- return decrypt_verify(ctx, nullptr, buffer, std::shared_ptr<QIODevice>());
-}
-
-static QGpgMEDecryptVerifyJob::result_type decrypt_verify_from_filename(Context *ctx,
- const QString &inputFilePath,
- const QString &outputFilePath,
- bool processAllSignatures)
-{
- Data indata;
-#ifdef Q_OS_WIN
- indata.setFileName(inputFilePath.toUtf8().constData());
-#else
- indata.setFileName(QFile::encodeName(inputFilePath).constData());
-#endif
-
- PartialFileGuard partFileGuard{outputFilePath};
- if (partFileGuard.tempFileName().isEmpty()) {
- return std::make_tuple(DecryptionResult{Error::fromCode(GPG_ERR_EEXIST)}, VerificationResult{Error::fromCode(GPG_ERR_EEXIST)}, QByteArray{}, QString{}, Error{});
- }
-
- Data outdata;
-#ifdef Q_OS_WIN
- outdata.setFileName(partFileGuard.tempFileName().toUtf8().constData());
-#else
- outdata.setFileName(QFile::encodeName(partFileGuard.tempFileName()).constData());
-#endif
-
- if (processAllSignatures) {
- ctx->setFlag("proc-all-sigs", "1");
- }
- const auto results = ctx->decryptAndVerify(indata, outdata);
- const auto &decryptionResult = results.first;
- const auto &verificationResult = results.second;
-
- if (!decryptionResult.error().code() && !verificationResult.error().code()) {
- // the operation succeeded -> save the result under the requested file name
- partFileGuard.commit();
- }
-
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(decryptionResult, verificationResult, QByteArray{}, log, ae);
-}
-
-Error QGpgMEDecryptVerifyJob::start(const QByteArray &cipherText)
-{
- if (processAllSignatures()) {
- context()->setFlag("proc-all-sigs", "1");
- }
- run(std::bind(&decrypt_verify_qba, std::placeholders::_1, cipherText));
- return Error();
-}
-
-void QGpgMEDecryptVerifyJob::start(const std::shared_ptr<QIODevice> &cipherText, const std::shared_ptr<QIODevice> &plainText)
-{
- if (processAllSignatures()) {
- context()->setFlag("proc-all-sigs", "1");
- }
- run(std::bind(&decrypt_verify, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), cipherText, plainText);
-}
-
-std::pair<GpgME::DecryptionResult, GpgME::VerificationResult>
-QGpgME::QGpgMEDecryptVerifyJob::exec(const QByteArray &cipherText, QByteArray &plainText)
-{
- if (processAllSignatures()) {
- context()->setFlag("proc-all-sigs", "1");
- }
- const result_type r = decrypt_verify_qba(context(), cipherText);
- plainText = std::get<2>(r);
- return std::make_pair(std::get<0>(r), std::get<1>(r));
-}
-
-GpgME::Error QGpgMEDecryptVerifyJobPrivate::startIt()
-{
- if (m_inputFilePath.isEmpty() || m_outputFilePath.isEmpty()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return decrypt_verify_from_filename(ctx, m_inputFilePath, m_outputFilePath, m_processAllSignatures);
- });
-
- return {};
-}
-
-#include "qgpgmedecryptverifyjob.moc"
diff --git a/lang/qt/src/qgpgmedecryptverifyjob.h b/lang/qt/src/qgpgmedecryptverifyjob.h
deleted file mode 100644
index 1a1721df..00000000
--- a/lang/qt/src/qgpgmedecryptverifyjob.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- qgpgmedecryptverifyjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_QGPGMEDECRYPTVERIFYJOB_H__
-#define __QGPGME_QGPGMEDECRYPTVERIFYJOB_H__
-
-#include "decryptverifyjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/decryptionresult.h>
-#include <gpgme++/verificationresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEDecryptVerifyJob
-#ifdef Q_MOC_RUN
- : public DecryptVerifyJob
-#else
- : public _detail::ThreadedJobMixin<DecryptVerifyJob, std::tuple<GpgME::DecryptionResult, GpgME::VerificationResult, QByteArray, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-private Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEDecryptVerifyJob(GpgME::Context *context);
- ~QGpgMEDecryptVerifyJob();
-
- /* from DecryptVerifyJob */
- GpgME::Error start(const QByteArray &cipherText) override;
-
- /* from DecryptVerifyJob */
- void start(const std::shared_ptr<QIODevice> &cipherText, const std::shared_ptr<QIODevice> &plainText) override;
-
- /* from DecryptVerifyJob */
- std::pair<GpgME::DecryptionResult, GpgME::VerificationResult>
- exec(const QByteArray &cipherText, QByteArray &plainText) override;
-};
-
-}
-#endif // __QGPGME_QGPGMEDECRYPTVERIFYJOB_H__
diff --git a/lang/qt/src/qgpgmedeletejob.cpp b/lang/qt/src/qgpgmedeletejob.cpp
deleted file mode 100644
index 16f822b5..00000000
--- a/lang/qt/src/qgpgmedeletejob.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- qgpgmedeletejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "qgpgmedeletejob.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/key.h>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEDeleteJob::QGpgMEDeleteJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMEDeleteJob::~QGpgMEDeleteJob() {}
-
-static QGpgMEDeleteJob::result_type delete_key(Context *ctx, const Key &key, bool allowSecretKeyDeletion)
-{
- const Error err = ctx->deleteKey(key, allowSecretKeyDeletion);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, log, ae);
-}
-
-Error QGpgMEDeleteJob::start(const Key &key, bool allowSecretKeyDeletion)
-{
- run(std::bind(&delete_key, std::placeholders::_1, key, allowSecretKeyDeletion));
- return Error();
-}
-#include "qgpgmedeletejob.moc"
diff --git a/lang/qt/src/qgpgmedeletejob.h b/lang/qt/src/qgpgmedeletejob.h
deleted file mode 100644
index 6228a50c..00000000
--- a/lang/qt/src/qgpgmedeletejob.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- qgpgmedeletejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_QGPGMEDELETEJOB_H__
-#define __QGPGME_QGPGMEDELETEJOB_H__
-
-#include "deletejob.h"
-
-#include "threadedjobmixin.h"
-
-namespace GpgME
-{
-class Key;
-}
-
-namespace QGpgME
-{
-
-class QGpgMEDeleteJob
-#ifdef Q_MOC_RUN
- : public DeleteJob
-#else
- : public _detail::ThreadedJobMixin<DeleteJob>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEDeleteJob(GpgME::Context *context);
- ~QGpgMEDeleteJob();
-
- /* from DeleteJob */
- GpgME::Error start(const GpgME::Key &key, bool allowSecretKeyDeletion) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEDELETEJOB_H__
diff --git a/lang/qt/src/qgpgmedownloadjob.cpp b/lang/qt/src/qgpgmedownloadjob.cpp
deleted file mode 100644
index d7c608f4..00000000
--- a/lang/qt/src/qgpgmedownloadjob.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- qgpgmedownloadjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "qgpgmedownloadjob.h"
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-
-#include <QStringList>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEDownloadJob::QGpgMEDownloadJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMEDownloadJob::~QGpgMEDownloadJob() {}
-
-static QGpgMEDownloadJob::result_type download_qsl(Context *ctx, const QStringList &pats)
-{
- QGpgME::QByteArrayDataProvider dp;
- Data data(&dp);
-
- const _detail::PatternConverter pc(pats);
-
- const Error err = ctx->exportPublicKeys(pc.patterns(), data);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, dp.data(), log, ae);
-}
-
-static QGpgMEDownloadJob::result_type download(Context *ctx, QThread *thread, const QByteArray &fpr, const std::weak_ptr<QIODevice> &keyData_)
-{
- const std::shared_ptr<QIODevice> keyData = keyData_.lock();
- if (!keyData) {
- return download_qsl(ctx, QStringList(QString::fromUtf8(fpr)));
- }
-
- const _detail::ToThreadMover kdMover(keyData, thread);
-
- QGpgME::QIODeviceDataProvider dp(keyData);
- Data data(&dp);
-
- const _detail::PatternConverter pc(fpr);
-
- const Error err = ctx->exportPublicKeys(pc.patterns(), data);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, QByteArray(), log, ae);
-}
-
-Error QGpgMEDownloadJob::start(const QStringList &pats)
-{
- run(std::bind(&download_qsl, std::placeholders::_1, pats));
- return Error();
-}
-
-Error QGpgMEDownloadJob::start(const QByteArray &fpr, const std::shared_ptr<QIODevice> &keyData)
-{
- run(std::bind(&download, std::placeholders::_1, std::placeholders::_2, fpr, std::placeholders::_3), keyData);
- return Error();
-}
-#include "qgpgmedownloadjob.moc"
diff --git a/lang/qt/src/qgpgmedownloadjob.h b/lang/qt/src/qgpgmedownloadjob.h
deleted file mode 100644
index 8aab7479..00000000
--- a/lang/qt/src/qgpgmedownloadjob.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- qgpgmedownloadjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_QGPGMEDOWNLOADJOB_H__
-#define __QGPGME_QGPGMEDOWNLOADJOB_H__
-
-#include "downloadjob.h"
-
-#include "threadedjobmixin.h"
-
-namespace QGpgME
-{
-
-class QGpgMEDownloadJob
-#ifdef Q_MOC_RUN
- : public DownloadJob
-#else
- : public _detail::ThreadedJobMixin<DownloadJob, std::tuple<GpgME::Error, QByteArray, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEDownloadJob(GpgME::Context *context);
- ~QGpgMEDownloadJob();
-
- /* from DownloadJob */
- GpgME::Error start(const QStringList &fingerprints) override;
-
- /* from DownloadJob */
- GpgME::Error start(const QByteArray &fingerprint, const std::shared_ptr<QIODevice> &keyData) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEDOWNLOADJOB_H__
diff --git a/lang/qt/src/qgpgmeencryptarchivejob.cpp b/lang/qt/src/qgpgmeencryptarchivejob.cpp
deleted file mode 100644
index 02b9e587..00000000
--- a/lang/qt/src/qgpgmeencryptarchivejob.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- qgpgmeencryptarchivejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- 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,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "qgpgmeencryptarchivejob.h"
-
-#include "dataprovider.h"
-#include "encryptarchivejob_p.h"
-#include "filelistdataprovider.h"
-#include "qgpgme_debug.h"
-#include "util.h"
-
-#include <QFile>
-
-#include <gpgme++/data.h>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEEncryptArchiveJobPrivate : public EncryptArchiveJobPrivate
-{
- QGpgMEEncryptArchiveJob *q = nullptr;
-
-public:
- QGpgMEEncryptArchiveJobPrivate(QGpgMEEncryptArchiveJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEEncryptArchiveJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMEEncryptArchiveJob::QGpgMEEncryptArchiveJob(Context *context)
- : mixin_type{context}
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEEncryptArchiveJobPrivate>{new QGpgMEEncryptArchiveJobPrivate{this}});
- lateInitialization();
- connect(this, &Job::rawProgress, this, [this](const QString &what, int type, int current, int total) {
- emitArchiveProgressSignals(this, what, type, current, total);
- });
-}
-
-static QGpgMEEncryptArchiveJob::result_type encrypt(Context *ctx,
- const std::vector<Key> &recipients,
- const std::vector<QString> &paths,
- GpgME::Data &outdata,
- Context::EncryptionFlags flags,
- const QString &baseDirectory)
-{
- QGpgME::FileListDataProvider in{paths};
- Data indata(&in);
- if (!baseDirectory.isEmpty()) {
- indata.setFileName(baseDirectory.toStdString());
- }
-
- flags = static_cast<Context::EncryptionFlags>(flags | Context::EncryptArchive);
- const auto encryptionResult = ctx->encrypt(recipients, indata, outdata, flags);
-
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(encryptionResult, log, ae);
-}
-
-static QGpgMEEncryptArchiveJob::result_type encrypt_to_io_device(Context *ctx,
- QThread *thread,
- const std::vector<Key> &recipients,
- const std::vector<QString> &paths,
- const std::weak_ptr<QIODevice> &cipherText_,
- Context::EncryptionFlags flags,
- const QString &baseDirectory)
-{
- const std::shared_ptr<QIODevice> cipherText = cipherText_.lock();
- const _detail::ToThreadMover ctMover(cipherText, thread);
- QGpgME::QIODeviceDataProvider out{cipherText};
- Data outdata(&out);
-
- return encrypt(ctx, recipients, paths, outdata, flags, baseDirectory);
-}
-
-static QGpgMEEncryptArchiveJob::result_type encrypt_to_filename(Context *ctx,
- const std::vector<Key> &recipients,
- const std::vector<QString> &paths,
- const QString &outputFileName,
- Context::EncryptionFlags flags,
- const QString &baseDirectory)
-{
- PartialFileGuard partFileGuard{outputFileName};
- if (partFileGuard.tempFileName().isEmpty()) {
- return std::make_tuple(EncryptionResult{Error::fromCode(GPG_ERR_EEXIST)}, QString{}, Error{});
- }
-
- Data outdata;
-#ifdef Q_OS_WIN
- outdata.setFileName(partFileGuard.tempFileName().toUtf8().constData());
-#else
- outdata.setFileName(QFile::encodeName(partFileGuard.tempFileName()).constData());
-#endif
-
- const auto result = encrypt(ctx, recipients, paths, outdata, flags, baseDirectory);
- const auto &encryptionResult = std::get<0>(result);
- if (!encryptionResult.error().code()) {
- // the operation succeeded -> save the result under the requested file name
- partFileGuard.commit();
- }
-
- return result;
-}
-
-GpgME::Error QGpgMEEncryptArchiveJob::start(const std::vector<GpgME::Key> &recipients,
- const std::vector<QString> &paths,
- const std::shared_ptr<QIODevice> &cipherText,
- const GpgME::Context::EncryptionFlags flags)
-{
- if (!cipherText) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- run(std::bind(&encrypt_to_io_device,
- std::placeholders::_1,
- std::placeholders::_2,
- recipients,
- paths,
- std::placeholders::_3,
- flags,
- baseDirectory()),
- cipherText);
- return {};
-}
-
-GpgME::Error QGpgMEEncryptArchiveJobPrivate::startIt()
-{
- if (m_outputFilePath.isEmpty()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return encrypt_to_filename(ctx, m_recipients, m_inputPaths, m_outputFilePath, m_encryptionFlags, m_baseDirectory);
- });
-
- return {};
-}
-
-#include "qgpgmeencryptarchivejob.moc"
diff --git a/lang/qt/src/qgpgmeencryptarchivejob.h b/lang/qt/src/qgpgmeencryptarchivejob.h
deleted file mode 100644
index 6b818f20..00000000
--- a/lang/qt/src/qgpgmeencryptarchivejob.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- qgpgmeencryptarchivejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_QGPGMEENCRYPTARCHIVEJOB_H__
-#define __QGPGME_QGPGMEENCRYPTARCHIVEJOB_H__
-
-#include "encryptarchivejob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/encryptionresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEEncryptArchiveJob
-#ifdef Q_MOC_RUN
- : public EncryptArchiveJob
-#else
- : public _detail::ThreadedJobMixin<EncryptArchiveJob, std::tuple<GpgME::EncryptionResult, QString, GpgME::Error>>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEEncryptArchiveJob(GpgME::Context *context);
- ~QGpgMEEncryptArchiveJob() = default;
-
- GpgME::Error start(const std::vector<GpgME::Key> &recipients,
- const std::vector<QString> &paths,
- const std::shared_ptr<QIODevice> &cipherText,
- const GpgME::Context::EncryptionFlags flags) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEENCRYPTARCHIVEJOB_H__
diff --git a/lang/qt/src/qgpgmeencryptjob.cpp b/lang/qt/src/qgpgmeencryptjob.cpp
deleted file mode 100644
index c8dd5f1b..00000000
--- a/lang/qt/src/qgpgmeencryptjob.cpp
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- qgpgmeencryptjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- 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,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "qgpgmeencryptjob.h"
-
-#include "dataprovider.h"
-#include "encryptjob_p.h"
-#include "util.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/encryptionresult.h>
-
-#include <QBuffer>
-#include <QFileInfo>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEEncryptJobPrivate : public EncryptJobPrivate
-{
- QGpgMEEncryptJob *q = nullptr;
-
-public:
- QGpgMEEncryptJobPrivate(QGpgMEEncryptJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEEncryptJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMEEncryptJob::QGpgMEEncryptJob(Context *context)
- : mixin_type(context),
- mOutputIsBase64Encoded(false)
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEEncryptJobPrivate>{new QGpgMEEncryptJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMEEncryptJob::~QGpgMEEncryptJob() {}
-
-void QGpgMEEncryptJob::setOutputIsBase64Encoded(bool on)
-{
- mOutputIsBase64Encoded = on;
-}
-
-static QGpgMEEncryptJob::result_type encrypt(Context *ctx, QThread *thread,
- const std::vector<Key> &recipients,
- const std::weak_ptr<QIODevice> &plainText_,
- const std::weak_ptr<QIODevice> &cipherText_,
- const Context::EncryptionFlags eflags,
- bool outputIsBsse64Encoded,
- Data::Encoding inputEncoding,
- const QString &fileName)
-{
-
- const std::shared_ptr<QIODevice> plainText = plainText_.lock();
- const std::shared_ptr<QIODevice> cipherText = cipherText_.lock();
-
- const _detail::ToThreadMover ctMover(cipherText, thread);
- const _detail::ToThreadMover ptMover(plainText, thread);
-
- QGpgME::QIODeviceDataProvider in(plainText);
- Data indata(&in);
- indata.setEncoding(inputEncoding);
-
- if (!plainText->isSequential()) {
- indata.setSizeHint(plainText->size());
- }
-
- const auto pureFileName = QFileInfo{fileName}.fileName().toStdString();
- if (!pureFileName.empty()) {
- indata.setFileName(pureFileName.c_str());
- }
-
- if (!cipherText) {
- QGpgME::QByteArrayDataProvider out;
- Data outdata(&out);
-
- if (outputIsBsse64Encoded) {
- outdata.setEncoding(Data::Base64Encoding);
- }
-
- const EncryptionResult res = ctx->encrypt(recipients, indata, outdata, eflags);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, out.data(), log, ae);
- } else {
- QGpgME::QIODeviceDataProvider out(cipherText);
- Data outdata(&out);
-
- if (outputIsBsse64Encoded) {
- outdata.setEncoding(Data::Base64Encoding);
- }
-
- const EncryptionResult res = ctx->encrypt(recipients, indata, outdata, eflags);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, QByteArray(), log, ae);
- }
-
-}
-
-static QGpgMEEncryptJob::result_type encrypt_qba(Context *ctx, const std::vector<Key> &recipients, const QByteArray &plainText, const Context::EncryptionFlags eflags, bool outputIsBsse64Encoded, Data::Encoding inputEncoding, 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, inputEncoding, fileName);
-}
-
-static QGpgMEEncryptJob::result_type encrypt_to_filename(Context *ctx,
- const std::vector<Key> &recipients,
- const QString &inputFilePath,
- const QString &outputFilePath,
- Context::EncryptionFlags flags)
-{
- Data indata;
-#ifdef Q_OS_WIN
- indata.setFileName(inputFilePath.toUtf8().constData());
-#else
- indata.setFileName(QFile::encodeName(inputFilePath).constData());
-#endif
-
- PartialFileGuard partFileGuard{outputFilePath};
- if (partFileGuard.tempFileName().isEmpty()) {
- return std::make_tuple(EncryptionResult{Error::fromCode(GPG_ERR_EEXIST)}, QByteArray{}, QString{}, Error{});
- }
-
- Data outdata;
-#ifdef Q_OS_WIN
- outdata.setFileName(partFileGuard.tempFileName().toUtf8().constData());
-#else
- outdata.setFileName(QFile::encodeName(partFileGuard.tempFileName()).constData());
-#endif
-
- flags = static_cast<Context::EncryptionFlags>(flags | Context::EncryptFile);
- const auto encryptionResult = ctx->encrypt(recipients, indata, outdata, flags);
-
- if (!encryptionResult.error().code()) {
- // the operation succeeded -> save the result under the requested file name
- partFileGuard.commit();
- }
-
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(encryptionResult, QByteArray{}, log, ae);
-}
-
-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, inputEncoding(), fileName()));
- return Error();
-}
-
-void QGpgMEEncryptJob::start(const std::vector<Key> &recipients, const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &cipherText, const Context::EncryptionFlags eflags)
-{
- run(std::bind(&encrypt,
- std::placeholders::_1, std::placeholders::_2,
- recipients,
- std::placeholders::_3, std::placeholders::_4,
- eflags,
- mOutputIsBase64Encoded,
- inputEncoding(),
- 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, inputEncoding(), fileName());
- cipherText = std::get<1>(r);
- return std::get<0>(r);
-}
-
-void QGpgMEEncryptJob::start(const std::vector<Key> &recipients, const std::shared_ptr<QIODevice> &plainText, const std::shared_ptr<QIODevice> &cipherText, bool alwaysTrust)
-{
- return start(recipients, plainText, cipherText, alwaysTrust ? Context::AlwaysTrust : Context::None);
-}
-
-EncryptionResult QGpgMEEncryptJob::exec(const std::vector<Key> &recipients, const QByteArray &plainText, bool alwaysTrust, QByteArray &cipherText)
-{
- return exec(recipients, plainText, alwaysTrust ? Context::AlwaysTrust : Context::None, cipherText);
-}
-
-GpgME::Error QGpgMEEncryptJobPrivate::startIt()
-{
- if (m_inputFilePath.isEmpty() || m_outputFilePath.isEmpty()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return encrypt_to_filename(ctx, m_recipients, m_inputFilePath, m_outputFilePath, m_encryptionFlags);
- });
-
- return {};
-}
-
-#include "qgpgmeencryptjob.moc"
diff --git a/lang/qt/src/qgpgmeencryptjob.h b/lang/qt/src/qgpgmeencryptjob.h
deleted file mode 100644
index 4fcb0c69..00000000
--- a/lang/qt/src/qgpgmeencryptjob.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- qgpgmeencryptjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- 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
-
- 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_QGPGMEENCRYPTJOB_H__
-#define __QGPGME_QGPGMEENCRYPTJOB_H__
-
-#include "encryptjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/encryptionresult.h>
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-class QGpgMEEncryptJob
-#ifdef Q_MOC_RUN
- : public EncryptJob
-#else
- : public _detail::ThreadedJobMixin<EncryptJob, std::tuple<GpgME::EncryptionResult, QByteArray, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEEncryptJob(GpgME::Context *context);
- ~QGpgMEEncryptJob();
-
- /* from EncryptJob */
- GpgME::Error start(const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText, bool alwaysTrust) override;
-
- /* from EncryptJob */
- void start(const std::vector<GpgME::Key> &recipients,
- const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &cipherText,
- bool alwaysTrust) override;
-
- /* from EncryptJob */
- GpgME::EncryptionResult exec(const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText, bool alwaysTrust,
- QByteArray &cipherText) override;
- /* from EncryptJob */
- void start(const std::vector<GpgME::Key> &recipients,
- const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &cipherText,
- const GpgME::Context::EncryptionFlags flags) override;
-
- /* from EncryptJob */
- GpgME::EncryptionResult exec(const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText, const GpgME::Context::EncryptionFlags flags,
- QByteArray &cipherText) override;
-
- /* from EncryptJob */
- void setOutputIsBase64Encoded(bool on) override;
-
-private:
- bool mOutputIsBase64Encoded;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEENCRYPTJOB_H__
diff --git a/lang/qt/src/qgpgmeexportjob.cpp b/lang/qt/src/qgpgmeexportjob.cpp
deleted file mode 100644
index 239b46b0..00000000
--- a/lang/qt/src/qgpgmeexportjob.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- qgpgmeexportjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2022 by g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "qgpgmeexportjob.h"
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/key.h>
-
-#include <QStringList>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEExportJob::QGpgMEExportJob(Context *context)
- : QGpgMEExportJob{context, 0}
-{
-}
-
-QGpgMEExportJob::QGpgMEExportJob(Context *context, unsigned int forcedMode)
- : mixin_type{context}
- , m_exportMode{forcedMode}
- , m_additionalExportModeFlags{0}
-{
- lateInitialization();
-}
-
-QGpgMEExportJob::~QGpgMEExportJob() = default;
-
-static QGpgMEExportJob::result_type export_qba(Context *ctx, const QStringList &patterns, unsigned int mode)
-{
- const _detail::PatternConverter pc(patterns);
-
- QGpgME::QByteArrayDataProvider dp;
- Data data(&dp);
-
- const Error err = ctx->exportKeys(pc.patterns(), data, mode);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, dp.data(), log, ae);
-}
-
-Error QGpgMEExportJob::start(const QStringList &patterns)
-{
- auto mode = m_exportMode | m_additionalExportModeFlags;
- run(std::bind(&export_qba, std::placeholders::_1, patterns, mode));
- return Error();
-}
-
-Error QGpgMEExportJob::exec(const QStringList &patterns, QByteArray &data)
-{
- auto mode = m_exportMode | m_additionalExportModeFlags;
- const result_type r = export_qba(context(), patterns, mode);
- data = std::get<1>(r);
- return std::get<0>(r);
-}
-
-void QGpgMEExportJob::setExportFlags(unsigned int flags)
-{
- m_additionalExportModeFlags = flags;
-}
-
-/* For ABI compat not pure virtual. */
-void ExportJob::setExportFlags(unsigned int)
-{
-}
-
-/* For ABI compat not pure virtual. */
-GpgME::Error ExportJob::exec(const QStringList &, QByteArray &)
-{
- return Error();
-}
-
-#include "qgpgmeexportjob.moc"
diff --git a/lang/qt/src/qgpgmeexportjob.h b/lang/qt/src/qgpgmeexportjob.h
deleted file mode 100644
index b60b95f2..00000000
--- a/lang/qt/src/qgpgmeexportjob.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- qgpgmeexportjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2022 by g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_QGPGMEEXPORTJOB_H__
-#define __QGPGME_QGPGMEEXPORTJOB_H__
-
-#include "exportjob.h"
-
-#include "threadedjobmixin.h"
-
-namespace QGpgME
-{
-
-class QGpgMEExportJob
-#ifdef Q_MOC_RUN
- : public ExportJob
-#else
- : public _detail::ThreadedJobMixin<ExportJob, std::tuple<GpgME::Error, QByteArray, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEExportJob(GpgME::Context *context);
- // Creates an export job with forced export mode @p exportMode. The
- // export mode flags set with @p exportMode cannot be overridden with
- // setExportFlags.
- explicit QGpgMEExportJob(GpgME::Context *context, unsigned int exportMode);
- ~QGpgMEExportJob() override;
-
- /* from ExportJob */
- void setExportFlags(unsigned int flags) override;
-
- /* from ExportJob */
- GpgME::Error start(const QStringList &patterns) override;
- GpgME::Error exec(const QStringList &patterns, QByteArray &data) override;
-
-private:
- unsigned int m_exportMode;
- unsigned int m_additionalExportModeFlags;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEEXPORTJOB_H__
diff --git a/lang/qt/src/qgpgmegpgcardjob.cpp b/lang/qt/src/qgpgmegpgcardjob.cpp
deleted file mode 100644
index 2bed23c2..00000000
--- a/lang/qt/src/qgpgmegpgcardjob.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- qgpgmegpgcardjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2020 g10 Code 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 "qgpgmegpgcardjob.h"
-
-#include <QStringList>
-#include <QFileInfo>
-#include <QDir>
-#include <QProcess>
-#include "util.h"
-#include "qgpgme_debug.h"
-
-/* We cannot have a timeout because key generation can
- * take ages. Well maybe 10 minutes. */
-#define TIMEOUT_VALUE (600000)
-
-#include <tuple>
-
-using namespace GpgME;
-using namespace QGpgME;
-
-QGpgMEGpgCardJob::QGpgMEGpgCardJob()
- : mixin_type(/* needed for the mixer */
- Context::createForEngine(GpgME::SpawnEngine).release())
-{
- lateInitialization();
-}
-
-QGpgMEGpgCardJob::~QGpgMEGpgCardJob() {}
-
-static QString getGpgCardPath()
-{
- auto bindir = QString::fromLocal8Bit(dirInfo("bindir"));
- if (bindir.isEmpty()) {
- return QString();
- }
-
- const QFileInfo fi(QDir(bindir).absoluteFilePath(QStringLiteral("gpg-card")));
- if (fi.exists() && fi.isExecutable()) {
- return fi.absoluteFilePath();
- }
- return QString();
-}
-
-static QGpgMEGpgCardJob::result_type do_work(const QStringList &cmds, const QString &path)
-{
- QStringList args;
- args << QStringLiteral("--with-colons");
- args += cmds;
-
- QProcess proc;
-
- proc.setProgram(path);
- proc.setArguments(args);
-
- qCDebug(QGPGME_LOG) << "Executing:" << path << args;
- proc.start();
- if (!proc.waitForStarted()) {
- return std::make_tuple (QString(), QString(), 1, QString(), Error());
- }
-
- if (!proc.waitForFinished(TIMEOUT_VALUE)) {
- return std::make_tuple (QString(), QString(), 1, QString(), Error());
- }
- if (proc.exitStatus() == QProcess::NormalExit) {
- return std::make_tuple (QString::fromUtf8(proc.readAllStandardOutput()),
- QString::fromUtf8(proc.readAllStandardError()), proc.exitCode(),
- QString(), Error());
- }
- return std::make_tuple (QString::fromUtf8(proc.readAllStandardOutput()),
- QString::fromUtf8(proc.readAllStandardError()), 1,
- QString(), Error());
-}
-
-Error QGpgMEGpgCardJob::start(const QStringList &cmds)
-{
- const auto cardpath = getGpgCardPath ();
- if (cardpath.isEmpty()) {
- return Error(make_error(GPG_ERR_NOT_SUPPORTED));
- }
- run(std::bind(&do_work, cmds, cardpath));
- return Error();
-}
-
-Error QGpgMEGpgCardJob::exec(const QStringList &cmds, QString &std_out, QString &std_err, int &exitCode)
-{
- const auto cardpath = getGpgCardPath ();
- if (cardpath.isEmpty()) {
- return Error(make_error(GPG_ERR_NOT_SUPPORTED));
- }
- const result_type r = do_work(cmds, cardpath);
- std_out = std::get<0>(r);
- std_err = std::get<1>(r);
- exitCode = std::get<2>(r);
- return exitCode == 0 ? Error() : Error(make_error(GPG_ERR_GENERAL));
-}
-
-#include "qgpgmegpgcardjob.moc"
diff --git a/lang/qt/src/qgpgmegpgcardjob.h b/lang/qt/src/qgpgmegpgcardjob.h
deleted file mode 100644
index c78c0ee5..00000000
--- a/lang/qt/src/qgpgmegpgcardjob.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* qgpgmegpgcardjob.h
-
- This file is part of libkleopatra, the KDE keymanagement library
- Copyright (c) 2020 g10 Code 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_QGPGMEGPGCARDJOB_H__
-#define __QGPGME_QGPGMEGPGCARDJOB_H__
-#include "gpgcardjob.h"
-
-#include "threadedjobmixin.h"
-
-namespace QGpgME
-{
-
-class QGpgMEGpgCardJob
-#ifdef Q_MOC_RUN
- : public GpgCardJob
-#else
- : public _detail::ThreadedJobMixin<GpgCardJob, std::tuple<QString, QString, int, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEGpgCardJob();
- ~QGpgMEGpgCardJob();
-
- GpgME::Error start(const QStringList &cmds) override;
-
- GpgME::Error exec(const QStringList &cmds, QString &std_out, QString &std_err, int &exitCode) override;
-};
-
-}
-#endif
diff --git a/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp b/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp
deleted file mode 100644
index e5e06b23..00000000
--- a/lang/qt/src/qgpgmeimportfromkeyserverjob.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- qgpgmeimportfromkeyserverjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "qgpgmeimportfromkeyserverjob.h"
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/key.h>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEImportFromKeyserverJob::QGpgMEImportFromKeyserverJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMEImportFromKeyserverJob::~QGpgMEImportFromKeyserverJob() {}
-
-static QGpgMEImportFromKeyserverJob::result_type importfromkeyserver(Context *ctx, const std::vector<Key> &keys)
-{
- const ImportResult res = ctx->importKeys(keys);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, log, ae);
-}
-
-Error QGpgMEImportFromKeyserverJob::start(const std::vector<Key> &keys)
-{
- run(std::bind(&importfromkeyserver, std::placeholders::_1, keys));
- return Error();
-}
-
-GpgME::ImportResult QGpgME::QGpgMEImportFromKeyserverJob::exec(const std::vector<Key> &keys)
-{
- const result_type r = importfromkeyserver(context(), keys);
- return std::get<0>(r);
-}
-
-#include "qgpgmeimportfromkeyserverjob.moc"
diff --git a/lang/qt/src/qgpgmeimportfromkeyserverjob.h b/lang/qt/src/qgpgmeimportfromkeyserverjob.h
deleted file mode 100644
index 917863ed..00000000
--- a/lang/qt/src/qgpgmeimportfromkeyserverjob.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- qgpgmeimportfromkeyserverjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_QGPGMEIMPORTFROMKEYSERVERJOB_H__
-#define __QGPGME_QGPGMEIMPORTFROMKEYSERVERJOB_H__
-
-#include "importfromkeyserverjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/importresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEImportFromKeyserverJob
-#ifdef Q_MOC_RUN
- : public ImportFromKeyserverJob
-#else
- : public _detail::ThreadedJobMixin<ImportFromKeyserverJob, std::tuple<GpgME::ImportResult, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEImportFromKeyserverJob(GpgME::Context *context);
- ~QGpgMEImportFromKeyserverJob();
-
- /* from ImportFromKeyserverJob */
- GpgME::Error start(const std::vector<GpgME::Key> &keys) override;
-
- /* from ImportFromKeyserverJob */
- GpgME::ImportResult exec(const std::vector<GpgME::Key> &keys) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEIMPORTFROMKEYSERVERJOB_H__
diff --git a/lang/qt/src/qgpgmeimportjob.cpp b/lang/qt/src/qgpgmeimportjob.cpp
deleted file mode 100644
index 7c33288d..00000000
--- a/lang/qt/src/qgpgmeimportjob.cpp
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- qgpgmeimportjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "qgpgmeimportjob.h"
-
-#include "importjob_p.h"
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/key.h>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEImportJobPrivate : public ImportJobPrivate
-{
- QGpgMEImportJob *q = nullptr;
-
-public:
- QGpgMEImportJobPrivate(QGpgMEImportJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEImportJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override
- {
- Q_ASSERT(!"Not supported by this Job class.");
- return Error::fromCode(GPG_ERR_NOT_SUPPORTED);
- }
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMEImportJob::QGpgMEImportJob(Context *context)
- : mixin_type(context)
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEImportJobPrivate>{new QGpgMEImportJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMEImportJob::~QGpgMEImportJob() = default;
-
-static const char *originToString(Key::Origin origin)
-{
- static const std::map<Key::Origin, const char *> mapping = {
- { Key::OriginUnknown, "unknown" },
- { Key::OriginKS, "ks" },
- { Key::OriginDane, "dane" },
- { Key::OriginWKD, "wkd" },
- { Key::OriginURL, "url" },
- { Key::OriginFile, "file" },
- { Key::OriginSelf, "self" },
- };
- const auto it = mapping.find(origin);
- return (it != std::end(mapping)) ? it->second : nullptr;
-}
-
-static QGpgMEImportJob::result_type import_qba(Context *ctx, const QByteArray &certData, const QString &importFilter,
- const QStringList &importOptions, Key::Origin keyOrigin,
- const QString &keyOriginUrl)
-{
- if (!importFilter.isEmpty()) {
- ctx->setFlag("import-filter", importFilter.toStdString().c_str());
- }
- if (!importOptions.empty()) {
- ctx->setFlag("import-options", importOptions.join(QLatin1Char{','}).toStdString().c_str());
- }
- if (keyOrigin != Key::OriginUnknown) {
- if (const auto origin = originToString(keyOrigin)) {
- std::string value{origin};
- if (!keyOriginUrl.isEmpty()) {
- value += ",";
- value += keyOriginUrl.toStdString();
- }
- ctx->setFlag("key-origin", value.c_str());
- }
- }
-
- QGpgME::QByteArrayDataProvider dp(certData);
- Data data(&dp);
-
- ImportResult res = ctx->importKeys(data);
- // HACK: If the import failed with an error, then check if res.imports()
- // contains only import statuses with "bad passphrase" error; if yes, this
- // means that the user probably entered a wrong password to decrypt an
- // encrypted key for import. In this case, return a result with "bad
- // passphrase" error instead of the original error.
- // We check if all import statuses instead of any import status has a
- // "bad passphrase" error to avoid breaking imports that partially worked.
- // See https://dev.gnupg.org/T5713.
- const auto imports = res.imports();
- if (res.error() && !imports.empty()
- && std::all_of(std::begin(imports), std::end(imports),
- [](const Import &import) {
- return import.error().code() == GPG_ERR_BAD_PASSPHRASE;
- })) {
- res = ImportResult{Error{GPG_ERR_BAD_PASSPHRASE}};
- }
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, log, ae);
-}
-
-Error QGpgMEImportJob::start(const QByteArray &certData)
-{
- run(std::bind(&import_qba, std::placeholders::_1, certData, importFilter(), importOptions(), keyOrigin(), keyOriginUrl()));
- return Error();
-}
-
-GpgME::ImportResult QGpgME::QGpgMEImportJob::exec(const QByteArray &keyData)
-{
- const result_type r = import_qba(context(), keyData, importFilter(), importOptions(), keyOrigin(), keyOriginUrl());
- return std::get<0>(r);
-}
-
-Error QGpgMEImportJob::startLater(const QByteArray &certData)
-{
- setWorkerFunction(std::bind(&import_qba, std::placeholders::_1, certData, importFilter(), importOptions(), keyOrigin(), keyOriginUrl()));
- return {};
-}
-
-#include "qgpgmeimportjob.moc"
diff --git a/lang/qt/src/qgpgmeimportjob.h b/lang/qt/src/qgpgmeimportjob.h
deleted file mode 100644
index d36fc359..00000000
--- a/lang/qt/src/qgpgmeimportjob.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- qgpgmeimportjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_QGPGMEIMPORTJOB_H__
-#define __QGPGME_QGPGMEIMPORTJOB_H__
-
-#include "importjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/importresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEImportJob
-#ifdef Q_MOC_RUN
- : public ImportJob
-#else
- : public _detail::ThreadedJobMixin<ImportJob, std::tuple<GpgME::ImportResult, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEImportJob(GpgME::Context *context);
- ~QGpgMEImportJob();
-
- /* from ImportJob */
- GpgME::Error start(const QByteArray &keyData) override;
-
- /* from ImportJob */
- GpgME::ImportResult exec(const QByteArray &keyData) override;
-
- GpgME::Error startLater(const QByteArray &keyData) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEIMPORTJOB_H__
diff --git a/lang/qt/src/qgpgmekeyformailboxjob.cpp b/lang/qt/src/qgpgmekeyformailboxjob.cpp
deleted file mode 100644
index dca22426..00000000
--- a/lang/qt/src/qgpgmekeyformailboxjob.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- qgpgmekeyformailboxjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "qgpgmekeyformailboxjob.h"
-#include "qgpgmekeylistjob.h"
-
-#include <QStringList>
-
-#include <tuple>
-
-using namespace GpgME;
-using namespace QGpgME;
-
-QGpgMEKeyForMailboxJob::QGpgMEKeyForMailboxJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMEKeyForMailboxJob::~QGpgMEKeyForMailboxJob() {}
-
-static bool keyIsOk(const Key k)
-{
- return !k.isExpired() && !k.isRevoked() && !k.isInvalid() && !k.isDisabled();
-}
-
-static bool uidIsOk(const UserID uid)
-{
- return keyIsOk(uid.parent()) && !uid.isRevoked() && !uid.isInvalid();
-}
-
-static bool subkeyIsOk(const Subkey s)
-{
- return !s.isRevoked() && !s.isInvalid() && !s.isDisabled();
-}
-
-static QGpgMEKeyForMailboxJob::result_type do_work(Context *ctx, const QString &mailbox, bool canEncrypt)
-{
- /* Do a Keylisting. */
- ctx->setKeyListMode(GpgME::Locate | GpgME::Signatures | GpgME::Validate);
- std::vector<Key> keys;
- QGpgMEKeyListJob *keylist = new QGpgMEKeyListJob(ctx);
-
- KeyListResult result = keylist->exec(QStringList() << mailbox, false, keys);
-
- if (result.error()) {
- return std::make_tuple(result, Key(), UserID(), QString(), Error());
- }
-
- // This should ideally be decided by GnuPG and this Job changed
- // to just call the according API in GpgME
- // See: https://bugs.gnupg.org/gnupg/issue2359
- Key keyC;
- UserID uidC;
- for (const Key &k : keys) {
- if (canEncrypt && !k.canEncrypt()) {
- continue;
- }
- /* First get the uid that matches the mailbox */
- for (const UserID &u : k.userIDs()) {
- if (QString::fromUtf8(u.email()).toLower() == mailbox.toLower()) {
- if (uidC.isNull()) {
- keyC = k;
- uidC = u;
- } else if ((!uidIsOk(uidC) && uidIsOk(u)) || uidC.validity() < u.validity()) {
- /* Validity of the new key is better. */
- uidC = u;
- keyC = k;
- } else if (uidC.validity() == u.validity() && uidIsOk(u)) {
- /* Both are the same check which one is newer. */
- time_t oldTime = 0;
- for (const Subkey &s : keyC.subkeys()) {
- if ((canEncrypt && s.canEncrypt()) && subkeyIsOk(s)) {
- oldTime = s.creationTime();
- }
- }
- time_t newTime = 0;
- for (const Subkey &s : k.subkeys()) {
- if ((canEncrypt && s.canEncrypt()) && subkeyIsOk(s)) {
- newTime = s.creationTime();
- }
- }
- if (newTime > oldTime) {
- uidC = u;
- keyC = k;
- }
- }
- }
- }
- }
- return std::make_tuple(result, keyC, uidC, QString(), Error());
-}
-
-Error QGpgMEKeyForMailboxJob::start(const QString &mailbox, bool canEncrypt)
-{
- run(std::bind(&do_work, std::placeholders::_1, mailbox, canEncrypt));
- return Error();
-}
-
-KeyListResult QGpgMEKeyForMailboxJob::exec(const QString &mailbox, bool canEncrypt, Key &key, UserID &uid)
-{
- const result_type r = do_work(context(), mailbox, canEncrypt);
- key = std::get<1>(r);
- uid = std::get<2>(r);
- return std::get<0>(r);
-}
-
-#include "qgpgmekeyformailboxjob.moc"
diff --git a/lang/qt/src/qgpgmekeyformailboxjob.h b/lang/qt/src/qgpgmekeyformailboxjob.h
deleted file mode 100644
index 0e8cc1dc..00000000
--- a/lang/qt/src/qgpgmekeyformailboxjob.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- qgpgmekeyformailboxjob.h
-
- This file is part of libkleopatra, the KDE keymanagement library
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_QGPGMEKEYFORMAILBOXJOB_H__
-#define __QGPGME_QGPGMEKEYFORMAILBOXJOB_H__
-#include "keyformailboxjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/keylistresult.h>
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-class QGpgMEKeyForMailboxJob
-#ifdef Q_MOC_RUN
- : public KeyForMailboxJob
-#else
- : public _detail::ThreadedJobMixin<KeyForMailboxJob, std::tuple<GpgME::KeyListResult, GpgME::Key, GpgME::UserID, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEKeyForMailboxJob(GpgME::Context *context);
- ~QGpgMEKeyForMailboxJob();
-
- /**
- Starts the operation. \a mailbox is the mailbox to
- look for.
-
- The result is the same as for the LocateKeysJob.
-
- If \a canEncrypt is true, only keys that have a subkey for encryption
- usage are returned. Use this if you need to select a
- key for signing.
- */
- GpgME::Error start(const QString &mailbox, bool canEncrypt = true) override;
-
- GpgME::KeyListResult exec(const QString &mailbox, bool canEncrypt, GpgME::Key &key, GpgME::UserID &uid) override;
-};
-
-}
-#endif
diff --git a/lang/qt/src/qgpgmekeygenerationjob.cpp b/lang/qt/src/qgpgmekeygenerationjob.cpp
deleted file mode 100644
index ce0b4d40..00000000
--- a/lang/qt/src/qgpgmekeygenerationjob.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- qgpgmekeygenerationjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "qgpgmekeygenerationjob.h"
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEKeyGenerationJob::QGpgMEKeyGenerationJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMEKeyGenerationJob::~QGpgMEKeyGenerationJob() {}
-
-static QGpgMEKeyGenerationJob::result_type generate_key(Context *ctx, const QString &parameters)
-{
- QGpgME::QByteArrayDataProvider dp;
- Data data = ctx->protocol() == CMS ? Data(&dp) : Data(Data::null);
- assert(data.isNull() == (ctx->protocol() != CMS));
-
- const KeyGenerationResult res = ctx->generateKey(parameters.toUtf8().constData(), data);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, dp.data(), log, ae);
-}
-
-Error QGpgMEKeyGenerationJob::start(const QString &parameters)
-{
- run(std::bind(&generate_key, std::placeholders::_1, parameters));
- return Error();
-}
-#include "qgpgmekeygenerationjob.moc"
diff --git a/lang/qt/src/qgpgmekeygenerationjob.h b/lang/qt/src/qgpgmekeygenerationjob.h
deleted file mode 100644
index 35d5c2f4..00000000
--- a/lang/qt/src/qgpgmekeygenerationjob.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- qgpgmekeygenerationjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_QGPGMEKEYGENERATIONJOB_H__
-#define __QGPGME_QGPGMEKEYGENERATIONJOB_H__
-
-#include "keygenerationjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/keygenerationresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEKeyGenerationJob
-#ifdef Q_MOC_RUN
- : public KeyGenerationJob
-#else
- : public _detail::ThreadedJobMixin<KeyGenerationJob, std::tuple<GpgME::KeyGenerationResult, QByteArray, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-private Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEKeyGenerationJob(GpgME::Context *context);
- ~QGpgMEKeyGenerationJob();
-
- /* from KeygenerationJob */
- GpgME::Error start(const QString &parameters) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEKEYGENERATIONJOB_H__
diff --git a/lang/qt/src/qgpgmekeylistjob.cpp b/lang/qt/src/qgpgmekeylistjob.cpp
deleted file mode 100644
index 633cff5b..00000000
--- a/lang/qt/src/qgpgmekeylistjob.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- qgpgmekeylistjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "qgpgmekeylistjob.h"
-
-#include <gpgme++/key.h>
-#include <gpgme++/context.h>
-#include <gpgme++/keylistresult.h>
-#include <gpg-error.h>
-
-#include <QStringList>
-
-#include <algorithm>
-
-#include <cstdlib>
-#include <cstring>
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEKeyListJob::QGpgMEKeyListJob(Context *context)
- : mixin_type(context)
- , mSecretOnly(false)
-{
- lateInitialization();
-}
-
-QGpgMEKeyListJob::~QGpgMEKeyListJob() {}
-
-static KeyListResult do_list_keys(Context *ctx, const QStringList &pats, std::vector<Key> &keys, bool secretOnly)
-{
-
- const _detail::PatternConverter pc(pats);
-
- if (const Error err = ctx->startKeyListing(pc.patterns(), secretOnly)) {
- return KeyListResult(nullptr, err);
- }
-
- Error err;
- do {
- keys.push_back(ctx->nextKey(err));
- } while (!err);
-
- keys.pop_back();
-
- const KeyListResult result = ctx->endKeyListing();
- ctx->cancelPendingOperation();
- return result;
-}
-
-static QGpgMEKeyListJob::result_type list_keys(Context *ctx, QStringList pats, bool secretOnly)
-{
- if (pats.size() < 2) {
- std::vector<Key> keys;
- const KeyListResult r = do_list_keys(ctx, pats, keys, secretOnly);
- return std::make_tuple(r, keys, QString(), Error());
- }
-
- // The communication channel between gpgme and gpgsm is limited in
- // the number of patterns that can be transported, but they won't
- // say to how much, so we need to find out ourselves if we get a
- // LINE_TOO_LONG error back...
-
- // We could of course just feed them single patterns, and that would
- // probably be easier, but the performance penalty would currently
- // be noticeable.
-
- unsigned int chunkSize = pats.size();
-retry:
- std::vector<Key> keys;
- keys.reserve(pats.size());
- KeyListResult result;
- do {
- const KeyListResult this_result = do_list_keys(ctx, pats.mid(0, chunkSize), keys, secretOnly);
- if (this_result.error().code() == GPG_ERR_LINE_TOO_LONG) {
- // got LINE_TOO_LONG, try a smaller chunksize:
- chunkSize /= 2;
- if (chunkSize < 1)
- // chunks smaller than one can't be -> return the error.
- {
- return std::make_tuple(this_result, keys, QString(), Error());
- } else {
- goto retry;
- }
- } else if (this_result.error().code() == GPG_ERR_EOF) {
- // early end of keylisting (can happen when ~/.gnupg doesn't
- // exist). Fakeing an empty result:
- return std::make_tuple(KeyListResult(), std::vector<Key>(), QString(), Error());
- }
- // ok, that seemed to work...
- result.mergeWith(this_result);
- if (result.error().code()) {
- break;
- }
- pats = pats.mid(chunkSize);
- } while (!pats.empty());
- return std::make_tuple(result, keys, QString(), Error());
-}
-
-Error QGpgMEKeyListJob::start(const QStringList &patterns, bool secretOnly)
-{
- mSecretOnly = secretOnly;
- run(std::bind(&list_keys, std::placeholders::_1, patterns, secretOnly));
- return Error();
-}
-
-KeyListResult QGpgMEKeyListJob::exec(const QStringList &patterns, bool secretOnly, std::vector<Key> &keys)
-{
- mSecretOnly = secretOnly;
- const result_type r = list_keys(context(), patterns, secretOnly);
- resultHook(r);
- keys = std::get<1>(r);
- return std::get<0>(r);
-}
-
-void QGpgMEKeyListJob::resultHook(const result_type &tuple)
-{
- for (const Key &key : std::get<1>(tuple)) {
- Q_EMIT nextKey(key);
- }
-}
-
-void QGpgMEKeyListJob::addMode(KeyListMode mode)
-{
- context()->addKeyListMode(mode);
-}
-
-#include "qgpgmekeylistjob.moc"
diff --git a/lang/qt/src/qgpgmekeylistjob.h b/lang/qt/src/qgpgmekeylistjob.h
deleted file mode 100644
index c1199768..00000000
--- a/lang/qt/src/qgpgmekeylistjob.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- qgpgmekeylistjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_QGPGMEKEYLISTJOB_H__
-#define __QGPGME_QGPGMEKEYLISTJOB_H__
-
-#include "keylistjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/keylistresult.h>
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-class QGpgMEKeyListJob
-#ifdef Q_MOC_RUN
- : public KeyListJob
-#else
- : public _detail::ThreadedJobMixin<KeyListJob, std::tuple<GpgME::KeyListResult, std::vector<GpgME::Key>, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEKeyListJob(GpgME::Context *context);
- ~QGpgMEKeyListJob();
-
- /* from KeyListJob */
- GpgME::Error start(const QStringList &patterns, bool secretOnly) override;
-
- /* from KeyListJob */
- GpgME::KeyListResult exec(const QStringList &patterns, bool secretOnly, std::vector<GpgME::Key> &keys) override;
-
- void addMode(GpgME::KeyListMode mode) override;
-
- /* from ThreadedJobMixin */
- void resultHook(const result_type &result) override;
-private:
- bool mSecretOnly;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEKEYLISTJOB_H__
diff --git a/lang/qt/src/qgpgmelistallkeysjob.cpp b/lang/qt/src/qgpgmelistallkeysjob.cpp
deleted file mode 100644
index ab9f1f42..00000000
--- a/lang/qt/src/qgpgmelistallkeysjob.cpp
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- qgpgmelistallkeysjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2022,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "qgpgmelistallkeysjob.h"
-
-#include "listallkeysjob_p.h"
-
-#include "debug.h"
-#include <gpgme++/key.h>
-#include <gpgme++/context.h>
-#include <gpgme++/engineinfo.h>
-#include <gpgme++/global.h>
-#include <gpgme++/keylistresult.h>
-#include "qgpgme_debug.h"
-
-#include <gpg-error.h>
-
-#include <algorithm>
-
-#include <cstdlib>
-#include <cstring>
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEListAllKeysJobPrivate : public ListAllKeysJobPrivate
-{
- QGpgMEListAllKeysJob *q = nullptr;
-
-public:
- QGpgMEListAllKeysJobPrivate(QGpgMEListAllKeysJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEListAllKeysJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override
- {
- Q_ASSERT(!"Not supported by this Job class.");
- return Error::fromCode(GPG_ERR_NOT_SUPPORTED);
- }
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMEListAllKeysJob::QGpgMEListAllKeysJob(Context *context)
- : mixin_type(context)
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEListAllKeysJobPrivate>{new QGpgMEListAllKeysJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMEListAllKeysJob::~QGpgMEListAllKeysJob() {}
-
-namespace {
-
-static KeyListResult do_list_keys_legacy(Context *ctx, std::vector<Key> &keys, bool secretOnly)
-{
-
- const char **pat = nullptr;
- if (const Error err = ctx->startKeyListing(pat, secretOnly)) {
- return KeyListResult(nullptr, err);
- }
-
- Error err;
- do {
- keys.push_back(ctx->nextKey(err));
- } while (!err);
-
- keys.pop_back();
-
- const KeyListResult result = ctx->endKeyListing();
- ctx->cancelPendingOperation();
- return result;
-}
-
-template <typename ForwardIterator, typename BinaryPredicate>
-ForwardIterator unique_by_merge(ForwardIterator first, ForwardIterator last, BinaryPredicate pred)
-{
- first = std::adjacent_find(first, last, pred);
- if (first == last) {
- return last;
- }
-
- ForwardIterator dest = first;
- dest->mergeWith(*++first);
- while (++first != last)
- if (pred(*dest, *first)) {
- dest->mergeWith(*first);
- } else {
- *++dest = *first;
- }
- return ++dest;
-}
-
-static void merge_keys(std::vector<Key> &merged, std::vector<Key> &pub, std::vector<Key> &sec)
-{
- merged.reserve(pub.size() + sec.size());
-
- std::merge(pub.begin(), pub.end(),
- sec.begin(), sec.end(),
- std::back_inserter(merged),
- ByFingerprint<std::less>());
-
- merged.erase(unique_by_merge(merged.begin(), merged.end(), ByFingerprint<std::equal_to>()),
- merged.end());
-}
-
-static QGpgMEListAllKeysJob::result_type list_keys_legacy(Context *ctx, bool mergeKeys)
-{
- std::vector<Key> pub, sec, merged;
- KeyListResult r;
-
- r.mergeWith(do_list_keys_legacy(ctx, pub, false));
- std::sort(pub.begin(), pub.end(), ByFingerprint<std::less>());
-
- r.mergeWith(do_list_keys_legacy(ctx, sec, true));
- std::sort(sec.begin(), sec.end(), ByFingerprint<std::less>());
-
- if (mergeKeys) {
- merge_keys(merged, pub, sec);
- } else {
- merged.swap(pub);
- }
- return std::make_tuple(r, merged, sec, QString(), Error());
-}
-
-static KeyListResult do_list_keys(Context *ctx, std::vector<Key> &keys)
-{
- const unsigned int keyListMode = ctx->keyListMode();
- ctx->addKeyListMode(KeyListMode::WithSecret);
-
- const char **pat = nullptr;
- if (const Error err = ctx->startKeyListing(pat)) {
- ctx->setKeyListMode(keyListMode);
- return KeyListResult(nullptr, err);
- }
-
- Error err;
- do {
- keys.push_back(ctx->nextKey(err));
- } while (!err);
-
- keys.pop_back();
-
- const KeyListResult result = ctx->endKeyListing();
- ctx->setKeyListMode(keyListMode);
-
- ctx->cancelPendingOperation();
- return result;
-}
-
-static QGpgMEListAllKeysJob::result_type list_keys(Context *ctx, bool mergeKeys, ListAllKeysJob::Options options)
-{
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.0") {
- return list_keys_legacy(ctx, mergeKeys);
- }
-
- if (options & ListAllKeysJob::DisableAutomaticTrustDatabaseCheck) {
- auto err = ctx->setFlag("no-auto-check-trustdb", "1");
- if (err) {
- // ignore error, but log a warning
- qCWarning(QGPGME_LOG) << "Setting context flag no-auto-check-trustdb failed:" << err;
- }
- }
-
- std::vector<Key> keys;
- KeyListResult r = do_list_keys(ctx, keys);
- std::sort(keys.begin(), keys.end(), ByFingerprint<std::less>());
-
- std::vector<Key> sec;
- std::copy_if(keys.begin(), keys.end(), std::back_inserter(sec), [](const Key &key) { return key.hasSecret(); });
-
- return std::make_tuple(r, keys, sec, QString(), Error());
-}
-
-}
-
-Error QGpgMEListAllKeysJob::start(bool mergeKeys)
-{
- run(std::bind(&list_keys, std::placeholders::_1, mergeKeys, options()));
- return Error();
-}
-
-KeyListResult QGpgMEListAllKeysJob::exec(std::vector<Key> &pub, std::vector<Key> &sec, bool mergeKeys)
-{
- const result_type r = list_keys(context(), mergeKeys, options());
- pub = std::get<1>(r);
- sec = std::get<2>(r);
- return std::get<0>(r);
-}
-
-#include "qgpgmelistallkeysjob.moc"
diff --git a/lang/qt/src/qgpgmelistallkeysjob.h b/lang/qt/src/qgpgmelistallkeysjob.h
deleted file mode 100644
index 93686a4b..00000000
--- a/lang/qt/src/qgpgmelistallkeysjob.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- qgpgmelistallkeysjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004,2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_QGPGMELISTALLKEYSJOB_H__
-#define __QGPGME_QGPGMELISTALLKEYSJOB_H__
-
-#include "listallkeysjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/keylistresult.h>
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-class QGpgMEListAllKeysJob
-#ifdef Q_MOC_RUN
- : public ListAllKeysJob
-#else
- : public _detail::ThreadedJobMixin<ListAllKeysJob, std::tuple<GpgME::KeyListResult, std::vector<GpgME::Key>, std::vector<GpgME::Key>, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEListAllKeysJob(GpgME::Context *context);
- ~QGpgMEListAllKeysJob();
-
- /* from ListAllKeysJob */
- GpgME::Error start(bool mergeKeys) override;
-
- /* from ListAllKeysJob */
- GpgME::KeyListResult exec(std::vector<GpgME::Key> &pub, std::vector<GpgME::Key> &sec, bool mergeKeys) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMELISTALLKEYSJOB_H__
diff --git a/lang/qt/src/qgpgmenewcryptoconfig.cpp b/lang/qt/src/qgpgmenewcryptoconfig.cpp
deleted file mode 100644
index a4782d2f..00000000
--- a/lang/qt/src/qgpgmenewcryptoconfig.cpp
+++ /dev/null
@@ -1,819 +0,0 @@
-/*
- qgpgmenewcryptoconfig.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2010 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "qgpgmenewcryptoconfig.h"
-
-#include <QDebug>
-#include "qgpgme_debug.h"
-
-#include <QFile>
-#include <QDir>
-#include <QList>
-
-#include <gpgme++/global.h>
-#include <gpgme++/error.h>
-#include "debug.h"
-
-#include <sstream>
-#include <string>
-#include <functional>
-#include <cassert>
-#include <functional>
-
-using namespace QGpgME;
-using namespace GpgME;
-using namespace GpgME::Configuration;
-
-// Just for the Q_ASSERT in the dtor. Not thread-safe, but who would
-// have 2 threads talking to gpgconf anyway? :)
-static bool s_duringClear = false;
-
-QGpgMENewCryptoConfig::QGpgMENewCryptoConfig()
- : m_parsed(false)
-{
-}
-
-QGpgMENewCryptoConfig::~QGpgMENewCryptoConfig()
-{
- clear();
-}
-
-void QGpgMENewCryptoConfig::reloadConfiguration(bool)
-{
- clear();
-
- Error error;
- const std::vector<Component> components = Component::load(error);
-#ifndef NDEBUG
- {
- std::stringstream ss;
- ss << "error: " << error
- << "components:\n";
- std::copy(components.begin(), components.end(),
- std::ostream_iterator<Component>(ss, "\n"));
- qCDebug(QGPGME_CONFIG_LOADING_LOG) << ss.str().c_str();
- }
-#endif
-#if 0
- TODO port?
- if (error && showErrors) {
- const QString wmsg = i18n("<qt>Failed to execute gpgconf:<p>%1</p></qt>", QString::fromLocal8Bit(error.asString()));
- qCWarning(QGPGME_LOG) << wmsg; // to see it from test_cryptoconfig.cpp
- KMessageBox::error(0, wmsg);
- }
-#endif
- for (const Component &c : components) {
- const std::shared_ptr<QGpgMENewCryptoConfigComponent> comp(new QGpgMENewCryptoConfigComponent);
- comp->setComponent(c);
- m_componentsByName[ comp->name() ] = comp;
- }
- m_parsed = true;
-}
-
-QStringList QGpgMENewCryptoConfig::componentList() const
-{
- if (!m_parsed) {
- const_cast<QGpgMENewCryptoConfig *>(this)->reloadConfiguration(true);
- }
- QStringList result;
- std::transform(m_componentsByName.begin(), m_componentsByName.end(),
- std::back_inserter(result),
- mem_fn(&QGpgMENewCryptoConfigComponent::name));
- return result;
-}
-
-QGpgMENewCryptoConfigComponent *QGpgMENewCryptoConfig::component(const QString &name) const
-{
- if (!m_parsed) {
- const_cast<QGpgMENewCryptoConfig *>(this)->reloadConfiguration(false);
- }
- return m_componentsByName.value(name).get();
-}
-
-void QGpgMENewCryptoConfig::sync(bool runtime)
-{
- for (const std::shared_ptr<QGpgMENewCryptoConfigComponent> &c : qAsConst(m_componentsByName)) {
- c->sync(runtime);
- }
-}
-
-void QGpgMENewCryptoConfig::clear()
-{
- s_duringClear = true;
- m_componentsByName.clear();
- s_duringClear = false;
- m_parsed = false; // next call to componentList/component will need to run gpgconf again
-}
-
-////
-
-QGpgMENewCryptoConfigComponent::QGpgMENewCryptoConfigComponent()
- : CryptoConfigComponent(),
- m_component()
-{
-
-}
-
-void QGpgMENewCryptoConfigComponent::setComponent(const Component &component)
-{
- m_component = component;
- m_groupsByName.clear();
-
- std::shared_ptr<QGpgMENewCryptoConfigGroup> group;
-
- const std::vector<Option> options = m_component.options();
- for (const Option &o : options) {
- if (o.flags() & Group) {
- if (group) {
- m_groupsByName[group->name()] = group;
- }
- group.reset(new QGpgMENewCryptoConfigGroup(shared_from_this(), o));
- } else if (group) {
- const std::shared_ptr<QGpgMENewCryptoConfigEntry> entry(new QGpgMENewCryptoConfigEntry(group, o));
- const QString name = entry->name();
- group->m_entryNames.push_back(name);
- group->m_entriesByName[name] = entry;
- } else {
- qCWarning(QGPGME_LOG) << "found no group for entry" << o.name() << "of component" << name();
- }
- }
- if (group) {
- m_groupsByName[group->name()] = group;
- }
-
-}
-
-QGpgMENewCryptoConfigComponent::~QGpgMENewCryptoConfigComponent() {}
-
-QString QGpgMENewCryptoConfigComponent::name() const
-{
- return QString::fromUtf8(m_component.name());
-}
-
-QString QGpgMENewCryptoConfigComponent::description() const
-{
- return QString::fromUtf8(m_component.description());
-}
-
-QStringList QGpgMENewCryptoConfigComponent::groupList() const
-{
- QStringList result;
- result.reserve(m_groupsByName.size());
- std::transform(m_groupsByName.begin(), m_groupsByName.end(),
- std::back_inserter(result),
- std::mem_fn(&QGpgMENewCryptoConfigGroup::name));
- return result;
-}
-
-QGpgMENewCryptoConfigGroup *QGpgMENewCryptoConfigComponent::group(const QString &name) const
-{
- return m_groupsByName.value(name).get();
-}
-
-void QGpgMENewCryptoConfigComponent::sync(bool runtime)
-{
- Q_UNUSED(runtime) // runtime is always set by engine_gpgconf
- if (const Error err = m_component.save()) {
- qCWarning(QGPGME_LOG) << ":"
- << "Error from gpgconf while saving configuration: %1"
- << err;
- }
-}
-
-////
-
-QGpgMENewCryptoConfigGroup::QGpgMENewCryptoConfigGroup(const std::shared_ptr<QGpgMENewCryptoConfigComponent> &comp, const Option &option)
- : CryptoConfigGroup(),
- m_component(comp),
- m_option(option)
-{
-}
-
-QGpgMENewCryptoConfigGroup::~QGpgMENewCryptoConfigGroup() {}
-
-QString QGpgMENewCryptoConfigGroup::name() const
-{
- return QString::fromUtf8(m_option.name());
-}
-
-QString QGpgMENewCryptoConfigGroup::description() const
-{
- return QString::fromUtf8(m_option.description());
-}
-
-QString QGpgMENewCryptoConfigGroup::path() const
-{
- if (const std::shared_ptr<QGpgMENewCryptoConfigComponent> c = m_component.lock()) {
- return c->name() + QLatin1Char('/') + name();
- } else {
- return QString();
- }
-}
-
-CryptoConfigEntry::Level QGpgMENewCryptoConfigGroup::level() const
-{
- // two casts to make SunCC happy:
- return static_cast<CryptoConfigEntry::Level>(static_cast<unsigned int>(m_option.level()));
-}
-
-QStringList QGpgMENewCryptoConfigGroup::entryList() const
-{
- return m_entryNames;
-}
-
-QGpgMENewCryptoConfigEntry *QGpgMENewCryptoConfigGroup::entry(const QString &name) const
-{
- return m_entriesByName.value(name).get();
-}
-
-static QString urlpart_encode(const QString &str)
-{
- QString enc(str);
- enc.replace(QLatin1Char('%'), QStringLiteral("%25")); // first!
- enc.replace(QLatin1Char(':'), QStringLiteral("%3a"));
- //qCDebug(QGPGME_LOG) <<" urlpart_encode:" << str <<" ->" << enc;
- return enc;
-}
-
-static QString urlpart_decode(const QString &str)
-{
- return QUrl::fromPercentEncoding(str.toLatin1());
-}
-
-// gpgconf arg type number -> NewCryptoConfigEntry arg type enum mapping
-static QGpgME::CryptoConfigEntry::ArgType knownArgType(int argType, bool &ok)
-{
- ok = true;
- switch (argType) {
- case 0: // none
- return QGpgME::CryptoConfigEntry::ArgType_None;
- case 1: // string
- return QGpgME::CryptoConfigEntry::ArgType_String;
- case 2: // int32
- return QGpgME::CryptoConfigEntry::ArgType_Int;
- case 3: // uint32
- return QGpgME::CryptoConfigEntry::ArgType_UInt;
- case 32: // pathname
- return QGpgME::CryptoConfigEntry::ArgType_Path;
- case 33: // ldap server
- return QGpgME::CryptoConfigEntry::ArgType_LDAPURL;
- default:
- ok = false;
- return QGpgME::CryptoConfigEntry::ArgType_None;
- }
-}
-
-QGpgMENewCryptoConfigEntry::QGpgMENewCryptoConfigEntry(const std::shared_ptr<QGpgMENewCryptoConfigGroup> &group, const Option &option)
- : m_group(group), m_option(option)
-{
-}
-
-#if 0
-QVariant QGpgMENewCryptoConfigEntry::stringToValue(const QString &str, bool unescape) const
-{
- const bool isString = isStringType();
-
- if (isList()) {
- if (argType() == ArgType_None) {
- bool ok = true;
- const QVariant v = str.isEmpty() ? 0U : str.toUInt(&ok);
- if (!ok) {
- qCWarning(QGPGME_LOG) << "list-of-none should have an unsigned int as value:" << str;
- }
- return v;
- }
- QList<QVariant> lst;
- QStringList items = str.split(',', QString::SkipEmptyParts);
- for (QStringList::const_iterator valit = items.constBegin(); valit != items.constEnd(); ++valit) {
- QString val = *valit;
- if (isString) {
- if (val.isEmpty()) {
- lst << QVariant(QString());
- continue;
- } else if (unescape) {
- if (val[0] != '"') { // see README.gpgconf
- qCWarning(QGPGME_LOG) << "String value should start with '\"' :" << val;
- }
- val = val.mid(1);
- }
- }
- lst << QVariant(unescape ? gpgconf_unescape(val) : val);
- }
- return lst;
- } else { // not a list
- QString val(str);
- if (isString) {
- if (val.isEmpty()) {
- return QVariant(QString()); // not set [ok with lists too?]
- } else if (unescape) {
- if (val[0] != '"') { // see README.gpgconf
- qCWarning(QGPGME_LOG) << "String value should start with '\"' :" << val;
- }
- val = val.mid(1);
- }
- }
- return QVariant(unescape ? gpgconf_unescape(val) : val);
- }
-}
-#endif
-
-QGpgMENewCryptoConfigEntry::~QGpgMENewCryptoConfigEntry()
-{
-#ifndef NDEBUG
- if (!s_duringClear && m_option.dirty())
- qCWarning(QGPGME_LOG) << "Deleting a QGpgMENewCryptoConfigEntry that was modified (" << m_option.description() << ")"
- << "You forgot to call sync() (to commit) or clear() (to discard)";
-#endif
-}
-
-QString QGpgMENewCryptoConfigEntry::name() const
-{
- return QString::fromUtf8(m_option.name());
-}
-
-QString QGpgMENewCryptoConfigEntry::description() const
-{
- return QString::fromUtf8(m_option.description());
-}
-
-QString QGpgMENewCryptoConfigEntry::path() const
-{
- if (const std::shared_ptr<QGpgMENewCryptoConfigGroup> g = m_group.lock()) {
- return g->path() + QLatin1Char('/') + name();
- } else {
- return QString();
- }
-}
-
-bool QGpgMENewCryptoConfigEntry::isOptional() const
-{
- return m_option.flags() & Optional;
-}
-
-bool QGpgMENewCryptoConfigEntry::isReadOnly() const
-{
- return m_option.flags() & NoChange;
-}
-
-bool QGpgMENewCryptoConfigEntry::isList() const
-{
- return m_option.flags() & List;
-}
-
-bool QGpgMENewCryptoConfigEntry::isRuntime() const
-{
- return m_option.flags() & Runtime;
-}
-
-CryptoConfigEntry::Level QGpgMENewCryptoConfigEntry::level() const
-{
- // two casts to make SunCC happy:
- return static_cast<Level>(static_cast<unsigned int>(m_option.level()));
-}
-
-CryptoConfigEntry::ArgType QGpgMENewCryptoConfigEntry::argType() const
-{
- bool ok = false;
- const ArgType type = knownArgType(m_option.type(), ok);
- if (ok) {
- return type;
- } else {
- return knownArgType(m_option.alternateType(), ok);
- }
-}
-
-bool QGpgMENewCryptoConfigEntry::isSet() const
-{
- return m_option.set();
-}
-
-bool QGpgMENewCryptoConfigEntry::boolValue() const
-{
- Q_ASSERT(m_option.alternateType() == NoType);
- Q_ASSERT(!isList());
- return m_option.currentValue().boolValue();
-}
-
-QString QGpgMENewCryptoConfigEntry::stringValue() const
-{
- //return toString( false );
- Q_ASSERT(m_option.alternateType() == StringType);
- Q_ASSERT(!isList());
- return QString::fromUtf8(m_option.currentValue().stringValue());
-}
-
-int QGpgMENewCryptoConfigEntry::intValue() const
-{
- Q_ASSERT(m_option.alternateType() == IntegerType);
- Q_ASSERT(!isList());
- return m_option.currentValue().intValue();
-}
-
-unsigned int QGpgMENewCryptoConfigEntry::uintValue() const
-{
- Q_ASSERT(m_option.alternateType() == UnsignedIntegerType);
- Q_ASSERT(!isList());
- return m_option.currentValue().uintValue();
-}
-
-static QUrl parseURL(int mRealArgType, const QString &str)
-{
- if (mRealArgType == 33) { // LDAP server
- // The format is HOSTNAME:PORT:USERNAME:PASSWORD:BASE_DN
- // or, since gpg 2.2.18, e.g. for dirmngr/ldapserver: [ldap:]hostname:port:username:password:base_dn:flags[:]
- const bool isLdapUrl = str.startsWith(QLatin1String("ldap://")) || str.startsWith(QLatin1String("ldaps://"));
- if (!isLdapUrl) {
- const bool hasOptionalPrefix = str.startsWith(QLatin1String("ldap:"));
- const QStringList items = hasOptionalPrefix ? str.mid(5).split(QLatin1Char(':')) : str.split(QLatin1Char(':'));
- if (items.size() >= 5) {
- QUrl url;
- url.setScheme(QStringLiteral("ldap"));
- url.setHost(urlpart_decode(items[0]), QUrl::DecodedMode);
-
- const auto portString = items[1];
- if (!portString.isEmpty()) {
- bool ok;
- const int port = portString.toInt(&ok);
- if (ok) {
- url.setPort(port);
- } else {
- qCWarning(QGPGME_LOG) << "parseURL: malformed LDAP server port, ignoring:" << portString;
- }
- }
-
- const QString userName = urlpart_decode(items[2]);
- if (!userName.isEmpty()) {
- url.setUserName(userName, QUrl::DecodedMode);
- }
- const QString passWord = urlpart_decode(items[3]);
- if (!passWord.isEmpty()) {
- url.setPassword(passWord, QUrl::DecodedMode);
- }
- const auto baseDn = urlpart_decode(items[4]);
- if (!baseDn.isEmpty()) {
- url.setQuery(baseDn, QUrl::DecodedMode);
- }
- if (items.size() >= 6) {
- const auto flags = urlpart_decode(items[5]);
- if (!flags.isEmpty()) {
- url.setFragment(flags, QUrl::DecodedMode);
- }
- }
- return url;
- } else {
- qCWarning(QGPGME_LOG) << "parseURL: malformed LDAP server:" << str;
- }
- }
- }
- // other URLs : assume wellformed URL syntax.
- return QUrl(str);
-}
-
-static QString portToString(int port)
-{
- // -1 is used for default ports => empty string
- return port != -1 ? QString::number(port) : QString();
-}
-
-// The opposite of parseURL
-static QString splitURL(int mRealArgType, const QUrl &url)
-{
- if (mRealArgType == 33) { // LDAP server
- // The format is HOSTNAME:PORT:USERNAME:PASSWORD:BASE_DN
- // or, since gpg 2.2.18, e.g. for dirmngr/ldapserver: [ldap:]hostname:port:username:password:base_dn:flags[:]
- Q_ASSERT(url.scheme() == QLatin1String("ldap"));
- return urlpart_encode(url.host()) + QLatin1Char(':') +
- portToString(url.port()) + QLatin1Char(':') +
- urlpart_encode(url.userName()) + QLatin1Char(':') +
- urlpart_encode(url.password()) + QLatin1Char(':') +
- urlpart_encode(url.query()) + QLatin1Char(':') +
- urlpart_encode(url.fragment());
- }
- return url.path();
-}
-
-QUrl QGpgMENewCryptoConfigEntry::urlValue() const
-{
- const Type type = m_option.type();
- Q_ASSERT(type == FilenameType || type == LdapServerType);
- Q_ASSERT(!isList());
- if (type == FilenameType) {
- QUrl url = QUrl::fromLocalFile(m_option.currentValue().stringValue());
- return url;
- }
- return parseURL(type, stringValue());
-}
-
-unsigned int QGpgMENewCryptoConfigEntry::numberOfTimesSet() const
-{
- Q_ASSERT(m_option.alternateType() == NoType);
- Q_ASSERT(isList());
- return m_option.currentValue().uintValue();
-}
-
-std::vector<int> QGpgMENewCryptoConfigEntry::intValueList() const
-{
- Q_ASSERT(m_option.alternateType() == IntegerType);
- Q_ASSERT(isList());
- return m_option.currentValue().intValues();
-}
-
-std::vector<unsigned int> QGpgMENewCryptoConfigEntry::uintValueList() const
-{
- Q_ASSERT(m_option.alternateType() == UnsignedIntegerType);
- Q_ASSERT(isList());
- return m_option.currentValue().uintValues();
-}
-
-QStringList QGpgMENewCryptoConfigEntry::stringValueList() const
-{
- Q_ASSERT(isList());
- const Argument arg = m_option.currentValue();
- const std::vector<const char *> values = arg.stringValues();
- QStringList ret;
- for(const char *value: values) {
- ret << QString::fromUtf8(value);
- }
- return ret;
-}
-
-QList<QUrl> QGpgMENewCryptoConfigEntry::urlValueList() const
-{
- const Type type = m_option.type();
- Q_ASSERT(type == FilenameType || type == LdapServerType);
- Q_ASSERT(isList());
- const Argument arg = m_option.currentValue();
- const std::vector<const char *> values = arg.stringValues();
- QList<QUrl> ret;
- for (const char *value : values) {
- if (type == FilenameType) {
- QUrl url;
- url.setPath(QFile::decodeName(value));
- ret << url;
- } else {
- ret << parseURL(type, QString::fromUtf8(value));
- }
- }
- return ret;
-}
-
-void QGpgMENewCryptoConfigEntry::resetToDefault()
-{
- m_option.resetToDefaultValue();
-}
-
-void QGpgMENewCryptoConfigEntry::setBoolValue(bool b)
-{
- Q_ASSERT(m_option.alternateType() == NoType);
- Q_ASSERT(!isList());
- // A "no arg" option is either set or not set.
- // Being set means createNoneArgument(), being unset means resetToDefault()
- m_option.setNewValue(m_option.createNoneArgument(b));
-}
-
-void QGpgMENewCryptoConfigEntry::setStringValue(const QString &str)
-{
- Q_ASSERT(m_option.alternateType() == StringType);
- Q_ASSERT(!isList());
- const Type type = m_option.type();
- // When setting a string to empty (and there's no default), we need to act like resetToDefault
- // Otherwise we try e.g. "ocsp-responder:0:" and gpgconf answers:
- // "gpgconf: argument required for option ocsp-responder"
- if (str.isEmpty() && !isOptional()) {
- m_option.resetToDefaultValue();
- } else if (type == FilenameType) {
- m_option.setNewValue(m_option.createStringArgument(QFile::encodeName(str).constData()));
- } else {
- m_option.setNewValue(m_option.createStringArgument(str.toUtf8().constData()));
- }
-}
-
-void QGpgMENewCryptoConfigEntry::setIntValue(int i)
-{
- Q_ASSERT(m_option.alternateType() == IntegerType);
- Q_ASSERT(!isList());
- m_option.setNewValue(m_option.createIntArgument(i));
-}
-
-void QGpgMENewCryptoConfigEntry::setUIntValue(unsigned int i)
-{
- Q_ASSERT(m_option.alternateType() == UnsignedIntegerType);
- Q_ASSERT(!isList());
- m_option.setNewValue(m_option.createUIntArgument(i));
-}
-
-void QGpgMENewCryptoConfigEntry::setURLValue(const QUrl &url)
-{
- const Type type = m_option.type();
- Q_ASSERT(type == FilenameType || type == LdapServerType);
- Q_ASSERT(!isList());
- const QString str = splitURL(type, url);
- // cf. setStringValue()
- if (str.isEmpty() && !isOptional()) {
- m_option.resetToDefaultValue();
- } else if (type == FilenameType) {
- m_option.setNewValue(m_option.createStringArgument(url.toLocalFile().toUtf8().constData()));
- } else {
- m_option.setNewValue(m_option.createStringArgument(str.toUtf8().constData()));
- }
-}
-
-void QGpgMENewCryptoConfigEntry::setNumberOfTimesSet(unsigned int i)
-{
- Q_ASSERT(m_option.alternateType() == NoType);
- Q_ASSERT(isList());
- m_option.setNewValue(m_option.createNoneListArgument(i));
-}
-
-void QGpgMENewCryptoConfigEntry::setIntValueList(const std::vector<int> &lst)
-{
- Q_ASSERT(m_option.alternateType() == IntegerType);
- Q_ASSERT(isList());
- m_option.setNewValue(m_option.createIntListArgument(lst));
-}
-
-void QGpgMENewCryptoConfigEntry::setUIntValueList(const std::vector<unsigned int> &lst)
-{
- Q_ASSERT(m_option.alternateType() == UnsignedIntegerType);
- Q_ASSERT(isList());
- m_option.setNewValue(m_option.createUIntListArgument(lst));
-}
-
-void QGpgMENewCryptoConfigEntry::setURLValueList(const QList<QUrl> &urls)
-{
- const Type type = m_option.type();
- Q_ASSERT(m_option.alternateType() == StringType);
- Q_ASSERT(isList());
- std::vector<std::string> values;
- values.reserve(urls.size());
- for (const QUrl &url : urls) {
- if (type == FilenameType) {
- values.push_back(QFile::encodeName(url.path()).constData());
- } else {
- values.push_back(splitURL(type, url).toUtf8().constData());
- }
- }
- const auto err = m_option.setNewValue(m_option.createStringListArgument(values));
- if (err) {
- qCWarning(QGPGME_LOG) << "setURLValueList: failed to set new value:" << err;
- }
-}
-
-bool QGpgMENewCryptoConfigEntry::isDirty() const
-{
- return m_option.dirty();
-}
-
-QVariant QGpgMENewCryptoConfigEntry::defaultValue() const
-{
- const auto defaultValue = m_option.defaultValue();
- if (defaultValue.isNull() || defaultValue.numElements() == 0) {
- return {};
- }
- if (defaultValue.numElements() == 1) {
- switch (m_option.alternateType()) {
- case NoType:
- return QVariant{defaultValue.boolValue()};
- case StringType:
- return QVariant{QString::fromUtf8(defaultValue.stringValue())};
- case IntegerType:
- return QVariant{defaultValue.intValue()};
- case UnsignedIntegerType:
- return QVariant{defaultValue.uintValue()};
- default:
- // alternateType should always be one of the above four types
- qCWarning(QGPGME_LOG) << __func__ << ": unsupported alternateType" << m_option.alternateType();
- }
- } else {
- QList<QVariant> list;
- switch (m_option.alternateType()) {
- case StringType: {
- const auto values = defaultValue.stringValues();
- std::transform(std::begin(values), std::end(values), std::back_inserter(list),
- [] (const char *value) { return QVariant{QString::fromUtf8(value)}; });
- break;
- }
- case IntegerType: {
- const auto values = defaultValue.intValues();
- std::transform(std::begin(values), std::end(values), std::back_inserter(list),
- [] (int value) { return QVariant{value}; });
- break;
- }
- case UnsignedIntegerType: {
- const auto values = defaultValue.uintValues();
- std::transform(std::begin(values), std::end(values), std::back_inserter(list),
- [] (unsigned int value) { return QVariant{value}; });
- break;
- }
- default:
- // alternateType should always be one of the above four types
- qCWarning(QGPGME_LOG) << __func__ << ": unsupported alternateType" << m_option.alternateType() << "for list";
- }
- return QVariant{list};
- }
-
- return {};
-}
-
-#if 0
-QString QGpgMENewCryptoConfigEntry::toString(bool escape) const
-{
- // Basically the opposite of stringToValue
- if (isStringType()) {
- if (mValue.isNull()) {
- return QString();
- } else if (isList()) { // string list
- QStringList lst = mValue.toStringList();
- if (escape) {
- for (QStringList::iterator it = lst.begin(); it != lst.end(); ++it) {
- if (!(*it).isNull()) {
- *it = gpgconf_escape(*it).prepend("\"");
- }
- }
- }
- QString res = lst.join(",");
- //qCDebug(QGPGME_LOG) <<"toString:" << res;
- return res;
- } else { // normal string
- QString res = mValue.toString();
- if (escape) {
- res = gpgconf_escape(res).prepend("\"");
- }
- return res;
- }
- }
- if (!isList()) { // non-list non-string
- if (mArgType == ArgType_None) {
- return mValue.toBool() ? QString::fromLatin1("1") : QString();
- } else { // some int
- Q_ASSERT(mArgType == ArgType_Int || mArgType == ArgType_UInt);
- return mValue.toString(); // int to string conversion
- }
- }
-
- // Lists (of other types than strings)
- if (mArgType == ArgType_None) {
- return QString::number(numberOfTimesSet());
- }
- QStringList ret;
- QList<QVariant> lst = mValue.toList();
- for (QList<QVariant>::const_iterator it = lst.constBegin(); it != lst.constEnd(); ++it) {
- ret << (*it).toString(); // QVariant does the conversion
- }
- return ret.join(",");
-}
-
-QString QGpgMENewCryptoConfigEntry::outputString() const
-{
- Q_ASSERT(mSet);
- return toString(true);
-}
-
-bool QGpgMENewCryptoConfigEntry::isStringType() const
-{
- return (mArgType == QGpgME::NewCryptoConfigEntry::ArgType_String
- || mArgType == QGpgME::NewCryptoConfigEntry::ArgType_Path
- || mArgType == QGpgME::NewCryptoConfigEntry::ArgType_URL
- || mArgType == QGpgME::NewCryptoConfigEntry::ArgType_LDAPURL);
-}
-
-void QGpgMENewCryptoConfigEntry::setDirty(bool b)
-{
- mDirty = b;
-}
-#endif
diff --git a/lang/qt/src/qgpgmenewcryptoconfig.h b/lang/qt/src/qgpgmenewcryptoconfig.h
deleted file mode 100644
index 05726e37..00000000
--- a/lang/qt/src/qgpgmenewcryptoconfig.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- qgpgmenewcryptoconfig.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2010 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_QGPGMENEWCRYPTOCONFIG_H
-#define QGPGME_QGPGMENEWCRYPTOCONFIG_H
-
-#include "qgpgme_export.h"
-#include "cryptoconfig.h"
-
-#include <QHash>
-#include <QStringList>
-#include <QVariant>
-
-#include <gpgme++/configuration.h>
-
-#include <vector>
-#include <utility>
-
-class QGpgMENewCryptoConfig;
-class QGpgMENewCryptoConfigComponent;
-class QGpgMENewCryptoConfigGroup;
-class QGpgMENewCryptoConfigEntry;
-
-class QGpgMENewCryptoConfigEntry : public QGpgME::CryptoConfigEntry
-{
-public:
- QGpgMENewCryptoConfigEntry(const std::shared_ptr<QGpgMENewCryptoConfigGroup> &group, const GpgME::Configuration::Option &option);
- ~QGpgMENewCryptoConfigEntry();
-
- QString name() const override;
- QString description() const override;
- QString path() const override;
- bool isOptional() const override;
- bool isReadOnly() const override;
- bool isList() const override;
- bool isRuntime() const override;
- Level level() const override;
- ArgType argType() const override;
- bool isSet() const override;
- bool boolValue() const override;
- QString stringValue() const override;
- int intValue() const override;
- unsigned int uintValue() const override;
- QUrl urlValue() const override;
- unsigned int numberOfTimesSet() const override;
- std::vector<int> intValueList() const override;
- std::vector<unsigned int> uintValueList() const override;
- QList<QUrl> urlValueList() const override;
- void resetToDefault() override;
- void setBoolValue(bool) override;
- void setStringValue(const QString &) override;
- void setIntValue(int) override;
- void setUIntValue(unsigned int) override;
- void setURLValue(const QUrl &) override;
- void setNumberOfTimesSet(unsigned int) override;
- void setIntValueList(const std::vector<int> &) override;
- void setUIntValueList(const std::vector<unsigned int> &) override;
- void setURLValueList(const QList<QUrl> &) override;
- bool isDirty() const override;
-
- QStringList stringValueList() const;
- QVariant defaultValue() const;
-
-#if 0
- void setDirty(bool b);
- QString outputString() const;
-
-protected:
- bool isStringType() const;
- QVariant stringToValue(const QString &value, bool unescape) const;
- QString toString(bool escape) const;
-#endif
-private:
- std::weak_ptr<QGpgMENewCryptoConfigGroup> m_group;
- GpgME::Configuration::Option m_option;
-};
-
-class QGpgMENewCryptoConfigGroup : public QGpgME::CryptoConfigGroup
-{
-public:
- QGpgMENewCryptoConfigGroup(const std::shared_ptr<QGpgMENewCryptoConfigComponent> &parent, const GpgME::Configuration::Option &option);
- ~QGpgMENewCryptoConfigGroup();
-
- QString name() const override;
- QString iconName() const override
- {
- return QString();
- }
- QString description() const override;
- QString path() const override;
- QGpgME::CryptoConfigEntry::Level level() const override;
- QStringList entryList() const override;
- QGpgMENewCryptoConfigEntry *entry(const QString &name) const override;
-
-private:
- friend class QGpgMENewCryptoConfigComponent; // it adds the entries
- std::weak_ptr<QGpgMENewCryptoConfigComponent> m_component;
- GpgME::Configuration::Option m_option;
- QStringList m_entryNames;
- QHash< QString, std::shared_ptr<QGpgMENewCryptoConfigEntry> > m_entriesByName;
-};
-
-/// For docu, see kleo/cryptoconfig.h
-class QGpgMENewCryptoConfigComponent : public QGpgME::CryptoConfigComponent, public std::enable_shared_from_this<QGpgMENewCryptoConfigComponent>
-{
-public:
- QGpgMENewCryptoConfigComponent();
- ~QGpgMENewCryptoConfigComponent();
-
- void setComponent(const GpgME::Configuration::Component &component);
-
- QString name() const override;
- QString iconName() const override
- {
- return name();
- }
- QString description() const override;
- QStringList groupList() const override;
- QGpgMENewCryptoConfigGroup *group(const QString &name) const override;
-
- void sync(bool runtime);
-
-private:
- GpgME::Configuration::Component m_component;
- QHash< QString, std::shared_ptr<QGpgMENewCryptoConfigGroup> > m_groupsByName;
-};
-
-/**
- * CryptoConfig implementation around the gpgconf command-line tool
- * For method docu, see kleo/cryptoconfig.h
- */
-class QGPGME_EXPORT QGpgMENewCryptoConfig : public QGpgME::CryptoConfig
-{
-public:
- /**
- * Constructor
- */
- QGpgMENewCryptoConfig();
- ~QGpgMENewCryptoConfig();
-
- QStringList componentList() const override;
-
- QGpgMENewCryptoConfigComponent *component(const QString &name) const override;
-
- void clear() override;
- void sync(bool runtime) override;
-
-private:
- /// @param showErrors if true, a messagebox will be shown if e.g. gpgconf wasn't found
- void reloadConfiguration(bool showErrors);
-
-private:
- QHash< QString, std::shared_ptr<QGpgMENewCryptoConfigComponent> > m_componentsByName;
- bool m_parsed;
-};
-
-#endif /* QGPGME_QGPGMENEWCRYPTOCONFIG_H */
diff --git a/lang/qt/src/qgpgmequickjob.cpp b/lang/qt/src/qgpgmequickjob.cpp
deleted file mode 100644
index d65afd7d..00000000
--- a/lang/qt/src/qgpgmequickjob.cpp
+++ /dev/null
@@ -1,211 +0,0 @@
-/* qgpgmequickjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2017 Intevation GmbH
- Copyright (c) 2020 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "qgpgmequickjob.h"
-
-#include "qgpgme_debug.h"
-#include "quickjob_p.h"
-#include "util.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/key.h>
-
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEQuickJobPrivate : public QuickJobPrivate
-{
- QGpgMEQuickJob *q = nullptr;
-
-public:
- QGpgMEQuickJobPrivate(QGpgMEQuickJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEQuickJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override
- {
- Q_ASSERT(!"Not supported by this Job class.");
- return Error::fromCode(GPG_ERR_NOT_SUPPORTED);
- }
-
- void startNow() override
- {
- Q_ASSERT(!"Not supported by this Job class.");
- q->run();
- }
-
- GpgME::Error startSetKeyEnabled(const GpgME::Key &key, bool enable) override;
-};
-
-}
-
-QGpgMEQuickJob::QGpgMEQuickJob(Context *context)
- : mixin_type(context)
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEQuickJobPrivate>{new QGpgMEQuickJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMEQuickJob::~QGpgMEQuickJob() = default;
-
-static QGpgMEQuickJob::result_type createWorker(GpgME::Context *ctx,
- const QString &uid,
- const char *algo,
- const QDateTime &expires,
- const GpgME::Key &key,
- unsigned int flags)
-{
- auto err = ctx->createKey(uid.toUtf8().constData(),
- algo,
- 0,
- expires.isValid() ? (unsigned long) (expires.toMSecsSinceEpoch() / 1000
- - QDateTime::currentSecsSinceEpoch()) : 0,
- key,
- flags);
- return std::make_tuple(err, QString(), Error());
-}
-
-static QGpgMEQuickJob::result_type addSubkeyWorker(GpgME::Context *ctx,
- const GpgME::Key &key,
- const char *algo,
- const QDateTime &expires,
- unsigned int flags)
-{
- auto err = ctx->createSubkey(key, algo, 0,
- expires.isValid() ? (unsigned long) (expires.toMSecsSinceEpoch() / 1000
- - QDateTime::currentSecsSinceEpoch()): 0,
- flags);
- return std::make_tuple(err, QString(), Error());
-}
-
-static QGpgMEQuickJob::result_type addUidWorker(GpgME::Context *ctx,
- const GpgME::Key &key,
- const QString &uid)
-{
- auto err = ctx->addUid(key, uid.toUtf8().constData());
- return std::make_tuple(err, QString(), Error());
-}
-
-static QGpgMEQuickJob::result_type revUidWorker(GpgME::Context *ctx,
- const GpgME::Key &key,
- const QString &uid)
-{
- auto err = ctx->revUid(key, uid.toUtf8().constData());
- return std::make_tuple(err, QString(), Error());
-}
-
-static QGpgMEQuickJob::result_type revokeSignatureWorker(Context *ctx,
- const Key &key,
- const Key &signingKey,
- const std::vector<UserID> &userIds)
-{
- const auto err = ctx->revokeSignature(key, signingKey, userIds);
- return std::make_tuple(err, QString(), Error());
-}
-
-static QGpgMEQuickJob::result_type addAdskWorker(Context *ctx, const Key &key, const char *adsk)
-{
- const auto err = ctx->addAdsk(key, adsk);
- return std::make_tuple(err, QString(), Error());
-}
-
-void QGpgMEQuickJob::startCreate(const QString &uid,
- const char *algo,
- const QDateTime &expires,
- const GpgME::Key &key,
- unsigned int flags)
-{
- run(std::bind(&createWorker, std::placeholders::_1, uid, algo,
- expires, key, flags));
-}
-
-void QGpgMEQuickJob::startAddUid(const GpgME::Key &key, const QString &uid)
-{
- run(std::bind(&addUidWorker, std::placeholders::_1, key, uid));
-}
-
-void QGpgMEQuickJob::startRevUid(const GpgME::Key &key, const QString &uid)
-{
- run(std::bind(&revUidWorker, std::placeholders::_1, key, uid));
-}
-
-void QGpgMEQuickJob::startAddSubkey(const GpgME::Key &key, const char *algo,
- const QDateTime &expires,
- unsigned int flags)
-{
- run(std::bind(&addSubkeyWorker, std::placeholders::_1, key, algo,
- expires, flags));
-}
-
-void QGpgMEQuickJob::startRevokeSignature(const Key &key, const Key &signingKey, const std::vector<UserID> &userIds)
-{
- run(std::bind(&revokeSignatureWorker, std::placeholders::_1, key, signingKey, userIds));
-}
-
-void QGpgMEQuickJob::startAddAdsk(const GpgME::Key &key, const char *adsk)
-{
- run(std::bind(&addAdskWorker, std::placeholders::_1, key, adsk));
-}
-
-static QGpgMEQuickJob::result_type set_key_enabled(Context *ctx, const Key &key, bool enabled)
-{
- const auto err = ctx->setKeyEnabled(key, enabled);
- return std::make_tuple(err, QString(), Error());
-}
-
-Error QGpgMEQuickJobPrivate::startSetKeyEnabled(const Key &key, bool enabled)
-{
- if (key.isNull()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return set_key_enabled(ctx, key, enabled);
- });
-
- return {};
-}
-
-#include "qgpgmequickjob.moc"
diff --git a/lang/qt/src/qgpgmequickjob.h b/lang/qt/src/qgpgmequickjob.h
deleted file mode 100644
index 07b89e18..00000000
--- a/lang/qt/src/qgpgmequickjob.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* qgpgmequickjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2017 Intevation GmbH
- Copyright (c) 2020 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_QGPGMEQUICKJOB_H
-#define QGPGME_QGPGMEQUICKJOB_H
-
-#include "quickjob.h"
-
-#include "threadedjobmixin.h"
-
-namespace QGpgME
-{
-
-/**
- * Interface to the modern key manipulation functions.
- */
-class QGpgMEQuickJob
-#ifdef Q_MOC_RUN
- : public QuickJob
-#else
- : public _detail::ThreadedJobMixin<QuickJob>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEQuickJob(GpgME::Context *context);
- ~QGpgMEQuickJob();
-
- void startCreate(const QString &uid,
- const char *algo,
- const QDateTime &expires = QDateTime(),
- const GpgME::Key &key = GpgME::Key(),
- unsigned int flags = 0) override;
- void startAddUid(const GpgME::Key &key, const QString &uid) override;
- void startRevUid(const GpgME::Key &key, const QString &uid) override;
- void startAddSubkey(const GpgME::Key &key, const char *algo,
- const QDateTime &expires = QDateTime(),
- unsigned int flags = 0) override;
- void startRevokeSignature(const GpgME::Key &key, const GpgME::Key &signingKey,
- const std::vector<GpgME::UserID> &userIds = std::vector<GpgME::UserID>()) override;
- void startAddAdsk(const GpgME::Key &key, const char *adsk) override;
-};
-
-}
-#endif
diff --git a/lang/qt/src/qgpgmereceivekeysjob.cpp b/lang/qt/src/qgpgmereceivekeysjob.cpp
deleted file mode 100644
index 6bfc6b56..00000000
--- a/lang/qt/src/qgpgmereceivekeysjob.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- qgpgmereceivekeysjob.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 <[email protected]>
-
- 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 "qgpgmereceivekeysjob.h"
-
-#include "util.h"
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEReceiveKeysJob::QGpgMEReceiveKeysJob(Context *context)
- : mixin_type{context}
-{
- lateInitialization();
-}
-
-QGpgMEReceiveKeysJob::~QGpgMEReceiveKeysJob() = default;
-
-static QGpgMEReceiveKeysJob::result_type importfromkeyserver(Context *ctx, const QStringList &keyIds)
-{
- const ImportResult res = ctx->importKeys(toStrings(keyIds));
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, log, ae);
-}
-
-Error QGpgMEReceiveKeysJob::start(const QStringList &keyIds)
-{
- run(std::bind(&importfromkeyserver, std::placeholders::_1, keyIds));
- return Error();
-}
-
-GpgME::ImportResult QGpgME::QGpgMEReceiveKeysJob::exec(const QStringList &keyIds)
-{
- const result_type r = importfromkeyserver(context(), keyIds);
- return std::get<0>(r);
-}
-
-#include "qgpgmereceivekeysjob.moc"
diff --git a/lang/qt/src/qgpgmereceivekeysjob.h b/lang/qt/src/qgpgmereceivekeysjob.h
deleted file mode 100644
index 4c6a24be..00000000
--- a/lang/qt/src/qgpgmereceivekeysjob.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- qgpgmereceivekeysjob.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 <[email protected]>
-
- 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_QGPGMERECEIVEKEYSJOB_H__
-#define __QGPGME_QGPGMERECEIVEKEYSJOB_H__
-
-#include "receivekeysjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/importresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEReceiveKeysJob
-#ifdef Q_MOC_RUN
- : public ReceiveKeysJob
-#else
- : public _detail::ThreadedJobMixin<ReceiveKeysJob, std::tuple<GpgME::ImportResult, QString, GpgME::Error>>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEReceiveKeysJob(GpgME::Context *context);
- ~QGpgMEReceiveKeysJob() override;
-
- GpgME::Error start(const QStringList &keyIds) override;
-
- GpgME::ImportResult exec(const QStringList &keyIds) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMERECEIVEKEYSJOB_H__
diff --git a/lang/qt/src/qgpgmerefreshsmimekeysjob.cpp b/lang/qt/src/qgpgmerefreshsmimekeysjob.cpp
deleted file mode 100644
index 730cef80..00000000
--- a/lang/qt/src/qgpgmerefreshsmimekeysjob.cpp
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- qgpgmerefreshsmimekeysjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarävdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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.
-*/
-
-#define MAX_CMD_LENGTH 32768
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "qgpgmerefreshsmimekeysjob.h"
-#include "util.h"
-
-#include <QDebug>
-#include "qgpgme_debug.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/key.h>
-
-#include <QByteArray>
-#include <QMetaObject>
-#include <QProcess>
-#include <QStringList>
-
-#include <gpg-error.h>
-
-#include <assert.h>
-
-using namespace QGpgME;
-
-QGpgMERefreshSMIMEKeysJob::QGpgMERefreshSMIMEKeysJob()
- : RefreshKeysJob(nullptr),
- mProcess(nullptr),
- mError(0)
-{
-
-}
-
-QGpgMERefreshSMIMEKeysJob::~QGpgMERefreshSMIMEKeysJob()
-{
-
-}
-
-GpgME::Error QGpgMERefreshSMIMEKeysJob::start(const QStringList &patterns)
-{
- assert(mPatternsToDo.empty());
-
- mPatternsToDo = patterns;
- if (mPatternsToDo.empty()) {
- mPatternsToDo.push_back(QStringLiteral(" ")); // empty list means all -> mae
- }
- // sure to fail the first
- // startAProcess() guard clause
-
- 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 GpgME::Key &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 QGpgMERefreshSMIMEKeysJob::startAProcess()
-{
- if (mPatternsToDo.empty()) {
- return GpgME::Error();
- }
- // create and start gpgsm process:
- mProcess = new QProcess(this);
- mProcess->setObjectName(QStringLiteral("gpgsm -k --with-validation --force-crl-refresh --enable-crl-checks"));
-
- // FIXME: obbtain the path to gpgsm from gpgme, so we use the same instance.
- mProcess->setProgram(QStringLiteral("gpgsm"));
- QStringList arguments;
- arguments << QStringLiteral("-k")
- << QStringLiteral("--with-validation")
- << QStringLiteral("--force-crl-refresh")
- << QStringLiteral("--enable-crl-checks");
- unsigned int commandLineLength = MAX_CMD_LENGTH;
- commandLineLength -=
- strlen("gpgsm") + 1 + strlen("-k") + 1 +
- strlen("--with-validation") + 1 + strlen("--force-crl-refresh") + 1 +
- strlen("--enable-crl-checks") + 1;
- while (!mPatternsToDo.empty()) {
- const QByteArray pat = mPatternsToDo.front().toUtf8().trimmed();
- const unsigned int patLength = pat.length();
- if (patLength >= commandLineLength) {
- break;
- }
- mPatternsToDo.pop_front();
- if (pat.isEmpty()) {
- continue;
- }
- arguments << QLatin1String(pat);
- commandLineLength -= patLength + 1;
- }
-
- mProcess->setArguments(arguments);
-
- connect(mProcess, SIGNAL(finished(int,QProcess::ExitStatus)),
- SLOT(slotProcessExited(int,QProcess::ExitStatus)));
- 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()) {
- mError = GpgME::Error::fromCode(GPG_ERR_ENOENT, GPG_ERR_SOURCE_GPGSM); // what else?
- deleteLater();
- return mError;
- } else {
- return GpgME::Error();
- }
-}
-
-void QGpgMERefreshSMIMEKeysJob::slotCancel()
-{
- if (mProcess) {
- mProcess->kill();
- }
- mProcess = nullptr;
- mError = GpgME::Error::fromCode(GPG_ERR_CANCELED, GPG_ERR_SOURCE_GPGSM);
-}
-
-void QGpgMERefreshSMIMEKeysJob::slotStatus(QProcess *proc, const QString &type, const QStringList &args)
-{
- if (proc != mProcess) {
- return;
- }
- QStringList::const_iterator it = args.begin();
- bool ok = false;
-
- if (type == QLatin1String("ERROR")) {
-
- if (args.size() < 2) {
- qCDebug(QGPGME_LOG) << "not recognising ERROR with < 2 args!";
- return;
- }
- const int source = (*++it).toInt(&ok);
- if (!ok) {
- qCDebug(QGPGME_LOG) << "expected number for first ERROR arg, got something else";
- return;
- }
- ok = false;
- const int code = (*++it).toInt(&ok);
- if (!ok) {
- qCDebug(QGPGME_LOG) << "expected number for second ERROR arg, got something else";
- return;
- }
- mError = GpgME::Error::fromCode(code, source);
-
- } else if (type == QLatin1String("PROGRESS")) {
-
- if (args.size() < 4) {
- qCDebug(QGPGME_LOG) << "not recognising PROGRESS with < 4 args!";
- return;
- }
- const QString what = *++it;
- ok = false;
- const int type = (*++it).toInt(&ok);
- if (!ok) {
- qCDebug(QGPGME_LOG) << "expected number for \"type\", got something else";
- return;
- }
- ok = false;
- const int cur = (*++it).toInt(&ok);
- if (!ok) {
- qCDebug(QGPGME_LOG) << "expected number for \"cur\", got something else";
- return;
- }
- ok = false;
- const int total = (*++it).toInt(&ok);
- if (!ok) {
- qCDebug(QGPGME_LOG) << "expected number for \"total\", got something else";
- return;
- }
- Q_EMIT jobProgress(cur, total);
- Q_EMIT rawProgress(what, type, cur, total);
- QT_WARNING_PUSH
- QT_WARNING_DISABLE_DEPRECATED
- Q_EMIT progress(what, cur, total);
- QT_WARNING_POP
- }
-}
-
-void QGpgMERefreshSMIMEKeysJob::slotProcessExited(int exitCode, QProcess::ExitStatus exitStatus)
-{
- if (!mError && !mPatternsToDo.empty()) {
- if (const GpgME::Error err = startAProcess()) {
- mError = err;
- } else {
- return;
- }
- }
-
- Q_EMIT done();
- if (!mError &&
- (exitStatus != QProcess::NormalExit || exitCode != 0)) {
- mError = GpgME::Error::fromCode(GPG_ERR_GENERAL, GPG_ERR_SOURCE_GPGSM);
- }
- Q_EMIT result(mError);
- deleteLater();
-}
-#include "qgpgmerefreshsmimekeysjob.moc"
diff --git a/lang/qt/src/qgpgmerefreshsmimekeysjob.h b/lang/qt/src/qgpgmerefreshsmimekeysjob.h
deleted file mode 100644
index f2324581..00000000
--- a/lang/qt/src/qgpgmerefreshsmimekeysjob.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- qgpgmerefreshsmimekeysjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_QGPGMEREFRESHSMIMEKEYSJOB_H__
-#define __QGPGME_QGPGMEREFRESHSMIMEKEYSJOB_H__
-
-#include "refreshkeysjob.h"
-
-#include <gpgme++/context.h>
-
-#include <QStringList>
-#include <QProcess>
-
-namespace QGpgME
-{
-
-class QGpgMERefreshSMIMEKeysJob : public RefreshKeysJob
-{
- Q_OBJECT
-public:
- QGpgMERefreshSMIMEKeysJob();
- ~QGpgMERefreshSMIMEKeysJob();
-
- /* from RefreshKeysJob */
- GpgME::Error start(const QStringList &patterns) override;
-
- GpgME::Error start(const std::vector<GpgME::Key> &keys) override;
-
-private Q_SLOTS:
- /* from Job */
- void slotCancel() override;
-
- void slotStatus(QProcess *, const QString &, const QStringList &);
- void slotProcessExited(int exitCode, QProcess::ExitStatus exitStatus);
-
-private:
- GpgME::Error startAProcess();
-
-private:
- QProcess *mProcess;
- GpgME::Error mError;
- QStringList mPatternsToDo;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEREFRESHSMIMEKEYSJOB_H__
diff --git a/lang/qt/src/qgpgmerevokekeyjob.cpp b/lang/qt/src/qgpgmerevokekeyjob.cpp
deleted file mode 100644
index bf51144d..00000000
--- a/lang/qt/src/qgpgmerevokekeyjob.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- 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 <[email protected]>
-
- 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 <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/gpgrevokekeyeditinteractor.h>
-#include <gpgme++/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);
- err = std::get<0>(r);
- }
- return err;
-}
-
-#include "qgpgmerevokekeyjob.moc"
diff --git a/lang/qt/src/qgpgmerevokekeyjob.h b/lang/qt/src/qgpgmerevokekeyjob.h
deleted file mode 100644
index 0eba5cb7..00000000
--- a/lang/qt/src/qgpgmerevokekeyjob.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- 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 <[email protected]>
-
- 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
deleted file mode 100644
index a7d603d5..00000000
--- a/lang/qt/src/qgpgmesetprimaryuseridjob.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- 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 <[email protected]>
-
- 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 <gpgme++/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
deleted file mode 100644
index 4ee967ae..00000000
--- a/lang/qt/src/qgpgmesetprimaryuseridjob.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- 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 <[email protected]>
-
- 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/qgpgmesignarchivejob.cpp b/lang/qt/src/qgpgmesignarchivejob.cpp
deleted file mode 100644
index 4d257284..00000000
--- a/lang/qt/src/qgpgmesignarchivejob.cpp
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- qgpgmesignarchivejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- 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,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "qgpgmesignarchivejob.h"
-
-#include "dataprovider.h"
-#include "signarchivejob_p.h"
-#include "filelistdataprovider.h"
-#include "qgpgme_debug.h"
-#include "util.h"
-
-#include <QFile>
-
-#include <gpgme++/data.h>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMESignArchiveJobPrivate : public SignArchiveJobPrivate
-{
- QGpgMESignArchiveJob *q = nullptr;
-
-public:
- QGpgMESignArchiveJobPrivate(QGpgMESignArchiveJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMESignArchiveJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMESignArchiveJob::QGpgMESignArchiveJob(Context *context)
- : mixin_type{context}
-{
- setJobPrivate(this, std::unique_ptr<QGpgMESignArchiveJobPrivate>{new QGpgMESignArchiveJobPrivate{this}});
- lateInitialization();
- connect(this, &Job::rawProgress, this, [this](const QString &what, int type, int current, int total) {
- emitArchiveProgressSignals(this, what, type, current, total);
- });
-}
-
-static QGpgMESignArchiveJob::result_type sign(Context *ctx,
- const std::vector<Key> &signers,
- const std::vector<QString> &paths,
- GpgME::Data &outdata,
- const QString &baseDirectory)
-{
- QGpgME::FileListDataProvider in{paths};
- Data indata(&in);
- if (!baseDirectory.isEmpty()) {
- indata.setFileName(baseDirectory.toStdString());
- }
-
- ctx->clearSigningKeys();
- for (const Key &signer : signers) {
- if (!signer.isNull()) {
- if (const Error err = ctx->addSigningKey(signer)) {
- return std::make_tuple(SigningResult{err}, QString{}, Error{});
- }
- }
- }
-
- const auto signingResult = ctx->sign(indata, outdata, GpgME::SignArchive);
-
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(signingResult, log, ae);
-}
-
-static QGpgMESignArchiveJob::result_type sign_to_io_device(Context *ctx,
- QThread *thread,
- const std::vector<Key> &signers,
- const std::vector<QString> &paths,
- const std::weak_ptr<QIODevice> &output_,
- const QString &baseDirectory)
-{
- const std::shared_ptr<QIODevice> output = output_.lock();
- const _detail::ToThreadMover ctMover(output, thread);
- QGpgME::QIODeviceDataProvider out{output};
- Data outdata(&out);
-
- return sign(ctx, signers, paths, outdata, baseDirectory);
-}
-
-static QGpgMESignArchiveJob::result_type sign_to_filename(Context *ctx,
- const std::vector<Key> &signers,
- const std::vector<QString> &paths,
- const QString &outputFileName,
- const QString &baseDirectory)
-{
- PartialFileGuard partFileGuard{outputFileName};
- if (partFileGuard.tempFileName().isEmpty()) {
- return std::make_tuple(SigningResult{Error::fromCode(GPG_ERR_EEXIST)}, QString{}, Error{});
- }
-
- Data outdata;
-#ifdef Q_OS_WIN
- outdata.setFileName(partFileGuard.tempFileName().toUtf8().constData());
-#else
- outdata.setFileName(QFile::encodeName(partFileGuard.tempFileName()).constData());
-#endif
-
- const auto result = sign(ctx, signers, paths, outdata, baseDirectory);
- const auto &signingResult = std::get<0>(result);
- if (!signingResult.error().code()) {
- // the operation succeeded -> save the result under the requested file name
- partFileGuard.commit();
- }
-
- return result;
-}
-
-GpgME::Error QGpgMESignArchiveJob::start(const std::vector<GpgME::Key> &signers,
- const std::vector<QString> &paths,
- const std::shared_ptr<QIODevice> &output)
-{
- if (!output) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- run(std::bind(&sign_to_io_device,
- std::placeholders::_1,
- std::placeholders::_2,
- signers,
- paths,
- std::placeholders::_3,
- baseDirectory()),
- output);
- return {};
-}
-
-
-GpgME::Error QGpgMESignArchiveJobPrivate::startIt()
-{
- if (m_outputFilePath.isEmpty()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return sign_to_filename(ctx, m_signers, m_inputPaths, m_outputFilePath, m_baseDirectory);
- });
-
- return {};
-}
-
-#include "qgpgmesignarchivejob.moc"
diff --git a/lang/qt/src/qgpgmesignarchivejob.h b/lang/qt/src/qgpgmesignarchivejob.h
deleted file mode 100644
index 5755a91c..00000000
--- a/lang/qt/src/qgpgmesignarchivejob.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- qgpgmesignarchivejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_QGPGMESIGNARCHIVEJOB_H__
-#define __QGPGME_QGPGMESIGNARCHIVEJOB_H__
-
-#include "signarchivejob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/signingresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMESignArchiveJob
-#ifdef Q_MOC_RUN
- : public SignArchiveJob
-#else
- : public _detail::ThreadedJobMixin<SignArchiveJob, std::tuple<GpgME::SigningResult, QString, GpgME::Error>>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMESignArchiveJob(GpgME::Context *context);
- ~QGpgMESignArchiveJob() = default;
-
- GpgME::Error start(const std::vector<GpgME::Key> &signers,
- const std::vector<QString> &paths,
- const std::shared_ptr<QIODevice> &output) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMESIGNARCHIVEJOB_H__
diff --git a/lang/qt/src/qgpgmesignencryptarchivejob.cpp b/lang/qt/src/qgpgmesignencryptarchivejob.cpp
deleted file mode 100644
index c3e23b43..00000000
--- a/lang/qt/src/qgpgmesignencryptarchivejob.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- qgpgmesignencryptarchivejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- 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,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "qgpgmesignencryptarchivejob.h"
-
-#include "dataprovider.h"
-#include "signencryptarchivejob_p.h"
-#include "filelistdataprovider.h"
-#include "qgpgme_debug.h"
-#include "util.h"
-
-#include <QFile>
-
-#include <gpgme++/data.h>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMESignEncryptArchiveJobPrivate : public SignEncryptArchiveJobPrivate
-{
- QGpgMESignEncryptArchiveJob *q = nullptr;
-
-public:
- QGpgMESignEncryptArchiveJobPrivate(QGpgMESignEncryptArchiveJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMESignEncryptArchiveJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMESignEncryptArchiveJob::QGpgMESignEncryptArchiveJob(Context *context)
- : mixin_type{context}
-{
- setJobPrivate(this, std::unique_ptr<QGpgMESignEncryptArchiveJobPrivate>{new QGpgMESignEncryptArchiveJobPrivate{this}});
- lateInitialization();
- connect(this, &Job::rawProgress, this, [this](const QString &what, int type, int current, int total) {
- emitArchiveProgressSignals(this, what, type, current, total);
- });
-}
-
-static QGpgMESignEncryptArchiveJob::result_type sign_encrypt(Context *ctx,
- const std::vector<GpgME::Key> &signers,
- const std::vector<Key> &recipients,
- const std::vector<QString> &paths,
- GpgME::Data &outdata,
- Context::EncryptionFlags encryptionFlags,
- const QString &baseDirectory)
-{
- QGpgME::FileListDataProvider in{paths};
- Data indata(&in);
- if (!baseDirectory.isEmpty()) {
- indata.setFileName(baseDirectory.toStdString());
- }
-
- ctx->clearSigningKeys();
- for (const Key &signer : signers) {
- if (!signer.isNull()) {
- if (const Error err = ctx->addSigningKey(signer)) {
- return std::make_tuple(SigningResult{err}, EncryptionResult{}, QString{}, Error{});
- }
- }
- }
-
- encryptionFlags = static_cast<Context::EncryptionFlags>(encryptionFlags | Context::EncryptArchive);
- const auto res = ctx->signAndEncrypt(recipients, indata, outdata, encryptionFlags);
- const auto &signingResult = res.first;
- const auto &encryptionResult = res.second;
-
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(signingResult, encryptionResult, log, ae);
-}
-
-static QGpgMESignEncryptArchiveJob::result_type sign_encrypt_to_io_device(Context *ctx,
- QThread *thread,
- const std::vector<GpgME::Key> &signers,
- const std::vector<Key> &recipients,
- const std::vector<QString> &paths,
- const std::weak_ptr<QIODevice> &cipherText_,
- Context::EncryptionFlags encryptionFlags,
- const QString &baseDirectory)
-{
- const std::shared_ptr<QIODevice> cipherText = cipherText_.lock();
- const _detail::ToThreadMover ctMover(cipherText, thread);
- QGpgME::QIODeviceDataProvider out{cipherText};
- Data outdata(&out);
-
- return sign_encrypt(ctx, signers, recipients, paths, outdata, encryptionFlags, baseDirectory);
-}
-
-static QGpgMESignEncryptArchiveJob::result_type sign_encrypt_to_filename(Context *ctx,
- const std::vector<GpgME::Key> &signers,
- const std::vector<Key> &recipients,
- const std::vector<QString> &paths,
- const QString &outputFileName,
- Context::EncryptionFlags encryptionFlags,
- const QString &baseDirectory)
-{
- PartialFileGuard partFileGuard{outputFileName};
- if (partFileGuard.tempFileName().isEmpty()) {
- return std::make_tuple(SigningResult{Error::fromCode(GPG_ERR_EEXIST)},
- EncryptionResult{Error::fromCode(GPG_ERR_EEXIST)},
- QString{},
- Error{});
- }
-
- Data outdata;
-#ifdef Q_OS_WIN
- outdata.setFileName(partFileGuard.tempFileName().toUtf8().constData());
-#else
- outdata.setFileName(QFile::encodeName(partFileGuard.tempFileName()).constData());
-#endif
-
- const auto result = sign_encrypt(ctx, signers, recipients, paths, outdata, encryptionFlags, baseDirectory);
- const auto &signingResult = std::get<0>(result);
- const auto &encryptionResult = std::get<1>(result);
- if (!signingResult.error().code() && !encryptionResult.error().code()) {
- // the operation succeeded -> save the result under the requested file name
- partFileGuard.commit();
- }
-
- return result;
-}
-
-GpgME::Error QGpgMESignEncryptArchiveJob::start(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const std::vector<QString> &paths,
- const std::shared_ptr<QIODevice> &cipherText,
- const GpgME::Context::EncryptionFlags encryptionFlags)
-{
- if (!cipherText) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- run(std::bind(&sign_encrypt_to_io_device,
- std::placeholders::_1,
- std::placeholders::_2,
- signers,
- recipients,
- paths,
- std::placeholders::_3,
- encryptionFlags,
- baseDirectory()),
- cipherText);
- return {};
-}
-
-GpgME::Error QGpgMESignEncryptArchiveJobPrivate::startIt()
-{
- if (m_outputFilePath.isEmpty()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return sign_encrypt_to_filename(ctx, m_signers, m_recipients, m_inputPaths, m_outputFilePath, m_encryptionFlags, m_baseDirectory);
- });
-
- return {};
-}
-
-#include "qgpgmesignencryptarchivejob.moc"
diff --git a/lang/qt/src/qgpgmesignencryptarchivejob.h b/lang/qt/src/qgpgmesignencryptarchivejob.h
deleted file mode 100644
index 2675b28a..00000000
--- a/lang/qt/src/qgpgmesignencryptarchivejob.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- qgpgmesignencryptarchivejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_QGPGMESIGNENCRYPTARCHIVEJOB_H__
-#define __QGPGME_QGPGMESIGNENCRYPTARCHIVEJOB_H__
-
-#include "signencryptarchivejob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/encryptionresult.h>
-#include <gpgme++/signingresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMESignEncryptArchiveJob
-#ifdef Q_MOC_RUN
- : public SignEncryptArchiveJob
-#else
- : public _detail::ThreadedJobMixin<SignEncryptArchiveJob, std::tuple<GpgME::SigningResult, GpgME::EncryptionResult, QString, GpgME::Error>>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMESignEncryptArchiveJob(GpgME::Context *context);
- ~QGpgMESignEncryptArchiveJob() = default;
-
- GpgME::Error start(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const std::vector<QString> &paths,
- const std::shared_ptr<QIODevice> &cipherText,
- const GpgME::Context::EncryptionFlags flags) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMESIGNENCRYPTARCHIVEJOB_H__
diff --git a/lang/qt/src/qgpgmesignencryptjob.cpp b/lang/qt/src/qgpgmesignencryptjob.cpp
deleted file mode 100644
index 8634d91d..00000000
--- a/lang/qt/src/qgpgmesignencryptjob.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- qgpgmesignencryptjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- 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,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "qgpgmesignencryptjob.h"
-
-#include "dataprovider.h"
-#include "signencryptjob_p.h"
-#include "util.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/exception.h>
-#include <gpgme++/key.h>
-
-#include <QBuffer>
-#include <QFileInfo>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMESignEncryptJobPrivate : public SignEncryptJobPrivate
-{
- QGpgMESignEncryptJob *q = nullptr;
-
-public:
- QGpgMESignEncryptJobPrivate(QGpgMESignEncryptJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMESignEncryptJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMESignEncryptJob::QGpgMESignEncryptJob(Context *context)
- : mixin_type(context),
- mOutputIsBase64Encoded(false)
-{
- setJobPrivate(this, std::unique_ptr<QGpgMESignEncryptJobPrivate>{new QGpgMESignEncryptJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMESignEncryptJob::~QGpgMESignEncryptJob() {}
-
-void QGpgMESignEncryptJob::setOutputIsBase64Encoded(bool on)
-{
- mOutputIsBase64Encoded = 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 QString &fileName)
-{
- const std::shared_ptr<QIODevice> &plainText = plainText_.lock();
- const std::shared_ptr<QIODevice> &cipherText = cipherText_.lock();
-
- const _detail::ToThreadMover ctMover(cipherText, thread);
- const _detail::ToThreadMover ptMover(plainText, thread);
-
- QGpgME::QIODeviceDataProvider in(plainText);
- Data indata(&in);
- if (!plainText->isSequential()) {
- indata.setSizeHint(plainText->size());
- }
-
- const auto pureFileName = QFileInfo{fileName}.fileName().toStdString();
- if (!pureFileName.empty()) {
- indata.setFileName(pureFileName.c_str());
- }
-
- ctx->clearSigningKeys();
- for (const Key &signer : signers) {
- if (!signer.isNull()) {
- if (const Error err = ctx->addSigningKey(signer)) {
- return std::make_tuple(SigningResult(err), EncryptionResult(), QByteArray(), QString(), Error());
- }
- }
- }
-
- if (!cipherText) {
- QGpgME::QByteArrayDataProvider out;
- Data outdata(&out);
-
- if (outputIsBsse64Encoded) {
- outdata.setEncoding(Data::Base64Encoding);
- }
-
- const std::pair<SigningResult, EncryptionResult> res = ctx->signAndEncrypt(recipients, indata, outdata, eflags);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res.first, res.second, out.data(), log, ae);
- } else {
- QGpgME::QIODeviceDataProvider out(cipherText);
- Data outdata(&out);
-
- if (outputIsBsse64Encoded) {
- outdata.setEncoding(Data::Base64Encoding);
- }
-
- const std::pair<SigningResult, EncryptionResult> res = ctx->signAndEncrypt(recipients, indata, outdata, eflags);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res.first, res.second, QByteArray(), log, ae);
- }
-
-}
-
-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 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, fileName);
-}
-
-static QGpgMESignEncryptJob::result_type sign_encrypt_to_filename(Context *ctx,
- const std::vector<Key> &signers,
- const std::vector<Key> &recipients,
- const QString &inputFilePath,
- const QString &outputFilePath,
- Context::EncryptionFlags flags)
-{
- Data indata;
-#ifdef Q_OS_WIN
- indata.setFileName(inputFilePath.toUtf8().constData());
-#else
- indata.setFileName(QFile::encodeName(inputFilePath).constData());
-#endif
-
- PartialFileGuard partFileGuard{outputFilePath};
- if (partFileGuard.tempFileName().isEmpty()) {
- return std::make_tuple(SigningResult{Error::fromCode(GPG_ERR_EEXIST)},
- EncryptionResult{Error::fromCode(GPG_ERR_EEXIST)},
- QByteArray{},
- QString{},
- Error{});
- }
-
- Data outdata;
-#ifdef Q_OS_WIN
- outdata.setFileName(partFileGuard.tempFileName().toUtf8().constData());
-#else
- outdata.setFileName(QFile::encodeName(partFileGuard.tempFileName()).constData());
-#endif
-
- ctx->clearSigningKeys();
- for (const Key &signer : signers) {
- if (!signer.isNull()) {
- if (const Error err = ctx->addSigningKey(signer)) {
- return std::make_tuple(SigningResult{err}, EncryptionResult{}, QByteArray{}, QString{}, Error{});
- }
- }
- }
-
- flags = static_cast<Context::EncryptionFlags>(flags | Context::EncryptFile);
- const auto results = ctx->signAndEncrypt(recipients, indata, outdata, flags);
- const auto &signingResult = results.first;
- const auto &encryptionResult = results.second;
-
- if (!signingResult.error().code() && !encryptionResult.error().code()) {
- // the operation succeeded -> save the result under the requested file name
- partFileGuard.commit();
- }
-
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(signingResult, encryptionResult, QByteArray{}, log, ae);
-}
-
-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, 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, 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)
-{
- return start(signers, recipients, plainText, cipherText, alwaysTrust ? Context::AlwaysTrust : Context::None);
-}
-
-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, fileName());
- cipherText = std::get<2>(r);
- return std::make_pair(std::get<0>(r), std::get<1>(r));
-}
-
-std::pair<SigningResult, EncryptionResult> QGpgMESignEncryptJob::exec(const std::vector<Key> &signers, const std::vector<Key> &recipients, const QByteArray &plainText, bool alwaysTrust, QByteArray &cipherText)
-{
- return exec(signers, recipients, plainText, alwaysTrust ? Context::AlwaysTrust : Context::None, cipherText);
-}
-
-GpgME::Error QGpgMESignEncryptJobPrivate::startIt()
-{
- if (m_inputFilePath.isEmpty() || m_outputFilePath.isEmpty()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return sign_encrypt_to_filename(ctx, m_signers, m_recipients, m_inputFilePath, m_outputFilePath, m_encryptionFlags);
- });
-
- return {};
-}
-
-#include "qgpgmesignencryptjob.moc"
diff --git a/lang/qt/src/qgpgmesignencryptjob.h b/lang/qt/src/qgpgmesignencryptjob.h
deleted file mode 100644
index a0014d2b..00000000
--- a/lang/qt/src/qgpgmesignencryptjob.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- qgpgmesignencryptjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- 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
-
- 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_QGPGMESIGNENCRYPTJOB_H__
-#define __QGPGME_QGPGMESIGNENCRYPTJOB_H__
-
-#include "signencryptjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/signingresult.h>
-#include <gpgme++/encryptionresult.h>
-#include <gpgme++/key.h>
-
-#include <utility>
-
-namespace QGpgME
-{
-
-class QGpgMESignEncryptJob
-#ifdef Q_MOC_RUN
- : public SignEncryptJob
-#else
- : public _detail::ThreadedJobMixin<SignEncryptJob, std::tuple<GpgME::SigningResult, GpgME::EncryptionResult, QByteArray, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMESignEncryptJob(GpgME::Context *context);
- ~QGpgMESignEncryptJob();
-
- /* from SignEncryptJob */
- GpgME::Error start(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText, bool alwaysTrust) override;
-
- /* from SignEncryptJob */
- void start(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &cipherText,
- bool alwaysTrust) override;
-
- void start(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &cipherText,
- const GpgME::Context::EncryptionFlags flags) override;
-
- std::pair<GpgME::SigningResult, GpgME::EncryptionResult>
- exec(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText, bool alwaysTrust,
- QByteArray &cipherText) override;
-
- std::pair<GpgME::SigningResult, GpgME::EncryptionResult>
- exec(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText, const GpgME::Context::EncryptionFlags flags,
- QByteArray &cipherText) override;
-
- /* from SignEncryptJob */
- void setOutputIsBase64Encoded(bool on) override;
-
-private:
- bool mOutputIsBase64Encoded;
-};
-
-}
-
-#endif // __QGPGME_QGPGMESIGNENCRYPTJOB_H__
diff --git a/lang/qt/src/qgpgmesignjob.cpp b/lang/qt/src/qgpgmesignjob.cpp
deleted file mode 100644
index 79077f4a..00000000
--- a/lang/qt/src/qgpgmesignjob.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- qgpgmesignjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- 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
-
- 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 "qgpgmesignjob.h"
-
-#include "dataprovider.h"
-#include "signjob_p.h"
-#include "util.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/signingresult.h>
-
-#include <QBuffer>
-#include <QFile>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMESignJobPrivate : public SignJobPrivate
-{
- QGpgMESignJob *q = nullptr;
-
-public:
- QGpgMESignJobPrivate(QGpgMESignJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMESignJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMESignJob::QGpgMESignJob(Context *context)
- : mixin_type(context),
- mOutputIsBase64Encoded(false)
-{
- setJobPrivate(this, std::unique_ptr<QGpgMESignJobPrivate>{new QGpgMESignJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMESignJob::~QGpgMESignJob() {}
-
-void QGpgMESignJob::setOutputIsBase64Encoded(bool on)
-{
- mOutputIsBase64Encoded = on;
-}
-
-static QGpgMESignJob::result_type sign(Context *ctx, QThread *thread,
- const std::vector<Key> &signers,
- const std::weak_ptr<QIODevice> &plainText_,
- const std::weak_ptr<QIODevice> &signature_,
- SignatureMode mode,
- bool outputIsBsse64Encoded)
-{
-
- const std::shared_ptr<QIODevice> plainText = plainText_.lock();
- const std::shared_ptr<QIODevice> signature = signature_.lock();
-
- const _detail::ToThreadMover ptMover(plainText, thread);
- const _detail::ToThreadMover sgMover(signature, thread);
-
- QGpgME::QIODeviceDataProvider in(plainText);
- Data indata(&in);
- if (!plainText->isSequential()) {
- indata.setSizeHint(plainText->size());
- }
-
- ctx->clearSigningKeys();
- for (const Key &signer : signers) {
- if (!signer.isNull()) {
- if (const Error err = ctx->addSigningKey(signer)) {
- return std::make_tuple(SigningResult(err), QByteArray(), QString(), Error());
- }
- }
- }
-
- if (!signature) {
- QGpgME::QByteArrayDataProvider out;
- Data outdata(&out);
-
- if (outputIsBsse64Encoded) {
- outdata.setEncoding(Data::Base64Encoding);
- }
-
- const SigningResult res = ctx->sign(indata, outdata, mode);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, out.data(), log, ae);
- } else {
- QGpgME::QIODeviceDataProvider out(signature);
- Data outdata(&out);
-
- if (outputIsBsse64Encoded) {
- outdata.setEncoding(Data::Base64Encoding);
- }
-
- const SigningResult res = ctx->sign(indata, outdata, mode);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, QByteArray(), log, ae);
- }
-
-}
-
-static QGpgMESignJob::result_type sign_qba(Context *ctx,
- const std::vector<Key> &signers,
- const QByteArray &plainText,
- SignatureMode mode,
- bool outputIsBsse64Encoded)
-{
- 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(ctx, nullptr, signers, buffer, std::shared_ptr<QIODevice>(), mode, outputIsBsse64Encoded);
-}
-
-static QGpgMESignJob::result_type sign_to_filename(Context *ctx,
- const std::vector<Key> &signers,
- const QString &inputFilePath,
- const QString &outputFilePath,
- SignatureMode flags,
- bool appendSignature)
-{
- Data indata;
-#ifdef Q_OS_WIN
- indata.setFileName(inputFilePath.toUtf8().constData());
-#else
- indata.setFileName(QFile::encodeName(inputFilePath).constData());
-#endif
-
- PartialFileGuard partFileGuard{outputFilePath};
- if (partFileGuard.tempFileName().isEmpty()) {
- return std::make_tuple(SigningResult{Error::fromCode(GPG_ERR_EEXIST)},
- QByteArray{},
- QString{},
- Error{});
- }
-
- Data outdata;
-#ifdef Q_OS_WIN
- outdata.setFileName(partFileGuard.tempFileName().toUtf8().constData());
-#else
- outdata.setFileName(QFile::encodeName(partFileGuard.tempFileName()).constData());
-#endif
-
- ctx->clearSigningKeys();
- for (const Key &signer : signers) {
- if (!signer.isNull()) {
- if (const Error err = ctx->addSigningKey(signer)) {
- return std::make_tuple(SigningResult{err}, QByteArray{}, QString{}, Error{});
- }
- }
- }
-
- flags = static_cast<SignatureMode>(flags | SignFile);
- const auto signingResult = ctx->sign(indata, outdata, flags);
-
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
-
- if (!signingResult.error().code()) {
- // the operation succeeded
- const bool appendSignatureToExistingFile = appendSignature && (flags & Detached) && QFile::exists(outputFilePath);
- if (appendSignatureToExistingFile) {
- // append the result to the existing file
- QFile newSignatureFile{partFileGuard.tempFileName()};
- if (!newSignatureFile.open(QIODevice::ReadOnly)) {
- qCDebug(QGPGME_LOG) << "Failed to open detached signature file" << newSignatureFile.fileName() << "(" << newSignatureFile.errorString() << ")";
- return std::make_tuple(SigningResult{Error::fromCode(GPG_ERR_GENERAL)}, QByteArray{}, log, ae);
- }
- const QByteArray newSigData = newSignatureFile.readAll();
- if (newSigData.isEmpty()) {
- qCDebug(QGPGME_LOG) << "Failed to read detached signature from file" << newSignatureFile.fileName() << "(" << newSignatureFile.errorString() << ")";
- return std::make_tuple(SigningResult{Error::fromCode(GPG_ERR_GENERAL)}, QByteArray{}, log, ae);
- }
- newSignatureFile.close();
-
- QFile existingSignatureFile{outputFilePath};
- if (!existingSignatureFile.open(QIODevice::WriteOnly | QIODevice::Append)) {
- qCDebug(QGPGME_LOG) << "Failed to open existing detached signature file for appending" << existingSignatureFile.fileName() << "(" << existingSignatureFile.errorString() << ")";
- return std::make_tuple(SigningResult{Error::fromCode(GPG_ERR_GENERAL)}, QByteArray{}, log, ae);
- }
- const auto bytesWritten = existingSignatureFile.write(newSigData);
- if (bytesWritten != newSigData.size()) {
- qCDebug(QGPGME_LOG) << "Failed to write new signature to existing detached signature file" << existingSignatureFile.fileName() << "(" << existingSignatureFile.errorString() << ")";
- return std::make_tuple(SigningResult{Error::fromCode(GPG_ERR_GENERAL)}, QByteArray{}, log, ae);
- }
- } else {
- // save the result under the requested file name
- partFileGuard.commit();
- }
- }
-
- return std::make_tuple(signingResult, QByteArray{}, log, ae);
-}
-
-Error QGpgMESignJob::start(const std::vector<Key> &signers, const QByteArray &plainText, SignatureMode mode)
-{
- run(std::bind(&sign_qba, std::placeholders::_1, signers, plainText, mode, mOutputIsBase64Encoded));
- return Error();
-}
-
-void QGpgMESignJob::start(const std::vector<Key> &signers, const std::shared_ptr<QIODevice> &plainText, const std::shared_ptr<QIODevice> &signature, SignatureMode mode)
-{
- run(std::bind(&sign, std::placeholders::_1, std::placeholders::_2, signers, std::placeholders::_3, std::placeholders::_4, mode, mOutputIsBase64Encoded), plainText, signature);
-}
-
-SigningResult QGpgMESignJob::exec(const std::vector<Key> &signers, const QByteArray &plainText, SignatureMode mode, QByteArray &signature)
-{
- const result_type r = sign_qba(context(), signers, plainText, mode, mOutputIsBase64Encoded);
- signature = std::get<1>(r);
- return std::get<0>(r);
-}
-
-GpgME::Error QGpgMESignJobPrivate::startIt()
-{
- if (m_inputFilePath.isEmpty() || m_outputFilePath.isEmpty()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return sign_to_filename(ctx, m_signers, m_inputFilePath, m_outputFilePath, m_signingFlags, m_appendSignature);
- });
-
- return {};
-}
-
-#include "qgpgmesignjob.moc"
diff --git a/lang/qt/src/qgpgmesignjob.h b/lang/qt/src/qgpgmesignjob.h
deleted file mode 100644
index 27d352d0..00000000
--- a/lang/qt/src/qgpgmesignjob.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- qgpgmesignjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- 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
-
- 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_QGPGMESIGNJOB_H__
-#define __QGPGME_QGPGMESIGNJOB_H__
-
-#include "signjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/signingresult.h>
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-class QGpgMESignJob
-#ifdef Q_MOC_RUN
- : public SignJob
-#else
- : public _detail::ThreadedJobMixin<SignJob, std::tuple<GpgME::SigningResult, QByteArray, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMESignJob(GpgME::Context *context);
- ~QGpgMESignJob();
-
- /* from SignJob */
- GpgME::Error start(const std::vector<GpgME::Key> &signers,
- const QByteArray &plainText,
- GpgME::SignatureMode mode) override;
-
- /* from SignJob */
- void start(const std::vector<GpgME::Key> &signers,
- const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &signature,
- GpgME::SignatureMode mode) override;
-
- /* from SignJob */
- GpgME::SigningResult exec(const std::vector<GpgME::Key> &signers,
- const QByteArray &plainText,
- GpgME::SignatureMode mode,
- QByteArray &signature) override;
-
- /* from SignJob */
- void setOutputIsBase64Encoded(bool on) override;
-
-private:
- bool mOutputIsBase64Encoded;
-};
-
-}
-
-#endif // __QGPGME_QGPGMESIGNJOB_H__
diff --git a/lang/qt/src/qgpgmesignkeyjob.cpp b/lang/qt/src/qgpgmesignkeyjob.cpp
deleted file mode 100644
index 0fdab165..00000000
--- a/lang/qt/src/qgpgmesignkeyjob.cpp
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- qgpgmesignkeyjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "qgpgmesignkeyjob.h"
-
-#include <QDate>
-#include <QString>
-
-#include "dataprovider.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/gpgsignkeyeditinteractor.h>
-
-#include "qgpgme_debug.h"
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-struct TrustSignatureProperties {
- TrustSignatureProperties() = default;
- // needed for C++11 because until C++14 "aggregate initialization requires
- // class type, that has no default member initializers"
- TrustSignatureProperties(TrustSignatureTrust trust_, unsigned int depth_, const QString &scope_)
- : trust{trust_}
- , depth{depth_}
- , scope{scope_}
- {}
-
- TrustSignatureTrust trust = TrustSignatureTrust::None;
- unsigned int depth = 0;
- QString scope;
-};
-}
-
-class QGpgMESignKeyJob::Private
-{
-public:
- Private() = default;
-
- std::vector<unsigned int> m_userIDsToSign;
- GpgME::Key m_signingKey;
- unsigned int m_checkLevel = 0;
- bool m_exportable = false;
- bool m_nonRevocable = false;
- bool m_started = false;
- bool m_dupeOk = false;
- QString m_remark;
- TrustSignatureProperties m_trustSignature;
- QDate m_expiration;
-};
-
-QGpgMESignKeyJob::QGpgMESignKeyJob(Context *context)
- : mixin_type(context)
- , d{std::unique_ptr<Private>(new Private())}
-{
- lateInitialization();
-}
-
-QGpgMESignKeyJob::~QGpgMESignKeyJob() {}
-
-static QGpgMESignKeyJob::result_type sign_key(Context *ctx, const Key &key, const std::vector<unsigned int> &uids,
- unsigned int checkLevel, const Key &signer, unsigned int opts,
- bool dupeOk, const QString &remark,
- const TrustSignatureProperties &trustSignature,
- const QDate &expirationDate)
-{
- QGpgME::QByteArrayDataProvider dp;
- Data data(&dp);
-
- GpgSignKeyEditInteractor *skei(new GpgSignKeyEditInteractor);
- skei->setUserIDsToSign(uids);
- skei->setCheckLevel(checkLevel);
- skei->setSigningOptions(opts);
- skei->setKey(key);
-
- if (dupeOk) {
- ctx->setFlag("extended-edit", "1");
- skei->setDupeOk(true);
- }
-
- if (!remark.isEmpty()) {
- ctx->addSignatureNotation("[email protected]", remark.toUtf8().constData());
- }
-
- if (opts & GpgSignKeyEditInteractor::Trust) {
- skei->setTrustSignatureTrust(trustSignature.trust);
- skei->setTrustSignatureDepth(trustSignature.depth);
- skei->setTrustSignatureScope(trustSignature.scope.toUtf8().toStdString());
- }
-
- if (!signer.isNull()) {
- if (const Error err = ctx->addSigningKey(signer)) {
- return std::make_tuple(err, QString(), Error());
- }
- }
-
- 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-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) {
- 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
- const auto daysFromNow = QDate::currentDate().daysTo(clippedExpirationDate);
- if (daysFromNow > 0) {
- const auto certExpire = std::to_string(daysFromNow) + "d";
- ctx->setFlag("cert-expire", certExpire.c_str());
- }
- } else {
- // explicitly set "cert-expire" to "0" (no expiration) to override default-cert-expire set in gpg.conf
- ctx->setFlag("cert-expire", "0");
- }
-
- const Error err = ctx->edit(key, std::unique_ptr<EditInteractor> (skei), data);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(err, log, ae);
-}
-
-Error QGpgMESignKeyJob::start(const Key &key)
-{
- unsigned int opts = 0;
- if (d->m_nonRevocable) {
- opts |= GpgSignKeyEditInteractor::NonRevocable;
- }
- if (d->m_exportable) {
- opts |= GpgSignKeyEditInteractor::Exportable;
- }
- switch (d->m_trustSignature.trust) {
- case TrustSignatureTrust::Partial:
- case TrustSignatureTrust::Complete:
- opts |= GpgSignKeyEditInteractor::Trust;
- break;
- default:
- opts &= ~GpgSignKeyEditInteractor::Trust;
- break;
- }
- run(std::bind(&sign_key, std::placeholders::_1, key, d->m_userIDsToSign, d->m_checkLevel, d->m_signingKey,
- opts, d->m_dupeOk, d->m_remark, d->m_trustSignature, d->m_expiration));
- d->m_started = true;
- return Error();
-}
-
-void QGpgMESignKeyJob::setUserIDsToSign(const std::vector<unsigned int> &idsToSign)
-{
- assert(!d->m_started);
- d->m_userIDsToSign = idsToSign;
-}
-
-void QGpgMESignKeyJob::setCheckLevel(unsigned int checkLevel)
-{
- assert(!d->m_started);
- d->m_checkLevel = checkLevel;
-}
-
-void QGpgMESignKeyJob::setExportable(bool exportable)
-{
- assert(!d->m_started);
- d->m_exportable = exportable;
-}
-
-void QGpgMESignKeyJob::setSigningKey(const Key &key)
-{
- assert(!d->m_started);
- d->m_signingKey = key;
-}
-
-void QGpgMESignKeyJob::setNonRevocable(bool nonRevocable)
-{
- assert(!d->m_started);
- d->m_nonRevocable = nonRevocable;
-}
-
-void QGpgMESignKeyJob::setRemark(const QString &remark)
-{
- assert(!d->m_started);
- d->m_remark = remark;
-}
-
-void QGpgMESignKeyJob::setDupeOk(bool value)
-{
- assert(!d->m_started);
- d->m_dupeOk = value;
-}
-
-void QGpgMESignKeyJob::setTrustSignature(GpgME::TrustSignatureTrust trust, unsigned short depth, const QString &scope)
-{
- assert(!d->m_started);
- assert(depth <= 255);
- d->m_trustSignature = {trust, depth, scope};
-}
-
-void QGpgMESignKeyJob::setExpirationDate(const QDate &expiration)
-{
- assert(!d->m_started);
- d->m_expiration = expiration;
-}
-
-#include "qgpgmesignkeyjob.moc"
diff --git a/lang/qt/src/qgpgmesignkeyjob.h b/lang/qt/src/qgpgmesignkeyjob.h
deleted file mode 100644
index 0316beb6..00000000
--- a/lang/qt/src/qgpgmesignkeyjob.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- qgpgmesignkeyjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_QGPGMESIGNKEYJOB_H__
-#define __QGPGME_QGPGMESIGNKEYJOB_H__
-
-#include "signkeyjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <memory>
-
-namespace QGpgME
-{
-
-class QGpgMESignKeyJob
-#ifdef Q_MOC_RUN
- : public SignKeyJob
-#else
- : public _detail::ThreadedJobMixin<SignKeyJob>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMESignKeyJob(GpgME::Context *context);
- ~QGpgMESignKeyJob();
-
- /* from SignKeyJob */
- GpgME::Error start(const GpgME::Key &key) override;
-
- /* from SignKeyJob */
- void setUserIDsToSign(const std::vector<unsigned int> &idsToSign) override;
-
- /* from SignKeyJob */
- void setCheckLevel(unsigned int checkLevel) override;
-
- /* from SignKeyJob */
- void setExportable(bool exportable) override;
-
- /* from SignKeyJob */
- void setSigningKey(const GpgME::Key &key) override;
-
- /* from SignKeyJob */
- void setNonRevocable(bool nonRevocable) override;
-
- /* from SignKeyJob */
- void setRemark(const QString &remark) override;
-
- /* from SignKeyJob */
- void setDupeOk(bool value) override;
-
- /* from SignKeyJob */
- void setTrustSignature(GpgME::TrustSignatureTrust trust, unsigned short depth, const QString &scope) override;
-
- void setExpirationDate(const QDate &expiration) override;
-
-private:
- class Private;
- std::unique_ptr<Private> d;
-};
-}
-
-#endif // __QGPGME_QGPGMESIGNKEYJOB_H__
diff --git a/lang/qt/src/qgpgmetofupolicyjob.cpp b/lang/qt/src/qgpgmetofupolicyjob.cpp
deleted file mode 100644
index f5d43fa1..00000000
--- a/lang/qt/src/qgpgmetofupolicyjob.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/* qgpgmetofupolicyjob.cpp
-
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "qgpgmetofupolicyjob.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/key.h>
-#include <gpgme++/tofuinfo.h>
-
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMETofuPolicyJob::QGpgMETofuPolicyJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMETofuPolicyJob::~QGpgMETofuPolicyJob() {}
-
-static QGpgMETofuPolicyJob::result_type policy_worker(Context *ctx, const Key &key, TofuInfo::Policy policy)
-{
- return std::make_tuple (ctx->setTofuPolicy(key, policy),
- QString(), Error());
-}
-
-void QGpgMETofuPolicyJob::start(const Key &key, TofuInfo::Policy policy)
-{
- run(std::bind(&policy_worker, std::placeholders::_1, key, policy));
-}
-
-Error QGpgMETofuPolicyJob::exec(const Key &key, TofuInfo::Policy policy)
-{
- return std::get<0>(policy_worker(context(), key, policy));
-}
-
-#include "qgpgmetofupolicyjob.moc"
diff --git a/lang/qt/src/qgpgmetofupolicyjob.h b/lang/qt/src/qgpgmetofupolicyjob.h
deleted file mode 100644
index ad09045d..00000000
--- a/lang/qt/src/qgpgmetofupolicyjob.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* qgpgmetofupolicyjob.h
-
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_QGPGMETOFUPOLICYJOB_H
-#define QGPGME_QGPGMETOFUPOLICYJOB_H
-
-#include "tofupolicyjob.h"
-
-#include "threadedjobmixin.h"
-namespace GpgME
-{
- class Key;
-} // namespace GpgME
-
-namespace QGpgME {
-
-class QGpgMETofuPolicyJob
-#ifdef Q_MOC_RUN
- : public TofuPolicyJob
-#else
- : public _detail::ThreadedJobMixin<TofuPolicyJob, std::tuple<GpgME::Error, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMETofuPolicyJob(GpgME::Context *context);
- ~QGpgMETofuPolicyJob();
-
- void start(const GpgME::Key &key, GpgME::TofuInfo::Policy policy) override;
- GpgME::Error exec(const GpgME::Key &key, GpgME::TofuInfo::Policy policy) override;
-};
-
-}
-
-#endif
diff --git a/lang/qt/src/qgpgmeverifydetachedjob.cpp b/lang/qt/src/qgpgmeverifydetachedjob.cpp
deleted file mode 100644
index 91d89f96..00000000
--- a/lang/qt/src/qgpgmeverifydetachedjob.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- qgpgmeverifydetachedjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- 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
-
- 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 "qgpgmeverifydetachedjob.h"
-
-#include "dataprovider.h"
-#include "util.h"
-#include "verifydetachedjob_p.h"
-
-#include <QFile>
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/verificationresult.h>
-
-#include <cassert>
-
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEVerifyDetachedJobPrivate : public VerifyDetachedJobPrivate
-{
- QGpgMEVerifyDetachedJob *q = nullptr;
-
-public:
- QGpgMEVerifyDetachedJobPrivate(QGpgMEVerifyDetachedJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEVerifyDetachedJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMEVerifyDetachedJob::QGpgMEVerifyDetachedJob(Context *context)
- : mixin_type(context)
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEVerifyDetachedJobPrivate>{new QGpgMEVerifyDetachedJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMEVerifyDetachedJob::~QGpgMEVerifyDetachedJob() {}
-
-static QGpgMEVerifyDetachedJob::result_type verify_detached(Context *ctx, QThread *thread, const std::weak_ptr<QIODevice> &signature_, const std::weak_ptr<QIODevice> &signedData_)
-{
- const std::shared_ptr<QIODevice> signature = signature_.lock();
- const std::shared_ptr<QIODevice> signedData = signedData_.lock();
-
- const _detail::ToThreadMover sgMover(signature, thread);
- const _detail::ToThreadMover sdMover(signedData, thread);
-
- QGpgME::QIODeviceDataProvider sigDP(signature);
- Data sig(&sigDP);
-
- QGpgME::QIODeviceDataProvider dataDP(signedData);
- Data data(&dataDP);
- if (!signedData->isSequential()) {
- data.setSizeHint(signedData->size());
- }
-
- const VerificationResult res = ctx->verifyDetachedSignature(sig, data);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
-
- return std::make_tuple(res, log, ae);
-}
-
-static QGpgMEVerifyDetachedJob::result_type verify_detached_qba(Context *ctx, const QByteArray &signature, const QByteArray &signedData)
-{
- QGpgME::QByteArrayDataProvider sigDP(signature);
- Data sig(&sigDP);
-
- QGpgME::QByteArrayDataProvider dataDP(signedData);
- Data data(&dataDP);
-
- const VerificationResult res = ctx->verifyDetachedSignature(sig, data);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
-
- return std::make_tuple(res, log, ae);
-
-}
-
-static QGpgMEVerifyDetachedJob::result_type verify_from_filename(Context *ctx,
- const QString &signatureFilePath,
- const QString &signedFilePath,
- bool processAllSignatures)
-{
- Data signatureData;
-#ifdef Q_OS_WIN
- signatureData.setFileName(signatureFilePath.toUtf8().constData());
-#else
- signatureData.setFileName(QFile::encodeName(signatureFilePath).constData());
-#endif
-
- Data signedData;
-#ifdef Q_OS_WIN
- signedData.setFileName(signedFilePath.toUtf8().constData());
-#else
- signedData.setFileName(QFile::encodeName(signedFilePath).constData());
-#endif
-
- if (processAllSignatures) {
- ctx->setFlag("proc-all-sigs", "1");
- }
- const auto verificationResult = ctx->verifyDetachedSignature(signatureData, signedData);
-
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(verificationResult, log, ae);
-}
-
-Error QGpgMEVerifyDetachedJob::start(const QByteArray &signature, const QByteArray &signedData)
-{
- if (processAllSignatures()) {
- context()->setFlag("proc-all-sigs", "1");
- }
- run(std::bind(&verify_detached_qba, std::placeholders::_1, signature, signedData));
- return Error();
-}
-
-void QGpgMEVerifyDetachedJob::start(const std::shared_ptr<QIODevice> &signature, const std::shared_ptr<QIODevice> &signedData)
-{
- if (processAllSignatures()) {
- context()->setFlag("proc-all-sigs", "1");
- }
- run(std::bind(&verify_detached, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), signature, signedData);
-}
-
-GpgME::VerificationResult QGpgME::QGpgMEVerifyDetachedJob::exec(const QByteArray &signature,
- const QByteArray &signedData)
-{
- if (processAllSignatures()) {
- context()->setFlag("proc-all-sigs", "1");
- }
- const result_type r = verify_detached_qba(context(), signature, signedData);
- return std::get<0>(r);
-}
-
-GpgME::Error QGpgMEVerifyDetachedJobPrivate::startIt()
-{
- if (m_signatureFilePath.isEmpty() || m_signedFilePath.isEmpty()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return verify_from_filename(ctx, m_signatureFilePath, m_signedFilePath, m_processAllSignatures);
- });
-
- return {};
-}
-
-#include "qgpgmeverifydetachedjob.moc"
diff --git a/lang/qt/src/qgpgmeverifydetachedjob.h b/lang/qt/src/qgpgmeverifydetachedjob.h
deleted file mode 100644
index 36350254..00000000
--- a/lang/qt/src/qgpgmeverifydetachedjob.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- qgpgmeverifydetachedjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- 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
-
- 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_QGPGMEVERIFYDETACHEDJOB_H__
-#define __QGPGME_QGPGMEVERIFYDETACHEDJOB_H__
-
-#include "verifydetachedjob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/verificationresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEVerifyDetachedJob
-#ifdef Q_MOC_RUN
- : public VerifyDetachedJob
-#else
- : public _detail::ThreadedJobMixin<VerifyDetachedJob, std::tuple<GpgME::VerificationResult, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEVerifyDetachedJob(GpgME::Context *context);
- ~QGpgMEVerifyDetachedJob();
-
- /* from VerifyDetachedJob */
- GpgME::Error start(const QByteArray &signature, const QByteArray &signedData) override;
-
- /* from VerifyDetachedJob */
- void start(const std::shared_ptr<QIODevice> &signature, const std::shared_ptr<QIODevice> &signedData) override;
-
- /* from VerifyDetachedJob */
- GpgME::VerificationResult exec(const QByteArray &signature,
- const QByteArray &signedData) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEVERIFYDETACHEDJOB_H__
diff --git a/lang/qt/src/qgpgmeverifyopaquejob.cpp b/lang/qt/src/qgpgmeverifyopaquejob.cpp
deleted file mode 100644
index 0cca9f72..00000000
--- a/lang/qt/src/qgpgmeverifyopaquejob.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- qgpgmeverifyopaquejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- 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
-
- 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 "qgpgmeverifyopaquejob.h"
-
-#include "dataprovider.h"
-#include "util.h"
-#include "verifyopaquejob_p.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/verificationresult.h>
-
-#include <QBuffer>
-#include <QFile>
-
-#include <cassert>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEVerifyOpaqueJobPrivate : public VerifyOpaqueJobPrivate
-{
- QGpgMEVerifyOpaqueJob *q = nullptr;
-
-public:
- QGpgMEVerifyOpaqueJobPrivate(QGpgMEVerifyOpaqueJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEVerifyOpaqueJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-}
-
-QGpgMEVerifyOpaqueJob::QGpgMEVerifyOpaqueJob(Context *context)
- : mixin_type(context)
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEVerifyOpaqueJobPrivate>{new QGpgMEVerifyOpaqueJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMEVerifyOpaqueJob::~QGpgMEVerifyOpaqueJob() {}
-
-static QGpgMEVerifyOpaqueJob::result_type verify_opaque(Context *ctx, QThread *thread, const std::weak_ptr<QIODevice> &signedData_, const std::weak_ptr<QIODevice> &plainText_)
-{
-
- const std::shared_ptr<QIODevice> plainText = plainText_.lock();
- const std::shared_ptr<QIODevice> signedData = signedData_.lock();
-
- const _detail::ToThreadMover ptMover(plainText, thread);
- const _detail::ToThreadMover sdMover(signedData, thread);
-
- QGpgME::QIODeviceDataProvider in(signedData);
- Data indata(&in);
- if (!signedData->isSequential()) {
- indata.setSizeHint(signedData->size());
- }
-
- if (!plainText) {
- QGpgME::QByteArrayDataProvider out;
- Data outdata(&out);
-
- const VerificationResult res = ctx->verifyOpaqueSignature(indata, outdata);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, out.data(), log, ae);
- } else {
- QGpgME::QIODeviceDataProvider out(plainText);
- Data outdata(&out);
-
- const VerificationResult res = ctx->verifyOpaqueSignature(indata, outdata);
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(res, QByteArray(), log, ae);
- }
-
-}
-
-static QGpgMEVerifyOpaqueJob::result_type verify_opaque_qba(Context *ctx, const QByteArray &signedData)
-{
- const std::shared_ptr<QBuffer> buffer(new QBuffer);
- buffer->setData(signedData);
- if (!buffer->open(QIODevice::ReadOnly)) {
- assert(!"This should never happen: QBuffer::open() failed");
- }
- return verify_opaque(ctx, nullptr, buffer, std::shared_ptr<QIODevice>());
-}
-
-static QGpgMEVerifyOpaqueJob::result_type verify_from_filename(Context *ctx,
- const QString &inputFilePath,
- const QString &outputFilePath,
- bool processAllSignatures)
-{
- Data indata;
-#ifdef Q_OS_WIN
- indata.setFileName(inputFilePath.toUtf8().constData());
-#else
- indata.setFileName(QFile::encodeName(inputFilePath).constData());
-#endif
-
- PartialFileGuard partFileGuard{outputFilePath};
- if (partFileGuard.tempFileName().isEmpty()) {
- return std::make_tuple(VerificationResult{Error::fromCode(GPG_ERR_EEXIST)}, QByteArray{}, QString{}, Error{});
- }
-
- Data outdata;
-#ifdef Q_OS_WIN
- outdata.setFileName(partFileGuard.tempFileName().toUtf8().constData());
-#else
- outdata.setFileName(QFile::encodeName(partFileGuard.tempFileName()).constData());
-#endif
-
- if (processAllSignatures) {
- ctx->setFlag("proc-all-sigs", "1");
- }
- const auto verificationResult = ctx->verifyOpaqueSignature(indata, outdata);
-
- if (!verificationResult.error().code()) {
- // the operation succeeded -> save the result under the requested file name
- partFileGuard.commit();
- }
-
- Error ae;
- const QString log = _detail::audit_log_as_html(ctx, ae);
- return std::make_tuple(verificationResult, QByteArray{}, log, ae);
-}
-
-Error QGpgMEVerifyOpaqueJob::start(const QByteArray &signedData)
-{
- if (processAllSignatures()) {
- context()->setFlag("proc-all-sigs", "1");
- }
- run(std::bind(&verify_opaque_qba, std::placeholders::_1, signedData));
- return Error();
-}
-
-void QGpgMEVerifyOpaqueJob::start(const std::shared_ptr<QIODevice> &signedData, const std::shared_ptr<QIODevice> &plainText)
-{
- if (processAllSignatures()) {
- context()->setFlag("proc-all-sigs", "1");
- }
- run(std::bind(&verify_opaque, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), signedData, plainText);
-}
-
-GpgME::VerificationResult QGpgME::QGpgMEVerifyOpaqueJob::exec(const QByteArray &signedData, QByteArray &plainText)
-{
- if (processAllSignatures()) {
- context()->setFlag("proc-all-sigs", "1");
- }
- const result_type r = verify_opaque_qba(context(), signedData);
- plainText = std::get<1>(r);
- return std::get<0>(r);
-}
-
-GpgME::Error QGpgMEVerifyOpaqueJobPrivate::startIt()
-{
- if (m_inputFilePath.isEmpty() || m_outputFilePath.isEmpty()) {
- return Error::fromCode(GPG_ERR_INV_VALUE);
- }
-
- q->run([=](Context *ctx) {
- return verify_from_filename(ctx, m_inputFilePath, m_outputFilePath, m_processAllSignatures);
- });
-
- return {};
-}
-
-#include "qgpgmeverifyopaquejob.moc"
diff --git a/lang/qt/src/qgpgmeverifyopaquejob.h b/lang/qt/src/qgpgmeverifyopaquejob.h
deleted file mode 100644
index b46de8f8..00000000
--- a/lang/qt/src/qgpgmeverifyopaquejob.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- qgpgmeverifyopaquejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- 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
-
- 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_QGPGMEVERIFYOPAQUEJOB_H__
-#define __QGPGME_QGPGMEVERIFYOPAQUEJOB_H__
-
-#include "verifyopaquejob.h"
-
-#include "threadedjobmixin.h"
-
-#include <gpgme++/verificationresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEVerifyOpaqueJob
-#ifdef Q_MOC_RUN
- : public VerifyOpaqueJob
-#else
- : public _detail::ThreadedJobMixin<VerifyOpaqueJob, std::tuple<GpgME::VerificationResult, QByteArray, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEVerifyOpaqueJob(GpgME::Context *context);
- ~QGpgMEVerifyOpaqueJob();
-
- /* from VerifyOpaqueJob */
- GpgME::Error start(const QByteArray &signedData) override;
-
- /* from VerifyOpaqueJob */
- void start(const std::shared_ptr<QIODevice> &signedData, const std::shared_ptr<QIODevice> &plainText) override;
-
- /* form VerifyOpaqueJob */
- GpgME::VerificationResult exec(const QByteArray &signedData, QByteArray &plainData) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEVERIFYOPAQUEJOB_H__
diff --git a/lang/qt/src/qgpgmewkdlookupjob.cpp b/lang/qt/src/qgpgmewkdlookupjob.cpp
deleted file mode 100644
index 76f5b728..00000000
--- a/lang/qt/src/qgpgmewkdlookupjob.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- qgpgmewkdlookupjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "qgpgmewkdlookupjob.h"
-
-#include "debug.h"
-#include "qgpgme_debug.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/defaultassuantransaction.h>
-
-#include <gpg-error.h>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEWKDLookupJob::QGpgMEWKDLookupJob(Context *context)
- : mixin_type{context}
-{
- lateInitialization();
-}
-
-QGpgMEWKDLookupJob::~QGpgMEWKDLookupJob() = default;
-
-static GpgME::Error startDirmngr(Context *assuanCtx)
-{
- Error err;
-
- auto spawnCtx = std::unique_ptr<Context>{Context::createForEngine(SpawnEngine, &err)};
- if (err) {
- qCDebug(QGPGME_LOG) << "Error: Failed to get context for spawn engine (" << err << ")";
- }
- const auto gpgconfProgram = GpgME::dirInfo("gpgconf-name");
- // replace backslashes with forward slashes in homedir to work around bug T6833
- std::string homedir{GpgME::dirInfo("homedir")};
- std::replace(homedir.begin(), homedir.end(), '\\', '/');
- const char *argv[] = {
- gpgconfProgram,
- "--homedir",
- homedir.c_str(),
- "--launch",
- "dirmngr",
- NULL
- };
- auto ignoreIO = Data{Data::null};
- if (!err) {
- qCDebug(QGPGME_LOG) << "Starting dirmngr ...";
- err = spawnCtx->spawn(gpgconfProgram, argv,
- ignoreIO, ignoreIO, ignoreIO,
- Context::SpawnDetached);
- }
-
- if (!err) {
- // wait for socket to become available
- int cnt = 0;
- do {
- ++cnt;
- qCDebug(QGPGME_LOG) << "Waiting for dirmngr to start ...";
- QThread::msleep(250 * cnt);
- err = assuanCtx->assuanTransact("GETINFO version");
- } while (err.code() == GPG_ERR_ASS_CONNECT_FAILED && cnt < 5);
- }
-
- return err;
-}
-
-static GpgME::Error setUpDirmngrAssuanConnection(Context *ctx)
-{
- Error err;
-
- const std::string dirmngrSocket = GpgME::dirInfo("dirmngr-socket");
- err = ctx->setEngineFileName(dirmngrSocket.c_str());
-
- if (!err) {
- err = ctx->setEngineHomeDirectory("");
- }
-
- if (!err) {
- // try do connect to dirmngr
- err = ctx->assuanTransact("GETINFO version");
- if (err.code() == GPG_ERR_ASS_CONNECT_FAILED) {
- err = startDirmngr(ctx);
- }
- }
-
- return err;
-}
-
-static GpgME::Error run_wkd_get(Context *ctx, const std::string &email)
-{
- Error err;
-
- const auto cmd = std::string{"WKD_GET "} + email;
- err = ctx->assuanTransact(cmd.c_str());
- if (err.code() == GPG_ERR_NO_NAME || err.code() == GPG_ERR_NO_DATA) {
- // ignore those benign errors; GPG_ERR_NO_NAME indicates that the domain
- // doesn't exist (on first request); GPG_ERR_NO_DATA indicates that
- // no key for email is available via WKD or that the domain doesn't
- // support WKD or that the domain doesn't exist (on subsequent requests
- // using dirmngr's internal cache)
- qCDebug(QGPGME_LOG) << "WKD_GET returned" << err << "; ignoring...";
- err = {};
- }
- if (err) {
- qCDebug(QGPGME_LOG) << "WKD_GET failed with" << err;
- }
-
- return err;
-}
-
-static QGpgMEWKDLookupJob::result_type lookup_keys(Context *ctx, const QString &email)
-{
- WKDLookupResult result;
-
- Error err = setUpDirmngrAssuanConnection(ctx);
-
- const auto pattern = email.toUtf8().toStdString();
- if (!err) {
- err = run_wkd_get(ctx, pattern);
- }
-
- if (!err) {
- const auto transaction = std::unique_ptr<DefaultAssuanTransaction>(dynamic_cast<DefaultAssuanTransaction*>(ctx->takeLastAssuanTransaction().release()));
- const auto source = transaction->firstStatusLine("SOURCE");
- const auto rawData = transaction->data();
- if (rawData.size() == 0) {
- qCDebug(QGPGME_LOG) << "No key found for" << email;
- result = WKDLookupResult{pattern, GpgME::Data::null, {}, {}};
- } else {
- qCDebug(QGPGME_LOG) << "Found key for" << email << "at" << source.c_str();
- result = WKDLookupResult{pattern, GpgME::Data{rawData.c_str(), rawData.size()}, source, {}};
- }
- }
-
- return std::make_tuple(err ? WKDLookupResult{pattern, err} : result, QString{}, Error{});
-}
-
-Error QGpgMEWKDLookupJob::start(const QString &email)
-{
- run(std::bind(&lookup_keys, std::placeholders::_1, email));
- return Error();
-}
-
-WKDLookupResult QGpgMEWKDLookupJob::exec(const QString &email)
-{
- const result_type r = lookup_keys(context(), email);
- return std::get<0>(r);
-}
-
-#include "qgpgmewkdlookupjob.moc"
diff --git a/lang/qt/src/qgpgmewkdlookupjob.h b/lang/qt/src/qgpgmewkdlookupjob.h
deleted file mode 100644
index 9a206d25..00000000
--- a/lang/qt/src/qgpgmewkdlookupjob.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- qgpgmewkdlookupjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_QGPGMEWKDLOOKUPJOB_H__
-#define __QGPGME_QGPGMEWKDLOOKUPJOB_H__
-
-#include "threadedjobmixin.h"
-#include "wkdlookupjob.h"
-#include "wkdlookupresult.h"
-
-namespace QGpgME
-{
-class WKDLookupResult;
-
-class QGpgMEWKDLookupJob
-#ifdef Q_MOC_RUN
- : public WKDLookupJob
-#else
- : public _detail::ThreadedJobMixin<WKDLookupJob, std::tuple<WKDLookupResult, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEWKDLookupJob(GpgME::Context *context);
- ~QGpgMEWKDLookupJob();
-
- /* from WKDLookupJob */
- GpgME::Error start(const QString &email) override;
-
- /* from WKDLookupJob */
- WKDLookupResult exec(const QString &email) override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEWKDLOOKUPJOB_H__
diff --git a/lang/qt/src/qgpgmewkdrefreshjob.cpp b/lang/qt/src/qgpgmewkdrefreshjob.cpp
deleted file mode 100644
index 264d9f21..00000000
--- a/lang/qt/src/qgpgmewkdrefreshjob.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- qgpgmewkdrefreshjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "qgpgmewkdrefreshjob.h"
-
-#include "debug.h"
-#include "qgpgme_debug.h"
-#include "qgpgmekeylistjob.h"
-#include "wkdrefreshjob_p.h"
-
-#include <gpgme++/context.h>
-
-#include <memory>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-namespace
-{
-
-class QGpgMEWKDRefreshJobPrivate : public WKDRefreshJobPrivate
-{
- QGpgMEWKDRefreshJob *q = nullptr;
-
-public:
- QGpgMEWKDRefreshJobPrivate(QGpgMEWKDRefreshJob *qq)
- : q{qq}
- {
- }
-
- ~QGpgMEWKDRefreshJobPrivate() override = default;
-
-private:
- GpgME::Error startIt() override;
-
- void startNow() override
- {
- q->run();
- }
-};
-
-static QStringList toEmailAddressesOriginatingFromWKD(const std::vector<GpgME::Key> &keys)
-{
- const QStringList emails = std::accumulate(keys.begin(), keys.end(), QStringList{}, [](QStringList &emails, const Key &key) {
- const auto userIDs = key.userIDs();
- emails = std::accumulate(std::begin(userIDs), std::end(userIDs), emails, [](QStringList &emails, const UserID &userID) {
- if (!userID.isRevoked() && !userID.addrSpec().empty() && userID.origin() == Key::OriginWKD) {
- emails.push_back(QString::fromStdString(userID.addrSpec()));
- }
- return emails;
- });
- return emails;
- });
- return emails;
-}
-
-static QStringList toEmailAddresses(const std::vector<GpgME::UserID> &userIds)
-{
- const QStringList emails = std::accumulate(
- std::begin(userIds),
- std::end(userIds),
- QStringList{},
- [](QStringList &emails, const UserID &userId) {
- if (!userId.isRevoked() && !userId.addrSpec().empty()) {
- emails.push_back(QString::fromStdString(userId.addrSpec()));
- }
- return emails;
- });
- return emails;
-}
-
-}
-
-QGpgMEWKDRefreshJob::QGpgMEWKDRefreshJob(Context *context)
- : mixin_type{context}
-{
- setJobPrivate(this, std::unique_ptr<QGpgMEWKDRefreshJobPrivate>{new QGpgMEWKDRefreshJobPrivate{this}});
- lateInitialization();
-}
-
-QGpgMEWKDRefreshJob::~QGpgMEWKDRefreshJob() = default;
-
-static QGpgMEWKDRefreshJob::result_type locate_external_keys(Context *ctx, const QStringList &emails)
-{
- qCDebug(QGPGME_LOG) << __func__ << "locating external keys for" << emails;
- if (emails.empty()) {
- return std::make_tuple(ImportResult{}, QString{}, Error{});
- }
-
- Context::KeyListModeSaver saver{ctx};
- ctx->setKeyListMode(GpgME::LocateExternal);
- ctx->setFlag("auto-key-locate", "clear,wkd");
- std::vector<Key> dummy;
- auto job = std::unique_ptr<KeyListJob>{new QGpgMEKeyListJob{ctx}};
- (void) job->exec(emails, false, dummy);
- qCDebug(QGPGME_LOG) << __func__ << "number of keys:" << dummy.size();
- std::for_each(dummy.cbegin(), dummy.cend(), [](const Key &k) {
- qCDebug(QGPGME_LOG) << __func__ << toLogString(k).c_str();
- });
- const auto result = ctx->importResult();
- qCDebug(QGPGME_LOG) << __func__ << "result:" << toLogString(result).c_str();
- job.release();
-
- return std::make_tuple(result, QString{}, Error{});
-}
-
-GpgME::Error QGpgMEWKDRefreshJobPrivate::startIt()
-{
- QStringList emails;
- if (!m_keys.empty()) {
- emails = toEmailAddressesOriginatingFromWKD(m_keys);
- } else {
- emails = toEmailAddresses(m_userIds);
- }
- std::sort(emails.begin(), emails.end());
- emails.erase(std::unique(emails.begin(), emails.end()), emails.end());
-
- q->run([emails](Context *ctx) {
- return locate_external_keys(ctx, emails);
- });
-
- return {};
-}
-
-#include "qgpgmewkdrefreshjob.moc"
diff --git a/lang/qt/src/qgpgmewkdrefreshjob.h b/lang/qt/src/qgpgmewkdrefreshjob.h
deleted file mode 100644
index 2a242d65..00000000
--- a/lang/qt/src/qgpgmewkdrefreshjob.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- qgpgmewkdrefreshjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_QGPGMEWKDREFRESHJOB_H__
-#define __QGPGME_QGPGMEWKDREFRESHJOB_H__
-
-#include "threadedjobmixin.h"
-#include "wkdrefreshjob.h"
-
-#include <gpgme++/importresult.h>
-
-namespace QGpgME
-{
-
-class QGpgMEWKDRefreshJob
-#ifdef Q_MOC_RUN
- : public WKDRefreshJob
-#else
- : public _detail::ThreadedJobMixin<WKDRefreshJob, std::tuple<GpgME::ImportResult, QString, GpgME::Error>>
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEWKDRefreshJob(GpgME::Context *context);
- ~QGpgMEWKDRefreshJob() override;
-};
-
-}
-
-#endif // __QGPGME_QGPGMEWKDREFRESHJOB_H__
diff --git a/lang/qt/src/qgpgmewkspublishjob.cpp b/lang/qt/src/qgpgmewkspublishjob.cpp
deleted file mode 100644
index 74cf25cc..00000000
--- a/lang/qt/src/qgpgmewkspublishjob.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/* wkspublishjob.cpp
-
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "qgpgmewkspublishjob.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/key.h>
-
-#include "util.h"
-
-#include <QFileInfo>
-#include <QDir>
-#include <QProcess>
-
-/* Timeout for the WKS Processes will be 5 Minutes as
- * they can involve pinentry questions. */
-#define TIMEOUT_VALUE (5*60*1000)
-
-using namespace QGpgME;
-using namespace GpgME;
-
-QGpgMEWKSPublishJob::QGpgMEWKSPublishJob(Context *context)
- : mixin_type(context)
-{
- lateInitialization();
-}
-
-QGpgMEWKSPublishJob::~QGpgMEWKSPublishJob() {}
-
-static QString getWKSClient()
-{
- auto libexecdir = QString::fromLocal8Bit(dirInfo("libexecdir"));
- if (libexecdir.isEmpty()) {
- return QString();
- }
-
- const QFileInfo fi(QDir(libexecdir).absoluteFilePath(QStringLiteral("gpg-wks-client")));
- if (fi.exists() && fi.isExecutable()) {
- return fi.absoluteFilePath();
- }
- return QString();
-}
-
-static QGpgMEWKSPublishJob::result_type check_worker(const QString &mail)
-{
- if (mail.isEmpty()) {
- return std::make_tuple (Error(make_error(GPG_ERR_INV_ARG)),
- QByteArray(), QByteArray(), QString(), Error());
- }
-
- const auto wksPath = getWKSClient();
- if (wksPath.isEmpty()) {
- return std::make_tuple (Error(make_error(GPG_ERR_NOT_SUPPORTED)),
- QByteArray(), QByteArray(), QString(), Error());
- }
-
- /* QProcess instead of engine_spawn because engine_spawn does not communicate
- * the return value of the process and we are in qt anyway. */
- QProcess proc;
- proc.setProgram(wksPath);
- proc.setArguments(QStringList() << QStringLiteral("--supported") << mail);
- proc.start();
- if (!proc.waitForStarted()) {
- return std::make_tuple (Error(make_error(GPG_ERR_NOT_SUPPORTED)),
- QByteArray(), QByteArray(), QString(), Error());
- }
- if (!proc.waitForFinished(TIMEOUT_VALUE)) {
- return std::make_tuple (Error(make_error(GPG_ERR_TIMEOUT)),
- QByteArray(), QByteArray(), QString(), Error());
- }
- if (proc.exitStatus() == QProcess::NormalExit && proc.exitCode() == 0) {
- return std::make_tuple (Error(), QByteArray(), QByteArray(), QString(), Error());
- }
- return std::make_tuple (Error(make_error(GPG_ERR_NOT_ENABLED)),
- QByteArray(), QByteArray(), QString(), Error());
-}
-
-static QGpgMEWKSPublishJob::result_type create_worker(const char *fpr, const QString &mail)
-{
- if (mail.isEmpty() || !fpr) {
- return std::make_tuple (Error(make_error(GPG_ERR_INV_ARG)),
- QByteArray(), QByteArray(), QString(), Error());
- }
-
- const auto wksPath = getWKSClient();
- if (wksPath.isEmpty()) {
- return std::make_tuple (Error(make_error(GPG_ERR_NOT_SUPPORTED)),
- QByteArray(), QByteArray(), QString(), Error());
- }
-
- QProcess proc;
- proc.setProgram(wksPath);
- proc.setArguments(QStringList() << QStringLiteral("--create")
- << QLatin1String(fpr)
- << mail);
- proc.start();
- if (!proc.waitForStarted()) {
- return std::make_tuple (Error(make_error(GPG_ERR_NOT_SUPPORTED)),
- QByteArray(), QByteArray(), QString(), Error());
- }
-
- if (!proc.waitForFinished(TIMEOUT_VALUE)) {
- return std::make_tuple (Error(make_error(GPG_ERR_TIMEOUT)),
- QByteArray(), QByteArray(), QString(), Error());
- }
- if (proc.exitStatus() == QProcess::NormalExit && proc.exitCode() == 0) {
- return std::make_tuple (Error(), proc.readAllStandardOutput(),
- proc.readAllStandardError(), QString(), Error());
- }
- return std::make_tuple (Error(make_error(GPG_ERR_GENERAL)),
- proc.readAllStandardOutput(), proc.readAllStandardError(), QString(), Error());
-}
-
-static QGpgMEWKSPublishJob::result_type receive_worker(const QByteArray &response)
-{
- if (response.isEmpty()) {
- return std::make_tuple (Error(make_error(GPG_ERR_INV_ARG)),
- QByteArray(), QByteArray(), QString(), Error());
- }
-
- const auto wksPath = getWKSClient();
- if (wksPath.isEmpty()) {
- return std::make_tuple (Error(make_error(GPG_ERR_NOT_SUPPORTED)),
- QByteArray(), QByteArray(), QString(), Error());
- }
-
- QProcess proc;
- proc.setProgram(wksPath);
- proc.setArguments(QStringList() << QStringLiteral("--receive"));
- proc.start();
- if (!proc.waitForStarted()) {
- return std::make_tuple (Error(make_error(GPG_ERR_NOT_SUPPORTED)),
- QByteArray(), QByteArray(), QString(), Error());
- }
- proc.write(response);
- proc.closeWriteChannel();
- if (!proc.waitForFinished(TIMEOUT_VALUE)) {
- return std::make_tuple (Error(make_error(GPG_ERR_TIMEOUT)),
- QByteArray(), QByteArray(), QString(), Error());
- }
- if (proc.exitStatus() == QProcess::NormalExit && proc.exitCode() == 0) {
- return std::make_tuple (Error(), proc.readAllStandardOutput(),
- proc.readAllStandardError(), QString(), Error());
- }
- return std::make_tuple (Error(make_error(GPG_ERR_GENERAL)),
- proc.readAllStandardOutput(), proc.readAllStandardError(), QString(), Error());
-}
-
-void QGpgMEWKSPublishJob::startCheck(const QString &mailbox)
-{
- run(std::bind(&check_worker, mailbox));
-}
-
-void QGpgMEWKSPublishJob::startCreate(const char *fpr, const QString &mailbox) {
- run(std::bind(&create_worker, fpr, mailbox));
-}
-
-void QGpgMEWKSPublishJob::startReceive(const QByteArray &response)
-{
- run(std::bind(&receive_worker, response));
-}
-
-#include "qgpgmewkspublishjob.moc"
diff --git a/lang/qt/src/qgpgmewkspublishjob.h b/lang/qt/src/qgpgmewkspublishjob.h
deleted file mode 100644
index a8635e16..00000000
--- a/lang/qt/src/qgpgmewkspublishjob.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* qgpgmewkspublishjob.h
-
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_QGPGMEWKSPUBLISHJOB_H
-#define QGPGME_QGPGMEWKSPUBLISHJOB_H
-
-#include "wkspublishjob.h"
-
-#include "threadedjobmixin.h"
-namespace GpgME
-{
- class Key;
-} // namespace GpgME
-
-namespace QGpgME {
-
-/**
- * Handles Web Key Service Publishing. Needs WKS tools installed and
- * server support.
- */
-class QGpgMEWKSPublishJob
-#ifdef Q_MOC_RUN
- : public WKSPublishJob
-#else
- : public _detail::ThreadedJobMixin<WKSPublishJob, std::tuple<GpgME::Error, QByteArray, QByteArray, QString, GpgME::Error> >
-#endif
-{
- Q_OBJECT
-#ifdef Q_MOC_RUN
-public Q_SLOTS:
- void slotFinished();
-#endif
-public:
- explicit QGpgMEWKSPublishJob(GpgME::Context *context);
- ~QGpgMEWKSPublishJob();
-
- void startCheck(const QString &mailbox) override;
- void startCreate(const char *fpr, const QString &mailbox) override;
- void startReceive(const QByteArray &response) override;
-};
-
-}
-
-#endif
diff --git a/lang/qt/src/quickjob.cpp b/lang/qt/src/quickjob.cpp
deleted file mode 100644
index 1c9343da..00000000
--- a/lang/qt/src/quickjob.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- quickjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2024 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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.
-*/
-
-#include "quickjob.h"
-#include "quickjob_p.h"
-
-using namespace QGpgME;
-
-QuickJob::QuickJob(QObject *parent)
- : Job{parent}
-{
-}
-
-QuickJob::~QuickJob() = default;
-
-GpgME::Error QuickJob::startSetKeyEnabled(const GpgME::Key &key, bool enabled)
-{
- auto d = jobPrivate<QuickJobPrivate>(this);
- return d->startSetKeyEnabled(key, enabled);
-}
-
-#include "quickjob.moc"
diff --git a/lang/qt/src/quickjob.h b/lang/qt/src/quickjob.h
deleted file mode 100644
index df8ac2b5..00000000
--- a/lang/qt/src/quickjob.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* quickjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2017 Intevation GmbH
- Copyright (c) 2020 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_QUICKJOB_H
-#define QGPGME_QUICKJOB_H
-
-#include "job.h"
-
-#include "qgpgme_export.h"
-
-#include <QDateTime>
-
-#include <gpgme++/key.h>
-
-class QString;
-
-namespace QGpgME{
-
-/**
- * Interface to the modern key manipulation functions.
- */
-class QGPGME_EXPORT QuickJob : public Job
-{
- Q_OBJECT
-public:
- explicit QuickJob(QObject *parent = nullptr);
- ~QuickJob();
-
- /** Start --quick-gen-key */
- virtual void startCreate(const QString &uid,
- const char *algo,
- const QDateTime &expires = QDateTime(),
- const GpgME::Key &key = GpgME::Key(),
- unsigned int flags = 0) = 0;
-
- /** Start --quick-adduid */
- virtual void startAddUid(const GpgME::Key &key, const QString &uid) = 0;
-
- /** Start --quick-revuid */
- virtual void startRevUid(const GpgME::Key &key, const QString &uid) = 0;
-
- /** Start --quick-add-key */
- virtual void startAddSubkey(const GpgME::Key &key, const char *algo,
- const QDateTime &expires = QDateTime(),
- unsigned int flags = 0) = 0;
-
- /**
- Starts the operation to revoke the signatures made with the key \a signingKey on the
- user IDs \a userIds of the key \a key. If \a userIds is an empty list, then all
- signatures made with \a signingKey on the user IDs of \a key will be revoked.
- */
- virtual void startRevokeSignature(const GpgME::Key &key, const GpgME::Key &signingKey,
- const std::vector<GpgME::UserID> &userIds = std::vector<GpgME::UserID>()) = 0;
-
- /** Start --quick-add-adsk */
- virtual void startAddAdsk(const GpgME::Key &key, const char *adsk) = 0;
-
- /**
- * Starts the operation to enable or disable the OpenPGP key \a key.
- * If \a enabled is \c true then the key is enabled. Otherwise, the key is disabled.
- *
- * \note Requires gpg 2.4.6.
- */
- GpgME::Error startSetKeyEnabled(const GpgME::Key &key, bool enabled);
-
-Q_SIGNALS:
- void result(const GpgME::Error &error,
- const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-#endif
diff --git a/lang/qt/src/quickjob_p.h b/lang/qt/src/quickjob_p.h
deleted file mode 100644
index a8c993a2..00000000
--- a/lang/qt/src/quickjob_p.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- quickjob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2024 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_QUICKJOB_P_H__
-#define __QGPGME_QUICKJOB_P_H__
-
-#include "job_p.h"
-
-#include "quickjob.h"
-
-namespace QGpgME
-{
-
-struct QuickJobPrivate : public JobPrivate
-{
- virtual GpgME::Error startSetKeyEnabled(const GpgME::Key &key, bool enabled) = 0;
-};
-
-}
-
-#endif // __QGPGME_QUICKJOB_P_H__
diff --git a/lang/qt/src/receivekeysjob.h b/lang/qt/src/receivekeysjob.h
deleted file mode 100644
index 3f85792f..00000000
--- a/lang/qt/src/receivekeysjob.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- receivekeysjob.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 <[email protected]>
-
- 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_RECEIVEKEYSJOB_H__
-#define __QGPGME_RECEIVEKEYSJOB_H__
-
-#include "abstractimportjob.h"
-#include "qgpgme_export.h"
-
-namespace QGpgME
-{
-
-class QGPGME_EXPORT ReceiveKeysJob : public AbstractImportJob
-{
- Q_OBJECT
-protected:
- explicit ReceiveKeysJob(QObject *parent);
-public:
- ~ReceiveKeysJob() override;
-
- /**
- Starts the import of keys from a keyserver. \a keyIds is a list of
- key ids and/or fingerprints specifying the keys to import.
- */
- virtual GpgME::Error start(const QStringList &keyIds) = 0;
-
- /**
- Runs the import of keys from a keyserver. \a keyIds is a list of
- key ids and/or fingerprints specifying the keys to import.
- */
- virtual GpgME::ImportResult exec(const QStringList &keyIds) = 0;
-};
-
-}
-
-#endif // __QGPGME_RECEIVEKEYSJOB_H__
diff --git a/lang/qt/src/refreshkeysjob.h b/lang/qt/src/refreshkeysjob.h
deleted file mode 100644
index 67774c2f..00000000
--- a/lang/qt/src/refreshkeysjob.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- refreshkeysjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_REFRESHKEYSJOB_H__
-#define __KLEO_REFRESHKEYSJOB_H__
-
-#include "job.h"
-#include "qgpgme_export.h"
-
-#include <QtCore/QStringList>
-
-#include <vector>
-
-namespace GpgME
-{
-class Error;
-class Key;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous key refreshers.
-
- To use a RefreshKeysJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the key refresh with a
- call to start(). This call might fail, in which case the
- RefreshKeysJob instance will have scheduled its own destruction
- with a call to QObject::deleteLater().
-
- After result() is emitted, the job will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT RefreshKeysJob : public Job
-{
- Q_OBJECT
-protected:
- explicit RefreshKeysJob(QObject *parent);
-public:
- ~RefreshKeysJob();
-
- /**
- 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 refreshed.
-
- 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 &result);
-};
-
-}
-
-#endif // __KLEO_REFRESHKEYSJOB_H__
diff --git a/lang/qt/src/revokekeyjob.h b/lang/qt/src/revokekeyjob.h
deleted file mode 100644
index 69aef062..00000000
--- a/lang/qt/src/revokekeyjob.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- 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 <[email protected]>
-
- 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
deleted file mode 100644
index fa76199c..00000000
--- a/lang/qt/src/setprimaryuseridjob.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- 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 <[email protected]>
-
- 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/signarchivejob.cpp b/lang/qt/src/signarchivejob.cpp
deleted file mode 100644
index 0d898b25..00000000
--- a/lang/qt/src/signarchivejob.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- signarchivejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "signarchivejob.h"
-#include "signarchivejob_p.h"
-
-#include <gpgme++/engineinfo.h>
-
-using namespace QGpgME;
-
-SignArchiveJob::SignArchiveJob(QObject *parent)
- : Job{parent}
-{
-}
-
-SignArchiveJob::~SignArchiveJob() = default;
-
-// static
-bool SignArchiveJob::isSupported()
-{
- static const auto gpgVersion = GpgME::engineInfo(GpgME::GpgEngine).engineVersion();
- return (gpgVersion >= "2.4.1") || (gpgVersion >= "2.2.42" && gpgVersion < "2.3.0");
-}
-
-void SignArchiveJob::setSigners(const std::vector<GpgME::Key> &signers)
-{
- auto d = jobPrivate<SignArchiveJobPrivate>(this);
- d->m_signers = signers;
-}
-
-std::vector<GpgME::Key> SignArchiveJob::signers() const
-{
- auto d = jobPrivate<SignArchiveJobPrivate>(this);
- return d->m_signers;
-}
-
-void SignArchiveJob::setInputPaths(const std::vector<QString> &paths)
-{
- auto d = jobPrivate<SignArchiveJobPrivate>(this);
- d->m_inputPaths = paths;
-}
-
-std::vector<QString> SignArchiveJob::inputPaths() const
-{
- auto d = jobPrivate<SignArchiveJobPrivate>(this);
- return d->m_inputPaths;
-}
-
-void SignArchiveJob::setOutputFile(const QString &path)
-{
- auto d = jobPrivate<SignArchiveJobPrivate>(this);
- d->m_outputFilePath = path;
-}
-
-QString SignArchiveJob::outputFile() const
-{
- auto d = jobPrivate<SignArchiveJobPrivate>(this);
- return d->m_outputFilePath;
-}
-
-void SignArchiveJob::setBaseDirectory(const QString &baseDirectory)
-{
- auto d = jobPrivate<SignArchiveJobPrivate>(this);
- d->m_baseDirectory = baseDirectory;
-}
-
-QString SignArchiveJob::baseDirectory() const
-{
- auto d = jobPrivate<SignArchiveJobPrivate>(this);
- return d->m_baseDirectory;
-}
-
-#include "signarchivejob.moc"
diff --git a/lang/qt/src/signarchivejob.h b/lang/qt/src/signarchivejob.h
deleted file mode 100644
index 0b4cdeb4..00000000
--- a/lang/qt/src/signarchivejob.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- signarchivejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_SIGNARCHIVEJOB_H__
-#define __QGPGME_SIGNARCHIVEJOB_H__
-
-#include "job.h"
-
-#include <gpgme++/context.h>
-
-namespace GpgME
-{
-class Key;
-}
-
-namespace QGpgME
-{
-
-/**
- * Abstract base class for job for creating signed archives
- */
-class QGPGME_EXPORT SignArchiveJob : public Job
-{
- Q_OBJECT
-protected:
- explicit SignArchiveJob(QObject *parent);
-public:
- ~SignArchiveJob() override;
-
- static bool isSupported();
-
- /**
- * Sets the keys to use for signing the archive.
- *
- * Used if the job is started with startIt().
- */
- void setSigners(const std::vector<GpgME::Key> &signers);
- std::vector<GpgME::Key> signers() const;
-
- /**
- * Sets the paths of the files and folders to put into the archive.
- *
- * If base directory is set, then the paths must be relative to the
- * base directory.
- *
- * Used if the job is started with startIt().
- */
- void setInputPaths(const std::vector<QString> &paths);
- std::vector<QString> inputPaths() const;
-
- /**
- * Sets the path of the file to write the created archive to.
- *
- * If \a path is a relative path and base directory is set, then the
- * path is interpreted relative to the base directory.
- *
- * Used if the job is started with startIt().
- *
- * \note If a file with this path exists, then the job will fail, i.e. you
- * need to delete an existing file that shall be overwritten before you
- * start the job.
- */
- void setOutputFile(const QString &path);
- QString outputFile() const;
-
- /**
- * Sets the base directory for the relative paths of the input files and
- * the output file.
- */
- void setBaseDirectory(const QString &baseDirectory);
- QString baseDirectory() const;
-
- /**
- * Starts the creation of a signed archive.
- *
- * Creates a signed archive with the files and directories in \a paths.
- * The archive is signed with the keys in \a signers or with the default
- * key, if \a signers is empty. The signed archive is written to \a output.
- *
- * Emits result() when the job has finished.
- */
- virtual GpgME::Error start(const std::vector<GpgME::Key> &signers,
- const std::vector<QString> &paths,
- const std::shared_ptr<QIODevice> &output) = 0;
-
-Q_SIGNALS:
- /**
- * This signal is emitted whenever gpgtar sends a progress status update for
- * the number of files. In the scanning phase (i.e. while gpgtar checks
- * which files to put into the archive), \a current is the current number of
- * files and \a total is 0. In the writing phase, \a current is the number
- * of processed files and \a total is the total number of files.
- */
- void fileProgress(int current, int total);
-
- /**
- * This signal is emitted whenever gpgtar sends a progress status update for
- * the amount of processed data. It is only emitted in the writing phase.
- * \a current is the processed amount data and \a total is the total amount
- * of data to process. Both values never exceed 2^20.
- */
- void dataProgress(int current, int total);
-
- void result(const GpgME::SigningResult &result,
- const QString &auditLogAsHtml = {},
- const GpgME::Error &auditLogError = {});
-};
-
-}
-
-#endif // __QGPGME_SIGNARCHIVEJOB_H__
diff --git a/lang/qt/src/signarchivejob_p.h b/lang/qt/src/signarchivejob_p.h
deleted file mode 100644
index 9ec921bb..00000000
--- a/lang/qt/src/signarchivejob_p.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- signarchivejob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_SIGNARCHIVEJOB_P_H__
-#define __QGPGME_SIGNARCHIVEJOB_P_H__
-
-#include "job_p.h"
-
-namespace QGpgME
-{
-
-struct SignArchiveJobPrivate : public JobPrivate
-{
- std::vector<GpgME::Key> m_signers;
- std::vector<QString> m_inputPaths;
- QString m_outputFilePath;
- QString m_baseDirectory;
-};
-
-}
-
-#endif // __QGPGME_SIGNARCHIVEJOB_P_H__
diff --git a/lang/qt/src/signencryptarchivejob.cpp b/lang/qt/src/signencryptarchivejob.cpp
deleted file mode 100644
index 114d6f33..00000000
--- a/lang/qt/src/signencryptarchivejob.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- signencryptarchivejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "signencryptarchivejob.h"
-#include "signencryptarchivejob_p.h"
-
-#include <gpgme++/engineinfo.h>
-
-using namespace QGpgME;
-
-SignEncryptArchiveJob::SignEncryptArchiveJob(QObject *parent)
- : Job{parent}
-{
-}
-
-SignEncryptArchiveJob::~SignEncryptArchiveJob() = default;
-
-// static
-bool SignEncryptArchiveJob::isSupported()
-{
- static const auto gpgVersion = GpgME::engineInfo(GpgME::GpgEngine).engineVersion();
- return (gpgVersion >= "2.4.1") || (gpgVersion >= "2.2.42" && gpgVersion < "2.3.0");
-}
-
-void SignEncryptArchiveJob::setSigners(const std::vector<GpgME::Key> &signers)
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- d->m_signers = signers;
-}
-
-std::vector<GpgME::Key> SignEncryptArchiveJob::signers() const
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- return d->m_signers;
-}
-
-void SignEncryptArchiveJob::setRecipients(const std::vector<GpgME::Key> &recipients)
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- d->m_recipients = recipients;
-}
-
-std::vector<GpgME::Key> SignEncryptArchiveJob::recipients() const
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- return d->m_recipients;
-}
-
-void SignEncryptArchiveJob::setInputPaths(const std::vector<QString> &paths)
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- d->m_inputPaths = paths;
-}
-
-std::vector<QString> SignEncryptArchiveJob::inputPaths() const
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- return d->m_inputPaths;
-}
-
-void SignEncryptArchiveJob::setOutputFile(const QString &path)
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- d->m_outputFilePath = path;
-}
-
-QString SignEncryptArchiveJob::outputFile() const
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- return d->m_outputFilePath;
-}
-
-void SignEncryptArchiveJob::setEncryptionFlags(GpgME::Context::EncryptionFlags flags)
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- d->m_encryptionFlags = static_cast<GpgME::Context::EncryptionFlags>(flags | GpgME::Context::EncryptArchive);
-}
-
-GpgME::Context::EncryptionFlags SignEncryptArchiveJob::encryptionFlags() const
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- return d->m_encryptionFlags;
-}
-
-void SignEncryptArchiveJob::setBaseDirectory(const QString &baseDirectory)
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- d->m_baseDirectory = baseDirectory;
-}
-
-QString SignEncryptArchiveJob::baseDirectory() const
-{
- auto d = jobPrivate<SignEncryptArchiveJobPrivate>(this);
- return d->m_baseDirectory;
-}
-
-#include "signencryptarchivejob.moc"
diff --git a/lang/qt/src/signencryptarchivejob.h b/lang/qt/src/signencryptarchivejob.h
deleted file mode 100644
index c8742aec..00000000
--- a/lang/qt/src/signencryptarchivejob.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- signencryptarchivejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_SIGNENCRYPTARCHIVEJOB_H__
-#define __QGPGME_SIGNENCRYPTARCHIVEJOB_H__
-
-#include "job.h"
-
-#include <gpgme++/context.h>
-
-namespace GpgME
-{
-class Key;
-}
-
-namespace QGpgME
-{
-
-/**
- * Abstract base class for job for creating encrypted signed archives
- */
-class QGPGME_EXPORT SignEncryptArchiveJob : public Job
-{
- Q_OBJECT
-protected:
- explicit SignEncryptArchiveJob(QObject *parent);
-public:
- ~SignEncryptArchiveJob() override;
-
- static bool isSupported();
-
- /**
- * Sets the keys to use for signing the archive.
- *
- * Used if the job is started with startIt().
- */
- void setSigners(const std::vector<GpgME::Key> &signers);
- std::vector<GpgME::Key> signers() const;
-
- /**
- * Sets the keys to use for encrypting the archive.
- *
- * Used if the job is started with startIt().
- */
- void setRecipients(const std::vector<GpgME::Key> &recipients);
- std::vector<GpgME::Key> recipients() const;
-
- /**
- * Sets the paths of the files and folders to put into the archive.
- *
- * If base directory is set, then the paths must be relative to the
- * base directory.
- *
- * Used if the job is started with startIt().
- */
- void setInputPaths(const std::vector<QString> &paths);
- std::vector<QString> inputPaths() const;
-
- /**
- * Sets the path of the file to write the created archive to.
- *
- * If \a path is a relative path and base directory is set, then the
- * path is interpreted relative to the base directory.
- *
- * Used if the job is started with startIt().
- *
- * \note If a file with this path exists, then the job will fail, i.e. you
- * need to delete an existing file that shall be overwritten before you
- * start the job.
- */
- void setOutputFile(const QString &path);
- QString outputFile() const;
-
- /**
- * Sets the flags to use for encryption. Defaults to \c EncryptArchive.
- * The \c EncryptArchive flag is always assumed set for this job.
- *
- * Used if the job is started with startIt().
- */
- void setEncryptionFlags(GpgME::Context::EncryptionFlags flags);
- GpgME::Context::EncryptionFlags encryptionFlags() const;
-
- /**
- * Sets the base directory for the relative paths of the input files and
- * the output file.
- */
- void setBaseDirectory(const QString &baseDirectory);
- QString baseDirectory() const;
-
- /**
- * Starts the creation of an encrypted signed archive.
- *
- * Creates an encrypted signed archive with the files and directories in
- * \a paths.
- * The archive is signed with the keys in \a signers or with the default
- * key, if \a signers is empty. Then the archive is encrypted for the
- * keys in \a recipients. If \a recipients is empty, then symmetric
- * encryption is performed. The encrypted signed archive is written to
- * \a cipherText.
- *
- * Emits result() when the job has finished.
- */
- virtual GpgME::Error start(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const std::vector<QString> &paths,
- const std::shared_ptr<QIODevice> &cipherText,
- const GpgME::Context::EncryptionFlags flags) = 0;
-
-Q_SIGNALS:
- /**
- * This signal is emitted whenever gpgtar sends a progress status update for
- * the number of files. In the scanning phase (i.e. while gpgtar checks
- * which files to put into the archive), \a current is the current number of
- * files and \a total is 0. In the writing phase, \a current is the number
- * of processed files and \a total is the total number of files.
- */
- void fileProgress(int current, int total);
-
- /**
- * This signal is emitted whenever gpgtar sends a progress status update for
- * the amount of processed data. It is only emitted in the writing phase.
- * \a current is the processed amount data and \a total is the total amount
- * of data to process. Both values never exceed 2^20.
- */
- void dataProgress(int current, int total);
-
- void result(const GpgME::SigningResult &signingResult,
- const GpgME::EncryptionResult &encryptionResult,
- const QString &auditLogAsHtml = {},
- const GpgME::Error &auditLogError = {});
-};
-
-}
-
-#endif // __QGPGME_SIGNENCRYPTARCHIVEJOB_H__
diff --git a/lang/qt/src/signencryptarchivejob_p.h b/lang/qt/src/signencryptarchivejob_p.h
deleted file mode 100644
index 3ae7a4c1..00000000
--- a/lang/qt/src/signencryptarchivejob_p.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- signencryptarchivejob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_SIGNENCRYPTARCHIVEJOB_P_H__
-#define __QGPGME_SIGNENCRYPTARCHIVEJOB_P_H__
-
-#include "job_p.h"
-
-namespace QGpgME
-{
-
-struct SignEncryptArchiveJobPrivate : public JobPrivate
-{
- std::vector<GpgME::Key> m_signers;
- std::vector<GpgME::Key> m_recipients;
- std::vector<QString> m_inputPaths;
- QString m_outputFilePath;
- QString m_baseDirectory;
- GpgME::Context::EncryptionFlags m_encryptionFlags = GpgME::Context::EncryptArchive;
-};
-
-}
-
-#endif // __QGPGME_SIGNENCRYPTARCHIVEJOB_P_H__
diff --git a/lang/qt/src/signencryptjob.cpp b/lang/qt/src/signencryptjob.cpp
deleted file mode 100644
index e82730e6..00000000
--- a/lang/qt/src/signencryptjob.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- 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 <[email protected]>
-
- 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 "signencryptjob_p.h"
-
-using namespace QGpgME;
-
-SignEncryptJob::SignEncryptJob(QObject *parent)
- : Job{parent}
-{
-}
-
-SignEncryptJob::~SignEncryptJob() = default;
-
-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;
-}
-
-void SignEncryptJob::setSigners(const std::vector<GpgME::Key> &signers)
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- d->m_signers = signers;
-}
-
-std::vector<GpgME::Key> SignEncryptJob::signers() const
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- return d->m_signers;
-}
-
-void SignEncryptJob::setRecipients(const std::vector<GpgME::Key> &recipients)
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- d->m_recipients = recipients;
-}
-
-std::vector<GpgME::Key> SignEncryptJob::recipients() const
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- return d->m_recipients;
-}
-
-void SignEncryptJob::setInputFile(const QString &path)
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- d->m_inputFilePath = path;
-}
-
-QString SignEncryptJob::inputFile() const
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- return d->m_inputFilePath;
-}
-
-void SignEncryptJob::setOutputFile(const QString &path)
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- d->m_outputFilePath = path;
-}
-
-QString SignEncryptJob::outputFile() const
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- return d->m_outputFilePath;
-}
-
-void SignEncryptJob::setEncryptionFlags(GpgME::Context::EncryptionFlags flags)
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- d->m_encryptionFlags = static_cast<GpgME::Context::EncryptionFlags>(flags | GpgME::Context::EncryptFile);
-}
-
-GpgME::Context::EncryptionFlags SignEncryptJob::encryptionFlags() const
-{
- auto d = jobPrivate<SignEncryptJobPrivate>(this);
- return d->m_encryptionFlags;
-}
-
-#include "signencryptjob.moc"
diff --git a/lang/qt/src/signencryptjob.h b/lang/qt/src/signencryptjob.h
deleted file mode 100644
index 73b8c227..00000000
--- a/lang/qt/src/signencryptjob.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- signencryptjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- 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 <[email protected]>
-
- 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 __KLEO_SIGNENCRYPTJOB_H__
-#define __KLEO_SIGNENCRYPTJOB_H__
-
-#include "job.h"
-#include "qgpgme_export.h"
-
-#include <gpgme++/global.h>
-#include <gpgme++/context.h>
-
-#include <memory>
-#include <vector>
-#include <utility>
-
-class QByteArray;
-class QIODevice;
-
-namespace GpgME
-{
-class Error;
-class Key;
-class SigningResult;
-class EncryptionResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous combined signing and encrypting
-
- To use a SignEncryptJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the operation with a
- call to start(). This call might fail, in which case the
- SignEncryptJob instance will have scheduled it's own destruction
- with a call to QObject::deleteLater().
-
- Alternatively, the job can be started with startIt() after setting
- an input file and an output file and, optionally, signers, recipients or flags.
- If the job is started this way then the backend reads the input and
- writes the output directly from/to the specified input file and output
- file. In this case the cipherText value of the result signal will always
- be empty. This direct IO mode is currently only supported for OpenPGP.
- Note that startIt() does not schedule the job's destruction if starting
- the job failed.
-
- After result() is emitted, the SignEncryptJob will schedule it's
- own destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT SignEncryptJob : public Job
-{
- Q_OBJECT
-protected:
- explicit SignEncryptJob(QObject *parent);
-public:
- ~SignEncryptJob() override;
-
- /**
- * Sets the file name to embed in the encryption result.
- *
- * This is only used if one of the start() functions is used.
- */
- void setFileName(const QString &fileName);
- QString fileName() const;
-
- /**
- * Sets the keys to use for signing.
- *
- * Used if the job is started with startIt().
- */
- void setSigners(const std::vector<GpgME::Key> &signers);
- std::vector<GpgME::Key> signers() const;
-
- /**
- * Sets the keys to use for encryption.
- *
- * Used if the job is started with startIt().
- */
- void setRecipients(const std::vector<GpgME::Key> &recipients);
- std::vector<GpgME::Key> recipients() const;
-
- /**
- * Sets the path of the file to encrypt.
- *
- * Used if the job is started with startIt().
- */
- void setInputFile(const QString &path);
- QString inputFile() const;
-
- /**
- * Sets the path of the file to write the encryption result to.
- *
- * Used if the job is started with startIt().
- *
- * \note If a file with this path exists, then the job will fail, i.e. you
- * need to delete an existing file that shall be overwritten before you
- * start the job.
- */
- void setOutputFile(const QString &path);
- QString outputFile() const;
-
- /**
- * Sets the flags to use for encryption.
- *
- * Defaults to \c EncryptFile.
- *
- * Used if the job is started with startIt(). The \c EncryptFile flag is
- * always assumed set.
- */
- void setEncryptionFlags(GpgME::Context::EncryptionFlags flags);
- GpgME::Context::EncryptionFlags encryptionFlags() const;
-
- /**
- Starts the combined signing and encrypting operation. \a signers
- is the list of keys to sign \a plainText with. \a recipients is
- a list of keys to encrypt the signed \a plainText to. In both
- lists, empty (null) keys are ignored.
-
- If \a alwaysTrust is true, validity checking for the
- \em recipient keys will not be performed, but full validity
- assumed for all \em recipient keys without further checks.
- */
- virtual GpgME::Error start(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText,
- bool alwaysTrust = false) = 0;
-
- /*!
- \overload
-
- If \a cipherText is non-null, the ciphertext is written
- there. Otherwise, it will be delivered in the third argument of
- result().
- */
- virtual void start(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &cipherText = std::shared_ptr<QIODevice>(),
- bool alwaysTrust = false) = 0;
-
- virtual std::pair<GpgME::SigningResult, GpgME::EncryptionResult>
- exec(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText,
- bool alwaysTrust, QByteArray &cipherText) = 0;
-
- /*!
- This is a hack to request BASE64 output (instead of whatever
- comes out normally).
- */
- virtual void setOutputIsBase64Encoded(bool) = 0;
-
- /** Like start but with an additional argument for EncryptionFlags for
- * more flexibility. */
- virtual void start(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &cipherText = std::shared_ptr<QIODevice>(),
- const GpgME::Context::EncryptionFlags flags = GpgME::Context::None) = 0;
-
- /** Like exec but with an additional argument for EncryptionFlags for
- * more flexibility. */
- virtual std::pair<GpgME::SigningResult, GpgME::EncryptionResult>
- exec(const std::vector<GpgME::Key> &signers,
- const std::vector<GpgME::Key> &recipients,
- const QByteArray &plainText,
- const GpgME::Context::EncryptionFlags flags, QByteArray &cipherText) = 0;
-Q_SIGNALS:
- void result(const GpgME::SigningResult &signingresult,
- const GpgME::EncryptionResult &encryptionresult,
- const QByteArray &cipherText, const QString &auditLogAsHtml = QString(),
- const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_SIGNENCRYPTJOB_H__
diff --git a/lang/qt/src/signencryptjob_p.h b/lang/qt/src/signencryptjob_p.h
deleted file mode 100644
index 8f5c91ec..00000000
--- a/lang/qt/src/signencryptjob_p.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- signencryptjob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022,2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_SIGNENCRYPTJOB_P_H__
-#define __QGPGME_SIGNENCRYPTJOB_P_H__
-
-#include "job_p.h"
-
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-struct SignEncryptJobPrivate : public JobPrivate
-{
- // used by start() functions
- QString m_fileName;
-
- // used by startIt()
- std::vector<GpgME::Key> m_signers;
- std::vector<GpgME::Key> m_recipients;
- QString m_inputFilePath;
- QString m_outputFilePath;
- GpgME::Context::EncryptionFlags m_encryptionFlags = GpgME::Context::EncryptFile;
-};
-
-}
-
-#endif // __QGPGME_SIGNENCRYPTJOB_P_H__
diff --git a/lang/qt/src/signjob.cpp b/lang/qt/src/signjob.cpp
deleted file mode 100644
index be15051b..00000000
--- a/lang/qt/src/signjob.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- signjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "signjob.h"
-#include "signjob_p.h"
-
-using namespace QGpgME;
-
-SignJob::SignJob(QObject *parent)
- : Job{parent}
-{
-}
-
-SignJob::~SignJob() = default;
-
-void SignJob::setSigners(const std::vector<GpgME::Key> &signers)
-{
- auto d = jobPrivate<SignJobPrivate>(this);
- d->m_signers = signers;
-}
-
-std::vector<GpgME::Key> SignJob::signers() const
-{
- auto d = jobPrivate<SignJobPrivate>(this);
- return d->m_signers;
-}
-
-void SignJob::setInputFile(const QString &path)
-{
- auto d = jobPrivate<SignJobPrivate>(this);
- d->m_inputFilePath = path;
-}
-
-QString SignJob::inputFile() const
-{
- auto d = jobPrivate<SignJobPrivate>(this);
- return d->m_inputFilePath;
-}
-
-void SignJob::setOutputFile(const QString &path)
-{
- auto d = jobPrivate<SignJobPrivate>(this);
- d->m_outputFilePath = path;
-}
-
-QString SignJob::outputFile() const
-{
- auto d = jobPrivate<SignJobPrivate>(this);
- return d->m_outputFilePath;
-}
-
-void SignJob::setSigningFlags(GpgME::SignatureMode flags)
-{
- auto d = jobPrivate<SignJobPrivate>(this);
- d->m_signingFlags = static_cast<GpgME::SignatureMode>(flags | GpgME::SignFile);
-}
-
-GpgME::SignatureMode SignJob::signingFlags() const
-{
- auto d = jobPrivate<SignJobPrivate>(this);
- return d->m_signingFlags;
-}
-
-void SignJob::setAppendSignature(bool append)
-{
- auto d = jobPrivate<SignJobPrivate>(this);
- d->m_appendSignature = append;
-}
-
-bool SignJob::appendSignatureEnabled() const
-{
- auto d = jobPrivate<SignJobPrivate>(this);
- return d->m_appendSignature;
-}
-
-#include "signjob.moc"
diff --git a/lang/qt/src/signjob.h b/lang/qt/src/signjob.h
deleted file mode 100644
index be29f4d8..00000000
--- a/lang/qt/src/signjob.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- signjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_SIGNJOB_H__
-#define __KLEO_SIGNJOB_H__
-
-#include "job.h"
-
-#include <gpgme++/global.h>
-
-#include <vector>
-#include <memory>
-
-class QByteArray;
-class QIODevice;
-
-namespace GpgME
-{
-class Error;
-class Key;
-class SigningResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous signing
-
- To use a SignJob, first obtain an instance from the CryptoBackend
- implementation, connect the progress() and result() signals to
- suitable slots and then start the signing with a call to
- start(). This call might fail, in which case the SignJob instance
- will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- Alternatively, the job can be started with startIt() after setting
- an input file and an output file and, optionally, signers or flags.
- If the job is started this way then the backend reads the input and
- writes the output directly from/to the specified input file and output
- file. In this case the signature value of the result signal will always
- be empty. This direct IO mode is currently only supported for OpenPGP.
- Note that startIt() does not schedule the job's destruction if starting
- the job failed.
-
- After result() is emitted, the SignJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT SignJob : public Job
-{
- Q_OBJECT
-protected:
- explicit SignJob(QObject *parent);
-public:
- ~SignJob() override;
-
- /**
- * Sets the keys to use for signing.
- *
- * Used if the job is started with startIt().
- */
- void setSigners(const std::vector<GpgME::Key> &signers);
- std::vector<GpgME::Key> signers() const;
-
- /**
- * Sets the path of the file to sign.
- *
- * Used if the job is started with startIt().
- */
- void setInputFile(const QString &path);
- QString inputFile() const;
-
- /**
- * Sets the path of the file to write the signing result to.
- *
- * Used if the job is started with startIt().
- *
- * \note If a file with this path exists, then the job will fail, i.e. you
- * need to delete an existing file that shall be overwritten before you
- * start the job. If you create a detached signature then you can tell
- * the job to append the new detached signature to an existing file.
- */
- void setOutputFile(const QString &path);
- QString outputFile() const;
-
- /**
- * Sets the flags to use for signing.
- *
- * Defaults to \c SignFile.
- *
- * Used if the job is started with startIt(). The \c SignFile flag is
- * always assumed set.
- */
- void setSigningFlags(GpgME::SignatureMode flags);
- GpgME::SignatureMode signingFlags() const;
-
- /**
- * If @c true then a new detached signature is appended to an already
- * existing detached signature.
- *
- * Defaults to \c false.
- *
- * Used if the job is started with startIt().
- */
- void setAppendSignature(bool append);
- bool appendSignatureEnabled() const;
-
- /**
- Starts the signing operation. \a signers is the list of keys to
- sign \a plainText with. Empty (null) keys are ignored.
- */
- virtual GpgME::Error start(const std::vector<GpgME::Key> &signers,
- const QByteArray &plainText,
- GpgME::SignatureMode mode) = 0;
-
- /*!
- \overload
-
- If \a signature is non-null the signature is written
- there. Otherwise, it will be delivered in the second argument of
- result().
- */
- virtual void start(const std::vector<GpgME::Key> &signers,
- const std::shared_ptr<QIODevice> &plainText,
- const std::shared_ptr<QIODevice> &signature,
- GpgME::SignatureMode mode) = 0;
-
- virtual GpgME::SigningResult exec(const std::vector<GpgME::Key> &signers,
- const QByteArray &plainText,
- GpgME::SignatureMode mode,
- QByteArray &signature) = 0;
-
- /*!
- This is a hack to request BASE64 output (instead of whatever
- comes out normally).
- */
- virtual void setOutputIsBase64Encoded(bool) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::SigningResult &result, const QByteArray &signature, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_SIGNJOB_H__
diff --git a/lang/qt/src/signjob_p.h b/lang/qt/src/signjob_p.h
deleted file mode 100644
index ec974332..00000000
--- a/lang/qt/src/signjob_p.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- signjob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_SIGNJOB_P_H__
-#define __QGPGME_SIGNJOB_P_H__
-
-#include "job_p.h"
-
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-struct SignJobPrivate : public JobPrivate
-{
- // used by startIt()
- std::vector<GpgME::Key> m_signers;
- QString m_inputFilePath;
- QString m_outputFilePath;
- GpgME::SignatureMode m_signingFlags = GpgME::SignFile;
- bool m_appendSignature = false;
-};
-
-}
-
-#endif // __QGPGME_SIGNJOB_P_H__
diff --git a/lang/qt/src/signkeyjob.h b/lang/qt/src/signkeyjob.h
deleted file mode 100644
index d0e90c22..00000000
--- a/lang/qt/src/signkeyjob.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- signkeyjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_SIGNKEYJOB_H__
-#define __KLEO_SIGNKEYJOB_H__
-
-#include "job.h"
-
-#include <vector>
-
-namespace GpgME
-{
-class Error;
-class Key;
-enum class TrustSignatureTrust : char;
-}
-
-class QDate;
-class QString;
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class to sign keys asynchronously
-
- To use a SignKeyJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the job with a call
- to start(). This call might fail, in which case the ChangeExpiryJob
- instance will have scheduled it's own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the SignKeyJob will schedule it's own
- destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT SignKeyJob : public Job
-{
- Q_OBJECT
-protected:
- explicit SignKeyJob(QObject *parent);
-public:
- ~SignKeyJob();
-
- /**
- Starts the key signing operation. \a key is the key to sign.
- @param keyToSign the key to be signed
- */
- virtual GpgME::Error start(const GpgME::Key &keyToSign) = 0;
-
- /**
- * If explicitly specified, only the listed user IDs will be signed. Otherwise all user IDs
- * are signed.
- * @param idsToSign list of user ID indexes (of the key to be signed).
- */
- virtual void setUserIDsToSign(const std::vector<unsigned int> &idsToSign) = 0;
-
- /**
- * sets the check level
- * @param checkLevel the check level, ranges from 0 (no claim) and 3 (extensively checked),
- * default is 0
- */
- virtual void setCheckLevel(unsigned int checkLevel) = 0;
-
- /**
- * sets whether the signature should be exportable, or local only.
- * default is local.
- */
- virtual void setExportable(bool exportable) = 0;
-
- /**
- * sets an alternate signing key
- */
- virtual void setSigningKey(const GpgME::Key &key) = 0;
-
- /**
- * if set, the created signature won't be revocable. By default signatures
- * can be revoked.
- */
- virtual void setNonRevocable(bool nonRevocable) = 0;
-
- /**
- * Set this if it is ok to overwrite an existing signature. In that
- * case the context has to have the flag "extended-edit" set to 1 through
- * Context::setFlag before calling edit.
- *
- * Not pure virtual for ABI compatibility.
- **/
- virtual void setDupeOk(bool) {}
-
- /**
- * Add a remark to the signature. This uses [email protected] as a notation.
- *
- * Not pure virtual for ABI compatibility.
- **/
- virtual void setRemark(const QString &) {}
-
- /**
- * If set, then the created signature will be a trust signature. By default,
- * no trust signatures are created.
- *
- * @a trust is the amount of trust to put into the signed key, either
- * @c TrustSignatureTrust::Partial or @c TrustSignatureTrust::Complete.
- * @a depth is the level of the trust signature. Values between 0 and 255 are
- * allowed. Level 0 has the same meaning as an ordinary validity signature.
- * Level 1 means that the signed key is asserted to be a valid trusted
- * introducer. Level n >= 2 means that the signed key is asserted to be
- * trusted to issue level n-1 trust signatures, i.e., that it is a "meta
- * introducer".
- * @a scope is a domain name that limits the scope of trust of the signed key
- * to user IDs with email addresses matching the domain (or a subdomain).
- *
- * Not pure virtual for ABI compatibility.
- **/
- virtual void setTrustSignature(GpgME::TrustSignatureTrust trust, unsigned short depth, const QString &scope) { Q_UNUSED(trust); Q_UNUSED(depth); Q_UNUSED(scope); }
-
- /**
- * Sets the expiration date of the key signature to @a expiration. By default,
- * key signatures do not expire.
- *
- * Note: Expiration dates after 2106-02-05 will be set to 2106-02-05.
- *
- * Not pure virtual for ABI compatibility.
- **/
- virtual void setExpirationDate(const QDate &expiration) { Q_UNUSED(expiration); }
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_SIGNKEYJOB_H__
diff --git a/lang/qt/src/specialjob.h b/lang/qt/src/specialjob.h
deleted file mode 100644
index 5690d2e0..00000000
--- a/lang/qt/src/specialjob.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- specialjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_SPECIALJOB_H__
-#define __KLEO_SPECIALJOB_H__
-
-#include "job.h"
-#include "qgpgme_export.h"
-
-namespace GpgME
-{
-class Error;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for protocol-specific jobs
-
- To use a SpecialJob, first obtain an instance from the
- CryptoBackend implementation, connect progress() and result()
- signals to suitable slots and then start the job with a call to
- start(). This call might fail, in which case the SpecialJob
- instance will have schedules its own destruction with a call to
- QObject::deleteLater().
-
- After result() is emitted, the SpecialJob will schedule its own
- destruction by calling QObject::deleteLater().
-
- Parameters are set using the Qt property system. More general, or
- constructor parameters are given in the call to
- QGpgME::Protocol::specialJob().
-
- The result is made available through the result signal, and
- through the read-only result property, the latter of which needs
- to be defined in each SpecialJob subclass.
-*/
-class QGPGME_EXPORT SpecialJob : public Job
-{
- Q_OBJECT
-protected:
- explicit SpecialJob(QObject *parent);
-
-public:
- ~SpecialJob();
-
- /**
- Starts the special operation.
- */
- virtual GpgME::Error start() = 0;
-
- virtual GpgME::Error exec() = 0;
-
-Q_SIGNALS:
- void result(const GpgME::Error &result, const QVariant &data);
-};
-
-}
-
-#endif // __KLEO_SPECIALJOB_H__
diff --git a/lang/qt/src/threadedjobmixin.cpp b/lang/qt/src/threadedjobmixin.cpp
deleted file mode 100644
index c0485325..00000000
--- a/lang/qt/src/threadedjobmixin.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- threadedjobmixin.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "threadedjobmixin.h"
-
-#include "dataprovider.h"
-#include "util.h"
-
-#include <gpgme++/data.h>
-
-#include <QString>
-#include <QStringList>
-#include <QByteArray>
-
-
-#include <algorithm>
-#include <iterator>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-static QString stringFromGpgOutput(const QByteArray &ba)
-{
-#ifdef Q_OS_WIN
- return QString::fromUtf8(ba);
-#else
- return QString::fromLocal8Bit(ba);
-#endif
-}
-
-static QString markupDiagnostics(const QString &data)
-{
- // First ensure that we don't have html in the diag.
- QString ret = QStringLiteral("<pre>%1</pre>").arg(data.toHtmlEscaped());
-
- return ret;
-}
-
-static const unsigned int CMSAuditLogFlags = Context::AuditLogWithHelp | Context::HtmlAuditLog;
-static const unsigned int OpenPGPAuditLogFlags = Context::DiagnosticAuditLog;
-
-QString _detail::audit_log_as_html(Context *ctx, GpgME::Error &err)
-{
- assert(ctx);
- QGpgME::QByteArrayDataProvider dp;
- Data data(&dp);
- assert(!data.isNull());
-
- if (ctx->protocol() == OpenPGP) {
- if ((err = ctx->getAuditLog(data, OpenPGPAuditLogFlags))) {
- return errorAsString(err);
- }
- const QByteArray ba = dp.data();
- return markupDiagnostics(stringFromGpgOutput(ba));
- }
-
- if (ctx->protocol() == CMS) {
- if ((err = ctx->lastError())) {
- if ((err = ctx->getAuditLog(data, Context::DiagnosticAuditLog))) {
- return errorAsString(err);
- }
- const QByteArray ba = dp.data();
- return markupDiagnostics(stringFromGpgOutput(ba));
- } else if ((err = ctx->getAuditLog(data, CMSAuditLogFlags))) {
- return errorAsString(err);
- }
- return QString::fromUtf8(dp.data());
- }
-
- return QStringLiteral("Unsupported protocol for Audit Log");
-}
-
-static QList<QByteArray> from_sl(const QStringList &sl)
-{
- QList<QByteArray> result;
- for (const QString &str : sl) {
- result.append(str.toUtf8());
- }
-
-#if 0
- std::transform(sl.begin(), sl.end(), std::back_inserter(result),
- mem_fn(static_cast<QByteArray()const>(&QString::toUtf8)));
-#endif
- return result;
-}
-
-static QList<QByteArray> single(const QByteArray &ba)
-{
- QList<QByteArray> result;
- result.push_back(ba);
- return result;
-}
-
-_detail::PatternConverter::PatternConverter(const QByteArray &ba)
- : m_list(single(ba)), m_patterns(nullptr) {}
-_detail::PatternConverter::PatternConverter(const QString &s)
- : m_list(single(s.toUtf8())), m_patterns(nullptr) {}
-_detail::PatternConverter::PatternConverter(const QList<QByteArray> &lba)
- : m_list(lba), m_patterns(nullptr) {}
-_detail::PatternConverter::PatternConverter(const QStringList &sl)
- : m_list(from_sl(sl)), m_patterns(nullptr) {}
-
-const char **_detail::PatternConverter::patterns() const
-{
- if (!m_patterns) {
- m_patterns = new const char *[ m_list.size() + 1 ];
- const char **end = std::transform(m_list.begin(), m_list.end(), m_patterns,
- std::mem_fn(&QByteArray::constData));
- *end = nullptr;
- }
- return m_patterns;
-}
-
-_detail::PatternConverter::~PatternConverter()
-{
- delete [] m_patterns;
-}
diff --git a/lang/qt/src/threadedjobmixin.h b/lang/qt/src/threadedjobmixin.h
deleted file mode 100644
index 7a18aa4d..00000000
--- a/lang/qt/src/threadedjobmixin.h
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- threadedjobmixin.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2008 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_THREADEDJOBMIXING_H__
-#define __QGPGME_THREADEDJOBMIXING_H__
-
-#include <QMutex>
-#include <QMutexLocker>
-#include <QThread>
-#include <QString>
-#include <QIODevice>
-
-#include <gpgme++/context.h>
-#include <gpgme++/interfaces/progressprovider.h>
-
-#include "job.h"
-
-#include <cassert>
-#include <functional>
-
-namespace QGpgME
-{
-namespace _detail
-{
-
-QString audit_log_as_html(GpgME::Context *ctx, GpgME::Error &err);
-
-class PatternConverter
-{
- const QList<QByteArray> m_list;
- mutable const char **m_patterns;
-public:
- explicit PatternConverter(const QByteArray &ba);
- explicit PatternConverter(const QString &s);
- explicit PatternConverter(const QList<QByteArray> &lba);
- explicit PatternConverter(const QStringList &sl);
- ~PatternConverter();
-
- const char **patterns() const;
-};
-
-class ToThreadMover
-{
- QObject *const m_object;
- QThread *const m_thread;
-public:
- ToThreadMover(QObject *o, QThread *t) : m_object(o), m_thread(t) {}
- ToThreadMover(QObject &o, QThread *t) : m_object(&o), m_thread(t) {}
- ToThreadMover(const std::shared_ptr<QObject> &o, QThread *t) : m_object(o.get()), m_thread(t) {}
- ~ToThreadMover()
- {
- if (m_object && m_thread) {
- m_object->moveToThread(m_thread);
- }
- }
-};
-
-template <typename T_result>
-class Thread : public QThread
-{
-public:
- explicit Thread(QObject *parent = nullptr) : QThread(parent) {}
-
- void setFunction(const std::function<T_result()> &function)
- {
- const QMutexLocker locker(&m_mutex);
- m_function = function;
- }
-
- bool hasFunction()
- {
- const QMutexLocker locker(&m_mutex);
- return static_cast<bool>(m_function);
- }
-
- T_result result() const
- {
- const QMutexLocker locker(&m_mutex);
- return m_result;
- }
-
-private:
- void run() override {
- const QMutexLocker locker(&m_mutex);
- m_result = m_function();
- }
-private:
- mutable QMutex m_mutex;
- std::function<T_result()> m_function;
- T_result m_result;
-};
-
-template <typename T_base, typename T_result = std::tuple<GpgME::Error, QString, GpgME::Error> >
-class ThreadedJobMixin : public T_base, public GpgME::ProgressProvider
-{
-public:
- typedef ThreadedJobMixin<T_base, T_result> mixin_type;
- typedef T_result result_type;
-
- void run()
- {
- Q_ASSERT(m_thread.hasFunction() && "Call setWorkerFunction() before run()");
- m_thread.start();
- }
-
-protected:
- static_assert(std::tuple_size<T_result>::value > 2,
- "Result tuple too small");
- static_assert(std::is_same <
- typename std::tuple_element <
- std::tuple_size<T_result>::value - 2,
- T_result
- >::type,
- QString
- >::value,
- "Second to last result type not a QString");
- static_assert(std::is_same <
- typename std::tuple_element <
- std::tuple_size<T_result>::value - 1,
- T_result
- >::type,
- GpgME::Error
- >::value,
- "Last result type not a GpgME::Error");
-
- explicit ThreadedJobMixin(GpgME::Context *ctx)
- : T_base(nullptr), m_ctx(ctx), m_thread(), m_auditLog(), m_auditLogError()
- {
- }
-
- void lateInitialization()
- {
- assert(m_ctx);
- 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>
- void setWorkerFunction(const T_binder &func)
- {
- m_thread.setFunction([this, func]() { return func(this->context()); });
- }
-
-public:
- template <typename T_binder>
- void run(const T_binder &func)
- {
- m_thread.setFunction(std::bind(func, this->context()));
- m_thread.start();
- }
- template <typename T_binder>
- void run(const T_binder &func, const std::shared_ptr<QIODevice> &io)
- {
- if (io) {
- io->moveToThread(&m_thread);
- }
- // the arguments passed here to the functor are stored in a QThread, and are not
- // necessarily destroyed (living outside the UI thread) at the time the result signal
- // is emitted and the signal receiver wants to clean up IO devices.
- // To avoid such races, we pass std::weak_ptr's to the functor.
- m_thread.setFunction(std::bind(func, this->context(), this->thread(), std::weak_ptr<QIODevice>(io)));
- m_thread.start();
- }
- template <typename T_binder>
- void run(const T_binder &func, const std::shared_ptr<QIODevice> &io1, const std::shared_ptr<QIODevice> &io2)
- {
- if (io1) {
- io1->moveToThread(&m_thread);
- }
- if (io2) {
- io2->moveToThread(&m_thread);
- }
- // the arguments passed here to the functor are stored in a QThread, and are not
- // necessarily destroyed (living outside the UI thread) at the time the result signal
- // is emitted and the signal receiver wants to clean up IO devices.
- // To avoid such races, we pass std::weak_ptr's to the functor.
- m_thread.setFunction(std::bind(func, this->context(), this->thread(), std::weak_ptr<QIODevice>(io1), std::weak_ptr<QIODevice>(io2)));
- m_thread.start();
- }
-
-protected:
- GpgME::Context *context() const
- {
- return m_ctx.get();
- }
-
- virtual void resultHook(const result_type &) {}
-
- void slotFinished()
- {
- const T_result r = m_thread.result();
- m_auditLog = std::get < std::tuple_size<T_result>::value - 2 > (r);
- m_auditLogError = std::get < std::tuple_size<T_result>::value - 1 > (r);
- resultHook(r);
- Q_EMIT this->done();
- doEmitResult(r);
- this->deleteLater();
- }
- void slotCancel() override {
- if (m_ctx)
- {
- m_ctx->cancelPendingOperation();
- }
- }
- QString auditLogAsHtml() const override
- {
- return m_auditLog;
- }
- GpgME::Error auditLogError() const override
- {
- return m_auditLogError;
- }
- void showProgress(const char *what,
- int type, int current, int total) override {
- QMetaObject::invokeMethod(this, [this, current, total]() {
- Q_EMIT this->jobProgress(current, total);
- }, Qt::QueuedConnection);
- const QString what_ = QString::fromUtf8(what);
- QMetaObject::invokeMethod(this, [this, what_, type, current, total]() {
- Q_EMIT this->rawProgress(what_, type, current, total);
- }, Qt::QueuedConnection);
- QMetaObject::invokeMethod(this, [this, what_, current, total]() {
- QT_WARNING_PUSH
- QT_WARNING_DISABLE_DEPRECATED
- Q_EMIT this->progress(what_, current, total);
- QT_WARNING_POP
- }, Qt::QueuedConnection);
- }
-private:
- template <typename T1, typename T2>
- void doEmitResult(const std::tuple<T1, T2> &tuple)
- {
- Q_EMIT this->result(std::get<0>(tuple), std::get<1>(tuple));
- }
-
- template <typename T1, typename T2, typename T3>
- void doEmitResult(const std::tuple<T1, T2, T3> &tuple)
- {
- Q_EMIT this->result(std::get<0>(tuple), std::get<1>(tuple), std::get<2>(tuple));
- }
-
- template <typename T1, typename T2, typename T3, typename T4>
- void doEmitResult(const std::tuple<T1, T2, T3, T4> &tuple)
- {
- Q_EMIT this->result(std::get<0>(tuple), std::get<1>(tuple), std::get<2>(tuple), std::get<3>(tuple));
- }
-
- template <typename T1, typename T2, typename T3, typename T4, typename T5>
- void doEmitResult(const std::tuple<T1, T2, T3, T4, T5> &tuple)
- {
- Q_EMIT this->result(std::get<0>(tuple), std::get<1>(tuple), std::get<2>(tuple), std::get<3>(tuple), std::get<4>(tuple));
- }
-
-private:
- std::shared_ptr<GpgME::Context> m_ctx;
- Thread<T_result> m_thread;
- QString m_auditLog;
- GpgME::Error m_auditLogError;
-};
-
-}
-}
-
-#endif /* __QGPGME_THREADEDJOBMIXING_H__ */
diff --git a/lang/qt/src/tofupolicyjob.h b/lang/qt/src/tofupolicyjob.h
deleted file mode 100644
index 90debaef..00000000
--- a/lang/qt/src/tofupolicyjob.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* tofupolicyjob.h
-
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_TOFUPOLICYJOB_H
-#define QGPGME_TOFUPOLICYJOB_H
-
-#include "job.h"
-
-#include "qgpgme_export.h"
-
-#include <gpgme++/tofuinfo.h>
-
-namespace GpgME
-{
- class Key;
-} // namespace GpgME
-
-namespace QGpgME {
-
-/**
- * Set the TOFU Policy for a key
- */
-class QGPGME_EXPORT TofuPolicyJob: public Job
-{
- Q_OBJECT
-protected:
- explicit TofuPolicyJob(QObject *parent);
-public:
- ~TofuPolicyJob();
-
-
- /* Set the policy to \a policy see the gpgme manual for
- * policy explanations. */
- virtual void start(const GpgME::Key &key, GpgME::TofuInfo::Policy policy) = 0;
-
- virtual GpgME::Error exec(const GpgME::Key &key, GpgME::TofuInfo::Policy policy) = 0;
-
-Q_SIGNALS:
- /* Result of the operation
- *
- * As usual auditLogAsHtml and auditLogError can be ignored.
- **/
- void result(const GpgME::Error &error,
- const QString &auditLogAsHtml = QString(),
- const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif
diff --git a/lang/qt/src/util.cpp b/lang/qt/src/util.cpp
deleted file mode 100644
index 51ae9589..00000000
--- a/lang/qt/src/util.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- util.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 <[email protected]>
-
- 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 "util.h"
-
-#include "cleaner.h"
-#include "qgpgme_debug.h"
-
-#include <QFile>
-#include <QFileInfo>
-#include <QRandomGenerator>
-
-#include <gpgme++/key.h>
-
-#include <algorithm>
-#include <functional>
-
-std::vector<std::string> toStrings(const QStringList &l)
-{
- std::vector<std::string> v;
- v.reserve(l.size());
- std::transform(std::begin(l), std::end(l),
- std::back_inserter(v),
- 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 GpgME::Key &k) {
- return QString::fromLatin1(k.primaryFingerprint());
- });
- return fprs;
-}
-
-/**
- * Generates a string of random characters for the file names of temporary files.
- * Never use this for generating passwords or similar use cases requiring highly
- * secure random data.
- */
-static QString getRandomCharacters(const int count)
-{
- if (count < 0) {
- return {};
- }
-
- QString randomChars;
- randomChars.reserve(count);
-
- do {
- // get a 32-bit random number to generate up to 5 random characters from
- // the set {A-Z, a-z, 0-9}; set the highest bit for the break condition
- for (quint32 rnd = QRandomGenerator::global()->generate() | (1 << 31); rnd > 3; rnd = rnd >> 6)
- {
- // take the last 6 bits; ignore 62 and 63
- const char ch = rnd & ((1 << 6) - 1);
- if (ch < 26) {
- randomChars += QLatin1Char(ch + 'A');
- } else if (ch < 26 + 26) {
- randomChars += QLatin1Char(ch - 26 + 'a');
- } else if (ch < 26 + 26 + 10) {
- randomChars += QLatin1Char(ch - 26 - 26 + '0');
- }
- if (randomChars.size() >= count) {
- break;
- }
- }
- } while (randomChars.size() < count);
-
- return randomChars;
-}
-
-/**
- * Creates a temporary file name with extension \c .part for the given file name
- * \a fileName. The function makes sure that the created file name is not in use
- * at the time the file name is chosen.
- *
- * Example: For the file name "this.is.an.archive.tar.gpg" the temporary file name
- * "this.YHgf2tEl.is.an.archive.tar.gpg.part" could be returned.
- */
-static QString createPartFileName(const QString &fileName)
-{
- static const int maxAttempts = 10;
-
- const QFileInfo fi{fileName};
- const QString path = fi.path(); // path without trailing '/'
- const QString baseName = fi.baseName();
- const QString suffix = fi.completeSuffix();
- for (int attempt = 0; attempt < maxAttempts; ++attempt) {
- const QString candidate = (path + QLatin1Char('/')
- + baseName + QLatin1Char('.')
- + getRandomCharacters(8) + QLatin1Char('.')
- + suffix
- + QLatin1String(".part"));
- if (!QFile::exists(candidate)) {
- return candidate;
- }
- }
-
- qCWarning(QGPGME_LOG) << __func__ << "- Failed to create temporary file name for" << fileName;
- return {};
-}
-
-PartialFileGuard::PartialFileGuard(const QString &fileName)
- : mFileName{fileName}
- , mTempFileName{createPartFileName(fileName)}
-{
- qCDebug(QGPGME_LOG) << __func__ << "- Using temporary file name" << mTempFileName;
-}
-
-PartialFileGuard::~PartialFileGuard()
-{
- if (!mTempFileName.isEmpty()) {
- Cleaner::removeFile(mTempFileName);
- }
-}
-
-QString PartialFileGuard::tempFileName() const
-{
- return mTempFileName;
-}
-
-bool PartialFileGuard::commit()
-{
- if (mTempFileName.isEmpty()) {
- qCWarning(QGPGME_LOG) << "PartialFileGuard::commit: Called more than once";
- return false;
- }
- const bool success = QFile::rename(mTempFileName, mFileName);
- if (success) {
- qCDebug(QGPGME_LOG) << __func__ << "- Renamed" << mTempFileName << "to" << mFileName;
- mTempFileName.clear();
- } else {
- qCDebug(QGPGME_LOG) << __func__ << "- Renaming" << mTempFileName << "to" << mFileName << "failed";
- }
- return success;
-}
diff --git a/lang/qt/src/util.h b/lang/qt/src/util.h
deleted file mode 100644
index fcd1187e..00000000
--- a/lang/qt/src/util.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- util.h - some internal helpers
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2022 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_UTIL_H__
-#define __QGPGME_UTIL_H__
-
-#include <QStringList>
-
-#include <gpgme++/error.h>
-
-#include <gpgme.h>
-
-#include <string>
-#include <vector>
-
-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);
-}
-
-static inline QString errorAsString(const GpgME::Error &error)
-{
-#ifdef Q_OS_WIN
- return QString::fromStdString(error.asStdString());
-#else
- return QString::fromLocal8Bit(error.asStdString().c_str());
-#endif
-}
-
-std::vector<std::string> toStrings(const QStringList &l);
-
-QStringList toFingerprints(const std::vector<GpgME::Key> &keys);
-
-/**
- * Helper for using a temporary "part" file for writing a result to, similar
- * to what browsers do when downloading files.
- * On success, you commit() which renames the temporary file to the
- * final file name. Otherwise, you do nothing and let the helper remove the
- * temporary file on destruction.
- */
-class PartialFileGuard
-{
-public:
- explicit PartialFileGuard(const QString &fileName);
- ~PartialFileGuard();
-
- QString tempFileName() const;
-
- bool commit();
-
-private:
- QString mFileName;
- QString mTempFileName;
-};
-
-#endif // __QGPGME_UTIL_H__
diff --git a/lang/qt/src/verifydetachedjob.cpp b/lang/qt/src/verifydetachedjob.cpp
deleted file mode 100644
index 68fe7f21..00000000
--- a/lang/qt/src/verifydetachedjob.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- verifydetachedjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2024 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "verifydetachedjob.h"
-#include "verifydetachedjob_p.h"
-
-using namespace QGpgME;
-
-VerifyDetachedJob::VerifyDetachedJob(QObject *parent)
- : Job{parent}
-{
-}
-
-VerifyDetachedJob::~VerifyDetachedJob() = default;
-
-void VerifyDetachedJob::setProcessAllSignatures (bool processAll)
-{
- auto d = jobPrivate<VerifyDetachedJobPrivate>(this);
- d->m_processAllSignatures = processAll;
-}
-
-bool VerifyDetachedJob::processAllSignatures() const
-{
- auto d = jobPrivate<VerifyDetachedJobPrivate>(this);
- return d->m_processAllSignatures;
-}
-
-void VerifyDetachedJob::setSignatureFile(const QString &path)
-{
- auto d = jobPrivate<VerifyDetachedJobPrivate>(this);
- d->m_signatureFilePath = path;
-}
-
-QString VerifyDetachedJob::signatureFile() const
-{
- auto d = jobPrivate<VerifyDetachedJobPrivate>(this);
- return d->m_signatureFilePath;
-}
-
-void VerifyDetachedJob::setSignedFile(const QString &path)
-{
- auto d = jobPrivate<VerifyDetachedJobPrivate>(this);
- d->m_signedFilePath = path;
-}
-
-QString VerifyDetachedJob::signedFile() const
-{
- auto d = jobPrivate<VerifyDetachedJobPrivate>(this);
- return d->m_signedFilePath;
-}
-
-#include "verifydetachedjob.moc"
diff --git a/lang/qt/src/verifydetachedjob.h b/lang/qt/src/verifydetachedjob.h
deleted file mode 100644
index b5b668e3..00000000
--- a/lang/qt/src/verifydetachedjob.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- verifydetachedjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_VERIFYDETACHEDJOB_H__
-#define __KLEO_VERIFYDETACHEDJOB_H__
-
-#include "job.h"
-
-#include <memory>
-
-class QByteArray;
-class QIODevice;
-
-namespace GpgME
-{
-class Error;
-class VerificationResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous verification of detached signatures
-
- To use a VerifyDetachedJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the verification with a
- call to start(). This call might fail, in which case the
- VerifyDetachedJob instance will have scheduled it's own
- destruction with a call to QObject::deleteLater().
-
- Alternatively, the job can be started with startIt() after setting
- the input files. If the job is started this way then the backend reads the
- input directly from the specified input files. This direct IO mode is
- currently only supported for OpenPGP. Note that startIt() does not schedule
- the job's destruction if starting the job failed.
-
- After result() is emitted, the VerifyDetachedJob will schedule
- it's own destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT VerifyDetachedJob : public Job
-{
- Q_OBJECT
-protected:
- explicit VerifyDetachedJob(QObject *parent);
-public:
- ~VerifyDetachedJob() override;
-
- /**
- * Enables processing of all signatures if \a processAll is true.
- *
- * By default, gpg (in batch mode used by GpgME) stops the verification of
- * data signatures when a bad signature is encountered. This can be changed
- * by setting this flag. It's equivalent to setting the context flag
- * "proc-all-sigs".
- *
- * This is only supported for OpenPGP and requires GnuPG 2.2.45, 2.4.6, or
- * 2.5.1.
- */
- void setProcessAllSignatures(bool processAll);
- bool processAllSignatures() const;
-
- /**
- * Sets the path of the file containing the signature to verify.
- *
- * Used if the job is started with startIt().
- */
- void setSignatureFile(const QString &path);
- QString signatureFile() const;
-
- /**
- * Sets the path of the file containing the signed data to verify.
- *
- * Used if the job is started with startIt().
- */
- void setSignedFile(const QString &path);
- QString signedFile() const;
-
- /**
- Starts the verification operation. \a signature contains the
- signature data, while \a signedData contains the data over
- which the signature was made.
- */
- virtual GpgME::Error start(const QByteArray &signature,
- const QByteArray &signedData) = 0;
-
- virtual void start(const std::shared_ptr<QIODevice> &signature, const std::shared_ptr<QIODevice> &signedData) = 0;
-
- virtual GpgME::VerificationResult exec(const QByteArray &signature,
- const QByteArray &signedData) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::VerificationResult &result, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_VERIFYDETACHEDJOB_H__
diff --git a/lang/qt/src/verifydetachedjob_p.h b/lang/qt/src/verifydetachedjob_p.h
deleted file mode 100644
index cc594210..00000000
--- a/lang/qt/src/verifydetachedjob_p.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- verifydetachedjob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2024 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_VERIFYDETACHEDJOB_P_H__
-#define __QGPGME_VERIFYDETACHEDJOB_P_H__
-
-#include "job_p.h"
-
-namespace QGpgME
-{
-
-struct VerifyDetachedJobPrivate : public JobPrivate
-{
- QString m_signatureFilePath;
- QString m_signedFilePath;
- bool m_processAllSignatures = false;
-};
-
-}
-
-#endif // __QGPGME_VERIFYDETACHEDJOB_P_H__
diff --git a/lang/qt/src/verifyopaquejob.cpp b/lang/qt/src/verifyopaquejob.cpp
deleted file mode 100644
index dced4595..00000000
--- a/lang/qt/src/verifyopaquejob.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- verifyopaquejob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "verifyopaquejob.h"
-#include "verifyopaquejob_p.h"
-
-using namespace QGpgME;
-
-VerifyOpaqueJob::VerifyOpaqueJob(QObject *parent)
- : Job{parent}
-{
-}
-
-VerifyOpaqueJob::~VerifyOpaqueJob() = default;
-
-void VerifyOpaqueJob::setProcessAllSignatures (bool processAll)
-{
- auto d = jobPrivate<VerifyOpaqueJobPrivate>(this);
- d->m_processAllSignatures = processAll;
-}
-
-bool VerifyOpaqueJob::processAllSignatures() const
-{
- auto d = jobPrivate<VerifyOpaqueJobPrivate>(this);
- return d->m_processAllSignatures;
-}
-
-void VerifyOpaqueJob::setInputFile(const QString &path)
-{
- auto d = jobPrivate<VerifyOpaqueJobPrivate>(this);
- d->m_inputFilePath = path;
-}
-
-QString VerifyOpaqueJob::inputFile() const
-{
- auto d = jobPrivate<VerifyOpaqueJobPrivate>(this);
- return d->m_inputFilePath;
-}
-
-void VerifyOpaqueJob::setOutputFile(const QString &path)
-{
- auto d = jobPrivate<VerifyOpaqueJobPrivate>(this);
- d->m_outputFilePath = path;
-}
-
-QString VerifyOpaqueJob::outputFile() const
-{
- auto d = jobPrivate<VerifyOpaqueJobPrivate>(this);
- return d->m_outputFilePath;
-}
-
-#include "verifyopaquejob.moc"
diff --git a/lang/qt/src/verifyopaquejob.h b/lang/qt/src/verifyopaquejob.h
deleted file mode 100644
index e006886b..00000000
--- a/lang/qt/src/verifyopaquejob.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- verifyopaquejob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 __KLEO_VERIFYOPAQUEJOB_H__
-#define __KLEO_VERIFYOPAQUEJOB_H__
-
-#include "job.h"
-
-#include <memory>
-
-class QByteArray;
-class QIODevice;
-
-namespace GpgME
-{
-class Error;
-class VerificationResult;
-}
-
-namespace QGpgME
-{
-
-/**
- @short An abstract base class for asynchronous verification of opaque signatures
-
- To use a VerifyOpaqueJob, first obtain an instance from the
- CryptoBackend implementation, connect the progress() and result()
- signals to suitable slots and then start the verification with a
- call to start(). This call might fail, in which case the
- VerifyOpaqueJob instance will have scheduled it's own
- destruction with a call to QObject::deleteLater().
-
- Alternatively, the job can be started with startIt() after setting
- an input file and an output file. If the job is started this way then
- the backend reads the input and writes the output directly from/to the
- specified input file and output file. In this case the plainText value of
- the result signal will always be empty. This direct IO mode is currently
- only supported for OpenPGP. Note that startIt() does not schedule the job's
- destruction if starting the job failed.
-
- After result() is emitted, the VerifyOpaqueJob will schedule
- it's own destruction by calling QObject::deleteLater().
-*/
-class QGPGME_EXPORT VerifyOpaqueJob : public Job
-{
- Q_OBJECT
-protected:
- explicit VerifyOpaqueJob(QObject *parent);
-public:
- ~VerifyOpaqueJob() override;
-
- /**
- * Enables processing of all signatures if \a processAll is true.
- *
- * By default, gpg (in batch mode used by GpgME) stops the verification of
- * data signatures when a bad signature is encountered. This can be changed
- * by setting this flag. It's equivalent to setting the context flag
- * "proc-all-sigs".
- *
- * This is only supported for OpenPGP and requires GnuPG 2.2.45, 2.4.6, or
- * 2.5.1.
- */
- void setProcessAllSignatures(bool processAll);
- bool processAllSignatures() const;
-
- /**
- * Sets the path of the file to verify.
- *
- * Used if the job is started with startIt().
- */
- void setInputFile(const QString &path);
- QString inputFile() const;
-
- /**
- * Sets the path of the file to write the result to.
- *
- * Used if the job is started with startIt().
- *
- * \note If a file with this path exists, then the job will fail, i.e. you
- * need to delete an existing file that shall be overwritten before you
- * start the job.
- */
- void setOutputFile(const QString &path);
- QString outputFile() const;
-
- /**
- Starts the verification operation. \a signature contains the
- signature data, while \a signedData contains the data over
- which the signature was made.
- */
- virtual GpgME::Error start(const QByteArray &signedData) = 0;
-
- /*!
- \overload
-
- If \a plainText is non-null, the plaintext is written
- there. Otherwise, it will be delivered in the second argument
- of result().
- */
- virtual void start(const std::shared_ptr<QIODevice> &signedData, const std::shared_ptr<QIODevice> &plainText = std::shared_ptr<QIODevice>()) = 0;
-
- /** Synchronous version of @ref start */
- virtual GpgME::VerificationResult exec(const QByteArray &signedData, QByteArray &plainText) = 0;
-
-Q_SIGNALS:
- void result(const GpgME::VerificationResult &result, const QByteArray &plainText, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif // __KLEO_VERIFYOPAQUEJOB_H__
diff --git a/lang/qt/src/verifyopaquejob_p.h b/lang/qt/src/verifyopaquejob_p.h
deleted file mode 100644
index 9686f01c..00000000
--- a/lang/qt/src/verifyopaquejob_p.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- verifyopaquejob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_VERIFYOPAQUEJOB_P_H__
-#define __QGPGME_VERIFYOPAQUEJOB_P_H__
-
-#include "job_p.h"
-
-namespace QGpgME
-{
-
-struct VerifyOpaqueJobPrivate : public JobPrivate
-{
- QString m_inputFilePath;
- QString m_outputFilePath;
- bool m_processAllSignatures = false;
-};
-
-}
-
-#endif // __QGPGME_VERIFYOPAQUEJOB_P_H__
diff --git a/lang/qt/src/wkdlookupjob.h b/lang/qt/src/wkdlookupjob.h
deleted file mode 100644
index ae228744..00000000
--- a/lang/qt/src/wkdlookupjob.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- wkdlookupjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_WKDLOOKUPJOB_H__
-#define __QGPGME_WKDLOOKUPJOB_H__
-
-#include "job.h"
-#include "qgpgme_export.h"
-
-class QString;
-
-namespace GpgME
-{
-class Data;
-class Error;
-}
-
-namespace QGpgME
-{
-
-class WKDLookupResult;
-
-class QGPGME_EXPORT WKDLookupJob : public Job
-{
- Q_OBJECT
-protected:
- explicit WKDLookupJob(QObject *parent);
-
-public:
- ~WKDLookupJob();
-
- /**
- Starts a key lookup operation for the email address \a email via WKD.
- */
- virtual GpgME::Error start(const QString &email) = 0;
-
- /**
- Runs a key lookup operation for the email address \a email via WKD.
- */
- virtual WKDLookupResult exec(const QString &email) = 0;
-
-Q_SIGNALS:
- void result(const WKDLookupResult &result, const QString &auditLogAsHtml = {}, const GpgME::Error &auditLogError = {});
-};
-
-}
-
-#endif // __QGPGME_WKDLOOKUPJOB_H__
diff --git a/lang/qt/src/wkdlookupresult.cpp b/lang/qt/src/wkdlookupresult.cpp
deleted file mode 100644
index ac1a89e9..00000000
--- a/lang/qt/src/wkdlookupresult.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- wkdlookupresult.cpp - wraps the result of a WKDLookupJob
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "wkdlookupresult.h"
-
-#include <gpgme++/data.h>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-class WKDLookupResult::Private
-{
-public:
- std::string pattern;
- GpgME::Data keyData;
- std::string source;
-};
-
-WKDLookupResult::WKDLookupResult() = default;
-
-WKDLookupResult::~WKDLookupResult() = default;
-
-WKDLookupResult::WKDLookupResult(const std::string &pattern, const Error &error)
- : Result{error}
- , d{new Private{pattern, {}, {}}}
-{
-}
-
-WKDLookupResult::WKDLookupResult(const std::string &pattern, const Data &keyData, const std::string &source, const Error &error)
- : Result{error}
- , d{new Private{pattern, keyData, source}}
-{
-}
-
-WKDLookupResult::WKDLookupResult(const WKDLookupResult &other)
- : Result{other}
-{
- if (other.d) {
- d.reset(new Private{*other.d});
- }
-}
-
-WKDLookupResult &WKDLookupResult::operator=(const WKDLookupResult &other)
-{
- auto tmp = other;
- swap(tmp);
- return *this;
-}
-
-WKDLookupResult::WKDLookupResult(WKDLookupResult &&other) = default;
-
-WKDLookupResult &WKDLookupResult::operator=(WKDLookupResult &&other) = default;
-
-void WKDLookupResult::swap(WKDLookupResult &other) noexcept
-{
- Result::swap(other);
- std::swap(this->d, other.d);
-}
-
-bool WKDLookupResult::isNull() const
-{
- return !d && !bool(error());
-}
-
-std::string WKDLookupResult::pattern() const
-{
- return d ? d->pattern : std::string{};
-}
-
-Data WKDLookupResult::keyData() const
-{
- return d ? d->keyData : Data{};
-}
-
-std::string WKDLookupResult::source() const
-{
- return d ? d->source : std::string{};
-}
-
-void QGpgME::swap(WKDLookupResult &a, WKDLookupResult &b)
-{
- a.swap(b);
-}
diff --git a/lang/qt/src/wkdlookupresult.h b/lang/qt/src/wkdlookupresult.h
deleted file mode 100644
index 5696fb6d..00000000
--- a/lang/qt/src/wkdlookupresult.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- wkdlookupresult.h - wraps the result of a WKDLookupJob
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_WKDLOOKUPRESULT_H__
-#define __QGPGME_WKDLOOKUPRESULT_H__
-
-#include "qgpgme_export.h"
-
-#include <gpgme++/result.h>
-
-#include <memory>
-
-namespace GpgME
-{
-class Data;
-class Error;
-}
-
-namespace QGpgME
-{
-
-class QGPGME_EXPORT WKDLookupResult : public GpgME::Result
-{
-public:
- WKDLookupResult();
- ~WKDLookupResult();
-
- explicit WKDLookupResult(const std::string &pattern, const GpgME::Error &err);
- explicit WKDLookupResult(const std::string &pattern, const GpgME::Data &keyData, const std::string &source, const GpgME::Error &err);
-
- WKDLookupResult(const WKDLookupResult &other);
- WKDLookupResult &operator=(const WKDLookupResult &other);
-
- WKDLookupResult(WKDLookupResult &&other);
- WKDLookupResult &operator=(WKDLookupResult &&other);
-
- void swap(WKDLookupResult &other) noexcept;
-
- bool isNull() const;
-
- std::string pattern() const;
- GpgME::Data keyData() const;
- std::string source() const;
-
-private:
- class Private;
- std::unique_ptr<Private> d;
-};
-
-QGPGME_EXPORT void swap(WKDLookupResult &a, WKDLookupResult &b);
-
-}
-
-#endif // __QGPGME_WKDLOOKUPRESULT_H__
diff --git a/lang/qt/src/wkdrefreshjob.cpp b/lang/qt/src/wkdrefreshjob.cpp
deleted file mode 100644
index f79df2c5..00000000
--- a/lang/qt/src/wkdrefreshjob.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- wkdrefreshjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "wkdrefreshjob.h"
-#include "wkdrefreshjob_p.h"
-
-using namespace QGpgME;
-
-WKDRefreshJob::WKDRefreshJob(QObject *parent)
- : AbstractImportJob{parent}
-{
-}
-
-WKDRefreshJob::~WKDRefreshJob() = default;
-
-GpgME::Error WKDRefreshJob::start(const std::vector<GpgME::Key> &keys)
-{
- auto d = jobPrivate<WKDRefreshJobPrivate>(this);
- d->m_keys = keys;
- return d->startIt();
-}
-
-GpgME::Error WKDRefreshJob::start(const std::vector<GpgME::UserID> &userIDs)
-{
- auto d = jobPrivate<WKDRefreshJobPrivate>(this);
- d->m_userIds = userIDs;
- return d->startIt();
-}
-
-#include "wkdrefreshjob.moc"
diff --git a/lang/qt/src/wkdrefreshjob.h b/lang/qt/src/wkdrefreshjob.h
deleted file mode 100644
index cbaaf6b0..00000000
--- a/lang/qt/src/wkdrefreshjob.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- wkdrefreshjob.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_WKDREFRESHJOB_H__
-#define __QGPGME_WKDREFRESHJOB_H__
-
-#include "abstractimportjob.h"
-#include "qgpgme_export.h"
-
-#include <vector>
-
-namespace GpgME
-{
-class Error;
-class Key;
-class UserID;
-}
-
-namespace QGpgME
-{
-
-/**
- * This job refreshes OpenPGP keys via WKD.
- */
-class QGPGME_EXPORT WKDRefreshJob : public AbstractImportJob
-{
- Q_OBJECT
-protected:
- explicit WKDRefreshJob(QObject *parent);
-public:
- ~WKDRefreshJob() override;
-
- /**
- * Starts a refresh of the \a keys. Only user IDs that have WKD set as
- * origin are used for the WKD lookup. Revoked user IDs are ignored.
- *
- * Use the other start overload to use all user IDs for the WKD lookup.
- */
- GpgME::Error start(const std::vector<GpgME::Key> &keys);
-
- /**
- * Starts a refresh of the keys belonging to the user IDs \a userIDs.
- * All user IDs are used for the WKD lookup. Revoked user IDs are ignored.
- */
- GpgME::Error start(const std::vector<GpgME::UserID> &userIDs);
-};
-
-}
-
-#endif // __QGPGME_WKDREFRESHJOB_H__
diff --git a/lang/qt/src/wkdrefreshjob_p.h b/lang/qt/src/wkdrefreshjob_p.h
deleted file mode 100644
index 8e729936..00000000
--- a/lang/qt/src/wkdrefreshjob_p.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- wkdrefreshjob_p.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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_WKDREFRESHJOB_P_H__
-#define __QGPGME_WKDREFRESHJOB_P_H__
-
-#include "job_p.h"
-
-#include <gpgme++/key.h>
-
-namespace QGpgME
-{
-
-struct WKDRefreshJobPrivate : public JobPrivate
-{
- std::vector<GpgME::Key> m_keys;
- std::vector<GpgME::UserID> m_userIds;
-};
-
-}
-
-#endif // __QGPGME_WKDREFRESHJOB_P_H__
diff --git a/lang/qt/src/wkspublishjob.h b/lang/qt/src/wkspublishjob.h
deleted file mode 100644
index 2b4daf51..00000000
--- a/lang/qt/src/wkspublishjob.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* wkspublishjob.h
-
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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_WKSPUBLISHJOB_H
-#define QGPGME_WKSPUBLISHJOB_H
-
-#include "job.h"
-
-#include "qgpgme_export.h"
-
-namespace GpgME
-{
- class Key;
-} // namespace GpgME
-
-namespace QGpgME {
-
-/**
- * Handles Web Key Service Publishing. Needs WKS tools installed and
- * server support.
- *
- * 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 call startReceive with the
- * RFC822 mail received as parameter response. Check for errors
- * and then send the result from returnedData back to the server.
- */
-class QGPGME_EXPORT WKSPublishJob: public Job
-{
- Q_OBJECT
-protected:
- explicit WKSPublishJob(QObject *parent);
-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.
- *
- * The error GPG_ERR_NOT_ENABLED indicates that wks-tools failed to
- * detect a working wks service for this.
- *
- * @param the mailbox to check for.
- **/
- virtual void startCheck(const QString &mailbox) = 0;
-
- /** Create a publish request.
- * 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 submission 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.
- **/
- virtual void startReceive(const QByteArray &response) = 0;
-
-Q_SIGNALS:
- /* Result of the operation returned Data and returned Error are
- * the results from gpg-wks-client's stdout or stderr respectively.
- *
- * As usual auditLogAsHtml and auditLogError can be ignored.
- **/
- void result(const GpgME::Error &error, const QByteArray &returnedData,
- const QByteArray &returnedError,
- const QString &auditLogAsHtml = QString(),
- const GpgME::Error &auditLogError = GpgME::Error());
-};
-
-}
-
-#endif
diff --git a/lang/qt/tests/Makefile.am b/lang/qt/tests/Makefile.am
deleted file mode 100644
index ee168b75..00000000
--- a/lang/qt/tests/Makefile.am
+++ /dev/null
@@ -1,424 +0,0 @@
-# Makefile.am - Makefile for QGpgME tests.
-# Copyright (C) 2016 Bundesamt für Sicherheit in der Informationstechnik
-# Software engineering by Intevation GmbH
-#
-# This file is part of QGpgME.
-#
-# 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, see <https://gnu.org/licenses/>.
-# SPDX-License-Identifier: GPL-2.0-or-later
-
-## Process this file with automake to produce Makefile.in
-
-GPG = gpg
-
-GNUPGHOME=$(abs_builddir)
-TESTS_ENVIRONMENT = GNUPGHOME=$(GNUPGHOME)
-
-EXTRA_DIST = initial.test final.test
-
-if WANT_QT5
-the_tests5 = \
- t-addexistingsubkey5 \
- t-changeexpiryjob5 \
- t-config5 \
- t-decryptverify5 \
- t-disablekey5 \
- t-encrypt5 \
- t-import5 \
- t-keylist5 \
- t-keylocate5 \
- t-ownertrust5 \
- t-remarks5 \
- t-revokekey5 \
- t-setprimaryuserid5 \
- t-tofuinfo5 \
- t-trustsignatures5 \
- t-various5 \
- t-verify5 \
- t-wkdlookup5
-# disabled test: t-wkspublish5
-the_runners5 = \
- run-decryptverifyarchivejob5 \
- run-decryptverifyjob5 \
- run-encryptarchivejob5 \
- run-encryptjob5 \
- run-exportjob5 \
- run-importjob5 \
- run-keyformailboxjob5 \
- run-receivekeysjob5 \
- run-refreshkeysjob5 \
- run-signarchivejob5 \
- run-signjob5 \
- run-verifydetachedjob5 \
- run-verifyopaquejob5 \
- run-wkdrefreshjob5
-endif
-if WANT_QT6
-the_tests6 = \
- t-addexistingsubkey6 \
- t-changeexpiryjob6 \
- t-config6 \
- t-decryptverify6 \
- t-disablekey6 \
- t-encrypt6 \
- t-import6 \
- t-keylist6 \
- t-keylocate6 \
- t-ownertrust6 \
- t-remarks6 \
- t-revokekey6 \
- t-setprimaryuserid6 \
- t-tofuinfo6 \
- t-trustsignatures6 \
- t-various6 \
- t-verify6 \
- t-wkdlookup6
-# disabled test: t-wkspublish6
-the_runners6 = \
- run-decryptverifyarchivejob6 \
- run-decryptverifyjob6 \
- run-encryptarchivejob6 \
- run-encryptjob6 \
- run-exportjob6 \
- run-importjob6 \
- run-keyformailboxjob6 \
- run-receivekeysjob6 \
- run-refreshkeysjob6 \
- run-signarchivejob6 \
- run-signjob6 \
- run-verifydetachedjob6 \
- run-verifyopaquejob6 \
- run-wkdrefreshjob6
-endif
-
-TESTS = initial.test $(the_tests5) $(the_tests6) final.test
-
-# define .moc files for all tests; we'll moc their .cpp files
-# the only header that needs to be moc'd (t-support.h) is handled individually
-# moc_files = $(the_tests:%=%.moc)
-
-# generate the moc files in two steps:
-# 1. generate Qt 5/6-specific moc files in builddir with extension .moc5/.moc6;
-# this ensures correct dependencies on the source files
-# 2. generate forwarding headers in subfolders moc5/moc6 with extension .moc;
-# this ensures that the "foo.moc" includes in the source files work and
-# include the correct version of the generated moc files for Qt 5/6
-# GNU make's pattern rules would make this easier, but we don't want to use them
-if WANT_QT5
-moc5_dir = moc5
-moc5_files = $(moc5_dir)/t-support.hmoc $(the_tests5:%5=%.moc5)
-moc5_forward_headers = $(the_tests5:%5=$(moc5_dir)/%.moc)
-
-$(moc5_dir)/t-support.hmoc: t-support.h | $(moc5_dir)
- $(MOC5) `test -f '$<' || echo '$(srcdir)/'`$< -o $@
-
-.cpp.moc5:
- $(MOC5) `test -f '$<' || echo '$(srcdir)/'`$< -o $@
-
-$(moc5_dir):
- mkdir $(moc5_dir)
-
-$(moc5_forward_headers): Makefile.am | $(moc5_dir)
- echo "#include \"../$(notdir $@)5\"" > "$@"
-endif
-if WANT_QT6
-moc6_dir = moc6
-moc6_files = $(moc6_dir)/t-support.hmoc $(the_tests6:%6=%.moc6)
-moc6_forward_headers = $(the_tests6:%6=$(moc6_dir)/%.moc)
-
-$(moc6_dir)/t-support.hmoc: t-support.h | $(moc6_dir)
- $(MOC6) `test -f '$<' || echo '$(srcdir)/'`$< -o $@
-
-.cpp.moc6:
- $(MOC6) `test -f '$<' || echo '$(srcdir)/'`$< -o $@
-
-$(moc6_dir):
- mkdir $(moc6_dir)
-
-$(moc6_forward_headers): Makefile.am | $(moc6_dir)
- echo "#include \"../$(notdir $@)6\"" > "$@"
-endif
-
-AM_LDFLAGS = -no-install
-
-if WANT_QT5
-ldadd_qt5 = ../../cpp/src/libgpgmepp.la ../src/libqgpgme.la \
- ../../../src/libgpgme.la @GPGME_QT5_LIBS@ @GPG_ERROR_LIBS@ \
- @GPGME_QT5TEST_LIBS@ @LDADD_FOR_TESTS_KLUDGE@ -lstdc++
-
-cppflags_qt5 = -I$(moc5_dir) -I$(top_srcdir)/lang/qt/src -I$(top_builddir)/lang/cpp/src \
- -I$(top_builddir)/src \
- @GPG_ERROR_CFLAGS@ @GPGME_QT5_CFLAGS@ @GPG_ERROR_CFLAGS@ \
- @LIBASSUAN_CFLAGS@ @GPGME_QT5TEST_CFLAGS@ -DBUILDING_QGPGME \
- -DTOP_SRCDIR="$(top_srcdir)"
-endif
-if WANT_QT6
-ldadd_qt6 = ../../cpp/src/libgpgmepp.la ../src/libqgpgmeqt6.la \
- ../../../src/libgpgme.la @GPGME_QT6_LIBS@ @GPG_ERROR_LIBS@ \
- @GPGME_QT6TEST_LIBS@ @LDADD_FOR_TESTS_KLUDGE@ -lstdc++
-
-cppflags_qt6 = -I$(moc6_dir) -I$(top_srcdir)/lang/qt/src -I$(top_builddir)/lang/cpp/src \
- -I$(top_builddir)/src \
- @GPG_ERROR_CFLAGS@ @GPGME_QT6_CFLAGS@ @GPG_ERROR_CFLAGS@ \
- @LIBASSUAN_CFLAGS@ @GPGME_QT6TEST_CFLAGS@ -DBUILDING_QGPGME \
- -DTOP_SRCDIR="$(top_srcdir)"
-endif
-
-support_src = t-support.h t-support.cpp
-
-if WANT_QT5
-t_addexistingsubkey5_SOURCES = t-addexistingsubkey.cpp $(support_src)
-t_addexistingsubkey5_LDADD = $(ldadd_qt5)
-t_addexistingsubkey5_CPPFLAGS = $(cppflags_qt5)
-t_changeexpiryjob5_SOURCES = t-changeexpiryjob.cpp $(support_src)
-t_changeexpiryjob5_LDADD = $(ldadd_qt5)
-t_changeexpiryjob5_CPPFLAGS = $(cppflags_qt5)
-t_config5_SOURCES = t-config.cpp $(support_src)
-t_config5_LDADD = $(ldadd_qt5)
-t_config5_CPPFLAGS = $(cppflags_qt5)
-t_decryptverify5_SOURCES = t-decryptverify.cpp $(support_src)
-t_decryptverify5_LDADD = $(ldadd_qt5)
-t_decryptverify5_CPPFLAGS = $(cppflags_qt5)
-t_disablekey5_SOURCES = t-disablekey.cpp $(support_src)
-t_disablekey5_LDADD = $(ldadd_qt5)
-t_disablekey5_CPPFLAGS = $(cppflags_qt5)
-t_encrypt5_SOURCES = t-encrypt.cpp $(support_src)
-t_encrypt5_LDADD = $(ldadd_qt5)
-t_encrypt5_CPPFLAGS = $(cppflags_qt5)
-t_import5_SOURCES = t-import.cpp $(support_src)
-t_import5_LDADD = $(ldadd_qt5)
-t_import5_CPPFLAGS = $(cppflags_qt5)
-t_keylist5_SOURCES = t-keylist.cpp $(support_src)
-t_keylist5_LDADD = $(ldadd_qt5)
-t_keylist5_CPPFLAGS = $(cppflags_qt5)
-t_keylocate5_SOURCES = t-keylocate.cpp $(support_src)
-t_keylocate5_LDADD = $(ldadd_qt5)
-t_keylocate5_CPPFLAGS = $(cppflags_qt5)
-t_ownertrust5_SOURCES = t-ownertrust.cpp $(support_src)
-t_ownertrust5_LDADD = $(ldadd_qt5)
-t_ownertrust5_CPPFLAGS = $(cppflags_qt5)
-t_remarks5_SOURCES = t-remarks.cpp $(support_src)
-t_remarks5_LDADD = $(ldadd_qt5)
-t_remarks5_CPPFLAGS = $(cppflags_qt5)
-t_revokekey5_SOURCES = t-revokekey.cpp $(support_src)
-t_revokekey5_LDADD = $(ldadd_qt5)
-t_revokekey5_CPPFLAGS = $(cppflags_qt5)
-t_setprimaryuserid5_SOURCES = t-setprimaryuserid.cpp $(support_src)
-t_setprimaryuserid5_LDADD = $(ldadd_qt5)
-t_setprimaryuserid5_CPPFLAGS = $(cppflags_qt5)
-t_tofuinfo5_SOURCES = t-tofuinfo.cpp $(support_src)
-t_tofuinfo5_LDADD = $(ldadd_qt5)
-t_tofuinfo5_CPPFLAGS = $(cppflags_qt5)
-t_trustsignatures5_SOURCES = t-trustsignatures.cpp $(support_src)
-t_trustsignatures5_LDADD = $(ldadd_qt5)
-t_trustsignatures5_CPPFLAGS = $(cppflags_qt5)
-t_various5_SOURCES = t-various.cpp $(support_src)
-t_various5_LDADD = $(ldadd_qt5)
-t_various5_CPPFLAGS = $(cppflags_qt5)
-t_verify5_SOURCES = t-verify.cpp $(support_src)
-t_verify5_LDADD = $(ldadd_qt5)
-t_verify5_CPPFLAGS = $(cppflags_qt5)
-t_wkdlookup5_SOURCES = t-wkdlookup.cpp $(support_src)
-t_wkdlookup5_LDADD = $(ldadd_qt5)
-t_wkdlookup5_CPPFLAGS = $(cppflags_qt5)
-# t_wkspublish5_SOURCES = t-wkspublish.cpp $(support_src)
-# t_wkspublish5_LDADD = $(ldadd_qt5)
-# t_wkspublish5_CPPFLAGS = $(cppflags_qt5)
-run_decryptverifyarchivejob5_SOURCES = run-decryptverifyarchivejob.cpp
-run_decryptverifyarchivejob5_LDADD = $(ldadd_qt5)
-run_decryptverifyarchivejob5_CPPFLAGS = $(cppflags_qt5)
-run_decryptverifyjob5_SOURCES = run-decryptverifyjob.cpp
-run_decryptverifyjob5_LDADD = $(ldadd_qt5)
-run_decryptverifyjob5_CPPFLAGS = $(cppflags_qt5)
-run_encryptarchivejob5_SOURCES = run-encryptarchivejob.cpp
-run_encryptarchivejob5_LDADD = $(ldadd_qt5)
-run_encryptarchivejob5_CPPFLAGS = $(cppflags_qt5)
-run_encryptjob5_SOURCES = run-encryptjob.cpp
-run_encryptjob5_LDADD = $(ldadd_qt5)
-run_encryptjob5_CPPFLAGS = $(cppflags_qt5)
-run_exportjob5_SOURCES = run-exportjob.cpp
-run_exportjob5_LDADD = $(ldadd_qt5)
-run_exportjob5_CPPFLAGS = $(cppflags_qt5)
-run_importjob5_SOURCES = run-importjob.cpp
-run_importjob5_LDADD = $(ldadd_qt5)
-run_importjob5_CPPFLAGS = $(cppflags_qt5)
-run_keyformailboxjob5_SOURCES = run-keyformailboxjob.cpp
-run_keyformailboxjob5_LDADD = $(ldadd_qt5)
-run_keyformailboxjob5_CPPFLAGS = $(cppflags_qt5)
-run_receivekeysjob5_SOURCES = run-receivekeysjob.cpp
-run_receivekeysjob5_LDADD = $(ldadd_qt5)
-run_receivekeysjob5_CPPFLAGS = $(cppflags_qt5)
-run_refreshkeysjob5_SOURCES = run-refreshkeysjob.cpp
-run_refreshkeysjob5_LDADD = $(ldadd_qt5)
-run_refreshkeysjob5_CPPFLAGS = $(cppflags_qt5)
-run_signarchivejob5_SOURCES = run-signarchivejob.cpp
-run_signarchivejob5_LDADD = $(ldadd_qt5)
-run_signarchivejob5_CPPFLAGS = $(cppflags_qt5)
-run_signjob5_SOURCES = run-signjob.cpp
-run_signjob5_LDADD = $(ldadd_qt5)
-run_signjob5_CPPFLAGS = $(cppflags_qt5)
-run_verifydetachedjob5_SOURCES = run-verifydetachedjob.cpp
-run_verifydetachedjob5_LDADD = $(ldadd_qt5)
-run_verifydetachedjob5_CPPFLAGS = $(cppflags_qt5)
-run_verifyopaquejob5_SOURCES = run-verifyopaquejob.cpp
-run_verifyopaquejob5_LDADD = $(ldadd_qt5)
-run_verifyopaquejob5_CPPFLAGS = $(cppflags_qt5)
-run_wkdrefreshjob5_SOURCES = run-wkdrefreshjob.cpp
-run_wkdrefreshjob5_LDADD = $(ldadd_qt5)
-run_wkdrefreshjob5_CPPFLAGS = $(cppflags_qt5)
-
-#nodist_t_keylist5_SOURCES = $(moc5_files) $(moc5_forward_headers)
-endif
-if WANT_QT6
-t_addexistingsubkey6_SOURCES = t-addexistingsubkey.cpp $(support_src)
-t_addexistingsubkey6_LDADD = $(ldadd_qt6)
-t_addexistingsubkey6_CPPFLAGS = $(cppflags_qt6)
-t_changeexpiryjob6_SOURCES = t-changeexpiryjob.cpp $(support_src)
-t_changeexpiryjob6_LDADD = $(ldadd_qt6)
-t_changeexpiryjob6_CPPFLAGS = $(cppflags_qt6)
-t_config6_SOURCES = t-config.cpp $(support_src)
-t_config6_LDADD = $(ldadd_qt6)
-t_config6_CPPFLAGS = $(cppflags_qt6)
-t_decryptverify6_SOURCES = t-decryptverify.cpp $(support_src)
-t_decryptverify6_LDADD = $(ldadd_qt6)
-t_decryptverify6_CPPFLAGS = $(cppflags_qt6)
-t_disablekey6_SOURCES = t-disablekey.cpp $(support_src)
-t_disablekey6_LDADD = $(ldadd_qt6)
-t_disablekey6_CPPFLAGS = $(cppflags_qt6)
-t_encrypt6_SOURCES = t-encrypt.cpp $(support_src)
-t_encrypt6_LDADD = $(ldadd_qt6)
-t_encrypt6_CPPFLAGS = $(cppflags_qt6)
-t_import6_SOURCES = t-import.cpp $(support_src)
-t_import6_LDADD = $(ldadd_qt6)
-t_import6_CPPFLAGS = $(cppflags_qt6)
-t_keylist6_SOURCES = t-keylist.cpp $(support_src)
-t_keylist6_LDADD = $(ldadd_qt6)
-t_keylist6_CPPFLAGS = $(cppflags_qt6)
-t_keylocate6_SOURCES = t-keylocate.cpp $(support_src)
-t_keylocate6_LDADD = $(ldadd_qt6)
-t_keylocate6_CPPFLAGS = $(cppflags_qt6)
-t_ownertrust6_SOURCES = t-ownertrust.cpp $(support_src)
-t_ownertrust6_LDADD = $(ldadd_qt6)
-t_ownertrust6_CPPFLAGS = $(cppflags_qt6)
-t_remarks6_SOURCES = t-remarks.cpp $(support_src)
-t_remarks6_LDADD = $(ldadd_qt6)
-t_remarks6_CPPFLAGS = $(cppflags_qt6)
-t_revokekey6_SOURCES = t-revokekey.cpp $(support_src)
-t_revokekey6_LDADD = $(ldadd_qt6)
-t_revokekey6_CPPFLAGS = $(cppflags_qt6)
-t_setprimaryuserid6_SOURCES = t-setprimaryuserid.cpp $(support_src)
-t_setprimaryuserid6_LDADD = $(ldadd_qt6)
-t_setprimaryuserid6_CPPFLAGS = $(cppflags_qt6)
-t_tofuinfo6_SOURCES = t-tofuinfo.cpp $(support_src)
-t_tofuinfo6_LDADD = $(ldadd_qt6)
-t_tofuinfo6_CPPFLAGS = $(cppflags_qt6)
-t_trustsignatures6_SOURCES = t-trustsignatures.cpp $(support_src)
-t_trustsignatures6_LDADD = $(ldadd_qt6)
-t_trustsignatures6_CPPFLAGS = $(cppflags_qt6)
-t_various6_SOURCES = t-various.cpp $(support_src)
-t_various6_LDADD = $(ldadd_qt6)
-t_various6_CPPFLAGS = $(cppflags_qt6)
-t_verify6_SOURCES = t-verify.cpp $(support_src)
-t_verify6_LDADD = $(ldadd_qt6)
-t_verify6_CPPFLAGS = $(cppflags_qt6)
-t_wkdlookup6_SOURCES = t-wkdlookup.cpp $(support_src)
-t_wkdlookup6_LDADD = $(ldadd_qt6)
-t_wkdlookup6_CPPFLAGS = $(cppflags_qt6)
-# t_wkspublish6_SOURCES = t-wkspublish.cpp $(support_src)
-# t_wkspublish6_LDADD = $(ldadd_qt6)
-# t_wkspublish6_CPPFLAGS = $(cppflags_qt6)
-run_decryptverifyarchivejob6_SOURCES = run-decryptverifyarchivejob.cpp
-run_decryptverifyarchivejob6_LDADD = $(ldadd_qt6)
-run_decryptverifyarchivejob6_CPPFLAGS = $(cppflags_qt6)
-run_decryptverifyjob6_SOURCES = run-decryptverifyjob.cpp
-run_decryptverifyjob6_LDADD = $(ldadd_qt6)
-run_decryptverifyjob6_CPPFLAGS = $(cppflags_qt6)
-run_encryptarchivejob6_SOURCES = run-encryptarchivejob.cpp
-run_encryptarchivejob6_LDADD = $(ldadd_qt6)
-run_encryptarchivejob6_CPPFLAGS = $(cppflags_qt6)
-run_encryptjob6_SOURCES = run-encryptjob.cpp
-run_encryptjob6_LDADD = $(ldadd_qt6)
-run_encryptjob6_CPPFLAGS = $(cppflags_qt6)
-run_exportjob6_SOURCES = run-exportjob.cpp
-run_exportjob6_LDADD = $(ldadd_qt6)
-run_exportjob6_CPPFLAGS = $(cppflags_qt6)
-run_importjob6_SOURCES = run-importjob.cpp
-run_importjob6_LDADD = $(ldadd_qt6)
-run_importjob6_CPPFLAGS = $(cppflags_qt6)
-run_keyformailboxjob6_SOURCES = run-keyformailboxjob.cpp
-run_keyformailboxjob6_LDADD = $(ldadd_qt6)
-run_keyformailboxjob6_CPPFLAGS = $(cppflags_qt6)
-run_receivekeysjob6_SOURCES = run-receivekeysjob.cpp
-run_receivekeysjob6_LDADD = $(ldadd_qt6)
-run_receivekeysjob6_CPPFLAGS = $(cppflags_qt6)
-run_refreshkeysjob6_SOURCES = run-refreshkeysjob.cpp
-run_refreshkeysjob6_LDADD = $(ldadd_qt6)
-run_refreshkeysjob6_CPPFLAGS = $(cppflags_qt6)
-run_signarchivejob6_SOURCES = run-signarchivejob.cpp
-run_signarchivejob6_LDADD = $(ldadd_qt6)
-run_signarchivejob6_CPPFLAGS = $(cppflags_qt6)
-run_signjob6_SOURCES = run-signjob.cpp
-run_signjob6_LDADD = $(ldadd_qt6)
-run_signjob6_CPPFLAGS = $(cppflags_qt6)
-run_verifydetachedjob6_SOURCES = run-verifydetachedjob.cpp
-run_verifydetachedjob6_LDADD = $(ldadd_qt6)
-run_verifydetachedjob6_CPPFLAGS = $(cppflags_qt6)
-run_verifyopaquejob6_SOURCES = run-verifyopaquejob.cpp
-run_verifyopaquejob6_LDADD = $(ldadd_qt6)
-run_verifyopaquejob6_CPPFLAGS = $(cppflags_qt6)
-run_wkdrefreshjob6_SOURCES = run-wkdrefreshjob.cpp
-run_wkdrefreshjob6_LDADD = $(ldadd_qt6)
-run_wkdrefreshjob6_CPPFLAGS = $(cppflags_qt6)
-
-# nodist_t_keylist6_SOURCES = $(moc6_files) $(moc6_forward_headers)
-endif
-
-BUILT_SOURCES = $(moc5_files) $(moc5_forward_headers) \
- $(moc6_files) $(moc6_forward_headers) \
- pubring-stamp
-
-noinst_PROGRAMS = $(the_tests5) $(the_runners5) $(the_tests6) $(the_runners6)
-
-CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \
- gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \
- random_seed S.gpg-agent .gpg-v21-migrated pubring-stamp \
- $(moc5_files) $(moc5_forward_headers) \
- $(moc6_files) $(moc6_forward_headers) \
- gpg.conf tofu.db reader_0.status reader_1.status
-
-clean-local:
- -test -z "$(moc5_dir)" || rm -rf $(moc5_dir)
- -test -z "$(moc6_dir)" || rm -rf $(moc6_dir)
- -$(TESTS_ENVIRONMENT) $(top_srcdir)/tests/start-stop-agent --stop
- -rm -fR private-keys-v1.d crls.d
-
-clean-keyring:
- -$(TESTS_ENVIRONMENT) $(top_srcdir)/tests/start-stop-agent --stop
- -rm -fR private-keys-v1.d crls.d pubring.gpg pubring.kbx secring.gpg \
- trustdb.gpg pubring-stamp
-
-pubring-stamp: $(top_srcdir)/tests/gpg/pubdemo.asc \
- $(top_srcdir)/tests/gpg/secdemo.asc
- -$(TESTS_ENVIRONMENT) gpgconf --kill all
- echo "ignore-invalid-option allow-loopback-pinentry" > $(abs_builddir)/gpg-agent.conf
- echo "allow-loopback-pinentry" >> gpg-agent.conf
- echo "ignore-invalid-option pinentry-mode" > gpg.conf
- echo "pinentry-mode loopback" >> gpg.conf
- $(TESTS_ENVIRONMENT) $(GPG) --no-permission-warning \
- --import $(top_srcdir)/tests/gpg/pubdemo.asc
- $(TESTS_ENVIRONMENT) $(GPG) --no-permission-warning \
- --passphrase "abc" \
- --import $(top_srcdir)/tests/gpg/secdemo.asc
- -$(TESTS_ENVIRONMENT) gpgconf --kill all
- touch pubring-stamp
diff --git a/lang/qt/tests/final.test b/lang/qt/tests/final.test
deleted file mode 100755
index f28aaa4c..00000000
--- a/lang/qt/tests/final.test
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-# stop the dirmngr that may have been started
-gpgconf --kill dirmngr
-
-exit 0
diff --git a/lang/qt/tests/initial.test b/lang/qt/tests/initial.test
deleted file mode 100755
index 039e4d00..00000000
--- a/lang/qt/tests/initial.test
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-exit 0
diff --git a/lang/qt/tests/run-decryptverifyarchivejob.cpp b/lang/qt/tests/run-decryptverifyarchivejob.cpp
deleted file mode 100644
index 6d5615c0..00000000
--- a/lang/qt/tests/run-decryptverifyarchivejob.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- run-decryptverifyarchivejob.cpp
-
- This file is part of QGpgME's test suite.
- Copyright (c) 2023 by g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License,
- version 2, as published by the Free Software Foundation.
-
- 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 <debug.h>
-#include <decryptverifyarchivejob.h>
-#include <protocol.h>
-
-#include <QCommandLineParser>
-#include <QCoreApplication>
-#include <QDebug>
-
-#include <gpgme++/context.h>
-#include <gpgme++/decryptionresult.h>
-#include <gpgme++/verificationresult.h>
-
-#include <iostream>
-
-using namespace GpgME;
-
-std::ostream &operator<<(std::ostream &os, const QString &s)
-{
- return os << s.toLocal8Bit().constData();
-}
-
-struct CommandLineOptions {
- bool processAllSignatures = false;
- QString outputDirectory;
- QString archiveName;
-};
-
-CommandLineOptions parseCommandLine(const QStringList &arguments)
-{
- CommandLineOptions options;
-
- QCommandLineParser parser;
- parser.setApplicationDescription("Test program for DecryptVerifyArchiveJob");
- parser.addHelpOption();
- parser.addOptions({
- {{"C", "directory"}, "Extract the files into the directory DIRECTORY.", "DIRECTORY"},
- {"process-all-signatures", "Don't stop signature checking after bad signature."},
- });
- parser.addPositionalArgument("archive", "The archive to decrypt and extract");
-
- parser.process(arguments);
-
- const auto args = parser.positionalArguments();
- if (args.size() != 1) {
- parser.showHelp(1);
- }
-
- options.processAllSignatures = parser.isSet("process-all-signatures");
- options.outputDirectory = parser.value("directory");
- options.archiveName = args.first();
-
- return options;
-}
-
-int main(int argc, char **argv)
-{
- GpgME::initializeLibrary();
-
- QCoreApplication app{argc, argv};
- app.setApplicationName("run-decryptverifyarchivejob");
-
- const auto options = parseCommandLine(app.arguments());
-
- if (!QGpgME::DecryptVerifyArchiveJob::isSupported()) {
- std::cerr << "Error: Decrypting and extracting archives is not supported by your version of gpg." << std::endl;
- return 1;
- }
-
- auto job = QGpgME::openpgp()->decryptVerifyArchiveJob();
- if (!job) {
- std::cerr << "Error: Could not create job" << std::endl;
- return 1;
- }
- job->setProcessAllSignatures(options.processAllSignatures);
- job->setInputFile(options.archiveName);
- job->setOutputDirectory(options.outputDirectory);
- QObject::connect(job, &QGpgME::DecryptVerifyArchiveJob::result, &app, [](const GpgME::DecryptionResult &decryptionResult, const GpgME::VerificationResult &verificationResult, const QString &auditLog, const GpgME::Error &) {
- std::cerr << "Diagnostics: " << auditLog << std::endl;
- std::cerr << "Decryption Result: " << decryptionResult << std::endl;
- std::cerr << "Verification Result: " << verificationResult << std::endl;
- qApp->quit();
- });
-
- const auto err = job->startIt();
- if (err) {
- std::cerr << "Error: Starting the job failed: " << err << std::endl;
- return 1;
- }
-
- return app.exec();
-}
diff --git a/lang/qt/tests/run-decryptverifyjob.cpp b/lang/qt/tests/run-decryptverifyjob.cpp
deleted file mode 100644
index 805bad68..00000000
--- a/lang/qt/tests/run-decryptverifyjob.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- run-decryptverifyjob.cpp
-
- This file is part of QGpgME's test suite.
- Copyright (c) 2023 by g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License,
- version 2, as published by the Free Software Foundation.
-
- 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 <debug.h>
-#include <protocol.h>
-#include <decryptverifyjob.h>
-
-#include <QCommandLineParser>
-#include <QCoreApplication>
-#include <QDebug>
-#include <QFile>
-#include <QTimer>
-
-#include <gpgme++/context.h>
-#include <gpgme++/decryptionresult.h>
-#include <gpgme++/verificationresult.h>
-
-#include <iostream>
-
-using namespace GpgME;
-
-std::ostream &operator<<(std::ostream &os, const QString &s)
-{
- return os << s.toLocal8Bit().constData();
-}
-
-struct CommandLineOptions {
- bool processAllSignatures = false;
- QString inputFile;
- QString outputFile;
- std::chrono::seconds cancelTimeout{0};
-};
-
-CommandLineOptions parseCommandLine(const QStringList &arguments)
-{
- CommandLineOptions options;
-
- QCommandLineParser parser;
- parser.setApplicationDescription("Test program for DecryptVerifyJob");
- parser.addHelpOption();
- parser.addOptions({
- {{"o", "output"}, "Write output to FILE.", "FILE"},
- {"cancel-after", "Cancel the running job after SECONDS seconds.", "SECONDS"},
- {"process-all-signatures", "Don't stop signature checking after bad signature."},
- });
- parser.addPositionalArgument("file", "File to decrypt", "FILE");
-
- parser.process(arguments);
-
- const auto args = parser.positionalArguments();
- if (args.size() != 1) {
- parser.showHelp(1);
- }
-
- options.processAllSignatures = parser.isSet("process-all-signatures");
- options.inputFile = args.front();
- options.outputFile = parser.value("output");
- if (parser.isSet("cancel-after")) {
- bool ok;
- options.cancelTimeout = std::chrono::seconds{parser.value("cancel-after").toInt(&ok)};
- if (!ok) {
- options.cancelTimeout = std::chrono::seconds{-1};
- }
- }
-
- return options;
-}
-
-int main(int argc, char **argv)
-{
- GpgME::initializeLibrary();
-
- QCoreApplication app{argc, argv};
- app.setApplicationName("run-decryptverifyjob");
-
- const auto options = parseCommandLine(app.arguments());
- if (options.cancelTimeout.count() < 0) {
- std::cerr << "Ignoring invalid timeout for cancel." << std::endl;
- }
-
- std::shared_ptr<QFile> output;
- if (options.outputFile.isEmpty() || options.outputFile == QLatin1String{"-"}) {
- output.reset(new QFile);
- output->open(stdout, QIODevice::WriteOnly);
- } else {
- if (QFile::exists(options.outputFile)) {
- qCritical() << "File" << options.outputFile << "exists. Bailing out.";
- return 1;
- }
- }
-
- auto job = QGpgME::openpgp()->decryptVerifyJob();
- if (!job) {
- std::cerr << "Error: Could not create job" << std::endl;
- return 1;
- }
- QObject::connect(job,
- &QGpgME::DecryptVerifyJob::result,
- &app,
- [](const GpgME::DecryptionResult &decryptionResult,
- const GpgME::VerificationResult &verificationResult,
- const QByteArray &,
- const QString &auditLog,
- const GpgME::Error &) {
- std::cerr << "Diagnostics: " << auditLog << std::endl;
- std::cerr << "Decryption Result: " << decryptionResult << std::endl;
- std::cerr << "Verification Result: " << verificationResult << std::endl;
- qApp->quit();
- });
- if (options.cancelTimeout.count() > 0) {
- QTimer::singleShot(options.cancelTimeout, job, [job]() {
- std::cerr << "Canceling job" << std::endl;
- job->slotCancel();
- });
- }
-
- std::shared_ptr<QFile> input;
- GpgME::Error err;
- job->setProcessAllSignatures(options.processAllSignatures);
- if (output) {
- input.reset(new QFile{options.inputFile});
- input->open(QIODevice::ReadOnly);
- job->start(input, output);
- } else {
- job->setInputFile(options.inputFile);
- job->setOutputFile(options.outputFile);
- err = job->startIt();
- }
- if (err) {
- std::cerr << "Error: Starting the job failed: " << err << std::endl;
- return 1;
- }
-
- return app.exec();
-}
diff --git a/lang/qt/tests/run-encryptarchivejob.cpp b/lang/qt/tests/run-encryptarchivejob.cpp
deleted file mode 100644
index 87781fd9..00000000
--- a/lang/qt/tests/run-encryptarchivejob.cpp
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- run-encryptarchivejob.cpp
-
- This file is part of QGpgME's test suite.
- Copyright (c) 2023 by g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License,
- version 2, as published by the Free Software Foundation.
-
- 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 <debug.h>
-#include <protocol.h>
-#include <encryptarchivejob.h>
-#include <signencryptarchivejob.h>
-
-#include <QCommandLineParser>
-#include <QCoreApplication>
-#include <QDebug>
-#include <QDir>
-#include <QFile>
-#include <QFileInfo>
-#include <QTimer>
-
-#include <gpgme++/context.h>
-#include <gpgme++/encryptionresult.h>
-#include <gpgme++/signingresult.h>
-
-#include <iostream>
-
-using namespace GpgME;
-
-std::ostream &operator<<(std::ostream &os, const QString &s)
-{
- return os << s.toLocal8Bit().constData();
-}
-
-struct CommandLineOptions {
- bool armor = false;
- bool sign = false;
- QString archiveName;
- QString baseDirectory;
- std::chrono::seconds cancelTimeout{0};
- std::vector<QString> filesAndDirectories;
-};
-
-CommandLineOptions parseCommandLine(const QStringList &arguments)
-{
- CommandLineOptions options;
-
- QCommandLineParser parser;
- parser.setApplicationDescription("Test program for EncryptArchiveJob and SignEncryptArchiveJob");
- parser.addHelpOption();
- parser.addOptions({
- {{"s", "sign"}, "Sign archive before encryption."},
- {{"o", "output"}, "Write output to FILE.", "FILE"},
- {{"a", "armor"}, "Create ASCII armored output."},
- {{"C", "directory"}, "Change to DIRECTORY before creating the archive.", "DIRECTORY"},
- {"cancel-after", "Cancel the running job after SECONDS seconds.", "SECONDS"},
- });
- parser.addPositionalArgument("files", "Files and directories to add to the archive", "[files] [directories]");
-
- parser.process(arguments);
-
- const auto args = parser.positionalArguments();
- if (args.empty()) {
- parser.showHelp(1);
- }
-
- options.armor = parser.isSet("armor");
- options.sign = parser.isSet("sign");
- options.archiveName = parser.value("output");
- options.baseDirectory = parser.value("directory");
- if (parser.isSet("cancel-after")) {
- bool ok;
- options.cancelTimeout = std::chrono::seconds{parser.value("cancel-after").toInt(&ok)};
- if (!ok) {
- options.cancelTimeout = std::chrono::seconds{-1};
- }
- }
- std::copy(args.begin(), args.end(), std::back_inserter(options.filesAndDirectories));
-
- return options;
-}
-
-QString checkOutputFilePath(const QString &fileName, const QString &baseDirectory)
-{
- const QFileInfo fi{QDir{baseDirectory}, fileName};
- if (fi.exists()) {
- qCritical() << "File" << fi.filePath() << "exists. Bailing out.";
- return {};
- }
- return fileName;
-}
-
-int main(int argc, char **argv)
-{
- GpgME::initializeLibrary();
-
- QCoreApplication app{argc, argv};
- app.setApplicationName("run-encryptarchivejob");
-
- const auto options = parseCommandLine(app.arguments());
- if (options.cancelTimeout.count() < 0) {
- std::cerr << "Ignoring invalid timeout for cancel." << std::endl;
- }
-
- if ((options.sign && !QGpgME::SignEncryptArchiveJob::isSupported())
- || (!options.sign && !QGpgME::EncryptArchiveJob::isSupported())) {
- std::cerr << "Error: Encrypting archives is not supported by your version of gpg." << std::endl;
- return 1;
- }
-
- std::shared_ptr<QFile> output;
- QString outputFilePath;
- if (options.archiveName.isEmpty() || options.archiveName == QLatin1String{"-"}) {
- output.reset(new QFile);
- output->open(stdout, QIODevice::WriteOnly);
- } else {
- outputFilePath = checkOutputFilePath(options.archiveName, options.baseDirectory);
- if (outputFilePath.isEmpty()) {
- return 1;
- }
- }
-
- if (options.sign) {
- auto job = QGpgME::openpgp()->signEncryptArchiveJob(options.armor);
- if (!job) {
- std::cerr << "Error: Could not create job" << std::endl;
- return 1;
- }
- job->setBaseDirectory(options.baseDirectory);
- QObject::connect(job, &QGpgME::SignEncryptArchiveJob::result, &app, [](const GpgME::SigningResult &signingResult, const GpgME::EncryptionResult &encryptionResult, const QString &auditLog, const GpgME::Error &) {
- std::cerr << "Diagnostics: " << auditLog << std::endl;
- std::cerr << "Signing Result: " << signingResult << std::endl;
- std::cerr << "Encryption Result: " << encryptionResult << std::endl;
- qApp->quit();
- });
- if (options.cancelTimeout.count() > 0) {
- QTimer::singleShot(options.cancelTimeout, job, [job]() {
- std::cerr << "Canceling job" << std::endl;
- job->slotCancel();
- });
- }
-
- GpgME::Error err;
- if (output) {
- err = job->start({}, {}, options.filesAndDirectories, output, GpgME::Context::None);
- } else {
- job->setInputPaths(options.filesAndDirectories);
- job->setOutputFile(outputFilePath);
- err = job->startIt();
- }
- if (err) {
- std::cerr << "Error: Starting the job failed: " << err << std::endl;
- return 1;
- }
- } else {
- auto job = QGpgME::openpgp()->encryptArchiveJob(options.armor);
- if (!job) {
- std::cerr << "Error: Could not create job" << std::endl;
- return 1;
- }
- job->setBaseDirectory(options.baseDirectory);
- QObject::connect(job, &QGpgME::EncryptArchiveJob::result, &app, [](const GpgME::EncryptionResult &result, const QString &auditLog, const GpgME::Error &) {
- std::cerr << "Diagnostics: " << auditLog << std::endl;
- std::cerr << "Result: " << result << std::endl;
- qApp->quit();
- });
- if (options.cancelTimeout.count() > 0) {
- QTimer::singleShot(options.cancelTimeout, job, [job]() {
- std::cerr << "Canceling job" << std::endl;
- job->slotCancel();
- });
- }
-
- GpgME::Error err;
- if (output) {
- err = job->start({}, options.filesAndDirectories, output, GpgME::Context::None);
- } else {
- job->setInputPaths(options.filesAndDirectories);
- job->setOutputFile(outputFilePath);
- err = job->startIt();
- }
- if (err) {
- std::cerr << "Error: Starting the job failed: " << err << std::endl;
- return 1;
- }
- }
-
- return app.exec();
-}
diff --git a/lang/qt/tests/run-encryptjob.cpp b/lang/qt/tests/run-encryptjob.cpp
deleted file mode 100644
index 14c8ea44..00000000
--- a/lang/qt/tests/run-encryptjob.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- run-encryptjob.cpp
-
- This file is part of QGpgME's test suite.
- Copyright (c) 2023 by g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License,
- version 2, as published by the Free Software Foundation.
-
- 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 <debug.h>
-#include <protocol.h>
-#include <encryptjob.h>
-#include <signencryptjob.h>
-
-#include <QCommandLineParser>
-#include <QCoreApplication>
-#include <QDebug>
-#include <QFile>
-#include <QTimer>
-
-#include <gpgme++/context.h>
-#include <gpgme++/encryptionresult.h>
-#include <gpgme++/signingresult.h>
-
-#include <iostream>
-
-using namespace GpgME;
-
-std::ostream &operator<<(std::ostream &os, const QString &s)
-{
- return os << s.toLocal8Bit().constData();
-}
-
-struct CommandLineOptions {
- bool armor = false;
- bool sign = false;
- QString inputFile;
- QString outputFile;
- std::chrono::seconds cancelTimeout{0};
-};
-
-CommandLineOptions parseCommandLine(const QStringList &arguments)
-{
- CommandLineOptions options;
-
- QCommandLineParser parser;
- parser.setApplicationDescription("Test program for EncryptJob and SignEncryptJob");
- parser.addHelpOption();
- parser.addOptions({
- {{"s", "sign"}, "Sign file before encryption."},
- {{"o", "output"}, "Write output to FILE.", "FILE"},
- {{"a", "armor"}, "Create ASCII armored output."},
- {"cancel-after", "Cancel the running job after SECONDS seconds.", "SECONDS"},
- });
- parser.addPositionalArgument("file", "File to encrypt", "FILE");
-
- parser.process(arguments);
-
- const auto args = parser.positionalArguments();
- if (args.size() != 1) {
- parser.showHelp(1);
- }
-
- options.armor = parser.isSet("armor");
- options.sign = parser.isSet("sign");
- options.inputFile = args.front();
- options.outputFile = parser.value("output");
- if (parser.isSet("cancel-after")) {
- bool ok;
- options.cancelTimeout = std::chrono::seconds{parser.value("cancel-after").toInt(&ok)};
- if (!ok) {
- options.cancelTimeout = std::chrono::seconds{-1};
- }
- }
-
- return options;
-}
-
-int main(int argc, char **argv)
-{
- GpgME::initializeLibrary();
-
- QCoreApplication app{argc, argv};
- app.setApplicationName("run-encryptjob");
-
- const auto options = parseCommandLine(app.arguments());
- if (options.cancelTimeout.count() < 0) {
- std::cerr << "Ignoring invalid timeout for cancel." << std::endl;
- }
-
- std::shared_ptr<QFile> output;
- if (options.outputFile.isEmpty() || options.outputFile == QLatin1String{"-"}) {
- output.reset(new QFile);
- output->open(stdout, QIODevice::WriteOnly);
- } else {
- if (QFile::exists(options.outputFile)) {
- qCritical() << "File" << options.outputFile << "exists. Bailing out.";
- return 1;
- }
- }
-
- std::shared_ptr<QFile> input;
-
- if (options.sign) {
- auto job = QGpgME::openpgp()->signEncryptJob(options.armor);
- if (!job) {
- std::cerr << "Error: Could not create job" << std::endl;
- return 1;
- }
- QObject::connect(job, &QGpgME::SignEncryptJob::result, &app, [](const GpgME::SigningResult &signingResult, const GpgME::EncryptionResult &encryptionResult, const QByteArray &, const QString &auditLog, const GpgME::Error &) {
- std::cerr << "Diagnostics: " << auditLog << std::endl;
- std::cerr << "Signing Result: " << signingResult << std::endl;
- std::cerr << "Encryption Result: " << encryptionResult << std::endl;
- qApp->quit();
- });
- if (options.cancelTimeout.count() > 0) {
- QTimer::singleShot(options.cancelTimeout, job, [job]() {
- std::cerr << "Canceling job" << std::endl;
- job->slotCancel();
- });
- }
-
- GpgME::Error err;
- if (output) {
- input.reset(new QFile{options.inputFile});
- input->open(QIODevice::ReadOnly);
- job->start({}, {}, input, output, GpgME::Context::None);
- } else {
- job->setInputFile(options.inputFile);
- job->setOutputFile(options.outputFile);
- err = job->startIt();
- }
- if (err) {
- std::cerr << "Error: Starting the job failed: " << err << std::endl;
- return 1;
- }
- } else {
- auto job = QGpgME::openpgp()->encryptJob(options.armor);
- if (!job) {
- std::cerr << "Error: Could not create job" << std::endl;
- return 1;
- }
- QObject::connect(job, &QGpgME::EncryptJob::result, &app, [](const GpgME::EncryptionResult &result, const QByteArray &, const QString &auditLog, const GpgME::Error &) {
- std::cerr << "Diagnostics: " << auditLog << std::endl;
- std::cerr << "Result: " << result << std::endl;
- qApp->quit();
- });
- if (options.cancelTimeout.count() > 0) {
- QTimer::singleShot(options.cancelTimeout, job, [job]() {
- std::cerr << "Canceling job" << std::endl;
- job->slotCancel();
- });
- }
-
- GpgME::Error err;
- if (output) {
- input.reset(new QFile{options.inputFile});
- input->open(QIODevice::ReadOnly);
- job->start({}, input, output, GpgME::Context::None);
- } else {
- job->setInputFile(options.inputFile);
- job->setOutputFile(options.outputFile);
- err = job->startIt();
- }
- if (err) {
- std::cerr << "Error: Starting the job failed: " << err << std::endl;
- return 1;
- }
- }
-
- return app.exec();
-}
diff --git a/lang/qt/tests/run-exportjob.cpp b/lang/qt/tests/run-exportjob.cpp
deleted file mode 100644
index ed6f8912..00000000
--- a/lang/qt/tests/run-exportjob.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- run-exportjob.cpp
-
- This file is part of QGpgME's test suite.
- Copyright (c) 2022 by g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License,
- version 2, as published by the Free Software Foundation.
-
- 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 <debug.h>
-#include <exportjob.h>
-#include <protocol.h>
-
-#include <gpgme++/context.h>
-
-#include <QCoreApplication>
-
-#include <iostream>
-
-using namespace GpgME;
-using std::cout;
-using std::cerr;
-
-static void showUsageAndExitWithCode(int exitCode)
-{
- cerr << "Usage: run-exportjob [OPTION]... [PATTERN]...\n"
- "Options:\n"
- " --secret export secret keys instead of public keys\n"
- " --secret-subkey export secret subkeys instead of public keys\n";
-
- exit(exitCode);
-}
-
-static QGpgME::ExportJob *createExportJob(unsigned int mode)
-{
- if (mode & Context::ExportSecretSubkey) {
- return QGpgME::openpgp()->secretSubkeyExportJob(/*armor=*/true);
- } else if (mode & Context::ExportSecret) {
- return QGpgME::openpgp()->secretKeyExportJob(/*armor=*/true);
- }
- return QGpgME::openpgp()->publicKeyExportJob(/*armor=*/true);
-}
-
-int main(int argc, char *argv[])
-{
- GpgME::initializeLibrary();
-
- QCoreApplication app{argc, argv};
-
- unsigned int exportMode = 0;
-
- auto arguments = app.arguments();
- if (!arguments.isEmpty()) {
- arguments.pop_front(); // remove program name
- }
- while (!arguments.isEmpty()) {
- const auto &arg = arguments.front();
- if (!arg.startsWith(QLatin1String{"--"})) {
- break;
- }
- if (arg == QLatin1String{"--"}) {
- arguments.pop_front();
- break;
- }
- if (arg == QLatin1String{"--help"}) {
- showUsageAndExitWithCode(0);
- } else if (arg == QLatin1String{"--secret"}) {
- exportMode = Context::ExportSecret;
- arguments.pop_front();
- } else if (arg == QLatin1String{"--secret-subkey"}) {
- exportMode = Context::ExportSecretSubkey;
- arguments.pop_front();
- } else {
- cerr << "Error: Invalid option " << arg.toStdString() << std::endl;
- showUsageAndExitWithCode(1);
- }
- }
-
- auto job = createExportJob(exportMode);
- QObject::connect(job, &QGpgME::ExportJob::result,
- &app, [&app] (const GpgME::Error &err, const QByteArray &keyData, const QString &, const GpgME::Error &) {
- if (err) {
- cerr << "The ChangeExpiryJob failed with" << err << ".";
- app.exit(1);
- return;
- }
- cout << "Begin Result:\n" << keyData.toStdString() << "End Result:\n";
- app.exit();
- });
- job->start(arguments);
-
- return app.exec();
-}
diff --git a/lang/qt/tests/run-importjob.cpp b/lang/qt/tests/run-importjob.cpp
deleted file mode 100644
index 67ee73f3..00000000
--- a/lang/qt/tests/run-importjob.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- run-importjob.cpp
-
- This file is part of QGpgME's test suite.
- Copyright (c) 2021 by g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License,
- version 2, as published by the Free Software Foundation.
-
- 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 <debug.h>
-#include <importjob.h>
-#include <gpgme++/importresult.h>
-#include <protocol.h>
-
-#include <QFile>
-#include <QFileInfo>
-
-#include <QDebug>
-
-#include <set>
-
-GpgME::Protocol guessProtocol(const QString &filename)
-{
- static const std::set<QString> cmsExtensions = {"cer", "crt", "der", "p12", "p7c", "pem", "pfx"};
- static const std::set<QString> pgpExtensions = {"asc", "gpg", "pgp"};
-
- const auto extension = QFileInfo{filename}.suffix();
- if (cmsExtensions.find(extension) != cmsExtensions.end()) {
- return GpgME::CMS;
- } else if (pgpExtensions.find(extension) != pgpExtensions.end()) {
- return GpgME::OpenPGP;
- }
- qDebug() << "Unknown file name extension" << extension;
- return GpgME::UnknownProtocol;
-}
-
-int main(int argc, char **argv)
-{
- GpgME::initializeLibrary();
-
- if (argc != 2) {
- qInfo().noquote() << "Usage:" << argv[0] << "<certificate file>";
- return 1;
- }
- const auto filename = QString::fromLocal8Bit(argv[1]);
-
- QFile f{filename};
- if (!f.exists()) {
- qWarning() << "Error: File not found" << filename;
- return 1;
- }
- const auto protocol = guessProtocol(filename);
- if (protocol == GpgME::UnknownProtocol) {
- qWarning() << "Error: Unknown file type";
- return 1;
- }
- if (!f.open(QIODevice::ReadOnly)) {
- qWarning() << "Error: Failed to open file" << filename << "for reading.";
- return 1;
- }
-
- const auto keyData = f.readAll();
- auto job = (protocol == GpgME::CMS ? QGpgME::smime() : QGpgME::openpgp())->importJob();
- const auto result = job->exec(keyData);
- qDebug() << "Result error:" << result.error();
- for (const auto &line : QString::fromStdString(QGpgME::toLogString(result)).split('\n')) {
- qDebug().noquote() << line;
- }
- return 0;
-}
diff --git a/lang/qt/tests/run-keyformailboxjob.cpp b/lang/qt/tests/run-keyformailboxjob.cpp
deleted file mode 100644
index 8ec0c5b3..00000000
--- a/lang/qt/tests/run-keyformailboxjob.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- run-keyformailbox.cpp
-
- This file is part of QGpgME's test suite.
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License,
- version 2, as published by the Free Software Foundation.
-
- 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 "keyformailboxjob.h"
-#include "keylistjob.h"
-#include "protocol.h"
-
-#include <gpgme++/key.h>
-#include <gpgme++/keylistresult.h>
-
-#include <QDebug>
-
-
-int main(int argc, char **argv)
-{
- QString mailbox;
- if (argc == 2) {
- mailbox = QString::fromLocal8Bit(argv[1]);
- }
-
- auto job = QGpgME::openpgp()->keyForMailboxJob();
- GpgME::Key k;
- GpgME::UserID uid;
- job->exec(mailbox, true, k, uid);
- qDebug() << "UID Name: " << uid.name() << " Mail: " << uid.email() << " id: " << uid.id();
- qDebug() << "Key fpr: " << k.primaryFingerprint();
- return 0;
-}
diff --git a/lang/qt/tests/run-receivekeysjob.cpp b/lang/qt/tests/run-receivekeysjob.cpp
deleted file mode 100644
index 44553218..00000000
--- a/lang/qt/tests/run-receivekeysjob.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- run-receivekeysjob.cpp
-
- This file is part of QGpgME's test suite.
- Copyright (c) 2022 by g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License,
- version 2, as published by the Free Software Foundation.
-
- 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 <debug.h>
-#include <gpgme++/importresult.h>
-#include <protocol.h>
-#include <receivekeysjob.h>
-
-#include <QCoreApplication>
-#include <QDebug>
-
-#include <iostream>
-
-int main(int argc, char **argv)
-{
- GpgME::initializeLibrary();
-
- if (argc < 2) {
- std::cerr << "Usage: " << argv[0] << " KEYID..." << std::endl;
- return 1;
- }
-
- QCoreApplication app(argc, argv);
- const QStringList keyIds = qApp->arguments().mid(1);
-
- auto job = QGpgME::openpgp()->receiveKeysJob();
- const auto result = job->exec(keyIds);
-
- std::cout << "Result: " << result.error() << std::endl;
- std::cout << "Details:\n" << result << std::endl;
-
- return 0;
-}
diff --git a/lang/qt/tests/run-refreshkeysjob.cpp b/lang/qt/tests/run-refreshkeysjob.cpp
deleted file mode 100644
index ad653a54..00000000
--- a/lang/qt/tests/run-refreshkeysjob.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- run-refreshkeysjob.cpp
-
- This file is part of QGpgME's test suite.
- Copyright (c) 2022 by g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License,
- version 2, as published by the Free Software Foundation.
-
- 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 <debug.h>
-#include <protocol.h>
-#include <refreshkeysjob.h>
-#include <receivekeysjob.h>
-
-#include <QCoreApplication>
-#include <QDebug>
-
-#include <gpgme++/context.h>
-#include <gpgme++/importresult.h>
-
-#include <iostream>
-
-using namespace GpgME;
-
-std::ostream &operator<<(std::ostream &os, const QString &s)
-{
- return os << s.toLocal8Bit().constData();
-}
-
-const char *displayName(Protocol protocol)
-{
- switch (protocol) {
- case GpgME::OpenPGP:
- return "OpenPGP";
- case GpgME::CMS:
- return "S/MIME";
- default:
- return "Unknown protocol";
- }
-}
-
-struct KeyAndError {
- Key key;
- Error error;
-};
-
-KeyAndError getKey(const QString &keyId, Protocol protocol)
-{
- KeyAndError result;
-
- auto ctx = Context::create(protocol);
- if (!ctx) {
- result.error = Error::fromCode(GPG_ERR_GENERAL);
- return result;
- }
-
- result.key = ctx->key(keyId.toLatin1().constData(), result.error);
- if (result.error.code() == GPG_ERR_EOF) {
- result.error = Error{};
- }
- return result;
-}
-
-int main(int argc, char **argv)
-{
- GpgME::initializeLibrary();
-
- if (argc != 2) {
- std::cerr << "Usage: " << argv[0] << " KEYID" << std::endl;
- return 1;
- }
-
- QCoreApplication app{argc, argv};
- const auto keyId = qApp->arguments().last();
-
- auto openPGPKey = getKey(keyId, GpgME::OpenPGP);
- auto smimeKey = getKey(keyId, GpgME::CMS);
- if ((!openPGPKey.key.isNull() && !smimeKey.key.isNull())
- || (openPGPKey.error.code() == GPG_ERR_AMBIGUOUS_NAME)
- || (smimeKey.error.code() == GPG_ERR_AMBIGUOUS_NAME)) {
- std::cerr << "Error: Multiple keys matching '" << keyId << "' found" << std::endl;
- return 1;
- } else if (openPGPKey.key.isNull() && smimeKey.key.isNull()) {
- std::cerr << "Error: No key matching '" << keyId << "' found" << std::endl;
- return 1;
- }
- if (openPGPKey.error) {
- std::cerr << "Warning: Error while getting OpenPGP key: " << openPGPKey.error << std::endl;
- }
- if (smimeKey.error) {
- std::cerr << "Warning: Error while getting S/MIME key: " << openPGPKey.error << std::endl;
- }
- auto key = openPGPKey.key.isNull() ? smimeKey.key : openPGPKey.key;
- std::cout << "Refreshing " << displayName(key.protocol()) << " key " << key.userID(0).id() << std::endl;
-
- if (key.protocol() == GpgME::OpenPGP) {
- auto job = QGpgME::openpgp()->receiveKeysJob();
- if (!job) {
- std::cerr << "Error: Could not create job to refresh OpenPGP key" << std::endl;
- return 1;
- }
- QObject::connect(job, &QGpgME::ReceiveKeysJob::result, &app, [](const GpgME::ImportResult &result, const QString &, const GpgME::Error &) {
- std::cout << "Result: " << result << std::endl;
- qApp->quit();
- });
- const auto err = job->start({QString::fromLatin1(key.primaryFingerprint())});
- if (err) {
- std::cerr << "Error: " << err << std::endl;
- return 1;
- }
- } else {
- auto job = QGpgME::smime()->refreshKeysJob();
- if (!job) {
- std::cerr << "Error: Could not create job to refresh S/MIME key" << std::endl;
- return 1;
- }
- QObject::connect(job, &QGpgME::RefreshKeysJob::result, &app, [](const GpgME::Error &err) {
- std::cout << "Result: " << err << std::endl;
- qApp->quit();
- });
- const auto err = job->start({key});
- if (err) {
- std::cerr << "Error: " << err << std::endl;
- return 1;
- }
- }
-
- return app.exec();
-}
diff --git a/lang/qt/tests/run-signarchivejob.cpp b/lang/qt/tests/run-signarchivejob.cpp
deleted file mode 100644
index 3152507e..00000000
--- a/lang/qt/tests/run-signarchivejob.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- run-signarchivejob.cpp
-
- This file is part of QGpgME's test suite.
- Copyright (c) 2023 by g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License,
- version 2, as published by the Free Software Foundation.
-
- 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 <debug.h>
-#include <protocol.h>
-#include <signarchivejob.h>
-
-#include <QCommandLineParser>
-#include <QCoreApplication>
-#include <QDebug>
-#include <QDir>
-#include <QFile>
-#include <QFileInfo>
-#include <QTimer>
-
-#include <gpgme++/context.h>
-#include <gpgme++/signingresult.h>
-
-#include <iostream>
-
-using namespace GpgME;
-
-std::ostream &operator<<(std::ostream &os, const QString &s)
-{
- return os << s.toLocal8Bit().constData();
-}
-
-struct CommandLineOptions {
- bool armor;
- QString archiveName;
- QString baseDirectory;
- std::chrono::seconds cancelTimeout{0};
- std::vector<QString> filesAndDirectories;
-};
-
-CommandLineOptions parseCommandLine(const QStringList &arguments)
-{
- CommandLineOptions options;
-
- QCommandLineParser parser;
- parser.setApplicationDescription("Test program for SignArchiveJob");
- parser.addHelpOption();
- parser.addOptions({
- {{"o", "output"}, "Write output to FILE.", "FILE"},
- {{"a", "armor"}, "Create ASCII armored output."},
- {{"C", "directory"}, "Change to DIRECTORY before creating the archive.", "DIRECTORY"},
- {"cancel-after", "Cancel the running job after SECONDS seconds.", "SECONDS"},
- });
- parser.addPositionalArgument("files", "Files and directories to add to the archive", "[files] [directories]");
-
- parser.process(arguments);
-
- const auto args = parser.positionalArguments();
- if (args.empty()) {
- parser.showHelp(1);
- }
-
- options.armor = parser.isSet("armor");
- options.archiveName = parser.value("output");
- options.baseDirectory = parser.value("directory");
- if (parser.isSet("cancel-after")) {
- bool ok;
- options.cancelTimeout = std::chrono::seconds{parser.value("cancel-after").toInt(&ok)};
- if (!ok) {
- options.cancelTimeout = std::chrono::seconds{-1};
- }
- }
- std::copy(args.begin(), args.end(), std::back_inserter(options.filesAndDirectories));
-
- return options;
-}
-
-QString checkOutputFilePath(const QString &fileName, const QString &baseDirectory)
-{
- const QFileInfo fi{QDir{baseDirectory}, fileName};
- if (fi.exists()) {
- qCritical() << "File" << fi.filePath() << "exists. Bailing out.";
- return {};
- }
- return fileName;
-}
-
-int main(int argc, char **argv)
-{
- GpgME::initializeLibrary();
-
- QCoreApplication app{argc, argv};
- app.setApplicationName("run-signarchivejob");
-
- const auto options = parseCommandLine(app.arguments());
- if (options.cancelTimeout.count() < 0) {
- std::cerr << "Ignoring invalid timeout for cancel." << std::endl;
- }
-
- if (!QGpgME::SignArchiveJob::isSupported()) {
- std::cerr << "Error: Signing archives is not supported by your version of gpg." << std::endl;
- return 1;
- }
-
- std::shared_ptr<QFile> output;
- QString outputFilePath;
- if (options.archiveName.isEmpty() || options.archiveName == QLatin1String{"-"}) {
- output.reset(new QFile);
- output->open(stdout, QIODevice::WriteOnly);
- } else {
- outputFilePath = checkOutputFilePath(options.archiveName, options.baseDirectory);
- if (outputFilePath.isEmpty()) {
- return 1;
- }
- }
-
- auto job = QGpgME::openpgp()->signArchiveJob(options.armor);
- if (!job) {
- std::cerr << "Error: Could not create job" << std::endl;
- return 1;
- }
- job->setBaseDirectory(options.baseDirectory);
- QObject::connect(job, &QGpgME::SignArchiveJob::result, &app, [](const GpgME::SigningResult &result, const QString &auditLog, const GpgME::Error &) {
- std::cerr << "Diagnostics: " << auditLog << std::endl;
- std::cerr << "Result: " << result << std::endl;
- qApp->quit();
- });
- if (options.cancelTimeout.count() > 0) {
- QTimer::singleShot(options.cancelTimeout, job, [job]() {
- std::cerr << "Canceling job" << std::endl;
- job->slotCancel();
- });
- }
-
- GpgME::Error err;
- if (output) {
- err = job->start({}, options.filesAndDirectories, output);
- } else {
- job->setInputPaths(options.filesAndDirectories);
- job->setOutputFile(outputFilePath);
- err = job->startIt();
- }
- if (err) {
- std::cerr << "Error: Starting the job failed: " << err << std::endl;
- return 1;
- }
-
- return app.exec();
-}
diff --git a/lang/qt/tests/run-signjob.cpp b/lang/qt/tests/run-signjob.cpp
deleted file mode 100644
index 9c2ebcc2..00000000
--- a/lang/qt/tests/run-signjob.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- run-signjob.cpp
-
- This file is part of QGpgME's test suite.
- Copyright (c) 2023 by g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License,
- version 2, as published by the Free Software Foundation.
-
- 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 <debug.h>
-#include <protocol.h>
-#include <signjob.h>
-
-#include <QCommandLineParser>
-#include <QCoreApplication>
-#include <QDebug>
-#include <QFile>
-#include <QTimer>
-
-#include <gpgme++/context.h>
-#include <gpgme++/signingresult.h>
-
-#include <iostream>
-
-using namespace GpgME;
-
-std::ostream &operator<<(std::ostream &os, const QString &s)
-{
- return os << s.toLocal8Bit().constData();
-}
-
-struct CommandLineOptions {
- GpgME::SignatureMode signingFlags = GpgME::NormalSignatureMode;
- bool armor = false;
- bool appendSignature = false;
- QString inputFile;
- QString outputFile;
- std::chrono::seconds cancelTimeout{0};
-};
-
-CommandLineOptions parseCommandLine(const QStringList &arguments)
-{
- CommandLineOptions options;
-
- QCommandLineParser parser;
- parser.setApplicationDescription("Test program for SignJob");
- parser.addHelpOption();
- parser.addOptions({
- {{"o", "output"}, "Write output to FILE.", "FILE"},
- {{"a", "armor"}, "Create ASCII armored output."},
- {{"b", "detach-sign"}, "Create a detached signature."},
- {"append", "Append new (detached) signature to existing file."},
- {"cancel-after", "Cancel the running job after SECONDS seconds.", "SECONDS"},
- });
- parser.addPositionalArgument("file", "File to sign", "FILE");
-
- parser.process(arguments);
-
- const auto args = parser.positionalArguments();
- if (args.size() != 1) {
- parser.showHelp(1);
- }
-
- options.armor = parser.isSet("armor");
- if (parser.isSet("detach-sign")) {
- options.signingFlags = GpgME::Detached;
- options.appendSignature = parser.isSet("append");
- }
- options.inputFile = args.front();
- options.outputFile = parser.value("output");
- if (parser.isSet("cancel-after")) {
- bool ok;
- options.cancelTimeout = std::chrono::seconds{parser.value("cancel-after").toInt(&ok)};
- if (!ok) {
- options.cancelTimeout = std::chrono::seconds{-1};
- }
- }
-
- return options;
-}
-
-int main(int argc, char **argv)
-{
- GpgME::initializeLibrary();
-
- QCoreApplication app{argc, argv};
- app.setApplicationName("run-signjob");
-
- const auto options = parseCommandLine(app.arguments());
- if (options.cancelTimeout.count() < 0) {
- std::cerr << "Ignoring invalid timeout for cancel." << std::endl;
- }
-
- std::shared_ptr<QFile> output;
- if (options.outputFile.isEmpty() || options.outputFile == QLatin1String{"-"}) {
- output.reset(new QFile);
- output->open(stdout, QIODevice::WriteOnly);
- } else {
- if (QFile::exists(options.outputFile) && !options.appendSignature) {
- qCritical() << "File" << options.outputFile << "exists. Bailing out.";
- return 1;
- }
- }
-
- auto job = QGpgME::openpgp()->signJob(options.armor);
- if (!job) {
- std::cerr << "Error: Could not create job" << std::endl;
- return 1;
- }
- QObject::connect(job, &QGpgME::SignJob::result, &app, [](const GpgME::SigningResult &result, const QByteArray &, const QString &auditLog, const GpgME::Error &) {
- std::cerr << "Diagnostics: " << auditLog << std::endl;
- std::cerr << "Result: " << result << std::endl;
- qApp->quit();
- });
- if (options.cancelTimeout.count() > 0) {
- QTimer::singleShot(options.cancelTimeout, job, [job]() {
- std::cerr << "Canceling job" << std::endl;
- job->slotCancel();
- });
- }
-
- std::shared_ptr<QFile> input;
- GpgME::Error err;
- if (output) {
- input.reset(new QFile{options.inputFile});
- input->open(QIODevice::ReadOnly);
- job->start({}, input, output, GpgME::NormalSignatureMode);
- } else {
- job->setInputFile(options.inputFile);
- job->setOutputFile(options.outputFile);
- job->setSigningFlags(options.signingFlags);
- job->setAppendSignature(options.appendSignature);
- err = job->startIt();
- }
- if (err) {
- std::cerr << "Error: Starting the job failed: " << err << std::endl;
- return 1;
- }
-
- return app.exec();
-}
diff --git a/lang/qt/tests/run-verifydetachedjob.cpp b/lang/qt/tests/run-verifydetachedjob.cpp
deleted file mode 100644
index 17a719e9..00000000
--- a/lang/qt/tests/run-verifydetachedjob.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- run-verifydetachedjob.cpp
-
- This file is part of QGpgME's test suite.
- Copyright (c) 2024 by g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License,
- version 2, as published by the Free Software Foundation.
-
- 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 <debug.h>
-#include <protocol.h>
-#include <verifydetachedjob.h>
-
-#include <QCommandLineParser>
-#include <QCoreApplication>
-#include <QDebug>
-#include <QFile>
-
-#include <gpgme++/context.h>
-#include <gpgme++/verificationresult.h>
-
-#include <iostream>
-
-using namespace GpgME;
-
-std::ostream &operator<<(std::ostream &os, const QString &s)
-{
- return os << s.toLocal8Bit().constData();
-}
-
-struct CommandLineOptions {
- bool processAllSignatures = false;
- QString signatureFile;
- QString signedFile;
-};
-
-CommandLineOptions parseCommandLine(const QStringList &arguments)
-{
- CommandLineOptions options;
-
- QCommandLineParser parser;
- parser.setApplicationDescription("Test program for VerifyDetachedJob");
- parser.addHelpOption();
- parser.addOptions({
- {"process-all-signatures", "Don't stop signature checking after bad signature."},
- });
- parser.addPositionalArgument("signature", "Detached SIGNATURE to verify", "SIGNATURE");
- parser.addPositionalArgument("signed file", "FILE containing the signed data", "FILE");
-
- parser.process(arguments);
-
- const auto args = parser.positionalArguments();
- if (args.size() != 2) {
- parser.showHelp(1);
- }
-
- options.processAllSignatures = parser.isSet("process-all-signatures");
- options.signatureFile = args[0];
- options.signedFile = args[1];
-
- return options;
-}
-
-int main(int argc, char **argv)
-{
- GpgME::initializeLibrary();
-
- QCoreApplication app{argc, argv};
- app.setApplicationName("run-verifydetachedjob");
-
- const auto options = parseCommandLine(app.arguments());
-
- auto job = QGpgME::openpgp()->verifyDetachedJob();
- if (!job) {
- std::cerr << "Error: Could not create job" << std::endl;
- return 1;
- }
- QObject::connect(job,
- &QGpgME::VerifyDetachedJob::result,
- &app,
- [](const GpgME::VerificationResult &verificationResult,
- const QString &auditLog,
- const GpgME::Error &) {
- std::cerr << "Diagnostics: " << auditLog << std::endl;
- std::cerr << "Verification Result: " << verificationResult << std::endl;
- qApp->quit();
- });
-
- std::shared_ptr<QFile> input;
- GpgME::Error err;
- job->setProcessAllSignatures(options.processAllSignatures);
- job->setSignatureFile(options.signatureFile);
- job->setSignedFile(options.signedFile);
- err = job->startIt();
- if (err) {
- std::cerr << "Error: Starting the job failed: " << err << std::endl;
- return 1;
- }
-
- return app.exec();
-}
diff --git a/lang/qt/tests/run-verifyopaquejob.cpp b/lang/qt/tests/run-verifyopaquejob.cpp
deleted file mode 100644
index a3245b4f..00000000
--- a/lang/qt/tests/run-verifyopaquejob.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- run-verifyopaquejob.cpp
-
- This file is part of QGpgME's test suite.
- Copyright (c) 2023 by g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License,
- version 2, as published by the Free Software Foundation.
-
- 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 <debug.h>
-#include <protocol.h>
-#include <verifyopaquejob.h>
-
-#include <QCommandLineParser>
-#include <QCoreApplication>
-#include <QDebug>
-#include <QFile>
-#include <QTimer>
-
-#include <gpgme++/context.h>
-#include <gpgme++/verificationresult.h>
-
-#include <iostream>
-
-using namespace GpgME;
-
-std::ostream &operator<<(std::ostream &os, const QString &s)
-{
- return os << s.toLocal8Bit().constData();
-}
-
-struct CommandLineOptions {
- bool processAllSignatures = false;
- QString inputFile;
- QString outputFile;
- std::chrono::seconds cancelTimeout{0};
-};
-
-CommandLineOptions parseCommandLine(const QStringList &arguments)
-{
- CommandLineOptions options;
-
- QCommandLineParser parser;
- parser.setApplicationDescription("Test program for VerifyOpaqueJob");
- parser.addHelpOption();
- parser.addOptions({
- {{"o", "output"}, "Write output to FILE.", "FILE"},
- {"cancel-after", "Cancel the running job after SECONDS seconds.", "SECONDS"},
- {"process-all-signatures", "Don't stop signature checking after bad signature."},
- });
- parser.addPositionalArgument("file", "File to verify", "FILE");
-
- parser.process(arguments);
-
- const auto args = parser.positionalArguments();
- if (args.size() != 1) {
- parser.showHelp(1);
- }
-
- options.processAllSignatures = parser.isSet("process-all-signatures");
- options.inputFile = args.front();
- options.outputFile = parser.value("output");
- if (parser.isSet("cancel-after")) {
- bool ok;
- options.cancelTimeout = std::chrono::seconds{parser.value("cancel-after").toInt(&ok)};
- if (!ok) {
- options.cancelTimeout = std::chrono::seconds{-1};
- }
- }
-
- return options;
-}
-
-int main(int argc, char **argv)
-{
- GpgME::initializeLibrary();
-
- QCoreApplication app{argc, argv};
- app.setApplicationName("run-verifyopaquejob");
-
- const auto options = parseCommandLine(app.arguments());
- if (options.cancelTimeout.count() < 0) {
- std::cerr << "Ignoring invalid timeout for cancel." << std::endl;
- }
-
- std::shared_ptr<QFile> output;
- if (options.outputFile.isEmpty() || options.outputFile == QLatin1String{"-"}) {
- output.reset(new QFile);
- output->open(stdout, QIODevice::WriteOnly);
- } else {
- if (QFile::exists(options.outputFile)) {
- qCritical() << "File" << options.outputFile << "exists. Bailing out.";
- return 1;
- }
- }
-
- auto job = QGpgME::openpgp()->verifyOpaqueJob();
- if (!job) {
- std::cerr << "Error: Could not create job" << std::endl;
- return 1;
- }
- QObject::connect(job,
- &QGpgME::VerifyOpaqueJob::result,
- &app,
- [](const GpgME::VerificationResult &verificationResult,
- const QByteArray &,
- const QString &auditLog,
- const GpgME::Error &) {
- std::cerr << "Diagnostics: " << auditLog << std::endl;
- std::cerr << "Verification Result: " << verificationResult << std::endl;
- qApp->quit();
- });
- if (options.cancelTimeout.count() > 0) {
- QTimer::singleShot(options.cancelTimeout, job, [job]() {
- std::cerr << "Canceling job" << std::endl;
- job->slotCancel();
- });
- }
-
- std::shared_ptr<QFile> input;
- GpgME::Error err;
- job->setProcessAllSignatures(options.processAllSignatures);
- if (output) {
- input.reset(new QFile{options.inputFile});
- input->open(QIODevice::ReadOnly);
- job->start(input, output);
- } else {
- job->setInputFile(options.inputFile);
- job->setOutputFile(options.outputFile);
- err = job->startIt();
- }
- if (err) {
- std::cerr << "Error: Starting the job failed: " << err << std::endl;
- return 1;
- }
-
- return app.exec();
-}
diff --git a/lang/qt/tests/run-wkdrefreshjob.cpp b/lang/qt/tests/run-wkdrefreshjob.cpp
deleted file mode 100644
index 17bad83d..00000000
--- a/lang/qt/tests/run-wkdrefreshjob.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- run-wkdrefreshjob.cpp
-
- This file is part of QGpgME's test suite.
- Copyright (c) 2023 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 <debug.h>
-#include <protocol.h>
-#include <wkdrefreshjob.h>
-
-#include <QCommandLineParser>
-#include <QCoreApplication>
-#include <QDebug>
-
-#include <gpgme++/context.h>
-#include <gpgme++/importresult.h>
-
-#include <iostream>
-
-using namespace GpgME;
-
-std::ostream &operator<<(std::ostream &os, const QString &s)
-{
- return os << s.toLocal8Bit().constData();
-}
-
-struct CommandLineOptions {
- bool allUserIds;
- QString keyId;
-};
-
-CommandLineOptions parseCommandLine(const QStringList &arguments)
-{
- CommandLineOptions options;
-
- QCommandLineParser parser;
- parser.setApplicationDescription("Test program for WKDRefreshJob");
- parser.addHelpOption();
- parser.addOptions({
- {"all-userids", "Query WKD for all user IDs."},
- });
- parser.addPositionalArgument("key ID", "Key to refresh");
-
- parser.process(arguments);
-
- const auto args = parser.positionalArguments();
- if (args.size() != 1) {
- parser.showHelp(1);
- }
-
- options.allUserIds = parser.isSet("all-userids");
- options.keyId = args[0];
-
- return options;
-}
-
-Key getOpenPGPKey(const QString &keyId, Error &err)
-{
- Key key;
-
- auto ctx = Context::create(GpgME::OpenPGP);
- if (!ctx) {
- err = Error::fromCode(GPG_ERR_GENERAL);
- return key;
- }
-
- key = ctx->key(keyId.toLatin1().constData(), err);
- if (err.code() == GPG_ERR_EOF) {
- err = Error{};
- }
- return key;
-}
-
-int main(int argc, char **argv)
-{
- GpgME::initializeLibrary();
-
- QCoreApplication app{argc, argv};
- app.setApplicationName("run-wkdrefreshjob");
-
- const auto options = parseCommandLine(app.arguments());
-
- Error err;
- const auto key = getOpenPGPKey(options.keyId, err);
- if (err.code() == GPG_ERR_AMBIGUOUS_NAME) {
- std::cerr << "Error: Multiple OpenPGP keys matching '" << options.keyId << "' found" << std::endl;
- return 1;
- }
- if (key.isNull()) {
- std::cerr << "Error: No OpenPGP key matching '" << options.keyId << "' found" << std::endl;
- return 1;
- }
- if (err) {
- std::cerr << "Error while getting OpenPGP key: " << err << std::endl;
- return 1;
- }
- std::cout << "Refreshing OpenPGP key " << key.userID(0).id() << std::endl;
-
- auto job = QGpgME::openpgp()->wkdRefreshJob();
- if (!job) {
- std::cerr << "Error: Could not create job to refresh OpenPGP key" << std::endl;
- return 1;
- }
- QObject::connect(job, &QGpgME::WKDRefreshJob::result, &app, [](const GpgME::ImportResult &result, const QString &, const GpgME::Error &) {
- if (result.isNull()) {
- std::cout << "Empty result. Lookup via WKD failed or no user ID was originally retrieved via WKD." << std::endl;
- } else {
- std::cout << "Result: " << result << std::endl;
- }
- qApp->quit();
- });
- if (options.allUserIds) {
- err = job->start(key.userIDs());
- } else {
- err = job->start({key});
- }
- if (err) {
- std::cerr << "Error: " << err << std::endl;
- return 1;
- }
-
- return app.exec();
-}
diff --git a/lang/qt/tests/t-addexistingsubkey.cpp b/lang/qt/tests/t-addexistingsubkey.cpp
deleted file mode 100644
index df620ddb..00000000
--- a/lang/qt/tests/t-addexistingsubkey.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-/* t-addexistingsubkey.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 <[email protected]>
-
- 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 "t-support.h"
-
-#include "addexistingsubkeyjob.h"
-#include "protocol.h"
-
-#include <QSignalSpy>
-#include <QTest>
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-#include <gpgme++/engineinfo.h>
-
-#include <algorithm>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-static const char *requiredVersion = "2.3.5";
-
-/* Test keys
- sec# ed25519 2022-01-13 [SC]
- 1CB8C6A0317AA83F44FE009932392C82B814C8E0
- uid [ unknown] [email protected]
- ssb cv25519 2022-01-13 [E]
- ssb cv25519 2022-01-13 [E] [expires: 2100-01-01]
-
- sec ed25519 2022-01-13 [SC]
- C3C87F0A3920B01F9E4450EA2B79F21D4DD10BFC
- uid [ unknown] [email protected]
- ssb cv25519 2022-01-13 [E]
- * generated with
-export GNUPGHOME=$(mktemp -d)
-gpg -K
-gpg --batch --pinentry-mode loopback --passphrase abc --quick-gen-key [email protected] default default never
-fpr=$(gpg -k --with-colons [email protected] | grep ^fpr | head -1 | cut -d ':' -f 10)
-gpg --batch --pinentry-mode loopback --passphrase abc --quick-add-key ${fpr} default default 21000101T120000
-gpg --batch --pinentry-mode loopback --passphrase abc --quick-gen-key [email protected] default default never
-gpg -K
-gpg --export-secret-subkeys --armor --batch --pinentry-mode loopback --passphrase abc --comment [email protected] [email protected] | sed 's/\(.*\)/ "\1\\n"/'
-gpg --export-secret-keys --armor --batch --pinentry-mode loopback --passphrase abc --comment [email protected] [email protected] | sed 's/\(.*\)/ "\1\\n"/'
-#rm -rf ${GNUPGHOME}
-unset GNUPGHOME
-*/
-static const char *testKeyData =
- "-----BEGIN PGP PRIVATE KEY BLOCK-----\n"
- "Comment: [email protected]\n"
- "\n"
- "lDsEYd/ujBYJKwYBBAHaRw8BAQdAwiZPINTcrpgmu6ZWSaPZlcRSd4nDuofVMhe7\n"
- "c2XrFyT/AGUAR05VAbQWc291cmNlLWtleUBleGFtcGxlLm5ldIiUBBMWCgA8FiEE\n"
- "HLjGoDF6qD9E/gCZMjksgrgUyOAFAmHf7owCGwMFCwkIBwIDIgIBBhUKCQgLAgQW\n"
- "AgMBAh4HAheAAAoJEDI5LIK4FMjgupIA/Au2YEAT9dYdJd0eJCJerG5YAeoB+uBs\n"
- "mBkgr6xXE0bIAP43b6u1Jtvf/Wm3BhRbLd5Tg67Ba4CIZ8ZLGng73FBoBpyLBGHf\n"
- "7owSCisGAQQBl1UBBQEBB0Cpg8Qof/WShxROZZtmPnw24vTk0R8nIAF1CZJ0bG/C\n"
- "SwMBCAf+BwMCtzxziVxQEor8w/VVzHp4/hVSCUyrpiX7Djf04cIMs2bFPduZLgxb\n"
- "c1SXhlgiqU0YBNntbGGNdKjTP6FMbYWq1+NwQm6ZXtC76LPG7syM94h4BBgWCgAg\n"
- "FiEEHLjGoDF6qD9E/gCZMjksgrgUyOAFAmHf7owCGwwACgkQMjksgrgUyOCI0wEA\n"
- "+f56fkvDDUwMOMw7n4+GKpfJXpWhVL08ttccbBOa/9IA/2HYA/78ZaD8E5EyqAEK\n"
- "Aj9Au+2oJu9V5qo92QEoqwYHnIsEYd/vgxIKKwYBBAGXVQEFAQEHQBa9FxJkm/9D\n"
- "xABildkaYMrbJbu8BPk6uv9V8aLmv9FnAwEIB/4HAwIPhcbN8s6OzPz8/g78TrCh\n"
- "xqQb2kygCEj+OQ4/XXU3lus2b5xS5h44LGt99Wisqx+wVPDXmPDJOaxjhHXDmJxd\n"
- "/LplIEhykojSm3uUDxERiH4EGBYKACYWIQQcuMagMXqoP0T+AJkyOSyCuBTI4AUC\n"
- "Yd/vgwIbDAUJkqcQPQAKCRAyOSyCuBTI4IUjAP9BTfOD+jy6lLmzNO9pquRSAxi/\n"
- "PQuglGtpS0LQEJMEOwD+PFnsMe2EtQ+WVSDBeB7O0m61EXeY+RhpuhNtsNXVuwc=\n"
- "=wIPU\n"
- "-----END PGP PRIVATE KEY BLOCK-----\n"
- "-----BEGIN PGP PRIVATE KEY BLOCK-----\n"
- "Comment: [email protected]\n"
- "\n"
- "lIYEYd/v/RYJKwYBBAHaRw8BAQdAKoILWXG3yaLb2EniNKQLUjwsrvy5vgAN299J\n"
- "W5cFbrz+BwMC/uKbCq3sK5H8QVtEQ/IxGmjWNBpy6c8EDlOG4APi4o4VE+bEYD8w\n"
- "J3Kk/lzSm6ZT5vC6DDASks797omjXD+J7zZ0vtTPvheYi/nsVz2UebQWdGFyZ2V0\n"
- "LWtleUBleGFtcGxlLm5ldIiUBBMWCgA8FiEEw8h/CjkgsB+eRFDqK3nyHU3RC/wF\n"
- "AmHf7/0CGwMFCwkIBwIDIgIBBhUKCQgLAgQWAgMBAh4HAheAAAoJECt58h1N0Qv8\n"
- "rXcBAPxnkXqpp4IY3iTKV5XAdo7Uys7U/joUD73rj2XEvgI1AQDhKK4PLxPhf3ki\n"
- "FKU0RA7itxzOH+F8bQ5BdYS49jDPCpyLBGHf7/0SCisGAQQBl1UBBQEBB0Dq9rwA\n"
- "hAA2UFJShFsLFp7+g4uhWDfuDa3VjeIQRM+9QgMBCAf+BwMCMfCTl0LNqsn836t5\n"
- "f2ZHBuMcNs4JWYmdLAIVaewEHq7zhOsX3iB+/yxwu9g2mXc4XUJ1iQzXLOYwgGov\n"
- "8jIovrr01hDkSg4rvM9JKMWdd4h4BBgWCgAgFiEEw8h/CjkgsB+eRFDqK3nyHU3R\n"
- "C/wFAmHf7/0CGwwACgkQK3nyHU3RC/xyfAEAqnMdSv6FTAwAWrYvJqJtSVoEhjMn\n"
- "3c2qMsu34Bk86/MBAKHbLFmdyePvHaxKeO8CkQDoJzK8rYzw3RAmq/5JsQkL\n"
- "=rOVf\n"
- "-----END PGP PRIVATE KEY BLOCK-----\n";
-
-class AddExistingSubkeyJobTest : public QGpgMETest
-{
- Q_OBJECT
-
-private Q_SLOTS:
-
- void initTestCase()
- {
- QGpgMETest::initTestCase();
-
- // set up the test fixture for this test
- qputenv("GNUPGHOME", mGnupgHomeTestFixture.path().toUtf8());
- QVERIFY(importSecretKeys(testKeyData, 2));
- }
-
- void init()
- {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < requiredVersion) {
- QSKIP("gpg does not yet support adding an existing subkey to another key via the command API");
- }
-
- // set up a copy of the test fixture for each test function
- mGnupgHomeTestCopy.reset(new QTemporaryDir{});
- QVERIFY(copyKeyrings(mGnupgHomeTestFixture.path(), mGnupgHomeTestCopy->path()));
- qputenv("GNUPGHOME", mGnupgHomeTestCopy->path().toUtf8());
- }
-
- void testAddExistingSubkeyAsync()
- {
- // Get the key the subkey should be added to
- auto key = getTestKey("[email protected]");
- QVERIFY(!key.isNull());
-
- // Get the key with the subkey to add
- auto sourceKey = getTestKey("[email protected]", 3);
- QVERIFY(!sourceKey.isNull());
-
- auto job = std::unique_ptr<AddExistingSubkeyJob>{openpgp()->addExistingSubkeyJob()};
- hookUpPassphraseProvider(job.get());
-
- Error result;
- connect(job.get(), &AddExistingSubkeyJob::result,
- job.get(), [this, &result](const Error &result_) {
- result = result_;
- Q_EMIT asyncDone();
- });
- QVERIFY(!job->start(key, sourceKey.subkey(1)));
- job.release(); // after the job has been started it's on its own
-
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- QCOMPARE(result.code(), static_cast<int>(GPG_ERR_NO_ERROR));
- key.update();
- QCOMPARE(key.numSubkeys(), 3u);
- }
-
- void testAddExistingSubkeySync()
- {
- // Get the key the subkey should be added to
- auto key = getTestKey("[email protected]");
- QVERIFY(!key.isNull());
-
- // Get the key with the subkey to add
- auto sourceKey = getTestKey("[email protected]", 3);
- QVERIFY(!sourceKey.isNull());
- auto sourceSubkey = sourceKey.subkey(1);
- QVERIFY(sourceSubkey.expirationTime() == 0);
-
- auto job = std::unique_ptr<AddExistingSubkeyJob>{openpgp()->addExistingSubkeyJob()};
- hookUpPassphraseProvider(job.get());
-
- const auto result = job->exec(key, sourceSubkey);
-
- QCOMPARE(result.code(), static_cast<int>(GPG_ERR_NO_ERROR));
- key.update();
- QCOMPARE(key.numSubkeys(), 3u);
- QCOMPARE(key.subkey(2).expirationTime(), 0);
- }
-
- void testAddExistingSubkeyWithExpiration()
- {
- // Get the key the subkey should be added to
- auto key = getTestKey("[email protected]");
- QVERIFY(!key.isNull());
-
- // Get the key with the subkey to add
- auto sourceKey = getTestKey("[email protected]", 3);
- QVERIFY(!sourceKey.isNull());
- auto sourceSubkey = sourceKey.subkey(2);
- QVERIFY(sourceSubkey.expirationTime() != 0);
-
- auto job = std::unique_ptr<AddExistingSubkeyJob>{openpgp()->addExistingSubkeyJob()};
- hookUpPassphraseProvider(job.get());
-
- const auto result = job->exec(key, sourceSubkey);
-
- if (sourceSubkey.expirationTime() > 0) {
- QCOMPARE(result.code(), static_cast<int>(GPG_ERR_NO_ERROR));
- key.update();
- QCOMPARE(key.numSubkeys(), 3u);
-
- // allow 1 second different expiration because gpg calculates with
- // expiration as difference to current time and takes current time
- // several times
- const auto allowedDeltaTSeconds = 1;
- const auto expectedExpirationRange = std::make_pair(
- uint_least32_t(sourceSubkey.expirationTime()) - allowedDeltaTSeconds,
- uint_least32_t(sourceSubkey.expirationTime()) + allowedDeltaTSeconds);
- const auto actualExpiration = uint_least32_t(key.subkey(2).expirationTime());
- QVERIFY2(actualExpiration >= expectedExpirationRange.first,
- ("actual: " + std::to_string(actualExpiration) +
- "; expected: " + std::to_string(expectedExpirationRange.first)).c_str());
- QVERIFY2(actualExpiration <= expectedExpirationRange.second,
- ("actual: " + std::to_string(actualExpiration) +
- "; expected: " + std::to_string(expectedExpirationRange.second)).c_str());
- } else {
- // on 32-bit systems the expiration date of the test key overflows;
- // in this case we expect an appropriate error code
- QCOMPARE(result.code(), static_cast<int>(GPG_ERR_INV_TIME));
- }
- }
-
-private:
- Key getTestKey(const char *pattern, unsigned int expectedSubkeys = 2)
- {
- auto ctx = Context::create(OpenPGP);
- VERIFY_OR_OBJECT(ctx);
-
- Error err;
- auto key = ctx->key(pattern, err, /*secret=*/true);
- VERIFY_OR_OBJECT(!err);
- VERIFY_OR_OBJECT(!key.isNull());
- COMPARE_OR_OBJECT(key.numSubkeys(), expectedSubkeys);
- for (unsigned int i = 0; i < key.numSubkeys(); ++i) {
- VERIFY_OR_OBJECT(!key.subkey(i).isNull());
- }
- return key;
- }
-
-private:
- QTemporaryDir mGnupgHomeTestFixture;
- std::unique_ptr<QTemporaryDir> mGnupgHomeTestCopy;
-};
-
-QTEST_MAIN(AddExistingSubkeyJobTest)
-
-#include "t-addexistingsubkey.moc"
diff --git a/lang/qt/tests/t-changeexpiryjob.cpp b/lang/qt/tests/t-changeexpiryjob.cpp
deleted file mode 100644
index b64bf798..00000000
--- a/lang/qt/tests/t-changeexpiryjob.cpp
+++ /dev/null
@@ -1,397 +0,0 @@
-/* t-changeexpiryjob.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "t-support.h"
-
-#include "changeexpiryjob.h"
-#include <gpgme++/context.h>
-#include <gpgme++/engineinfo.h>
-#include "protocol.h"
-#include "util.h"
-
-#include <QSignalSpy>
-#include <QTemporaryDir>
-#include <QTest>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-class TestChangeExpiryJob: public QGpgMETest
-{
- Q_OBJECT
-
-private Q_SLOTS:
- void test_change_expiration_default_without_subkeys()
- {
- Error err;
-
- if (!loopbackSupported()) {
- return;
- }
-
- auto ctx = Context::create(OpenPGP);
- QVERIFY(ctx);
-
- // Get the key ([email protected])
- auto key = ctx->key("A0FF4590BB6122EDEF6E3C542D727CC768697734", err, true);
- QVERIFY(!err);
- QVERIFY(!key.isNull());
- QVERIFY(!key.subkey(0).isNull());
- QVERIFY(!key.subkey(1).isNull());
- const auto subkeyExpiration = uint_least32_t(key.subkey(1).expirationTime());
-
- {
- // Create the job
- auto job = std::unique_ptr<ChangeExpiryJob>{openpgp()->changeExpiryJob()};
- QVERIFY(job);
- hookUpPassphraseProvider(job.get());
-
- // Use defaults of job
-
- connect(job.get(), &ChangeExpiryJob::result,
- this, [this] (const GpgME::Error &err2, const QString &, const GpgME::Error &) {
- Q_EMIT asyncDone();
- if (err2) {
- QFAIL(qPrintable(QString("The ChangeExpiryJob failed with '%1'.").arg(errorAsString(err2))));
- }
- });
-
- const auto newExpirationDate = QDateTime::currentDateTime().addDays(1);
- job->start(key, newExpirationDate);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- // At this point the expiration date should have been changed.
- key.update();
-
- // allow a few seconds earlier expiration because job calculates "seconds from now" passed to gpg after it was started
- const auto expectedExpirationRange = std::make_pair(
- newExpirationDate.toSecsSinceEpoch() - 10,
- QDateTime::currentDateTime().addDays(1).toSecsSinceEpoch());
- {
- const auto actualExpiration = uint_least32_t(key.subkey(0).expirationTime());
- QVERIFY2(actualExpiration >= expectedExpirationRange.first,
- ("actual: " + std::to_string(actualExpiration) +
- "; expected: " + std::to_string(expectedExpirationRange.first)).c_str());
- QVERIFY2(actualExpiration <= expectedExpirationRange.second,
- ("actual: " + std::to_string(actualExpiration) +
- "; expected: " + std::to_string(expectedExpirationRange.second)).c_str());
- }
- {
- const auto actualExpiration = uint_least32_t(key.subkey(1).expirationTime());
- QCOMPARE(actualExpiration, subkeyExpiration); // unchanged
- }
- }
- }
-
- void test_change_expiration_default_with_subkeys()
- {
- Error err;
-
- if (!loopbackSupported()) {
- return;
- }
-
- auto ctx = Context::create(OpenPGP);
- QVERIFY(ctx);
-
- // Get the key ([email protected])
- auto key = ctx->key("A0FF4590BB6122EDEF6E3C542D727CC768697734", err, true);
- QVERIFY(!err);
- QVERIFY(!key.isNull());
- QVERIFY(!key.subkey(0).isNull());
- QVERIFY(!key.subkey(1).isNull());
- const auto primaryKeyExpiration = uint_least32_t(key.subkey(0).expirationTime());
-
- {
- // Create the job
- auto job = std::unique_ptr<ChangeExpiryJob>{openpgp()->changeExpiryJob()};
- QVERIFY(job);
- hookUpPassphraseProvider(job.get());
-
- // Use defaults of job
-
- connect(job.get(), &ChangeExpiryJob::result,
- this, [this] (const GpgME::Error &err2, const QString &, const GpgME::Error &) {
- Q_EMIT asyncDone();
- if (err2) {
- QFAIL(qPrintable(QString("The ChangeExpiryJob failed with '%1'.").arg(errorAsString(err2))));
- }
- });
-
- const auto newExpirationDate = QDateTime::currentDateTime().addDays(2);
- job->start(key, newExpirationDate, {key.subkey(1)});
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- // At this point the expiration date should have been changed.
- key.update();
-
- // allow a few seconds earlier expiration because job calculates "seconds from now" passed to gpg after it was started
- const auto expectedExpirationRange = std::make_pair(
- newExpirationDate.toSecsSinceEpoch() - 10,
- QDateTime::currentDateTime().addDays(2).toSecsSinceEpoch());
- {
- const auto actualExpiration = uint_least32_t(key.subkey(0).expirationTime());
- QCOMPARE(actualExpiration, primaryKeyExpiration); // unchanged
- }
- {
- const auto actualExpiration = uint_least32_t(key.subkey(1).expirationTime());
- QVERIFY2(actualExpiration >= expectedExpirationRange.first,
- ("actual: " + std::to_string(actualExpiration) +
- "; expected: " + std::to_string(expectedExpirationRange.first)).c_str());
- QVERIFY2(actualExpiration <= expectedExpirationRange.second,
- ("actual: " + std::to_string(actualExpiration) +
- "; expected: " + std::to_string(expectedExpirationRange.second)).c_str());
- }
- }
- }
-
- void test_change_expiration_update_primary_key_without_subkeys()
- {
- Error err;
-
- if (!loopbackSupported()) {
- return;
- }
-
- auto ctx = Context::create(OpenPGP);
- QVERIFY(ctx);
-
- // Get the key ([email protected])
- auto key = ctx->key("A0FF4590BB6122EDEF6E3C542D727CC768697734", err, true);
- QVERIFY(!err);
- QVERIFY(!key.isNull());
- QVERIFY(!key.subkey(0).isNull());
- QVERIFY(!key.subkey(1).isNull());
- const auto subkeyExpiration = uint_least32_t(key.subkey(1).expirationTime());
-
- {
- // Create the job
- auto job = std::unique_ptr<ChangeExpiryJob>{openpgp()->changeExpiryJob()};
- QVERIFY(job);
- hookUpPassphraseProvider(job.get());
-
- // Set up the job
- job->setOptions(ChangeExpiryJob::UpdatePrimaryKey);
-
- connect(job.get(), &ChangeExpiryJob::result,
- this, [this] (const GpgME::Error &err2, const QString &, const GpgME::Error &) {
- Q_EMIT asyncDone();
- if (err2) {
- QFAIL(qPrintable(QString("The ChangeExpiryJob failed with '%1'.").arg(errorAsString(err2))));
- }
- });
-
- const auto newExpirationDate = QDateTime::currentDateTime().addDays(3);
- job->start(key, newExpirationDate, {});
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- // At this point the expiration date should have been changed.
- key.update();
-
- // allow a few seconds earlier expiration because job calculates "seconds from now" passed to gpg after it was started
- const auto expectedExpirationRange = std::make_pair(
- newExpirationDate.toSecsSinceEpoch() - 10,
- QDateTime::currentDateTime().addDays(3).toSecsSinceEpoch());
- {
- const auto actualExpiration = uint_least32_t(key.subkey(0).expirationTime());
- QVERIFY2(actualExpiration >= expectedExpirationRange.first,
- ("actual: " + std::to_string(actualExpiration) +
- "; expected: " + std::to_string(expectedExpirationRange.first)).c_str());
- QVERIFY2(actualExpiration <= expectedExpirationRange.second,
- ("actual: " + std::to_string(actualExpiration) +
- "; expected: " + std::to_string(expectedExpirationRange.second)).c_str());
- }
- {
- const auto actualExpiration = uint_least32_t(key.subkey(1).expirationTime());
- QCOMPARE(actualExpiration, subkeyExpiration); // unchanged
- }
- }
- }
-
- void test_change_expiration_update_primary_key_with_subkeys()
- {
- Error err;
-
- if (!loopbackSupported()) {
- return;
- }
-
- auto ctx = Context::create(OpenPGP);
- QVERIFY(ctx);
-
- // Get the key ([email protected])
- auto key = ctx->key("A0FF4590BB6122EDEF6E3C542D727CC768697734", err, true);
- QVERIFY(!err);
- QVERIFY(!key.isNull());
- QVERIFY(!key.subkey(0).isNull());
- QVERIFY(!key.subkey(1).isNull());
-
- {
- // Create the job
- auto job = std::unique_ptr<ChangeExpiryJob>{openpgp()->changeExpiryJob()};
- QVERIFY(job);
- hookUpPassphraseProvider(job.get());
-
- // Set up the job
- job->setOptions(ChangeExpiryJob::UpdatePrimaryKey);
-
- connect(job.get(), &ChangeExpiryJob::result,
- this, [this] (const GpgME::Error &err2, const QString &, const GpgME::Error &) {
- Q_EMIT asyncDone();
- if (err2) {
- QFAIL(qPrintable(QString("The ChangeExpiryJob failed with '%1'.").arg(errorAsString(err2))));
- }
- });
-
- const auto newExpirationDate = QDateTime::currentDateTime().addDays(4);
- job->start(key, newExpirationDate, {key.subkey(1)});
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- // At this point the expiration date should have been changed.
- key.update();
-
- // allow a few seconds earlier expiration because job calculates "seconds from now" passed to gpg after it was started
- const auto expectedExpirationRange = std::make_pair(
- newExpirationDate.toSecsSinceEpoch() - 10,
- QDateTime::currentDateTime().addDays(4).toSecsSinceEpoch());
- {
- const auto actualExpiration = uint_least32_t(key.subkey(0).expirationTime());
- QVERIFY2(actualExpiration >= expectedExpirationRange.first,
- ("actual: " + std::to_string(actualExpiration) +
- "; expected: " + std::to_string(expectedExpirationRange.first)).c_str());
- QVERIFY2(actualExpiration <= expectedExpirationRange.second,
- ("actual: " + std::to_string(actualExpiration) +
- "; expected: " + std::to_string(expectedExpirationRange.second)).c_str());
- }
- {
- const auto actualExpiration = uint_least32_t(key.subkey(1).expirationTime());
- QVERIFY2(actualExpiration >= expectedExpirationRange.first,
- ("actual: " + std::to_string(actualExpiration) +
- "; expected: " + std::to_string(expectedExpirationRange.first)).c_str());
- QVERIFY2(actualExpiration <= expectedExpirationRange.second,
- ("actual: " + std::to_string(actualExpiration) +
- "; expected: " + std::to_string(expectedExpirationRange.second)).c_str());
- }
- }
- }
-
- void test_change_expiration_update_primary_key_and_all_subkeys()
- {
- Error err;
-
- if (!loopbackSupported()) {
- return;
- }
-
- auto ctx = Context::create(OpenPGP);
- QVERIFY(ctx);
-
- // Get the key ([email protected])
- auto key = ctx->key("A0FF4590BB6122EDEF6E3C542D727CC768697734", err, true);
- QVERIFY(!err);
- QVERIFY(!key.isNull());
- QVERIFY(!key.subkey(0).isNull());
- QVERIFY(!key.subkey(1).isNull());
-
- {
- // Create the job
- auto job = std::unique_ptr<ChangeExpiryJob>{openpgp()->changeExpiryJob()};
- QVERIFY(job);
- hookUpPassphraseProvider(job.get());
-
- // Set up the job
- job->setOptions(ChangeExpiryJob::UpdatePrimaryKey | ChangeExpiryJob::UpdateAllSubkeys);
-
- connect(job.get(), &ChangeExpiryJob::result,
- this, [this] (const GpgME::Error &err2, const QString &, const GpgME::Error &) {
- Q_EMIT asyncDone();
- if (err2) {
- QFAIL(qPrintable(QString("The ChangeExpiryJob failed with '%1'.").arg(errorAsString(err2))));
- }
- });
-
- const auto newExpirationDate = QDateTime::currentDateTime().addDays(5);
- job->start(key, newExpirationDate);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- // At this point the expiration date should have been changed.
- key.update();
-
- // allow a few seconds earlier expiration because job calculates "seconds from now" passed to gpg after it was started
- const auto expectedExpirationRange = std::make_pair(
- newExpirationDate.toSecsSinceEpoch() - 10,
- QDateTime::currentDateTime().addDays(5).toSecsSinceEpoch());
- {
- const auto actualExpiration = uint_least32_t(key.subkey(0).expirationTime());
- QVERIFY2(actualExpiration >= expectedExpirationRange.first,
- ("actual: " + std::to_string(actualExpiration) +
- "; expected: " + std::to_string(expectedExpirationRange.first)).c_str());
- QVERIFY2(actualExpiration <= expectedExpirationRange.second,
- ("actual: " + std::to_string(actualExpiration) +
- "; expected: " + std::to_string(expectedExpirationRange.second)).c_str());
- }
- {
- const auto actualExpiration = uint_least32_t(key.subkey(1).expirationTime());
- QVERIFY2(actualExpiration >= expectedExpirationRange.first,
- ("actual: " + std::to_string(actualExpiration) +
- "; expected: " + std::to_string(expectedExpirationRange.first)).c_str());
- QVERIFY2(actualExpiration <= expectedExpirationRange.second,
- ("actual: " + std::to_string(actualExpiration) +
- "; expected: " + std::to_string(expectedExpirationRange.second)).c_str());
- }
- }
- }
-
- void initTestCase()
- {
- QGpgMETest::initTestCase();
- const QString gpgHome = qgetenv("GNUPGHOME");
- QVERIFY(copyKeyrings(gpgHome, mDir.path()));
- qputenv("GNUPGHOME", mDir.path().toUtf8());
- }
-
-private:
- QTemporaryDir mDir;
-};
-
-QTEST_MAIN(TestChangeExpiryJob)
-
-#include "t-changeexpiryjob.moc"
diff --git a/lang/qt/tests/t-config.cpp b/lang/qt/tests/t-config.cpp
deleted file mode 100644
index 2f73b9a6..00000000
--- a/lang/qt/tests/t-config.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/* t-config.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include <QDebug>
-#include <QTest>
-#include <QTemporaryDir>
-#include "t-support.h"
-#include "protocol.h"
-#include "cryptoconfig.h"
-#include <gpgme++/engineinfo.h>
-
-#include <unistd.h>
-
-using namespace QGpgME;
-
-class CryptoConfigTest: public QGpgMETest
-{
- Q_OBJECT
-
-private Q_SLOTS:
- void testDefault()
- {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.2.0") {
- // We are using compliance here and other options might also
- // be unsupported in older versions.
- return;
- }
- auto conf = cryptoConfig();
- QVERIFY(conf);
- auto entry = conf->entry(QStringLiteral("gpg"), QStringLiteral("compliance"));
- QVERIFY(entry);
- const auto defaultValue = entry->defaultValue().toString();
- QCOMPARE(defaultValue, QStringLiteral("gnupg"));
-
- entry->setStringValue("de-vs");
- conf->sync(true);
- conf->clear();
- entry = conf->entry(QStringLiteral("gpg"), QStringLiteral("compliance"));
- QCOMPARE(entry->stringValue(), QStringLiteral("de-vs"));
-
- entry->resetToDefault();
- conf->sync(true);
- conf->clear();
- entry = conf->entry(QStringLiteral("gpg"), QStringLiteral("compliance"));
- QCOMPARE(entry->stringValue(), defaultValue);
- }
-
- void initTestCase()
- {
- QGpgMETest::initTestCase();
- const QString gpgHome = qgetenv("GNUPGHOME");
- qputenv("GNUPGHOME", mDir.path().toUtf8());
- QVERIFY(mDir.isValid());
- }
-private:
- QTemporaryDir mDir;
-
-};
-
-QTEST_MAIN(CryptoConfigTest)
-
-#include "t-config.moc"
diff --git a/lang/qt/tests/t-decryptverify.cpp b/lang/qt/tests/t-decryptverify.cpp
deleted file mode 100644
index 9df10933..00000000
--- a/lang/qt/tests/t-decryptverify.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/* t-verifiy.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
- Copyright (c) 2023 by g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "t-support.h"
-
-#include <protocol.h>
-#include <decryptverifyjob.h>
-
-#include <QDebug>
-#include <QTest>
-
-#include <gpgme++/decryptionresult.h>
-#include <gpgme++/key.h>
-#include <gpgme++/verificationresult.h>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-static const char encryptedText[] =
-"-----BEGIN PGP MESSAGE-----\n"
-"\n"
-"jA0ECQMCnJt+DX+RJJH90kIBCYlu/LYn57TCNO+O8kYwe4jcyEIaHqSZuvO50nFE\n"
-"hQy9p33Y5VwP6uDOYOKxr1W6iE4GvbX+5UNKYdjjPL0m1ak=\n"
-"=hgKY\n"
-"-----END PGP MESSAGE-----\n";
-
-static const char signedText[] =
-"-----BEGIN PGP MESSAGE-----\n"
-"\n"
-"owGbwMvMwCSoW1RzPCOz3IRxjXQSR0lqcYleSUWJTZOvjVdpcYmCu1+oQmaJIleH\n"
-"GwuDIBMDGysTSIqBi1MApi+nlGGuwDeHao53HBr+FoVGP3xX+kvuu9fCMJvl6IOf\n"
-"y1kvP4y+8D5a11ang0udywsA\n"
-"=Crq6\n"
-"-----END PGP MESSAGE-----\n";
-
-static const char storedText[] =
-"-----BEGIN PGP MESSAGE-----\n"
-"\n"
-"owE7LZzEkHy7X86rtLhEwd0vVCGzRJELAA==\n"
-"=VwL6\n"
-"-----END PGP MESSAGE-----\n";
-
-class DecryptVerifyTest: public QGpgMETest
-{
- Q_OBJECT
-
-private Q_SLOTS:
-
- void testEncryptedOnlyData()
- {
- const QByteArray encryptedData{encryptedText};
- std::unique_ptr<DecryptVerifyJob> job{openpgp()->decryptVerifyJob(true)};
- hookUpPassphraseProvider(job.get());
-
- QByteArray verified;
- const auto result = job->exec(encryptedData, verified);
-
- const auto decryptionResult = result.first;
- QCOMPARE(decryptionResult.error().code(), int{GPG_ERR_NO_ERROR});
- const auto verificationResult = result.second;
- QCOMPARE(verificationResult.error().code(), int{GPG_ERR_NO_ERROR});
- QCOMPARE(verificationResult.numSignatures(), 0u);
- }
-
- void testSignedOnlyData()
- {
- const QByteArray signedData{signedText};
- std::unique_ptr<DecryptVerifyJob> job{openpgp()->decryptVerifyJob(true)};
-
- QByteArray verified;
- const auto result = job->exec(signedData, verified);
-
- const auto decryptionResult = result.first;
- QCOMPARE(decryptionResult.error().code(), int{GPG_ERR_NO_DATA});
- const auto verificationResult = result.second;
- QCOMPARE(verificationResult.error().code(), int{GPG_ERR_NO_ERROR});
- QCOMPARE(verificationResult.numSignatures(), 1u);
- }
-
- void testStoredData()
- {
- const QByteArray storedData{storedText};
- std::unique_ptr<DecryptVerifyJob> job{openpgp()->decryptVerifyJob(true)};
-
- QByteArray verified;
- const auto result = job->exec(storedData, verified);
-
- const auto decryptionResult = result.first;
- QCOMPARE(decryptionResult.error().code(), int{GPG_ERR_NO_DATA});
- const auto verificationResult = result.second;
- QCOMPARE(verificationResult.error().code(), int{GPG_ERR_NO_DATA});
- QCOMPARE(verificationResult.numSignatures(), 0u);
- }
-};
-
-QTEST_MAIN(DecryptVerifyTest)
-#include "t-decryptverify.moc"
diff --git a/lang/qt/tests/t-disablekey.cpp b/lang/qt/tests/t-disablekey.cpp
deleted file mode 100644
index 40581719..00000000
--- a/lang/qt/tests/t-disablekey.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/* t-disablekey.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2024 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "t-support.h"
-
-#include "quickjob.h"
-#include "debug.h"
-#include "keylistjob.h"
-#include "protocol.h"
-
-#include <gpgme++/engineinfo.h>
-#include <gpgme++/keylistresult.h>
-
-#include <QDebug>
-#include <QSignalSpy>
-#include <QTest>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-class DisableKeyTest: public QGpgMETest
-{
- Q_OBJECT
-
- Key getTestKey()
- {
- const std::unique_ptr<KeyListJob> job{openpgp()->keyListJob(false, true, true)};
- std::vector<GpgME::Key> keys;
- KeyListResult result = job->exec({QStringLiteral("[email protected]")}, false, keys);
- VERIFY_OR_OBJECT(!result.error());
- VERIFY_OR_OBJECT(keys.size() == 1);
- return keys.front();
- }
-
-private Q_SLOTS:
-
- void testDisableAndEnableKey()
- {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.4.6") {
- QSKIP("gpg does not yet support the --quick-set-ownertrust command");
- }
-
- Key key = getTestKey();
- QVERIFY(!key.isNull());
- QVERIFY(!key.isDisabled());
-
- {
- const std::unique_ptr<QuickJob> job{openpgp()->quickJob()};
- connect(job.get(), &QuickJob::result, this, [this](Error e) {
- if (e) {
- qDebug() << "Error in result:" << e;
- }
- QVERIFY(!e);
- Q_EMIT asyncDone();
- });
- job->startSetKeyEnabled(key, false);
- QSignalSpy spy{this, SIGNAL(asyncDone())};
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
- }
- key = getTestKey();
- QVERIFY(!key.isNull());
- QVERIFY(key.isDisabled());
-
- {
- const std::unique_ptr<QuickJob> job{openpgp()->quickJob()};
- connect(job.get(), &QuickJob::result, this, [this](Error e) {
- if (e) {
- qDebug() << "Error in result:" << e;
- }
- QVERIFY(!e);
- Q_EMIT asyncDone();
- });
- job->startSetKeyEnabled(key, true);
- QSignalSpy spy{this, SIGNAL(asyncDone())};
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
- }
- key = getTestKey();
- QVERIFY(!key.isNull());
- QVERIFY(!key.isDisabled());
- }
-};
-
-QTEST_MAIN(DisableKeyTest)
-
-#include "t-disablekey.moc"
diff --git a/lang/qt/tests/t-encrypt.cpp b/lang/qt/tests/t-encrypt.cpp
deleted file mode 100644
index aac49a4b..00000000
--- a/lang/qt/tests/t-encrypt.cpp
+++ /dev/null
@@ -1,333 +0,0 @@
-/* t-encrypt.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include <QDebug>
-#include <QTest>
-#include <QTemporaryDir>
-#include <QSignalSpy>
-#include <QBuffer>
-#include "keylistjob.h"
-#include "encryptjob.h"
-#include "signencryptjob.h"
-#include <gpgme++/signingresult.h>
-#include "encryptjob.h"
-#include <gpgme++/encryptionresult.h>
-#include <gpgme++/decryptionresult.h>
-#include "decryptjob.h"
-#include "qgpgmebackend.h"
-#include <gpgme++/keylistresult.h>
-#include <gpgme++/engineinfo.h>
-#include "verifyopaquejob.h"
-#include "t-support.h"
-
-#define PROGRESS_TEST_SIZE 1 * 1024 * 1024
-
-using namespace QGpgME;
-using namespace GpgME;
-
-
-
-class EncryptionTest : public QGpgMETest
-{
- Q_OBJECT
-
-private Q_SLOTS:
-
- void testSimpleEncryptDecrypt()
- {
- auto listjob = openpgp()->keyListJob(false, false, false);
- std::vector<Key> keys;
- auto keylistresult = listjob->exec(QStringList() << QStringLiteral("[email protected]"),
- false, keys);
- QVERIFY(!keylistresult.error());
- QVERIFY(keys.size() == 1);
- delete listjob;
-
- auto job = openpgp()->encryptJob(/*ASCII Armor */true, /* Textmode */ true);
- QVERIFY(job);
- QByteArray cipherText;
- auto result = job->exec(keys, QStringLiteral("Hello World").toUtf8(), Context::AlwaysTrust, cipherText);
- delete job;
- QVERIFY(!result.error());
- const auto cipherString = QString::fromUtf8(cipherText);
- QVERIFY(cipherString.startsWith("-----BEGIN PGP MESSAGE-----"));
-
- /* Now decrypt */
- if (!loopbackSupported()) {
- return;
- }
- auto decJob = openpgp()->decryptJob();
- hookUpPassphraseProvider(decJob);
- QByteArray plainText;
- auto decResult = decJob->exec(cipherText, plainText);
- QVERIFY(!decResult.error());
- QVERIFY(QString::fromUtf8(plainText) == QStringLiteral("Hello World"));
- delete decJob;
- }
-
- void testProgress()
- {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.15") {
- // We can only test the progress with 2.1.15 as this started to
- // have total progress for memory callbacks
- return;
- }
- auto listjob = openpgp()->keyListJob(false, false, false);
- std::vector<Key> keys;
- auto keylistresult = listjob->exec(QStringList() << QStringLiteral("[email protected]"),
- false, keys);
- QVERIFY(!keylistresult.error());
- QVERIFY(keys.size() == 1);
- delete listjob;
-
- auto job = openpgp()->encryptJob(/*ASCII Armor */false, /* Textmode */ false);
- QVERIFY(job);
- QByteArray plainBa;
- plainBa.fill('X', PROGRESS_TEST_SIZE);
- QByteArray cipherText;
-
- bool initSeen = false;
- bool finishSeen = false;
- connect(job, &Job::jobProgress, this, [&initSeen, &finishSeen] (int current, int total) {
- // We only check for progress 0 and max progress as the other progress
- // lines depend on the system speed and are as such unreliable to test.
- QVERIFY(total == PROGRESS_TEST_SIZE);
- if (current == 0) {
- initSeen = true;
- }
- if (current == total) {
- finishSeen = true;
- }
- QVERIFY(current >= 0 && current <= total);
- });
- connect(job, &Job::rawProgress, this, [&initSeen, &finishSeen] (const QString &what, int type, int current, int total) {
- // `what` is something like "-&12", i.e. a special fd passed to gpg; we only check that it's not empty
- QVERIFY(!what.isEmpty());
- QCOMPARE(type, '?');
- // We only check for progress 0 and max progress as the other progress
- // lines depend on the system speed and are as such unreliable to test.
- QVERIFY(total == PROGRESS_TEST_SIZE);
- if (current == 0) {
- initSeen = true;
- }
- if (current == total) {
- finishSeen = true;
- }
- QVERIFY(current >= 0 && current <= total);
- });
- connect(job, &EncryptJob::result, this, [this, &initSeen, &finishSeen] (const GpgME::EncryptionResult &,
- const QByteArray &,
- const QString,
- const GpgME::Error) {
- QVERIFY(initSeen);
- QVERIFY(finishSeen);
- Q_EMIT asyncDone();
- });
-
- auto inptr = std::shared_ptr<QIODevice>(new QBuffer(&plainBa));
- inptr->open(QIODevice::ReadOnly);
- auto outptr = std::shared_ptr<QIODevice>(new QBuffer(&cipherText));
- outptr->open(QIODevice::WriteOnly);
-
- job->start(keys, inptr, outptr, Context::AlwaysTrust);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
- }
-
- void testSymmetricEncryptDecrypt()
- {
- if (!loopbackSupported()) {
- return;
- }
- auto job = openpgp()->encryptJob();
- hookUpPassphraseProvider(job);
- auto ctx = Job::context(job);
- ctx->setArmor(true);
- ctx->setTextMode(true);
- QByteArray cipherText;
- auto result = job->exec(std::vector<Key>(), QStringLiteral("Hello symmetric World").toUtf8(), Context::AlwaysTrust, cipherText);
- delete job;
- QVERIFY(!result.error());
- const auto cipherString = QString::fromUtf8(cipherText);
- QVERIFY(cipherString.startsWith("-----BEGIN PGP MESSAGE-----"));
-
- killAgent(mDir.path());
-
- auto decJob = openpgp()->decryptJob();
- hookUpPassphraseProvider(decJob);
- QByteArray plainText;
- auto decResult = decJob->exec(cipherText, plainText);
- QVERIFY(!result.error());
- QVERIFY(QString::fromUtf8(plainText) == QStringLiteral("Hello symmetric World"));
- delete decJob;
- }
-
- void testEncryptDecryptNowrap()
- {
- /* Now decrypt */
- if (!loopbackSupported()) {
- return;
- }
- auto listjob = openpgp()->keyListJob(false, false, false);
- std::vector<Key> keys;
- auto keylistresult = listjob->exec(QStringList() << QStringLiteral("[email protected]"),
- false, keys);
- QVERIFY(!keylistresult.error());
- QVERIFY(keys.size() == 1);
- delete listjob;
-
- auto job = openpgp()->signEncryptJob(/*ASCII Armor */true, /* Textmode */ true);
- QVERIFY(job);
- hookUpPassphraseProvider(job);
-
- QByteArray cipherText;
- auto result = job->exec(keys, keys, QStringLiteral("Hello World").toUtf8(), Context::AlwaysTrust, cipherText);
- delete job;
- QVERIFY(!result.first.error());
- QVERIFY(!result.second.error());
- const auto cipherString = QString::fromUtf8(cipherText);
- QVERIFY(cipherString.startsWith("-----BEGIN PGP MESSAGE-----"));
-
- /* Now decrypt */
- if (!loopbackSupported()) {
- return;
- }
-
- auto decJob = openpgp()->decryptJob();
- hookUpPassphraseProvider(decJob);
- auto ctx = Job::context(decJob);
- ctx->setDecryptionFlags(Context::DecryptUnwrap);
-
- QByteArray plainText;
- auto decResult = decJob->exec(cipherText, plainText);
-
- QVERIFY(!decResult.error());
-
- delete decJob;
-
- // Now verify the unwrapeped data.
- auto verifyJob = openpgp()->verifyOpaqueJob(true);
- QByteArray verified;
-
- auto verResult = verifyJob->exec(plainText, verified);
- QVERIFY(!verResult.error());
- delete verifyJob;
-
- QVERIFY(verResult.numSignatures() == 1);
- auto sig = verResult.signatures()[0];
-
- QVERIFY(verified == QStringLiteral("Hello World"));
- }
-
-private:
- /* Loopback and passphrase provider don't work for mixed encryption.
- * So this test is disabled until gnupg(?) is fixed for this. */
- void testMixedEncryptDecrypt()
- {
- if (!loopbackSupported()) {
- return;
- }
- auto listjob = openpgp()->keyListJob(false, false, false);
- std::vector<Key> keys;
- auto keylistresult = listjob->exec(QStringList() << QStringLiteral("[email protected]"),
- false, keys);
- QVERIFY(!keylistresult.error());
- QVERIFY(keys.size() == 1);
- delete listjob;
-
- auto job = openpgp()->encryptJob();
- hookUpPassphraseProvider(job);
- auto ctx = Job::context(job);
- ctx->setArmor(true);
- ctx->setTextMode(true);
- QByteArray cipherText;
- printf("Before exec, flags: %x\n", Context::Symmetric | Context::AlwaysTrust);
- auto result = job->exec(keys, QStringLiteral("Hello symmetric World").toUtf8(),
- static_cast<Context::EncryptionFlags>(Context::Symmetric | Context::AlwaysTrust),
- cipherText);
- printf("After exec\n");
- delete job;
- QVERIFY(!result.error());
- printf("Cipher:\n%s\n", cipherText.constData());
- const auto cipherString = QString::fromUtf8(cipherText);
- QVERIFY(cipherString.startsWith("-----BEGIN PGP MESSAGE-----"));
-
- killAgent(mDir.path());
-
- /* Now create a new homedir which with we test symmetric decrypt. */
- QTemporaryDir tmp;
- qputenv("GNUPGHOME", tmp.path().toUtf8());
- QFile agentConf(tmp.path() + QStringLiteral("/gpg-agent.conf"));
- QVERIFY(agentConf.open(QIODevice::WriteOnly));
- agentConf.write("allow-loopback-pinentry");
- agentConf.close();
-
- auto decJob = openpgp()->decryptJob();
- hookUpPassphraseProvider(decJob);
- auto ctx2 = Job::context(decJob);
- ctx2->setTextMode(true);
- QByteArray plainText;
- auto decResult = decJob->exec(cipherText, plainText);
- QVERIFY(!decResult.error());
- qDebug() << "Plain: " << plainText;
- QVERIFY(QString::fromUtf8(plainText) == QStringLiteral("Hello symmetric World"));
- delete decJob;
-
- killAgent(tmp.path());
- qputenv("GNUPGHOME", mDir.path().toUtf8());
- }
-
-public Q_SLOT:
-
- void initTestCase()
- {
- QGpgMETest::initTestCase();
- const QString gpgHome = qgetenv("GNUPGHOME");
- qputenv("GNUPGHOME", mDir.path().toUtf8());
- QVERIFY(mDir.isValid());
- QFile agentConf(mDir.path() + QStringLiteral("/gpg-agent.conf"));
- QVERIFY(agentConf.open(QIODevice::WriteOnly));
- agentConf.write("allow-loopback-pinentry");
- agentConf.close();
- QVERIFY(copyKeyrings(gpgHome, mDir.path()));
- }
-
-private:
- QTemporaryDir mDir;
-};
-
-QTEST_MAIN(EncryptionTest)
-
-#include "t-encrypt.moc"
diff --git a/lang/qt/tests/t-import.cpp b/lang/qt/tests/t-import.cpp
deleted file mode 100644
index be17a03c..00000000
--- a/lang/qt/tests/t-import.cpp
+++ /dev/null
@@ -1,250 +0,0 @@
-/* t-import.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "t-support.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/engineinfo.h>
-#include "protocol.h"
-#include "importjob.h"
-
-#include <gpgme++/importresult.h>
-
-#include <QDebug>
-#include <QSignalSpy>
-#include <QTemporaryDir>
-#include <QTest>
-
-#include <memory>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-class ImportTest : public QGpgMETest
-{
- Q_OBJECT
-
-private:
- QTemporaryDir tempGpgHome;
-
-private Q_SLOTS:
- void initTestCase()
- {
- QGpgMETest::initTestCase();
- QVERIFY2(tempGpgHome.isValid(), "Failed to create temporary GNUPGHOME");
- qputenv("GNUPGHOME", tempGpgHome.path().toLocal8Bit());
- }
-
- void testImportWithImportFilter()
- {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.14") {
- QSKIP("gpg does not yet support the --import-filter option");
- }
-
- // pub ed25519 2021-12-15 [SC]
- // E7A0841292ACC9465D3142652FB3A6F51FBF28A2
- // uid [ultimate] [email protected]
- // uid [ultimate] [email protected]
- // sub cv25519 2021-12-15 [E]
- static const char keyFpr[] = "E7A0841292ACC9465D3142652FB3A6F51FBF28A2";
- static const char keyData[] =
- "-----BEGIN PGP PUBLIC KEY BLOCK-----\n"
- "\n"
- "mDMEYbm2PhYJKwYBBAHaRw8BAQdACzxBWtNNsmJ6rzpZkjh1yBe+Ajsk9NR8umEu\n"
- "Da3HLgG0ImltcG9ydFdpdGhJbXBvcnRGaWx0ZXJAZXhhbXBsZS5uZXSIlAQTFgoA\n"
- "PBYhBOeghBKSrMlGXTFCZS+zpvUfvyiiBQJhubY+AhsDBQsJCAcCAyICAQYVCgkI\n"
- "CwIEFgIDAQIeBwIXgAAKCRAvs6b1H78oosRgAQCc/ke6q076nvzIE2UzT83JK/B6\n"
- "lxSV7Fb8bKltOMpvsAD+Phap3EzA8jdMyKoO0FM926bw5lX7QROfeZ/JBYqyPwC0\n"
- "ImltcG9ydFdpdGhJbXBvcnRGaWx0ZXJAZXhhbXBsZS5jb22IlAQTFgoAPBYhBOeg\n"
- "hBKSrMlGXTFCZS+zpvUfvyiiBQJhubZlAhsDBQsJCAcCAyICAQYVCgkICwIEFgID\n"
- "AQIeBwIXgAAKCRAvs6b1H78oohPWAQC/u9UXzkxRkrB2huaTZCsyimWEGZIMmxWd\n"
- "tE+vN9/IvQD/Yzia+xRS6yca3Yz6iW8xS844ZqRxvkUEHjtJXSOzagm4OARhubY+\n"
- "EgorBgEEAZdVAQUBAQdANQFjmDctY3N0/ELPZtj9tapwFs4vrmTVpx/SCfZmihkD\n"
- "AQgHiHgEGBYKACAWIQTnoIQSkqzJRl0xQmUvs6b1H78oogUCYbm2PgIbDAAKCRAv\n"
- "s6b1H78oovGyAP41ySzvvDpV7XDJBOAFxvWLmywa5IcO7Lrg7y1efoWj0AD+Kk/B\n"
- "s7jGLdoG51h670h50MMoYCANB6MwAdSP+qZUlQg=\n"
- "=/3O0\n"
- "-----END PGP PUBLIC KEY BLOCK-----\n";
-
- auto *job = openpgp()->importJob();
- job->setImportFilter(QLatin1String{"keep-uid=mbox = [email protected]"});
- connect(job, &ImportJob::result, this,
- [this](ImportResult result, QString, Error)
- {
- QVERIFY(!result.error());
- QVERIFY(!result.imports().empty());
- QVERIFY(result.numImported());
- Q_EMIT asyncDone();
- });
- job->start(QByteArray{keyData});
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait());
-
- auto ctx = std::unique_ptr<GpgME::Context>(Context::createForProtocol(GpgME::OpenPGP));
- GpgME::Error err;
- const auto key = ctx->key(keyFpr, err, false);
- QVERIFY(!key.isNull());
- QCOMPARE(key.numUserIDs(), 1u);
- QCOMPARE(key.userID(0).id(), "[email protected]");
- }
-
- void testImportWithImportOptions()
- {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.23") {
- QSKIP("gpg does not yet support --import-options show-only");
- }
-
- // pub ed25519 2024-06-12 [SC]
- // A52F4947AF1506F3A7572EFC140278B773CA7C16
- static const char keyFpr[] = "A52F4947AF1506F3A7572EFC140278B773CA7C16";
- static const char keyData[] =
- "-----BEGIN PGP PUBLIC KEY BLOCK-----\n"
- "\n"
- "mDMEZmlpmBYJKwYBBAHaRw8BAQdAZaSopKwccTwnMlJBVCWMT6et1T1WF9EkXdJi\n"
- "gzI74xW0GWltcG9ydE9wdGlvbnNAZXhhbXBsZS5uZXSIkwQTFgoAOxYhBKUvSUev\n"
- "FQbzp1cu/BQCeLdzynwWBQJmaWmYAhsDBQsJCAcCAiICBhUKCQgLAgQWAgMBAh4H\n"
- "AheAAAoJEBQCeLdzynwWjmQBAP4dQEN/M4/dKIAlxNAbWzIkV+eSoUFLJszOJ/xx\n"
- "FwJzAP43gkdXkUsHZt/U3mLZqtiHJFd7JxVm7hKRoAVBhZZYDw==\n"
- "=7Z1j\n"
- "-----END PGP PUBLIC KEY BLOCK-----\n";
-
- auto *job = openpgp()->importJob();
- job->setImportOptions({QStringLiteral("show-only")});
- connect(job, &ImportJob::result, this,
- [this](ImportResult result, QString, Error)
- {
- QVERIFY(!result.error());
- QCOMPARE(result.numConsidered(), 0);
- QCOMPARE(result.numImported(), 0);
- QVERIFY(result.imports().empty());
- Q_EMIT asyncDone();
- });
- job->start(QByteArray{keyData});
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait());
-
- auto ctx = std::unique_ptr<GpgME::Context>(Context::createForProtocol(GpgME::OpenPGP));
- GpgME::Error err;
- const auto key = ctx->key(keyFpr, err, false);
- QVERIFY(key.isNull());
- }
-
- void testImportWithKeyOrigin()
- {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.22") {
- QSKIP("gpg does not yet support the --key-origin option");
- }
-
- static const char keyFpr[] = "5C5C428FABCC20F6913464BCCA6FB442887289B3";
- static const char keyData[] =
- "-----BEGIN PGP PUBLIC KEY BLOCK-----\n"
- "\n"
- "mDMEYbhuixYJKwYBBAHaRw8BAQdAulOM3IksCjdOJluEVlwalD8oZ5oa6wCw3EgW\n"
- "NswXXb60H2ltcG9ydFdpdGhLZXlPcmlnaW5AZXhhbXBsZS5uZXSIlAQTFgoAPBYh\n"
- "BFxcQo+rzCD2kTRkvMpvtEKIcomzBQJhuG6LAhsDBQsJCAcCAyICAQYVCgkICwIE\n"
- "FgIDAQIeBwIXgAAKCRDKb7RCiHKJs+cIAQDaeoOw1OCAGpZQb8xJmLJHul5dLLzU\n"
- "RBdHauMx9NROmQEA23QUVedc7walQjNKFzyIJA/YqRdbAKPiLonRBmxk9Ay4OARh\n"
- "uG6LEgorBgEEAZdVAQUBAQdAMVdO9mNWIP/q8PtNOnBGlPyhx/vs07sF5sXk50A+\n"
- "61QDAQgHiHgEGBYKACAWIQRcXEKPq8wg9pE0ZLzKb7RCiHKJswUCYbhuiwIbDAAK\n"
- "CRDKb7RCiHKJs/x6AP0SEbZqW4iLCz2i1JntQghK5qpSZOVqsBTcARd6pcJ/cwEA\n"
- "mrwskWazuS9+GVbHT5RATWOXnGaj+AICSDPE6qHtGgA=\n"
- "=putz\n"
- "-----END PGP PUBLIC KEY BLOCK-----\n";
-
- auto *job = openpgp()->importJob();
- job->setKeyOrigin(GpgME::Key::OriginWKD, "https://example.net");
- connect(job, &ImportJob::result, this,
- [this](ImportResult result, QString, Error)
- {
- QVERIFY(!result.error());
- QVERIFY(!result.imports().empty());
- QVERIFY(result.numImported());
- Q_EMIT asyncDone();
- });
- job->start(QByteArray{keyData});
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait());
-
- auto ctx = std::unique_ptr<GpgME::Context>(Context::createForProtocol(GpgME::OpenPGP));
- GpgME::Error err;
- const auto key = ctx->key(keyFpr, err, false);
- QVERIFY(!key.isNull());
- QVERIFY(key.origin() == Key::OriginWKD);
- // the origin URL is currently not available in GpgME
- }
-
- void testDeferredStart()
- {
- // pub ed25519 2023-01-05 [SC]
- // 4D1367FE9AF6334D8A55BA635A817A94C7B37E5D
- static const char keyFpr[] = "4D1367FE9AF6334D8A55BA635A817A94C7B37E5D";
- static const char keyData[] =
- "-----BEGIN PGP PUBLIC KEY BLOCK-----\n"
- "\n"
- "mDMEY7bNSxYJKwYBBAHaRw8BAQdAazIWyd/xEMeObDSUnh2+AXQuo0oM+TDBG49z\n"
- "KHvTAYG0GmltcG9ydERlZmVycmVkQGV4YW1wbGUubmV0iJMEExYKADsWIQRNE2f+\n"
- "mvYzTYpVumNagXqUx7N+XQUCY7bNSwIbAwULCQgHAgIiAgYVCgkICwIEFgIDAQIe\n"
- "BwIXgAAKCRBagXqUx7N+XasrAP4qPzLzPd6tWDZvP29ZYPTSrjrTb0U5MOJeIPKX\n"
- "73jZswEAwWRvgH+GmhTOigw0UVtinAFvUEFVyvcW/GR19mw5XA0=\n"
- "=JnpA\n"
- "-----END PGP PUBLIC KEY BLOCK-----\n";
-
- auto *job = openpgp()->importJob();
- job->startLater(QByteArray{keyData});
- connect(job, &ImportJob::result, this,
- [this](ImportResult result, QString, Error)
- {
- QVERIFY(!result.error());
- QVERIFY(!result.imports().empty());
- QVERIFY(result.numImported());
- Q_EMIT asyncDone();
- });
- job->startNow();
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait());
-
- auto ctx = std::unique_ptr<GpgME::Context>(Context::createForProtocol(GpgME::OpenPGP));
- GpgME::Error err;
- const auto key = ctx->key(keyFpr, err, false);
- QVERIFY(!key.isNull());
- }
-};
-
-QTEST_MAIN(ImportTest)
-
-#include "t-import.moc"
diff --git a/lang/qt/tests/t-keylist.cpp b/lang/qt/tests/t-keylist.cpp
deleted file mode 100644
index 75bc4120..00000000
--- a/lang/qt/tests/t-keylist.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/* t-keylist.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include <QDebug>
-#include <QTest>
-#include <QSignalSpy>
-#include <QMap>
-#include "keylistjob.h"
-#include "listallkeysjob.h"
-#include "qgpgmebackend.h"
-#include <gpgme++/keylistresult.h>
-
-#include <gpgme++/context.h>
-#include <gpgme++/engineinfo.h>
-
-#include <memory>
-
-#include "t-support.h"
-
-using namespace QGpgME;
-using namespace GpgME;
-
-class KeyListTest : public QGpgMETest
-{
- Q_OBJECT
-
-private Q_SLOTS:
- void testSingleKeyListSync()
- {
- KeyListJob *job = openpgp()->keyListJob(false, false, false);
- std::vector<GpgME::Key> keys;
- GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("[email protected]"),
- false, keys);
- delete job;
- QVERIFY (!result.error());
- QVERIFY (keys.size() == 1);
- const QString kId = QLatin1String(keys.front().keyID());
- QVERIFY (kId == QStringLiteral("2D727CC768697734"));
-
- QVERIFY (keys[0].subkeys().size() == 2);
- QVERIFY (keys[0].subkeys()[0].publicKeyAlgorithm() == Subkey::AlgoDSA);
- QVERIFY (keys[0].subkeys()[1].publicKeyAlgorithm() == Subkey::AlgoELG_E);
- }
-
- // This test can help with valgrind to check for memleaks when handling
- // keys
- void testGetKey()
- {
- GpgME::Key key;
- {
- auto ctx = std::unique_ptr<GpgME::Context> (GpgME::Context::createForProtocol(GpgME::OpenPGP));
- ctx->setKeyListMode (GpgME::KeyListMode::Local |
- GpgME::KeyListMode::Signatures |
- GpgME::KeyListMode::Validate |
- GpgME::KeyListMode::WithTofu);
- GpgME::Error err;
- key = ctx->key ("A0FF4590BB6122EDEF6E3C542D727CC768697734", err, false);
- }
- QVERIFY(key.primaryFingerprint());
- QVERIFY(!strcmp(key.primaryFingerprint(), "A0FF4590BB6122EDEF6E3C542D727CC768697734"));
- {
- auto ctx = std::unique_ptr<GpgME::Context> (GpgME::Context::createForProtocol(GpgME::OpenPGP));
- ctx->setKeyListMode (GpgME::KeyListMode::Local |
- GpgME::KeyListMode::Signatures |
- GpgME::KeyListMode::Validate |
- GpgME::KeyListMode::WithTofu);
- GpgME::Error err;
- key = ctx->key ("A0FF4590BB6122EDEF6E3C542D727CC768697734", err, false);
- }
- QVERIFY(key.primaryFingerprint());
- QVERIFY(!strcmp(key.primaryFingerprint(), "A0FF4590BB6122EDEF6E3C542D727CC768697734"));
- }
-
- void testPubkeyAlgoAsString()
- {
- static const QMap<Subkey::PubkeyAlgo, QString> expected {
- { Subkey::AlgoRSA, QStringLiteral("RSA") },
- { Subkey::AlgoRSA_E, QStringLiteral("RSA-E") },
- { Subkey::AlgoRSA_S, QStringLiteral("RSA-S") },
- { Subkey::AlgoELG_E, QStringLiteral("ELG-E") },
- { Subkey::AlgoDSA, QStringLiteral("DSA") },
- { Subkey::AlgoECC, QStringLiteral("ECC") },
- { Subkey::AlgoELG, QStringLiteral("ELG") },
- { Subkey::AlgoECDSA, QStringLiteral("ECDSA") },
- { Subkey::AlgoECDH, QStringLiteral("ECDH") },
- { Subkey::AlgoEDDSA, QStringLiteral("EdDSA") },
- { Subkey::AlgoUnknown, QString() }
- };
- for (Subkey::PubkeyAlgo algo : expected.keys()) {
- QVERIFY(QString::fromUtf8(Subkey::publicKeyAlgorithmAsString(algo)) ==
- expected.value(algo));
- }
- }
-
- void testKeyListAsync()
- {
- KeyListJob *job = openpgp()->keyListJob();
- connect(job, &KeyListJob::result, job, [this, job](KeyListResult, std::vector<Key> keys, QString, Error)
- {
- QVERIFY(keys.size() == 1);
- Q_EMIT asyncDone();
- });
- job->start(QStringList() << "[email protected]");
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
- }
-
- void testListAllKeysSync()
- {
- const auto accumulateFingerprints = [](std::vector<std::string> &v, const Key &key) { v.push_back(std::string(key.primaryFingerprint())); return v; };
-
- ListAllKeysJob *job = openpgp()->listAllKeysJob(/* includeSigs= */false, /* validate= */false);
- std::vector<GpgME::Key> pubKeys, secKeys;
- GpgME::KeyListResult result = job->exec(pubKeys, secKeys, /* mergeKeys= */false); // mergeKeys is unused for GnuPG >= 2.1
- delete job;
- QVERIFY(!result.error());
-
- QCOMPARE(secKeys.size(), static_cast<decltype(secKeys.size())>(2));
- std::vector<std::string> secKeyFingerprints = std::accumulate(secKeys.begin(), secKeys.end(), std::vector<std::string>(), accumulateFingerprints);
- QCOMPARE(secKeyFingerprints, std::vector<std::string>({
- "23FD347A419429BACCD5E72D6BC4778054ACD246",
- "A0FF4590BB6122EDEF6E3C542D727CC768697734"
- }));
- QVERIFY(secKeys[0].hasSecret());
- if (!(GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.0")) {
- QVERIFY(secKeys[0].subkeys()[0].keyGrip());
- }
-
- QCOMPARE(pubKeys.size(), static_cast<decltype(pubKeys.size())>(26));
- std::vector<std::string> pubKeyFingerprints = std::accumulate(pubKeys.begin(), pubKeys.end(), std::vector<std::string>(), accumulateFingerprints);
- QCOMPARE(pubKeyFingerprints, std::vector<std::string>({
- "045B2334ADD69FC221076841A5E67F7FA3AE3EA1",
- "04C1DF62EFA0EBB00519B06A8979A6C5567FB34A",
- "0DBCAD3F08843B9557C6C4D4A94C0F75653244D6",
- "1DDD28CEF714F5B03B8C246937CAB51FB79103F8",
- "23FD347A419429BACCD5E72D6BC4778054ACD246",
- "2686AA191A278013992C72EBBE794852BE5CF886",
- "3531152DE293E26A07F504BC318C1FAEFAEF6D1B",
- "38FBE1E4BF6A5E1242C8F6A13BDBEDB1777FBED3",
- "3FD11083779196C2ECDD9594AD1B0FAD43C2D0C7",
- "43929E89F8F79381678CAE515F6356BA6D9732AC",
- "56D33268F7FE693FBB594762D4BF57F37372E243",
- "5AB9D6D7BAA1C95B3BAA3D9425B00FD430CEC684",
- "61EE841A2A27EB983B3B3C26413F4AF31AFDAB6C",
- "6560C59C43D031C54D7C588EEBA9F240EB9DC9E6",
- "6FAA9C201E5E26DCBAEC39FD5D15E01D3FF13206",
- "9E91CBB11E4D4135583EF90513DB965534C6E3F1",
- "A0FF4590BB6122EDEF6E3C542D727CC768697734",
- "A7969DA1C3297AA96D49843F1C67EC133C661C84",
- "C9C07DCC6621B9FB8D071B1D168410A48FC282E6",
- "CD538D6CC9FB3D745ECDA5201FE8FC6F04259677",
- "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2",
- "E8143C489C8D41124DC40D0B47AF4B6961F04784",
- "E8D6C90B683B0982BD557A99DEF0F7B8EC67DBDE",
- "ECAC774F4EEEB0620767044A58CB9A4C85A81F38",
- "ED9B316F78644A58D042655A9EEF34CD4B11B25F",
- "F8F1EDC73995AB739AD54B380C820C71D2699313"
- }));
- if (!(GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.0")) {
- // with GnuPG >= 2.1 the job always lists keys with --with-keygrip and --with-secret,
- // i.e. the key grips and information about secret keys are always available
- QVERIFY(!pubKeys[0].hasSecret());
- QVERIFY(pubKeys[0].subkeys()[0].keyGrip());
-
- QVERIFY(pubKeys[4].hasSecret());
- QVERIFY(pubKeys[4].subkeys()[0].keyGrip());
- }
- }
-};
-
-QTEST_MAIN(KeyListTest)
-
-#include "t-keylist.moc"
diff --git a/lang/qt/tests/t-keylocate.cpp b/lang/qt/tests/t-keylocate.cpp
deleted file mode 100644
index 88062f50..00000000
--- a/lang/qt/tests/t-keylocate.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/* t-keylocate.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include <QDebug>
-#include <QTest>
-#include <QSignalSpy>
-#include <QTemporaryDir>
-#include "keylistjob.h"
-#include "protocol.h"
-#include <gpgme++/keylistresult.h>
-#include <gpgme++/engineinfo.h>
-
-#include "t-support.h"
-
-using namespace QGpgME;
-using namespace GpgME;
-
-class KeyLocateTest : public QGpgMETest
-{
- Q_OBJECT
-
-private Q_SLOTS:
-
-#ifdef DO_ONLINE_TESTS
- void testDaneKeyLocate()
- {
- QTemporaryDir dir;
- const QString oldHome = qgetenv("GNUPGHOME");
- qputenv("GNUPGHOME", dir.path().toUtf8());
- /* Could do this with gpgconf but this is not a gpgconf test ;-) */
- QFile conf(dir.path() + QStringLiteral("/gpg.conf"));
- QVERIFY(conf.open(QIODevice::WriteOnly));
- conf.write("auto-key-locate dane");
- conf.close();
-
- auto *job = openpgp()->locateKeysJob();
- mTestpattern = QStringLiteral("[email protected]");
- connect(job, &KeyListJob::result, job, [this, job](KeyListResult result, std::vector<Key> keys, QString, Error)
- {
- QVERIFY(!result.error());
- QVERIFY(keys.size() == 1);
-
- Key k = keys.front();
- QVERIFY(k.numUserIDs());
- bool found = false;
- for (const UserID &uid : k.userIDs()) {
- const QString mailBox = QString::fromUtf8(uid.email());
- if (mTestpattern.toLower() == mailBox.toLower()) {
- found = true;
- }
- }
- QVERIFY(found);
- Q_EMIT asyncDone();
- });
- job->start(QStringList() << mTestpattern);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
- qputenv("GNUPGHOME", oldHome.toUtf8());
- }
-#endif
-
- void testKeyLocateSingle()
- {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.0.10") {
- return;
- }
- auto *job = openpgp()->locateKeysJob();
- mTestpattern = QStringLiteral("[email protected]");
-
- connect(job, &KeyListJob::result, job, [this, job](KeyListResult result, std::vector<Key> keys, QString, Error)
- {
- QVERIFY(!result.isNull());
- QVERIFY(!result.isTruncated());
- QVERIFY(!result.error());
- QVERIFY(keys.size() == 1);
-
- Key k = keys.front();
- QVERIFY(k.numUserIDs());
- bool found = false;
- for (const UserID &uid : k.userIDs()) {
- const QString mailBox = QString::fromUtf8(uid.email());
- if (mTestpattern.toLower() == mailBox.toLower()) {
- found = true;
- }
- }
- QVERIFY(found);
- Q_EMIT asyncDone();
- });
- job->start(QStringList() << mTestpattern);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
- }
-
-private:
- QString mTestpattern;
-};
-
-QTEST_MAIN(KeyLocateTest)
-
-#include "t-keylocate.moc"
diff --git a/lang/qt/tests/t-ownertrust.cpp b/lang/qt/tests/t-ownertrust.cpp
deleted file mode 100644
index a032dfbd..00000000
--- a/lang/qt/tests/t-ownertrust.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/* t-ownertrust.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include <QDebug>
-#include <QTest>
-#include <QSignalSpy>
-#include "debug.h"
-#include "keylistjob.h"
-#include "protocol.h"
-#include <gpgme++/keylistresult.h>
-#include "changeownertrustjob.h"
-
-#include "t-support.h"
-
-using namespace QGpgME;
-using namespace GpgME;
-
-class ChangeOwnerTrustTest: public QGpgMETest
-{
- Q_OBJECT
-
-private Q_SLOTS:
-
- void testChangeOwnerTrust()
- {
- KeyListJob *job = openpgp()->keyListJob(false, true, true);
- std::vector<GpgME::Key> keys;
- GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("[email protected]"),
- false, keys);
- delete job;
- QVERIFY (!result.error());
- QVERIFY (keys.size() == 1);
- Key key = keys.front();
- QVERIFY (key.ownerTrust() == Key::Unknown);
-
- ChangeOwnerTrustJob *job2 = openpgp()->changeOwnerTrustJob();
- connect(job2, &ChangeOwnerTrustJob::result, this, [this](Error e)
- {
- if (e) {
- qDebug() << "Error in result: " << e;
- }
- QVERIFY(!e);
- Q_EMIT asyncDone();
- });
- job2->start(key, Key::Ultimate);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- job = openpgp()->keyListJob(false, true, true);
- result = job->exec(QStringList() << QStringLiteral("[email protected]"),
- false, keys);
- delete job;
- key = keys.front();
- QVERIFY (key.ownerTrust() == Key::Ultimate);
-
- ChangeOwnerTrustJob *job3 = openpgp()->changeOwnerTrustJob();
- connect(job3, &ChangeOwnerTrustJob::result, this, [this](Error e)
- {
- if (e) {
- qDebug() << "Error in result: " << e;
- }
- QVERIFY(!e);
- Q_EMIT asyncDone();
- });
- job3->start(key, Key::Unknown);
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- job = openpgp()->keyListJob(false, true, true);
- result = job->exec(QStringList() << QStringLiteral("[email protected]"),
- false, keys);
- delete job;
-
- key = keys.front();
- QVERIFY (key.ownerTrust() == Key::Unknown);
- }
-};
-
-QTEST_MAIN(ChangeOwnerTrustTest)
-
-#include "t-ownertrust.moc"
diff --git a/lang/qt/tests/t-remarks.cpp b/lang/qt/tests/t-remarks.cpp
deleted file mode 100644
index b7de4ac4..00000000
--- a/lang/qt/tests/t-remarks.cpp
+++ /dev/null
@@ -1,472 +0,0 @@
-/* t-remarks.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2017 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include <QDebug>
-#include <QTest>
-#include <QSignalSpy>
-#include <QTemporaryDir>
-#include "debug.h"
-#include "keylistjob.h"
-#include "protocol.h"
-#include "signkeyjob.h"
-#include <gpgme++/context.h>
-#include <gpgme++/engineinfo.h>
-
-#include "t-support.h"
-
-using namespace QGpgME;
-using namespace GpgME;
-
-class TestRemarks: public QGpgMETest
-{
- Q_OBJECT
-
-public:
- // This test is disabled (no slot) because the behavior
- // is not clearly defined. Better to prevent that
- // case in the UI
- void testRemarkOwnKey()
- {
- if (!loopbackSupported()) {
- return;
- }
- // Get the signing key (alfa)
- auto ctx = Context::create(OpenPGP);
- QVERIFY (ctx);
- Error err;
- auto seckey = ctx->key("A0FF4590BB6122EDEF6E3C542D727CC768697734", err, true);
- QVERIFY (!seckey.isNull());
- QVERIFY (!err);
-
- // Create the job
- auto job = openpgp()->signKeyJob();
- QVERIFY (job);
- hookUpPassphraseProvider(job);
-
- // Set up the job
- job->setExportable(false);
- std::vector<unsigned int> uids;
- uids.push_back(0);
- job->setUserIDsToSign(uids);
- job->setSigningKey(seckey);
- job->setRemark(QStringLiteral("Just GNU it!"));
- job->setDupeOk(true);
-
- connect(job, &SignKeyJob::result, this, [this] (const GpgME::Error &err2,
- const QString,
- const GpgME::Error) {
- Q_EMIT asyncDone();
- if (err2) {
- qDebug() << "Error: " << err2;
- }
- QVERIFY(err2);
- });
-
- job->start(seckey);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
- }
-
-
-private Q_SLOTS:
-
- void testRemarkReplaceSingleUIDExportable()
- {
- if (!loopbackSupported()) {
- return;
- }
- // Get the signing key (alfa)
- auto ctx = Context::create(OpenPGP);
- QVERIFY (ctx);
- Error err;
- auto seckey = ctx->key("A0FF4590BB6122EDEF6E3C542D727CC768697734", err, true);
- QVERIFY (!seckey.isNull());
- QVERIFY (!err);
-
- // Get the target key (tango)
- auto target = ctx->key("ECAC774F4EEEB0620767044A58CB9A4C85A81F38", err, false);
- QVERIFY (!target.isNull());
- QVERIFY (!err);
- QVERIFY (target.numUserIDs());
-
- // Create the job
- auto job = openpgp()->signKeyJob();
- QVERIFY (job);
- hookUpPassphraseProvider(job);
-
- // Set up the job
- job->setExportable(true);
- std::vector<unsigned int> uids;
- uids.push_back(0);
- job->setUserIDsToSign(uids);
- job->setSigningKey(seckey);
- job->setRemark(QStringLiteral("The quick brown fox jumps over the lazy dog"));
-
- connect(job, &SignKeyJob::result, this, [this] (const GpgME::Error &err2,
- const QString,
- const GpgME::Error) {
- Q_EMIT asyncDone();
- QVERIFY(!err2);
- });
-
- job->start(target);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- // At this point the remark should have been added.
- target.update();
- const char *remark = target.userID(0).remark(seckey, err);
- QVERIFY(!err);
- QVERIFY(remark);
- QCOMPARE(QString::fromUtf8(remark), QStringLiteral("The quick brown fox "
- "jumps over the lazy dog"));
-
- // Now replace the remark
- auto job3 = openpgp()->signKeyJob();
- QVERIFY (job3);
- hookUpPassphraseProvider(job3);
-
- // Set up the job
- job3->setExportable(false);
- job3->setUserIDsToSign(uids);
- job3->setSigningKey(seckey);
- job3->setDupeOk(true);
- job3->setRemark(QStringLiteral("The quick brown fox fails to jump over Frodo"));
-
- connect(job3, &SignKeyJob::result, this, [this] (const GpgME::Error &err2,
- const QString,
- const GpgME::Error) {
- Q_EMIT asyncDone();
- QVERIFY(!err2);
- });
-
- job3->start(target);
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- target.update();
- remark = target.userID(0).remark(seckey, err);
- QVERIFY(!err);
- QVERIFY(remark);
- QCOMPARE(QString::fromUtf8(remark), QStringLiteral("The quick brown fox fails "
- "to jump over Frodo"));
- }
-
-
- void testMultipleRemarks()
- {
- if (!loopbackSupported()) {
- return;
- }
- // Get the signing key1 (alfa)
- auto ctx = Context::create(OpenPGP);
- QVERIFY (ctx);
- Error err;
- auto alpha = ctx->key("A0FF4590BB6122EDEF6E3C542D727CC768697734", err, true);
- QVERIFY (!alpha.isNull());
- QVERIFY (!err);
-
- // Get the signing key2 (zulu)
- auto zulu = ctx->key("23FD347A419429BACCD5E72D6BC4778054ACD246", err, true);
- QVERIFY (!zulu.isNull());
- QVERIFY (!err);
-
- // Get the target key (victor)
- auto target = ctx->key("E8143C489C8D41124DC40D0B47AF4B6961F04784", err, false);
- QVERIFY (!target.isNull());
- QVERIFY (!err);
- QVERIFY (target.numUserIDs());
-
- // Create the job
- auto job = openpgp()->signKeyJob();
- QVERIFY (job);
- hookUpPassphraseProvider(job);
-
- // Setup the first job
- job->setExportable(false);
- std::vector<unsigned int> uids;
- uids.push_back(0);
- job->setUserIDsToSign(uids);
- job->setSigningKey(alpha);
- job->setRemark(QStringLiteral("String one"));
-
- connect(job, &SignKeyJob::result, this, [this] (const GpgME::Error &err2,
- const QString,
- const GpgME::Error) {
- Q_EMIT asyncDone();
- QVERIFY(!err2);
- });
- job->start(target);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- // Now another remark from zulu
- auto job3 = openpgp()->signKeyJob();
- QVERIFY (job3);
- hookUpPassphraseProvider(job3);
-
- // Set up the job
- job3->setExportable(false);
- job3->setUserIDsToSign(uids);
- job3->setSigningKey(zulu);
- job3->setDupeOk(true);
- job3->setRemark(QStringLiteral("String two"));
-
- connect(job3, &SignKeyJob::result, this, [this] (const GpgME::Error &err2,
- const QString,
- const GpgME::Error) {
- Q_EMIT asyncDone();
- QVERIFY(!err2);
- });
-
- job3->start(target);
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- target.update();
- std::vector<GpgME::Key> keys;
- keys.push_back(alpha);
- keys.push_back(zulu);
-
- const auto remarks = target.userID(0).remarks(keys, err);
-
- QVERIFY(!err);
- QVERIFY(remarks.size() == 2);
- QCOMPARE(remarks[0], std::string("String one"));
- QCOMPARE(remarks[1], std::string("String two"));
- }
-
- void testRemarkReplaceSingleUID()
- {
- if (!loopbackSupported()) {
- return;
- }
- // Get the signing key (alfa)
- auto ctx = Context::create(OpenPGP);
- QVERIFY (ctx);
- Error err;
- auto seckey = ctx->key("A0FF4590BB6122EDEF6E3C542D727CC768697734", err, true);
- QVERIFY (!seckey.isNull());
- QVERIFY (!err);
-
- // Get the target key (xray)
- auto target = ctx->key("04C1DF62EFA0EBB00519B06A8979A6C5567FB34A", err, false);
- QVERIFY (!target.isNull());
- QVERIFY (!err);
- QVERIFY (target.numUserIDs());
-
- // Create the job
- auto job = openpgp()->signKeyJob();
- QVERIFY (job);
- hookUpPassphraseProvider(job);
-
- // Set up the job
- job->setExportable(false);
- std::vector<unsigned int> uids;
- uids.push_back(0);
- job->setUserIDsToSign(uids);
- job->setSigningKey(seckey);
- job->setRemark(QStringLiteral("The quick brown fox jumps over the lazy dog"));
-
- connect(job, &SignKeyJob::result, this, [this] (const GpgME::Error &err2,
- const QString,
- const GpgME::Error) {
- Q_EMIT asyncDone();
- QVERIFY(!err2);
- });
-
- job->start(target);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- // At this point the remark should have been added.
- target.update();
- const char *remark = target.userID(0).remark(seckey, err);
- QVERIFY(!err);
- QVERIFY(remark);
- QCOMPARE(QString::fromUtf8(remark), QStringLiteral("The quick brown fox "
- "jumps over the lazy dog"));
-
- // Now replace the remark
- auto job3 = openpgp()->signKeyJob();
- QVERIFY (job3);
- hookUpPassphraseProvider(job3);
-
- // Set up the job
- job3->setExportable(false);
- job3->setUserIDsToSign(uids);
- job3->setSigningKey(seckey);
- job3->setDupeOk(true);
- job3->setRemark(QStringLiteral("The quick brown fox jumps over Frodo"));
-
- connect(job3, &SignKeyJob::result, this, [this] (const GpgME::Error &err2,
- const QString,
- const GpgME::Error) {
- Q_EMIT asyncDone();
- QVERIFY(!err2);
- });
-
- job3->start(target);
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- target.update();
- remark = target.userID(0).remark(seckey, err);
- QVERIFY(!err);
- QVERIFY(remark);
- QCOMPARE(QString::fromUtf8(remark), QStringLiteral("The quick brown fox "
- "jumps over Frodo"));
- }
-
- void testRemarkReplaceMultiUID()
- {
- if (!loopbackSupported()) {
- return;
- }
- // Get the signing key (alfa)
- auto ctx = Context::create(OpenPGP);
- QVERIFY (ctx);
- Error err;
- auto seckey = ctx->key("A0FF4590BB6122EDEF6E3C542D727CC768697734", err, true);
- QVERIFY (!seckey.isNull());
- QVERIFY (!err);
-
- // Get the target key (mallory / mike)
- auto target = ctx->key("2686AA191A278013992C72EBBE794852BE5CF886", err, false);
- QVERIFY (!target.isNull());
- QVERIFY (!err);
- QVERIFY (target.numUserIDs());
-
- // Create the job
- auto job = openpgp()->signKeyJob();
- QVERIFY (job);
- hookUpPassphraseProvider(job);
-
- // Set up the job
- job->setExportable(false);
- std::vector<unsigned int> uids;
- uids.push_back(0);
- job->setUserIDsToSign(uids);
- job->setSigningKey(seckey);
- job->setRemark(QStringLiteral("Mallory is evil 😠"));
-
- connect(job, &SignKeyJob::result, this, [this] (const GpgME::Error &err2,
- const QString,
- const GpgME::Error) {
- Q_EMIT asyncDone();
- QVERIFY(!err2);
- });
-
- job->start(target);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- // At this point the remark should have been added.
- target.update();
- const char *remark = target.userID(0).remark(seckey, err);
- QVERIFY(!err);
- QVERIFY(remark);
- QCOMPARE(QString::fromUtf8(remark), QStringLiteral("Mallory is evil 😠"));
-
- // Try to replace it without dupeOK
- auto job2 = openpgp()->signKeyJob();
- QVERIFY (job2);
- hookUpPassphraseProvider(job2);
-
- // Set up the job
- job2->setExportable(false);
- job2->setUserIDsToSign(uids);
- job2->setSigningKey(seckey);
- job2->setRemark(QStringLiteral("Mallory is nice"));
-
- connect(job2, &SignKeyJob::result, this, [this] (const GpgME::Error &err2,
- const QString,
- const GpgME::Error) {
- Q_EMIT asyncDone();
- QVERIFY(err2);
- });
-
- job2->start(target);
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- // Now replace the remark
- auto job3 = openpgp()->signKeyJob();
- QVERIFY (job3);
- hookUpPassphraseProvider(job3);
-
- // Set up the job
- job3->setExportable(false);
- job3->setUserIDsToSign(uids);
- job3->setSigningKey(seckey);
- job3->setDupeOk(true);
- job3->setRemark(QStringLiteral("Mallory is nice"));
-
- connect(job3, &SignKeyJob::result, this, [this] (const GpgME::Error &err2,
- const QString,
- const GpgME::Error) {
- Q_EMIT asyncDone();
- QVERIFY(!err2);
- });
-
- job3->start(target);
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- target.update();
- remark = target.userID(0).remark(seckey, err);
- QVERIFY(!err);
- QVERIFY(remark);
- QCOMPARE(QString::fromUtf8(remark), QStringLiteral("Mallory is nice"));
- }
-
- void initTestCase()
- {
- QGpgMETest::initTestCase();
- const QString gpgHome = qgetenv("GNUPGHOME");
- QVERIFY(copyKeyrings(gpgHome, mDir.path()));
- qputenv("GNUPGHOME", mDir.path().toUtf8());
- QFile conf(mDir.path() + QStringLiteral("/gpg.conf"));
- QVERIFY(conf.open(QIODevice::WriteOnly));
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() >= "2.2.18") {
- conf.write("allow-weak-key-signatures");
- }
- conf.close();
- }
-
-private:
- QTemporaryDir mDir;
-};
-
-QTEST_MAIN(TestRemarks)
-
-#include "t-remarks.moc"
diff --git a/lang/qt/tests/t-revokekey.cpp b/lang/qt/tests/t-revokekey.cpp
deleted file mode 100644
index 4d8b0ca5..00000000
--- a/lang/qt/tests/t-revokekey.cpp
+++ /dev/null
@@ -1,338 +0,0 @@
-/* t-revokekey.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 <[email protected]>
-
- 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 "t-support.h"
-
-#include <protocol.h>
-#include <revokekeyjob.h>
-
-#include <QDebug>
-#include <QProcess>
-#include <QRegularExpression>
-#include <QSignalSpy>
-#include <QTest>
-
-#include <gpgme++/context.h>
-#include <gpgme++/data.h>
-
-#include <algorithm>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-/* Test keys
- sec ed25519 2022-03-29 [SC]
- 604122B94C86BE846EAFE637FC2BCFB1B19A1CF4
- uid [ultimate] [email protected]
- ssb cv25519 2022-03-29 [E]
- * generated with
-export GNUPGHOME=$(mktemp -d)
-gpg -K
-gpg --batch --pinentry-mode loopback --passphrase abc --quick-gen-key [email protected] default default never
-gpg -K
-gpg --export-secret-keys --armor --batch --pinentry-mode loopback --passphrase abc --comment [email protected] [email protected] | sed 's/\(.*\)/ "\1\\n"/'
-#rm -rf ${GNUPGHOME}
-unset GNUPGHOME
-*/
-static const char *testKeyData =
- "-----BEGIN PGP PRIVATE KEY BLOCK-----\n"
- "Comment: [email protected]\n"
- "\n"
- "lIYEYkLSGhYJKwYBBAHaRw8BAQdAWKBjYOZIW33CjwlHKKGIgqXDOGhmbPCStkj1\n"
- "+2/cVFL+BwMCXJpRHkD8EcT8DMWdVo84Lx4w7RNDCQx5xnm6rO5kvtmh+PjgM3qt\n"
- "CQVGy8H7Dq35yzi0Hihm5zvHxVGYdAu96ShAI2ZqqVL7is0CdAmAibQVcmV2b2tl\n"
- "LW1lQGV4YW1wbGUubmV0iJQEExYKADwWIQRgQSK5TIa+hG6v5jf8K8+xsZoc9AUC\n"
- "YkLSGgIbAwULCQgHAgMiAgEGFQoJCAsCBBYCAwECHgcCF4AACgkQ/CvPsbGaHPSH\n"
- "LAD/RNFgm1Bp6ltDXLS6oS0S5Bgjjg3CBpbdxWTvLjPpaagBAIU2pTLrsGNDKIZq\n"
- "EAY7hY50tdcvOfT4OSAySJACJzMFnIsEYkLSGhIKKwYBBAGXVQEFAQEHQIOTbPEz\n"
- "hUtL72BHfetUWESlEbh2IF/NEUWASUtQJDghAwEIB/4HAwJGE5naBnwwcfyPC+Nq\n"
- "DwY5FO28hQVAzgNu9KAncmPtpST1J8sEPAtJGhtq/9fki9eSvBMbAa64VVpFHKHK\n"
- "ravZxr2uCrK6J/u4rTvnR8HgiHgEGBYKACAWIQRgQSK5TIa+hG6v5jf8K8+xsZoc\n"
- "9AUCYkLSGgIbDAAKCRD8K8+xsZoc9ANAAP9rX/xanm7YvcGFIxPclmy4h33lLaG8\n"
- "dE5RA6zeSg7DqQD8Dae82iKaqKfTpe2+2vIEyxBVy8+WttoElUoXiwr0AQg=\n"
- "=/5re\n"
- "-----END PGP PRIVATE KEY BLOCK-----\n";
-
-class RevokeKeyJobTest : public QGpgMETest
-{
- Q_OBJECT
-
-private Q_SLOTS:
-
- void initTestCase()
- {
- QGpgMETest::initTestCase();
-
- // set up the test fixture for this test
- qputenv("GNUPGHOME", mGnupgHomeTestFixture.path().toUtf8());
- QVERIFY(importSecretKeys(testKeyData, 1));
- }
-
- void init()
- {
- // set up a copy of the test fixture for each test function
- mGnupgHomeTestCopy.reset(new QTemporaryDir{});
- QVERIFY(copyKeyrings(mGnupgHomeTestFixture.path(), mGnupgHomeTestCopy->path()));
- qputenv("GNUPGHOME", mGnupgHomeTestCopy->path().toUtf8());
- }
-
- void testAsync()
- {
- // Get the key that shall be revoked
- auto key = getTestKey("[email protected]");
- QVERIFY(!key.isNull());
- QVERIFY(!key.isRevoked());
-
- auto job = std::unique_ptr<RevokeKeyJob>{openpgp()->revokeKeyJob()};
- hookUpPassphraseProvider(job.get());
-
- Error result;
- connect(job.get(), &RevokeKeyJob::result,
- job.get(), [this, &result](const Error &result_) {
- result = result_;
- Q_EMIT asyncDone();
- });
- QVERIFY(!job->start(key, RevocationReason::NoLongerUsed,
- {"This key is not used anymore."}));
- job.release(); // after the job has been started it's on its own
-
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- QVERIFY(result.code() == GPG_ERR_NO_ERROR);
- key.update();
- QVERIFY(key.isRevoked());
- verifyReason(key, RevocationReason::NoLongerUsed,
- {"This key is not used anymore."});
- }
-
- void testSync_noReasonDescription()
- {
- // Get the key that shall be revoked
- auto key = getTestKey("[email protected]");
- QVERIFY(!key.isNull());
- QVERIFY(!key.isRevoked());
-
- auto job = std::unique_ptr<RevokeKeyJob>{openpgp()->revokeKeyJob()};
- hookUpPassphraseProvider(job.get());
-
- const auto result = job->exec(key);
-
- QVERIFY(result.code() == GPG_ERR_NO_ERROR);
- key.update();
- QVERIFY(key.isRevoked());
- verifyReason(key, RevocationReason::Unspecified, {});
- }
-
- void testSync_oneLineReasonDescription()
- {
- // Get the key that shall be revoked
- auto key = getTestKey("[email protected]");
- QVERIFY(!key.isNull());
- QVERIFY(!key.isRevoked());
-
- auto job = std::unique_ptr<RevokeKeyJob>{openpgp()->revokeKeyJob()};
- hookUpPassphraseProvider(job.get());
-
- const auto result = job->exec(key, RevocationReason::Compromised,
- {"The secret key was stolen."});
-
- QVERIFY(result.code() == GPG_ERR_NO_ERROR);
- key.update();
- QVERIFY(key.isRevoked());
- verifyReason(key, RevocationReason::Compromised,
- {"The secret key was stolen."});
- }
-
- void testSync_twoLinesReasonDescription()
- {
- // Get the key that shall be revoked
- auto key = getTestKey("[email protected]");
- QVERIFY(!key.isNull());
- QVERIFY(!key.isRevoked());
-
- auto job = std::unique_ptr<RevokeKeyJob>{openpgp()->revokeKeyJob()};
- hookUpPassphraseProvider(job.get());
-
- const auto result = job->exec(key, RevocationReason::Superseded,
- {"This key has been superseded by key",
- "0000 1111 2222 3333 4444 5555 6666 7777 8888 9999."});
-
- QVERIFY(result.code() == GPG_ERR_NO_ERROR);
- key.update();
- QVERIFY(key.isRevoked());
- verifyReason(key, RevocationReason::Superseded,
- {"This key has been superseded by key",
- "0000 1111 2222 3333 4444 5555 6666 7777 8888 9999."});
- }
-
- void testErrorHandling_nullKey()
- {
- {
- auto job = std::unique_ptr<RevokeKeyJob>{openpgp()->revokeKeyJob()};
- QTest::ignoreMessage(QtWarningMsg, "Error: Key is null key");
- const auto result = job->exec(Key{});
- QVERIFY(result.code() == GPG_ERR_INV_ARG);
- }
- {
- auto job = std::unique_ptr<RevokeKeyJob>{openpgp()->revokeKeyJob()};
- QTest::ignoreMessage(QtWarningMsg, "Error: Key is null key");
- const auto result = job->start(Key{});
- QVERIFY(result.code() == GPG_ERR_INV_ARG);
- }
- }
-
- void testErrorHandling_invalidReason()
- {
- // Get the key that shall be revoked
- auto key = getTestKey("[email protected]");
- QVERIFY(!key.isNull());
- QVERIFY(!key.isRevoked());
-
- {
- auto job = std::unique_ptr<RevokeKeyJob>{openpgp()->revokeKeyJob()};
- QTest::ignoreMessage(QtWarningMsg, QRegularExpression{"^Error: Invalid revocation reason"});
- const auto result = job->exec(key, static_cast<RevocationReason>(-1));
- QVERIFY(result.code() == GPG_ERR_INV_VALUE);
- }
- {
- auto job = std::unique_ptr<RevokeKeyJob>{openpgp()->revokeKeyJob()};
- QTest::ignoreMessage(QtWarningMsg, QRegularExpression{"^Error: Invalid revocation reason"});
- const auto result = job->start(key, static_cast<RevocationReason>(4));
- QVERIFY(result.code() == GPG_ERR_INV_VALUE);
- }
- }
-
- void testErrorHandling_invalidDescription()
- {
- // Get the key that shall be revoked
- auto key = getTestKey("[email protected]");
- QVERIFY(!key.isNull());
- QVERIFY(!key.isRevoked());
-
- {
- auto job = std::unique_ptr<RevokeKeyJob>{openpgp()->revokeKeyJob()};
- QTest::ignoreMessage(QtWarningMsg, "Error: Revocation description contains empty lines or lines with endline characters");
- const auto result = job->exec(key, RevocationReason::Unspecified,
- {"line1", "", "line3"});
- QVERIFY(result.code() == GPG_ERR_INV_VALUE);
- }
- {
- auto job = std::unique_ptr<RevokeKeyJob>{openpgp()->revokeKeyJob()};
- QTest::ignoreMessage(QtWarningMsg, "Error: Revocation description contains empty lines or lines with endline characters");
- const auto result = job->start(key, RevocationReason::Unspecified,
- {"line1\nline2"});
- QVERIFY(result.code() == GPG_ERR_INV_VALUE);
- }
- }
-
-private:
- Key getTestKey(const char *pattern)
- {
- auto ctx = Context::create(OpenPGP);
- VERIFY_OR_OBJECT(ctx);
-
- Error err;
- auto key = ctx->key(pattern, err, /*secret=*/true);
- VERIFY_OR_OBJECT(!err);
- VERIFY_OR_OBJECT(!key.isNull());
- return key;
- }
-
- bool verifyReason(const Key &key, RevocationReason reason, const QStringList &description)
- {
- static const auto startTimeout = std::chrono::milliseconds{1000};
- static const auto finishTimeout = std::chrono::milliseconds{2000};
- static const QStringList hexCodeForReason = {
- QStringLiteral("00"), /* no particular reason */
- QStringLiteral("02"), /* key has been compromised */
- QStringLiteral("01"), /* key is superseded */
- QStringLiteral("03") /* key is no longer used */
- };
-
- QProcess p;
- p.setProgram(dirInfo("gpg-name"));
- p.setArguments({QStringLiteral("-K"),
- QStringLiteral("--with-colon"),
- QStringLiteral("--with-sig-list"),
- QLatin1String{key.primaryFingerprint()}
- });
-
- p.start();
-
- if (!p.waitForStarted(startTimeout.count())) {
- qWarning() << "Timeout while waiting for start of" << p.program() << p.arguments().join(u' ');
- return false;
- }
- if (!p.waitForFinished(finishTimeout.count())) {
- qWarning() << "Timeout while waiting for completion of" << p.program() << p.arguments().join(u' ');
- return false;
- }
- if (p.exitStatus() != QProcess::NormalExit) {
- qWarning() << p.program() << "terminated abnormally with exit status" << p.exitStatus();
- return false;
- }
-
- const auto lines = QString::fromUtf8(p.readAllStandardOutput()).split(u'\n');
- for (const auto &l : lines) {
- const auto fields = l.split(u':');
- if (fields[0] == QLatin1String{"rev"}) {
- // or "rev" the signature class may be followed by a comma
- // and a 2 digit hexnumber with the revocation reason
- const auto sigClass = fields.value(10);
- const auto revReason = sigClass.split(u',').value(1);
- COMPARE_OR_FALSE(revReason, hexCodeForReason.value(static_cast<int>(reason)));
-
- // decode the \n in the C-style quoted comment field
- const auto comment = fields.value(20).replace(QStringLiteral("\\n"), QStringLiteral("\n"));
- COMPARE_OR_FALSE(comment, description.join(u'\n'));
- return true;
- }
- if (fields[0] == QLatin1String{"uid"}) {
- qWarning() << "Found uid before rev in key listing:\n" << stdout;
- return false;
- }
- }
- return false;
- }
-
-private:
- QTemporaryDir mGnupgHomeTestFixture;
- std::unique_ptr<QTemporaryDir> mGnupgHomeTestCopy;
-};
-
-QTEST_MAIN(RevokeKeyJobTest)
-
-#include "t-revokekey.moc"
diff --git a/lang/qt/tests/t-setprimaryuserid.cpp b/lang/qt/tests/t-setprimaryuserid.cpp
deleted file mode 100644
index e57d1c6e..00000000
--- a/lang/qt/tests/t-setprimaryuserid.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/* t-setprimaryuserid.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 <[email protected]>
-
- 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 "t-support.h"
-
-#include <keylistjob.h>
-#include <protocol.h>
-
-#include <gpgme++/context.h>
-#include <gpgme++/engineinfo.h>
-#include <gpgme++/keylistresult.h>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-class TestSetPrimaryUserID: public QGpgMETest
-{
- Q_OBJECT
-
-private Q_SLOTS:
- void testSetPrimaryUserID()
- {
- Key key;
- {
- std::unique_ptr<KeyListJob> job{openpgp()->keyListJob()};
- std::vector<GpgME::Key> keys;
- GpgME::KeyListResult result = job->exec({QStringLiteral("[email protected]")}, true, keys);
- QVERIFY(!result.error());
- QVERIFY(keys.size() == 1);
- key = keys.front();
- }
-
- QCOMPARE(key.numUserIDs(), 3u);
- const std::string oldPrimaryUserId = key.userID(0).id();
- const std::string newPrimaryUserId = key.userID(1).id();
- const std::string newPrimaryUserIdHash = key.userID(1).uidhash();
-
- {
- std::unique_ptr<Context> ctx{Context::createForProtocol(key.protocol())};
- QVERIFY(ctx);
- hookUpPassphraseProvider(ctx.get());
-
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() >= "2.3.8") {
- QVERIFY(!ctx->setPrimaryUid(key, newPrimaryUserIdHash.c_str()));
- } else {
- QVERIFY(!ctx->setPrimaryUid(key, newPrimaryUserId.c_str()));
- }
- }
- key.update();
-
- QCOMPARE(key.userID(0).id(), newPrimaryUserId);
-
- {
- std::unique_ptr<Context> ctx{Context::createForProtocol(key.protocol())};
- QVERIFY(ctx);
- hookUpPassphraseProvider(ctx.get());
-
- QVERIFY(!ctx->setPrimaryUid(key, oldPrimaryUserId.c_str()));
- }
- key.update();
-
- QCOMPARE(key.userID(0).id(), oldPrimaryUserId);
- }
-
- void testErrorHandling_noSecretKey()
- {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.3.8") {
- QSKIP("gpg < 2.3.8 does not report status error");
- }
- Key key;
- {
- std::unique_ptr<KeyListJob> job{openpgp()->keyListJob()};
- std::vector<GpgME::Key> keys;
- GpgME::KeyListResult result = job->exec({QStringLiteral("[email protected]")}, false, keys);
- QVERIFY(!result.error());
- QVERIFY(keys.size() == 1);
- key = keys.front();
- }
-
- QCOMPARE(key.numUserIDs(), 2u);
- const std::string newPrimaryUserId = key.userID(1).id();
-
- {
- std::unique_ptr<Context> ctx{Context::createForProtocol(key.protocol())};
- QVERIFY(ctx);
- auto err = ctx->setPrimaryUid(key, newPrimaryUserId.c_str());
- QCOMPARE(err.code(), static_cast<int>(GPG_ERR_NO_SECKEY));
- }
- }
-
- void testErrorHandling_noUserID()
- {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.3.8") {
- QSKIP("gpg < 2.3.8 does not report status error");
- }
- Key key;
- {
- std::unique_ptr<KeyListJob> job{openpgp()->keyListJob()};
- std::vector<GpgME::Key> keys;
- GpgME::KeyListResult result = job->exec({QStringLiteral("[email protected]")}, true, keys);
- QVERIFY(!result.error());
- QVERIFY(keys.size() == 1);
- key = keys.front();
- }
- {
- std::unique_ptr<Context> ctx{Context::createForProtocol(key.protocol())};
- QVERIFY(ctx);
- auto err = ctx->setPrimaryUid(key, "bravo");
- QCOMPARE(err.code(), static_cast<int>(GPG_ERR_NO_USER_ID));
- }
- }
-
- void initTestCase()
- {
- QGpgMETest::initTestCase();
- const QString gpgHome = qgetenv("GNUPGHOME");
- QVERIFY(copyKeyrings(gpgHome, mDir.path()));
- qputenv("GNUPGHOME", mDir.path().toUtf8());
- QFile conf(mDir.path() + QStringLiteral("/gpg.conf"));
- QVERIFY(conf.open(QIODevice::WriteOnly));
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() >= "2.2.18") {
- conf.write("allow-weak-key-signatures\n");
- }
- conf.close();
- }
-
-private:
- QTemporaryDir mDir;
-};
-
-QTEST_MAIN(TestSetPrimaryUserID)
-
-#include "t-setprimaryuserid.moc"
diff --git a/lang/qt/tests/t-support.cpp b/lang/qt/tests/t-support.cpp
deleted file mode 100644
index 48ad0cd9..00000000
--- a/lang/qt/tests/t-support.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-/* t-support.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 "t-support.h"
-
-#include "importjob.h"
-#include "job.h"
-#include "protocol.h"
-
-#include <QTest>
-
-#include <QProcess>
-#include <QCoreApplication>
-#include <QObject>
-#include <QDir>
-#include <QSignalSpy>
-
-#include <gpgme++/context.h>
-#include <gpgme++/engineinfo.h>
-#include <gpgme++/importresult.h>
-
-using namespace GpgME;
-using namespace QGpgME;
-
-void QGpgMETest::initTestCase()
-{
- GpgME::initializeLibrary();
- const QString gpgHome = qgetenv("GNUPGHOME");
- QVERIFY2(!gpgHome.isEmpty(), "GNUPGHOME environment variable is not set.");
-}
-
-void QGpgMETest::cleanupTestCase()
-{
- QCoreApplication::sendPostedEvents();
- killAgent();
-}
-
-// static
-bool QGpgMETest::doOnlineTests()
-{
- return !qgetenv("DO_ONLINE_TESTS").isEmpty();
-}
-
-bool QGpgMETest::copyKeyrings(const QString &src, const QString &dest)
-{
- bool is21dir = QFileInfo(src + QDir::separator() + QStringLiteral("pubring.kbx")).exists();
- const QString name = is21dir ? QStringLiteral("pubring.kbx") :
- QStringLiteral("pubring.gpg");
- if (!QFile::copy(src + QDir::separator() + name, dest + QDir::separator() + name)) {
- return false;
- }
- if (!is21dir) {
- return (QFile::copy(src + QDir::separator() + QStringLiteral("secring.gpg"),
- dest + QDir::separator() + QStringLiteral("secring.gpg")));
- }
- QDir dir (src + QDir::separator() + QStringLiteral("private-keys-v1.d"));
- QDir target(dest);
- if (!target.mkdir("private-keys-v1.d")) {
- return false;
- }
- foreach (QString f, dir.entryList(QDir::Files)) {
- if (!QFile::copy(dir.path() + QDir::separator() + f,
- dest + QDir::separator() +
- QStringLiteral("private-keys-v1.d") + QDir::separator() + f)) {
- return false;
- }
- }
- return true;
-}
-
-bool QGpgMETest::importSecretKeys(const char *keyData, int expectedKeys)
-{
- auto job = std::unique_ptr<ImportJob>{openpgp()->importJob()};
- VERIFY_OR_FALSE(job);
- hookUpPassphraseProvider(job.get());
-
- ImportResult result;
- connect(job.get(), &ImportJob::result,
- this, [this, &result](const ImportResult &result_) {
- result = result_;
- Q_EMIT asyncDone();
- });
- VERIFY_OR_FALSE(!job->start(keyData));
- job.release(); // after the job has been started it's on its own
-
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- VERIFY_OR_FALSE(spy.wait(QSIGNALSPY_TIMEOUT));
- VERIFY_OR_FALSE(!result.error());
- VERIFY_OR_FALSE(!result.imports().empty());
- COMPARE_OR_FALSE(result.numSecretKeysImported(), expectedKeys);
-
- return true;
-}
-
-void QGpgMETest::hookUpPassphraseProvider(GpgME::Context *context)
-{
- context->setPassphraseProvider(&mPassphraseProvider);
- context->setPinentryMode(Context::PinentryLoopback);
-}
-
-void QGpgMETest::hookUpPassphraseProvider(QGpgME::Job *job)
-{
- hookUpPassphraseProvider(Job::context(job));
-}
-
-void killAgent(const QString& dir)
-{
- QProcess proc;
- proc.setProgram(QStringLiteral("gpg-connect-agent"));
- QStringList arguments;
- arguments << "-S " << dir + "/S.gpg-agent";
- proc.start();
- proc.waitForStarted();
- proc.write("KILLAGENT\n");
- proc.write("BYE\n");
- proc.closeWriteChannel();
- proc.waitForFinished();
-}
-
-bool loopbackSupported()
-{
- /* With GnuPG 2.0.x (at least 2.0.26 by default on jessie)
- * the passphrase_cb does not work. So the test popped up
- * a pinentry. So tests requiring decryption don't work. */
- static auto version = GpgME::engineInfo(GpgME::GpgEngine).engineVersion();
- if (version < "2.0.0") {
- /* With 1.4 it just works */
- return true;
- }
- if (version < "2.1.0") {
- /* With 2.1 it works with loopback mode */
- return false;
- }
- return true;
-}
-
-#include "t-support.hmoc"
diff --git a/lang/qt/tests/t-support.h b/lang/qt/tests/t-support.h
deleted file mode 100644
index eb4ba57d..00000000
--- a/lang/qt/tests/t-support.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* t-support.h
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by 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 T_SUPPORT_H
-#define T_SUPPORT_H
-
-#include <gpgme++/interfaces/passphraseprovider.h>
-#include <QObject>
-#include <QTest>
-
-#include <gpg-error.h>
-
-namespace GpgME
-{
-class Context;
-}
-
-namespace QGpgME
-{
-class Job;
-}
-
-/// generic variant of QVERIFY returning \a returnValue on failure
-#define VERIFY_OR_RETURN_VALUE(statement, returnValue) \
-do {\
- if (!QTest::qVerify(static_cast<bool>(statement), #statement, "", __FILE__, __LINE__))\
- return returnValue;\
-} while (false)
-
-/// generic variant of QCOMPARE returning \a returnValue on failure
-#define COMPARE_OR_RETURN_VALUE(actual, expected, returnValue) \
-do {\
- if (!QTest::qCompare(actual, expected, #actual, #expected, __FILE__, __LINE__))\
- return returnValue;\
-} while (false)
-
-/// variant of QVERIFY returning a default constructed object on failure
-#define VERIFY_OR_OBJECT(statement) VERIFY_OR_RETURN_VALUE(statement, {})
-
-/// variant of QCOMPARE returning a default constructed object on failure
-#define COMPARE_OR_OBJECT(actual, expected) COMPARE_OR_RETURN_VALUE(actual, expected, {})
-
-/// variant of QVERIFY returning \c false on failure
-#define VERIFY_OR_FALSE(statement) VERIFY_OR_RETURN_VALUE(statement, false)
-
-/// variant of QCOMPARE returning \c false on failure
-#define COMPARE_OR_FALSE(actual, expected) COMPARE_OR_RETURN_VALUE(actual, expected, false)
-
-namespace QTest
-{
-template <>
-inline char *toString(const std::string &s)
-{
- return QTest::toString(s.c_str());
-}
-}
-
-namespace GpgME
-{
-class TestPassphraseProvider : public PassphraseProvider
-{
-public:
- char *getPassphrase(const char * /*useridHint*/, const char * /*description*/,
- bool /*previousWasBad*/, bool &/*canceled*/) override
- {
- char *ret;
- gpgrt_asprintf(&ret, "abc");
- return ret;
- }
-};
-} // namespace GpgME
-
-void killAgent(const QString &dir = qgetenv("GNUPGHOME"));
-/* Is the passphrase Provider / loopback Supported */
-bool loopbackSupported();
-
-class QGpgMETest : public QObject
-{
- Q_OBJECT
-
-Q_SIGNALS:
- void asyncDone();
-
-protected:
- static bool doOnlineTests();
-
- bool copyKeyrings(const QString &from, const QString& to);
-
- bool importSecretKeys(const char *keyData, int expectedKeys = 1);
-
- void hookUpPassphraseProvider(GpgME::Context *context);
- void hookUpPassphraseProvider(QGpgME::Job *job);
-
-public Q_SLOTS:
- void initTestCase();
- void cleanupTestCase();
-
-private:
- GpgME::TestPassphraseProvider mPassphraseProvider;
-};
-
-/* Timeout, in milliseconds, for use with QSignalSpy to wait on
- signals. */
-#define QSIGNALSPY_TIMEOUT 60000
-
-#endif // T_SUPPORT_H
diff --git a/lang/qt/tests/t-tofuinfo.cpp b/lang/qt/tests/t-tofuinfo.cpp
deleted file mode 100644
index 852142cf..00000000
--- a/lang/qt/tests/t-tofuinfo.cpp
+++ /dev/null
@@ -1,530 +0,0 @@
-/* t-tofuinfo.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include <QDebug>
-#include <QTest>
-#include <QTemporaryDir>
-#include <QSignalSpy>
-
-#include "debug.h"
-#include "protocol.h"
-#include <gpgme++/tofuinfo.h>
-#include "tofupolicyjob.h"
-#include "verifyopaquejob.h"
-#include <gpgme++/verificationresult.h>
-#include <gpgme++/signingresult.h>
-#include "importjob.h"
-#include <gpgme++/importresult.h>
-#include "keylistjob.h"
-#include <gpgme++/keylistresult.h>
-#include "signjob.h"
-#include <gpgme++/key.h>
-
-#include "t-support.h"
-#include <gpgme++/engineinfo.h>
-#include <gpgme++/context.h>
-#include <iostream>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-static const char testMsg1[] =
-"-----BEGIN PGP MESSAGE-----\n"
-"\n"
-"owGbwMvMwCSoW1RzPCOz3IRxjXQSR0lqcYleSUWJTZOvjVdpcYmCu1+oQmaJIleH\n"
-"GwuDIBMDGysTSIqBi1MApi+nlGGuwDeHao53HBr+FoVGP3xX+kvuu9fCMJvl6IOf\n"
-"y1kvP4y+8D5a11ang0udywsA\n"
-"=Crq6\n"
-"-----END PGP MESSAGE-----\n";
-
-static const char conflictKey1[] = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n"
-"\n"
-"mDMEXDWgpxYJKwYBBAHaRw8BAQdAguVu4qkx8iw4eU+TQ4vvcKG7IdcZvbMhw3Zc\n"
-"npGf0+u0GXRvZnVfY29uZmxpY3RAZXhhbXBsZS5jb22IkAQTFggAOBYhBO6ovNDG\n"
-"nLzbR1TlMJYJ0fjlWbUrBQJcNaCnAhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA\n"
-"AAoJEJYJ0fjlWbUrLaMBALegwkv2+sEcmKZqxt8JscYvFiEuycv2+rKHaZA0eDoN\n"
-"AP97W4XrJb5x49J5jDDdeko8k00uGqiiuAXJo27/i/phA7g4BFw1oKcSCisGAQQB\n"
-"l1UBBQEBB0Crhw24E2lPBhd/y+ZFotQ/2TrYqkUQqGPmff8ofLziNgMBCAeIeAQY\n"
-"FggAIBYhBO6ovNDGnLzbR1TlMJYJ0fjlWbUrBQJcNaCnAhsMAAoJEJYJ0fjlWbUr\n"
-"/K8BAJWsa+tOZsJw7w5fz6O0We6Xx4Rt17jHf563G6wMcz9+AQDRsedJ7w4zYzS9\n"
-"MFiJQ5aN0NDHMRtDFWAgCunVnJ3OBw==\n"
-"=fZa5\n"
-"-----END PGP PUBLIC KEY BLOCK-----\n";
-
-static const char conflictKey2[] = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n"
-"\n"
-"mDMEXDWgixYJKwYBBAHaRw8BAQdAMWOhumYspcvEOTuesOSN4rvnJVOj/6qOWFTu\n"
-"x+wPRra0GXRvZnVfY29uZmxpY3RAZXhhbXBsZS5jb22IkAQTFggAOBYhBA64G88Q\n"
-"NPXztj8ID/FhC7tiGbeRBQJcNaCLAhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheA\n"
-"AAoJEPFhC7tiGbeRUt4A/2hf4Zgz+TYyfeH/4/ZtyL1JuZggqR1s5UopEx2Aiw10\n"
-"AP405KiTd31TJQN8Ru+7bskPu0/mzLZMNkRvBNEdc5kbDLg4BFw1oIsSCisGAQQB\n"
-"l1UBBQEBB0B5NtSrx7wDDKgwUe5Rxz0vRkaWLtyE0KbfE77oPy5DGAMBCAeIeAQY\n"
-"FggAIBYhBA64G88QNPXztj8ID/FhC7tiGbeRBQJcNaCLAhsMAAoJEPFhC7tiGbeR\n"
-"km0BAP8TQwraipqb1pJlLsEgDXeM5Jocz4fuePD78BsOBtORAP9gpCyKXdyJYGlA\n"
-"qjmG356yG6pCK9aPckTZ9IViPiHWCw==\n"
-"=tn3Q\n"
-"-----END PGP PUBLIC KEY BLOCK-----\n";
-
-static const char conflictMsg1[] = "-----BEGIN PGP MESSAGE-----\n"
-"\n"
-"owGbwMvMwCE2jfPij6eRW7UZTwsnMcSYLnT0Ki0uUXD3C1XILFHk6ihlYRDjYJAV\n"
-"U2R5t2LPhWNz9tx2D3lqANPEygTSwcDFKQAT+RjG8M9of873hQrMpinBVwKYv+rq\n"
-"XGmYW+ZcZJ+133KDq+itzlxGhg3L2X/6Khj+2Hd+He+KnXtunF2wNWxl7849e/Sy\n"
-"v6tc+8MBAA==\n"
-"=fZLe\n"
-"-----END PGP MESSAGE-----\n";
-
-static const char conflictMsg2[] = "-----BEGIN PGP MESSAGE-----\n"
-"\n"
-"owGbwMvMwCH2MZF7d5Lk9omMp4WTGGJMFwZ4lRaXKLj7hSpklihydZSyMIhxMMiK\n"
-"KbLw7ZA+L2Dy9fM2ew5+mCZWJpAOBi5OAZhIUhIjw7bV+xS+cR0quqhmcY2Dl3WW\n"
-"8Ufr+rRNufOPyIdoO6nEXGH47/B+E1+oxS6e5f5n7MJ3aHBO+s345sipGV/4f665\n"
-"9mmiGjsA\n"
-"=8oJA\n"
-"-----END PGP MESSAGE-----\n";
-
-class TofuInfoTest: public QGpgMETest
-{
- Q_OBJECT
-
-private:
- bool testSupported()
- {
- static bool initialized, supported;
- if (initialized) {
- return supported;
- }
- initialized = true;
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.16") {
- return false;
- }
- // If the keylist fails here this means that gnupg does not
- // support tofu at all. It can be disabled at compile time. So no
- // tests.
- auto *job = openpgp()->keyListJob(false, false, false);
- job->addMode(GpgME::WithTofu);
- std::vector<GpgME::Key> keys;
- job->exec(QStringList() << QStringLiteral("[email protected]"), true, keys);
- delete job;
- supported = !keys.empty();
- return supported;
- }
-
- void testTofuCopy(TofuInfo other, const TofuInfo &orig)
- {
- QVERIFY(!orig.isNull());
- QVERIFY(!other.isNull());
- QVERIFY(orig.signLast() == other.signLast());
- QVERIFY(orig.signCount() == other.signCount());
- QVERIFY(orig.validity() == other.validity());
- QVERIFY(orig.policy() == other.policy());
- }
-
- void signAndVerify(const QString &what, const GpgME::Key &key, int expected)
- {
- auto job = openpgp()->signJob();
- hookUpPassphraseProvider(job);
-
- std::vector<Key> keys;
- keys.push_back(key);
- QByteArray signedData;
- auto sigResult = job->exec(keys, what.toUtf8(), NormalSignatureMode, signedData);
- delete job;
-
- QVERIFY(!sigResult.error());
- for (const auto &uid : keys[0].userIDs()) {
- auto info = uid.tofuInfo();
- QVERIFY(info.signCount() == expected - 1);
- }
-
- auto verifyJob = openpgp()->verifyOpaqueJob();
- QByteArray verified;
-
- auto result = verifyJob->exec(signedData, verified);
- delete verifyJob;
-
- QVERIFY(!result.error());
- QVERIFY(verified == what.toUtf8());
-
- QVERIFY(result.numSignatures() == 1);
- auto sig = result.signatures()[0];
-
- auto key2 = sig.key();
- QVERIFY(!key.isNull());
- QVERIFY(!strcmp (key2.primaryFingerprint(), key.primaryFingerprint()));
- QVERIFY(!strcmp (key.primaryFingerprint(), sig.fingerprint()));
- auto stats = key2.userID(0).tofuInfo();
- QVERIFY(!stats.isNull());
- if (stats.signCount() != expected) {
- std::cout << "################ Key before verify: "
- << key
- << "################ Key after verify: "
- << key2;
- }
- QVERIFY(stats.signCount() == expected);
- }
-
-private Q_SLOTS:
- void testTofuNull()
- {
- if (!testSupported()) {
- return;
- }
- TofuInfo tofu;
- QVERIFY(tofu.isNull());
- QVERIFY(!tofu.description());
- QVERIFY(!tofu.signCount());
- QVERIFY(!tofu.signLast());
- QVERIFY(!tofu.signFirst());
- QVERIFY(tofu.validity() == TofuInfo::ValidityUnknown);
- QVERIFY(tofu.policy() == TofuInfo::PolicyUnknown);
- }
-
- void testTofuInfo()
- {
- if (!testSupported()) {
- return;
- }
- auto *job = openpgp()->verifyOpaqueJob(true);
- const QByteArray data1(testMsg1);
- QByteArray plaintext;
-
- auto ctx = Job::context(job);
- QVERIFY(ctx);
- ctx->setSender("[email protected]");
-
- auto result = job->exec(data1, plaintext);
- delete job;
-
- QVERIFY(!result.isNull());
- QVERIFY(!result.error());
- QVERIFY(!strcmp(plaintext.constData(), "Just GNU it!\n"));
-
- QVERIFY(result.numSignatures() == 1);
- Signature sig = result.signatures()[0];
- /* TOFU is always marginal */
- QVERIFY(sig.validity() == Signature::Marginal);
-
- auto stats = sig.key().userID(0).tofuInfo();
- QVERIFY(!stats.isNull());
- QVERIFY(sig.key().primaryFingerprint());
- QVERIFY(sig.fingerprint());
- QVERIFY(!strcmp(sig.key().primaryFingerprint(), sig.fingerprint()));
- QVERIFY(stats.signFirst() == stats.signLast());
- QVERIFY(stats.signCount() == 1);
- QVERIFY(stats.policy() == TofuInfo::PolicyAuto);
- QVERIFY(stats.validity() == TofuInfo::LittleHistory);
-
- testTofuCopy(stats, stats);
-
- /* Another verify */
-
- job = openpgp()->verifyOpaqueJob(true);
- result = job->exec(data1, plaintext);
- delete job;
-
- QVERIFY(!result.isNull());
- QVERIFY(!result.error());
-
- QVERIFY(result.numSignatures() == 1);
- sig = result.signatures()[0];
- /* TOFU is always marginal */
- QVERIFY(sig.validity() == Signature::Marginal);
-
- stats = sig.key().userID(0).tofuInfo();
- QVERIFY(!stats.isNull());
- QVERIFY(!strcmp(sig.key().primaryFingerprint(), sig.fingerprint()));
- QVERIFY(stats.signFirst() == stats.signLast());
- QVERIFY(stats.signCount() == 1);
- QVERIFY(stats.policy() == TofuInfo::PolicyAuto);
- QVERIFY(stats.validity() == TofuInfo::LittleHistory);
-
- /* Verify that another call yields the same result */
- job = openpgp()->verifyOpaqueJob(true);
- result = job->exec(data1, plaintext);
- delete job;
-
- QVERIFY(!result.isNull());
- QVERIFY(!result.error());
-
- QVERIFY(result.numSignatures() == 1);
- sig = result.signatures()[0];
- /* TOFU is always marginal */
- QVERIFY(sig.validity() == Signature::Marginal);
-
- stats = sig.key().userID(0).tofuInfo();
- QVERIFY(!stats.isNull());
- QVERIFY(!strcmp(sig.key().primaryFingerprint(), sig.fingerprint()));
- QVERIFY(stats.signFirst() == stats.signLast());
- QVERIFY(stats.signCount() == 1);
- QVERIFY(stats.policy() == TofuInfo::PolicyAuto);
- QVERIFY(stats.validity() == TofuInfo::LittleHistory);
- }
-
- void testTofuSignCount()
- {
- if (!testSupported()) {
- return;
- }
- auto *job = openpgp()->keyListJob(false, false, false);
- job->addMode(GpgME::WithTofu);
- std::vector<GpgME::Key> keys;
- GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("[email protected]"),
- true, keys);
- delete job;
- QVERIFY(!keys.empty());
- Key key = keys[0];
- QVERIFY(!key.isNull());
-
- /* As we sign & verify quickly here we need different
- * messages to avoid having them treated as the same
- * message if they were created within the same second.
- * Alternatively we could use the same message and wait
- * a second between each call. But this would slow down
- * the testsuite. */
- signAndVerify(QStringLiteral("Hello"), key, 1);
- key.update();
- signAndVerify(QStringLiteral("Hello2"), key, 2);
- key.update();
- signAndVerify(QStringLiteral("Hello3"), key, 3);
- key.update();
- signAndVerify(QStringLiteral("Hello4"), key, 4);
- }
-
- void testTofuKeyList()
- {
- if (!testSupported()) {
- return;
- }
-
- /* First check that the key has no tofu info. */
- auto *job = openpgp()->keyListJob(false, false, false);
- std::vector<GpgME::Key> keys;
- auto result = job->exec(QStringList() << QStringLiteral("[email protected]"),
- true, keys);
- delete job;
- QVERIFY(!keys.empty());
- auto key = keys[0];
- QVERIFY(!key.isNull());
- QVERIFY(key.userID(0).tofuInfo().isNull());
- auto keyCopy = key;
- keyCopy.update();
- auto sigCnt = keyCopy.userID(0).tofuInfo().signCount();
- signAndVerify(QStringLiteral("Hello5"), keyCopy,
- sigCnt + 1);
- keyCopy.update();
- signAndVerify(QStringLiteral("Hello6"), keyCopy,
- sigCnt + 2);
-
- /* Now another one but with tofu */
- job = openpgp()->keyListJob(false, false, false);
- job->addMode(GpgME::WithTofu);
- result = job->exec(QStringList() << QStringLiteral("[email protected]"),
- true, keys);
- delete job;
- QVERIFY(!result.error());
- QVERIFY(!keys.empty());
- auto key2 = keys[0];
- QVERIFY(!key2.isNull());
- auto info = key2.userID(0).tofuInfo();
- QVERIFY(!info.isNull());
- QVERIFY(info.signCount());
- }
-
- void testTofuPolicy()
- {
- if (!testSupported()) {
- return;
- }
-
- /* First check that the key has no tofu info. */
- auto *job = openpgp()->keyListJob(false, false, false);
- std::vector<GpgME::Key> keys;
- job->addMode(GpgME::WithTofu);
- auto result = job->exec(QStringList() << QStringLiteral("[email protected]"),
- false, keys);
-
- if (keys.empty()) {
- qDebug() << "[email protected] not found";
- qDebug() << "Error: " << result.error();
- const auto homedir = QString::fromLocal8Bit(qgetenv("GNUPGHOME"));
- qDebug() << "Homedir is: " << homedir;
- QFileInfo fi(homedir + "/pubring.gpg");
- qDebug () << "pubring exists: " << fi.exists() << " readable? "
- << fi.isReadable() << " size: " << fi.size();
- QFileInfo fi2(homedir + "/pubring.kbx");
- qDebug () << "keybox exists: " << fi2.exists() << " readable? "
- << fi2.isReadable() << " size: " << fi2.size();
-
- result = job->exec(QStringList(), false, keys);
- for (const auto &key : keys) {
- qDebug() << "Key: " << key.userID(0).name() << " <"
- << key.userID(0).email()
- << ">\n fpr: " << key.primaryFingerprint();
- }
- }
- QVERIFY(!result.error());
- QVERIFY(!keys.empty());
- auto key = keys[0];
- QVERIFY(!key.isNull());
- QVERIFY(key.userID(0).tofuInfo().policy() != TofuInfo::PolicyBad);
- auto *tofuJob = openpgp()->tofuPolicyJob();
- auto err = tofuJob->exec(key, TofuInfo::PolicyBad);
- QVERIFY(!err);
- result = job->exec(QStringList() << QStringLiteral("[email protected]"),
- false, keys);
- QVERIFY(!keys.empty());
- key = keys[0];
- QVERIFY(key.userID(0).tofuInfo().policy() == TofuInfo::PolicyBad);
- err = tofuJob->exec(key, TofuInfo::PolicyGood);
-
- result = job->exec(QStringList() << QStringLiteral("[email protected]"),
- false, keys);
- key = keys[0];
- QVERIFY(key.userID(0).tofuInfo().policy() == TofuInfo::PolicyGood);
- delete tofuJob;
- delete job;
- }
-
- void testTofuConflict()
- {
- if (!testSupported()) {
- return;
- }
-
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.19") {
- return;
- }
-
- // Import key 1
- auto importjob = openpgp()->importJob();
- connect(importjob, &ImportJob::result, this,
- [this](ImportResult result, QString, Error)
- {
- QVERIFY(!result.error());
- QVERIFY(!result.imports().empty());
- QVERIFY(result.numImported());
- Q_EMIT asyncDone();
- });
- importjob->start(QByteArray(conflictKey1));
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait());
-
- // Verify Message 1
- const QByteArray signedData(conflictMsg1);
- auto verifyJob = openpgp()->verifyOpaqueJob(true);
- QByteArray verified;
- auto result = verifyJob->exec(signedData, verified);
- delete verifyJob;
-
- QVERIFY(!result.isNull());
- QVERIFY(!result.error());
-
- QVERIFY(result.numSignatures() == 1);
- auto sig = result.signatures()[0];
- QVERIFY(sig.validity() == Signature::Marginal);
-
- auto stats = sig.key().userID(0).tofuInfo();
- QVERIFY(!stats.isNull());
- QVERIFY(!strcmp(sig.key().primaryFingerprint(), sig.fingerprint()));
- QVERIFY(stats.signFirst() == stats.signLast());
- QVERIFY(stats.signCount() == 1);
- QVERIFY(stats.policy() == TofuInfo::PolicyAuto);
- QVERIFY(stats.validity() == TofuInfo::LittleHistory);
-
- // Import key 2
- importjob = openpgp()->importJob();
- connect(importjob, &ImportJob::result, this,
- [this](ImportResult result, QString, Error)
- {
- QVERIFY(!result.error());
- QVERIFY(!result.imports().empty());
- QVERIFY(result.numImported());
- Q_EMIT asyncDone();
- });
- importjob->start(QByteArray(conflictKey2));
- QSignalSpy spy2 (this, SIGNAL(asyncDone()));
- QVERIFY(spy2.wait());
-
- // Verify Message 2
- const QByteArray signedData2(conflictMsg2);
- QByteArray verified2;
- verifyJob = openpgp()->verifyOpaqueJob(true);
- result = verifyJob->exec(signedData2, verified2);
- delete verifyJob;
-
- QVERIFY(!result.isNull());
- QVERIFY(!result.error());
-
- QVERIFY(result.numSignatures() == 1);
- sig = result.signatures()[0];
- QVERIFY(sig.validity() == Signature::Unknown);
- // TODO activate when implemented
- // QVERIFY(sig.summary() == Signature::TofuConflict);
-
- stats = sig.key().userID(0).tofuInfo();
- QVERIFY(!stats.isNull());
- QVERIFY(!strcmp(sig.key().primaryFingerprint(), sig.fingerprint()));
- QVERIFY(stats.signFirst() == stats.signLast());
- QVERIFY(stats.signCount() == 1);
- QVERIFY(stats.policy() == TofuInfo::PolicyAsk);
- QVERIFY(stats.validity() == TofuInfo::Conflict);
- }
-
-
- void initTestCase()
- {
- QGpgMETest::initTestCase();
- const QString gpgHome = qgetenv("GNUPGHOME");
- qputenv("GNUPGHOME", mDir.path().toUtf8());
- QVERIFY(mDir.isValid());
- QFile conf(mDir.path() + QStringLiteral("/gpg.conf"));
- QVERIFY(conf.open(QIODevice::WriteOnly));
- conf.write("trust-model tofu+pgp");
- conf.close();
- QFile agentConf(mDir.path() + QStringLiteral("/gpg-agent.conf"));
- QVERIFY(agentConf.open(QIODevice::WriteOnly));
- agentConf.write("allow-loopback-pinentry");
- agentConf.close();
- QVERIFY(copyKeyrings(gpgHome, mDir.path()));
- }
-private:
- QTemporaryDir mDir;
-
-};
-
-QTEST_MAIN(TofuInfoTest)
-
-#include "t-tofuinfo.moc"
diff --git a/lang/qt/tests/t-trustsignatures.cpp b/lang/qt/tests/t-trustsignatures.cpp
deleted file mode 100644
index 6d575dff..00000000
--- a/lang/qt/tests/t-trustsignatures.cpp
+++ /dev/null
@@ -1,524 +0,0 @@
-/* t-trustsignatures.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "t-support.h"
-
-#include <gpgme++/context.h>
-#include <gpgme++/engineinfo.h>
-#include "protocol.h"
-#include "signkeyjob.h"
-#include "util.h"
-
-#include <QRegularExpression>
-#include <QSignalSpy>
-#include <QTemporaryDir>
-#include <QTest>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-class TestTrustSignatures: public QGpgMETest
-{
- Q_OBJECT
-
-private Q_SLOTS:
- void test_tsign_single_uid_key_and_then_tsign_it_again()
- {
- Error err;
-
- if (!loopbackSupported()) {
- return;
- }
-
- auto ctx = Context::create(OpenPGP);
- QVERIFY(ctx);
-
- // Get the signing key ([email protected])
- auto seckey = ctx->key("A0FF4590BB6122EDEF6E3C542D727CC768697734", err, true);
- QVERIFY(!err);
- QVERIFY(!seckey.isNull());
-
- // Get the target key ([email protected])
- auto target = ctx->key("E8143C489C8D41124DC40D0B47AF4B6961F04784", err, false);
- QVERIFY(!err);
- QVERIFY(!target.isNull());
- QVERIFY(target.numUserIDs() > 0);
-
- // Create first trust signature
- {
- // Create the job
- auto job = std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
- QVERIFY(job);
- hookUpPassphraseProvider(job.get());
-
- // Set up the job
- job->setExportable(true);
- job->setSigningKey(seckey);
- job->setTrustSignature(TrustSignatureTrust::Complete, 1, QStringLiteral("example.org"));
-
- connect(job.get(), &SignKeyJob::result,
- this, [this] (const GpgME::Error &err2, const QString &, const GpgME::Error &) {
- Q_EMIT asyncDone();
- if (err2) {
- if (err2.code() == GPG_ERR_GENERAL) {
- QFAIL(qPrintable(QString("The SignKeyJob failed with '%1'.\n"
- "Hint: Run with GPGMEPP_INTERACTOR_DEBUG=stderr to debug the edit interaction.").arg(errorAsString(err2))));
- } else {
- QFAIL(qPrintable(QString("The SignKeyJob failed with '%1'.").arg(errorAsString(err2))));
- }
- }
- });
-
- job->start(target);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- // At this point the trust signature should have been added.
- target.update();
- const auto trustSignature = target.userID(0).signature(target.userID(0).numSignatures() - 1);
- QVERIFY(trustSignature.isTrustSignature());
- QCOMPARE(trustSignature.trustDepth(), 1u);
- QCOMPARE(trustSignature.trustValue(), TrustSignatureTrust::Complete);
- QVERIFY(trustSignature.trustScope());
- const auto trustScope = QString::fromUtf8(trustSignature.trustScope());
- QVERIFY(!trustScope.isEmpty());
- const QRegularExpression regex{trustScope};
- QVERIFY(regex.isValid());
- QVERIFY(regex.match(QStringLiteral("Foo <[email protected]>")).hasMatch());
- }
-
- // Create second trust signature
- {
- // Create the job
- auto job = std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
- QVERIFY(job);
- hookUpPassphraseProvider(job.get());
-
- // Set up the job
- job->setExportable(true);
- job->setSigningKey(seckey);
- job->setDupeOk(true);
- job->setTrustSignature(TrustSignatureTrust::Partial, 2, QStringLiteral("example.net"));
-
- connect(job.get(), &SignKeyJob::result,
- this, [this] (const GpgME::Error &err2, const QString &, const GpgME::Error &) {
- Q_EMIT asyncDone();
- if (err2) {
- if (err2.code() == GPG_ERR_GENERAL) {
- QFAIL(qPrintable(QString("The SignKeyJob failed with '%1'.\n"
- "Hint: Run with GPGMEPP_INTERACTOR_DEBUG=stderr to debug the edit interaction.").arg(errorAsString(err2))));
- } else {
- QFAIL(qPrintable(QString("The SignKeyJob failed with '%1'.").arg(errorAsString(err2))));
- }
- }
- });
-
- err = job->start(target);
- QVERIFY(!err);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- // At this point the trust signature should have been added.
- target.update();
- const auto trustSignature = target.userID(0).signature(target.userID(0).numSignatures() - 1);
- QVERIFY(trustSignature.isTrustSignature());
- QCOMPARE(trustSignature.trustDepth(), 2u);
- QCOMPARE(trustSignature.trustValue(), TrustSignatureTrust::Partial);
- QVERIFY(trustSignature.trustScope());
- const auto trustScope = QString::fromUtf8(trustSignature.trustScope());
- QVERIFY(!trustScope.isEmpty());
- const QRegularExpression regex{trustScope};
- QVERIFY(regex.isValid());
- QVERIFY(regex.match(QStringLiteral("Foo <[email protected]>")).hasMatch());
- }
- }
-
- void test_tsign_multi_uid_key_and_then_tsign_it_again()
- {
- Error err;
-
- if (!loopbackSupported()) {
- return;
- }
-
- auto ctx = Context::create(OpenPGP);
- QVERIFY(ctx);
-
- // Get the signing key ([email protected])
- auto seckey = ctx->key("A0FF4590BB6122EDEF6E3C542D727CC768697734", err, true);
- QVERIFY(!err);
- QVERIFY(!seckey.isNull());
-
- // Get the target key (Bob / Bravo Test)
- auto target = ctx->key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", err, false);
- QVERIFY(!err);
- QVERIFY(!target.isNull());
- QVERIFY(target.numUserIDs() > 0);
-
- // Create first trust signature
- {
- // Create the job
- auto job = openpgp()->signKeyJob();//std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
- QVERIFY(job);
- hookUpPassphraseProvider(job);
-
- // Set up the job
- job->setExportable(true);
- job->setSigningKey(seckey);
- job->setTrustSignature(TrustSignatureTrust::Complete, 1, QStringLiteral("example.org"));
-
- connect(job, &SignKeyJob::result,
- this, [this] (const GpgME::Error &err2, const QString &, const GpgME::Error &) {
- Q_EMIT asyncDone();
- if (err2) {
- if (err2.code() == GPG_ERR_GENERAL) {
- QFAIL(qPrintable(QString("The SignKeyJob failed with '%1'.\n"
- "Hint: Run with GPGMEPP_INTERACTOR_DEBUG=stderr to debug the edit interaction.").arg(errorAsString(err2))));
- } else {
- QFAIL(qPrintable(QString("The SignKeyJob failed with '%1'.").arg(errorAsString(err2))));
- }
- }
- });
-
- job->start(target);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- // At this point the trust signature should have been added.
- target.update();
- const auto trustSignature = target.userID(0).signature(target.userID(0).numSignatures() - 1);
- QVERIFY(trustSignature.isTrustSignature());
- QCOMPARE(trustSignature.trustDepth(), 1u);
- QCOMPARE(trustSignature.trustValue(), TrustSignatureTrust::Complete);
- QVERIFY(trustSignature.trustScope());
- const auto trustScope = QString::fromUtf8(trustSignature.trustScope());
- QVERIFY(!trustScope.isEmpty());
- const QRegularExpression regex{trustScope};
- QVERIFY(regex.isValid());
- QVERIFY(regex.match(QStringLiteral("Foo <[email protected]>")).hasMatch());
- }
-
- // Create second trust signature
- {
- // Create the job
- auto job = openpgp()->signKeyJob();//std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
- QVERIFY(job);
- hookUpPassphraseProvider(job);
-
- // Set up the job
- job->setExportable(true);
- job->setSigningKey(seckey);
- job->setDupeOk(true);
- job->setTrustSignature(TrustSignatureTrust::Partial, 2, QStringLiteral("example.net"));
-
- connect(job, &SignKeyJob::result,
- this, [this] (const GpgME::Error &err2, const QString &, const GpgME::Error &) {
- Q_EMIT asyncDone();
- if (err2) {
- if (err2.code() == GPG_ERR_GENERAL) {
- QFAIL(qPrintable(QString("The SignKeyJob failed with '%1'.\n"
- "Hint: Run with GPGMEPP_INTERACTOR_DEBUG=stderr to debug the edit interaction.").arg(errorAsString(err2))));
- } else {
- QFAIL(qPrintable(QString("The SignKeyJob failed with '%1'.").arg(errorAsString(err2))));
- }
- }
- });
-
- err = job->start(target);
- QVERIFY(!err);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- // At this point the trust signature should have been added.
- target.update();
- const auto trustSignature = target.userID(0).signature(target.userID(0).numSignatures() - 1);
- QVERIFY(trustSignature.isTrustSignature());
- QCOMPARE(trustSignature.trustDepth(), 2u);
- QCOMPARE(trustSignature.trustValue(), TrustSignatureTrust::Partial);
- QVERIFY(trustSignature.trustScope());
- const auto trustScope = QString::fromUtf8(trustSignature.trustScope());
- QVERIFY(!trustScope.isEmpty());
- const QRegularExpression regex{trustScope};
- QVERIFY(regex.isValid());
- QVERIFY(regex.match(QStringLiteral("Foo <[email protected]>")).hasMatch());
- }
- }
-
- void test_tsign_first_uid_and_then_tsign_both_uids()
- {
- Error err;
-
- if (!loopbackSupported()) {
- return;
- }
-
- auto ctx = Context::create(OpenPGP);
- QVERIFY(ctx);
-
- // Get the signing key ([email protected])
- auto seckey = ctx->key("A0FF4590BB6122EDEF6E3C542D727CC768697734", err, true);
- QVERIFY(!err);
- QVERIFY(!seckey.isNull());
-
- // Get the target key (Mallory / Mike Test)
- auto target = ctx->key("2686AA191A278013992C72EBBE794852BE5CF886", err, false);
- QVERIFY(!err);
- QVERIFY(!target.isNull());
- QVERIFY(target.numUserIDs() > 0);
-
- // Create first trust signature
- {
- // Create the job
- auto job = openpgp()->signKeyJob();//std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
- QVERIFY(job);
- hookUpPassphraseProvider(job);
-
- // Set up the job
- job->setExportable(true);
- job->setSigningKey(seckey);
- job->setUserIDsToSign({0});
- job->setTrustSignature(TrustSignatureTrust::Complete, 1, QStringLiteral("example.org"));
-
- connect(job, &SignKeyJob::result,
- this, [this] (const GpgME::Error &err2, const QString &, const GpgME::Error &) {
- Q_EMIT asyncDone();
- if (err2) {
- if (err2.code() == GPG_ERR_GENERAL) {
- QFAIL(qPrintable(QString("The SignKeyJob failed with '%1'.\n"
- "Hint: Run with GPGMEPP_INTERACTOR_DEBUG=stderr to debug the edit interaction.").arg(errorAsString(err2))));
- } else {
- QFAIL(qPrintable(QString("The SignKeyJob failed with '%1'.").arg(errorAsString(err2))));
- }
- }
- });
-
- job->start(target);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- // At this point the trust signature should have been added.
- target.update();
- const auto trustSignature = target.userID(0).signature(target.userID(0).numSignatures() - 1);
- QVERIFY(trustSignature.isTrustSignature());
- QCOMPARE(trustSignature.trustDepth(), 1u);
- QCOMPARE(trustSignature.trustValue(), TrustSignatureTrust::Complete);
- QVERIFY(trustSignature.trustScope());
- const auto trustScope = QString::fromUtf8(trustSignature.trustScope());
- QVERIFY(!trustScope.isEmpty());
- const QRegularExpression regex{trustScope};
- QVERIFY(regex.isValid());
- QVERIFY(regex.match(QStringLiteral("Foo <[email protected]>")).hasMatch());
- }
-
- // Create second trust signature
- {
- // Create the job
- auto job = openpgp()->signKeyJob();//std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
- QVERIFY(job);
- hookUpPassphraseProvider(job);
-
- // Set up the job
- job->setExportable(true);
- job->setSigningKey(seckey);
- job->setDupeOk(true);
- job->setTrustSignature(TrustSignatureTrust::Partial, 2, QStringLiteral("example.net"));
-
- connect(job, &SignKeyJob::result,
- this, [this] (const GpgME::Error &err2, const QString &, const GpgME::Error &) {
- Q_EMIT asyncDone();
- if (err2) {
- if (err2.code() == GPG_ERR_GENERAL) {
- QFAIL(qPrintable(QString("The SignKeyJob failed with '%1'.\n"
- "Hint: Run with GPGMEPP_INTERACTOR_DEBUG=stderr to debug the edit interaction.").arg(errorAsString(err2))));
- } else {
- QFAIL(qPrintable(QString("The SignKeyJob failed with '%1'.").arg(errorAsString(err2))));
- }
- }
- });
-
- err = job->start(target);
- QVERIFY(!err);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- // At this point the trust signature should have been added.
- target.update();
- const auto trustSignature = target.userID(0).signature(target.userID(0).numSignatures() - 1);
- QVERIFY(trustSignature.isTrustSignature());
- QCOMPARE(trustSignature.trustDepth(), 2u);
- QCOMPARE(trustSignature.trustValue(), TrustSignatureTrust::Partial);
- QVERIFY(trustSignature.trustScope());
- const auto trustScope = QString::fromUtf8(trustSignature.trustScope());
- QVERIFY(!trustScope.isEmpty());
- const QRegularExpression regex{trustScope};
- QVERIFY(regex.isValid());
- QVERIFY(regex.match(QStringLiteral("Foo <[email protected]>")).hasMatch());
- }
- }
-
- void test_tsign_all_uids_and_then_tsign_first_uid()
- {
- Error err;
-
- if (!loopbackSupported()) {
- return;
- }
-
- auto ctx = Context::create(OpenPGP);
- QVERIFY(ctx);
-
- // Get the signing key ([email protected])
- auto seckey = ctx->key("A0FF4590BB6122EDEF6E3C542D727CC768697734", err, true);
- QVERIFY(!err);
- QVERIFY(!seckey.isNull());
-
- // Get the target key (Echelon / Echo Test / Eve)
- auto target = ctx->key("3531152DE293E26A07F504BC318C1FAEFAEF6D1B", err, false);
- QVERIFY(!err);
- QVERIFY(!target.isNull());
- QVERIFY(target.numUserIDs() > 0);
-
- // Create first trust signature
- {
- // Create the job
- auto job = openpgp()->signKeyJob();//std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
- QVERIFY(job);
- hookUpPassphraseProvider(job);
-
- // Set up the job
- job->setExportable(true);
- job->setSigningKey(seckey);
- job->setTrustSignature(TrustSignatureTrust::Complete, 1, QStringLiteral("example.org"));
-
- connect(job, &SignKeyJob::result,
- this, [this] (const GpgME::Error &err2, const QString &, const GpgME::Error &) {
- Q_EMIT asyncDone();
- if (err2) {
- if (err2.code() == GPG_ERR_GENERAL) {
- QFAIL(qPrintable(QString("The SignKeyJob failed with '%1'.\n"
- "Hint: Run with GPGMEPP_INTERACTOR_DEBUG=stderr to debug the edit interaction.").arg(errorAsString(err2))));
- } else {
- QFAIL(qPrintable(QString("The SignKeyJob failed with '%1'.").arg(errorAsString(err2))));
- }
- }
- });
-
- job->start(target);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- // At this point the trust signature should have been added.
- target.update();
- const auto trustSignature = target.userID(0).signature(target.userID(0).numSignatures() - 1);
- QVERIFY(trustSignature.isTrustSignature());
- QCOMPARE(trustSignature.trustDepth(), 1u);
- QCOMPARE(trustSignature.trustValue(), TrustSignatureTrust::Complete);
- QVERIFY(trustSignature.trustScope());
- const auto trustScope = QString::fromUtf8(trustSignature.trustScope());
- QVERIFY(!trustScope.isEmpty());
- const QRegularExpression regex{trustScope};
- QVERIFY(regex.isValid());
- QVERIFY(regex.match(QStringLiteral("Foo <[email protected]>")).hasMatch());
- }
-
- // Create second trust signature
- {
- // Create the job
- auto job = openpgp()->signKeyJob();//std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
- QVERIFY(job);
- hookUpPassphraseProvider(job);
-
- // Set up the job
- job->setExportable(true);
- job->setSigningKey(seckey);
- job->setUserIDsToSign({0});
- job->setDupeOk(true);
- job->setTrustSignature(TrustSignatureTrust::Partial, 2, QStringLiteral("example.net"));
-
- connect(job, &SignKeyJob::result,
- this, [this] (const GpgME::Error &err2, const QString &, const GpgME::Error &) {
- Q_EMIT asyncDone();
- if (err2) {
- if (err2.code() == GPG_ERR_GENERAL) {
- QFAIL(qPrintable(QString("The SignKeyJob failed with '%1'.\n"
- "Hint: Run with GPGMEPP_INTERACTOR_DEBUG=stderr to debug the edit interaction.").arg(errorAsString(err2))));
- } else {
- QFAIL(qPrintable(QString("The SignKeyJob failed with '%1'.").arg(errorAsString(err2))));
- }
- }
- });
-
- err = job->start(target);
- QVERIFY(!err);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- // At this point the trust signature should have been added.
- target.update();
- const auto trustSignature = target.userID(0).signature(target.userID(0).numSignatures() - 1);
- QVERIFY(trustSignature.isTrustSignature());
- QCOMPARE(trustSignature.trustDepth(), 2u);
- QCOMPARE(trustSignature.trustValue(), TrustSignatureTrust::Partial);
- QVERIFY(trustSignature.trustScope());
- const auto trustScope = QString::fromUtf8(trustSignature.trustScope());
- QVERIFY(!trustScope.isEmpty());
- const QRegularExpression regex{trustScope};
- QVERIFY(regex.isValid());
- QVERIFY(regex.match(QStringLiteral("Foo <[email protected]>")).hasMatch());
- }
- }
-
- void initTestCase()
- {
- QGpgMETest::initTestCase();
- const QString gpgHome = qgetenv("GNUPGHOME");
- QVERIFY(copyKeyrings(gpgHome, mDir.path()));
- qputenv("GNUPGHOME", mDir.path().toUtf8());
- QFile conf(mDir.path() + QStringLiteral("/gpg.conf"));
- QVERIFY(conf.open(QIODevice::WriteOnly));
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() >= "2.2.18") {
- conf.write("allow-weak-key-signatures");
- }
- conf.close();
- }
-
-private:
- QTemporaryDir mDir;
-};
-
-QTEST_MAIN(TestTrustSignatures)
-
-#include "t-trustsignatures.moc"
diff --git a/lang/qt/tests/t-various.cpp b/lang/qt/tests/t-various.cpp
deleted file mode 100644
index 282fffc2..00000000
--- a/lang/qt/tests/t-various.cpp
+++ /dev/null
@@ -1,418 +0,0 @@
-/* t-various.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2017 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include <QDebug>
-#include <QTest>
-#include <QSignalSpy>
-#include <QTemporaryDir>
-#include "keylistjob.h"
-#include "protocol.h"
-#include "util.h"
-#include <gpgme++/keylistresult.h>
-#include <gpgme++/context.h>
-#include <gpgme++/engineinfo.h>
-#include "dn.h"
-#include <gpgme++/data.h>
-#include "dataprovider.h"
-#include "signkeyjob.h"
-
-#include "t-support.h"
-
-using namespace QGpgME;
-using namespace GpgME;
-
-static const char aKey[] = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n"
-"\n"
-"mDMEWG+w/hYJKwYBBAHaRw8BAQdAiq1oStvDYg8ZfFs5DgisYJo8dJxD+C/AA21O\n"
-"K/aif0O0GXRvZnVfY29uZmxpY3RAZXhhbXBsZS5jb22IlgQTFggAPhYhBHoJBLaV\n"
-"DamYAgoa1L5BwMOl/x88BQJYb7D+AhsDBQkDwmcABQsJCAcCBhUICQoLAgQWAgMB\n"
-"Ah4BAheAAAoJEL5BwMOl/x88GvwA/0SxkbLyAcshGm2PRrPsFQsSVAfwaSYFVmS2\n"
-"cMVIw1PfAQDclRH1Z4MpufK07ju4qI33o4s0UFpVRBuSxt7A4P2ZD7g4BFhvsP4S\n"
-"CisGAQQBl1UBBQEBB0AmVrgaDNJ7K2BSalsRo2EkRJjHGqnp5bBB0tapnF81CQMB\n"
-"CAeIeAQYFggAIBYhBHoJBLaVDamYAgoa1L5BwMOl/x88BQJYb7D+AhsMAAoJEL5B\n"
-"wMOl/x88OR0BAMq4/vmJUORRTmzjHcv/DDrQB030DSq666rlckGIKTShAPoDXM9N\n"
-"0gZK+YzvrinSKZXHmn0aSwmC1/hyPybJPEljBw==\n"
-"=p2Oj\n"
-"-----END PGP PUBLIC KEY BLOCK-----\n";
-
-class TestVarious: public QGpgMETest
-{
- Q_OBJECT
-
-private Q_SLOTS:
- void testDN()
- {
- DN dn(QStringLiteral("CN=Before\\0DAfter,OU=Test,DC=North America,DC=Fabrikam,DC=COM"));
- QVERIFY(dn.dn() == QStringLiteral("CN=Before\rAfter,OU=Test,DC=North America,DC=Fabrikam,DC=COM"));
- QStringList attrOrder;
- attrOrder << QStringLiteral("DC") << QStringLiteral("OU") << QStringLiteral("CN");
- dn.setAttributeOrder(attrOrder);
- QVERIFY(dn.prettyDN() == QStringLiteral("DC=North America,DC=Fabrikam,DC=COM,OU=Test,CN=Before\rAfter"));
- }
-
- void testKeyFromFile()
- {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.14") {
- return;
- }
- QGpgME::QByteArrayDataProvider dp(aKey);
- Data data(&dp);
- const auto keys = data.toKeys();
- QVERIFY(keys.size() == 1);
- const auto key = keys[0];
- QVERIFY(!key.isNull());
- QVERIFY(key.primaryFingerprint() == QStringLiteral("7A0904B6950DA998020A1AD4BE41C0C3A5FF1F3C"));
- }
-
- void testDataRewind()
- {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.14") {
- return;
- }
- QGpgME::QByteArrayDataProvider dp(aKey);
- Data data(&dp);
- char buf[20];
- data.read(buf, 20);
-
- auto keys = data.toKeys();
- QVERIFY(keys.size() == 0);
-
- data.rewind();
-
- keys = data.toKeys();
- QVERIFY(keys.size() == 1);
- }
-
- void testQuickUid()
- {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.13") {
- return;
- }
- KeyListJob *job = openpgp()->keyListJob(false, true, true);
- std::vector<GpgME::Key> keys;
- GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("[email protected]"),
- false, keys);
- delete job;
- QVERIFY (!result.error());
- QVERIFY (keys.size() == 1);
- Key key = keys.front();
-
- QVERIFY (key.numUserIDs() == 3);
- const char uid[] = "Foo Bar (with comment) <[email protected]>";
-
- auto ctx = Context::createForProtocol(key.protocol());
- QVERIFY (ctx);
- hookUpPassphraseProvider(ctx);
-
- QVERIFY(!ctx->addUid(key, uid));
- delete ctx;
- key.update();
-
- QVERIFY (key.numUserIDs() == 4);
- bool id_found = false;;
- for (const auto &u: key.userIDs()) {
- if (!strcmp (u.id(), uid)) {
- QVERIFY (!u.isRevoked());
- id_found = true;
- break;
- }
- }
- QVERIFY (id_found);
-
- ctx = Context::createForProtocol(key.protocol());
- QVERIFY (!ctx->revUid(key, uid));
- delete ctx;
- key.update();
-
- bool id_revoked = false;;
- for (const auto &u: key.userIDs()) {
- if (!strcmp (u.id(), uid)) {
- id_revoked = true;
- break;
- }
- }
- QVERIFY(id_revoked);
- }
-
- void testSetExpire()
- {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.1.22") {
- return;
- }
- KeyListJob *job = openpgp()->keyListJob(false, true, true);
- std::vector<GpgME::Key> keys;
- GpgME::KeyListResult result = job->exec(QStringList() << QStringLiteral("[email protected]"),
- false, keys);
- delete job;
- QVERIFY (!result.error());
- QVERIFY (keys.size() == 1);
- Key key = keys.front();
-
- QVERIFY (key.subkey(0).expirationTime() == time_t(0));
- QVERIFY (key.subkey(1).expirationTime() == time_t(0));
-
- auto ctx = Context::createForProtocol(key.protocol());
- QVERIFY (ctx);
- hookUpPassphraseProvider(ctx);
-
- // change expiration of the main key
- QVERIFY(!ctx->setExpire(key, 1000));
- delete ctx;
- key.update();
-
- QVERIFY (key.subkey(0).expirationTime() != time_t(0));
- QVERIFY (key.subkey(1).expirationTime() == time_t(0));
- time_t keyExpiration = key.subkey(0).expirationTime();
-
- // change expiration of all subkeys
- ctx = Context::createForProtocol(key.protocol());
- QVERIFY(!ctx->setExpire(key, 2000, std::vector<Subkey>(), Context::SetExpireAllSubkeys));
- delete ctx;
- key.update();
-
- QVERIFY (key.subkey(0).expirationTime() == keyExpiration);
- QVERIFY (key.subkey(1).expirationTime() != time_t(0));
- time_t subkeyExpiration = key.subkey(1).expirationTime();
-
- // change expiration of specific subkey(s)
- ctx = Context::createForProtocol(key.protocol());
- std::vector<Subkey> specificSubkeys;
- specificSubkeys.push_back(key.subkey(1));
- QVERIFY(!ctx->setExpire(key, 3000, specificSubkeys));
- delete ctx;
- key.update();
-
- QVERIFY (key.subkey(0).expirationTime() == keyExpiration);
- QVERIFY (key.subkey(1).expirationTime() != subkeyExpiration);
-
- // test error handling: calling setExpire() with the primary key as
- // subkey should fail with "subkey <primary key fpr> not found"
- ctx = Context::createForProtocol(key.protocol());
- std::vector<Subkey> primaryKey;
- primaryKey.push_back(key.subkey(0));
- const auto err = ctx->setExpire(key, 3000, primaryKey);
- QCOMPARE(err.code(), static_cast<int>(GPG_ERR_NOT_FOUND));
- delete ctx;
- }
-
- void testSignKeyWithoutExpiration()
- {
- Error err;
-
- if (!loopbackSupported()) {
- return;
- }
-
- auto ctx = Context::create(OpenPGP);
- QVERIFY(ctx);
-
- // Get the signing key ([email protected])
- auto seckey = ctx->key("A0FF4590BB6122EDEF6E3C542D727CC768697734", err, true);
- QVERIFY(!err);
- QVERIFY(!seckey.isNull());
-
- // Get the target key (Bob / Bravo Test)
- auto target = ctx->key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", err, false);
- QVERIFY(!err);
- QVERIFY(!target.isNull());
- QVERIFY(target.numUserIDs() > 0);
-
- // Create the job
- auto job = std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
- QVERIFY(job);
- hookUpPassphraseProvider(job.get());
-
- // Set up the job
- job->setExportable(true);
- job->setSigningKey(seckey);
- job->setDupeOk(true);
-
- connect(job.get(), &SignKeyJob::result,
- this, [this] (const GpgME::Error &err2, const QString &, const GpgME::Error &) {
- Q_EMIT asyncDone();
- if (err2) {
- if (err2.code() == GPG_ERR_GENERAL) {
- QFAIL(qPrintable(QString("The SignKeyJob failed with '%1'.\n"
- "Hint: Run with GPGMEPP_INTERACTOR_DEBUG=stderr to debug the edit interaction.").arg(errorAsString(err2))));
- } else {
- QFAIL(qPrintable(QString("The SignKeyJob failed with '%1'.").arg(errorAsString(err2))));
- }
- }
- });
-
- job->start(target);
- QSignalSpy spy{this, &TestVarious::asyncDone};
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- // At this point the signature should have been added.
- target.update();
- const auto keySignature = target.userID(0).signature(target.userID(0).numSignatures() - 1);
- QVERIFY(keySignature.neverExpires());
- }
-
- void testSignKeyWithExpiration()
- {
- Error err;
-
- if (!loopbackSupported()) {
- return;
- }
-
- auto ctx = Context::create(OpenPGP);
- QVERIFY(ctx);
-
- // Get the signing key ([email protected])
- auto seckey = ctx->key("A0FF4590BB6122EDEF6E3C542D727CC768697734", err, true);
- QVERIFY(!err);
- QVERIFY(!seckey.isNull());
-
- // Get the target key (Bob / Bravo Test)
- auto target = ctx->key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", err, false);
- QVERIFY(!err);
- QVERIFY(!target.isNull());
- QVERIFY(target.numUserIDs() > 0);
-
- // Create the job
- auto job = std::unique_ptr<SignKeyJob>{openpgp()->signKeyJob()};
- QVERIFY(job);
- hookUpPassphraseProvider(job.get());
-
- // Set up the job
- job->setExportable(true);
- job->setSigningKey(seckey);
- job->setDupeOk(true);
- job->setExpirationDate(QDate{2222, 2, 22});
-
- connect(job.get(), &SignKeyJob::result,
- this, [this] (const GpgME::Error &err2, const QString &, const GpgME::Error &) {
- Q_EMIT asyncDone();
- if (err2) {
- if (err2.code() == GPG_ERR_GENERAL) {
- QFAIL(qPrintable(QString("The SignKeyJob failed with '%1'.\n"
- "Hint: Run with GPGMEPP_INTERACTOR_DEBUG=stderr to debug the edit interaction.").arg(errorAsString(err2))));
- } else {
- QFAIL(qPrintable(QString("The SignKeyJob failed with '%1'.").arg(errorAsString(err2))));
- }
- }
- });
-
- job->start(target);
- QSignalSpy spy{this, &TestVarious::asyncDone};
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- // At this point the signature should have been added.
- target.update();
- const auto keySignature = target.userID(0).signature(target.userID(0).numSignatures() - 1);
- QVERIFY(!keySignature.neverExpires());
- const auto expirationDate = QDateTime::fromSecsSinceEpoch(uint_least32_t(keySignature.expirationTime())).date();
- // expiration date is capped at 2106-02-05; we also allow 2106-02-04 as expiration date because for locations that use DST
- // the expiration date may be 2106-02-04-23:xx:xx (in local non-DST time) if the current time is 00:xx::xx (in local DST time)
- const auto expectedExpirationRange = std::make_pair(QDate{2106, 2, 4}, QDate{2106, 2, 5});
- QVERIFY2(expirationDate >= expectedExpirationRange.first,
- ("\n Actual : " + expirationDate.toString(Qt::ISODate).toLatin1() +
- "\n Expected: " + expectedExpirationRange.first.toString(Qt::ISODate).toLatin1()).constData());
- QVERIFY2(expirationDate <= expectedExpirationRange.second,
- ("\n Actual : " + expirationDate.toString(Qt::ISODate).toLatin1() +
- "\n Expected: " + expectedExpirationRange.second.toString(Qt::ISODate).toLatin1()).constData());
- }
-
- void testVersion()
- {
- QVERIFY(EngineInfo::Version("2.1.0") < EngineInfo::Version("2.1.1"));
- QVERIFY(EngineInfo::Version("2.1.10") < EngineInfo::Version("2.1.11"));
- QVERIFY(EngineInfo::Version("2.2.0") > EngineInfo::Version("2.1.19"));
- QVERIFY(EngineInfo::Version("1.0.0") < EngineInfo::Version("2.0.0"));
- QVERIFY(EngineInfo::Version("0.1.0") < EngineInfo::Version("1.0.0"));
- QVERIFY(!(EngineInfo::Version("2.0.0") < EngineInfo::Version("2.0.0")));
- QVERIFY(!(EngineInfo::Version("2.0.0") > EngineInfo::Version("2.0.0")));
- QVERIFY(EngineInfo::Version("3.0.0") > EngineInfo::Version("2.3.20"));
- QVERIFY(EngineInfo::Version("3.0.1") > EngineInfo::Version("3.0.0"));
- QVERIFY(EngineInfo::Version("3.1.0") > EngineInfo::Version("3.0.20"));
-
- QVERIFY(EngineInfo::Version("1.1.1") <= "2.0.0");
- QVERIFY(EngineInfo::Version("1.1.1") <= "1.2.0");
- QVERIFY(EngineInfo::Version("1.1.1") <= "1.1.2");
- QVERIFY(EngineInfo::Version("1.1.1") <= "1.1.1");
- QVERIFY(!(EngineInfo::Version("1.1.1") <= "1.1.0"));
- QVERIFY(!(EngineInfo::Version("1.1.1") <= "1.0.9"));
- QVERIFY(!(EngineInfo::Version("1.1.1") <= "0.9.9"));
-
- QVERIFY(!(EngineInfo::Version("1.1.1") == "2.0.0"));
- QVERIFY(!(EngineInfo::Version("1.1.1") == "1.2.0"));
- QVERIFY(!(EngineInfo::Version("1.1.1") == "1.1.2"));
- QVERIFY(EngineInfo::Version("1.1.1") == "1.1.1");
- QVERIFY(!(EngineInfo::Version("1.1.1") == "1.1.0"));
- QVERIFY(!(EngineInfo::Version("1.1.1") == "1.0.9"));
- QVERIFY(!(EngineInfo::Version("1.1.1") == "0.9.9"));
-
- QVERIFY(EngineInfo::Version("1.1.1") != "2.0.0");
- QVERIFY(EngineInfo::Version("1.1.1") != "1.2.0");
- QVERIFY(EngineInfo::Version("1.1.1") != "1.1.2");
- QVERIFY(!(EngineInfo::Version("1.1.1") != "1.1.1"));
- QVERIFY(EngineInfo::Version("1.1.1") != "1.1.0");
- QVERIFY(EngineInfo::Version("1.1.1") != "1.0.9");
- QVERIFY(EngineInfo::Version("1.1.1") != "0.9.9");
-
- QVERIFY(!(EngineInfo::Version("1.1.1") >= "2.0.0"));
- QVERIFY(!(EngineInfo::Version("1.1.1") >= "1.2.0"));
- QVERIFY(!(EngineInfo::Version("1.1.1") >= "1.1.2"));
- QVERIFY(EngineInfo::Version("1.1.1") >= "1.1.1");
- QVERIFY(EngineInfo::Version("1.1.1") >= "1.1.0");
- QVERIFY(EngineInfo::Version("1.1.1") >= "1.0.9");
- QVERIFY(EngineInfo::Version("1.1.1") >= "0.9.9");
- }
-
- void initTestCase()
- {
- QGpgMETest::initTestCase();
- const QString gpgHome = qgetenv("GNUPGHOME");
- QVERIFY(copyKeyrings(gpgHome, mDir.path()));
- qputenv("GNUPGHOME", mDir.path().toUtf8());
- QFile conf(mDir.path() + QStringLiteral("/gpg.conf"));
- QVERIFY(conf.open(QIODevice::WriteOnly));
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() >= "2.2.18") {
- conf.write("allow-weak-key-signatures");
- }
- conf.close();
- }
-
-private:
- QTemporaryDir mDir;
-};
-
-QTEST_MAIN(TestVarious)
-
-#include "t-various.moc"
diff --git a/lang/qt/tests/t-verify.cpp b/lang/qt/tests/t-verify.cpp
deleted file mode 100644
index f1bba08f..00000000
--- a/lang/qt/tests/t-verify.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/* t-verifiy.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include <QDebug>
-#include <QTest>
-
-
-#include "protocol.h"
-
-#include "verifyopaquejob.h"
-#include <gpgme++/verificationresult.h>
-#include <gpgme++/key.h>
-
-#include "t-support.h"
-
-using namespace QGpgME;
-using namespace GpgME;
-
-static const char testMsg1[] =
-"-----BEGIN PGP MESSAGE-----\n"
-"\n"
-"owGbwMvMwCSoW1RzPCOz3IRxjXQSR0lqcYleSUWJTZOvjVdpcYmCu1+oQmaJIleH\n"
-"GwuDIBMDGysTSIqBi1MApi+nlGGuwDeHao53HBr+FoVGP3xX+kvuu9fCMJvl6IOf\n"
-"y1kvP4y+8D5a11ang0udywsA\n"
-"=Crq6\n"
-"-----END PGP MESSAGE-----\n";
-
-
-class VerifyTest: public QGpgMETest
-{
- Q_OBJECT
-
-private Q_SLOTS:
-
- /* Check that a signature always has a key. */
- void testSignatureKey()
- {
- const QByteArray signedData(testMsg1);
- auto verifyJob = openpgp()->verifyOpaqueJob(true);
- QByteArray verified;
-
- auto result = verifyJob->exec(signedData, verified);
- QVERIFY(!result.error());
- delete verifyJob;
-
- QVERIFY(result.numSignatures() == 1);
- auto sig = result.signatures()[0];
-
- const auto key = sig.key(true, false);
- QVERIFY(!key.isNull());
-
- bool found = false;
- for (const auto &subkey: key.subkeys()) {
- if (!strcmp (subkey.fingerprint(), sig.fingerprint())) {
- found = true;
- }
- }
- QVERIFY(found);
- }
-};
-
-QTEST_MAIN(VerifyTest)
-#include "t-verify.moc"
diff --git a/lang/qt/tests/t-wkdlookup.cpp b/lang/qt/tests/t-wkdlookup.cpp
deleted file mode 100644
index 03b7823a..00000000
--- a/lang/qt/tests/t-wkdlookup.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/* t-wkdlookup.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2021 g10 Code GmbH
- Software engineering by Ingo Klöcker <[email protected]>
-
- 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 "t-support.h"
-
-#include <gpgme++/data.h>
-#include <gpgme++/engineinfo.h>
-#include "protocol.h"
-#include "wkdlookupjob.h"
-#include "wkdlookupresult.h"
-
-#include <QDebug>
-#include <QSignalSpy>
-#include <QTest>
-
-#include <algorithm>
-
-using namespace QGpgME;
-using namespace GpgME;
-
-static const char *requiredVersion = "2.1.12";
-
-namespace
-{
-bool keyHasUserIDWithMatchingEmailAddress(const Key &key, const QString &expectedEmailAddress)
-{
- const auto email = expectedEmailAddress.toLower();
- const auto userIds = key.userIDs();
- return std::any_of(
- std::begin(userIds), std::end(userIds),
- [email](const UserID &uid) {
- return email == QString::fromUtf8(uid.email()).toLower();
- });
-}
-}
-
-class WKDLookupTest : public QGpgMETest
-{
- Q_OBJECT
-
-private Q_SLOTS:
-
- void testWKDLookupAsync()
- {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < requiredVersion) {
- QSKIP("dirmngr does not yet support WKD lookup");
- }
- if (!doOnlineTests()) {
- QSKIP("Set DO_ONLINE_TESTS environment variable to run this test.");
- }
- const QString email = QLatin1String{"[email protected]"};
-
- WKDLookupResult result;
- auto *job = openpgp()->wkdLookupJob();
- connect(job, &WKDLookupJob::result, job, [this, &result](const WKDLookupResult &result_, const QString &, const Error &)
- {
- result = result_;
- Q_EMIT asyncDone();
- });
- job->start(email);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- QVERIFY(result.error().code() == GPG_ERR_NO_ERROR);
- QCOMPARE(result.pattern(), "[email protected]");
- QCOMPARE(result.source(), "https://openpgpkey.gnupg.org");
- const auto keys = result.keyData().toKeys(GpgME::OpenPGP);
- QVERIFY(keys.size() == 1);
- QVERIFY(keyHasUserIDWithMatchingEmailAddress(keys.front(), email));
- }
-
- void testWKDLookupSync()
- {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < requiredVersion) {
- QSKIP("dirmngr does not yet support WKD lookup");
- }
- if (!doOnlineTests()) {
- QSKIP("Set DO_ONLINE_TESTS environment variable to run this test.");
- }
- const QString email = QLatin1String{"[email protected]"};
-
- auto *job = openpgp()->wkdLookupJob();
- const auto result = job->exec(email);
-
- QVERIFY(result.error().code() == GPG_ERR_NO_ERROR);
- QCOMPARE(result.pattern(), "[email protected]");
- QCOMPARE(result.source(), "https://openpgpkey.gnupg.org");
- const auto keys = result.keyData().toKeys(GpgME::OpenPGP);
- QVERIFY(keys.size() == 1);
- QVERIFY(keyHasUserIDWithMatchingEmailAddress(keys.front(), email));
- }
-
- void testLookupWithNoResultAsync()
- {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < requiredVersion) {
- QSKIP("dirmngr does not yet support WKD lookup");
- }
- if (!doOnlineTests()) {
- QSKIP("Set DO_ONLINE_TESTS environment variable to run this test.");
- }
- const QString email = QLatin1String{"[email protected]"};
-
- WKDLookupResult result;
- auto *job = openpgp()->wkdLookupJob();
- connect(job, &WKDLookupJob::result, job, [this, &result](const WKDLookupResult &result_, const QString &, const Error &)
- {
- result = result_;
- Q_EMIT asyncDone();
- });
- job->start(email);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- QVERIFY(result.error().code() == GPG_ERR_NO_ERROR);
- QCOMPARE(result.pattern(), "[email protected]");
- QCOMPARE(result.source(), "");
- QVERIFY(result.keyData().isNull());
- }
-};
-
-QTEST_MAIN(WKDLookupTest)
-
-#include "t-wkdlookup.moc"
diff --git a/lang/qt/tests/t-wkspublish.cpp b/lang/qt/tests/t-wkspublish.cpp
deleted file mode 100644
index cb75d149..00000000
--- a/lang/qt/tests/t-wkspublish.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-/* t-wkspublish.cpp
-
- This file is part of qgpgme, the Qt API binding for gpgme
- Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
- Software engineering by Intevation GmbH
-
- QGpgME is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- QGpgME is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
- In addition, as a special exception, the copyright holders give
- permission to link the code of this program with any edition of
- the Qt library by Trolltech AS, Norway (or with modified versions
- of Qt that use the same license as Qt), and distribute linked
- combinations including the two. You must obey the GNU General
- Public License in all respects for all of the code used other than
- Qt. If you modify this file, you may extend this exception to
- your version of the file, but you are not obligated to do so. If
- you do not wish to do so, delete this exception statement from
- your version.
-*/
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include <QDebug>
-#include <QTest>
-#include <QSignalSpy>
-#include <QTemporaryDir>
-#include "wkspublishjob.h"
-#include "keygenerationjob.h"
-#include <gpgme++/keygenerationresult.h>
-#include "importjob.h"
-#include <gpgme++/importresult.h>
-#include "protocol.h"
-#include <gpgme++/engineinfo.h>
-
-#include "t-support.h"
-
-using namespace QGpgME;
-using namespace GpgME;
-
-//#define DO_ONLINE_TESTS
-
-#define TEST_ADDRESS "[email protected]"
-
-static const char *testSecKey =
-"-----BEGIN PGP PRIVATE KEY BLOCK-----\n"
-"\n"
-"lHgEV77hVhMJKyQDAwIIAQEHAgMEN3qKqBr9EecnfUnpw8RS8DHAjJqhwm2HAoEE\n"
-"3yfQQ9w8uB/bKm5dqW4HML3JWRH8YoJaKSVrJY2D1FZUY+vHlgABAKDwEAB0HND8\n"
-"5kbxiJmqKIuuNqCJ2jHgs9G0xk4GdKvZEdq0JlRlc3QgVXNlciAyIDx0ZXN0dXNl\n"
-"cjJAdGVzdC5nbnVwZy5vcmc+iHkEExMIACEFAle+4VYCGwMFCwkIBwIGFQgJCgsC\n"
-"BBYCAwECHgECF4AACgkQRVRoUEJO+6zgFQD7BF3pnS3w3A7J9y+Y3kyGfmscXFWJ\n"
-"Kme1PAsAlVSm1y4A+weReMvWFYHJH257v94yhStmV8egGoybsNDttNAW53cbnHwE\n"
-"V77hVhIJKyQDAwIIAQEHAgMEX+6cF0HEn4g3ztFvwHyr7uwXMVYUGL3lE3mjhnV3\n"
-"SbY6Dmy3OeFVnEVkawHqSv+HobpQTeEqNoQHAoIiXFCRlgMBCAcAAP9FykiyDspm\n"
-"T33XWRPD+LAOmaIU7CIhfv9+lVkeExlU1w+qiGEEGBMIAAkFAle+4VYCGwwACgkQ\n"
-"RVRoUEJO+6xjhgD/ZJ/MwYZJPk/xPYhTP8+wF+tErVNA8w3pP9D69dgUPdcA/izZ\n"
-"Pji6YetVhgsyaHc4PrKynsk5G6nM3KkAOehUQsX8\n"
-"=S/Wa\n"
-"-----END PGP PRIVATE KEY BLOCK-----\n";
-
-static const char *testResponse =
-"From [email protected] Thu Aug 25 12:15:54 2016\n"
-"Return-Path: <[email protected]>\n"
-"Subject: Confirm your key publication\n"
-"X-Wks-Loop: webkey.g10code.com\n"
-"MIME-Version: 1.0\n"
-"Content-Type: multipart/encrypted; protocol=\"application/pgp-encrypted\";\n"
-" boundary=\"=-=01-wbu5fr9nu6fix5tcojjo=-=\"\n"
-"Date: Thu, 25 Aug 2016 12:15:54 +0000\n"
-"Message-Id: <[email protected]>\n"
-"Sender: <[email protected]>\n"
-"X-Kolab-Scheduling-Message: FALSE\n"
-"\n"
-" \n"
-"\n"
-"--=-=01-wbu5fr9nu6fix5tcojjo=-=\n"
-"Content-Type: application/pgp-encrypted\n"
-"\n"
-"Version: 1\n"
-"\n"
-"--=-=01-wbu5fr9nu6fix5tcojjo=-=\n"
-"Content-Type: application/octet-stream\n"
-"\n"
-"-----BEGIN PGP MESSAGE-----\n"
-"Version: GnuPG v2\n"
-"\n"
-"hH4D8pSp7hUsFUASAgMEg0w39E6d0TkFYxLbT6n3YcoKTT+Ur/c7Sn1ECyL7Rnuk\n"
-"cmPO0adt3JxueK7Oz5COlk32SECFODdF3cQuDhkGxzC6Sfc4SfisdILmNhaT/MeW\n"
-"8a+yE4skSK70absif4kw5XkvxXNxHeIHfAteP50jPJLSwEsBTEceb9cRMoP7s8w0\n"
-"lYyi+RWQ7UKlKKywtcRCL4ow2H7spjx+a+3FzNOAoy7K0/thhLVRk8z+iuPi0/4n\n"
-"Z2Ql60USLLUlfV2ZIpXdCd+5GjTJsnGhDos1pas5TZcOOAxO12Cg5TcqHISOaqa8\n"
-"6BqxcKCU3NypIynOKHj375KArSs0WsEH8HWHyBBHB+NYtNpnTAuHNKxM+JtNxf+U\n"
-"NfD2zptS6kyiHLw+4zjL5pEV7RHS2PBwWBDS6vhnyybNwckleya96U04iYiGRYGE\n"
-"lUUR6Fl8H6x04dItFH1/jJA6Ppcu4FoYou04HADWCqJXPTgztjiW1/9QoCeXl5lm\n"
-"CcOCcuw7lXp+qTejuns=\n"
-"=SsWX\n"
-"-----END PGP MESSAGE-----\n"
-"\n"
-"--=-=01-wbu5fr9nu6fix5tcojjo=-=--\n";
-
-
-class WKSPublishTest : public QGpgMETest
-{
- Q_OBJECT
-
-private Q_SLOTS:
- void testUnsupported()
- {
- // First check if it is supported
- auto job = openpgp()->wksPublishJob();
- connect(job, &WKSPublishJob::result, this,
- [this] (Error err, QByteArray, QByteArray, QString, Error) {
- QVERIFY(err);
- Q_EMIT asyncDone();
- });
- job->startCheck ("testuser1@localhost");
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
- }
-#ifdef DO_ONLINE_TESTS
-private Q_SLOTS:
-#else
-private:
-#endif
- void testWSKPublishSupport()
- {
- // First check if it is supported
- auto job = openpgp()->wksPublishJob();
- connect(job, &WKSPublishJob::result, this,
- [this] (Error err, QByteArray, QByteArray, QString, Error) {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.0.16") {
- std::cout << err;
- QVERIFY(err);
- } else {
- QVERIFY(!err);
- }
- Q_EMIT asyncDone();
- });
- job->startCheck ("[email protected]");
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
- }
-
- void testWKSPublishErrors() {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.0.16") {
- /* Not supported */
- return;
- }
- auto job = openpgp()->wksPublishJob();
- connect(job, &WKSPublishJob::result, this,
- [this] (Error err, QByteArray, QByteArray, QString, Error) {
- QVERIFY(err);
- Q_EMIT asyncDone();
- });
- job->startCreate("AB874F24E98EBB8487EE7B170F8E3D97FE7011B7",
- QStringLiteral("[email protected]"));
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
- }
-
- void testWKSPublishCreate() {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.0.16") {
- /* Not supported */
- return;
- }
- /* First generate a test key */
- const QString args = QStringLiteral("<GnupgKeyParms format=\"internal\">\n"
- "%no-protection\n"
- "%transient-key\n"
- "key-type: ECDSA\n"
- "key-curve: brainpoolP256r1\n"
- "key-usage: sign\n"
- "subkey-type: ECDH\n"
- "subkey-curve: brainpoolP256r1\n"
- "subkey-usage: encrypt\n"
- "name-email: %1\n"
- "name-real: Test User\n"
- "</GnupgKeyParms>").arg(TEST_ADDRESS);
-
- auto keygenjob = openpgp()->keyGenerationJob();
- QByteArray fpr;
- connect(keygenjob, &KeyGenerationJob::result, this,
- [this, &fpr](KeyGenerationResult result, QByteArray, QString, Error)
- {
- QVERIFY(!result.error());
- fpr = QByteArray(result.fingerprint());
- QVERIFY(!fpr.isEmpty());
- Q_EMIT asyncDone();
- });
- keygenjob->start(args);
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- /* Then try to create a request. */
- auto job = openpgp()->wksPublishJob();
- connect(job, &WKSPublishJob::result, this,
- [this] (Error err, QByteArray out, QByteArray, QString, Error) {
- QVERIFY(!err);
- Q_EMIT asyncDone();
- const QString outstr = QString(out);
- QVERIFY(outstr.contains(
- QStringLiteral("-----BEGIN PGP PUBLIC KEY BLOCK-----")));
- QVERIFY(outstr.contains(
- QStringLiteral("Content-Type: application/pgp-keys")));
- QVERIFY(outstr.contains(
- QStringLiteral("From: " TEST_ADDRESS)));
- });
- job->startCreate(fpr.constData(), QLatin1String(TEST_ADDRESS));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
- }
-
- void testWKSPublishReceive() {
- if (GpgME::engineInfo(GpgME::GpgEngine).engineVersion() < "2.0.16") {
- /* Not supported */
- return;
- }
- auto importjob = openpgp()->importJob();
- connect(importjob, &ImportJob::result, this,
- [this](ImportResult result, QString, Error)
- {
- QVERIFY(!result.error());
- QVERIFY(!result.imports().empty());
- QVERIFY(result.numSecretKeysImported());
- Q_EMIT asyncDone();
- });
- importjob->start(QByteArray(testSecKey));
- QSignalSpy spy (this, SIGNAL(asyncDone()));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
-
- /* Get a response. */
- auto job = openpgp()->wksPublishJob();
- connect(job, &WKSPublishJob::result, this,
- [this] (Error err, QByteArray out, QByteArray, QString, Error) {
- QVERIFY(!err);
- Q_EMIT asyncDone();
- const QString outstr = QString(out);
- QVERIFY(outstr.contains(
- QStringLiteral("-----BEGIN PGP MESSAGE-----")));
- QVERIFY(outstr.contains(
- QStringLiteral("Content-Type: multipart/encrypted;")));
- QVERIFY(outstr.contains(
- QStringLiteral("From: " TEST_ADDRESS)));
- });
- job->startReceive(QByteArray(testResponse));
- QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
- }
-
- void initTestCase()
- {
- QGpgMETest::initTestCase();
- const QString gpgHome = qgetenv("GNUPGHOME");
- qputenv("GNUPGHOME", mDir.path().toUtf8());
- QVERIFY(mDir.isValid());
- QFile agentConf(mDir.path() + QStringLiteral("/gpg-agent.conf"));
- QVERIFY(agentConf.open(QIODevice::WriteOnly));
- agentConf.write("allow-loopback-pinentry");
- agentConf.close();
- }
-private:
- QTemporaryDir mDir;
-};
-
-QTEST_MAIN(WKSPublishTest)
-
-#include "t-wkspublish.moc"
diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4
deleted file mode 100644
index bd753b34..00000000
--- a/m4/ax_check_compile_flag.m4
+++ /dev/null
@@ -1,53 +0,0 @@
-# ===========================================================================
-# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
-#
-# DESCRIPTION
-#
-# Check whether the given FLAG works with the current language's compiler
-# or gives an error. (Warnings, however, are ignored)
-#
-# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
-# success/failure.
-#
-# If EXTRA-FLAGS is defined, it is added to the current language's default
-# flags (e.g. CFLAGS) when the check is done. The check is thus made with
-# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
-# force the compiler to issue an error when a bad flag is given.
-#
-# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
-#
-# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
-# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
-#
-# LICENSE
-#
-# Copyright (c) 2008 Guido U. Draheim <[email protected]>
-# Copyright (c) 2011 Maarten Bosmans <[email protected]>
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice
-# and this notice are preserved. This file is offered as-is, without any
-# warranty.
-
-#serial 6
-
-AC_DEFUN([AX_CHECK_COMPILE_FLAG],
-[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
-AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
-AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
- ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
- _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
- AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
- [AS_VAR_SET(CACHEVAR,[yes])],
- [AS_VAR_SET(CACHEVAR,[no])])
- _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
-AS_VAR_IF(CACHEVAR,yes,
- [m4_default([$2], :)],
- [m4_default([$3], :)])
-AS_VAR_POPDEF([CACHEVAR])dnl
-])dnl AX_CHECK_COMPILE_FLAGS
diff --git a/m4/ax_cxx_compile_stdcxx.m4 b/m4/ax_cxx_compile_stdcxx.m4
deleted file mode 100644
index a3d964c6..00000000
--- a/m4/ax_cxx_compile_stdcxx.m4
+++ /dev/null
@@ -1,1009 +0,0 @@
-# ===========================================================================
-# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional])
-#
-# DESCRIPTION
-#
-# Check for baseline language coverage in the compiler for the specified
-# version of the C++ standard. If necessary, add switches to CXX and
-# CXXCPP to enable support. VERSION may be '11', '14', '17', or '20' for
-# the respective C++ standard version.
-#
-# The second argument, if specified, indicates whether you insist on an
-# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
-# -std=c++11). If neither is specified, you get whatever works, with
-# preference for no added switch, and then for an extended mode.
-#
-# The third argument, if specified 'mandatory' or if left unspecified,
-# indicates that baseline support for the specified C++ standard is
-# required and that the macro should error out if no mode with that
-# support is found. If specified 'optional', then configuration proceeds
-# regardless, after defining HAVE_CXX${VERSION} if and only if a
-# supporting mode is found.
-#
-# LICENSE
-#
-# Copyright (c) 2008 Benjamin Kosnik <[email protected]>
-# Copyright (c) 2012 Zack Weinberg <[email protected]>
-# Copyright (c) 2013 Roy Stogner <[email protected]>
-# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <[email protected]>
-# Copyright (c) 2015 Paul Norman <[email protected]>
-# Copyright (c) 2015 Moritz Klammler <[email protected]>
-# Copyright (c) 2016, 2018 Krzesimir Nowak <[email protected]>
-# Copyright (c) 2019 Enji Cooper <[email protected]>
-# Copyright (c) 2020 Jason Merrill <[email protected]>
-# Copyright (c) 2021 Jörn Heusipp <[email protected]>
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice
-# and this notice are preserved. This file is offered as-is, without any
-# warranty.
-
-#serial 15
-
-dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
-dnl (serial version number 13).
-
-AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
- m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
- [$1], [14], [ax_cxx_compile_alternatives="14 1y"],
- [$1], [17], [ax_cxx_compile_alternatives="17 1z"],
- [$1], [20], [ax_cxx_compile_alternatives="20"],
- [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
- m4_if([$2], [], [],
- [$2], [ext], [],
- [$2], [noext], [],
- [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl
- m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true],
- [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true],
- [$3], [optional], [ax_cxx_compile_cxx$1_required=false],
- [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])])
- AC_LANG_PUSH([C++])dnl
- ac_success=no
-
- m4_if([$2], [], [dnl
- AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
- ax_cv_cxx_compile_cxx$1,
- [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
- [ax_cv_cxx_compile_cxx$1=yes],
- [ax_cv_cxx_compile_cxx$1=no])])
- if test x$ax_cv_cxx_compile_cxx$1 = xyes; then
- ac_success=yes
- fi])
-
- m4_if([$2], [noext], [], [dnl
- if test x$ac_success = xno; then
- for alternative in ${ax_cxx_compile_alternatives}; do
- switch="-std=gnu++${alternative}"
- cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
- AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
- $cachevar,
- [ac_save_CXX="$CXX"
- CXX="$CXX $switch"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
- [eval $cachevar=yes],
- [eval $cachevar=no])
- CXX="$ac_save_CXX"])
- if eval test x\$$cachevar = xyes; then
- CXX="$CXX $switch"
- if test -n "$CXXCPP" ; then
- CXXCPP="$CXXCPP $switch"
- fi
- ac_success=yes
- break
- fi
- done
- fi])
-
- m4_if([$2], [ext], [], [dnl
- if test x$ac_success = xno; then
- dnl HP's aCC needs +std=c++11 according to:
- dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
- dnl Cray's crayCC needs "-h std=c++11"
- for alternative in ${ax_cxx_compile_alternatives}; do
- for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
- cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
- AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
- $cachevar,
- [ac_save_CXX="$CXX"
- CXX="$CXX $switch"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
- [eval $cachevar=yes],
- [eval $cachevar=no])
- CXX="$ac_save_CXX"])
- if eval test x\$$cachevar = xyes; then
- CXX="$CXX $switch"
- if test -n "$CXXCPP" ; then
- CXXCPP="$CXXCPP $switch"
- fi
- ac_success=yes
- break
- fi
- done
- if test x$ac_success = xyes; then
- break
- fi
- done
- fi])
- AC_LANG_POP([C++])
- if test x$ax_cxx_compile_cxx$1_required = xtrue; then
- if test x$ac_success = xno; then
- AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.])
- fi
- fi
- if test x$ac_success = xno; then
- HAVE_CXX$1=0
- AC_MSG_NOTICE([No compiler with C++$1 support was found])
- else
- HAVE_CXX$1=1
- AC_DEFINE(HAVE_CXX$1,1,
- [define if the compiler supports basic C++$1 syntax])
- fi
- AC_SUBST(HAVE_CXX$1)
-])
-
-
-dnl Test body for checking C++11 support
-
-m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11],
- _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
-)
-
-dnl Test body for checking C++14 support
-
-m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
- _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
- _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
-)
-
-dnl Test body for checking C++17 support
-
-m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
- _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
- _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
- _AX_CXX_COMPILE_STDCXX_testbody_new_in_17
-)
-
-dnl Test body for checking C++20 support
-
-m4_define([_AX_CXX_COMPILE_STDCXX_testbody_20],
- _AX_CXX_COMPILE_STDCXX_testbody_new_in_11
- _AX_CXX_COMPILE_STDCXX_testbody_new_in_14
- _AX_CXX_COMPILE_STDCXX_testbody_new_in_17
- _AX_CXX_COMPILE_STDCXX_testbody_new_in_20
-)
-
-
-dnl Tests for new features in C++11
-
-m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
-
-// If the compiler admits that it is not ready for C++11, why torture it?
-// Hopefully, this will speed up the test.
-
-#ifndef __cplusplus
-
-#error "This is not a C++ compiler"
-
-// MSVC always sets __cplusplus to 199711L in older versions; newer versions
-// only set it correctly if /Zc:__cplusplus is specified as well as a
-// /std:c++NN switch:
-// https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
-#elif __cplusplus < 201103L && !defined _MSC_VER
-
-#error "This is not a C++11 compiler"
-
-#else
-
-namespace cxx11
-{
-
- namespace test_static_assert
- {
-
- template <typename T>
- struct check
- {
- static_assert(sizeof(int) <= sizeof(T), "not big enough");
- };
-
- }
-
- namespace test_final_override
- {
-
- struct Base
- {
- virtual ~Base() {}
- virtual void f() {}
- };
-
- struct Derived : public Base
- {
- virtual ~Derived() override {}
- virtual void f() override {}
- };
-
- }
-
- namespace test_double_right_angle_brackets
- {
-
- template < typename T >
- struct check {};
-
- typedef check<void> single_type;
- typedef check<check<void>> double_type;
- typedef check<check<check<void>>> triple_type;
- typedef check<check<check<check<void>>>> quadruple_type;
-
- }
-
- namespace test_decltype
- {
-
- int
- f()
- {
- int a = 1;
- decltype(a) b = 2;
- return a + b;
- }
-
- }
-
- namespace test_type_deduction
- {
-
- template < typename T1, typename T2 >
- struct is_same
- {
- static const bool value = false;
- };
-
- template < typename T >
- struct is_same<T, T>
- {
- static const bool value = true;
- };
-
- template < typename T1, typename T2 >
- auto
- add(T1 a1, T2 a2) -> decltype(a1 + a2)
- {
- return a1 + a2;
- }
-
- int
- test(const int c, volatile int v)
- {
- static_assert(is_same<int, decltype(0)>::value == true, "");
- static_assert(is_same<int, decltype(c)>::value == false, "");
- static_assert(is_same<int, decltype(v)>::value == false, "");
- auto ac = c;
- auto av = v;
- auto sumi = ac + av + 'x';
- auto sumf = ac + av + 1.0;
- static_assert(is_same<int, decltype(ac)>::value == true, "");
- static_assert(is_same<int, decltype(av)>::value == true, "");
- static_assert(is_same<int, decltype(sumi)>::value == true, "");
- static_assert(is_same<int, decltype(sumf)>::value == false, "");
- static_assert(is_same<int, decltype(add(c, v))>::value == true, "");
- return (sumf > 0.0) ? sumi : add(c, v);
- }
-
- }
-
- namespace test_noexcept
- {
-
- int f() { return 0; }
- int g() noexcept { return 0; }
-
- static_assert(noexcept(f()) == false, "");
- static_assert(noexcept(g()) == true, "");
-
- }
-
- namespace test_constexpr
- {
-
- template < typename CharT >
- unsigned long constexpr
- strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
- {
- return *s ? strlen_c_r(s + 1, acc + 1) : acc;
- }
-
- template < typename CharT >
- unsigned long constexpr
- strlen_c(const CharT *const s) noexcept
- {
- return strlen_c_r(s, 0UL);
- }
-
- static_assert(strlen_c("") == 0UL, "");
- static_assert(strlen_c("1") == 1UL, "");
- static_assert(strlen_c("example") == 7UL, "");
- static_assert(strlen_c("another\0example") == 7UL, "");
-
- }
-
- namespace test_rvalue_references
- {
-
- template < int N >
- struct answer
- {
- static constexpr int value = N;
- };
-
- answer<1> f(int&) { return answer<1>(); }
- answer<2> f(const int&) { return answer<2>(); }
- answer<3> f(int&&) { return answer<3>(); }
-
- void
- test()
- {
- int i = 0;
- const int c = 0;
- static_assert(decltype(f(i))::value == 1, "");
- static_assert(decltype(f(c))::value == 2, "");
- static_assert(decltype(f(0))::value == 3, "");
- }
-
- }
-
- namespace test_uniform_initialization
- {
-
- struct test
- {
- static const int zero {};
- static const int one {1};
- };
-
- static_assert(test::zero == 0, "");
- static_assert(test::one == 1, "");
-
- }
-
- namespace test_lambdas
- {
-
- void
- test1()
- {
- auto lambda1 = [](){};
- auto lambda2 = lambda1;
- lambda1();
- lambda2();
- }
-
- int
- test2()
- {
- auto a = [](int i, int j){ return i + j; }(1, 2);
- auto b = []() -> int { return '0'; }();
- auto c = [=](){ return a + b; }();
- auto d = [&](){ return c; }();
- auto e = [a, &b](int x) mutable {
- const auto identity = [](int y){ return y; };
- for (auto i = 0; i < a; ++i)
- a += b--;
- return x + identity(a + b);
- }(0);
- return a + b + c + d + e;
- }
-
- int
- test3()
- {
- const auto nullary = [](){ return 0; };
- const auto unary = [](int x){ return x; };
- using nullary_t = decltype(nullary);
- using unary_t = decltype(unary);
- const auto higher1st = [](nullary_t f){ return f(); };
- const auto higher2nd = [unary](nullary_t f1){
- return [unary, f1](unary_t f2){ return f2(unary(f1())); };
- };
- return higher1st(nullary) + higher2nd(nullary)(unary);
- }
-
- }
-
- namespace test_variadic_templates
- {
-
- template <int...>
- struct sum;
-
- template <int N0, int... N1toN>
- struct sum<N0, N1toN...>
- {
- static constexpr auto value = N0 + sum<N1toN...>::value;
- };
-
- template <>
- struct sum<>
- {
- static constexpr auto value = 0;
- };
-
- static_assert(sum<>::value == 0, "");
- static_assert(sum<1>::value == 1, "");
- static_assert(sum<23>::value == 23, "");
- static_assert(sum<1, 2>::value == 3, "");
- static_assert(sum<5, 5, 11>::value == 21, "");
- static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, "");
-
- }
-
- // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
- // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function
- // because of this.
- namespace test_template_alias_sfinae
- {
-
- struct foo {};
-
- template<typename T>
- using member = typename T::member_type;
-
- template<typename T>
- void func(...) {}
-
- template<typename T>
- void func(member<T>*) {}
-
- void test();
-
- void test() { func<foo>(0); }
-
- }
-
-} // namespace cxx11
-
-#endif // __cplusplus >= 201103L
-
-]])
-
-
-dnl Tests for new features in C++14
-
-m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[
-
-// If the compiler admits that it is not ready for C++14, why torture it?
-// Hopefully, this will speed up the test.
-
-#ifndef __cplusplus
-
-#error "This is not a C++ compiler"
-
-#elif __cplusplus < 201402L && !defined _MSC_VER
-
-#error "This is not a C++14 compiler"
-
-#else
-
-namespace cxx14
-{
-
- namespace test_polymorphic_lambdas
- {
-
- int
- test()
- {
- const auto lambda = [](auto&&... args){
- const auto istiny = [](auto x){
- return (sizeof(x) == 1UL) ? 1 : 0;
- };
- const int aretiny[] = { istiny(args)... };
- return aretiny[0];
- };
- return lambda(1, 1L, 1.0f, '1');
- }
-
- }
-
- namespace test_binary_literals
- {
-
- constexpr auto ivii = 0b0000000000101010;
- static_assert(ivii == 42, "wrong value");
-
- }
-
- namespace test_generalized_constexpr
- {
-
- template < typename CharT >
- constexpr unsigned long
- strlen_c(const CharT *const s) noexcept
- {
- auto length = 0UL;
- for (auto p = s; *p; ++p)
- ++length;
- return length;
- }
-
- static_assert(strlen_c("") == 0UL, "");
- static_assert(strlen_c("x") == 1UL, "");
- static_assert(strlen_c("test") == 4UL, "");
- static_assert(strlen_c("another\0test") == 7UL, "");
-
- }
-
- namespace test_lambda_init_capture
- {
-
- int
- test()
- {
- auto x = 0;
- const auto lambda1 = [a = x](int b){ return a + b; };
- const auto lambda2 = [a = lambda1(x)](){ return a; };
- return lambda2();
- }
-
- }
-
- namespace test_digit_separators
- {
-
- constexpr auto ten_million = 100'000'000;
- static_assert(ten_million == 100000000, "");
-
- }
-
- namespace test_return_type_deduction
- {
-
- auto f(int& x) { return x; }
- decltype(auto) g(int& x) { return x; }
-
- template < typename T1, typename T2 >
- struct is_same
- {
- static constexpr auto value = false;
- };
-
- template < typename T >
- struct is_same<T, T>
- {
- static constexpr auto value = true;
- };
-
- int
- test()
- {
- auto x = 0;
- static_assert(is_same<int, decltype(f(x))>::value, "");
- static_assert(is_same<int&, decltype(g(x))>::value, "");
- return x;
- }
-
- }
-
-} // namespace cxx14
-
-#endif // __cplusplus >= 201402L
-
-]])
-
-
-dnl Tests for new features in C++17
-
-m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
-
-// If the compiler admits that it is not ready for C++17, why torture it?
-// Hopefully, this will speed up the test.
-
-#ifndef __cplusplus
-
-#error "This is not a C++ compiler"
-
-#elif __cplusplus < 201703L && !defined _MSC_VER
-
-#error "This is not a C++17 compiler"
-
-#else
-
-#include <initializer_list>
-#include <utility>
-#include <type_traits>
-
-namespace cxx17
-{
-
- namespace test_constexpr_lambdas
- {
-
- constexpr int foo = [](){return 42;}();
-
- }
-
- namespace test::nested_namespace::definitions
- {
-
- }
-
- namespace test_fold_expression
- {
-
- template<typename... Args>
- int multiply(Args... args)
- {
- return (args * ... * 1);
- }
-
- template<typename... Args>
- bool all(Args... args)
- {
- return (args && ...);
- }
-
- }
-
- namespace test_extended_static_assert
- {
-
- static_assert (true);
-
- }
-
- namespace test_auto_brace_init_list
- {
-
- auto foo = {5};
- auto bar {5};
-
- static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value);
- static_assert(std::is_same<int, decltype(bar)>::value);
- }
-
- namespace test_typename_in_template_template_parameter
- {
-
- template<template<typename> typename X> struct D;
-
- }
-
- namespace test_fallthrough_nodiscard_maybe_unused_attributes
- {
-
- int f1()
- {
- return 42;
- }
-
- [[nodiscard]] int f2()
- {
- [[maybe_unused]] auto unused = f1();
-
- switch (f1())
- {
- case 17:
- f1();
- [[fallthrough]];
- case 42:
- f1();
- }
- return f1();
- }
-
- }
-
- namespace test_extended_aggregate_initialization
- {
-
- struct base1
- {
- int b1, b2 = 42;
- };
-
- struct base2
- {
- base2() {
- b3 = 42;
- }
- int b3;
- };
-
- struct derived : base1, base2
- {
- int d;
- };
-
- derived d1 {{1, 2}, {}, 4}; // full initialization
- derived d2 {{}, {}, 4}; // value-initialized bases
-
- }
-
- namespace test_general_range_based_for_loop
- {
-
- struct iter
- {
- int i;
-
- int& operator* ()
- {
- return i;
- }
-
- const int& operator* () const
- {
- return i;
- }
-
- iter& operator++()
- {
- ++i;
- return *this;
- }
- };
-
- struct sentinel
- {
- int i;
- };
-
- bool operator== (const iter& i, const sentinel& s)
- {
- return i.i == s.i;
- }
-
- bool operator!= (const iter& i, const sentinel& s)
- {
- return !(i == s);
- }
-
- struct range
- {
- iter begin() const
- {
- return {0};
- }
-
- sentinel end() const
- {
- return {5};
- }
- };
-
- void f()
- {
- range r {};
-
- for (auto i : r)
- {
- [[maybe_unused]] auto v = i;
- }
- }
-
- }
-
- namespace test_lambda_capture_asterisk_this_by_value
- {
-
- struct t
- {
- int i;
- int foo()
- {
- return [*this]()
- {
- return i;
- }();
- }
- };
-
- }
-
- namespace test_enum_class_construction
- {
-
- enum class byte : unsigned char
- {};
-
- byte foo {42};
-
- }
-
- namespace test_constexpr_if
- {
-
- template <bool cond>
- int f ()
- {
- if constexpr(cond)
- {
- return 13;
- }
- else
- {
- return 42;
- }
- }
-
- }
-
- namespace test_selection_statement_with_initializer
- {
-
- int f()
- {
- return 13;
- }
-
- int f2()
- {
- if (auto i = f(); i > 0)
- {
- return 3;
- }
-
- switch (auto i = f(); i + 4)
- {
- case 17:
- return 2;
-
- default:
- return 1;
- }
- }
-
- }
-
- namespace test_template_argument_deduction_for_class_templates
- {
-
- template <typename T1, typename T2>
- struct pair
- {
- pair (T1 p1, T2 p2)
- : m1 {p1},
- m2 {p2}
- {}
-
- T1 m1;
- T2 m2;
- };
-
- void f()
- {
- [[maybe_unused]] auto p = pair{13, 42u};
- }
-
- }
-
- namespace test_non_type_auto_template_parameters
- {
-
- template <auto n>
- struct B
- {};
-
- B<5> b1;
- B<'a'> b2;
-
- }
-
- namespace test_structured_bindings
- {
-
- int arr[2] = { 1, 2 };
- std::pair<int, int> pr = { 1, 2 };
-
- auto f1() -> int(&)[2]
- {
- return arr;
- }
-
- auto f2() -> std::pair<int, int>&
- {
- return pr;
- }
-
- struct S
- {
- int x1 : 2;
- volatile double y1;
- };
-
- S f3()
- {
- return {};
- }
-
- auto [ x1, y1 ] = f1();
- auto& [ xr1, yr1 ] = f1();
- auto [ x2, y2 ] = f2();
- auto& [ xr2, yr2 ] = f2();
- const auto [ x3, y3 ] = f3();
-
- }
-
- namespace test_exception_spec_type_system
- {
-
- struct Good {};
- struct Bad {};
-
- void g1() noexcept;
- void g2();
-
- template<typename T>
- Bad
- f(T*, T*);
-
- template<typename T1, typename T2>
- Good
- f(T1*, T2*);
-
- static_assert (std::is_same_v<Good, decltype(f(g1, g2))>);
-
- }
-
- namespace test_inline_variables
- {
-
- template<class T> void f(T)
- {}
-
- template<class T> inline T g(T)
- {
- return T{};
- }
-
- template<> inline void f<>(int)
- {}
-
- template<> int g<>(int)
- {
- return 5;
- }
-
- }
-
-} // namespace cxx17
-
-#endif // __cplusplus < 201703L && !defined _MSC_VER
-
-]])
-
-
-dnl Tests for new features in C++20
-
-m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_20], [[
-
-#ifndef __cplusplus
-
-#error "This is not a C++ compiler"
-
-#elif __cplusplus < 202002L && !defined _MSC_VER
-
-#error "This is not a C++20 compiler"
-
-#else
-
-#include <version>
-
-namespace cxx20
-{
-
-// As C++20 supports feature test macros in the standard, there is no
-// immediate need to actually test for feature availability on the
-// Autoconf side.
-
-} // namespace cxx20
-
-#endif // __cplusplus < 202002L && !defined _MSC_VER
-
-]])
diff --git a/m4/ax_gcc_func_attribute.m4 b/m4/ax_gcc_func_attribute.m4
deleted file mode 100644
index fa4e089d..00000000
--- a/m4/ax_gcc_func_attribute.m4
+++ /dev/null
@@ -1,242 +0,0 @@
-# ===========================================================================
-# https://www.gnu.org/software/autoconf-archive/ax_gcc_func_attribute.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# AX_GCC_FUNC_ATTRIBUTE(ATTRIBUTE)
-#
-# DESCRIPTION
-#
-# This macro checks if the compiler supports one of GCC's function
-# attributes; many other compilers also provide function attributes with
-# the same syntax. Compiler warnings are used to detect supported
-# attributes as unsupported ones are ignored by default so quieting
-# warnings when using this macro will yield false positives.
-#
-# The ATTRIBUTE parameter holds the name of the attribute to be checked.
-#
-# If ATTRIBUTE is supported define HAVE_FUNC_ATTRIBUTE_<ATTRIBUTE>.
-#
-# The macro caches its result in the ax_cv_have_func_attribute_<attribute>
-# variable.
-#
-# The macro currently supports the following function attributes:
-#
-# alias
-# aligned
-# alloc_size
-# always_inline
-# artificial
-# cold
-# const
-# constructor
-# constructor_priority for constructor attribute with priority
-# deprecated
-# destructor
-# dllexport
-# dllimport
-# error
-# externally_visible
-# fallthrough
-# flatten
-# format
-# format_arg
-# gnu_format
-# gnu_inline
-# hot
-# ifunc
-# leaf
-# malloc
-# noclone
-# noinline
-# nonnull
-# noreturn
-# nothrow
-# optimize
-# pure
-# sentinel
-# sentinel_position
-# unused
-# used
-# visibility
-# warning
-# warn_unused_result
-# weak
-# weakref
-#
-# Unsupported function attributes will be tested with a prototype
-# returning an int and not accepting any arguments and the result of the
-# check might be wrong or meaningless so use with care.
-#
-# LICENSE
-#
-# Copyright (c) 2013 Gabriele Svelto <[email protected]>
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice
-# and this notice are preserved. This file is offered as-is, without any
-# warranty.
-
-#serial 13
-
-AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [
- AS_VAR_PUSHDEF([ac_var], [ax_cv_have_func_attribute_$1])
-
- AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [
- AC_LINK_IFELSE([AC_LANG_PROGRAM([
- m4_case([$1],
- [alias], [
- int foo( void ) { return 0; }
- int bar( void ) __attribute__(($1("foo")));
- ],
- [aligned], [
- int foo( void ) __attribute__(($1(32)));
- ],
- [alloc_size], [
- void *foo(int a) __attribute__(($1(1)));
- ],
- [always_inline], [
- inline __attribute__(($1)) int foo( void ) { return 0; }
- ],
- [artificial], [
- inline __attribute__(($1)) int foo( void ) { return 0; }
- ],
- [cold], [
- int foo( void ) __attribute__(($1));
- ],
- [const], [
- int foo( void ) __attribute__(($1));
- ],
- [constructor_priority], [
- int foo( void ) __attribute__((__constructor__(65535/2)));
- ],
- [constructor], [
- int foo( void ) __attribute__(($1));
- ],
- [deprecated], [
- int foo( void ) __attribute__(($1("")));
- ],
- [destructor], [
- int foo( void ) __attribute__(($1));
- ],
- [dllexport], [
- __attribute__(($1)) int foo( void ) { return 0; }
- ],
- [dllimport], [
- int foo( void ) __attribute__(($1));
- ],
- [error], [
- int foo( void ) __attribute__(($1("")));
- ],
- [externally_visible], [
- int foo( void ) __attribute__(($1));
- ],
- [fallthrough], [
- void foo( int x ) {switch (x) { case 1: __attribute__(($1)); case 2: break ; }};
- ],
- [flatten], [
- int foo( void ) __attribute__(($1));
- ],
- [format], [
- int foo(const char *p, ...) __attribute__(($1(printf, 1, 2)));
- ],
- [gnu_format], [
- int foo(const char *p, ...) __attribute__((format(gnu_printf, 1, 2)));
- ],
- [format_arg], [
- char *foo(const char *p) __attribute__(($1(1)));
- ],
- [gnu_inline], [
- inline __attribute__(($1)) int foo( void ) { return 0; }
- ],
- [hot], [
- int foo( void ) __attribute__(($1));
- ],
- [ifunc], [
- int my_foo( void ) { return 0; }
- static int (*resolve_foo(void))(void) { return my_foo; }
- int foo( void ) __attribute__(($1("resolve_foo")));
- ],
- [leaf], [
- __attribute__(($1)) int foo( void ) { return 0; }
- ],
- [malloc], [
- void *foo( void ) __attribute__(($1));
- ],
- [noclone], [
- int foo( void ) __attribute__(($1));
- ],
- [noinline], [
- __attribute__(($1)) int foo( void ) { return 0; }
- ],
- [nonnull], [
- int foo(char *p) __attribute__(($1(1)));
- ],
- [noreturn], [
- void foo( void ) __attribute__(($1));
- ],
- [nothrow], [
- int foo( void ) __attribute__(($1));
- ],
- [optimize], [
- __attribute__(($1(3))) int foo( void ) { return 0; }
- ],
- [pure], [
- int foo( void ) __attribute__(($1));
- ],
- [sentinel], [
- int foo(void *p, ...) __attribute__(($1));
- ],
- [sentinel_position], [
- int foo(void *p, ...) __attribute__(($1(1)));
- ],
- [returns_nonnull], [
- void *foo( void ) __attribute__(($1));
- ],
- [unused], [
- int foo( void ) __attribute__(($1));
- ],
- [used], [
- int foo( void ) __attribute__(($1));
- ],
- [visibility], [
- int foo_def( void ) __attribute__(($1("default")));
- int foo_hid( void ) __attribute__(($1("hidden")));
- int foo_int( void ) __attribute__(($1("internal")));
- int foo_pro( void ) __attribute__(($1("protected")));
- ],
- [warning], [
- int foo( void ) __attribute__(($1("")));
- ],
- [warn_unused_result], [
- int foo( void ) __attribute__(($1));
- ],
- [weak], [
- int foo( void ) __attribute__(($1));
- ],
- [weakref], [
- static int foo( void ) { return 0; }
- static int bar( void ) __attribute__(($1("foo")));
- ],
- [
- m4_warn([syntax], [Unsupported attribute $1, the test may fail])
- int foo( void ) __attribute__(($1));
- ]
- )], [])
- ],
- dnl GCC doesn't exit with an error if an unknown attribute is
- dnl provided but only outputs a warning, so accept the attribute
- dnl only if no warning were issued.
- [AS_IF([grep -- -Wattributes conftest.err],
- [AS_VAR_SET([ac_var], [no])],
- [AS_VAR_SET([ac_var], [yes])])],
- [AS_VAR_SET([ac_var], [no])])
- ])
-
- AS_IF([test yes = AS_VAR_GET([ac_var])],
- [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FUNC_ATTRIBUTE_$1), 1,
- [Define to 1 if the system has the `$1' function attribute])], [])
-
- AS_VAR_POPDEF([ac_var])
-])
diff --git a/m4/pkg.m4 b/m4/pkg.m4
deleted file mode 100644
index 5865daf1..00000000
--- a/m4/pkg.m4
+++ /dev/null
@@ -1,157 +0,0 @@
-# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
-#
-# Copyright © 2004 Scott James Remnant <[email protected]>.
-#
-# This program 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.
-#
-# This program 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# PKG_PROG_PKG_CONFIG([MIN-VERSION])
-# ----------------------------------
-AC_DEFUN([PKG_PROG_PKG_CONFIG],
-[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
-m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
-AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
-if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
- AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
-fi
-if test -n "$PKG_CONFIG"; then
- _pkg_min_version=m4_default([$1], [0.9.0])
- AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
- if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- PKG_CONFIG=""
- fi
-
-fi[]dnl
-])# PKG_PROG_PKG_CONFIG
-
-# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-#
-# Check to see whether a particular set of modules exists. Similar
-# to PKG_CHECK_MODULES(), but does not set variables or print errors.
-#
-#
-# Similar to PKG_CHECK_MODULES, make sure that the first instance of
-# this or PKG_CHECK_MODULES is called, or make sure to call
-# PKG_CHECK_EXISTS manually
-# --------------------------------------------------------------
-AC_DEFUN([PKG_CHECK_EXISTS],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-if test -n "$PKG_CONFIG" && \
- AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
- m4_ifval([$2], [$2], [:])
-m4_ifvaln([$3], [else
- $3])dnl
-fi])
-
-
-# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
-# ---------------------------------------------
-m4_define([_PKG_CONFIG],
-[if test -n "$PKG_CONFIG"; then
- if test -n "$$1"; then
- pkg_cv_[]$1="$$1"
- else
- PKG_CHECK_EXISTS([$3],
- [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
- [pkg_failed=yes])
- fi
-else
- pkg_failed=untried
-fi[]dnl
-])# _PKG_CONFIG
-
-# _PKG_SHORT_ERRORS_SUPPORTED
-# -----------------------------
-AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
- _pkg_short_errors_supported=yes
-else
- _pkg_short_errors_supported=no
-fi[]dnl
-])# _PKG_SHORT_ERRORS_SUPPORTED
-
-
-# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
-# [ACTION-IF-NOT-FOUND])
-#
-#
-# Note that if there is a possibility the first call to
-# PKG_CHECK_MODULES might not happen, you should be sure to include an
-# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
-#
-#
-# --------------------------------------------------------------
-AC_DEFUN([PKG_CHECK_MODULES],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
-AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
-
-pkg_failed=no
-AC_MSG_CHECKING([for $1])
-
-_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
-_PKG_CONFIG([$1][_LIBS], [libs], [$2])
-
-m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
-and $1[]_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.])
-
-if test $pkg_failed = yes; then
- _PKG_SHORT_ERRORS_SUPPORTED
- if test $_pkg_short_errors_supported = yes; then
- $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
- else
- $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
- fi
- # Put the nasty error message in config.log where it belongs
- echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
-
- ifelse([$4], , [AC_MSG_ERROR(dnl
-[Package requirements ($2) were not met:
-
-$$1_PKG_ERRORS
-
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-_PKG_TEXT
-])],
- [AC_MSG_RESULT([no])
- $4])
-elif test $pkg_failed = untried; then
- ifelse([$4], , [AC_MSG_FAILURE(dnl
-[The pkg-config script could not be found or is too old. Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-_PKG_TEXT
-
-To get pkg-config, see <https://www.freedesktop.org/software/pkgconfig>.])],
- [$4])
-else
- $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
- $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
- AC_MSG_RESULT([yes])
- ifelse([$3], , :, [$3])
-fi[]dnl
-])# PKG_CHECK_MODULES
diff --git a/m4/qt5.m4 b/m4/qt5.m4
deleted file mode 100644
index cc453261..00000000
--- a/m4/qt5.m4
+++ /dev/null
@@ -1,83 +0,0 @@
-dnl qt5.m4
-dnl Copyright (C) 2016 Intevation GmbH
-dnl
-dnl This file is part of gpgme and is provided under the same license as gpgme
-
-dnl Autoconf macro to find Qt5
-dnl
-dnl sets GPGME_QT5_LIBS, GPGME_QT5_CFLAGS, and MOC5
-dnl
-dnl if QT5 was found have_qt5_libs is set to yes
-
-AC_DEFUN([FIND_QT5],
-[
- have_qt5_libs="no";
-
- PKG_CHECK_MODULES(GPGME_QT5,
- Qt5Core >= 5.0.0,
- [have_qt5_libs="yes"],
- [have_qt5_libs="no"])
-
- PKG_CHECK_MODULES(GPGME_QT5TEST,
- Qt5Test >= 5.0.0,
- [have_qt5test_libs="yes"],
- [have_qt5test_libs="no"])
-
- if ! test "$have_w32_system" = yes; then
- if "$PKG_CONFIG" --variable qt_config Qt5Core | grep -q "reduce_relocations"; then
- GPGME_QT5_CFLAGS="$GPGME_QT5_CFLAGS -fpic"
- fi
- fi
- if test "$have_qt5_libs" = "yes"; then
- AC_CHECK_TOOL(MOC5, moc)
- AC_MSG_CHECKING([moc version])
- mocversion=`$MOC5 -v 2>&1`
- mocversiongrep=`echo $mocversion | grep -E "Qt 5|moc 5"`
- if test x"$mocversiongrep" != x"$mocversion"; then
- AC_MSG_RESULT([no])
- # moc was not the qt5 one, try with moc-qt5
- AC_CHECK_TOOL(MOC2, moc-qt5)
- mocversion=`$MOC2 -v 2>&1`
- mocversiongrep=`echo $mocversion | grep -E "Qt 5|moc-qt5 5|moc 5"`
- if test x"$mocversiongrep" != x"$mocversion"; then
- AC_CHECK_TOOL(QTCHOOSER, qtchooser)
- qt5tooldir=`QT_SELECT=qt5 qtchooser -print-env | grep QTTOOLDIR | cut -d '=' -f 2 | cut -d \" -f 2`
- mocversion=`$qt5tooldir/moc -v 2>&1`
- mocversiongrep=`echo $mocversion | grep -E "Qt 5|moc 5"`
- if test x"$mocversiongrep" != x"$mocversion"; then
- # no valid moc found
- have_qt5_libs="no";
- else
- MOC5=$qt5tooldir/moc
- fi
- else
- MOC5=$MOC2
- fi
- unset MOC2
- fi
- AC_MSG_RESULT([$mocversion])
- fi
- if test "$have_qt5_libs" = "yes"; then
- dnl Check that a binary can actually be build with this qt.
- dnl pkg-config may be set up in a way that it looks also for libraries
- dnl of the build system and not only for the host system. In that case
- dnl we check here that we can actually compile / link a qt application
- dnl for host.
- OLDCPPFLAGS=$CPPFLAGS
- CPPFLAGS=$GPGME_QT5_CFLAGS
- OLDLIBS=$LIBS
- LIBS=$GPGME_QT5_LIBS
- AC_LANG_PUSH(C++)
- AC_MSG_CHECKING([whether a simple qt program can be built])
- AC_LINK_IFELSE([AC_LANG_SOURCE([
- #include <QCoreApplication>
- int main (int argc, char **argv) {
- QCoreApplication app(argc, argv);
- app.exec();
- }])], [have_qt5_libs='yes'], [have_qt5_libs='no'])
- AC_MSG_RESULT([$have_qt5_libs])
- AC_LANG_POP()
- CPPFLAGS=$OLDCPPFLAGS
- LIBS=$OLDLIBS
- fi
-])
diff --git a/m4/qt6.m4 b/m4/qt6.m4
deleted file mode 100644
index f62a9069..00000000
--- a/m4/qt6.m4
+++ /dev/null
@@ -1,98 +0,0 @@
-dnl qt6.m4
-dnl Copyright (C) 2016 Intevation GmbH
-dnl
-dnl This file is part of gpgme and is provided under the same license as gpgme
-
-dnl Autoconf macro to find Qt6
-dnl
-dnl sets GPGME_QT6_LIBS, GPGME_QT6_CFLAGS, and MOC6
-dnl
-dnl if QT6 was found have_qt6_libs is set to yes
-
-AC_DEFUN([FIND_QT6],
-[
- have_qt6_libs="no";
-
- PKG_CHECK_MODULES(GPGME_QT6,
- Qt6Core >= 6.4.0,
- [have_qt6_libs="yes"],
- [have_qt6_libs="no"])
-
- PKG_CHECK_MODULES(GPGME_QT6TEST,
- Qt6Test >= 6.4.0,
- [have_qt6test_libs="yes"],
- [have_qt6test_libs="no"])
-
- if test "$have_qt6_libs" = "yes"; then
- # Qt6 moved moc to libexec
- qt6libexecdir=$($PKG_CONFIG --variable=libexecdir 'Qt6Core >= 6.4.0')
- AC_PATH_TOOL(MOC6, moc, [], [$qt6libexecdir])
- if test -z "$MOC6"; then
- AC_MSG_WARN([moc not found - Qt 6 binding will not be built.])
- have_qt6_libs="no";
- fi
- fi
-
- if test "$have_qt6_libs" = "yes"; then
- if test "$have_w32_system" != yes; then
- mkspecsdir=$($PKG_CONFIG --variable mkspecsdir Qt6Platform)
- if test -z "$mkspecsdir"; then
- AC_MSG_WARN([Failed to determine Qt's mkspecs directory. Cannot check its build configuration.])
- fi
- fi
-
- # check if we need -fPIC
- if test -z "$use_reduce_relocations" && test -n "$mkspecsdir"; then
- AC_MSG_CHECKING([whether Qt was built with -fPIC])
- if grep -q "QT_CONFIG .* reduce_relocations" $mkspecsdir/qconfig.pri; then
- use_reduce_relocations="yes"
- else
- use_reduce_relocations="no"
- fi
- AC_MSG_RESULT([$use_reduce_relocations])
- fi
- if test "$use_reduce_relocations" = yes; then
- GPGME_QT6_CFLAGS="$GPGME_QT6_CFLAGS -fPIC"
- fi
-
- # check if we need -mno-direct-extern-access
- if test "$have_no_direct_extern_access" = yes; then
- if test -z "$use_no_direct_extern_access" && test -n "$mkspecsdir"; then
- AC_MSG_CHECKING([whether Qt was built with -mno-direct-extern-access])
- if grep -q "QT_CONFIG .* no_direct_extern_access" $mkspecsdir/qconfig.pri; then
- use_no_direct_extern_access="yes"
- else
- use_no_direct_extern_access="no"
- fi
- AC_MSG_RESULT([$use_no_direct_extern_access])
- fi
- if test "$use_no_direct_extern_access" = yes; then
- GPGME_QT6_CFLAGS="$GPGME_QT6_CFLAGS -mno-direct-extern-access"
- fi
- fi
-
- dnl Check that a binary can actually be build with this qt.
- dnl pkg-config may be set up in a way that it looks also for libraries
- dnl of the build system and not only for the host system. In that case
- dnl we check here that we can actually compile / link a qt application
- dnl for host.
- OLDCPPFLAGS=$CPPFLAGS
- OLDLIBS=$LIBS
-
- CPPFLAGS=$GPGME_QT6_CFLAGS
- LIBS=$GPGME_QT6_LIBS
- AC_LANG_PUSH(C++)
- AC_MSG_CHECKING([whether a simple Qt program can be built])
- AC_LINK_IFELSE([AC_LANG_SOURCE([
- #include <QCoreApplication>
- int main (int argc, char **argv) {
- QCoreApplication app(argc, argv);
- app.exec();
- }])], [have_qt6_libs='yes'], [have_qt6_libs='no'])
- AC_MSG_RESULT([$have_qt6_libs])
- AC_LANG_POP()
-
- CPPFLAGS=$OLDCPPFLAGS
- LIBS=$OLDLIBS
- fi
-])