36 #ifndef __QGPGME_PROTOCOL_P_H__
37 #define __QGPGME_PROTOCOL_P_H__
38 #include "qgpgmenewcryptoconfig.h"
40 #include "qgpgmekeygenerationjob.h"
41 #include "qgpgmekeylistjob.h"
42 #include "qgpgmelistallkeysjob.h"
43 #include "qgpgmedecryptjob.h"
44 #include "qgpgmedecryptverifyjob.h"
45 #include "qgpgmerefreshkeysjob.h"
46 #include "qgpgmedeletejob.h"
47 #include "qgpgmedownloadjob.h"
48 #include "qgpgmesignencryptjob.h"
49 #include "qgpgmeencryptjob.h"
50 #include "qgpgmesignjob.h"
51 #include "qgpgmesignkeyjob.h"
52 #include "qgpgmeexportjob.h"
53 #include "qgpgmeverifydetachedjob.h"
54 #include "qgpgmeimportjob.h"
55 #include "qgpgmeimportfromkeyserverjob.h"
56 #include "qgpgmeverifyopaquejob.h"
57 #include "qgpgmechangeexpiryjob.h"
58 #include "qgpgmechangeownertrustjob.h"
59 #include "qgpgmechangepasswdjob.h"
60 #include "qgpgmeaddexistingsubkeyjob.h"
61 #include "qgpgmeadduseridjob.h"
62 #include "qgpgmekeyformailboxjob.h"
63 #include "qgpgmewkdlookupjob.h"
64 #include "qgpgmewkspublishjob.h"
65 #include "qgpgmetofupolicyjob.h"
66 #include "qgpgmequickjob.h"
67 #include "qgpgmereceivekeysjob.h"
74 GpgME::Protocol mProtocol;
76 explicit Protocol(GpgME::Protocol proto) : mProtocol(proto) {}
78 QString name() const Q_DECL_OVERRIDE
81 case GpgME::OpenPGP:
return QStringLiteral(
"OpenPGP");
82 case GpgME::CMS:
return QStringLiteral(
"SMIME");
83 default:
return QString();
87 QString displayName() const Q_DECL_OVERRIDE
92 case GpgME::OpenPGP:
return QStringLiteral(
"gpg");
93 case GpgME::CMS:
return QStringLiteral(
"gpgsm");
94 default:
return QStringLiteral(
"unknown");
103 QGpgME::KeyListJob *keyListJob(
bool remote,
bool includeSigs,
bool validate)
const Q_DECL_OVERRIDE
105 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
110 unsigned int mode = context->keyListMode();
112 mode |= GpgME::Extern;
113 mode &= ~GpgME::Local;
115 mode |= GpgME::Local;
116 mode &= ~GpgME::Extern;
119 mode |= GpgME::Signatures;
122 mode |= GpgME::Validate;
124 context->setKeyListMode(mode);
130 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
135 unsigned int mode = context->keyListMode();
136 mode |= GpgME::Local;
137 mode &= ~GpgME::Extern;
139 mode |= GpgME::Signatures;
142 mode |= GpgME::Validate;
149 context->setOffline(
true);
151 context->setKeyListMode(mode);
157 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
162 context->setArmor(armor);
163 context->setTextMode(textmode);
169 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
176 QGpgME::SignJob *signJob(
bool armor,
bool textMode)
const Q_DECL_OVERRIDE
178 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
183 context->setArmor(armor);
184 context->setTextMode(textMode);
190 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
195 context->setTextMode(textMode);
201 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
206 context->setTextMode(textMode);
212 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
221 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
230 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
239 if (mProtocol != GpgME::OpenPGP) {
243 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
252 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
257 context->setArmor(armor);
261 QGpgME::ExportJob *secretKeyExportJob(
bool armor,
const QString &)
const Q_DECL_OVERRIDE
263 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
268 context->setArmor(armor);
274 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
279 context->setArmor(armor);
285 if (mProtocol != GpgME::CMS) {
295 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
300 context->setArmor(armor);
302 context->setKeyListMode(GpgME::Extern);
308 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
317 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
322 context->setArmor(armor);
323 context->setTextMode(textMode);
329 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
334 context->setTextMode(textMode);
340 if (mProtocol != GpgME::OpenPGP) {
344 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
353 if (!GpgME::hasFeature(GpgME::PasswdFeature, 0)) {
356 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
365 if (mProtocol != GpgME::OpenPGP) {
369 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
378 if (mProtocol != GpgME::OpenPGP) {
382 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
391 if (mProtocol != GpgME::OpenPGP) {
395 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
404 if (mProtocol != GpgME::OpenPGP) {
408 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
417 if (mProtocol != GpgME::OpenPGP) {
420 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
424 context->setKeyListMode(GpgME::Extern | GpgME::Local | GpgME::Signatures | GpgME::Validate);
430 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
439 if (mProtocol != GpgME::OpenPGP) {
442 auto context = GpgME::Context::createForEngine(GpgME::AssuanEngine);
451 if (mProtocol != GpgME::OpenPGP) {
454 auto context = GpgME::Context::createForEngine(GpgME::SpawnEngine);
463 if (mProtocol != GpgME::OpenPGP) {
466 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
475 if (mProtocol != GpgME::OpenPGP) {
478 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
Definition: addexistingsubkeyjob.h:53
An abstract base class to asynchronously add UIDs to OpenPGP keys.
Definition: adduseridjob.h:65
An abstract base class to change expiry asynchronously.
Definition: changeexpiryjob.h:72
An abstract base class to change owner trust asynchronously.
Definition: changeownertrustjob.h:63
An abstract base class to change a key's passphrase asynchronously.
Definition: changepasswdjob.h:63
An abstract base class for asynchronous decrypters.
Definition: decryptjob.h:68
An abstract base class for asynchronous combined decrypters and verifiers.
Definition: decryptverifyjob.h:69
An abstract base class for asynchronous deleters.
Definition: deletejob.h:64
An abstract base class for asynchronous downloaders.
Definition: downloadjob.h:70
An abstract base class for asynchronous encrypters.
Definition: encryptjob.h:76
An abstract base class for asynchronous exporters.
Definition: exportjob.h:67
An abstract base class for asynchronous keyserver-importers.
Definition: importfromkeyserverjob.h:67
An abstract base class for asynchronous importers.
Definition: importjob.h:70
An abstract base class for asynchronous key generation.
Definition: keygenerationjob.h:66
An abstract base class for asynchronous key listers.
Definition: keylistjob.h:76
An abstract base class for asynchronously listing all keys.
Definition: listallkeysjob.h:75
Definition: protocol.h:112
virtual TofuPolicyJob * tofuPolicyJob() const =0
virtual KeyListJob * locateKeysJob() const =0
virtual QuickJob * quickJob() const =0
virtual WKDLookupJob * wkdLookupJob() const =0
virtual WKSPublishJob * wksPublishJob() const =0
virtual KeyForMailboxJob * keyForMailboxJob() const =0
Definition: qgpgmeaddexistingsubkeyjob.h:49
Definition: qgpgmeadduseridjob.h:51
Definition: qgpgmechangeexpiryjob.h:51
Definition: qgpgmechangeownertrustjob.h:51
Definition: qgpgmechangepasswdjob.h:51
Definition: qgpgmedecryptjob.h:57
Definition: qgpgmedecryptverifyjob.h:62
Definition: qgpgmedeletejob.h:56
Definition: qgpgmedownloadjob.h:51
Definition: qgpgmeencryptjob.h:62
Definition: qgpgmeexportjob.h:53
Definition: qgpgmeimportfromkeyserverjob.h:57
Definition: qgpgmeimportjob.h:57
Definition: qgpgmekeygenerationjob.h:57
Definition: qgpgmekeylistjob.h:62
Definition: qgpgmelistallkeysjob.h:62
Definition: qgpgmequickjob.h:52
Definition: qgpgmereceivekeysjob.h:56
Definition: qgpgmerefreshkeysjob.h:52
Definition: qgpgmesignencryptjob.h:69
Definition: qgpgmesignjob.h:62
Definition: qgpgmesignkeyjob.h:53
Definition: qgpgmetofupolicyjob.h:50
Definition: qgpgmeverifydetachedjob.h:57
Definition: qgpgmeverifyopaquejob.h:57
Definition: qgpgmewkdlookupjob.h:51
Definition: qgpgmewkspublishjob.h:54
Definition: quickjob.h:56
Definition: receivekeysjob.h:44
An abstract base class for asynchronous key refreshers.
Definition: refreshkeysjob.h:68
An abstract base class for asynchronous combined signing and encrypting.
Definition: signencryptjob.h:81
An abstract base class for asynchronous signing.
Definition: signjob.h:77
An abstract base class to sign keys asynchronously.
Definition: signkeyjob.h:69
An abstract base class for protocol-specific jobs.
Definition: specialjob.h:71
Definition: tofupolicyjob.h:55
An abstract base class for asynchronous verification of detached signatures.
Definition: verifydetachedjob.h:69
An abstract base class for asynchronous verification of opaque signatures.
Definition: verifyopaquejob.h:68
Definition: wkdlookupjob.h:54
Definition: wkspublishjob.h:62
Definition: qgpgmebackend.h:43