| 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 "chrome/browser/chromeos/cros/certificate_pattern_matcher.h" | 5 #include "chromeos/network/certificate_pattern_matcher.h" |
| 6 | 6 |
| 7 #include <cert.h> | 7 #include <cert.h> |
| 8 #include <pk11pub.h> | 8 #include <pk11pub.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "chromeos/network/certificate_pattern.h" | 14 #include "chromeos/network/certificate_pattern.h" |
| 15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 return true; | 125 return true; |
| 126 } | 126 } |
| 127 private: | 127 private: |
| 128 const std::vector<std::string>& issuer_ca_ref_list_; | 128 const std::vector<std::string>& issuer_ca_ref_list_; |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 } // namespace | 131 } // namespace |
| 132 | 132 |
| 133 namespace certificate_pattern { |
| 134 |
| 133 scoped_refptr<net::X509Certificate> GetCertificateMatch( | 135 scoped_refptr<net::X509Certificate> GetCertificateMatch( |
| 134 const CertificatePattern& pattern) { | 136 const CertificatePattern& pattern) { |
| 135 typedef std::list<scoped_refptr<net::X509Certificate> > CertificateStlList; | 137 typedef std::list<scoped_refptr<net::X509Certificate> > CertificateStlList; |
| 136 | 138 |
| 137 // Start with all the certs, and narrow it down from there. | 139 // Start with all the certs, and narrow it down from there. |
| 138 net::CertificateList all_certs; | 140 net::CertificateList all_certs; |
| 139 CertificateStlList matching_certs; | 141 CertificateStlList matching_certs; |
| 140 net::NSSCertDatabase::GetInstance()->ListCerts(&all_certs); | 142 net::NSSCertDatabase::GetInstance()->ListCerts(&all_certs); |
| 141 | 143 |
| 142 if (all_certs.empty()) | 144 if (all_certs.empty()) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 // Iterate over the rest looking for the one that was issued latest. | 185 // Iterate over the rest looking for the one that was issued latest. |
| 184 for (CertificateStlList::iterator iter = matching_certs.begin(); | 186 for (CertificateStlList::iterator iter = matching_certs.begin(); |
| 185 iter != matching_certs.end(); ++iter) { | 187 iter != matching_certs.end(); ++iter) { |
| 186 if (!latest.get() || (*iter)->valid_start() > latest->valid_start()) | 188 if (!latest.get() || (*iter)->valid_start() > latest->valid_start()) |
| 187 latest = *iter; | 189 latest = *iter; |
| 188 } | 190 } |
| 189 | 191 |
| 190 return latest; | 192 return latest; |
| 191 } | 193 } |
| 192 | 194 |
| 195 } // namespace certificate_pattern |
| 196 |
| 193 } // namespace chromeos | 197 } // namespace chromeos |
| OLD | NEW |