GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
GpgSignature.h
1 
29 #ifndef GPGFRONTEND_GPGSIGNATURE_H
30 #define GPGFRONTEND_GPGSIGNATURE_H
31 
32 #include <boost/date_time/gregorian/greg_date.hpp>
33 #include <boost/date_time/posix_time/conversion.hpp>
34 
35 #include "core/GpgConstants.h"
36 
37 namespace GpgFrontend {
38 
43 class GPGFRONTEND_CORE_EXPORT GpgSignature {
44  public:
50  [[nodiscard]] gpgme_validity_t GetValidity() const;
51 
57  [[nodiscard]] gpgme_error_t GetStatus() const;
58 
64  [[nodiscard]] gpgme_error_t GetSummary() const;
65 
71  [[nodiscard]] std::string GetPubkeyAlgo() const;
72 
78  [[nodiscard]] std::string GetHashAlgo() const;
79 
85  [[nodiscard]] boost::posix_time::ptime GetCreateTime() const;
86 
92  [[nodiscard]] boost::posix_time::ptime GetExpireTime() const;
93 
99  [[nodiscard]] std::string GetFingerprint() const;
100 
105  GpgSignature();
106 
111  ~GpgSignature();
112 
118  explicit GpgSignature(gpgme_signature_t sig);
119 
124  GpgSignature(GpgSignature &&) noexcept;
125 
130  GpgSignature(const GpgSignature &) = delete;
131 
137  GpgSignature &operator=(GpgSignature &&) noexcept;
138 
144  GpgSignature &operator=(const GpgSignature &) = delete;
145 
146  private:
147  using KeySignatrueRefHandler =
148  std::unique_ptr<struct _gpgme_signature,
149  std::function<void(gpgme_signature_t)>>;
150 
151  KeySignatrueRefHandler signature_ref_ = nullptr;
152 };
153 } // namespace GpgFrontend
154 
155 #endif // GPGFRONTEND_GPGSIGNATURE_H
GpgFrontend::GpgSignature::GetFingerprint
std::string GetFingerprint() const
Definition: GpgSignature.cpp:116
GpgFrontend
Definition: CoreCommonUtil.cpp:29
GpgFrontend::GpgSignature::GetValidity
gpgme_validity_t GetValidity() const
Definition: GpgSignature.cpp:53
GpgFrontend::GpgSignature
Definition: GpgSignature.h:43
GpgFrontend::GpgSignature::GetExpireTime
boost::posix_time::ptime GetExpireTime() const
Definition: GpgSignature.cpp:107
GpgFrontend::GpgSignature::~GpgSignature
~GpgSignature()
Destroy the Gpg Signature object.
GpgFrontend::GpgSignature::GetStatus
gpgme_error_t GetStatus() const
Definition: GpgSignature.cpp:62
GpgFrontend::GpgSignature::GetCreateTime
boost::posix_time::ptime GetCreateTime() const
Create a time object.
Definition: GpgSignature.cpp:98
GpgFrontend::GpgSignature::GetSummary
gpgme_error_t GetSummary() const
Definition: GpgSignature.cpp:71
GpgFrontend::GpgSignature::GetPubkeyAlgo
std::string GetPubkeyAlgo() const
Definition: GpgSignature.cpp:80
GpgFrontend::GpgSignature::GpgSignature
GpgSignature()
Construct a new Gpg Signature object.
GpgFrontend::GpgSignature::GetHashAlgo
std::string GetHashAlgo() const
Definition: GpgSignature.cpp:89