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
This commit is contained in:
parent
7d1159c1e9
commit
5bd84cfd3f
@ -208,17 +208,12 @@ bool Key::canEncrypt() const
|
|||||||
|
|
||||||
bool Key::canSign() const
|
bool Key::canSign() const
|
||||||
{
|
{
|
||||||
#ifndef GPGME_CAN_SIGN_ON_SECRET_OPENPGP_KEYLISTING_NOT_BROKEN
|
return key && key->can_sign;
|
||||||
if (key && key->protocol == GPGME_PROTOCOL_OpenPGP) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return canReallySign();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Key::canReallySign() const
|
bool Key::canReallySign() const
|
||||||
{
|
{
|
||||||
return key && key->can_sign;
|
return canSign();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Key::canCertify() const
|
bool Key::canCertify() const
|
||||||
@ -1297,7 +1292,7 @@ std::ostream &operator<<(std::ostream &os, const Key &key)
|
|||||||
<< "\n issuer: " << protect(key.issuerName())
|
<< "\n issuer: " << protect(key.issuerName())
|
||||||
<< "\n fingerprint:" << protect(key.primaryFingerprint())
|
<< "\n fingerprint:" << protect(key.primaryFingerprint())
|
||||||
<< "\n listmode: " << key.keyListMode()
|
<< "\n listmode: " << key.keyListMode()
|
||||||
<< "\n canSign: " << key.canReallySign()
|
<< "\n canSign: " << key.canSign()
|
||||||
<< "\n canEncrypt: " << key.canEncrypt()
|
<< "\n canEncrypt: " << key.canEncrypt()
|
||||||
<< "\n canCertify: " << key.canCertify()
|
<< "\n canCertify: " << key.canCertify()
|
||||||
<< "\n canAuth: " << key.canAuthenticate()
|
<< "\n canAuth: " << key.canAuthenticate()
|
||||||
|
@ -110,16 +110,8 @@ public:
|
|||||||
bool isBad() const;
|
bool isBad() const;
|
||||||
|
|
||||||
bool canEncrypt() const;
|
bool canEncrypt() const;
|
||||||
/*!
|
|
||||||
This function contains a workaround for old gpgme's: all secret
|
|
||||||
OpenPGP keys canSign() == true, which canReallySign() doesn't
|
|
||||||
have. I don't have time to find what breaks when I remove this
|
|
||||||
workaround, but since Kleopatra merges secret into public keys,
|
|
||||||
the workaround is not necessary there (and actively harms), I've
|
|
||||||
added a new function instead.
|
|
||||||
*/
|
|
||||||
bool canSign() const;
|
bool canSign() const;
|
||||||
bool canReallySign() const;
|
GPGMEPP_DEPRECATED bool canReallySign() const;
|
||||||
bool canCertify() const;
|
bool canCertify() const;
|
||||||
bool canAuthenticate() const;
|
bool canAuthenticate() const;
|
||||||
bool isQualified() const;
|
bool isQualified() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user