aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/asn1
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-02-02 18:51:54 -0500
committerJack Lloyd <[email protected]>2018-02-04 07:33:00 -0500
commit912f3b6f042855b4983a7ee86250fc670e3738e5 (patch)
tree3e1739b481dca8079d66b60a0d799710c368affc /src/lib/asn1
parent0d63e98483e304a385013a4568312ab94dff3822 (diff)
Create a persistent registry for ECC group data
Now a single copy is maintained of each EC group info
Diffstat (limited to 'src/lib/asn1')
-rw-r--r--src/lib/asn1/asn1_oid.cpp2
-rw-r--r--src/lib/asn1/asn1_oid.h18
2 files changed, 17 insertions, 3 deletions
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<uint32_t> init) : m_id(init) {}
private:
std::vector<uint32_t> m_id;
};