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_OPENSSL_H_ | 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
6 #define NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ | 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
7 | 7 |
8 #include <openssl/base.h> | 8 #include <openssl/base.h> |
9 #include <openssl/ssl.h> | 9 #include <openssl/ssl.h> |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "net/base/completion_callback.h" | 17 #include "net/base/completion_callback.h" |
18 #include "net/base/io_buffer.h" | 18 #include "net/base/io_buffer.h" |
19 #include "net/base/net_export.h" | |
19 #include "net/cert/cert_verifier.h" | 20 #include "net/cert/cert_verifier.h" |
20 #include "net/cert/cert_verify_result.h" | 21 #include "net/cert/cert_verify_result.h" |
21 #include "net/cert/ct_verify_result.h" | 22 #include "net/cert/ct_verify_result.h" |
22 #include "net/socket/client_socket_handle.h" | 23 #include "net/socket/client_socket_handle.h" |
23 #include "net/socket/ssl_client_socket.h" | 24 #include "net/socket/ssl_client_socket.h" |
24 #include "net/ssl/channel_id_service.h" | 25 #include "net/ssl/channel_id_service.h" |
25 #include "net/ssl/openssl_ssl_util.h" | 26 #include "net/ssl/openssl_ssl_util.h" |
26 #include "net/ssl/ssl_client_cert_type.h" | 27 #include "net/ssl/ssl_client_cert_type.h" |
27 #include "net/ssl/ssl_config_service.h" | 28 #include "net/ssl/ssl_config_service.h" |
28 #include "net/ssl/ssl_failure_state.h" | 29 #include "net/ssl/ssl_failure_state.h" |
29 | 30 |
30 namespace net { | 31 namespace net { |
31 | 32 |
32 class CertVerifier; | 33 class CertVerifier; |
33 class CTVerifier; | 34 class CTVerifier; |
34 class SSLCertRequestInfo; | 35 class SSLCertRequestInfo; |
35 class SSLInfo; | 36 class SSLInfo; |
36 class SSLPrivateKey; | 37 class SSLPrivateKey; |
37 | 38 |
38 // An SSL client socket implemented with OpenSSL. | 39 // An SSL client socket implemented with OpenSSL. |
39 class SSLClientSocketOpenSSL : public SSLClientSocket { | 40 class NET_EXPORT SSLClientSocketOpenSSL : public SSLClientSocket { |
40 public: | 41 public: |
41 // Takes ownership of the transport_socket, which may already be connected. | 42 // Takes ownership of the transport_socket, which may already be connected. |
42 // The given hostname will be compared with the name(s) in the server's | 43 // The given hostname will be compared with the name(s) in the server's |
43 // certificate during the SSL handshake. ssl_config specifies the SSL | 44 // certificate during the SSL handshake. ssl_config specifies the SSL |
44 // settings. | 45 // settings. |
45 SSLClientSocketOpenSSL(scoped_ptr<ClientSocketHandle> transport_socket, | 46 SSLClientSocketOpenSSL(scoped_ptr<ClientSocketHandle> transport_socket, |
46 const HostPortPair& host_and_port, | 47 const HostPortPair& host_and_port, |
47 const SSLConfig& ssl_config, | 48 const SSLConfig& ssl_config, |
48 const SSLClientSocketContext& context); | 49 const SSLClientSocketContext& context); |
49 ~SSLClientSocketOpenSSL() override; | 50 ~SSLClientSocketOpenSSL() override; |
50 | 51 |
51 const HostPortPair& host_and_port() const { return host_and_port_; } | 52 const HostPortPair& host_and_port() const { return host_and_port_; } |
52 const std::string& ssl_session_cache_shard() const { | 53 const std::string& ssl_session_cache_shard() const { |
53 return ssl_session_cache_shard_; | 54 return ssl_session_cache_shard_; |
54 } | 55 } |
55 | 56 |
57 // Export ssl key log files if env variable is not set. | |
58 static void SetSslKeyLogFile(std::string ssl_keylog_file); | |
Bryan McQuade
2015/10/14 00:38:54
nit: since other names use 'SSL' in all caps, let'
Bryan McQuade
2015/10/14 00:38:54
if there's not a strong need to use std::string he
Zhongyi Shi
2015/10/15 00:26:52
Done.
Zhongyi Shi
2015/10/15 00:26:52
Just to keep consistent with the usage in this fil
| |
59 | |
56 // SSLClientSocket implementation. | 60 // SSLClientSocket implementation. |
57 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override; | 61 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override; |
58 NextProtoStatus GetNextProto(std::string* proto) const override; | 62 NextProtoStatus GetNextProto(std::string* proto) const override; |
59 ChannelIDService* GetChannelIDService() const override; | 63 ChannelIDService* GetChannelIDService() const override; |
60 SSLFailureState GetSSLFailureState() const override; | 64 SSLFailureState GetSSLFailureState() const override; |
61 | 65 |
62 // SSLSocket implementation. | 66 // SSLSocket implementation. |
63 int ExportKeyingMaterial(const base::StringPiece& label, | 67 int ExportKeyingMaterial(const base::StringPiece& label, |
64 bool has_context, | 68 bool has_context, |
65 const base::StringPiece& context, | 69 const base::StringPiece& context, |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
332 // pinning failure. It is a (somewhat) human-readable string. | 336 // pinning failure. It is a (somewhat) human-readable string. |
333 std::string pinning_failure_log_; | 337 std::string pinning_failure_log_; |
334 | 338 |
335 BoundNetLog net_log_; | 339 BoundNetLog net_log_; |
336 base::WeakPtrFactory<SSLClientSocketOpenSSL> weak_factory_; | 340 base::WeakPtrFactory<SSLClientSocketOpenSSL> weak_factory_; |
337 }; | 341 }; |
338 | 342 |
339 } // namespace net | 343 } // namespace net |
340 | 344 |
341 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ | 345 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_OPENSSL_H_ |
OLD | NEW |