From 6d21256c9220df05bf92a695a787dde13fe44ca7 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 21 Mar 2023 08:36:33 +0100 Subject: core,cpp: Add new key flags to gpgme_subkey_t * src/gpgme.h.in (struct _gpgme_subkey): Add bit flags can_renc, can_timestamp, adn is_group_owned. Reduce size of _unused. * src/keylist.c (set_subkey_capability): Set them. * tests/run-keylist.c (main): Print them. * lang/cpp/src/key.h (Subkey::canRenc): New. (Subkey::canTimestamp): New. (Subkey::isGroupOwned): New. * lang/cpp/src/key.cpp: Implement new methods. (Subkey::isQualified): Print them. (std::ostream &operator<<): Print them. -- GnuPG-bug-id: 6395 --- src/gpgme.h.in | 11 ++++++++++- src/keylist.c | 12 ++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gpgme.h.in b/src/gpgme.h.in index 3ea07a81..1d3c1445 100644 --- a/src/gpgme.h.in +++ b/src/gpgme.h.in @@ -575,8 +575,17 @@ struct _gpgme_subkey /* True if the key is compliant to the de-vs mode. */ unsigned int is_de_vs : 1; + /* True if the key can be used for restricted encryption (ADSK). */ + unsigned int can_renc : 1; + + /* True if the key can be used for timestamping. */ + unsigned int can_timestamp : 1; + + /* True if the private key is possessed by more than one person. */ + unsigned int is_group_owned : 1; + /* Internal to GPGME, do not use. */ - unsigned int _unused : 20; + unsigned int _unused : 17; /* Public key algorithm supported by this subkey. */ gpgme_pubkey_algo_t pubkey_algo; diff --git a/src/keylist.c b/src/keylist.c index 1c01bd42..23b97087 100644 --- a/src/keylist.c +++ b/src/keylist.c @@ -287,6 +287,18 @@ set_subkey_capability (gpgme_subkey_t subkey, const char *src) subkey->can_authenticate = 1; break; + case 'r': + subkey->can_renc = 1; + break; + + case 't': + subkey->can_timestamp = 1; + break; + + case 'g': + subkey->is_group_owned = 1; + break; + case 'q': subkey->is_qualified = 1; break; -- cgit v1.2.3