From: Pieter Lexis Date: Wed, 13 Jan 2016 15:58:15 +0000 (+0100) Subject: pdnsutil: add list-algorithms X-Git-Tag: auth-4.0.0-alpha2~45^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98d13a9046cd928daaff1ea5861e0a612cd790d2;p=thirdparty%2Fpdns.git pdnsutil: add list-algorithms --- diff --git a/pdns/dnssecinfra.cc b/pdns/dnssecinfra.cc index 3d477eead8..7c59814d6a 100644 --- a/pdns/dnssecinfra.cc +++ b/pdns/dnssecinfra.cc @@ -123,6 +123,21 @@ DNSCryptoKeyEngine* DNSCryptoKeyEngine::make(unsigned int algo) } } +/** + * Returns the supported DNSSEC algorithms with the name of the Crypto Backend used + * + * @return A vector with pairs of (algorithm-number (int), backend-name (string)) + */ +vector> DNSCryptoKeyEngine::listAllAlgosWithBackend() +{ + vector> ret; + for (auto const& value : getMakers()) { + shared_ptr dcke(value.second(value.first)); + ret.push_back(make_pair(value.first, dcke->getName())); + } + return ret; +} + void DNSCryptoKeyEngine::report(unsigned int algo, maker_t* maker, bool fallback) { getAllMakers()[algo].push_back(maker); diff --git a/pdns/dnssecinfra.hh b/pdns/dnssecinfra.hh index 5d8e203021..e0d15335e1 100644 --- a/pdns/dnssecinfra.hh +++ b/pdns/dnssecinfra.hh @@ -49,6 +49,7 @@ class DNSCryptoKeyEngine static void report(unsigned int algorithm, maker_t* maker, bool fallback=false); static std::pair testMakers(unsigned int algorithm, maker_t* creator, maker_t* signer, maker_t* verifier); + static vector> listAllAlgosWithBackend(); static bool testAll(); static bool testOne(int algo); private: diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index 6c02e6bcf3..e324cffff4 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -1856,6 +1856,7 @@ try cerr<<" [active|inactive] [ksk|zsk] Defaults to KSK and active"< 2) { + cerr<<"Syntax: pdnsutil list-algorithms [with-backend]"<