| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "net/base/net_errors.h" | 6 #include "net/base/net_errors.h" |
| 7 #include "remoting/base/rsa_key_pair.h" | 7 #include "remoting/base/rsa_key_pair.h" |
| 8 #include "remoting/protocol/authenticator_test_base.h" | 8 #include "remoting/protocol/authenticator_test_base.h" |
| 9 #include "remoting/protocol/channel_authenticator.h" | 9 #include "remoting/protocol/channel_authenticator.h" |
| 10 #include "remoting/protocol/connection_tester.h" | 10 #include "remoting/protocol/connection_tester.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 } | 42 } |
| 43 | 43 |
| 44 protected: | 44 protected: |
| 45 void InitAuthenticators( | 45 void InitAuthenticators( |
| 46 const std::string& client_secret, | 46 const std::string& client_secret, |
| 47 const std::string& host_secret, | 47 const std::string& host_secret, |
| 48 AuthenticationMethod::HashFunction hash_function, | 48 AuthenticationMethod::HashFunction hash_function, |
| 49 bool client_hmac_only) { | 49 bool client_hmac_only) { |
| 50 std::string host_secret_hash = AuthenticationMethod::ApplyHashFunction( | 50 std::string host_secret_hash = AuthenticationMethod::ApplyHashFunction( |
| 51 hash_function, kTestHostId, host_secret); | 51 hash_function, kTestHostId, host_secret); |
| 52 host_.reset(new NegotiatingHostAuthenticator( | 52 host_ = NegotiatingHostAuthenticator::CreateWithSharedSecret( |
| 53 host_cert_, key_pair_, host_secret_hash, hash_function)); | 53 host_cert_, key_pair_, host_secret_hash, hash_function); |
| 54 | 54 |
| 55 std::vector<AuthenticationMethod> methods; | 55 std::vector<AuthenticationMethod> methods; |
| 56 methods.push_back(AuthenticationMethod::Spake2( | 56 methods.push_back(AuthenticationMethod::Spake2( |
| 57 AuthenticationMethod::HMAC_SHA256)); | 57 AuthenticationMethod::HMAC_SHA256)); |
| 58 if (!client_hmac_only) { | 58 if (!client_hmac_only) { |
| 59 methods.push_back(AuthenticationMethod::Spake2( | 59 methods.push_back(AuthenticationMethod::Spake2( |
| 60 AuthenticationMethod::NONE)); | 60 AuthenticationMethod::NONE)); |
| 61 } | 61 } |
| 62 client_.reset(new NegotiatingClientAuthenticator( | 62 client_.reset(new NegotiatingClientAuthenticator( |
| 63 kTestHostId, base::Bind(&NegotiatingAuthenticatorTest::FetchSecret, | 63 kTestHostId, base::Bind(&NegotiatingAuthenticatorTest::FetchSecret, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( | 137 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( |
| 138 kTestSharedSecret, kTestSharedSecretBad, | 138 kTestSharedSecret, kTestSharedSecretBad, |
| 139 AuthenticationMethod::NONE, true)); | 139 AuthenticationMethod::NONE, true)); |
| 140 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); | 140 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); |
| 141 | 141 |
| 142 VerifyRejected(Authenticator::PROTOCOL_ERROR); | 142 VerifyRejected(Authenticator::PROTOCOL_ERROR); |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace protocol | 145 } // namespace protocol |
| 146 } // namespace remoting | 146 } // namespace remoting |
| OLD | NEW |