| 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 #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" | 10 #include "net/base/cert_verifier.h" |
| 11 #include "net/base/host_port_pair.h" | 11 #include "net/base/host_port_pair.h" |
| 12 #include "net/base/io_buffer.h" | 12 #include "net/base/io_buffer.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 { |
| 23 | 23 |
| 24 // static | 24 // static |
| 25 SslHmacChannelAuthenticator* SslHmacChannelAuthenticator::CreateForClient( | 25 scoped_ptr<SslHmacChannelAuthenticator> |
| 26 SslHmacChannelAuthenticator::CreateForClient( |
| 26 const std::string& remote_cert, | 27 const std::string& remote_cert, |
| 27 const std::string& auth_key) { | 28 const std::string& auth_key) { |
| 28 SslHmacChannelAuthenticator* result = | 29 scoped_ptr<SslHmacChannelAuthenticator> result( |
| 29 new SslHmacChannelAuthenticator(auth_key); | 30 new SslHmacChannelAuthenticator(auth_key)); |
| 30 result->remote_cert_ = remote_cert; | 31 result->remote_cert_ = remote_cert; |
| 31 return result; | 32 return result.Pass(); |
| 32 } | 33 } |
| 33 | 34 |
| 34 SslHmacChannelAuthenticator* SslHmacChannelAuthenticator::CreateForHost( | 35 scoped_ptr<SslHmacChannelAuthenticator> |
| 36 SslHmacChannelAuthenticator::CreateForHost( |
| 35 const std::string& local_cert, | 37 const std::string& local_cert, |
| 36 crypto::RSAPrivateKey* local_private_key, | 38 crypto::RSAPrivateKey* local_private_key, |
| 37 const std::string& auth_key) { | 39 const std::string& auth_key) { |
| 38 SslHmacChannelAuthenticator* result = | 40 scoped_ptr<SslHmacChannelAuthenticator> result( |
| 39 new SslHmacChannelAuthenticator(auth_key); | 41 new SslHmacChannelAuthenticator(auth_key)); |
| 40 result->local_cert_ = local_cert; | 42 result->local_cert_ = local_cert; |
| 41 result->local_private_key_ = local_private_key; | 43 result->local_private_key_ = local_private_key; |
| 42 return result; | 44 return result.Pass(); |
| 43 } | 45 } |
| 44 | 46 |
| 45 SslHmacChannelAuthenticator::SslHmacChannelAuthenticator( | 47 SslHmacChannelAuthenticator::SslHmacChannelAuthenticator( |
| 46 const std::string& auth_key) | 48 const std::string& auth_key) |
| 47 : auth_key_(auth_key), | 49 : auth_key_(auth_key), |
| 48 local_private_key_(NULL), | 50 local_private_key_(NULL), |
| 49 legacy_mode_(NONE) { | 51 legacy_mode_(NONE) { |
| 50 } | 52 } |
| 51 | 53 |
| 52 SslHmacChannelAuthenticator::~SslHmacChannelAuthenticator() { | 54 SslHmacChannelAuthenticator::~SslHmacChannelAuthenticator() { |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 if (auth_write_buf_ == NULL && auth_read_buf_ == NULL) { | 265 if (auth_write_buf_ == NULL && auth_read_buf_ == NULL) { |
| 264 DCHECK(socket_.get() != NULL); | 266 DCHECK(socket_.get() != NULL); |
| 265 if (callback_called) | 267 if (callback_called) |
| 266 *callback_called = true; | 268 *callback_called = true; |
| 267 done_callback_.Run(net::OK, socket_.release()); | 269 done_callback_.Run(net::OK, socket_.release()); |
| 268 } | 270 } |
| 269 } | 271 } |
| 270 | 272 |
| 271 } // namespace protocol | 273 } // namespace protocol |
| 272 } // namespace remoting | 274 } // namespace remoting |
| OLD | NEW |