| 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/v2_authenticator.h" | 5 #include "remoting/protocol/v2_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 "remoting/base/constants.h" | 9 #include "remoting/base/constants.h" |
| 10 #include "remoting/base/rsa_key_pair.h" | 10 #include "remoting/base/rsa_key_pair.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 message->AddElement(certificate_tag); | 174 message->AddElement(certificate_tag); |
| 175 certificate_sent_ = true; | 175 certificate_sent_ = true; |
| 176 } | 176 } |
| 177 | 177 |
| 178 if (state_ != ACCEPTED) { | 178 if (state_ != ACCEPTED) { |
| 179 state_ = WAITING_MESSAGE; | 179 state_ = WAITING_MESSAGE; |
| 180 } | 180 } |
| 181 return message.Pass(); | 181 return message.Pass(); |
| 182 } | 182 } |
| 183 | 183 |
| 184 const std::string& V2Authenticator::GetAuthKey() const { |
| 185 return auth_key_; |
| 186 } |
| 187 |
| 184 scoped_ptr<ChannelAuthenticator> | 188 scoped_ptr<ChannelAuthenticator> |
| 185 V2Authenticator::CreateChannelAuthenticator() const { | 189 V2Authenticator::CreateChannelAuthenticator() const { |
| 186 DCHECK_EQ(state(), ACCEPTED); | 190 DCHECK_EQ(state(), ACCEPTED); |
| 187 CHECK(!auth_key_.empty()); | 191 CHECK(!auth_key_.empty()); |
| 188 | 192 |
| 189 if (is_host_side()) { | 193 if (is_host_side()) { |
| 190 return SslHmacChannelAuthenticator::CreateForHost( | 194 return SslHmacChannelAuthenticator::CreateForHost( |
| 191 local_cert_, local_key_pair_, auth_key_); | 195 local_cert_, local_key_pair_, auth_key_); |
| 192 } else { | 196 } else { |
| 193 return SslHmacChannelAuthenticator::CreateForClient( | 197 return SslHmacChannelAuthenticator::CreateForClient( |
| 194 remote_cert_, auth_key_); | 198 remote_cert_, auth_key_); |
| 195 } | 199 } |
| 196 } | 200 } |
| 197 | 201 |
| 198 bool V2Authenticator::is_host_side() const { | 202 bool V2Authenticator::is_host_side() const { |
| 199 return local_key_pair_.get() != nullptr; | 203 return local_key_pair_.get() != nullptr; |
| 200 } | 204 } |
| 201 | 205 |
| 202 } // namespace protocol | 206 } // namespace protocol |
| 203 } // namespace remoting | 207 } // namespace remoting |
| OLD | NEW |