aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils/parsing.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2019-08-04 07:42:36 -0400
committerJack Lloyd <[email protected]>2019-08-04 16:26:50 -0400
commit247df8cae3fbec8d9b608c5dc8b42a4f6bdeef8b (patch)
tree22485db46724eee6f274b85073f4def6ff18e5c3 /src/lib/utils/parsing.cpp
parentd41daa6891e725973ff257b4ad34a0e8a49423f6 (diff)
OID cleanups
Diffstat (limited to 'src/lib/utils/parsing.cpp')
-rw-r--r--src/lib/utils/parsing.cpp31
1 files changed, 5 insertions, 26 deletions
diff --git a/src/lib/utils/parsing.cpp b/src/lib/utils/parsing.cpp
index 8e62c6e03..fa36b5283 100644
--- a/src/lib/utils/parsing.cpp
+++ b/src/lib/utils/parsing.cpp
@@ -194,32 +194,11 @@ std::string string_join(const std::vector<std::string>& strs, char delim)
*/
std::vector<uint32_t> parse_asn1_oid(const std::string& oid)
{
- std::string substring;
- std::vector<uint32_t> oid_elems;
-
- for(auto i = oid.begin(); i != oid.end(); ++i)
- {
- char c = *i;
-
- if(c == '.')
- {
- if(substring.empty())
- throw Invalid_OID(oid);
- oid_elems.push_back(to_u32bit(substring));
- substring.clear();
- }
- else
- substring += c;
- }
-
- if(substring.empty())
- throw Invalid_OID(oid);
- oid_elems.push_back(to_u32bit(substring));
-
- if(oid_elems.size() < 2)
- throw Invalid_OID(oid);
-
- return oid_elems;
+#if defined(BOTAN_HAS_ASN1)
+ return OID(oid).get_components();
+#else
+ throw Not_Supported("ASN1 support not available");
+#endif
}
/*