aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils
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
parentd41daa6891e725973ff257b4ad34a0e8a49423f6 (diff)
OID cleanups
Diffstat (limited to 'src/lib/utils')
-rw-r--r--src/lib/utils/exceptn.h3
-rw-r--r--src/lib/utils/parsing.cpp31
2 files changed, 7 insertions, 27 deletions
diff --git a/src/lib/utils/exceptn.h b/src/lib/utils/exceptn.h
index 61e7c7c1f..0259a225b 100644
--- a/src/lib/utils/exceptn.h
+++ b/src/lib/utils/exceptn.h
@@ -360,7 +360,8 @@ class BOTAN_PUBLIC_API(2,0) Not_Implemented final : public Exception
/*
The following exception types are still in use for compatability reasons,
- but are deprecated and will be removed in a future major release
+ but are deprecated and will be removed in a future major release.
+ Instead catch the base class.
*/
/**
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
}
/*