cpp: Output more properties of a subkey

* lang/cpp/src/key.cpp (ostream operator<< for Subkey): Fix wrong output
of isInvalid and isDisabled flags. Add output of key grip, card serial
number and the flags isSecret, isQualified, isDeVs, and isCardKey.
--

This makes it easier to check those properties for different keys, e.g.
with the run-keylist test program.

GnuPG-bug-id: 5965
This commit is contained in:
Ingo Klöcker 2022-05-05 17:24:07 +02:00
parent e029fd2735
commit 306fd9c915

View File

@ -1250,16 +1250,22 @@ std::ostream &operator<<(std::ostream &os, const Subkey &subkey)
os << "GpgME::Subkey("; os << "GpgME::Subkey(";
if (!subkey.isNull()) { if (!subkey.isNull()) {
os << "\n fingerprint: " << protect(subkey.fingerprint()) os << "\n fingerprint: " << protect(subkey.fingerprint())
<< "\n keyGrip: " << protect(subkey.keyGrip())
<< "\n creationTime: " << subkey.creationTime() << "\n creationTime: " << subkey.creationTime()
<< "\n expirationTime:" << subkey.expirationTime() << "\n expirationTime:" << subkey.expirationTime()
<< "\n isRevoked: " << subkey.isRevoked() << "\n isRevoked: " << subkey.isRevoked()
<< "\n isExpired: " << subkey.isExpired() << "\n isExpired: " << subkey.isExpired()
<< "\n isInvalid: " << subkey.isRevoked() << "\n isInvalid: " << subkey.isInvalid()
<< "\n isDisabled: " << subkey.isInvalid() << "\n isDisabled: " << subkey.isDisabled()
<< "\n canSign: " << subkey.canSign() << "\n canSign: " << subkey.canSign()
<< "\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 isSecret: " << subkey.isSecret()
<< "\n isQualified: " << subkey.isQualified()
<< "\n isDeVs: " << subkey.isDeVs()
<< "\n isCardKey: " << subkey.isCardKey()
<< "\n cardSerialNumber:" << protect(subkey.cardSerialNumber());
} }
return os << ')'; return os << ')';
} }