File indexing completed on 2024-11-24 04:49:35

0001 /*  This file is part of Kleopatra, the KDE keymanager
0002     SPDX-FileCopyrightText: 2016 Klarälvdalens Datakonsult AB
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "kleo_export.h"
0010 
0011 #include <QGpgME/Job>
0012 
0013 #include <memory>
0014 
0015 namespace GpgME
0016 {
0017 class KeyGenerationResult;
0018 }
0019 
0020 namespace Kleo
0021 {
0022 
0023 /**
0024  * Generates a PGP RSA/2048 bit key pair for given name and email address.
0025  *
0026  * @since 5.4
0027  *
0028  * This class is deprecated. GnuPG defaults to ECC keys and RSA 2048 is no
0029  * longer allowed by some entities. Use QuickJob::startCreate from QGpgME
0030  * instead.
0031  */
0032 class KLEO_DEPRECATED_EXPORT DefaultKeyGenerationJob : public QGpgME::Job
0033 {
0034     Q_OBJECT
0035 public:
0036     explicit DefaultKeyGenerationJob(QObject *parent = nullptr);
0037     ~DefaultKeyGenerationJob() override;
0038 
0039     /**
0040      * Set key passphrase
0041      *
0042      * Use this method to specify custom passphrase, including an empty
0043      * one. If no passphrase (not even empty) is specified, gpg me will
0044      * automatically prompt for passphrase using Pinentry dialog.
0045      */
0046     void setPassphrase(const QString &passphrase);
0047 
0048     GpgME::Error start(const QString &email, const QString &name);
0049 
0050     QString auditLogAsHtml() const override;
0051     GpgME::Error auditLogError() const override;
0052 
0053 public Q_SLOTS:
0054     void slotCancel() override;
0055 
0056 Q_SIGNALS:
0057     void result(const GpgME::KeyGenerationResult &result, const QByteArray &pubkeyData, const QString &auditLogAsHtml, const GpgME::Error &auditLogError);
0058 
0059 protected:
0060     bool eventFilter(QObject *watched, QEvent *event) override;
0061 
0062 private:
0063     class DefaultKeyGenerationJobPrivate;
0064     std::unique_ptr<DefaultKeyGenerationJobPrivate> const d;
0065 };
0066 
0067 }