From 912f3b6f042855b4983a7ee86250fc670e3738e5 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Fri, 2 Feb 2018 18:51:54 -0500 Subject: Create a persistent registry for ECC group data Now a single copy is maintained of each EC group info --- src/lib/asn1/asn1_oid.cpp | 2 +- src/lib/asn1/asn1_oid.h | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'src/lib/asn1') diff --git a/src/lib/asn1/asn1_oid.cpp b/src/lib/asn1/asn1_oid.cpp index 2aa453c2b..81450becf 100644 --- a/src/lib/asn1/asn1_oid.cpp +++ b/src/lib/asn1/asn1_oid.cpp @@ -47,7 +47,7 @@ void OID::clear() /* * Return this OID as a string */ -std::string OID::as_string() const +std::string OID::to_string() const { std::string oid_str; for(size_t i = 0; i != m_id.size(); ++i) diff --git a/src/lib/asn1/asn1_oid.h b/src/lib/asn1/asn1_oid.h index 8f3f20f2f..6198819ad 100644 --- a/src/lib/asn1/asn1_oid.h +++ b/src/lib/asn1/asn1_oid.h @@ -27,7 +27,13 @@ class BOTAN_PUBLIC_API(2,0) OID final : public ASN1_Object * Find out whether this OID is empty * @return true is no OID value is set */ - bool empty() const { return m_id.size() == 0; } + bool empty() const { return m_id.empty(); } + + /** + * Find out whether this OID has a value + * @return true is this OID has a value + */ + bool has_value() const { return (m_id.empty() == false); } /** * Get this OID as list (vector) of its components. @@ -39,7 +45,13 @@ class BOTAN_PUBLIC_API(2,0) OID final : public ASN1_Object * Get this OID as a string * @return string representing this OID */ - std::string as_string() const; + std::string as_string() const { return this->to_string(); } + + /** + * Get this OID as a string + * @return string representing this OID + */ + std::string to_string() const; /** * Compare two OIDs. @@ -64,6 +76,8 @@ class BOTAN_PUBLIC_API(2,0) OID final : public ASN1_Object * @param str a string in the form "a.b.c" etc., where a,b,c are numbers */ OID(const std::string& str = ""); + + explicit OID(std::initializer_list init) : m_id(init) {} private: std::vector m_id; }; -- cgit v1.2.3