cpp: Add getters for the attributes of a trust signature
* lang/cpp/src/key.h (TrustSignatureTrust): New enum. * lang/cpp/src/key.h, lang/cpp/src/key.cpp (UserID::Signature::isTrustSignature): New. (UserID::Signature::trustValue): New. (UserID::Signature::trustDepth): New. (UserID::Signature::trustScope): New. -- GnuPG-bug-id: 5245, 5420
This commit is contained in:
parent
276187f6b6
commit
e391a08c6f
4
NEWS
4
NEWS
@ -4,6 +4,10 @@ Noteworthy changes in version 1.15.2 (unreleased)
|
|||||||
|
|
||||||
* Interface changes relative to the 1.15.1 release:
|
* Interface changes relative to the 1.15.1 release:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
cpp: UserID::Signature::isTrustSignature NEW.
|
||||||
|
cpp: UserID::Signature::trustValue NEW.
|
||||||
|
cpp: UserID::Signature::trustDepth NEW.
|
||||||
|
cpp: UserID::Signature::trustScope NEW.
|
||||||
gpgme_key_sig_t EXTENDED: New field 'trust_depth'.
|
gpgme_key_sig_t EXTENDED: New field 'trust_depth'.
|
||||||
gpgme_key_sig_t EXTENDED: New field 'trust_value'.
|
gpgme_key_sig_t EXTENDED: New field 'trust_value'.
|
||||||
gpgme_key_sig_t EXTENDED: New field 'trust_scope'.
|
gpgme_key_sig_t EXTENDED: New field 'trust_scope'.
|
||||||
|
@ -1083,6 +1083,29 @@ const char *UserID::Signature::policyURL() const
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UserID::Signature::isTrustSignature() const
|
||||||
|
{
|
||||||
|
return sig && sig->trust_depth > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
TrustSignatureTrust UserID::Signature::trustValue() const
|
||||||
|
{
|
||||||
|
if (!sig || !isTrustSignature()) {
|
||||||
|
return TrustSignatureTrust::None;
|
||||||
|
}
|
||||||
|
return sig->trust_value >= 120 ? TrustSignatureTrust::Complete : TrustSignatureTrust::Partial;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int UserID::Signature::trustDepth() const
|
||||||
|
{
|
||||||
|
return sig ? sig->trust_depth : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *UserID::Signature::trustScope() const
|
||||||
|
{
|
||||||
|
return sig ? sig->trust_scope : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
std::string UserID::addrSpecFromString(const char *userid)
|
std::string UserID::addrSpecFromString(const char *userid)
|
||||||
{
|
{
|
||||||
if (!userid) {
|
if (!userid) {
|
||||||
|
@ -47,6 +47,12 @@ class TofuInfo;
|
|||||||
|
|
||||||
typedef std::shared_ptr< std::remove_pointer<gpgme_key_t>::type > shared_gpgme_key_t;
|
typedef std::shared_ptr< std::remove_pointer<gpgme_key_t>::type > shared_gpgme_key_t;
|
||||||
|
|
||||||
|
enum class TrustSignatureTrust : char {
|
||||||
|
None = 0,
|
||||||
|
Partial,
|
||||||
|
Complete,
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// class Key
|
// class Key
|
||||||
//
|
//
|
||||||
@ -514,6 +520,11 @@ public:
|
|||||||
GpgME::Notation notation(unsigned int idx) const;
|
GpgME::Notation notation(unsigned int idx) const;
|
||||||
std::vector<GpgME::Notation> notations() const;
|
std::vector<GpgME::Notation> notations() const;
|
||||||
|
|
||||||
|
bool isTrustSignature() const;
|
||||||
|
TrustSignatureTrust trustValue() const;
|
||||||
|
unsigned int trustDepth() const;
|
||||||
|
const char *trustScope() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
shared_gpgme_key_t key;
|
shared_gpgme_key_t key;
|
||||||
gpgme_user_id_t uid;
|
gpgme_user_id_t uid;
|
||||||
|
Loading…
Reference in New Issue
Block a user