File indexing completed on 2024-06-23 05:19:21
0001 /* 0002 SPDX-FileCopyrightText: 2014-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "cryptobodypartmemento.h" 0010 #include <QStringList> 0011 #include <gpgme++/key.h> 0012 #include <gpgme++/verificationresult.h> 0013 0014 #include <QPointer> 0015 #include <QString> 0016 0017 #include "interfaces/bodypart.h" 0018 0019 namespace QGpgME 0020 { 0021 class VerifyDetachedJob; 0022 class KeyListJob; 0023 } 0024 0025 namespace MimeTreeParser 0026 { 0027 class VerifyDetachedBodyPartMemento : public CryptoBodyPartMemento 0028 { 0029 Q_OBJECT 0030 public: 0031 explicit VerifyDetachedBodyPartMemento(QGpgME::VerifyDetachedJob *job, QGpgME::KeyListJob *klj, const QByteArray &signature, const QByteArray &plainText); 0032 ~VerifyDetachedBodyPartMemento() override; 0033 0034 [[nodiscard]] bool start() override; 0035 void exec() override; 0036 0037 const GpgME::VerificationResult &verifyResult() const 0038 { 0039 return m_vr; 0040 } 0041 0042 const GpgME::Key &signingKey() const 0043 { 0044 return m_key; 0045 } 0046 0047 private Q_SLOTS: 0048 void slotResult(const GpgME::VerificationResult &vr); 0049 void slotKeyListJobDone(); 0050 void slotNextKey(const GpgME::Key &); 0051 0052 private: 0053 void saveResult(const GpgME::VerificationResult &); 0054 [[nodiscard]] bool canStartKeyListJob() const; 0055 [[nodiscard]] QStringList keyListPattern() const; 0056 [[nodiscard]] bool startKeyListJob(); 0057 0058 private: 0059 // input: 0060 const QByteArray m_signature; 0061 const QByteArray m_plainText; 0062 QPointer<QGpgME::VerifyDetachedJob> m_job; 0063 QPointer<QGpgME::KeyListJob> m_keylistjob; 0064 // output: 0065 GpgME::VerificationResult m_vr; 0066 GpgME::Key m_key; 0067 }; 0068 }