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

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

Issue 271753004: x509_certificate_model: remove unused code, move nss-only stuff out of public interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: get the missing places 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
Index: chrome/common/net/x509_certificate_model_nss.cc
diff --git a/chrome/common/net/x509_certificate_model_nss.cc b/chrome/common/net/x509_certificate_model_nss.cc
index 3fccdc092e0d82aba8dfc1eeea0d7be1f0a23ce8..7bd6918b45fe58adfaae00500b4cd8a7447f58da 100644
--- a/chrome/common/net/x509_certificate_model_nss.cc
+++ b/chrome/common/net/x509_certificate_model_nss.cc
@@ -66,9 +66,20 @@ std::string ProcessExtension(
std::string criticality =
extension->critical.data && extension->critical.data[0] ?
critical_label : non_critical_label;
- return criticality + "\n" +
- psm::ProcessExtensionData(SECOID_FindOIDTag(&extension->id),
- &extension->value);
+ return criticality + "\n" + psm::ProcessExtensionData(extension);
+}
+
+std::string GetNickname(net::X509Certificate::OSCertHandle cert_handle) {
+ std::string name;
+ if (cert_handle->nickname) {
+ name = cert_handle->nickname;
+ // Hack copied from mozilla: Cut off text before first :, which seems to
+ // just be the token name.
+ size_t colon_pos = name.find(':');
+ if (colon_pos != std::string::npos)
+ name = name.substr(colon_pos + 1);
+ }
+ return name;
}
////////////////////////////////////////////////////////////////////////////////
@@ -104,19 +115,6 @@ string GetCertNameOrNickname(X509Certificate::OSCertHandle cert_handle) {
return GetNickname(cert_handle);
}
-string GetNickname(X509Certificate::OSCertHandle cert_handle) {
- string name;
- if (cert_handle->nickname) {
- name = cert_handle->nickname;
- // Hack copied from mozilla: Cut off text before first :, which seems to
- // just be the token name.
- size_t colon_pos = name.find(':');
- if (colon_pos != string::npos)
- name = name.substr(colon_pos + 1);
- }
- return name;
-}
-
string GetTokenName(X509Certificate::OSCertHandle cert_handle) {
return psm::GetCertTokenName(cert_handle);
}
@@ -136,28 +134,11 @@ net::CertType GetType(X509Certificate::OSCertHandle cert_handle) {
return psm::GetCertType(cert_handle);
}
-string GetEmailAddress(X509Certificate::OSCertHandle cert_handle) {
- if (cert_handle->emailAddr)
- return cert_handle->emailAddr;
- return std::string();
-}
-
void GetUsageStrings(X509Certificate::OSCertHandle cert_handle,
std::vector<string>* usages) {
psm::GetCertUsageStrings(cert_handle, usages);
}
-string GetKeyUsageString(X509Certificate::OSCertHandle cert_handle) {
- SECItem key_usage;
- key_usage.data = NULL;
- string key_usage_str;
- if (CERT_FindKeyUsageExtension(cert_handle, &key_usage) == SECSuccess) {
- key_usage_str = psm::ProcessKeyUsageBitString(&key_usage, ',');
- PORT_Free(key_usage.data);
- }
- return key_usage_str;
-}
-
string GetSerialNumberHexified(X509Certificate::OSCertHandle cert_handle,
const string& alternative_text) {
return Stringize(CERT_Hexify(&cert_handle->serialNumber, true),
@@ -218,46 +199,6 @@ string GetSubjectName(X509Certificate::OSCertHandle cert_handle) {
return psm::ProcessName(&cert_handle->subject);
}
-void GetEmailAddresses(X509Certificate::OSCertHandle cert_handle,
- std::vector<string>* email_addresses) {
- for (const char* addr = CERT_GetFirstEmailAddress(cert_handle);
- addr; addr = CERT_GetNextEmailAddress(cert_handle, addr)) {
- // The first email addr (from Subject) may be duplicated in Subject
- // Alternative Name, so check subsequent addresses are not equal to the
- // first one before adding to the list.
- if (!email_addresses->size() || (*email_addresses)[0] != addr)
- email_addresses->push_back(addr);
- }
-}
-
-void GetNicknameStringsFromCertList(
- const std::vector<scoped_refptr<X509Certificate> >& certs,
- const string& cert_expired,
- const string& cert_not_yet_valid,
- std::vector<string>* nick_names) {
- CERTCertList* cert_list = CERT_NewCertList();
- for (size_t i = 0; i < certs.size(); ++i) {
- CERT_AddCertToListTail(
- cert_list,
- CERT_DupCertificate(certs[i]->os_cert_handle()));
- }
- // Would like to use CERT_GetCertNicknameWithValidity on each cert
- // individually instead of having to build a CERTCertList for this, but that
- // function is not exported.
- CERTCertNicknames* cert_nicknames = CERT_NicknameStringsFromCertList(
- cert_list,
- const_cast<char*>(cert_expired.c_str()),
- const_cast<char*>(cert_not_yet_valid.c_str()));
- DCHECK_EQ(cert_nicknames->numnicknames,
- static_cast<int>(certs.size()));
-
- for (int i = 0; i < cert_nicknames->numnicknames; ++i)
- nick_names->push_back(cert_nicknames->nicknames[i]);
-
- CERT_FreeNicknames(cert_nicknames);
- CERT_DestroyCertList(cert_list);
-}
-
void GetExtensions(
const string& critical_label,
const string& non_critical_label,
@@ -383,8 +324,4 @@ string ProcessRawBitsSignatureWrap(X509Certificate::OSCertHandle cert_handle) {
cert_handle->signatureWrap.signature.len);
}
-void RegisterDynamicOids() {
- psm::RegisterDynamicOids();
-}
-
} // namespace x509_certificate_model

Powered by Google App Engine
This is Rietveld 408576698