OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef NET_SOCKET_SSL_HOST_INFO_H_ | 5 #ifndef NET_SOCKET_SSL_HOST_INFO_H_ |
6 #define NET_SOCKET_SSL_HOST_INFO_H_ | 6 #define NET_SOCKET_SSL_HOST_INFO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "net/base/cert_verifier.h" |
14 #include "net/base/cert_verify_result.h" | 15 #include "net/base/cert_verify_result.h" |
15 #include "net/base/completion_callback.h" | 16 #include "net/base/completion_callback.h" |
16 #include "net/socket/ssl_client_socket.h" | 17 #include "net/socket/ssl_client_socket.h" |
17 | 18 |
18 namespace net { | 19 namespace net { |
19 | 20 |
20 class CertVerifier; | |
21 class X509Certificate; | 21 class X509Certificate; |
22 struct SSLConfig; | 22 struct SSLConfig; |
23 | 23 |
24 // SSLHostInfo is an interface for fetching information about an SSL server. | 24 // SSLHostInfo is an interface for fetching information about an SSL server. |
25 // This information may be stored on disk so does not include keys or session | 25 // This information may be stored on disk so does not include keys or session |
26 // information etc. Primarily it's intended for caching the server's | 26 // information etc. Primarily it's intended for caching the server's |
27 // certificates. | 27 // certificates. |
28 class SSLHostInfo { | 28 class SSLHostInfo { |
29 public: | 29 public: |
30 SSLHostInfo(const std::string& hostname, const SSLConfig& ssl_config); | 30 SSLHostInfo(const std::string& hostname, |
| 31 const SSLConfig& ssl_config, |
| 32 CertVerifier *certVerifier); |
31 virtual ~SSLHostInfo(); | 33 virtual ~SSLHostInfo(); |
32 | 34 |
33 // Start will commence the lookup. This must be called before any other | 35 // Start will commence the lookup. This must be called before any other |
34 // methods. By opportunistically calling this early, it may be possible to | 36 // methods. By opportunistically calling this early, it may be possible to |
35 // overlap this object's lookup and reduce latency. | 37 // overlap this object's lookup and reduce latency. |
36 virtual void Start() = 0; | 38 virtual void Start() = 0; |
37 | 39 |
38 // WaitForDataReady returns OK if the fetch of the requested data has | 40 // WaitForDataReady returns OK if the fetch of the requested data has |
39 // completed. Otherwise it returns ERR_IO_PENDING and will call |callback| on | 41 // completed. Otherwise it returns ERR_IO_PENDING and will call |callback| on |
40 // the current thread when ready. | 42 // the current thread when ready. |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // This is the hostname that we'll validate the certificates against. | 122 // This is the hostname that we'll validate the certificates against. |
121 const std::string hostname_; | 123 const std::string hostname_; |
122 bool cert_parsing_failed_; | 124 bool cert_parsing_failed_; |
123 CompletionCallback* cert_verification_callback_; | 125 CompletionCallback* cert_verification_callback_; |
124 // These two members are taken from the SSLConfig. | 126 // These two members are taken from the SSLConfig. |
125 bool rev_checking_enabled_; | 127 bool rev_checking_enabled_; |
126 bool verify_ev_cert_; | 128 bool verify_ev_cert_; |
127 base::TimeTicks verification_start_time_; | 129 base::TimeTicks verification_start_time_; |
128 base::TimeTicks verification_end_time_; | 130 base::TimeTicks verification_end_time_; |
129 CertVerifyResult cert_verify_result_; | 131 CertVerifyResult cert_verify_result_; |
130 scoped_ptr<CertVerifier> verifier_; | 132 SingleRequestCertVerifier verifier_; |
131 scoped_refptr<X509Certificate> cert_; | 133 scoped_refptr<X509Certificate> cert_; |
132 scoped_refptr<CancelableCompletionCallback<SSLHostInfo> > callback_; | 134 scoped_refptr<CancelableCompletionCallback<SSLHostInfo> > callback_; |
133 }; | 135 }; |
134 | 136 |
135 class SSLHostInfoFactory { | 137 class SSLHostInfoFactory { |
136 public: | 138 public: |
137 virtual ~SSLHostInfoFactory(); | 139 virtual ~SSLHostInfoFactory(); |
138 | 140 |
139 // GetForHost returns a fresh, allocated SSLHostInfo for the given hostname | 141 // GetForHost returns a fresh, allocated SSLHostInfo for the given hostname |
140 // or NULL on failure. | 142 // or NULL on failure. |
141 virtual SSLHostInfo* GetForHost(const std::string& hostname, | 143 virtual SSLHostInfo* GetForHost(const std::string& hostname, |
142 const SSLConfig& ssl_config) = 0; | 144 const SSLConfig& ssl_config) = 0; |
143 }; | 145 }; |
144 | 146 |
145 } // namespace net | 147 } // namespace net |
146 | 148 |
147 #endif // NET_SOCKET_SSL_HOST_INFO_H_ | 149 #endif // NET_SOCKET_SSL_HOST_INFO_H_ |
OLD | NEW |