# GpgFrontend Project: src/core/model/GpgKey.h Source File

GpgKey.h
#ifndef GPGFRONTEND_GPGKEY_H
#define GPGFRONTEND_GPGKEY_H
#include <mutex>
#include "GpgSubKey.h"
#include "GpgUID.h"
namespace GpgFrontend {
class GPGFRONTEND_CORE_EXPORT GpgKey {
public:
[[nodiscard]] bool IsGood() const;
[[nodiscard]] std::string GetId() const;
[[nodiscard]] std::string GetName() const;
[[nodiscard]] std::string GetEmail() const;
[[nodiscard]] std::string GetComment() const;
[[nodiscard]] std::string GetFingerprint() const;
[[nodiscard]] std::string GetProtocol() const;
[[nodiscard]] std::string GetOwnerTrust() const;
[[nodiscard]] std::string GetPublicKeyAlgo() const;
[[nodiscard]] boost::posix_time::ptime GetLastUpdateTime() const;
[[nodiscard]] boost::posix_time::ptime GetExpireTime() const;
[[nodiscard]] boost::posix_time::ptime GetCreateTime() const;
[[nodiscard]] unsigned int GetPrimaryKeyLength() const;
[[nodiscard]] bool IsHasEncryptionCapability() const;
[[nodiscard]] bool IsHasActualEncryptionCapability() const;
[[nodiscard]] bool IsHasSigningCapability() const;
[[nodiscard]] bool IsHasActualSigningCapability() const;
[[nodiscard]] bool IsHasCertificationCapability() const;
[[nodiscard]] bool IsHasActualCertificationCapability() const;
[[nodiscard]] bool IsHasAuthenticationCapability() const;
[[nodiscard]] bool IsHasActualAuthenticationCapability() const;
[[nodiscard]] bool IsHasCardKey() const;
[[nodiscard]] bool IsPrivateKey() const;
[[nodiscard]] bool IsExpired() const;
[[nodiscard]] bool IsRevoked() const;
[[nodiscard]] bool IsDisabled() const;
[[nodiscard]] bool IsHasMasterKey() const;
[[nodiscard]] std::unique_ptr<std::vector<GpgSubKey>> GetSubKeys() const;
[[nodiscard]] std::unique_ptr<std::vector<GpgUID>> GetUIDs() const;
GpgKey() = default;
explicit GpgKey(gpgme_key_t&& key);
~GpgKey() = default;
GpgKey(const gpgme_key_t& key) = delete;
GpgKey(GpgKey&& k) noexcept;
GpgKey& operator=(GpgKey&& k) noexcept;
GpgKey& operator=(const gpgme_key_t& key) = delete;
bool operator==(const GpgKey& o) const;
bool operator<=(const GpgKey& o) const;
explicit operator gpgme_key_t() const;
[[nodiscard]] GpgKey Copy() const;
private:
struct GPGFRONTEND_CORE_EXPORT _key_ref_deleter {
void operator()(gpgme_key_t _key);
};
using KeyRefHandler =
std::unique_ptr<struct _gpgme_key, _key_ref_deleter>;
KeyRefHandler key_ref_ = nullptr;
mutable std::mutex gpgme_key_opera_mutex; // mutex for gpgme key operations
};
} // namespace GpgFrontend
#endif // GPGFRONTEND_GPGKEY_H
GpgFrontend::GpgKey
Definition: GpgKey.h:43
GpgFrontend::GpgKey::GpgKey
GpgKey(const gpgme_key_t &key)=delete
Construct a new Gpg Key object.
GpgFrontend::GpgKey::~GpgKey
~GpgKey()=default
Destroy the Gpg Key objects.
GpgFrontend::GpgKey::GpgKey
GpgKey()=default
Construct a new Gpg Key object.
GpgFrontend::GpgKey::operator=
GpgKey & operator=(const gpgme_key_t &key)=delete
GpgFrontend
Definition: CoreCommonUtil.cpp:31
GpgFrontend::GpgKey::_key_ref_deleter
Definition: GpgKey.h:350