GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
GpgKey.h
1 
29 #pragma once
30 
31 #include "core/model/GpgSubKey.h"
32 #include "core/model/GpgUID.h"
33 
34 namespace GpgFrontend {
35 
40 class GPGFRONTEND_CORE_EXPORT GpgKey {
41  Q_DECLARE_TR_FUNCTIONS(GpgKey)
42  public:
49  [[nodiscard]] auto IsGood() const -> bool;
50 
56  [[nodiscard]] auto GetId() const -> QString;
57 
63  [[nodiscard]] auto GetName() const -> QString;
64 
70  [[nodiscard]] auto GetEmail() const -> QString;
71 
77  [[nodiscard]] auto GetComment() const -> QString;
78 
84  [[nodiscard]] auto GetFingerprint() const -> QString;
85 
91  [[nodiscard]] auto GetProtocol() const -> QString;
92 
98  [[nodiscard]] auto GetOwnerTrust() const -> QString;
99 
105  [[nodiscard]] auto GetOwnerTrustLevel() const -> int;
106 
112  [[nodiscard]] auto GetPublicKeyAlgo() const -> QString;
113 
119  [[nodiscard]] auto GetKeyAlgo() const -> QString;
120 
126  [[nodiscard]] auto GetLastUpdateTime() const -> QDateTime;
127 
133  [[nodiscard]] auto GetExpireTime() const -> QDateTime;
134 
140  [[nodiscard]] auto GetCreateTime() const -> QDateTime;
141 
147  [[nodiscard]] auto GetPrimaryKeyLength() const -> unsigned int;
148 
155  [[nodiscard]] auto IsHasEncryptionCapability() const -> bool;
156 
164  [[nodiscard]] auto IsHasActualEncryptionCapability() const -> bool;
165 
172  [[nodiscard]] auto IsHasSigningCapability() const -> bool;
173 
180  [[nodiscard]] auto IsHasActualSigningCapability() const -> bool;
181 
188  [[nodiscard]] auto IsHasCertificationCapability() const -> bool;
189 
196  [[nodiscard]] auto IsHasActualCertificationCapability() const -> bool;
197 
204  [[nodiscard]] auto IsHasAuthenticationCapability() const -> bool;
205 
212  [[nodiscard]] auto IsHasActualAuthenticationCapability() const -> bool;
213 
220  [[nodiscard]] auto IsHasCardKey() const -> bool;
221 
228  [[nodiscard]] auto IsPrivateKey() const -> bool;
229 
236  [[nodiscard]] auto IsExpired() const -> bool;
237 
244  [[nodiscard]] auto IsRevoked() const -> bool;
245 
252  [[nodiscard]] auto IsDisabled() const -> bool;
253 
260  [[nodiscard]] auto IsHasMasterKey() const -> bool;
261 
267  [[nodiscard]] auto GetSubKeys() const
268  -> std::unique_ptr<std::vector<GpgSubKey>>;
269 
275  [[nodiscard]] auto GetUIDs() const -> std::unique_ptr<std::vector<GpgUID>>;
276 
281  GpgKey() = default;
282 
288  explicit GpgKey(gpgme_key_t&& key);
289 
294  ~GpgKey() = default;
295 
301  GpgKey(const gpgme_key_t& key) = delete;
302 
308  GpgKey(GpgKey&&) noexcept;
309 
316  auto operator=(GpgKey&&) noexcept -> GpgKey&;
317 
323  GpgKey(const GpgKey&);
324 
331  auto operator=(const GpgKey&) -> GpgKey&;
332 
339  auto operator=(const gpgme_key_t&) -> GpgKey& = delete;
340 
348  auto operator==(const GpgKey&) const -> bool;
349 
357  auto operator<=(const GpgKey&) const -> bool;
358 
364  explicit operator gpgme_key_t() const;
365 
366  private:
371  struct GPGFRONTEND_CORE_EXPORT KeyRefDeleter {
372  void operator()(gpgme_key_t _key);
373  };
374 
375  using KeyRefHandler = std::unique_ptr<struct _gpgme_key, KeyRefDeleter>;
376 
377  KeyRefHandler key_ref_ = nullptr;
378 };
379 
380 } // namespace GpgFrontend
Definition: GpgKey.h:40
GpgKey(const gpgme_key_t &key)=delete
Construct a new Gpg Key object.
~GpgKey()=default
Destroy the Gpg Key objects.
GpgKey()=default
Construct a new Gpg Key object.
Definition: app.cpp:39
Definition: GpgKey.h:371