| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/cert/nss_cert_database.h" | 5 #include "net/cert/nss_cert_database.h" |
| 6 | 6 |
| 7 #include <cert.h> | 7 #include <cert.h> |
| 8 #include <certdb.h> | 8 #include <certdb.h> |
| 9 #include <keyhi.h> | 9 #include <keyhi.h> |
| 10 #include <pk11pub.h> | 10 #include <pk11pub.h> |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 return psm::nsPKCS12Blob_Export(output, certs, password); | 138 return psm::nsPKCS12Blob_Export(output, certs, password); |
| 139 } | 139 } |
| 140 | 140 |
| 141 X509Certificate* NSSCertDatabase::FindRootInList( | 141 X509Certificate* NSSCertDatabase::FindRootInList( |
| 142 const CertificateList& certificates) const { | 142 const CertificateList& certificates) const { |
| 143 DCHECK_GT(certificates.size(), 0U); | 143 DCHECK_GT(certificates.size(), 0U); |
| 144 | 144 |
| 145 if (certificates.size() == 1) | 145 if (certificates.size() == 1) |
| 146 return certificates[0].get(); | 146 return certificates[0].get(); |
| 147 | 147 |
| 148 X509Certificate* cert0 = certificates[0]; | 148 X509Certificate* cert0 = certificates[0].get(); |
| 149 X509Certificate* cert1 = certificates[1]; | 149 X509Certificate* cert1 = certificates[1].get(); |
| 150 X509Certificate* certn_2 = certificates[certificates.size() - 2]; | 150 X509Certificate* certn_2 = certificates[certificates.size() - 2].get(); |
| 151 X509Certificate* certn_1 = certificates[certificates.size() - 1]; | 151 X509Certificate* certn_1 = certificates[certificates.size() - 1].get(); |
| 152 | 152 |
| 153 if (CERT_CompareName(&cert1->os_cert_handle()->issuer, | 153 if (CERT_CompareName(&cert1->os_cert_handle()->issuer, |
| 154 &cert0->os_cert_handle()->subject) == SECEqual) | 154 &cert0->os_cert_handle()->subject) == SECEqual) |
| 155 return cert0; | 155 return cert0; |
| 156 if (CERT_CompareName(&certn_2->os_cert_handle()->issuer, | 156 if (CERT_CompareName(&certn_2->os_cert_handle()->issuer, |
| 157 &certn_1->os_cert_handle()->subject) == SECEqual) | 157 &certn_1->os_cert_handle()->subject) == SECEqual) |
| 158 return certn_1; | 158 return certn_1; |
| 159 | 159 |
| 160 VLOG(1) << "certificate list is not a hierarchy"; | 160 VLOG(1) << "certificate list is not a hierarchy"; |
| 161 return cert0; | 161 return cert0; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 observer_list_->Notify(&Observer::OnCertRemoved, make_scoped_refptr(cert)); | 336 observer_list_->Notify(&Observer::OnCertRemoved, make_scoped_refptr(cert)); |
| 337 } | 337 } |
| 338 | 338 |
| 339 void NSSCertDatabase::NotifyObserversOfCertTrustChanged( | 339 void NSSCertDatabase::NotifyObserversOfCertTrustChanged( |
| 340 const X509Certificate* cert) { | 340 const X509Certificate* cert) { |
| 341 observer_list_->Notify( | 341 observer_list_->Notify( |
| 342 &Observer::OnCertTrustChanged, make_scoped_refptr(cert)); | 342 &Observer::OnCertTrustChanged, make_scoped_refptr(cert)); |
| 343 } | 343 } |
| 344 | 344 |
| 345 } // namespace net | 345 } // namespace net |
| OLD | NEW |