cpp: Add support for new flag fields beta_compliance

* lang/cpp/src/decryptionresult.cpp, lang/cpp/src/decryptionresult.h
(class DecryptionResult): Add method isBetaCompliance.
* lang/cpp/src/decryptionresult.cpp (operator<<): Add new flag.
* lang/cpp/src/key.cpp, lang/cpp/src/key.h (class Key): Add method
isBetaCompliance.
(class Subkey): Add method isBetaCompliance.
* lang/cpp/src/key.cpp:
(Key::isDeVs): Remove duplicate check of is_de_vs of first subkey.
(operator<<): Add new flag.
* lang/cpp/src/verificationresult.cpp, lang/cpp/src/verificationresult.h
(class Signature): Add method isBetaCompliance.
* lang/cpp/src/verificationresult.cpp (operator<<): Add new flag.
--

GnuPG-bug-id: 7346
This commit is contained in:
Ingo Klöcker 2024-10-21 14:47:10 +02:00
parent f510c5d78c
commit 2a05959069
No known key found for this signature in database
GPG Key ID: F5A5D1692277A1E9
6 changed files with 39 additions and 7 deletions

View File

@ -122,6 +122,11 @@ bool GpgME::DecryptionResult::isDeVs() const
return d && d->res.is_de_vs;
}
bool GpgME::DecryptionResult::isBetaCompliance() const
{
return d && d->res.beta_compliance;
}
bool GpgME::DecryptionResult::isMime() const
{
return d && d->res.is_mime;
@ -257,8 +262,9 @@ std::ostream &GpgME::operator<<(std::ostream &os, const DecryptionResult &result
<< "\n fileName: " << protect(result.fileName())
<< "\n unsupportedAlgorithm: " << protect(result.unsupportedAlgorithm())
<< "\n isWrongKeyUsage: " << result.isWrongKeyUsage()
<< "\n isDeVs " << result.isDeVs()
<< "\n legacyCipherNoMDC " << result.isLegacyCipherNoMDC()
<< "\n isDeVs: " << result.isDeVs()
<< "\n isBetaCompliance: " << result.isBetaCompliance()
<< "\n legacyCipherNoMDC: " << result.isLegacyCipherNoMDC()
<< "\n symkeyAlgo: " << protect(result.symkeyAlgo())
<< "\n recipients:\n";
const std::vector<DecryptionResult::Recipient> recipients = result.recipients();

View File

@ -75,6 +75,7 @@ public:
}
bool isWrongKeyUsage() const;
bool isDeVs() const;
bool isBetaCompliance() const;
bool isMime() const;
const char *fileName() const;

View File

@ -264,10 +264,7 @@ bool Key::isQualified() const
bool Key::isDeVs() const
{
if (!key) {
return false;
}
if (!key->subkeys || !key->subkeys->is_de_vs) {
if (!key || !key->subkeys) {
return false;
}
for (gpgme_sub_key_t subkey = key->subkeys ; subkey ; subkey = subkey->next) {
@ -278,6 +275,19 @@ bool Key::isDeVs() const
return true;
}
bool Key::isBetaCompliance() const
{
if (!key || !key->subkeys) {
return false;
}
for (gpgme_sub_key_t subkey = key->subkeys ; subkey ; subkey = subkey->next) {
if (!subkey->beta_compliance) {
return false;
}
}
return true;
}
bool Key::hasCertify() const
{
return key && key->has_certify;
@ -586,6 +596,11 @@ bool Subkey::isDeVs() const
return subkey && subkey->is_de_vs;
}
bool Subkey::isBetaCompliance() const
{
return subkey && subkey->beta_compliance;
}
bool Subkey::isCardKey() const
{
return subkey && subkey->is_cardkey;
@ -1390,6 +1405,7 @@ std::ostream &operator<<(std::ostream &os, const Subkey &subkey)
<< "\n isGroupOwned: " << subkey.isGroupOwned()
<< "\n isQualified: " << subkey.isQualified()
<< "\n isDeVs: " << subkey.isDeVs()
<< "\n isBetaCompliance:" << subkey.isBetaCompliance()
<< "\n isCardKey: " << subkey.isCardKey()
<< "\n cardSerialNumber:" << protect(subkey.cardSerialNumber());
}

View File

@ -129,6 +129,7 @@ public:
bool canAuthenticate() const;
bool isQualified() const;
bool isDeVs() const;
bool isBetaCompliance() const;
/** Returns true, if the key has a certification subkey. */
bool hasCertify() const;
@ -289,6 +290,7 @@ public:
bool isGroupOwned() const;
bool isQualified() const;
bool isDeVs() const;
bool isBetaCompliance() const;
bool isCardKey() const;
bool isSecret() const;

View File

@ -283,6 +283,11 @@ bool GpgME::Signature::isDeVs() const
return !isNull() && d->sigs[idx]->is_de_vs;
}
bool GpgME::Signature::isBetaCompliance() const
{
return !isNull() && d->sigs[idx]->beta_compliance;
}
GpgME::Signature::PKAStatus GpgME::Signature::pkaStatus() const
{
if (!isNull()) {
@ -600,7 +605,8 @@ std::ostream &GpgME::operator<<(std::ostream &os, const Signature &sig)
<< "\n publicKeyAlgorithm: " << protect(sig.publicKeyAlgorithmAsString())
<< "\n hashAlgorithm: " << protect(sig.hashAlgorithmAsString())
<< "\n policyURL: " << protect(sig.policyURL())
<< "\n isDeVs " << sig.isDeVs()
<< "\n isDeVs: " << sig.isDeVs()
<< "\n isBetaCompliance: " << sig.isBetaCompliance()
<< "\n notations:\n";
const std::vector<Notation> nota = sig.notations();
std::copy(nota.begin(), nota.end(),

View File

@ -139,6 +139,7 @@ public:
bool isWrongKeyUsage() const;
bool isVerifiedUsingChainModel() const;
bool isDeVs() const;
bool isBetaCompliance() const;
enum PKAStatus {
UnknownPKAStatus, PKAVerificationFailed, PKAVerificationSucceeded