Commit d430be63 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Add new helpers for checking de-vs compliance of GnuPG

... and deprecate gpgComplianceP().

GnuPG-bug-id: 5362
parent 09c7841a
......@@ -15,6 +15,7 @@
#include "gnupg.h"
#include "utils/compat.h"
#include "utils/cryptoconfig.h"
#include "utils/hex.h"
#include <gpgme++/engineinfo.h>
......@@ -454,6 +455,22 @@ bool Kleo::gpgComplianceP(const char *mode)
return entry && entry->stringValue() == QString::fromLatin1(mode);
}
bool Kleo::gnupgUsesDeVsCompliance()
{
return getCryptoConfigStringValue("gpg", "compliance") == QLatin1String{"de-vs"};
}
bool Kleo::gnupgIsDeVsCompliant()
{
if (!gnupgUsesDeVsCompliance()) {
return false;
}
// the pseudo option compliance_de_vs was added in 2.2.28; for older versions of GnuPG
// we assume non-compliance to be on the safe side; versions of Kleopatra for which
// this matters are bundled with new enough versions of GnuPG anyway
return getCryptoConfigIntValue("gpg", "compliance_de_vs", 0) != 0;
}
enum GpgME::UserID::Validity Kleo::keyValidity(const GpgME::Key &key)
{
enum UserID::Validity validity = UserID::Validity::Unknown;
......
......@@ -50,7 +50,21 @@ KLEO_EXPORT int makeGnuPGError(int code);
KLEO_EXPORT bool engineIsVersion(int major, int minor, int patch, GpgME::Engine = GpgME::GpgConfEngine);
KLEO_EXPORT bool haveKeyserverConfigured();
KLEO_EXPORT bool gpgComplianceP(const char *mode);
/* Use gnupgUsesDeVsCompliance() or gnupgIsDeVsCompliant() instead. */
KLEO_DEPRECATED_EXPORT bool gpgComplianceP(const char *mode);
/** Returns true, if compliance mode "de-vs" is configured for GnuPG.
* Note: It does not check whether the used GnuPG is actually compliant.
*/
KLEO_EXPORT bool gnupgUsesDeVsCompliance();
/** Returns true, if compliance mode "de-vs" is configured for GnuPG and if
* GnuPG passes a basic compliance check, i.e. at least libgcrypt and the used
* RNG are compliant.
*/
KLEO_EXPORT bool gnupgIsDeVsCompliant();
KLEO_EXPORT enum GpgME::UserID::Validity keyValidity(const GpgME::Key &key);
/* Convert GnuPG output to a QString with proper encoding.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment