QGpgME  18.3.0.0000000
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 by Bundesamt für Sicherheit in der Informationstechnik
7  Software engineering by Intevation GmbH
8  Copyright (c) 2022 g10 Code GmbH
9  Software engineering by Ingo Klöcker <dev@ingo-kloecker.de>
10 
11  QGpgME is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 2 of the
14  License, or (at your option) any later version.
15 
16  QGpgME is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with this program; if not, write to the Free Software
23  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 
25  In addition, as a special exception, the copyright holders give
26  permission to link the code of this program with any edition of
27  the Qt library by Trolltech AS, Norway (or with modified versions
28  of Qt that use the same license as Qt), and distribute linked
29  combinations including the two. You must obey the GNU General
30  Public License in all respects for all of the code used other than
31  Qt. If you modify this file, you may extend this exception to
32  your version of the file, but you are not obligated to do so. If
33  you do not wish to do so, delete this exception statement from
34  your version.
35 */
36 
37 #ifndef __KLEO_SIGNENCRYPTJOB_H__
38 #define __KLEO_SIGNENCRYPTJOB_H__
39 
40 #include "job.h"
41 #include "qgpgme_export.h"
42 
43 #ifdef BUILDING_QGPGME
44 # include "global.h"
45 # include "context.h"
46 #else
47 # include <gpgme++/global.h>
48 # include <gpgme++/context.h>
49 #endif
50 
51 #include <memory>
52 #include <vector>
53 #include <utility>
54 
55 class QByteArray;
56 class QIODevice;
57 
58 namespace GpgME
59 {
60 class Error;
61 class Key;
62 class SigningResult;
63 class EncryptionResult;
64 }
65 
66 namespace QGpgME
67 {
68 
82 class QGPGME_EXPORT SignEncryptJob : public Job
83 {
84  Q_OBJECT
85 protected:
86  explicit SignEncryptJob(QObject *parent);
87 public:
88  ~SignEncryptJob();
89 
90  void setFileName(const QString &fileName);
91  QString fileName() const;
92 
103  virtual GpgME::Error start(const std::vector<GpgME::Key> &signers,
104  const std::vector<GpgME::Key> &recipients,
105  const QByteArray &plainText,
106  bool alwaysTrust = false) = 0;
107 
115  virtual void start(const std::vector<GpgME::Key> &signers,
116  const std::vector<GpgME::Key> &recipients,
117  const std::shared_ptr<QIODevice> &plainText,
118  const std::shared_ptr<QIODevice> &cipherText = std::shared_ptr<QIODevice>(),
119  bool alwaysTrust = false) = 0;
120 
121  virtual std::pair<GpgME::SigningResult, GpgME::EncryptionResult>
122  exec(const std::vector<GpgME::Key> &signers,
123  const std::vector<GpgME::Key> &recipients,
124  const QByteArray &plainText,
125  bool alwaysTrust, QByteArray &cipherText) = 0;
126 
131  virtual void setOutputIsBase64Encoded(bool) = 0;
132 
135  virtual void start(const std::vector<GpgME::Key> &signers,
136  const std::vector<GpgME::Key> &recipients,
137  const std::shared_ptr<QIODevice> &plainText,
138  const std::shared_ptr<QIODevice> &cipherText = std::shared_ptr<QIODevice>(),
139  const GpgME::Context::EncryptionFlags flags = GpgME::Context::None) = 0;
140 
143  virtual std::pair<GpgME::SigningResult, GpgME::EncryptionResult>
144  exec(const std::vector<GpgME::Key> &signers,
145  const std::vector<GpgME::Key> &recipients,
146  const QByteArray &plainText,
147  const GpgME::Context::EncryptionFlags flags, QByteArray &cipherText) = 0;
148 Q_SIGNALS:
149  void result(const GpgME::SigningResult &signingresult,
150  const GpgME::EncryptionResult &encryptionresult,
151  const QByteArray &cipherText, const QString &auditLogAsHtml = QString(),
152  const GpgME::Error &auditLogError = GpgME::Error());
153 };
154 
155 }
156 
157 #endif // __KLEO_SIGNENCRYPTJOB_H__
An abstract base class for asynchronous crypto operations.
Definition: job.h:73
An abstract base class for asynchronous combined signing and encrypting.
Definition: signencryptjob.h:83
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
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
virtual GpgME::Error start(const std::vector< GpgME::Key > &signers, const std::vector< GpgME::Key > &recipients, const QByteArray &plainText, bool alwaysTrust=false)=0
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 void setOutputIsBase64Encoded(bool)=0