aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-08-22 23:51:10 +0000
committerlloyd <[email protected]>2006-08-22 23:51:10 +0000
commit811bbca7a8321808470bb09da3bc39ea0b71dc06 (patch)
treeac0fde6d99005bfbf294294229ecd7f5872c7e58 /src
parent04ecd7cb4fb7751bb6d466fc8140280fe655040d (diff)
X509_Certificate::ex_constraints and ::policies now return (if possible)
string representations of the OIDs; anything for which a human-readable version does not exist in the OID table is returned in the normal dotted decimal representation.
Diffstat (limited to 'src')
-rw-r--r--src/x509cert.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/x509cert.cpp b/src/x509cert.cpp
index 3a6f22129..dd919e509 100644
--- a/src/x509cert.cpp
+++ b/src/x509cert.cpp
@@ -16,6 +16,26 @@
namespace Botan {
+namespace {
+
+/*************************************************
+* Lookup each OID in the vector *
+*************************************************/
+std::vector<std::string> lookup_oids(const std::vector<std::string>& in)
+ {
+ std::vector<std::string> out;
+
+ std::vector<std::string>::const_iterator i = in.begin();
+ while(i != in.end())
+ {
+ out.push_back(OIDS::lookup(OID(*i)));
+ ++i;
+ }
+ return out;
+ }
+
+}
+
/*************************************************
* X509_Certificate Constructor *
*************************************************/
@@ -206,7 +226,7 @@ Key_Constraints X509_Certificate::constraints() const
*************************************************/
std::vector<std::string> X509_Certificate::ex_constraints() const
{
- return subject.get("X509v3.ExtendedKeyUsage");
+ return lookup_oids(subject.get("X509v3.ExtendedKeyUsage"));
}
/*************************************************
@@ -214,7 +234,7 @@ std::vector<std::string> X509_Certificate::ex_constraints() const
*************************************************/
std::vector<std::string> X509_Certificate::policies() const
{
- return subject.get("X509v3.CertificatePolicies");
+ return lookup_oids(subject.get("X509v3.CertificatePolicies"));
}
/*************************************************