blob: 425dfd83f7fda81d4bfd684bfbd2cac5d777c4a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/chromeos/login/supervised/supervised_user_authentication.h"
#include "base/values.h"
#include "chrome/browser/chromeos/login/users/supervised_user_manager.h"
#include "chromeos/login/auth/key.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace chromeos {
class SupervisedUserAuthenticationTest : public testing::Test {
protected:
SupervisedUserAuthenticationTest();
virtual ~SupervisedUserAuthenticationTest();
// testing::Test:
virtual void SetUp() OVERRIDE;
virtual void TearDown() OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(SupervisedUserAuthenticationTest);
};
SupervisedUserAuthenticationTest::SupervisedUserAuthenticationTest() {}
SupervisedUserAuthenticationTest::~SupervisedUserAuthenticationTest() {}
void SupervisedUserAuthenticationTest::SetUp() {}
void SupervisedUserAuthenticationTest::TearDown() {}
TEST_F(SupervisedUserAuthenticationTest, SignatureGeneration) {
std::string password = "password";
int revision = 1;
std::string salt =
"204cc733ebe526ea9a84885de904eb7a578d86a4c385d252dce275d9d9675c37";
std::string expected_salted_password =
"OSL3HZZSfK+mDQTYUh3lXhgAzJNWhYz52ax0Bleny7Q=";
std::string signature_key = "p5TR/34XX0R7IMuffH14BiL1vcdSD8EajPzdIg09z9M=";
std::string expected_signature =
"KOPQmmJcMr9iMkr36N1cX+G9gDdBBu7zutAxNayPMN4=";
Key key(password);
key.Transform(Key::KEY_TYPE_SALTED_PBKDF2_AES256_1234, salt);
ASSERT_EQ(expected_salted_password, key.GetSecret());
std::string signature = SupervisedUserAuthentication::BuildPasswordSignature(
key.GetSecret(), revision, signature_key);
ASSERT_EQ(expected_signature, signature);
}
} // namespace chromeos
|