File indexing completed on 2022-09-27 16:32:27

0001 /*
0002     SPDX-FileCopyrightText: 2009 Rolf Eike Beer <kde@opensource.sf-tec.de>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef KGPGSIGNUID_H
0007 #define KGPGSIGNUID_H
0008 
0009 #include <QObject>
0010 
0011 #include "kgpguidtransaction.h"
0012 #include "kgpgsigntransactionhelper.h"
0013 
0014 class KGpgSignableNode;
0015 class QString;
0016 
0017 /**
0018  * @brief transaction class to sign a single user id of a key
0019  */
0020 class KGpgSignUid: public KGpgUidTransaction, public KGpgSignTransactionHelper {
0021     Q_OBJECT
0022 
0023     Q_DISABLE_COPY(KGpgSignUid)
0024     KGpgSignUid() = delete;
0025 
0026 public:
0027     /**
0028      * @brief constructor
0029      * @param parent parent object
0030      * @param signer id of the key to sign with
0031      * @param uid node to sign
0032      * @param local if signature should be local (not exportable)
0033      * @param checking how carefully the identity of the key owner was checked
0034      *
0035      * See setUid() for description of uid.
0036      */
0037     KGpgSignUid(QObject *parent, const QString &signer, const KGpgSignableNode *uid, const bool local, const carefulCheck checking);
0038     /**
0039      * @brief destructor
0040      */
0041     ~KGpgSignUid() override;
0042 
0043     /**
0044      * @brief set node to sign
0045      * @param uid node to sign
0046      *
0047      * If uid is a KGpgKeyNode only the primary id of that key is
0048      * signed. If you want to sign all user ids at once use
0049      * KGpgSignKey instead. Legal values for uid are also KGpgUidNode
0050      * and KGpgUatNode.
0051      */
0052     void setUid(const KGpgSignableNode *uid);
0053 
0054 protected:
0055     bool preStart() override;
0056     bool nextLine(const QString &line) override;
0057     ts_boolanswer boolQuestion(const QString &line) override;
0058     bool passphraseReceived() override;
0059 
0060     KGpgTransaction *asTransaction() override;
0061     void replaceCmd(const QString &cmd) override;
0062 
0063 private:
0064     int m_cmdPos;       ///< position of the command in GnuPG command line
0065 };
0066 
0067 #endif // KGPGSIGNUID_H