| 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/v1_authenticator.h" | 5 #include "remoting/protocol/v1_authenticator.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "crypto/rsa_private_key.h" | 9 #include "crypto/rsa_private_key.h" |
| 10 #include "remoting/base/constants.h" | 10 #include "remoting/base/constants.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 DCHECK_EQ(state_, ACCEPTED); | 79 DCHECK_EQ(state_, ACCEPTED); |
| 80 SslHmacChannelAuthenticator* result = | 80 SslHmacChannelAuthenticator* result = |
| 81 SslHmacChannelAuthenticator::CreateForClient( | 81 SslHmacChannelAuthenticator::CreateForClient( |
| 82 remote_cert_, shared_secret_); | 82 remote_cert_, shared_secret_); |
| 83 result->SetLegacyOneWayMode(SslHmacChannelAuthenticator::SEND_ONLY); | 83 result->SetLegacyOneWayMode(SslHmacChannelAuthenticator::SEND_ONLY); |
| 84 return result; | 84 return result; |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 V1HostAuthenticator::V1HostAuthenticator( | 87 V1HostAuthenticator::V1HostAuthenticator( |
| 88 const std::string& local_cert, | 88 const std::string& local_cert, |
| 89 const crypto::RSAPrivateKey* local_private_key, | 89 const crypto::RSAPrivateKey& local_private_key, |
| 90 const std::string& shared_secret, | 90 const std::string& shared_secret, |
| 91 const std::string& remote_jid) | 91 const std::string& remote_jid) |
| 92 : local_cert_(local_cert), | 92 : local_cert_(local_cert), |
| 93 local_private_key_(local_private_key->Copy()), | 93 local_private_key_(local_private_key.Copy()), |
| 94 shared_secret_(shared_secret), | 94 shared_secret_(shared_secret), |
| 95 remote_jid_(remote_jid), | 95 remote_jid_(remote_jid), |
| 96 state_(WAITING_MESSAGE) { | 96 state_(WAITING_MESSAGE) { |
| 97 } | 97 } |
| 98 | 98 |
| 99 V1HostAuthenticator::~V1HostAuthenticator() { | 99 V1HostAuthenticator::~V1HostAuthenticator() { |
| 100 } | 100 } |
| 101 | 101 |
| 102 Authenticator::State V1HostAuthenticator::state() const { | 102 Authenticator::State V1HostAuthenticator::state() const { |
| 103 return state_; | 103 return state_; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 ChannelAuthenticator* | 137 ChannelAuthenticator* |
| 138 V1HostAuthenticator::CreateChannelAuthenticator() const { | 138 V1HostAuthenticator::CreateChannelAuthenticator() const { |
| 139 DCHECK_EQ(state_, ACCEPTED); | 139 DCHECK_EQ(state_, ACCEPTED); |
| 140 SslHmacChannelAuthenticator* result = | 140 SslHmacChannelAuthenticator* result = |
| 141 SslHmacChannelAuthenticator::CreateForHost( | 141 SslHmacChannelAuthenticator::CreateForHost( |
| 142 local_cert_, local_private_key_.get(), shared_secret_); | 142 local_cert_, local_private_key_.get(), shared_secret_); |
| 143 result->SetLegacyOneWayMode(SslHmacChannelAuthenticator::RECEIVE_ONLY); | 143 result->SetLegacyOneWayMode(SslHmacChannelAuthenticator::RECEIVE_ONLY); |
| 144 return result; | 144 return result; |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 V1HostAuthenticatorFactory::V1HostAuthenticatorFactory( | |
| 148 const std::string& local_cert, | |
| 149 const crypto::RSAPrivateKey* local_private_key, | |
| 150 const std::string& shared_secret) | |
| 151 : local_cert_(local_cert), | |
| 152 local_private_key_(local_private_key->Copy()), | |
| 153 shared_secret_(shared_secret) { | |
| 154 CHECK(local_private_key_.get()); | |
| 155 } | |
| 156 | |
| 157 V1HostAuthenticatorFactory::~V1HostAuthenticatorFactory() { | |
| 158 } | |
| 159 | |
| 160 Authenticator* V1HostAuthenticatorFactory::CreateAuthenticator( | |
| 161 const std::string& remote_jid, | |
| 162 const buzz::XmlElement* first_message) { | |
| 163 return new V1HostAuthenticator(local_cert_, local_private_key_.get(), | |
| 164 shared_secret_, remote_jid); | |
| 165 } | |
| 166 | |
| 167 } // namespace remoting | 147 } // namespace remoting |
| 168 } // namespace protocol | 148 } // namespace protocol |
| OLD | NEW |