summaryrefslogtreecommitdiffstats
path: root/net/socket/ssl_client_socket_nss.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/socket/ssl_client_socket_nss.cc')
-rw-r--r--net/socket/ssl_client_socket_nss.cc49
1 files changed, 2 insertions, 47 deletions
diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc
index bc13d2a..155d3e5 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -2,11 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// This file includes code GetDefaultCertNickname(), derived from
-// nsNSSCertificate::defaultServerNickName()
-// in mozilla/security/manager/ssl/src/nsNSSCertificate.cpp
-// and SSLClientSocketNSS::DoVerifyCertComplete() derived from
-// AuthCertificateCallback() in
+// This file includes code SSLClientSocketNSS::DoVerifyCertComplete() derived
+// from AuthCertificateCallback() in
// mozilla/security/manager/ssl/src/nsNSSCallbacks.cpp.
/* ***** BEGIN LICENSE BLOCK *****
@@ -103,48 +100,6 @@ namespace net {
namespace {
-// Gets default certificate nickname from cert.
-// Derived from nsNSSCertificate::defaultServerNickname
-// in mozilla/security/manager/ssl/src/nsNSSCertificate.cpp.
-std::string GetDefaultCertNickname(
- net::X509Certificate::OSCertHandle cert) {
- if (cert == NULL)
- return "";
-
- char* name = CERT_GetCommonName(&cert->subject);
- if (!name) {
- // Certs without common names are strange, but they do exist...
- // Let's try to use another string for the nickname
- name = CERT_GetOrgUnitName(&cert->subject);
- if (!name)
- name = CERT_GetOrgName(&cert->subject);
- if (!name)
- name = CERT_GetLocalityName(&cert->subject);
- if (!name)
- name = CERT_GetStateName(&cert->subject);
- if (!name)
- name = CERT_GetCountryName(&cert->subject);
- if (!name)
- return "";
- }
- int count = 1;
- std::string nickname;
- while (1) {
- if (count == 1) {
- nickname = name;
- } else {
- nickname = StringPrintf("%s #%d", name, count);
- }
- PRBool conflict = SEC_CertNicknameConflict(
- const_cast<char*>(nickname.c_str()), &cert->derSubject, cert->dbhandle);
- if (!conflict)
- break;
- count++;
- }
- PR_FREEIF(name);
- return nickname;
-}
-
int NetErrorFromNSPRError(PRErrorCode err) {
// TODO(port): fill this out as we learn what's important
switch (err) {