Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7262)

Unified Diff: chrome/common/net/x509_certificate_model_openssl.cc

Issue 288053003: x509_certificate_model_openssl: implement GetCertNameOrNickname, GetTitle (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/net/x509_certificate_model_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | chrome/common/net/x509_certificate_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698