QGpgME  8.1.0.0
Qt API for GpgME
signencryptjob.h
1 /*
2  signencryptjob.h
3 
4  This file is part of qgpgme, the Qt API binding for gpgme
5  Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
6  Copyright (c) 2016 Intevation GmbH
7 
8  QGpgME is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2 of the
11  License, or (at your option) any later version.
12 
13  QGpgME is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 
22  In addition, as a special exception, the copyright holders give
23  permission to link the code of this program with any edition of
24  the Qt library by Trolltech AS, Norway (or with modified versions
25  of Qt that use the same license as Qt), and distribute linked
26  combinations including the two. You must obey the GNU General
27  Public License in all respects for all of the code used other than
28  Qt. If you modify this file, you may extend this exception to
29  your version of the file, but you are not obligated to do so. If
30  you do not wish to do so, delete this exception statement from
31  your version.
32 */
33 
34 #ifndef __KLEO_SIGNENCRYPTJOB_H__
35 #define __KLEO_SIGNENCRYPTJOB_H__
36 
37 #include "job.h"
38 #include "qgpgme_export.h"
39 
40 #ifdef BUILDING_QGPGME
41 # include "global.h"
42 # include "context.h"
43 #else
44 # include <gpgme++/global.h>
45 # include <gpgme++/context.h>
46 #endif
47 
48 #include <memory>
49 #include <vector>
50 #include <utility>
51 
52 class QByteArray;
53 class QIODevice;
54 
55 namespace GpgME
56 {
57 class Error;
58 class Key;
59 class SigningResult;
60 class EncryptionResult;
61 }
62 
63 namespace QGpgME
64 {
65 
79 class QGPGME_EXPORT SignEncryptJob : public Job
80 {
81  Q_OBJECT
82 protected:
83  explicit SignEncryptJob(QObject *parent);
84 public:
85  ~SignEncryptJob();
86 
97  virtual QGPGME_DEPRECATED_EXPORT GpgME::Error start(const std::vector<GpgME::Key> &signers,
98  const std::vector<GpgME::Key> &recipients,
99  const QByteArray &plainText,
100  bool alwaysTrust = false) = 0;
101 
111  virtual void start(const std::vector<GpgME::Key> &signers,
112  const std::vector<GpgME::Key> &recipients,
113  const std::shared_ptr<QIODevice> &plainText,
114  const std::shared_ptr<QIODevice> &cipherText = std::shared_ptr<QIODevice>(),
115  bool alwaysTrust = false) = 0;
116 
117  virtual std::pair<GpgME::SigningResult, GpgME::EncryptionResult>
118  exec(const std::vector<GpgME::Key> &signers,
119  const std::vector<GpgME::Key> &recipients,
120  const QByteArray &plainText,
121  bool alwaysTrust, QByteArray &cipherText) = 0;
122 
127  virtual void setOutputIsBase64Encoded(bool) = 0;
128 
131  virtual void start(const std::vector<GpgME::Key> &signers,
132  const std::vector<GpgME::Key> &recipients,
133  const std::shared_ptr<QIODevice> &plainText,
134  const std::shared_ptr<QIODevice> &cipherText = std::shared_ptr<QIODevice>(),
135  const GpgME::Context::EncryptionFlags flags = GpgME::Context::None) = 0;
136 
139  virtual std::pair<GpgME::SigningResult, GpgME::EncryptionResult>
140  exec(const std::vector<GpgME::Key> &signers,
141  const std::vector<GpgME::Key> &recipients,
142  const QByteArray &plainText,
143  const GpgME::Context::EncryptionFlags flags, QByteArray &cipherText) = 0;
144 Q_SIGNALS:
145  void result(const GpgME::SigningResult &signingresult,
146  const GpgME::EncryptionResult &encryptionresult,
147  const QByteArray &cipherText, const QString &auditLogAsHtml = QString(),
148  const GpgME::Error &auditLogError = GpgME::Error());
149 };
150 
151 }
152 
153 #endif // __KLEO_SIGNENCRYPTJOB_H__
An abstract base class for asynchronous crypto operations.
Definition: job.h:71
An abstract base class for asynchronous combined signing and encrypting.
Definition: signencryptjob.h:79
Definition: abstractimportjob.h:41
Definition: abstractimportjob.h:47