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 namespace GpgFrontend {
32 
33 class GPGFRONTEND_CORE_EXPORT GenKeyInfo {
34  public:
35  using KeyGenAlgo = std::tuple<QString, QString, QString>;
36 
43  explicit GenKeyInfo(bool m_is_sub_key = false);
44 
50  static auto GetSupportedKeyAlgo() -> const std::vector<KeyGenAlgo> &;
51 
57  static auto GetSupportedSubkeyAlgo() -> const std::vector<KeyGenAlgo> &;
58 
65  [[nodiscard]] auto IsSubKey() const -> bool;
66 
72  void SetIsSubKey(bool m_sub_key);
73 
79  [[nodiscard]] auto GetUserid() const -> QString;
80 
86  void SetName(const QString &m_name);
87 
93  void SetEmail(const QString &m_email);
94 
100  void SetComment(const QString &m_comment);
101 
107  [[nodiscard]] auto GetName() const -> QString;
108 
114  [[nodiscard]] auto GetEmail() const -> QString;
115 
121  [[nodiscard]] auto GetComment() const -> QString;
122 
128  [[nodiscard]] auto GetAlgo() const -> const QString &;
129 
135  void SetAlgo(const QString &);
136 
142  [[nodiscard]] auto GetKeySizeStr() const -> QString;
143 
149  [[nodiscard]] auto GetKeyLength() const -> int;
150 
156  void SetKeyLength(int m_key_size);
157 
163  [[nodiscard]] auto GetExpireTime() const -> const QDateTime &;
164 
170  void SetExpireTime(const QDateTime &m_expired);
171 
178  [[nodiscard]] auto IsNonExpired() const -> bool;
179 
185  void SetNonExpired(bool m_non_expired);
186 
193  [[nodiscard]] auto IsNoPassPhrase() const -> bool;
194 
200  void SetNonPassPhrase(bool m_non_pass_phrase);
201 
208  [[nodiscard]] auto IsAllowSigning() const -> bool;
209 
216  [[nodiscard]] auto IsAllowNoPassPhrase() const -> bool;
217 
223  void SetAllowSigning(bool m_allow_signing);
224 
231  [[nodiscard]] auto IsAllowEncryption() const -> bool;
232 
238  void SetAllowEncryption(bool m_allow_encryption);
239 
246  [[nodiscard]] auto IsAllowCertification() const -> bool;
247 
253  void SetAllowCertification(bool m_allow_certification);
254 
261  [[nodiscard]] auto IsAllowAuthentication() const -> bool;
262 
268  void SetAllowAuthentication(bool m_allow_authentication);
269 
275  [[nodiscard]] auto GetPassPhrase() const -> const QString &;
276 
282  void SetPassPhrase(const QString &m_pass_phrase);
283 
290  [[nodiscard]] auto IsAllowChangeSigning() const -> bool;
291 
298  [[nodiscard]] auto IsAllowChangeEncryption() const -> bool;
299 
306  [[nodiscard]] auto IsAllowChangeCertification() const -> bool;
307 
314  [[nodiscard]] auto IsAllowChangeAuthentication() const -> bool;
315 
321  [[nodiscard]] auto GetSuggestMaxKeySize() const -> int;
322 
328  [[nodiscard]] auto GetSuggestMinKeySize() const -> int;
329 
335  [[nodiscard]] auto GetSizeChangeStep() const -> int;
336 
337  private:
338  bool subkey_ = false;
339  QString name_;
340  QString email_;
341  QString comment_;
342 
343  QString algo_;
344  int key_size_ = 2048;
345  QDateTime expired_ = QDateTime::currentDateTime().addYears(2);
346  bool non_expired_ = false;
347 
348  bool no_passphrase_ = false;
349  bool allow_no_pass_phrase_ = true;
350 
351  int suggest_max_key_size_ = 4096;
352  int suggest_size_addition_step_ = 1024;
353  int suggest_min_key_size_ = 1024;
354 
355  QString passphrase_;
356 
357  bool allow_encryption_ = true;
358  bool allow_change_encryption_ = true;
359  bool allow_certification_ = true;
360  bool allow_change_certification_ = true;
361  bool allow_authentication_ = true;
362  bool allow_change_authentication_ = true;
363  bool allow_signing_ = true;
364  bool allow_change_signing_ = true;
365 
370  void reset_options();
371 };
372 
373 } // namespace GpgFrontend
Definition: GpgGenKeyInfo.h:33
Definition: app.cpp:39