From 5bd84cfd3f092703bb4b9b993be7d89ca13b36b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Tue, 18 Apr 2023 13:16:22 +0200 Subject: cpp: Fix Key::canSign() * lang/cpp/src/key.h (canReallySign): Deprecate. * lang/cpp/src/key.cpp (canSign): Remove workaround. Use implementation of canReallySign. (canReallySign): Use canSign(). (operator<<): Use canSign(). -- The workaround in canSign was added 19 years ago and canReallySign, the workaround for the workaround, was added 13 years ago. Time to get rid of those workarounds for a bug in gpgme which has been fixed long ago and which cause bugs for any unsuspecting user of Key::canSign(). GnuPG-bug-id: 6456 --- lang/cpp/src/key.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'lang/cpp/src/key.cpp') diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp index b7a55aec..b18cfaee 100644 --- a/lang/cpp/src/key.cpp +++ b/lang/cpp/src/key.cpp @@ -208,17 +208,12 @@ bool Key::canEncrypt() const bool Key::canSign() const { -#ifndef GPGME_CAN_SIGN_ON_SECRET_OPENPGP_KEYLISTING_NOT_BROKEN - if (key && key->protocol == GPGME_PROTOCOL_OpenPGP) { - return true; - } -#endif - return canReallySign(); + return key && key->can_sign; } bool Key::canReallySign() const { - return key && key->can_sign; + return canSign(); } bool Key::canCertify() const @@ -1297,7 +1292,7 @@ std::ostream &operator<<(std::ostream &os, const Key &key) << "\n issuer: " << protect(key.issuerName()) << "\n fingerprint:" << protect(key.primaryFingerprint()) << "\n listmode: " << key.keyListMode() - << "\n canSign: " << key.canReallySign() + << "\n canSign: " << key.canSign() << "\n canEncrypt: " << key.canEncrypt() << "\n canCertify: " << key.canCertify() << "\n canAuth: " << key.canAuthenticate() -- cgit v1.2.3