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

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

Issue 515153002: Add new Chrome OS key type: Salted SHA256 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@d_2_367847_add_get_key_data_ex_call
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | chromeos/login/auth/key.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4
5 #ifndef CHROMEOS_LOGIN_AUTH_KEY_H_ 5 #ifndef CHROMEOS_LOGIN_AUTH_KEY_H_
6 #define CHROMEOS_LOGIN_AUTH_KEY_H_ 6 #define CHROMEOS_LOGIN_AUTH_KEY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "chromeos/chromeos_export.h" 10 #include "chromeos/chromeos_export.h"
11 11
12 namespace chromeos { 12 namespace chromeos {
13 13
14 // Key for user authentication. The class supports hashing of plain text 14 // Key for user authentication. The class supports hashing of plain text
15 // passwords to generate keys as well as the use of pre-hashed keys. 15 // passwords to generate keys as well as the use of pre-hashed keys.
16 class CHROMEOS_EXPORT Key { 16 class CHROMEOS_EXPORT Key {
17 public: 17 public:
18 enum KeyType { 18 enum KeyType {
19 // Plain text password. 19 // Plain text password.
20 KEY_TYPE_PASSWORD_PLAIN, 20 KEY_TYPE_PASSWORD_PLAIN = 0,
21 // SHA256 of salt + password, first half only, lower-case hex encoded. 21 // SHA256 of salt + password, first half only, lower-case hex encoded.
22 KEY_TYPE_SALTED_SHA256_TOP_HALF, 22 KEY_TYPE_SALTED_SHA256_TOP_HALF = 1,
23 // PBKDF2 with 256 bit AES and 1234 iterations, base64 encoded. 23 // PBKDF2 with 256 bit AES and 1234 iterations, base64 encoded.
24 KEY_TYPE_SALTED_PBKDF2_AES256_1234, 24 KEY_TYPE_SALTED_PBKDF2_AES256_1234 = 2,
25 // SHA256 of salt + password, base64 encoded.
26 KEY_TYPE_SALTED_SHA256 = 3,
27
28 // Sentinel. Must be last.
29 KEY_TYPE_COUNT
25 }; 30 };
26 31
27 Key(); 32 Key();
28 Key(const Key& other); 33 Key(const Key& other);
29 explicit Key(const std::string& plain_text_password); 34 explicit Key(const std::string& plain_text_password);
30 Key(KeyType key_type, const std::string& salt, const std::string& secret); 35 Key(KeyType key_type, const std::string& salt, const std::string& secret);
31 ~Key(); 36 ~Key();
32 37
33 bool operator==(const Key& other) const; 38 bool operator==(const Key& other) const;
34 39
(...skipping 10 matching lines...) Expand all
45 private: 50 private:
46 KeyType key_type_; 51 KeyType key_type_;
47 std::string salt_; 52 std::string salt_;
48 std::string secret_; 53 std::string secret_;
49 std::string label_; 54 std::string label_;
50 }; 55 };
51 56
52 } // namespace chromeos 57 } // namespace chromeos
53 58
54 #endif // CHROMEOS_LOGIN_AUTH_KEY_H_ 59 #endif // CHROMEOS_LOGIN_AUTH_KEY_H_
OLDNEW
« no previous file with comments | « no previous file | chromeos/login/auth/key.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698