| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_HTTP_CERT_STATUS_CACHE_H | |
| 6 #define NET_HTTP_CERT_STATUS_CACHE_H | |
| 7 | |
| 8 #include <vector> | |
| 9 #include <map> | |
| 10 | |
| 11 #include "net/base/x509_certificate.h" | |
| 12 | |
| 13 // This class is used to remember the status of certificates, as WinHTTP | |
| 14 // does not report errors once it has been told to ignore them. | |
| 15 // It only exists because of the WinHTTP bug. | |
| 16 // IMPORTANT: this class is not thread-safe. | |
| 17 | |
| 18 namespace net { | |
| 19 | |
| 20 class CertStatusCache { | |
| 21 public: | |
| 22 CertStatusCache(); | |
| 23 ~CertStatusCache(); | |
| 24 | |
| 25 int GetCertStatus(const X509Certificate& cert, | |
| 26 const std::string& host_name) const; | |
| 27 void SetCertStatus(const X509Certificate& cert, | |
| 28 const std::string& host_name, | |
| 29 int status); | |
| 30 | |
| 31 private: | |
| 32 typedef std::map<X509Certificate::Fingerprint, int, | |
| 33 X509Certificate::FingerprintLessThan> StatusMap; | |
| 34 typedef std::set<std::string> StringSet; | |
| 35 typedef std::map<X509Certificate::Fingerprint, StringSet*, | |
| 36 X509Certificate::FingerprintLessThan> HostMap; | |
| 37 | |
| 38 StatusMap fingerprint_to_cert_status_; | |
| 39 | |
| 40 // We keep a map for each cert to the list of host names that have been marked | |
| 41 // with the CN invalid error, as that error is host name specific. | |
| 42 HostMap fingerprint_to_bad_hosts_; | |
| 43 | |
| 44 DISALLOW_EVIL_CONSTRUCTORS(CertStatusCache); | |
| 45 }; | |
| 46 | |
| 47 } // namespace net | |
| 48 | |
| 49 #endif // NET_HTTP_CERT_STATUS_CACHE_H | |
| 50 | |
| OLD | NEW |