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/cert_verifier.h" | |
11 #include "net/base/host_port_pair.h" | 10 #include "net/base/host_port_pair.h" |
12 #include "net/base/io_buffer.h" | 11 #include "net/base/io_buffer.h" |
| 12 #include "net/base/multi_threaded_cert_verifier.h" |
13 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
14 #include "net/base/ssl_config_service.h" | 14 #include "net/base/ssl_config_service.h" |
15 #include "net/base/x509_certificate.h" | 15 #include "net/base/x509_certificate.h" |
16 #include "net/socket/client_socket_factory.h" | 16 #include "net/socket/client_socket_factory.h" |
17 #include "net/socket/ssl_client_socket.h" | 17 #include "net/socket/ssl_client_socket.h" |
18 #include "net/socket/ssl_server_socket.h" | 18 #include "net/socket/ssl_server_socket.h" |
19 #include "remoting/protocol/auth_util.h" | 19 #include "remoting/protocol/auth_util.h" |
20 | 20 |
21 namespace remoting { | 21 namespace remoting { |
22 namespace protocol { | 22 namespace protocol { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 | 80 |
81 net::SSLConfig ssl_config; | 81 net::SSLConfig ssl_config; |
82 net::SSLServerSocket* server_socket = net::CreateSSLServerSocket( | 82 net::SSLServerSocket* server_socket = net::CreateSSLServerSocket( |
83 socket.release(), cert, local_private_key_, ssl_config); | 83 socket.release(), cert, local_private_key_, ssl_config); |
84 socket_.reset(server_socket); | 84 socket_.reset(server_socket); |
85 | 85 |
86 result = server_socket->Handshake(base::Bind( | 86 result = server_socket->Handshake(base::Bind( |
87 &SslHmacChannelAuthenticator::OnConnected, base::Unretained(this))); | 87 &SslHmacChannelAuthenticator::OnConnected, base::Unretained(this))); |
88 } else { | 88 } else { |
89 cert_verifier_.reset(new net::CertVerifier()); | 89 cert_verifier_.reset(new net::MultiThreadedCertVerifier()); |
90 | 90 |
91 net::SSLConfig::CertAndStatus cert_and_status; | 91 net::SSLConfig::CertAndStatus cert_and_status; |
92 cert_and_status.cert_status = net::CERT_STATUS_AUTHORITY_INVALID; | 92 cert_and_status.cert_status = net::CERT_STATUS_AUTHORITY_INVALID; |
93 cert_and_status.der_cert = remote_cert_; | 93 cert_and_status.der_cert = remote_cert_; |
94 | 94 |
95 net::SSLConfig ssl_config; | 95 net::SSLConfig ssl_config; |
96 // Certificate verification and revocation checking are not needed | 96 // Certificate verification and revocation checking are not needed |
97 // because we use self-signed certs. Disable it so that the SSL | 97 // because we use self-signed certs. Disable it so that the SSL |
98 // layer doesn't try to initialize OCSP (OCSP works only on the IO | 98 // layer doesn't try to initialize OCSP (OCSP works only on the IO |
99 // thread). | 99 // thread). |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 } | 268 } |
269 } | 269 } |
270 | 270 |
271 void SslHmacChannelAuthenticator::NotifyError(int error) { | 271 void SslHmacChannelAuthenticator::NotifyError(int error) { |
272 done_callback_.Run(static_cast<net::Error>(error), | 272 done_callback_.Run(static_cast<net::Error>(error), |
273 scoped_ptr<net::StreamSocket>(NULL)); | 273 scoped_ptr<net::StreamSocket>(NULL)); |
274 } | 274 } |
275 | 275 |
276 } // namespace protocol | 276 } // namespace protocol |
277 } // namespace remoting | 277 } // namespace remoting |
OLD | NEW |