OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/chromeos/login/managed/supervised_user_authentication.h
" | 4 #include "chrome/browser/chromeos/login/managed/supervised_user_authentication.h
" |
5 | 5 |
6 #include "base/values.h" | 6 #include "base/values.h" |
| 7 #include "chrome/browser/chromeos/login/auth/key.h" |
7 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 8 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
9 | 10 |
10 namespace chromeos { | 11 namespace chromeos { |
11 | 12 |
12 class SupervisedUserAuthenticationTest : public testing::Test { | 13 class SupervisedUserAuthenticationTest : public testing::Test { |
13 protected: | 14 protected: |
14 SupervisedUserAuthenticationTest(); | 15 SupervisedUserAuthenticationTest(); |
15 virtual ~SupervisedUserAuthenticationTest(); | 16 virtual ~SupervisedUserAuthenticationTest(); |
16 | 17 |
(...skipping 16 matching lines...) Expand all Loading... |
33 std::string password = "password"; | 34 std::string password = "password"; |
34 int revision = 1; | 35 int revision = 1; |
35 std::string salt = | 36 std::string salt = |
36 "204cc733ebe526ea9a84885de904eb7a578d86a4c385d252dce275d9d9675c37"; | 37 "204cc733ebe526ea9a84885de904eb7a578d86a4c385d252dce275d9d9675c37"; |
37 std::string expected_salted_password = | 38 std::string expected_salted_password = |
38 "OSL3HZZSfK+mDQTYUh3lXhgAzJNWhYz52ax0Bleny7Q="; | 39 "OSL3HZZSfK+mDQTYUh3lXhgAzJNWhYz52ax0Bleny7Q="; |
39 std::string signature_key = "p5TR/34XX0R7IMuffH14BiL1vcdSD8EajPzdIg09z9M="; | 40 std::string signature_key = "p5TR/34XX0R7IMuffH14BiL1vcdSD8EajPzdIg09z9M="; |
40 std::string expected_signature = | 41 std::string expected_signature = |
41 "KOPQmmJcMr9iMkr36N1cX+G9gDdBBu7zutAxNayPMN4="; | 42 "KOPQmmJcMr9iMkr36N1cX+G9gDdBBu7zutAxNayPMN4="; |
42 | 43 |
43 std::string salted_password = | 44 Key key(password); |
44 SupervisedUserAuthentication::BuildPasswordForHashWithSaltSchema( | 45 key.Transform(Key::KEY_TYPE_SALTED_PBKDF2_AES256_1234, salt); |
45 salt, password); | 46 ASSERT_EQ(expected_salted_password, key.GetSecret()); |
46 ASSERT_EQ(expected_salted_password, salted_password); | |
47 std::string signature = SupervisedUserAuthentication::BuildPasswordSignature( | 47 std::string signature = SupervisedUserAuthentication::BuildPasswordSignature( |
48 salted_password, revision, signature_key); | 48 key.GetSecret(), revision, signature_key); |
49 ASSERT_EQ(expected_signature, signature); | 49 ASSERT_EQ(expected_signature, signature); |
50 } | 50 } |
51 | 51 |
52 } // namespace chromeos | 52 } // namespace chromeos |
OLD | NEW |