diff options
author | J08nY <[email protected]> | 2017-12-05 22:41:59 +0100 |
---|---|---|
committer | J08nY <[email protected]> | 2017-12-05 22:41:59 +0100 |
commit | 6b13db9408d6f0a723fb7b8c053c67e4f986c132 (patch) | |
tree | 96d868762dc48893a7868c7e68f084caf99d493c /src/lib/pubkey/ec_group | |
parent | e5f39dd483a08accc8a12e8b322a48037c5b3bf4 (diff) |
Add known_named_groups to EC_Group to list known curves. Fixes GX #1338.
Diffstat (limited to 'src/lib/pubkey/ec_group')
-rw-r--r-- | src/lib/pubkey/ec_group/ec_group.h | 6 | ||||
-rw-r--r-- | src/lib/pubkey/ec_group/ec_named.cpp | 35 |
2 files changed, 41 insertions, 0 deletions
diff --git a/src/lib/pubkey/ec_group/ec_group.h b/src/lib/pubkey/ec_group/ec_group.h index ccd69a4dc..18ffed12c 100644 --- a/src/lib/pubkey/ec_group/ec_group.h +++ b/src/lib/pubkey/ec_group/ec_group.h @@ -13,6 +13,7 @@ #include <botan/point_gfp.h> #include <botan/curve_gfp.h> #include <botan/asn1_oid.h> +#include <set> namespace Botan { @@ -134,6 +135,11 @@ class BOTAN_PUBLIC_API(2,0) EC_Group final */ static std::string PEM_for_named_group(const std::string& name); + /** + * Return a set of known named EC groups + */ + static const std::set<std::string>& known_named_groups(); + private: CurveGFp m_curve; PointGFp m_base_point; diff --git a/src/lib/pubkey/ec_group/ec_named.cpp b/src/lib/pubkey/ec_group/ec_named.cpp index fc4a67fc6..2a8e1a186 100644 --- a/src/lib/pubkey/ec_group/ec_named.cpp +++ b/src/lib/pubkey/ec_group/ec_named.cpp @@ -284,4 +284,39 @@ std::string EC_Group::PEM_for_named_group(const std::string& name) return ""; } +const std::set<std::string>& EC_Group::known_named_groups() + { + static const std::set<std::string> named_groups = { + "secp160k1", + "secp160r1", + "secp160r2", + "secp192k1", + "secp192r1", + "secp224k1", + "secp224r1", + "secp256k1", + "secp256r1", + "secp384r1", + "secp521r1", + "brainpool160r1", + "brainpool192r1", + "brainpool224r1", + "brainpool256r1", + "brainpool320r1", + "brainpool384r1", + "brainpool512r1", + "x962_p192v2", + "x962_p192v3", + "x962_p239v1", + "x962_p239v2", + "x962_p239v3", + "gost_256A", + "frp256v1", + "sm2p256v1" +#if defined(BOTAN_HOUSE_ECC_CURVE_NAME) + ,BOTAN_HOUSE_ECC_CURVE_NAME +#endif + }; + return named_groups; + } } |