GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
GpgKey.h
1 
29 #ifndef GPGFRONTEND_GPGKEY_H
30 #define GPGFRONTEND_GPGKEY_H
31 
32 #include "GpgSubKey.h"
33 #include "GpgUID.h"
34 
35 namespace GpgFrontend {
36 
41 class GPGFRONTEND_CORE_EXPORT GpgKey {
42  public:
49  [[nodiscard]] bool IsGood() const;
50 
56  [[nodiscard]] std::string GetId() const;
57 
63  [[nodiscard]] std::string GetName() const;
64 
70  [[nodiscard]] std::string GetEmail() const;
71 
77  [[nodiscard]] std::string GetComment() const;
78 
84  [[nodiscard]] std::string GetFingerprint() const;
85 
91  [[nodiscard]] std::string GetProtocol() const;
92 
98  [[nodiscard]] std::string GetOwnerTrust() const;
99 
105  [[nodiscard]] std::string GetPublicKeyAlgo() const;
106 
112  [[nodiscard]] boost::posix_time::ptime GetLastUpdateTime() const;
113 
119  [[nodiscard]] boost::posix_time::ptime GetExpireTime() const;
120 
126  [[nodiscard]] boost::posix_time::ptime GetCreateTime() const;
127 
133  [[nodiscard]] unsigned int GetPrimaryKeyLength() const;
134 
141  [[nodiscard]] bool IsHasEncryptionCapability() const;
142 
150  [[nodiscard]] bool IsHasActualEncryptionCapability() const;
151 
158  [[nodiscard]] bool IsHasSigningCapability() const;
159 
166  [[nodiscard]] bool IsHasActualSigningCapability() const;
167 
174  [[nodiscard]] bool IsHasCertificationCapability() const;
175 
182  [[nodiscard]] bool IsHasActualCertificationCapability() const;
183 
190  [[nodiscard]] bool IsHasAuthenticationCapability() const;
191 
198  [[nodiscard]] bool IsHasActualAuthenticationCapability() const;
199 
206  [[nodiscard]] bool IsHasCardKey() const;
207 
214  [[nodiscard]] bool IsPrivateKey() const;
215 
222  [[nodiscard]] bool IsExpired() const;
223 
230  [[nodiscard]] bool IsRevoked() const;
231 
238  [[nodiscard]] bool IsDisabled() const;
239 
246  [[nodiscard]] bool IsHasMasterKey() const;
247 
253  [[nodiscard]] std::unique_ptr<std::vector<GpgSubKey>> GetSubKeys() const;
254 
260  [[nodiscard]] std::unique_ptr<std::vector<GpgUID>> GetUIDs() const;
261 
266  GpgKey() = default;
267 
273  explicit GpgKey(gpgme_key_t&& key);
274 
279  ~GpgKey() = default;
280 
286  GpgKey(const gpgme_key_t& key) = delete;
287 
293  GpgKey(GpgKey&& k) noexcept;
294 
301  GpgKey& operator=(GpgKey&& k) noexcept;
302 
309  GpgKey& operator=(const gpgme_key_t& key) = delete;
310 
318  bool operator==(const GpgKey& o) const;
319 
327  bool operator<=(const GpgKey& o) const;
328 
334  explicit operator gpgme_key_t() const;
335 
341  [[nodiscard]] GpgKey Copy() const;
342 
343  private:
348  struct GPGFRONTEND_CORE_EXPORT _key_ref_deleter {
349  void operator()(gpgme_key_t _key);
350  };
351 
352  using KeyRefHandler =
353  std::unique_ptr<struct _gpgme_key, _key_ref_deleter>;
354 
355  KeyRefHandler key_ref_ = nullptr;
356 };
357 
358 } // namespace GpgFrontend
359 
360 #endif // GPGFRONTEND_GPGKEY_H
Definition: GpgKey.h:41
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.
GpgKey & operator=(const gpgme_key_t &key)=delete
Definition: CoreCommonUtil.cpp:29