| 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/v2_authenticator.h" | 5 #include "remoting/protocol/v2_authenticator.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 reinterpret_cast<const uint8*>(key_string.data()), | 69 reinterpret_cast<const uint8*>(key_string.data()), |
| 70 reinterpret_cast<const uint8*>(key_string.data() + | 70 reinterpret_cast<const uint8*>(key_string.data() + |
| 71 key_string.length())); | 71 key_string.length())); |
| 72 private_key_.reset( | 72 private_key_.reset( |
| 73 crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_vector)); | 73 crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_vector)); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void InitAuthenticators(const std::string& client_secret, | 76 void InitAuthenticators(const std::string& client_secret, |
| 77 const std::string& host_secret) { | 77 const std::string& host_secret) { |
| 78 host_.reset(V2Authenticator::CreateForHost( | 78 host_.reset(V2Authenticator::CreateForHost( |
| 79 host_cert_, private_key_.get(), host_secret)); | 79 host_cert_, *private_key_, host_secret)); |
| 80 client_.reset(V2Authenticator::CreateForClient(client_secret)); | 80 client_.reset(V2Authenticator::CreateForClient(client_secret)); |
| 81 } | 81 } |
| 82 | 82 |
| 83 void RunAuthExchange() { | 83 void RunAuthExchange() { |
| 84 do { | 84 do { |
| 85 scoped_ptr<buzz::XmlElement> message; | 85 scoped_ptr<buzz::XmlElement> message; |
| 86 | 86 |
| 87 // Pass message from client to host. | 87 // Pass message from client to host. |
| 88 ASSERT_EQ(Authenticator::MESSAGE_READY, client_->state()); | 88 ASSERT_EQ(Authenticator::MESSAGE_READY, client_->state()); |
| 89 message.reset(client_->GetNextMessage()); | 89 message.reset(client_->GetNextMessage()); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 scoped_ptr<buzz::XmlElement> message(client_->GetNextMessage()); | 201 scoped_ptr<buzz::XmlElement> message(client_->GetNextMessage()); |
| 202 ASSERT_TRUE(message.get()); | 202 ASSERT_TRUE(message.get()); |
| 203 | 203 |
| 204 ASSERT_EQ(Authenticator::WAITING_MESSAGE, client_->state()); | 204 ASSERT_EQ(Authenticator::WAITING_MESSAGE, client_->state()); |
| 205 host_->ProcessMessage(message.get()); | 205 host_->ProcessMessage(message.get()); |
| 206 ASSERT_EQ(Authenticator::REJECTED, host_->state()); | 206 ASSERT_EQ(Authenticator::REJECTED, host_->state()); |
| 207 } | 207 } |
| 208 | 208 |
| 209 } // namespace protocol | 209 } // namespace protocol |
| 210 } // namespace remoting | 210 } // namespace remoting |
| OLD | NEW |