QGpgME 2.0.0-unknown
Qt API for GpgME
Loading...
Searching...
No Matches
encryptjob.h
1/*
2 encryptjob.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_ENCRYPTJOB_H__
38#define __KLEO_ENCRYPTJOB_H__
39
40#include "job.h"
41#include <gpgme++/data.h>
42
43#include <memory>
44#include <vector>
45
46#include <gpgme++/context.h>
47
48class QByteArray;
49class QIODevice;
50
51namespace GpgME
52{
53class Error;
54class Key;
55class EncryptionResult;
56}
57
58namespace QGpgME
59{
60
62
85class QGPGME_EXPORT EncryptJob : public Job
86{
87 Q_OBJECT
88protected:
89 explicit EncryptJob(std::unique_ptr<EncryptJobPrivate>, QObject *parent);
90public:
91 ~EncryptJob() override;
92
98 void setFileName(const QString &fileName);
99 QString fileName() const;
100
106 void setInputEncoding(GpgME::Data::Encoding);
107 GpgME::Data::Encoding inputEncoding() const;
108
114 void setRecipients(const std::vector<GpgME::Key> &recipients);
115 std::vector<GpgME::Key> recipients() const;
116
122 void setInputFile(const QString &path);
123 QString inputFile() const;
124
134 void setOutputFile(const QString &path);
135 QString outputFile() const;
136
145 void setEncryptionFlags(GpgME::Context::EncryptionFlags flags);
146 GpgME::Context::EncryptionFlags encryptionFlags() const;
147
158 virtual GpgME::Error start(const std::vector<GpgME::Key> &recipients,
159 const QByteArray &plainText, bool alwaysTrust = false) = 0;
160
168 virtual void start(const std::vector<GpgME::Key> &recipients,
169 const std::shared_ptr<QIODevice> &plainText,
170 const std::shared_ptr<QIODevice> &cipherText = std::shared_ptr<QIODevice>(),
171 bool alwaysTrust = false) = 0;
172
173 virtual GpgME::EncryptionResult exec(const std::vector<GpgME::Key> &recipients,
174 const QByteArray &plainText,
175 bool alwaysTrust, QByteArray &cipherText) = 0;
180 virtual void setOutputIsBase64Encoded(bool) = 0;
181
184 virtual void start(const std::vector<GpgME::Key> &recipients,
185 const std::shared_ptr<QIODevice> &plainText,
186 const std::shared_ptr<QIODevice> &cipherText = std::shared_ptr<QIODevice>(),
187 const GpgME::Context::EncryptionFlags flags = GpgME::Context::None) = 0;
188
191 virtual GpgME::EncryptionResult exec(const std::vector<GpgME::Key> &recipients,
192 const QByteArray &plainText,
193 const GpgME::Context::EncryptionFlags flags, QByteArray &cipherText) = 0;
194Q_SIGNALS:
195 void result(const GpgME::EncryptionResult &result, const QByteArray &cipherText, const QString &auditLogAsHtml = QString(), const GpgME::Error &auditLogError = GpgME::Error());
196
197private:
198 Q_DECLARE_PRIVATE(EncryptJob)
199};
200
201}
202
203#endif // __KLEO_ENCRYPTJOB_H__
Definition encryptjob_p.h:46
void setInputFile(const QString &path)
Definition encryptjob.cpp:86
void setOutputFile(const QString &path)
Definition encryptjob.cpp:98
virtual void start(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 void setOutputIsBase64Encoded(bool)=0
void setInputEncoding(GpgME::Data::Encoding)
Definition encryptjob.cpp:62
void setFileName(const QString &fileName)
Definition encryptjob.cpp:50
void setEncryptionFlags(GpgME::Context::EncryptionFlags flags)
Definition encryptjob.cpp:110
void setRecipients(const std::vector< GpgME::Key > &recipients)
Definition encryptjob.cpp:74
virtual GpgME::EncryptionResult exec(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 > &recipients, const std::shared_ptr< QIODevice > &plainText, const std::shared_ptr< QIODevice > &cipherText=std::shared_ptr< QIODevice >(), bool alwaysTrust=false)=0
virtual GpgME::Error start(const std::vector< GpgME::Key > &recipients, const QByteArray &plainText, bool alwaysTrust=false)=0