GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
GpgGenKeyInfo.h
1 
29 #pragma once
30 
31 #include "core/GpgFrontendCoreExport.h"
32 
33 namespace GpgFrontend {
34 
35 class GPGFRONTEND_CORE_EXPORT GenKeyInfo {
36  public:
37  using KeyGenAlgo = std::tuple<QString, QString, QString>;
38 
45  explicit GenKeyInfo(bool m_is_sub_key = false);
46 
52  static auto GetSupportedKeyAlgo() -> const std::vector<KeyGenAlgo> &;
53 
59  static auto GetSupportedSubkeyAlgo() -> const std::vector<KeyGenAlgo> &;
60 
67  [[nodiscard]] auto IsSubKey() const -> bool;
68 
74  void SetIsSubKey(bool m_sub_key);
75 
81  [[nodiscard]] auto GetUserid() const -> QString;
82 
88  void SetName(const QString &m_name);
89 
95  void SetEmail(const QString &m_email);
96 
102  void SetComment(const QString &m_comment);
103 
109  [[nodiscard]] auto GetName() const -> QString;
110 
116  [[nodiscard]] auto GetEmail() const -> QString;
117 
123  [[nodiscard]] auto GetComment() const -> QString;
124 
130  [[nodiscard]] auto GetAlgo() const -> const QString &;
131 
137  void SetAlgo(const QString &);
138 
144  [[nodiscard]] auto GetKeySizeStr() const -> QString;
145 
151  [[nodiscard]] auto GetKeyLength() const -> int;
152 
158  void SetKeyLength(int m_key_size);
159 
165  [[nodiscard]] auto GetExpireTime() const -> const QDateTime &;
166 
172  void SetExpireTime(const QDateTime &m_expired);
173 
180  [[nodiscard]] auto IsNonExpired() const -> bool;
181 
187  void SetNonExpired(bool m_non_expired);
188 
195  [[nodiscard]] auto IsNoPassPhrase() const -> bool;
196 
202  void SetNonPassPhrase(bool m_non_pass_phrase);
203 
210  [[nodiscard]] auto IsAllowSigning() const -> bool;
211 
218  [[nodiscard]] auto IsAllowNoPassPhrase() const -> bool;
219 
225  void SetAllowSigning(bool m_allow_signing);
226 
233  [[nodiscard]] auto IsAllowEncryption() const -> bool;
234 
240  void SetAllowEncryption(bool m_allow_encryption);
241 
248  [[nodiscard]] auto IsAllowCertification() const -> bool;
249 
255  void SetAllowCertification(bool m_allow_certification);
256 
263  [[nodiscard]] auto IsAllowAuthentication() const -> bool;
264 
270  void SetAllowAuthentication(bool m_allow_authentication);
271 
277  [[nodiscard]] auto GetPassPhrase() const -> const QString &;
278 
284  void SetPassPhrase(const QString &m_pass_phrase);
285 
292  [[nodiscard]] auto IsAllowChangeSigning() const -> bool;
293 
300  [[nodiscard]] auto IsAllowChangeEncryption() const -> bool;
301 
308  [[nodiscard]] auto IsAllowChangeCertification() const -> bool;
309 
316  [[nodiscard]] auto IsAllowChangeAuthentication() const -> bool;
317 
323  [[nodiscard]] auto GetSuggestMaxKeySize() const -> int;
324 
330  [[nodiscard]] auto GetSuggestMinKeySize() const -> int;
331 
337  [[nodiscard]] auto GetSizeChangeStep() const -> int;
338 
339  private:
340  bool subkey_ = false;
341  QString name_;
342  QString email_;
343  QString comment_;
344 
345  QString algo_;
346  int key_size_ = 2048;
347  QDateTime expired_ = QDateTime::currentDateTime().addYears(2);
348  bool non_expired_ = false;
349 
350  bool no_passphrase_ = false;
351  bool allow_no_pass_phrase_ = true;
352 
353  int suggest_max_key_size_ = 4096;
354  int suggest_size_addition_step_ = 1024;
355  int suggest_min_key_size_ = 1024;
356 
357  QString passphrase_;
358 
359  bool allow_encryption_ = true;
360  bool allow_change_encryption_ = true;
361  bool allow_certification_ = true;
362  bool allow_change_certification_ = true;
363  bool allow_authentication_ = true;
364  bool allow_change_authentication_ = true;
365  bool allow_signing_ = true;
366  bool allow_change_signing_ = true;
367 
372  void reset_options();
373 };
374 
375 } // namespace GpgFrontend
Definition: GpgGenKeyInfo.h:35
Definition: app.cpp:39