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
This commit is contained in:
parent
18e09b15d5
commit
6d21256c92
9
NEWS
9
NEWS
@ -2,6 +2,15 @@ Noteworthy changes in version 1.20.0 (unreleased)
|
|||||||
-------------------------------------------------
|
-------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
* Interface changes relative to the 1.19.0 release:
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
gpgme_subkey_t EXTENDED: New field 'can_renc'.
|
||||||
|
gpgme_subkey_t EXTENDED: New field 'can_timestamp'.
|
||||||
|
gpgme_subkey_t EXTENDED: New field 'is_group_owned'.
|
||||||
|
cpp: Subkey::canRenc NEW.
|
||||||
|
cpp: Subkey::canTimestamp NEW.
|
||||||
|
cpp: Subkey::isGroupOwned NEW.
|
||||||
|
|
||||||
Release-info: https://dev.gnupg.org/Tnnnn
|
Release-info: https://dev.gnupg.org/Tnnnn
|
||||||
|
|
||||||
|
|
||||||
|
@ -515,6 +515,21 @@ bool Subkey::canAuthenticate() const
|
|||||||
return subkey && subkey->can_authenticate;
|
return subkey && subkey->can_authenticate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Subkey::canRenc() const
|
||||||
|
{
|
||||||
|
return subkey && subkey->can_renc;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Subkey::canTimestamp() const
|
||||||
|
{
|
||||||
|
return subkey && subkey->can_timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Subkey::isGroupOwned() const
|
||||||
|
{
|
||||||
|
return subkey && subkey->is_group_owned;
|
||||||
|
}
|
||||||
|
|
||||||
bool Subkey::isQualified() const
|
bool Subkey::isQualified() const
|
||||||
{
|
{
|
||||||
return subkey && subkey->is_qualified;
|
return subkey && subkey->is_qualified;
|
||||||
@ -1261,7 +1276,10 @@ std::ostream &operator<<(std::ostream &os, const Subkey &subkey)
|
|||||||
<< "\n canEncrypt: " << subkey.canEncrypt()
|
<< "\n canEncrypt: " << subkey.canEncrypt()
|
||||||
<< "\n canCertify: " << subkey.canCertify()
|
<< "\n canCertify: " << subkey.canCertify()
|
||||||
<< "\n canAuth: " << subkey.canAuthenticate()
|
<< "\n canAuth: " << subkey.canAuthenticate()
|
||||||
|
<< "\n canRenc: " << subkey.canRenc()
|
||||||
|
<< "\n canTimestanp: " << subkey.canTimestamp()
|
||||||
<< "\n isSecret: " << subkey.isSecret()
|
<< "\n isSecret: " << subkey.isSecret()
|
||||||
|
<< "\n isGroupOwned: " << subkey.isGroupOwned()
|
||||||
<< "\n isQualified: " << subkey.isQualified()
|
<< "\n isQualified: " << subkey.isQualified()
|
||||||
<< "\n isDeVs: " << subkey.isDeVs()
|
<< "\n isDeVs: " << subkey.isDeVs()
|
||||||
<< "\n isCardKey: " << subkey.isCardKey()
|
<< "\n isCardKey: " << subkey.isCardKey()
|
||||||
|
@ -270,6 +270,9 @@ public:
|
|||||||
bool canSign() const;
|
bool canSign() const;
|
||||||
bool canCertify() const;
|
bool canCertify() const;
|
||||||
bool canAuthenticate() const;
|
bool canAuthenticate() const;
|
||||||
|
bool canRenc() const;
|
||||||
|
bool canTimestamp() const;
|
||||||
|
bool isGroupOwned() const;
|
||||||
bool isQualified() const;
|
bool isQualified() const;
|
||||||
bool isDeVs() const;
|
bool isDeVs() const;
|
||||||
bool isCardKey() const;
|
bool isCardKey() const;
|
||||||
|
@ -575,8 +575,17 @@ struct _gpgme_subkey
|
|||||||
/* True if the key is compliant to the de-vs mode. */
|
/* True if the key is compliant to the de-vs mode. */
|
||||||
unsigned int is_de_vs : 1;
|
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. */
|
/* Internal to GPGME, do not use. */
|
||||||
unsigned int _unused : 20;
|
unsigned int _unused : 17;
|
||||||
|
|
||||||
/* Public key algorithm supported by this subkey. */
|
/* Public key algorithm supported by this subkey. */
|
||||||
gpgme_pubkey_algo_t pubkey_algo;
|
gpgme_pubkey_algo_t pubkey_algo;
|
||||||
|
@ -287,6 +287,18 @@ set_subkey_capability (gpgme_subkey_t subkey, const char *src)
|
|||||||
subkey->can_authenticate = 1;
|
subkey->can_authenticate = 1;
|
||||||
break;
|
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':
|
case 'q':
|
||||||
subkey->is_qualified = 1;
|
subkey->is_qualified = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -309,19 +309,22 @@ main (int argc, char **argv)
|
|||||||
printf ("grip %2d: %s\n", nsub, subkey->keygrip);
|
printf ("grip %2d: %s\n", nsub, subkey->keygrip);
|
||||||
if (subkey->curve)
|
if (subkey->curve)
|
||||||
printf ("curve %2d: %s\n", nsub, subkey->curve);
|
printf ("curve %2d: %s\n", nsub, subkey->curve);
|
||||||
printf ("caps %2d: %s%s%s%s\n",
|
printf ("caps %2d: %s%s%s%s%s%s\n",
|
||||||
nsub,
|
nsub,
|
||||||
subkey->can_encrypt? "e":"",
|
subkey->can_encrypt? "e":"",
|
||||||
subkey->can_sign? "s":"",
|
subkey->can_sign? "s":"",
|
||||||
subkey->can_certify? "c":"",
|
subkey->can_certify? "c":"",
|
||||||
subkey->can_authenticate? "a":"");
|
subkey->can_authenticate? "a":"",
|
||||||
printf ("flags %2d:%s%s%s%s%s%s%s%s\n",
|
subkey->can_renc? "r":"",
|
||||||
|
subkey->can_timestamp? "t":"");
|
||||||
|
printf ("flags %2d:%s%s%s%s%s%s%s%s%s\n",
|
||||||
nsub,
|
nsub,
|
||||||
subkey->secret? " secret":"",
|
subkey->secret? " secret":"",
|
||||||
subkey->revoked? " revoked":"",
|
subkey->revoked? " revoked":"",
|
||||||
subkey->expired? " expired":"",
|
subkey->expired? " expired":"",
|
||||||
subkey->disabled? " disabled":"",
|
subkey->disabled? " disabled":"",
|
||||||
subkey->invalid? " invalid":"",
|
subkey->invalid? " invalid":"",
|
||||||
|
subkey->is_group_owned? " group":"",
|
||||||
subkey->is_qualified? " qualified":"",
|
subkey->is_qualified? " qualified":"",
|
||||||
subkey->is_de_vs? " de-vs":"",
|
subkey->is_de_vs? " de-vs":"",
|
||||||
subkey->is_cardkey? " cardkey":"");
|
subkey->is_cardkey? " cardkey":"");
|
||||||
|
Loading…
Reference in New Issue
Block a user