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
37namespace GpgFrontend {
38
43class 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
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
Definition: GpgSubKey.h:43
GpgSubKey()
Construct a new Gpg Sub Key object.
GpgSubKey(const GpgSubKey &)=delete
Construct a new Gpg Sub Key object.
GpgSubKey & operator=(const GpgSubKey &)=delete
Definition: CoreCommonUtil.cpp:29