From 811bbca7a8321808470bb09da3bc39ea0b71dc06 Mon Sep 17 00:00:00 2001 From: lloyd Date: Tue, 22 Aug 2006 23:51:10 +0000 Subject: 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. --- src/x509cert.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/x509cert.cpp') 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 lookup_oids(const std::vector& in) + { + std::vector out; + + std::vector::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 X509_Certificate::ex_constraints() const { - return subject.get("X509v3.ExtendedKeyUsage"); + return lookup_oids(subject.get("X509v3.ExtendedKeyUsage")); } /************************************************* @@ -214,7 +234,7 @@ std::vector X509_Certificate::ex_constraints() const *************************************************/ std::vector X509_Certificate::policies() const { - return subject.get("X509v3.CertificatePolicies"); + return lookup_oids(subject.get("X509v3.CertificatePolicies")); } /************************************************* -- cgit v1.2.3