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
3 // found in the LICENSE file.
4 #include "chrome/browser/chromeos/login/managed/supervised_user_authentication.h"
6 #include "base/values.h"
7 #include "chrome/browser/chromeos/login/supervised_user_manager.h"
8 #include "testing/gtest/include/gtest/gtest.h"
12 class SupervisedUserAuthenticationTest : public testing::Test {
14 SupervisedUserAuthenticationTest();
15 virtual ~SupervisedUserAuthenticationTest();
18 virtual void SetUp() OVERRIDE;
19 virtual void TearDown() OVERRIDE;
21 DISALLOW_COPY_AND_ASSIGN(SupervisedUserAuthenticationTest);
24 SupervisedUserAuthenticationTest::SupervisedUserAuthenticationTest() {}
26 SupervisedUserAuthenticationTest::~SupervisedUserAuthenticationTest() {}
28 void SupervisedUserAuthenticationTest::SetUp() {}
30 void SupervisedUserAuthenticationTest::TearDown() {}
32 TEST_F(SupervisedUserAuthenticationTest, SignatureGeneration) {
33 std::string password = "password";
36 "204cc733ebe526ea9a84885de904eb7a578d86a4c385d252dce275d9d9675c37";
37 std::string expected_salted_password =
38 "OSL3HZZSfK+mDQTYUh3lXhgAzJNWhYz52ax0Bleny7Q=";
39 std::string signature_key = "p5TR/34XX0R7IMuffH14BiL1vcdSD8EajPzdIg09z9M=";
40 std::string expected_signature =
41 "KOPQmmJcMr9iMkr36N1cX+G9gDdBBu7zutAxNayPMN4=";
43 std::string salted_password =
44 SupervisedUserAuthentication::BuildPasswordForHashWithSaltSchema(
46 ASSERT_EQ(expected_salted_password, salted_password);
47 std::string signature = SupervisedUserAuthentication::BuildPasswordSignature(
48 salted_password, revision, signature_key);
49 ASSERT_EQ(expected_signature, signature);
52 } // namespace chromeos