diff options
author | lloyd <[email protected]> | 2012-02-06 14:12:35 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-02-06 14:12:35 +0000 |
commit | cd58927000ef86eacc9de5b80f361d4d05e71731 (patch) | |
tree | 975d2e50e77567d14ea3d24e6ebaf24a9e4d7c3b /src/asn1/x509_dn.cpp | |
parent | 03bc906a6a94d236f192fa3b1bb370c013fc753a (diff) |
Fully working path validation. Even fixes the cases in PKITS where we
got the answer wrong before. Still no policy or name constraints
support, though.
Diffstat (limited to 'src/asn1/x509_dn.cpp')
-rw-r--r-- | src/asn1/x509_dn.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/asn1/x509_dn.cpp b/src/asn1/x509_dn.cpp index f91303296..37eecc6a3 100644 --- a/src/asn1/x509_dn.cpp +++ b/src/asn1/x509_dn.cpp @@ -11,6 +11,7 @@ #include <botan/parsing.h> #include <botan/internal/stl_util.h> #include <botan/oids.h> +#include <iostream> namespace Botan { @@ -293,4 +294,34 @@ void X509_DN::decode_from(BER_Decoder& source) dn_bits = bits; } +namespace { + +std::string to_short_form(const std::string& long_id) + { + if(long_id == "X520.CommonName") + return "CN"; + + if(long_id == "X520.Organization") + return "O"; + + if(long_id == "X520.OrganizationalUnit") + return "OU"; + + return long_id; + } + +} + +std::ostream& operator<<(std::ostream& out, const X509_DN& dn) + { + std::multimap<std::string, std::string> contents = dn.contents(); + + for(std::multimap<std::string, std::string>::const_iterator i = contents.begin(); + i != contents.end(); ++i) + { + out << to_short_form(i->first) << "=" << i->second << ' '; + } + return out; + } + } |