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

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

Issue 1279123004: Replace ToLower calls to the new format (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 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.h" 10 #include "base/metrics/histogram.h"
(...skipping 22 matching lines...) Expand all
33 // Size of key signature. 33 // Size of key signature.
34 const unsigned kHMACKeySizeInBits = 256; 34 const unsigned kHMACKeySizeInBits = 256;
35 const int kSignatureLength = 32; 35 const int kSignatureLength = 32;
36 36
37 // Size of master key (in bytes). 37 // Size of master key (in bytes).
38 const int kMasterKeySize = 32; 38 const int kMasterKeySize = 32;
39 39
40 std::string CreateSalt() { 40 std::string CreateSalt() {
41 char result[kSaltSize]; 41 char result[kSaltSize];
42 crypto::RandBytes(&result, sizeof(result)); 42 crypto::RandBytes(&result, sizeof(result));
43 return base::StringToLowerASCII(base::HexEncode( 43 return base::ToLowerASCII(
44 reinterpret_cast<const void*>(result), 44 base::HexEncode(reinterpret_cast<const void*>(result), sizeof(result)));
45 sizeof(result)));
46 } 45 }
47 46
48 std::string BuildRawHMACKey() { 47 std::string BuildRawHMACKey() {
49 scoped_ptr<crypto::SymmetricKey> key(crypto::SymmetricKey::GenerateRandomKey( 48 scoped_ptr<crypto::SymmetricKey> key(crypto::SymmetricKey::GenerateRandomKey(
50 crypto::SymmetricKey::AES, kHMACKeySizeInBits)); 49 crypto::SymmetricKey::AES, kHMACKeySizeInBits));
51 std::string raw_result, result; 50 std::string raw_result, result;
52 key->GetRawKey(&raw_result); 51 key->GetRawKey(&raw_result);
53 base::Base64Encode(raw_result, &result); 52 base::Base64Encode(raw_result, &result);
54 return result; 53 return result;
55 } 54 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 base64_signature_key); 156 base64_signature_key);
158 return true; 157 return true;
159 } 158 }
160 NOTREACHED(); 159 NOTREACHED();
161 return false; 160 return false;
162 } 161 }
163 162
164 std::string SupervisedUserAuthentication::GenerateMasterKey() { 163 std::string SupervisedUserAuthentication::GenerateMasterKey() {
165 char master_key_bytes[kMasterKeySize]; 164 char master_key_bytes[kMasterKeySize];
166 crypto::RandBytes(&master_key_bytes, sizeof(master_key_bytes)); 165 crypto::RandBytes(&master_key_bytes, sizeof(master_key_bytes));
167 return base::StringToLowerASCII( 166 return base::ToLowerASCII(
168 base::HexEncode(reinterpret_cast<const void*>(master_key_bytes), 167 base::HexEncode(reinterpret_cast<const void*>(master_key_bytes),
169 sizeof(master_key_bytes))); 168 sizeof(master_key_bytes)));
170 } 169 }
171 170
172 void SupervisedUserAuthentication::StorePasswordData( 171 void SupervisedUserAuthentication::StorePasswordData(
173 const std::string& user_id, 172 const std::string& user_id,
174 const base::DictionaryValue& password_data) { 173 const base::DictionaryValue& password_data) {
175 base::DictionaryValue holder; 174 base::DictionaryValue holder;
176 owner_->GetPasswordInformation(user_id, &holder); 175 owner_->GetPasswordInformation(user_id, &holder);
177 const base::Value* value; 176 const base::Value* value;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 LOG(FATAL) << "HMAC::Sign failed"; 316 LOG(FATAL) << "HMAC::Sign failed";
318 317
319 std::string raw_result(out_bytes, out_bytes + sizeof(out_bytes)); 318 std::string raw_result(out_bytes, out_bytes + sizeof(out_bytes));
320 319
321 std::string result; 320 std::string result;
322 base::Base64Encode(raw_result, &result); 321 base::Base64Encode(raw_result, &result);
323 return result; 322 return result;
324 } 323 }
325 324
326 } // namespace chromeos 325 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698