|
Packit |
d7e8d0 |
/*
|
|
Packit |
d7e8d0 |
signencryptjob.h
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
This file is part of qgpgme, the Qt API binding for gpgme
|
|
Packit |
d7e8d0 |
Copyright (c) 2004, 2007 Klarälvdalens Datakonsult AB
|
|
Packit |
d7e8d0 |
Copyright (c) 2016 by Bundesamt für Sicherheit in der Informationstechnik
|
|
Packit |
d7e8d0 |
Software engineering by Intevation GmbH
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
QGpgME is free software; you can redistribute it and/or
|
|
Packit |
d7e8d0 |
modify it under the terms of the GNU General Public License as
|
|
Packit |
d7e8d0 |
published by the Free Software Foundation; either version 2 of the
|
|
Packit |
d7e8d0 |
License, or (at your option) any later version.
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
QGpgME is distributed in the hope that it will be useful,
|
|
Packit |
d7e8d0 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
d7e8d0 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
d7e8d0 |
General Public License for more details.
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
You should have received a copy of the GNU General Public License
|
|
Packit |
d7e8d0 |
along with this program; if not, write to the Free Software
|
|
Packit |
d7e8d0 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
In addition, as a special exception, the copyright holders give
|
|
Packit |
d7e8d0 |
permission to link the code of this program with any edition of
|
|
Packit |
d7e8d0 |
the Qt library by Trolltech AS, Norway (or with modified versions
|
|
Packit |
d7e8d0 |
of Qt that use the same license as Qt), and distribute linked
|
|
Packit |
d7e8d0 |
combinations including the two. You must obey the GNU General
|
|
Packit |
d7e8d0 |
Public License in all respects for all of the code used other than
|
|
Packit |
d7e8d0 |
Qt. If you modify this file, you may extend this exception to
|
|
Packit |
d7e8d0 |
your version of the file, but you are not obligated to do so. If
|
|
Packit |
d7e8d0 |
you do not wish to do so, delete this exception statement from
|
|
Packit |
d7e8d0 |
your version.
|
|
Packit |
d7e8d0 |
*/
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
#ifndef __KLEO_SIGNENCRYPTJOB_H__
|
|
Packit |
d7e8d0 |
#define __KLEO_SIGNENCRYPTJOB_H__
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
#include "job.h"
|
|
Packit |
d7e8d0 |
#include "qgpgme_export.h"
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
#ifdef BUILDING_QGPGME
|
|
Packit |
d7e8d0 |
# include "global.h"
|
|
Packit |
d7e8d0 |
# include "context.h"
|
|
Packit |
d7e8d0 |
#else
|
|
Packit |
d7e8d0 |
# include <gpgme++/global.h>
|
|
Packit |
d7e8d0 |
# include <gpgme++/context.h>
|
|
Packit |
d7e8d0 |
#endif
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
#include <memory>
|
|
Packit |
d7e8d0 |
#include <vector>
|
|
Packit |
d7e8d0 |
#include <utility>
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
class QByteArray;
|
|
Packit |
d7e8d0 |
class QIODevice;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
namespace GpgME
|
|
Packit |
d7e8d0 |
{
|
|
Packit |
d7e8d0 |
class Error;
|
|
Packit |
d7e8d0 |
class Key;
|
|
Packit |
d7e8d0 |
class SigningResult;
|
|
Packit |
d7e8d0 |
class EncryptionResult;
|
|
Packit |
d7e8d0 |
}
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
namespace QGpgME
|
|
Packit |
d7e8d0 |
{
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/**
|
|
Packit |
d7e8d0 |
@short An abstract base class for asynchronous combined signing and encrypting
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
To use a SignEncryptJob, first obtain an instance from the
|
|
Packit |
d7e8d0 |
CryptoBackend implementation, connect the progress() and result()
|
|
Packit |
d7e8d0 |
signals to suitable slots and then start the operation with a
|
|
Packit |
d7e8d0 |
call to start(). This call might fail, in which case the
|
|
Packit |
d7e8d0 |
SignEncryptJob instance will have scheduled it's own destruction
|
|
Packit |
d7e8d0 |
with a call to QObject::deleteLater().
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
After result() is emitted, the SignEncryptJob will schedule it's
|
|
Packit |
d7e8d0 |
own destruction by calling QObject::deleteLater().
|
|
Packit |
d7e8d0 |
*/
|
|
Packit |
d7e8d0 |
class QGPGME_EXPORT SignEncryptJob : public Job
|
|
Packit |
d7e8d0 |
{
|
|
Packit |
d7e8d0 |
Q_OBJECT
|
|
Packit |
d7e8d0 |
protected:
|
|
Packit |
d7e8d0 |
explicit SignEncryptJob(QObject *parent);
|
|
Packit |
d7e8d0 |
public:
|
|
Packit |
d7e8d0 |
~SignEncryptJob();
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/**
|
|
Packit |
d7e8d0 |
Starts the combined signing and encrypting operation. \a signers
|
|
Packit |
d7e8d0 |
is the list of keys to sign \a plainText with. \a recipients is
|
|
Packit |
d7e8d0 |
a list of keys to encrypt the signed \a plainText to. In both
|
|
Packit |
d7e8d0 |
lists, empty (null) keys are ignored.
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
If \a alwaysTrust is true, validity checking for the
|
|
Packit |
d7e8d0 |
\em recipient keys will not be performed, but full validity
|
|
Packit |
d7e8d0 |
assumed for all \em recipient keys without further checks.
|
|
Packit |
d7e8d0 |
*/
|
|
Packit |
d7e8d0 |
virtual GpgME::Error start(const std::vector<GpgME::Key> &signers,
|
|
Packit |
d7e8d0 |
const std::vector<GpgME::Key> &recipients,
|
|
Packit |
d7e8d0 |
const QByteArray &plainText,
|
|
Packit |
d7e8d0 |
bool alwaysTrust = false) = 0;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/*!
|
|
Packit |
d7e8d0 |
\overload
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
If \a cipherText is non-null, the ciphertext is written
|
|
Packit |
d7e8d0 |
there. Otherwise, it will be delivered in the third argument of
|
|
Packit |
d7e8d0 |
result().
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
\throws GpgME::Exception if starting fails
|
|
Packit |
d7e8d0 |
*/
|
|
Packit |
d7e8d0 |
virtual void start(const std::vector<GpgME::Key> &signers,
|
|
Packit |
d7e8d0 |
const std::vector<GpgME::Key> &recipients,
|
|
Packit |
d7e8d0 |
const std::shared_ptr<QIODevice> &plainText,
|
|
Packit |
d7e8d0 |
const std::shared_ptr<QIODevice> &cipherText = std::shared_ptr<QIODevice>(),
|
|
Packit |
d7e8d0 |
bool alwaysTrust = false) = 0;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
virtual std::pair<GpgME::SigningResult, GpgME::EncryptionResult>
|
|
Packit |
d7e8d0 |
exec(const std::vector<GpgME::Key> &signers,
|
|
Packit |
d7e8d0 |
const std::vector<GpgME::Key> &recipients,
|
|
Packit |
d7e8d0 |
const QByteArray &plainText,
|
|
Packit |
d7e8d0 |
bool alwaysTrust, QByteArray &cipherText) = 0;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/*!
|
|
Packit |
d7e8d0 |
This is a hack to request BASE64 output (instead of whatever
|
|
Packit |
d7e8d0 |
comes out normally).
|
|
Packit |
d7e8d0 |
*/
|
|
Packit |
d7e8d0 |
virtual void setOutputIsBase64Encoded(bool) = 0;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/** Like start but with an additional argument for EncryptionFlags for
|
|
Packit |
d7e8d0 |
* more flexibility. */
|
|
Packit |
d7e8d0 |
virtual void start(const std::vector<GpgME::Key> &signers,
|
|
Packit |
d7e8d0 |
const std::vector<GpgME::Key> &recipients,
|
|
Packit |
d7e8d0 |
const std::shared_ptr<QIODevice> &plainText,
|
|
Packit |
d7e8d0 |
const std::shared_ptr<QIODevice> &cipherText = std::shared_ptr<QIODevice>(),
|
|
Packit |
d7e8d0 |
const GpgME::Context::EncryptionFlags flags = GpgME::Context::None) = 0;
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
/** Like exec but with an additional argument for EncryptionFlags for
|
|
Packit |
d7e8d0 |
* more flexibility. */
|
|
Packit |
d7e8d0 |
virtual std::pair<GpgME::SigningResult, GpgME::EncryptionResult>
|
|
Packit |
d7e8d0 |
exec(const std::vector<GpgME::Key> &signers,
|
|
Packit |
d7e8d0 |
const std::vector<GpgME::Key> &recipients,
|
|
Packit |
d7e8d0 |
const QByteArray &plainText,
|
|
Packit |
d7e8d0 |
const GpgME::Context::EncryptionFlags flags, QByteArray &cipherText) = 0;
|
|
Packit |
d7e8d0 |
Q_SIGNALS:
|
|
Packit |
d7e8d0 |
void result(const GpgME::SigningResult &signingresult,
|
|
Packit |
d7e8d0 |
const GpgME::EncryptionResult &encryptionresult,
|
|
Packit |
d7e8d0 |
const QByteArray &cipherText, const QString &auditLogAsHtml = QString(),
|
|
Packit |
d7e8d0 |
const GpgME::Error &auditLogError = GpgME::Error());
|
|
Packit |
d7e8d0 |
};
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
}
|
|
Packit |
d7e8d0 |
|
|
Packit |
d7e8d0 |
#endif // __KLEO_SIGNENCRYPTJOB_H__
|