QGpgME 2.0.0-unknown
Qt API for GpgME
Loading...
Searching...
No Matches
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#include <gpgme++/global.h>
44#include <gpgme++/context.h>
45
46#include <memory>
47#include <vector>
48#include <utility>
49
50class QByteArray;
51class QIODevice;
52
53namespace GpgME
54{
55class Error;
56class Key;
57class SigningResult;
58class EncryptionResult;
59}
60
61namespace QGpgME
62{
63
65
88class QGPGME_EXPORT SignEncryptJob : public Job
89{
90 Q_OBJECT
91protected:
92 explicit SignEncryptJob(std::unique_ptr<SignEncryptJobPrivate>, QObject *parent);
93public:
94 ~SignEncryptJob() override;
95
101 void setFileName(const QString &fileName);
102 QString fileName() const;
103
109 void setSigners(const std::vector<GpgME::Key> &signers);
110 std::vector<GpgME::Key> signers() const;
111
117 void setRecipients(const std::vector<GpgME::Key> &recipients);
118 std::vector<GpgME::Key> recipients() const;
119
125 void setInputFile(const QString &path);
126 QString inputFile() const;
127
137 void setOutputFile(const QString &path);
138 QString outputFile() const;
139
148 void setEncryptionFlags(GpgME::Context::EncryptionFlags flags);
149 GpgME::Context::EncryptionFlags encryptionFlags() const;
150
161 virtual GpgME::Error start(const std::vector<GpgME::Key> &signers,
162 const std::vector<GpgME::Key> &recipients,
163 const QByteArray &plainText,
164 bool alwaysTrust = false) = 0;
165
173 virtual void start(const std::vector<GpgME::Key> &signers,
174 const std::vector<GpgME::Key> &recipients,
175 const std::shared_ptr<QIODevice> &plainText,
176 const std::shared_ptr<QIODevice> &cipherText = std::shared_ptr<QIODevice>(),
177 bool alwaysTrust = false) = 0;
178
179 virtual std::pair<GpgME::SigningResult, GpgME::EncryptionResult>
180 exec(const std::vector<GpgME::Key> &signers,
181 const std::vector<GpgME::Key> &recipients,
182 const QByteArray &plainText,
183 bool alwaysTrust, QByteArray &cipherText) = 0;
184
189 virtual void setOutputIsBase64Encoded(bool) = 0;
190
193 virtual void start(const std::vector<GpgME::Key> &signers,
194 const std::vector<GpgME::Key> &recipients,
195 const std::shared_ptr<QIODevice> &plainText,
196 const std::shared_ptr<QIODevice> &cipherText = std::shared_ptr<QIODevice>(),
197 const GpgME::Context::EncryptionFlags flags = GpgME::Context::None) = 0;
198
201 virtual std::pair<GpgME::SigningResult, GpgME::EncryptionResult>
202 exec(const std::vector<GpgME::Key> &signers,
203 const std::vector<GpgME::Key> &recipients,
204 const QByteArray &plainText,
205 const GpgME::Context::EncryptionFlags flags, QByteArray &cipherText) = 0;
206Q_SIGNALS:
207 void result(const GpgME::SigningResult &signingresult,
208 const GpgME::EncryptionResult &encryptionresult,
209 const QByteArray &cipherText, const QString &auditLogAsHtml = QString(),
210 const GpgME::Error &auditLogError = GpgME::Error());
211
212private:
213 Q_DECLARE_PRIVATE(SignEncryptJob)
214};
215
216}
217
218#endif // __KLEO_SIGNENCRYPTJOB_H__
Definition signencryptjob_p.h:45
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 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
void setSigners(const std::vector< GpgME::Key > &signers)
Definition signencryptjob.cpp:62
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
void setOutputFile(const QString &path)
Definition signencryptjob.cpp:98
void setInputFile(const QString &path)
Definition signencryptjob.cpp:86
void setRecipients(const std::vector< GpgME::Key > &recipients)
Definition signencryptjob.cpp:74
void setFileName(const QString &fileName)
Definition signencryptjob.cpp:50
void setEncryptionFlags(GpgME::Context::EncryptionFlags flags)
Definition signencryptjob.cpp:110