| 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 #include "remoting/protocol/ssl_hmac_channel_authenticator.h" | 5 #include "remoting/protocol/ssl_hmac_channel_authenticator.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "crypto/secure_util.h" | 9 #include "crypto/secure_util.h" |
| 10 #include "net/base/host_port_pair.h" | 10 #include "net/base/host_port_pair.h" |
| 11 #include "net/base/io_buffer.h" | 11 #include "net/base/io_buffer.h" |
| 12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 13 #include "net/cert/cert_verifier.h" | 13 #include "net/cert/cert_verifier.h" |
| 14 #include "net/cert/x509_certificate.h" | 14 #include "net/cert/x509_certificate.h" |
| 15 #include "net/http/transport_security_state.h" | 15 #include "net/http/transport_security_state.h" |
| 16 #include "net/socket/client_socket_factory.h" | 16 #include "net/socket/client_socket_factory.h" |
| 17 #include "net/socket/client_socket_handle.h" |
| 17 #include "net/socket/ssl_client_socket.h" | 18 #include "net/socket/ssl_client_socket.h" |
| 18 #include "net/socket/ssl_server_socket.h" | 19 #include "net/socket/ssl_server_socket.h" |
| 19 #include "net/ssl/ssl_config_service.h" | 20 #include "net/ssl/ssl_config_service.h" |
| 20 #include "remoting/base/rsa_key_pair.h" | 21 #include "remoting/base/rsa_key_pair.h" |
| 21 #include "remoting/protocol/auth_util.h" | 22 #include "remoting/protocol/auth_util.h" |
| 22 | 23 |
| 23 namespace remoting { | 24 namespace remoting { |
| 24 namespace protocol { | 25 namespace protocol { |
| 25 | 26 |
| 26 // static | 27 // static |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // layer doesn't try to initialize OCSP (OCSP works only on the IO | 97 // layer doesn't try to initialize OCSP (OCSP works only on the IO |
| 97 // thread). | 98 // thread). |
| 98 ssl_config.cert_io_enabled = false; | 99 ssl_config.cert_io_enabled = false; |
| 99 ssl_config.rev_checking_enabled = false; | 100 ssl_config.rev_checking_enabled = false; |
| 100 ssl_config.allowed_bad_certs.push_back(cert_and_status); | 101 ssl_config.allowed_bad_certs.push_back(cert_and_status); |
| 101 | 102 |
| 102 net::HostPortPair host_and_port(kSslFakeHostName, 0); | 103 net::HostPortPair host_and_port(kSslFakeHostName, 0); |
| 103 net::SSLClientSocketContext context; | 104 net::SSLClientSocketContext context; |
| 104 context.cert_verifier = cert_verifier_.get(); | 105 context.cert_verifier = cert_verifier_.get(); |
| 105 context.transport_security_state = transport_security_state_.get(); | 106 context.transport_security_state = transport_security_state_.get(); |
| 107 scoped_ptr<net::ClientSocketHandle> connection(new net::ClientSocketHandle); |
| 108 connection->set_socket(socket.release()); |
| 106 socket_.reset( | 109 socket_.reset( |
| 107 net::ClientSocketFactory::GetDefaultFactory()->CreateSSLClientSocket( | 110 net::ClientSocketFactory::GetDefaultFactory()->CreateSSLClientSocket( |
| 108 socket.release(), host_and_port, ssl_config, context)); | 111 connection.release(), host_and_port, ssl_config, context)); |
| 109 | 112 |
| 110 result = socket_->Connect( | 113 result = socket_->Connect( |
| 111 base::Bind(&SslHmacChannelAuthenticator::OnConnected, | 114 base::Bind(&SslHmacChannelAuthenticator::OnConnected, |
| 112 base::Unretained(this))); | 115 base::Unretained(this))); |
| 113 } | 116 } |
| 114 | 117 |
| 115 if (result == net::ERR_IO_PENDING) | 118 if (result == net::ERR_IO_PENDING) |
| 116 return; | 119 return; |
| 117 | 120 |
| 118 OnConnected(result); | 121 OnConnected(result); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 } | 267 } |
| 265 } | 268 } |
| 266 | 269 |
| 267 void SslHmacChannelAuthenticator::NotifyError(int error) { | 270 void SslHmacChannelAuthenticator::NotifyError(int error) { |
| 268 done_callback_.Run(static_cast<net::Error>(error), | 271 done_callback_.Run(static_cast<net::Error>(error), |
| 269 scoped_ptr<net::StreamSocket>()); | 272 scoped_ptr<net::StreamSocket>()); |
| 270 } | 273 } |
| 271 | 274 |
| 272 } // namespace protocol | 275 } // namespace protocol |
| 273 } // namespace remoting | 276 } // namespace remoting |
| OLD | NEW |