| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "base/string_piece.h" | 14 #include "base/string_piece.h" |
| 15 #include "net/base/net_api.h" | 15 #include "net/base/net_export.h" |
| 16 #include "net/base/x509_certificate.h" | 16 #include "net/base/x509_certificate.h" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 | 19 |
| 20 // A collection of SSL-related configuration settings. | 20 // A collection of SSL-related configuration settings. |
| 21 struct NET_API SSLConfig { | 21 struct NET_EXPORT SSLConfig { |
| 22 // Default to revocation checking. | 22 // Default to revocation checking. |
| 23 // Default to SSL 3.0 on and TLS 1.0 on. | 23 // Default to SSL 3.0 on and TLS 1.0 on. |
| 24 SSLConfig(); | 24 SSLConfig(); |
| 25 ~SSLConfig(); | 25 ~SSLConfig(); |
| 26 | 26 |
| 27 // Returns true if |cert| is one of the certs in |allowed_bad_certs|. | 27 // Returns true if |cert| is one of the certs in |allowed_bad_certs|. |
| 28 // The expected cert status is written to |cert_status|. |*cert_status| can | 28 // The expected cert status is written to |cert_status|. |*cert_status| can |
| 29 // be NULL if user doesn't care about the cert status. | 29 // be NULL if user doesn't care about the cert status. |
| 30 bool IsAllowedBadCert(X509Certificate* cert, int* cert_status) const; | 30 bool IsAllowedBadCert(X509Certificate* cert, int* cert_status) const; |
| 31 | 31 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 std::vector<uint16> disabled_cipher_suites; | 65 std::vector<uint16> disabled_cipher_suites; |
| 66 | 66 |
| 67 bool cached_info_enabled; // True if TLS cached info extension is enabled. | 67 bool cached_info_enabled; // True if TLS cached info extension is enabled. |
| 68 bool origin_bound_certs_enabled; // True if TLS origin bound cert extension | 68 bool origin_bound_certs_enabled; // True if TLS origin bound cert extension |
| 69 // is enabled. | 69 // is enabled. |
| 70 bool false_start_enabled; // True if we'll use TLS False Start. | 70 bool false_start_enabled; // True if we'll use TLS False Start. |
| 71 | 71 |
| 72 // TODO(wtc): move the following members to a new SSLParams structure. They | 72 // TODO(wtc): move the following members to a new SSLParams structure. They |
| 73 // are not SSL configuration settings. | 73 // are not SSL configuration settings. |
| 74 | 74 |
| 75 struct NET_API CertAndStatus { | 75 struct NET_EXPORT CertAndStatus { |
| 76 CertAndStatus(); | 76 CertAndStatus(); |
| 77 ~CertAndStatus(); | 77 ~CertAndStatus(); |
| 78 | 78 |
| 79 std::string der_cert; | 79 std::string der_cert; |
| 80 int cert_status; | 80 int cert_status; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 // Add any known-bad SSL certificate (with its cert status) to | 83 // Add any known-bad SSL certificate (with its cert status) to |
| 84 // |allowed_bad_certs| that should not trigger an ERR_CERT_* error when | 84 // |allowed_bad_certs| that should not trigger an ERR_CERT_* error when |
| 85 // calling SSLClientSocket::Connect. This would normally be done in | 85 // calling SSLClientSocket::Connect. This would normally be done in |
| (...skipping 16 matching lines...) Expand all Loading... |
| 102 // first protocol in this list will be requested by the client. | 102 // first protocol in this list will be requested by the client. |
| 103 std::string next_protos; | 103 std::string next_protos; |
| 104 | 104 |
| 105 scoped_refptr<X509Certificate> client_cert; | 105 scoped_refptr<X509Certificate> client_cert; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 // The interface for retrieving the SSL configuration. This interface | 108 // The interface for retrieving the SSL configuration. This interface |
| 109 // does not cover setting the SSL configuration, as on some systems, the | 109 // does not cover setting the SSL configuration, as on some systems, the |
| 110 // SSLConfigService objects may not have direct access to the configuration, or | 110 // SSLConfigService objects may not have direct access to the configuration, or |
| 111 // live longer than the configuration preferences. | 111 // live longer than the configuration preferences. |
| 112 class NET_API SSLConfigService | 112 class NET_EXPORT SSLConfigService |
| 113 : public base::RefCountedThreadSafe<SSLConfigService> { | 113 : public base::RefCountedThreadSafe<SSLConfigService> { |
| 114 public: | 114 public: |
| 115 // Observer is notified when SSL config settings have changed. | 115 // Observer is notified when SSL config settings have changed. |
| 116 class NET_API Observer { | 116 class NET_EXPORT Observer { |
| 117 public: | 117 public: |
| 118 // Notify observers if SSL settings have changed. We don't check all of the | 118 // Notify observers if SSL settings have changed. We don't check all of the |
| 119 // data in SSLConfig, just those that qualify as a user config change. | 119 // data in SSLConfig, just those that qualify as a user config change. |
| 120 // The following settings are considered user changes: | 120 // The following settings are considered user changes: |
| 121 // rev_checking_enabled | 121 // rev_checking_enabled |
| 122 // ssl3_enabled | 122 // ssl3_enabled |
| 123 // tls1_enabled | 123 // tls1_enabled |
| 124 // disabled_cipher_suites | 124 // disabled_cipher_suites |
| 125 virtual void OnSSLConfigChanged() = 0; | 125 virtual void OnSSLConfigChanged() = 0; |
| 126 | 126 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 void ProcessConfigUpdate(const SSLConfig& orig_config, | 183 void ProcessConfigUpdate(const SSLConfig& orig_config, |
| 184 const SSLConfig& new_config); | 184 const SSLConfig& new_config); |
| 185 | 185 |
| 186 private: | 186 private: |
| 187 ObserverList<Observer> observer_list_; | 187 ObserverList<Observer> observer_list_; |
| 188 }; | 188 }; |
| 189 | 189 |
| 190 } // namespace net | 190 } // namespace net |
| 191 | 191 |
| 192 #endif // NET_BASE_SSL_CONFIG_SERVICE_H_ | 192 #endif // NET_BASE_SSL_CONFIG_SERVICE_H_ |
| OLD | NEW |