GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
GpgSubKey.h
1 
29 #ifndef GPGFRONTEND_GPGSUBKEY_H
30 #define GPGFRONTEND_GPGSUBKEY_H
31 
32 #include <boost/date_time.hpp>
33 #include <string>
34 
35 #include "core/GpgConstants.h"
36 
37 namespace GpgFrontend {
38 
43 class GPGFRONTEND_CORE_EXPORT GpgSubKey {
44  public:
50  [[nodiscard]] std::string GetID() const;
51 
57  [[nodiscard]] std::string GetFingerprint() const;
58 
64  [[nodiscard]] std::string GetPubkeyAlgo() const;
65 
71  [[nodiscard]] unsigned int GetKeyLength() const;
72 
79  [[nodiscard]] bool IsHasEncryptionCapability() const;
80 
87  [[nodiscard]] bool IsHasSigningCapability() const;
88 
95  [[nodiscard]] bool IsHasCertificationCapability() const;
96 
103  [[nodiscard]] bool IsHasAuthenticationCapability() const;
104 
111  [[nodiscard]] bool IsPrivateKey() const;
112 
119  [[nodiscard]] bool IsExpired() const;
120 
127  [[nodiscard]] bool IsRevoked() const;
128 
135  [[nodiscard]] bool IsDisabled() const;
136 
143  [[nodiscard]] bool IsSecretKey() const;
144 
151  [[nodiscard]] bool IsCardKey() const;
152 
158  [[nodiscard]] boost::posix_time::ptime GetCreateTime() const;
159 
165  [[nodiscard]] boost::posix_time::ptime GetExpireTime() const;
166 
171  GpgSubKey();
172 
178  explicit GpgSubKey(gpgme_subkey_t subkey);
179 
185  GpgSubKey(GpgSubKey&& o) noexcept;
186 
191  GpgSubKey(const GpgSubKey&) = delete;
192 
199  GpgSubKey& operator=(GpgSubKey&& o) noexcept;
200 
206  GpgSubKey& operator=(const GpgSubKey&) = delete;
207 
215  bool operator==(const GpgSubKey& o) const;
216 
217  private:
218  using SubkeyRefHandler =
219  std::unique_ptr<struct _gpgme_subkey,
220  std::function<void(gpgme_subkey_t)>>;
221 
222  SubkeyRefHandler _subkey_ref = nullptr;
223 };
224 
225 } // namespace GpgFrontend
226 
227 #endif // GPGFRONTEND_GPGSUBKEY_H
GpgFrontend::GpgSubKey::IsHasEncryptionCapability
bool IsHasEncryptionCapability() const
Definition: GpgSubKey.cpp:63
GpgFrontend::GpgSubKey::operator==
bool operator==(const GpgSubKey &o) const
Definition: GpgSubKey.cpp:45
GpgFrontend::GpgSubKey::GetKeyLength
unsigned int GetKeyLength() const
Definition: GpgSubKey.cpp:59
GpgFrontend
Definition: CoreCommonUtil.cpp:29
GpgFrontend::GpgSubKey::GpgSubKey
GpgSubKey()
Construct a new Gpg Sub Key object.
GpgFrontend::GpgSubKey::GetID
std::string GetID() const
Definition: GpgSubKey.cpp:49
GpgFrontend::GpgSubKey::IsExpired
bool IsExpired() const
Definition: GpgSubKey.cpp:83
GpgFrontend::GpgSubKey::operator=
GpgSubKey & operator=(GpgSubKey &&o) noexcept
Definition: GpgSubKey.cpp:39
GpgFrontend::GpgSubKey::IsSecretKey
bool IsSecretKey() const
Definition: GpgSubKey.cpp:91
GpgFrontend::GpgSubKey::IsHasCertificationCapability
bool IsHasCertificationCapability() const
Definition: GpgSubKey.cpp:71
GpgFrontend::GpgSubKey::IsDisabled
bool IsDisabled() const
Definition: GpgSubKey.cpp:87
GpgFrontend::GpgSubKey::GetFingerprint
std::string GetFingerprint() const
Definition: GpgSubKey.cpp:51
GpgFrontend::GpgSubKey::IsCardKey
bool IsCardKey() const
Definition: GpgSubKey.cpp:93
GpgFrontend::GpgSubKey::GetExpireTime
boost::posix_time::ptime GetExpireTime() const
Definition: GpgSubKey.cpp:101
GpgFrontend::GpgSubKey::IsRevoked
bool IsRevoked() const
Definition: GpgSubKey.cpp:85
GpgFrontend::GpgSubKey
Definition: GpgSubKey.h:43
GpgFrontend::GpgSubKey::IsHasAuthenticationCapability
bool IsHasAuthenticationCapability() const
Definition: GpgSubKey.cpp:75
GpgFrontend::GpgSubKey::GetPubkeyAlgo
std::string GetPubkeyAlgo() const
Definition: GpgSubKey.cpp:55
GpgFrontend::GpgSubKey::GetCreateTime
boost::posix_time::ptime GetCreateTime() const
Definition: GpgSubKey.cpp:97
GpgFrontend::GpgSubKey::IsPrivateKey
bool IsPrivateKey() const
Definition: GpgSubKey.cpp:79
GpgFrontend::GpgSubKey::IsHasSigningCapability
bool IsHasSigningCapability() const
Definition: GpgSubKey.cpp:67