OLD | NEW |
1 // Copyright (c) 2006-2009 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_BASE_SSL_CONFIG_SERVICE_H_ | 5 #ifndef NET_BASE_SSL_CONFIG_SERVICE_H_ |
6 #define NET_BASE_SSL_CONFIG_SERVICE_H_ | 6 #define NET_BASE_SSL_CONFIG_SERVICE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
14 #include "net/base/x509_certificate.h" | 14 #include "net/base/x509_certificate.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 | 17 |
18 // A collection of SSL-related configuration settings. | 18 // A collection of SSL-related configuration settings. |
19 struct SSLConfig { | 19 struct SSLConfig { |
20 // Default to revocation checking. | 20 // Default to revocation checking. |
21 // Default to SSL 2.0 off, SSL 3.0 on, and TLS 1.0 on. | 21 // Default to SSL 3.0 on and TLS 1.0 on. |
22 SSLConfig(); | 22 SSLConfig(); |
23 ~SSLConfig(); | 23 ~SSLConfig(); |
24 | 24 |
25 bool rev_checking_enabled; // True if server certificate revocation | 25 bool rev_checking_enabled; // True if server certificate revocation |
26 // checking is enabled. | 26 // checking is enabled. |
27 bool ssl2_enabled; // True if SSL 2.0 is enabled. | 27 // SSL 2.0 is not supported. |
28 bool ssl3_enabled; // True if SSL 3.0 is enabled. | 28 bool ssl3_enabled; // True if SSL 3.0 is enabled. |
29 bool tls1_enabled; // True if TLS 1.0 is enabled. | 29 bool tls1_enabled; // True if TLS 1.0 is enabled. |
30 bool dnssec_enabled; // True if we'll accept DNSSEC chains in certificates. | 30 bool dnssec_enabled; // True if we'll accept DNSSEC chains in certificates. |
31 bool snap_start_enabled; // True if we'll try Snap Start handshakes. | 31 bool snap_start_enabled; // True if we'll try Snap Start handshakes. |
32 // True if we'll do async checks for certificate provenance using DNS. | 32 // True if we'll do async checks for certificate provenance using DNS. |
33 bool dns_cert_provenance_checking_enabled; | 33 bool dns_cert_provenance_checking_enabled; |
34 | 34 |
35 // Cipher suites which should be explicitly prevented from being used. By | 35 // Cipher suites which should be explicitly prevented from being used. By |
36 // default, all cipher suites supported by the underlying SSL implementation | 36 // default, all cipher suites supported by the underlying SSL implementation |
37 // will be enabled, except for: | 37 // will be enabled, except for: |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // live longer than the configuration preferences. | 105 // live longer than the configuration preferences. |
106 class SSLConfigService : public base::RefCountedThreadSafe<SSLConfigService> { | 106 class SSLConfigService : public base::RefCountedThreadSafe<SSLConfigService> { |
107 public: | 107 public: |
108 // Observer is notified when SSL config settings have changed. | 108 // Observer is notified when SSL config settings have changed. |
109 class Observer { | 109 class Observer { |
110 public: | 110 public: |
111 // Notify observers if SSL settings have changed. We don't check all of the | 111 // Notify observers if SSL settings have changed. We don't check all of the |
112 // data in SSLConfig, just those that qualify as a user config change. | 112 // data in SSLConfig, just those that qualify as a user config change. |
113 // The following settings are considered user changes: | 113 // The following settings are considered user changes: |
114 // rev_checking_enabled | 114 // rev_checking_enabled |
115 // ssl2_enabled | |
116 // ssl3_enabled | 115 // ssl3_enabled |
117 // tls1_enabled | 116 // tls1_enabled |
118 virtual void OnSSLConfigChanged() = 0; | 117 virtual void OnSSLConfigChanged() = 0; |
119 | 118 |
120 protected: | 119 protected: |
121 virtual ~Observer() {} | 120 virtual ~Observer() {} |
122 }; | 121 }; |
123 | 122 |
124 SSLConfigService(); | 123 SSLConfigService(); |
125 | 124 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 173 |
175 // Remove an observer of this service. | 174 // Remove an observer of this service. |
176 void RemoveObserver(Observer* observer); | 175 void RemoveObserver(Observer* observer); |
177 | 176 |
178 protected: | 177 protected: |
179 friend class base::RefCountedThreadSafe<SSLConfigService>; | 178 friend class base::RefCountedThreadSafe<SSLConfigService>; |
180 | 179 |
181 virtual ~SSLConfigService(); | 180 virtual ~SSLConfigService(); |
182 | 181 |
183 // SetFlags sets the values of several flags based on global configuration. | 182 // SetFlags sets the values of several flags based on global configuration. |
184 static void SetSSLConfigFlags(SSLConfig*); | 183 static void SetSSLConfigFlags(SSLConfig* ssl_config); |
185 | 184 |
186 // Process before/after config update. | 185 // Process before/after config update. |
187 void ProcessConfigUpdate(const SSLConfig& orig_config, | 186 void ProcessConfigUpdate(const SSLConfig& orig_config, |
188 const SSLConfig& new_config); | 187 const SSLConfig& new_config); |
189 | 188 |
190 private: | 189 private: |
191 ObserverList<Observer> observer_list_; | 190 ObserverList<Observer> observer_list_; |
192 }; | 191 }; |
193 | 192 |
194 } // namespace net | 193 } // namespace net |
195 | 194 |
196 #endif // NET_BASE_SSL_CONFIG_SERVICE_H_ | 195 #endif // NET_BASE_SSL_CONFIG_SERVICE_H_ |
OLD | NEW |