| 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 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
| 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // A client socket that uses SSL as the transport layer. | 69 // A client socket that uses SSL as the transport layer. |
| 70 // | 70 // |
| 71 // NOTE: The SSL handshake occurs within the Connect method after a TCP | 71 // NOTE: The SSL handshake occurs within the Connect method after a TCP |
| 72 // connection is established. If a SSL error occurs during the handshake, | 72 // connection is established. If a SSL error occurs during the handshake, |
| 73 // Connect will fail. | 73 // Connect will fail. |
| 74 // | 74 // |
| 75 class NET_EXPORT SSLClientSocket : public SSLSocket { | 75 class NET_EXPORT SSLClientSocket : public SSLSocket { |
| 76 public: | 76 public: |
| 77 SSLClientSocket(); | 77 SSLClientSocket(); |
| 78 | 78 |
| 79 // Next Protocol Negotiation (NPN) allows a TLS client and server to come to | |
| 80 // an agreement about the application level protocol to speak over a | |
| 81 // connection. | |
| 82 enum NextProtoStatus { | |
| 83 // WARNING: These values are serialized to disk. Don't change them. | |
| 84 | |
| 85 kNextProtoUnsupported = 0, // The server doesn't support NPN. | |
| 86 kNextProtoNegotiated = 1, // We agreed on a protocol. | |
| 87 kNextProtoNoOverlap = 2, // No protocols in common. We requested | |
| 88 // the first protocol in our list. | |
| 89 }; | |
| 90 | |
| 91 // TLS extension used to negotiate protocol. | |
| 92 enum SSLNegotiationExtension { | |
| 93 kExtensionUnknown, | |
| 94 kExtensionALPN, | |
| 95 kExtensionNPN, | |
| 96 }; | |
| 97 | |
| 98 // Gets the SSL CertificateRequest info of the socket after Connect failed | 79 // Gets the SSL CertificateRequest info of the socket after Connect failed |
| 99 // with ERR_SSL_CLIENT_AUTH_CERT_NEEDED. | 80 // with ERR_SSL_CLIENT_AUTH_CERT_NEEDED. |
| 100 virtual void GetSSLCertRequestInfo( | 81 virtual void GetSSLCertRequestInfo( |
| 101 SSLCertRequestInfo* cert_request_info) = 0; | 82 SSLCertRequestInfo* cert_request_info) = 0; |
| 102 | 83 |
| 103 static NextProto NextProtoFromString(base::StringPiece proto_string); | 84 static NextProto NextProtoFromString(base::StringPiece proto_string); |
| 104 | 85 |
| 105 static const char* NextProtoToString(NextProto next_proto); | 86 static const char* NextProtoToString(NextProto next_proto); |
| 106 | 87 |
| 107 static const char* NextProtoStatusToString(const NextProtoStatus status); | |
| 108 | |
| 109 // Log SSL key material to |path| on |task_runner|. Must be called before any | 88 // Log SSL key material to |path| on |task_runner|. Must be called before any |
| 110 // SSLClientSockets are created. | 89 // SSLClientSockets are created. |
| 111 // | 90 // |
| 112 // TODO(davidben): Switch this to a parameter on the SSLClientSocketContext | 91 // TODO(davidben): Switch this to a parameter on the SSLClientSocketContext |
| 113 // once https://crbug.com/458365 is resolved. This will require splitting | 92 // once https://crbug.com/458365 is resolved. This will require splitting |
| 114 // SSLKeyLogger into an interface, built with OS_NACL and a non-NaCl | 93 // SSLKeyLogger into an interface, built with OS_NACL and a non-NaCl |
| 115 // SSLKeyLoggerImpl. | 94 // SSLKeyLoggerImpl. |
| 116 static void SetSSLKeyLogFile( | 95 static void SetSSLKeyLogFile( |
| 117 const base::FilePath& path, | 96 const base::FilePath& path, |
| 118 const scoped_refptr<base::SequencedTaskRunner>& task_runner); | 97 const scoped_refptr<base::SequencedTaskRunner>& task_runner); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 152 |
| 174 // True if SCTs were received via a TLS extension. | 153 // True if SCTs were received via a TLS extension. |
| 175 bool signed_cert_timestamps_received_; | 154 bool signed_cert_timestamps_received_; |
| 176 // True if a stapled OCSP response was received. | 155 // True if a stapled OCSP response was received. |
| 177 bool stapled_ocsp_response_received_; | 156 bool stapled_ocsp_response_received_; |
| 178 }; | 157 }; |
| 179 | 158 |
| 180 } // namespace net | 159 } // namespace net |
| 181 | 160 |
| 182 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ | 161 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ |
| OLD | NEW |