Chromium Code Reviews| Index: chrome/common/net/x509_certificate_model_openssl.cc |
| diff --git a/chrome/common/net/x509_certificate_model_openssl.cc b/chrome/common/net/x509_certificate_model_openssl.cc |
| index b8f28b34acc0aabc96d2ed68650d1f2f73966894..fcd62c4d3778c3dcbe51da57cdc14d24198140b7 100644 |
| --- a/chrome/common/net/x509_certificate_model_openssl.cc |
| +++ b/chrome/common/net/x509_certificate_model_openssl.cc |
| @@ -44,8 +44,16 @@ namespace x509_certificate_model { |
| using net::X509Certificate; |
| std::string GetCertNameOrNickname(X509Certificate::OSCertHandle cert_handle) { |
| - // TODO(bulach): implement me. |
| - return ""; |
| + std::string name = |
| + ProcessIDN(GetSubjectCommonName(cert_handle, std::string())); |
| + if (!name.empty()) |
| + return name; |
| + |
| + char buf[256]; |
| + if (X509_NAME_oneline(X509_get_subject_name(cert_handle), buf, sizeof(buf))) |
|
Ryan Sleevi
2014/05/15 05:53:05
1) X509_NAME_online is deprecated and has been for
mattm
2014/05/20 06:29:32
Done.
|
| + return buf; |
| + |
| + return std::string(); |
| } |
| std::string GetTokenName(X509Certificate::OSCertHandle cert_handle) { |
| @@ -140,8 +148,19 @@ bool GetTimes(X509Certificate::OSCertHandle cert_handle, |
| } |
| std::string GetTitle(net::X509Certificate::OSCertHandle cert_handle) { |
| - // TODO(bulach): implement me. |
| - return ""; |
| + // TODO(mattm): merge GetTitle and GetCertNameOrNickname? |
| + // Is there any reason GetCertNameOrNickname calls ProcessIDN and this |
| + // doesn't? |
| + std::string title = |
| + GetSubjectCommonName(cert_handle, std::string()); |
| + if (!title.empty()) |
| + return title; |
| + |
| + char buf[256]; |
| + if (X509_NAME_oneline(X509_get_subject_name(cert_handle), buf, sizeof(buf))) |
| + return buf; |
| + |
| + return std::string(); |
| } |
| std::string GetIssuerName(net::X509Certificate::OSCertHandle cert_handle) { |