File indexing completed on 2024-06-23 05:19:20
0001 /* 0002 SPDX-FileCopyrightText: 2008 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <gpgme++/decryptionresult.h> 0010 #include <gpgme++/importresult.h> 0011 #include <gpgme++/verificationresult.h> 0012 0013 #include <QObject> 0014 0015 #include <utility> 0016 0017 class QEventLoop; 0018 0019 namespace QGpgME 0020 { 0021 class DecryptVerifyJob; 0022 class ImportJob; 0023 class VerifyDetachedJob; 0024 class VerifyOpaqueJob; 0025 } 0026 0027 namespace MimeTreeParser 0028 { 0029 /** 0030 Helper class for synchronous execution of Kleo crypto jobs. 0031 */ 0032 class QGpgMEJobExecutor : public QObject 0033 { 0034 Q_OBJECT 0035 public: 0036 explicit QGpgMEJobExecutor(QObject *parent = nullptr); 0037 0038 GpgME::VerificationResult exec(QGpgME::VerifyDetachedJob *job, const QByteArray &signature, const QByteArray &signedData); 0039 GpgME::VerificationResult exec(QGpgME::VerifyOpaqueJob *job, const QByteArray &signedData, QByteArray &plainText); 0040 std::pair<GpgME::DecryptionResult, GpgME::VerificationResult> exec(QGpgME::DecryptVerifyJob *job, const QByteArray &cipherText, QByteArray &plainText); 0041 GpgME::ImportResult exec(QGpgME::ImportJob *job, const QByteArray &certData); 0042 0043 [[nodiscard]] GpgME::Error auditLogError() const; 0044 [[nodiscard]] QString auditLogAsHtml() const; 0045 0046 private Q_SLOTS: 0047 void verificationResult(const GpgME::VerificationResult &result); 0048 void verificationResult(const GpgME::VerificationResult &result, const QByteArray &plainText); 0049 void decryptResult(const GpgME::DecryptionResult &decryptionresult, const GpgME::VerificationResult &verificationresult, const QByteArray &plainText); 0050 void importResult(const GpgME::ImportResult &result); 0051 0052 private: 0053 QEventLoop *const mEventLoop; 0054 GpgME::VerificationResult mVerificationResult; 0055 GpgME::DecryptionResult mDecryptResult; 0056 GpgME::ImportResult mImportResult; 0057 QByteArray mData; 0058 GpgME::Error mAuditLogError; 0059 QString mAuditLog; 0060 }; 0061 }