GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
GpgKeySignature.h
1 
29 #ifndef GPGFRONTEND_GPGKEYSIGNATURE_H
30 #define GPGFRONTEND_GPGKEYSIGNATURE_H
31 
32 #include <boost/date_time.hpp>
33 #include <string>
34 
35 #include "core/GpgConstants.h"
36 
41 namespace GpgFrontend {
42 
47 class GPGFRONTEND_CORE_EXPORT GpgKeySignature {
48  public:
55  [[nodiscard]] bool IsRevoked() const;
56 
63  [[nodiscard]] bool IsExpired() const;
64 
71  [[nodiscard]] bool IsInvalid() const;
72 
79  [[nodiscard]] bool IsExportable() const;
80 
86  [[nodiscard]] gpgme_error_t GetStatus() const;
87 
93  [[nodiscard]] std::string GetKeyID() const;
94 
100  [[nodiscard]] std::string GetPubkeyAlgo() const;
101 
107  [[nodiscard]] boost::posix_time::ptime GetCreateTime() const;
108 
114  [[nodiscard]] boost::posix_time::ptime GetExpireTime() const;
115 
121  [[nodiscard]] std::string GetUID() const;
122 
128  [[nodiscard]] std::string GetName() const;
129 
135  [[nodiscard]] std::string GetEmail() const;
136 
142  [[nodiscard]] std::string GetComment() const;
143 
148  GpgKeySignature();
149 
154  ~GpgKeySignature();
155 
161  explicit GpgKeySignature(gpgme_key_sig_t sig);
162 
167  GpgKeySignature(GpgKeySignature &&) noexcept;
168 
173  GpgKeySignature(const GpgKeySignature &) = delete;
174 
180  GpgKeySignature &operator=(GpgKeySignature &&) noexcept;
181 
187  GpgKeySignature &operator=(const GpgKeySignature &) = delete;
188 
189  private:
190  using KeySignatrueRefHandler =
191  std::unique_ptr<struct _gpgme_key_sig,
192  std::function<void(gpgme_key_sig_t)>>;
193 
194  KeySignatrueRefHandler signature_ref_ = nullptr;
195 };
196 
197 } // namespace GpgFrontend
198 
199 #endif // GPGFRONTEND_GPGKEYSIGNATURE_H
GpgFrontend
Definition: CoreCommonUtil.cpp:29
GpgFrontend::GpgKeySignature::~GpgKeySignature
~GpgKeySignature()
Destroy the Gpg Key Signature object.
GpgFrontend::GpgKeySignature::GetPubkeyAlgo
std::string GetPubkeyAlgo() const
Definition: GpgKeySignature.cpp:68
GpgFrontend::GpgKeySignature
Definition: GpgKeySignature.h:47
GpgFrontend::GpgKeySignature::IsExportable
bool IsExportable() const
Definition: GpgKeySignature.cpp:56
GpgFrontend::GpgKeySignature::GetStatus
gpgme_error_t GetStatus() const
Definition: GpgKeySignature.cpp:60
GpgFrontend::GpgKeySignature::GetCreateTime
boost::posix_time::ptime GetCreateTime() const
Create a time object.
Definition: GpgKeySignature.cpp:72
GpgFrontend::GpgKeySignature::GetExpireTime
boost::posix_time::ptime GetExpireTime() const
Definition: GpgKeySignature.cpp:76
GpgFrontend::GpgKeySignature::IsExpired
bool IsExpired() const
Definition: GpgKeySignature.cpp:48
GpgFrontend::GpgKeySignature::GetComment
std::string GetComment() const
Definition: GpgKeySignature.cpp:92
GpgFrontend::GpgKeySignature::GetEmail
std::string GetEmail() const
Definition: GpgKeySignature.cpp:88
GpgFrontend::GpgKeySignature::IsInvalid
bool IsInvalid() const
Definition: GpgKeySignature.cpp:52
GpgFrontend::GpgKeySignature::GetName
std::string GetName() const
Definition: GpgKeySignature.cpp:84
GpgFrontend::GpgKeySignature::GpgKeySignature
GpgKeySignature()
Construct a new Gpg Key Signature object.
GpgFrontend::GpgKeySignature::GetKeyID
std::string GetKeyID() const
Definition: GpgKeySignature.cpp:64
GpgFrontend::GpgKeySignature::GetUID
std::string GetUID() const
Definition: GpgKeySignature.cpp:80