aboutsummaryrefslogtreecommitdiffstats
path: root/lang/cpp/src/key.h
diff options
context:
space:
mode:
authorIngo Klöcker <[email protected]>2024-05-24 08:47:15 +0000
committerIngo Klöcker <[email protected]>2024-05-24 08:47:15 +0000
commitf0d1f2c4c746d6f98643772b4864c09f3642cd83 (patch)
tree6348dacfbb5f42e946902dc42436d165fb8df904 /lang/cpp/src/key.h
parentqt,cpp: Implement adding ADSKs to existing keys (diff)
parentcpp: Add information about revocation keys to Key (diff)
downloadgpgme-f0d1f2c4c746d6f98643772b4864c09f3642cd83.tar.gz
gpgme-f0d1f2c4c746d6f98643772b4864c09f3642cd83.zip
Merge branch 'ikloecker/t7118-revkeys'
Diffstat (limited to 'lang/cpp/src/key.h')
-rw-r--r--lang/cpp/src/key.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/lang/cpp/src/key.h b/lang/cpp/src/key.h
index bdcc18d2..a1648884 100644
--- a/lang/cpp/src/key.h
+++ b/lang/cpp/src/key.h
@@ -44,6 +44,7 @@ class Context;
class Subkey;
class UserID;
class TofuInfo;
+class RevocationKey;
typedef std::shared_ptr< std::remove_pointer<gpgme_key_t>::type > shared_gpgme_key_t;
@@ -100,6 +101,10 @@ public:
std::vector<UserID> userIDs() const;
std::vector<Subkey> subkeys() const;
+ RevocationKey revocationKey(unsigned int index) const;
+ unsigned int numRevocationKeys() const;
+ std::vector<RevocationKey> revocationKeys() const;
+
bool isRevoked() const;
bool isExpired() const;
bool isDisabled() const;
@@ -547,9 +552,53 @@ private:
gpgme_key_sig_t sig;
};
+//
+// class RevocationKey
+//
+
+class GPGMEPP_EXPORT RevocationKey
+{
+public:
+ RevocationKey();
+ RevocationKey(const shared_gpgme_key_t &key, gpgme_revocation_key_t revkey);
+ RevocationKey(const shared_gpgme_key_t &key, unsigned int idx);
+
+ // Rule of Zero
+
+ void swap(RevocationKey &other)
+ {
+ using std::swap;
+ swap(this->key, other.key);
+ swap(this->revkey, other.revkey);
+ }
+
+ bool isNull() const
+ {
+ return !key || !revkey;
+ }
+
+ Key parent() const;
+
+ const char *fingerprint() const;
+
+ bool isSensitive() const;
+
+ int algorithm() const;
+
+private:
+ shared_gpgme_key_t key;
+ gpgme_revocation_key_t revkey;
+};
+
+inline void swap(RevocationKey& v1, RevocationKey& v2)
+{
+ v1.swap(v2);
+}
+
GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const UserID &uid);
GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const Subkey &subkey);
GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const Key &key);
+GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const RevocationKey &revkey);
} // namespace GpgME