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

Side by Side Diff: chrome/browser/chromeos/login/supervised/supervised_user_authentication.cc

Issue 2934893003: Deleted redundant SymmetricKey::GetRawKey(). (Closed)
Patch Set: Rebased to fix conflict with ToT. Created 3 years, 6 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
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 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio n.h" 5 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio n.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/json/json_file_value_serializer.h" 8 #include "base/json/json_file_value_serializer.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 29 matching lines...) Expand all
40 char result[kSaltSize]; 40 char result[kSaltSize];
41 crypto::RandBytes(&result, sizeof(result)); 41 crypto::RandBytes(&result, sizeof(result));
42 return base::ToLowerASCII( 42 return base::ToLowerASCII(
43 base::HexEncode(reinterpret_cast<const void*>(result), sizeof(result))); 43 base::HexEncode(reinterpret_cast<const void*>(result), sizeof(result)));
44 } 44 }
45 45
46 std::string BuildRawHMACKey() { 46 std::string BuildRawHMACKey() {
47 std::unique_ptr<crypto::SymmetricKey> key( 47 std::unique_ptr<crypto::SymmetricKey> key(
48 crypto::SymmetricKey::GenerateRandomKey(crypto::SymmetricKey::AES, 48 crypto::SymmetricKey::GenerateRandomKey(crypto::SymmetricKey::AES,
49 kHMACKeySizeInBits)); 49 kHMACKeySizeInBits));
50 std::string raw_result, result; 50 std::string result;
51 key->GetRawKey(&raw_result); 51 base::Base64Encode(key->key(), &result);
52 base::Base64Encode(raw_result, &result);
53 return result; 52 return result;
54 } 53 }
55 54
56 base::DictionaryValue* LoadPasswordData(base::FilePath profile_dir) { 55 base::DictionaryValue* LoadPasswordData(base::FilePath profile_dir) {
57 JSONFileValueDeserializer deserializer( 56 JSONFileValueDeserializer deserializer(
58 profile_dir.Append(kPasswordUpdateFile)); 57 profile_dir.Append(kPasswordUpdateFile));
59 std::string error_message; 58 std::string error_message;
60 int error_code = JSONFileValueDeserializer::JSON_NO_ERROR; 59 int error_code = JSONFileValueDeserializer::JSON_NO_ERROR;
61 std::unique_ptr<base::Value> value = 60 std::unique_ptr<base::Value> value =
62 deserializer.Deserialize(&error_code, &error_message); 61 deserializer.Deserialize(&error_code, &error_message);
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 LOG(FATAL) << "HMAC::Sign failed"; 317 LOG(FATAL) << "HMAC::Sign failed";
319 318
320 std::string raw_result(out_bytes, out_bytes + sizeof(out_bytes)); 319 std::string raw_result(out_bytes, out_bytes + sizeof(out_bytes));
321 320
322 std::string result; 321 std::string result;
323 base::Base64Encode(raw_result, &result); 322 base::Base64Encode(raw_result, &result);
324 return result; 323 return result;
325 } 324 }
326 325
327 } // namespace chromeos 326 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_operation.cc ('k') | chrome/browser/signin/local_auth.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698