File indexing completed on 2024-06-23 05:14:04
0001 /* dialogs/gencardkeydialog.h 0002 0003 This file is part of Kleopatra, the KDE keymanager 0004 SPDX-FileCopyrightText: 2017 Bundesamt für Sicherheit in der Informationstechnik 0005 SPDX-FileContributor: Intevation GmbH 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 #pragma once 0010 0011 #include <QDialog> 0012 0013 #include <gpgme++/key.h> 0014 0015 #include <memory> 0016 #include <vector> 0017 0018 namespace Kleo 0019 { 0020 namespace SmartCard 0021 { 0022 struct AlgorithmInfo; 0023 } 0024 0025 class GenCardKeyDialog : public QDialog 0026 { 0027 Q_OBJECT 0028 0029 public: 0030 struct KeyParams { 0031 QString name; 0032 QString email; 0033 QString comment; 0034 std::string algorithm; 0035 bool backup; 0036 }; 0037 0038 enum KeyAttribute { 0039 // clang-format off 0040 NoKeyAttributes = 0, 0041 KeyOwnerName = 1, 0042 KeyOwnerEmail = 2, 0043 KeyComment = 4, 0044 KeyAlgorithm = 8, 0045 LocalKeyBackup = 16, 0046 0047 _AllKeyAttributes_Helper, 0048 AllKeyAttributes = 2 * (_AllKeyAttributes_Helper - 1) - 1 0049 // clang-format on 0050 }; 0051 0052 Q_DECLARE_FLAGS(KeyAttributes, KeyAttribute) 0053 0054 explicit GenCardKeyDialog(KeyAttributes requiredAttributes, QWidget *parent = nullptr); 0055 0056 KeyParams getKeyParams() const; 0057 0058 void setSupportedAlgorithms(const std::vector<SmartCard::AlgorithmInfo> &algorithms, const std::string &defaultAlgo); 0059 0060 private: 0061 class Private; 0062 std::shared_ptr<Private> d; 0063 }; 0064 } // namespace Kleo