Messagelib

qgpgmejobexecutor.h
1/*
2 SPDX-FileCopyrightText: 2008 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <gpgme++/decryptionresult.h>
10#include <gpgme++/importresult.h>
11#include <gpgme++/verificationresult.h>
12
13#include <QObject>
14
15#include <utility>
16
17class QEventLoop;
18
19namespace QGpgME
20{
21class DecryptVerifyJob;
22class ImportJob;
23class VerifyDetachedJob;
24class VerifyOpaqueJob;
25}
26
27namespace MimeTreeParser
28{
29/**
30 Helper class for synchronous execution of Kleo crypto jobs.
31*/
33{
35public:
36 explicit QGpgMEJobExecutor(QObject *parent = nullptr);
37
38 GpgME::VerificationResult exec(QGpgME::VerifyDetachedJob *job, const QByteArray &signature, const QByteArray &signedData);
39 GpgME::VerificationResult exec(QGpgME::VerifyOpaqueJob *job, const QByteArray &signedData, QByteArray &plainText);
40 std::pair<GpgME::DecryptionResult, GpgME::VerificationResult> exec(QGpgME::DecryptVerifyJob *job, const QByteArray &cipherText, QByteArray &plainText);
41 GpgME::ImportResult exec(QGpgME::ImportJob *job, const QByteArray &certData);
42
43 [[nodiscard]] GpgME::Error auditLogError() const;
44 [[nodiscard]] QString auditLogAsHtml() const;
45
46private Q_SLOTS:
47 void verificationResult(const GpgME::VerificationResult &result);
48 void verificationResult(const GpgME::VerificationResult &result, const QByteArray &plainText);
49 void decryptResult(const GpgME::DecryptionResult &decryptionresult, const GpgME::VerificationResult &verificationresult, const QByteArray &plainText);
50 void importResult(const GpgME::ImportResult &result);
51
52private:
53 QEventLoop *const mEventLoop;
54 GpgME::VerificationResult mVerificationResult;
55 GpgME::DecryptionResult mDecryptResult;
56 GpgME::ImportResult mImportResult;
57 QByteArray mData;
58 GpgME::Error mAuditLogError;
59 QString mAuditLog;
60};
61}
Helper class for synchronous execution of Kleo crypto jobs.
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:07:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.