From 4a729ae7ff3f615214d2120a2218a5bef4742c58 Mon Sep 17 00:00:00 2001 From: "davidben@chromium.org" Date: Mon, 2 Aug 2010 21:26:11 +0000 Subject: Display an infobar after enrolling a client certificate This gives the user some feedback that we added a certificate. R=wtc,brettw TEST=none BUG=50782 Review URL: http://codereview.chromium.org/2815023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54602 0039d316-1c4b-4281-b951-d872f2087c98 --- net/base/x509_cert_types.cc | 11 +++++++++++ net/base/x509_cert_types.h | 4 ++++ 2 files changed, 15 insertions(+) (limited to 'net') diff --git a/net/base/x509_cert_types.cc b/net/base/x509_cert_types.cc index 8f7a2ae..9c1369d 100644 --- a/net/base/x509_cert_types.cc +++ b/net/base/x509_cert_types.cc @@ -49,6 +49,17 @@ bool CertPrincipal::Matches(const CertPrincipal& against) const { match(domain_components, against.domain_components); } +std::string CertPrincipal::GetDisplayName() const { + if (!common_name.empty()) + return common_name; + if (!organization_names.empty()) + return organization_names[0]; + if (!organization_unit_names.empty()) + return organization_unit_names[0]; + + return std::string(); +} + std::ostream& operator<<(std::ostream& s, const CertPrincipal& p) { s << "CertPrincipal["; if (!p.common_name.empty()) diff --git a/net/base/x509_cert_types.h b/net/base/x509_cert_types.h index 8693ba9..1a788a7d 100644 --- a/net/base/x509_cert_types.h +++ b/net/base/x509_cert_types.h @@ -69,6 +69,10 @@ struct CertPrincipal { // where "match" is defined in RFC 5280 sec. 7.1. bool Matches(const CertPrincipal& against) const; + // Returns a name that can be used to represent the issuer. It tries in this + // order: CN, O and OU and returns the first non-empty one found. + std::string GetDisplayName() const; + // The different attributes for a principal. They may be "". // Note that some of them can have several values. -- cgit v1.1