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

Unified Diff: chromeos/login/auth/key.cc

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, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/login/auth/key.h ('k') | chromeos/login/auth/key_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/login/auth/key.cc
diff --git a/chromeos/login/auth/key.cc b/chromeos/login/auth/key.cc
index 02733531240edae5b8be37d2c03d00658e8540bc..01c3bcf1ffc89a03b21dc468d4b66b1374a4e01c 100644
--- a/chromeos/login/auth/key.cc
+++ b/chromeos/login/auth/key.cc
@@ -100,6 +100,10 @@ void Key::Transform(KeyType target_key_type, const std::string& salt) {
base::Base64Encode(raw_secret, &secret_);
break;
}
+ case KEY_TYPE_SALTED_SHA256:
+ base::Base64Encode(crypto::SHA256HashString(salt + secret_), &secret_);
+ break;
+
default:
// The resulting key will be sent to cryptohomed. It should always be
// hashed. If hashing fails, crash instead of sending a plain-text key.
« no previous file with comments | « chromeos/login/auth/key.h ('k') | chromeos/login/auth/key_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698