| 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/base/rsa_key_pair.h" |
| 10 #include "remoting/protocol/authenticator_test_base.h" | 10 #include "remoting/protocol/authenticator_test_base.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 | 42 |
| 43 protected: | 43 protected: |
| 44 void InitAuthenticators( | 44 void InitAuthenticators( |
| 45 const std::string& client_secret, | 45 const std::string& client_secret, |
| 46 const std::string& host_secret, | 46 const std::string& host_secret, |
| 47 AuthenticationMethod::HashFunction hash_function, | 47 AuthenticationMethod::HashFunction hash_function, |
| 48 bool client_hmac_only) { | 48 bool client_hmac_only) { |
| 49 std::string host_secret_hash = AuthenticationMethod::ApplyHashFunction( | 49 std::string host_secret_hash = AuthenticationMethod::ApplyHashFunction( |
| 50 hash_function, kTestHostId, host_secret); | 50 hash_function, kTestHostId, host_secret); |
| 51 host_ = NegotiatingAuthenticator::CreateForHost( | 51 host_ = NegotiatingAuthenticator::CreateForHostSharedSecret( |
| 52 host_cert_, key_pair_, host_secret_hash, hash_function); | 52 host_cert_, key_pair_, host_secret_hash, hash_function); |
| 53 | 53 |
| 54 std::vector<AuthenticationMethod> methods; | 54 std::vector<AuthenticationMethod> methods; |
| 55 methods.push_back(AuthenticationMethod::Spake2( | 55 methods.push_back(AuthenticationMethod::Spake2( |
| 56 AuthenticationMethod::HMAC_SHA256)); | 56 AuthenticationMethod::HMAC_SHA256)); |
| 57 if (!client_hmac_only) { | 57 if (!client_hmac_only) { |
| 58 methods.push_back(AuthenticationMethod::Spake2( | 58 methods.push_back(AuthenticationMethod::Spake2( |
| 59 AuthenticationMethod::NONE)); | 59 AuthenticationMethod::NONE)); |
| 60 } | 60 } |
| 61 client_ = NegotiatingAuthenticator::CreateForClient( | 61 client_ = NegotiatingAuthenticator::CreateForClient( |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( | 136 ASSERT_NO_FATAL_FAILURE(InitAuthenticators( |
| 137 kTestSharedSecret, kTestSharedSecretBad, | 137 kTestSharedSecret, kTestSharedSecretBad, |
| 138 AuthenticationMethod::NONE, true)); | 138 AuthenticationMethod::NONE, true)); |
| 139 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); | 139 ASSERT_NO_FATAL_FAILURE(RunAuthExchange()); |
| 140 | 140 |
| 141 VerifyRejected(Authenticator::PROTOCOL_ERROR); | 141 VerifyRejected(Authenticator::PROTOCOL_ERROR); |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace protocol | 144 } // namespace protocol |
| 145 } // namespace remoting | 145 } // namespace remoting |
| OLD | NEW |