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/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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 reinterpret_cast<const uint8*>(key_string.data()), | 70 reinterpret_cast<const uint8*>(key_string.data()), |
71 reinterpret_cast<const uint8*>(key_string.data() + | 71 reinterpret_cast<const uint8*>(key_string.data() + |
72 key_string.length())); | 72 key_string.length())); |
73 private_key_.reset( | 73 private_key_.reset( |
74 crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_vector)); | 74 crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_vector)); |
75 } | 75 } |
76 | 76 |
77 void InitAuthenticators(const std::string& client_secret, | 77 void InitAuthenticators(const std::string& client_secret, |
78 const std::string& host_secret) { | 78 const std::string& host_secret) { |
79 host_.reset(new V1HostAuthenticator( | 79 host_.reset(new V1HostAuthenticator( |
80 host_cert_, private_key_.get(), host_secret, kClientJid)); | 80 host_cert_, *private_key_, host_secret, kClientJid)); |
81 client_.reset(new V1ClientAuthenticator(kClientJid, client_secret)); | 81 client_.reset(new V1ClientAuthenticator(kClientJid, client_secret)); |
82 } | 82 } |
83 | 83 |
84 void RunAuthExchange() { | 84 void RunAuthExchange() { |
85 do { | 85 do { |
86 scoped_ptr<buzz::XmlElement> message; | 86 scoped_ptr<buzz::XmlElement> message; |
87 | 87 |
88 // Pass message from client to host. | 88 // Pass message from client to host. |
89 ASSERT_EQ(Authenticator::MESSAGE_READY, client_->state()); | 89 ASSERT_EQ(Authenticator::MESSAGE_READY, client_->state()); |
90 message.reset(client_->GetNextMessage()); | 90 message.reset(client_->GetNextMessage()); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 { | 197 { |
198 SCOPED_TRACE("RunAuthExchange"); | 198 SCOPED_TRACE("RunAuthExchange"); |
199 InitAuthenticators(kTestSharedSecretBad, kTestSharedSecret); | 199 InitAuthenticators(kTestSharedSecretBad, kTestSharedSecret); |
200 RunAuthExchange(); | 200 RunAuthExchange(); |
201 } | 201 } |
202 ASSERT_EQ(Authenticator::REJECTED, host_->state()); | 202 ASSERT_EQ(Authenticator::REJECTED, host_->state()); |
203 } | 203 } |
204 | 204 |
205 } // namespace protocol | 205 } // namespace protocol |
206 } // namespace remoting | 206 } // namespace remoting |
OLD | NEW |