QGpgME 16.1.0.000048b
Qt API for GpgME
qgpgmesignencryptjob.h
1/*
2 qgpgmesignencryptjob.h
3
4 This file is part of qgpgme, the Qt API binding for gpgme
5 Copyright (c) 2004,2007,2008 Klarälvdalens Datakonsult AB
6 Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
7 Software engineering by Intevation GmbH
8
9 QGpgME is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version.
13
14 QGpgME is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
23 In addition, as a special exception, the copyright holders give
24 permission to link the code of this program with any edition of
25 the Qt library by Trolltech AS, Norway (or with modified versions
26 of Qt that use the same license as Qt), and distribute linked
27 combinations including the two. You must obey the GNU General
28 Public License in all respects for all of the code used other than
29 Qt. If you modify this file, you may extend this exception to
30 your version of the file, but you are not obligated to do so. If
31 you do not wish to do so, delete this exception statement from
32 your version.
33*/
34
35#ifndef __QGPGME_QGPGMESIGNENCRYPTJOB_H__
36#define __QGPGME_QGPGMESIGNENCRYPTJOB_H__
37
38#include "signencryptjob.h"
39
40#include "threadedjobmixin.h"
41
42#ifdef BUILDING_QGPGME
43# include "signingresult.h"
44#else
45#include <gpgme++/signingresult.h>
46#endif
47#ifdef BUILDING_QGPGME
48# include "encryptionresult.h"
49#else
50#include <gpgme++/encryptionresult.h>
51#endif
52#ifdef BUILDING_QGPGME
53# include "key.h"
54#else
55#include <gpgme++/key.h>
56#endif
57
58#include <utility>
59
60namespace QGpgME
61{
62
64#ifdef Q_MOC_RUN
65 : public SignEncryptJob
66#else
67 : public _detail::ThreadedJobMixin<SignEncryptJob, std::tuple<GpgME::SigningResult, GpgME::EncryptionResult, QByteArray, QString, GpgME::Error> >
68#endif
69{
70 Q_OBJECT
71#ifdef Q_MOC_RUN
72public Q_SLOTS:
73 void slotFinished();
74#endif
75public:
76 explicit QGpgMESignEncryptJob(GpgME::Context *context);
78
79 /* from SignEncryptJob */
80 GpgME::Error start(const std::vector<GpgME::Key> &signers,
81 const std::vector<GpgME::Key> &recipients,
82 const QByteArray &plainText, bool alwaysTrust) Q_DECL_OVERRIDE;
83
84 /* from SignEncryptJob */
85 void start(const std::vector<GpgME::Key> &signers,
86 const std::vector<GpgME::Key> &recipients,
87 const std::shared_ptr<QIODevice> &plainText,
88 const std::shared_ptr<QIODevice> &cipherText,
89 bool alwaysTrust) Q_DECL_OVERRIDE;
90
91 void start(const std::vector<GpgME::Key> &signers,
92 const std::vector<GpgME::Key> &recipients,
93 const std::shared_ptr<QIODevice> &plainText,
94 const std::shared_ptr<QIODevice> &cipherText,
95 const GpgME::Context::EncryptionFlags flags) Q_DECL_OVERRIDE;
96
97 std::pair<GpgME::SigningResult, GpgME::EncryptionResult>
98 exec(const std::vector<GpgME::Key> &signers,
99 const std::vector<GpgME::Key> &recipients,
100 const QByteArray &plainText, bool alwaysTrust,
101 QByteArray &cipherText) Q_DECL_OVERRIDE;
102
103 std::pair<GpgME::SigningResult, GpgME::EncryptionResult>
104 exec(const std::vector<GpgME::Key> &signers,
105 const std::vector<GpgME::Key> &recipients,
106 const QByteArray &plainText, const GpgME::Context::EncryptionFlags flags,
107 QByteArray &cipherText) Q_DECL_OVERRIDE;
108
109 /* from SignEncryptJob */
110 void setOutputIsBase64Encoded(bool on) Q_DECL_OVERRIDE;
111
112 /* from ThreadedJobMixin */
113 void resultHook(const result_type &r) Q_DECL_OVERRIDE;
114
115private:
116 bool mOutputIsBase64Encoded;
117 std::pair<GpgME::SigningResult, GpgME::EncryptionResult> mResult;
118};
119
120}
121
122#endif // __QGPGME_QGPGMESIGNENCRYPTJOB_H__
Definition: qgpgmesignencryptjob.h:69
void setOutputIsBase64Encoded(bool on) Q_DECL_OVERRIDE
Definition: qgpgmesignencryptjob.cpp:67
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) Q_DECL_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) Q_DECL_OVERRIDE
GpgME::Error start(const std::vector< GpgME::Key > &signers, const std::vector< GpgME::Key > &recipients, const QByteArray &plainText, bool alwaysTrust) Q_DECL_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) Q_DECL_OVERRIDE
An abstract base class for asynchronous combined signing and encrypting.
Definition: signencryptjob.h:83
Definition: threadedjobmixin.h:125