GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
GpgSubKey.h
1 
29 #pragma once
30 
31 #include <gpgme.h>
32 
33 #include "core/GpgFrontendCoreExport.h"
34 
35 namespace GpgFrontend {
36 
41 class GPGFRONTEND_CORE_EXPORT GpgSubKey {
42  public:
48  [[nodiscard]] auto GetID() const -> QString;
49 
55  [[nodiscard]] auto GetFingerprint() const -> QString;
56 
62  [[nodiscard]] auto GetPubkeyAlgo() const -> QString;
63 
69  [[nodiscard]] auto GetKeyAlgo() const -> QString;
70 
76  [[nodiscard]] auto GetKeyLength() const -> unsigned int;
77 
84  [[nodiscard]] auto IsHasEncryptionCapability() const -> bool;
85 
92  [[nodiscard]] auto IsHasSigningCapability() const -> bool;
93 
100  [[nodiscard]] auto IsHasCertificationCapability() const -> bool;
101 
108  [[nodiscard]] auto IsHasAuthenticationCapability() const -> bool;
109 
116  [[nodiscard]] auto IsPrivateKey() const -> bool;
117 
124  [[nodiscard]] auto IsExpired() const -> bool;
125 
132  [[nodiscard]] auto IsRevoked() const -> bool;
133 
140  [[nodiscard]] auto IsDisabled() const -> bool;
141 
148  [[nodiscard]] auto IsSecretKey() const -> bool;
149 
156  [[nodiscard]] auto IsCardKey() const -> bool;
157 
163  [[nodiscard]] auto GetCreateTime() const -> QDateTime;
164 
170  [[nodiscard]] QDateTime GetExpireTime() const;
171 
177 
183  explicit GpgSubKey(gpgme_subkey_t subkey);
184 
190  GpgSubKey(GpgSubKey&& o) noexcept;
191 
196  GpgSubKey(const GpgSubKey&) = delete;
197 
204  auto operator=(GpgSubKey&& o) noexcept -> GpgSubKey&;
205 
211  auto operator=(const GpgSubKey&) -> GpgSubKey& = delete;
212 
220  auto operator==(const GpgSubKey& o) const -> bool;
221 
222  private:
223  using SubkeyRefHandler =
224  std::unique_ptr<struct _gpgme_subkey,
225  std::function<void(gpgme_subkey_t)>>;
226 
227  SubkeyRefHandler subkey_ref_ = nullptr;
228 };
229 
230 } // namespace GpgFrontend
Definition: GpgSubKey.h:41
GpgSubKey()
Construct a new Gpg Sub Key object.
GpgSubKey(const GpgSubKey &)=delete
Construct a new Gpg Sub Key object.
auto operator=(const GpgSubKey &) -> GpgSubKey &=delete
Definition: app.cpp:39