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

Add helper returning the configured keyserver

GnuPG-bug-id: 5672
parent f4af96a1
......@@ -440,12 +440,16 @@ bool Kleo::haveKeyserverConfigured()
// since 2.1.19 there is a builtin keyserver
return true;
const QGpgME::CryptoConfig *const config = QGpgME::cryptoConfig();
if (!config) {
return false;
return !Kleo::keyserver().isEmpty();
QString Kleo::keyserver()
QString result = getCryptoConfigStringValue("gpg", "keyserver");
if (result.isEmpty()) {
result = getCryptoConfigStringValue("dirmngr", "keyserver");
const QGpgME::CryptoConfigEntry *const entry = Kleo::getCryptoConfigEntry(config, "gpg", "keyserver");
return entry && !entry->stringValue().isEmpty();
return result;
bool Kleo::gpgComplianceP(const char *mode)
......@@ -49,8 +49,22 @@ KLEO_EXPORT QStringList gnupgFileWhitelist();
KLEO_EXPORT int makeGnuPGError(int code);
KLEO_EXPORT bool engineIsVersion(int major, int minor, int patch, GpgME::Engine = GpgME::GpgConfEngine);
/** Returns true, if GnuPG knows which keyserver to use for keyserver
* operations.
* Since version 2.1.19 GnuPG has a builtin default keyserver, so that this
* function always returns true. For older versions of GnuPG it checks if
* a keyserver has been configured.
KLEO_EXPORT bool haveKeyserverConfigured();
/** Returns the configured keyserver or an empty string if no keyserver is
* configured.
* Note: Since GnuPG 2.1.19 gpg/dirmngr uses a default keyserver if no
* keyserver is configured.
KLEO_EXPORT QString keyserver();
/* Use gnupgUsesDeVsCompliance() or gnupgIsDeVsCompliant() instead. */
KLEO_DEPRECATED_EXPORT bool gpgComplianceP(const char *mode);
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