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 "qgpgmerefreshsmimekeysjob.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"
68 #include "qgpgmerevokekeyjob.h"
69 #include "qgpgmesetprimaryuseridjob.h"
76 GpgME::Protocol mProtocol;
78 explicit Protocol(GpgME::Protocol proto) : mProtocol(proto) {}
80 QString name() const Q_DECL_OVERRIDE
83 case GpgME::OpenPGP:
return QStringLiteral(
"OpenPGP");
84 case GpgME::CMS:
return QStringLiteral(
"SMIME");
85 default:
return QString();
89 QString displayName() const Q_DECL_OVERRIDE
94 case GpgME::OpenPGP:
return QStringLiteral(
"gpg");
95 case GpgME::CMS:
return QStringLiteral(
"gpgsm");
96 default:
return QStringLiteral(
"unknown");
105 QGpgME::KeyListJob *keyListJob(
bool remote,
bool includeSigs,
bool validate)
const Q_DECL_OVERRIDE
107 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
112 unsigned int mode = context->keyListMode();
114 mode |= GpgME::Extern;
115 mode &= ~GpgME::Local;
117 mode |= GpgME::Local;
118 mode &= ~GpgME::Extern;
121 mode |= GpgME::Signatures;
124 mode |= GpgME::Validate;
126 context->setKeyListMode(mode);
132 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
137 unsigned int mode = context->keyListMode();
138 mode |= GpgME::Local;
139 mode &= ~GpgME::Extern;
141 mode |= GpgME::Signatures;
144 mode |= GpgME::Validate;
151 context->setOffline(
true);
153 context->setKeyListMode(mode);
159 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
164 context->setArmor(armor);
165 context->setTextMode(textmode);
171 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
178 QGpgME::SignJob *signJob(
bool armor,
bool textMode)
const Q_DECL_OVERRIDE
180 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
185 context->setArmor(armor);
186 context->setTextMode(textMode);
192 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
197 context->setTextMode(textMode);
203 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
208 context->setTextMode(textMode);
214 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
223 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
232 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
241 if (mProtocol != GpgME::OpenPGP) {
245 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
254 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
259 context->setArmor(armor);
263 QGpgME::ExportJob *secretKeyExportJob(
bool armor,
const QString &)
const Q_DECL_OVERRIDE
265 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
270 context->setArmor(armor);
276 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
281 context->setArmor(armor);
287 if (mProtocol != GpgME::CMS) {
296 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
301 context->setArmor(armor);
303 context->setKeyListMode(GpgME::Extern);
309 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
318 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
323 context->setArmor(armor);
324 context->setTextMode(textMode);
330 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
335 context->setTextMode(textMode);
341 if (mProtocol != GpgME::OpenPGP) {
345 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
354 if (!GpgME::hasFeature(GpgME::PasswdFeature, 0)) {
357 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
366 if (mProtocol != GpgME::OpenPGP) {
370 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
379 if (mProtocol != GpgME::OpenPGP) {
383 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
392 if (mProtocol != GpgME::OpenPGP) {
396 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
405 if (mProtocol != GpgME::OpenPGP) {
409 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
418 if (mProtocol != GpgME::OpenPGP) {
421 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
425 context->setKeyListMode(GpgME::Locate | GpgME::Signatures | GpgME::Validate);
431 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
440 if (mProtocol != GpgME::OpenPGP) {
443 auto context = GpgME::Context::createForEngine(GpgME::AssuanEngine);
452 if (mProtocol != GpgME::OpenPGP) {
455 auto context = GpgME::Context::createForEngine(GpgME::SpawnEngine);
464 if (mProtocol != GpgME::OpenPGP) {
467 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
476 if (mProtocol != GpgME::OpenPGP) {
479 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
488 if (mProtocol != GpgME::OpenPGP) {
491 GpgME::Context *context = GpgME::Context::createForProtocol(mProtocol);
500 if (mProtocol != GpgME::OpenPGP) {
503 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:78
An abstract base class for asynchronous exporters.
Definition: exportjob.h:66
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:114
virtual TofuPolicyJob * tofuPolicyJob() const =0
virtual KeyListJob * locateKeysJob() const =0
virtual RefreshKeysJob * refreshKeysJob() const =0
virtual QuickJob * quickJob() const =0
virtual WKDLookupJob * wkdLookupJob() const =0
virtual SetPrimaryUserIDJob * setPrimaryUserIDJob() 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: qgpgmerefreshsmimekeysjob.h:52
Definition: qgpgmerevokekeyjob.h:49
Definition: qgpgmesetprimaryuseridjob.h:49
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
Definition: revokekeyjob.h:52
Definition: setprimaryuseridjob.h:51
An abstract base class for asynchronous combined signing and encrypting.
Definition: signencryptjob.h:83
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:60
Definition: qgpgmebackend.h:43