Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: chrome/browser/chromeos/login/auth/key.h

Issue 296773002: Add a Key class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_KEY_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_KEY_H_
7
8 #include <string>
9
10 namespace chromeos {
11
12 // Key for user authentication. The class supports hashing of plain text
13 // passwords to generate keys as well as the use of pre-hashed keys.
14 class Key {
15 public:
16 enum KeyType {
17 // Plain text password.
18 KEY_TYPE_PASSWORD_PLAIN,
19 // SHA256 of salt + password, first half only, lower-case hex encoded.
20 KEY_TYPE_SALTED_SHA256_TOP_HALF,
21 // PBKDF2 with 256 bit AES and 1234 iterations, base64 encoded.
22 KEY_TYPE_SALTED_PBKDF2_AES256_1234,
23 };
24
25 Key();
26 Key(const Key& other);
27 explicit Key(const std::string& plain_text_password);
28 Key(KeyType key_type, const std::string& salt, const std::string& secret);
29 ~Key();
30
31 bool operator==(const Key& other) const;
32
33 KeyType GetKeyType() const;
34 const std::string& GetSecret() const;
35 const std::string& GetLabel() const;
36
37 void SetLabel(const std::string& label);
38
39 void ClearSecret();
40
41 void Transform(KeyType target_key_type, const std::string& salt);
42
43 private:
44 KeyType key_type_;
45 std::string salt_;
46 std::string secret_;
47 std::string label_;
48 };
49
50 } // namespace chromeos
51
52 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_AUTH_KEY_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/auth/extended_authenticator.cc ('k') | chrome/browser/chromeos/login/auth/key.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698