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/negotiating_authenticator.h" | 5 #include "remoting/protocol/negotiating_authenticator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
| 9 #include "remoting/base/rsa_key_pair.h" |
9 #include "remoting/protocol/authenticator_test_base.h" | 10 #include "remoting/protocol/authenticator_test_base.h" |
10 #include "remoting/protocol/channel_authenticator.h" | 11 #include "remoting/protocol/channel_authenticator.h" |
11 #include "remoting/protocol/connection_tester.h" | 12 #include "remoting/protocol/connection_tester.h" |
12 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" | 15 #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" |
15 | 16 |
16 using testing::_; | 17 using testing::_; |
17 using testing::DeleteArg; | 18 using testing::DeleteArg; |
18 using testing::SaveArg; | 19 using testing::SaveArg; |
(...skipping 22 matching lines...) Expand all Loading... |
41 | 42 |
42 protected: | 43 protected: |
43 void InitAuthenticators( | 44 void InitAuthenticators( |
44 const std::string& client_secret, | 45 const std::string& client_secret, |
45 const std::string& host_secret, | 46 const std::string& host_secret, |
46 AuthenticationMethod::HashFunction hash_function, | 47 AuthenticationMethod::HashFunction hash_function, |
47 bool client_hmac_only) { | 48 bool client_hmac_only) { |
48 std::string host_secret_hash = AuthenticationMethod::ApplyHashFunction( | 49 std::string host_secret_hash = AuthenticationMethod::ApplyHashFunction( |
49 hash_function, kTestHostId, host_secret); | 50 hash_function, kTestHostId, host_secret); |
50 host_ = NegotiatingAuthenticator::CreateForHost( | 51 host_ = NegotiatingAuthenticator::CreateForHost( |
51 host_cert_, *private_key_, host_secret_hash, hash_function); | 52 host_cert_, key_pair_, host_secret_hash, hash_function); |
52 | 53 |
53 std::vector<AuthenticationMethod> methods; | 54 std::vector<AuthenticationMethod> methods; |
54 methods.push_back(AuthenticationMethod::Spake2( | 55 methods.push_back(AuthenticationMethod::Spake2( |
55 AuthenticationMethod::HMAC_SHA256)); | 56 AuthenticationMethod::HMAC_SHA256)); |
56 if (!client_hmac_only) { | 57 if (!client_hmac_only) { |
57 methods.push_back(AuthenticationMethod::Spake2( | 58 methods.push_back(AuthenticationMethod::Spake2( |
58 AuthenticationMethod::NONE)); | 59 AuthenticationMethod::NONE)); |
59 } | 60 } |
60 client_ = NegotiatingAuthenticator::CreateForClient( | 61 client_ = NegotiatingAuthenticator::CreateForClient( |
61 kTestHostId, client_secret, methods); | 62 kTestHostId, client_secret, methods); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( | 142 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( |
142 kTestSharedSecret, kTestSharedSecretBad, | 143 kTestSharedSecret, kTestSharedSecretBad, |
143 AuthenticationMethod::NONE, true)); | 144 AuthenticationMethod::NONE, true)); |
144 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); | 145 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); |
145 | 146 |
146 VerifyRejected(Authenticator::PROTOCOL_ERROR); | 147 VerifyRejected(Authenticator::PROTOCOL_ERROR); |
147 } | 148 } |
148 | 149 |
149 } // namespace protocol | 150 } // namespace protocol |
150 } // namespace remoting | 151 } // namespace remoting |
OLD | NEW |