diff options
author | lloyd <[email protected]> | 2006-08-22 23:51:10 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-08-22 23:51:10 +0000 |
commit | 811bbca7a8321808470bb09da3bc39ea0b71dc06 (patch) | |
tree | ac0fde6d99005bfbf294294229ecd7f5872c7e58 | |
parent | 04ecd7cb4fb7751bb6d466fc8140280fe655040d (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.
-rw-r--r-- | src/x509cert.cpp | 24 |
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")); } /************************************************* |