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

Side by Side Diff: components/password_manager/core/browser/login_database_mac.cc

Issue 1192493005: Encrypt password values in LoginDatabase on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix win Created 5 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 "components/password_manager/core/browser/login_database.h" 5 #include "components/password_manager/core/browser/login_database.h"
6 6
7 // On the Mac, the LoginDatabase nulls out passwords, so that we can use the 7 #include "components/os_crypt/os_crypt.h"
8 // rest of the database as a suplemental storage system to complement Keychain,
9 // providing storage of fields Keychain doesn't allow.
10 8
11 namespace password_manager { 9 namespace password_manager {
12 10
13 // static 11 // static
14 LoginDatabase::EncryptionResult LoginDatabase::EncryptedString( 12 LoginDatabase::EncryptionResult LoginDatabase::EncryptedString(
15 const base::string16& plain_text, 13 const base::string16& plain_text,
16 std::string* cipher_text) { 14 std::string* cipher_text) {
17 *cipher_text = std::string(); 15 // Handling the empty string shouldn't use the Keychain.
vabr (Chromium) 2015/06/18 13:39:09 It is not clear to me why it is important to menti
vasilii 2015/06/18 14:28:14 The comment is obsolete.
18 return ENCRYPTION_RESULT_SUCCESS; 16 return OSCrypt::EncryptString16(plain_text, cipher_text)
17 ? ENCRYPTION_RESULT_SUCCESS
18 : ENCRYPTION_RESULT_SERVICE_FAILURE;
19 } 19 }
20 20
21 // static 21 // static
22 LoginDatabase::EncryptionResult LoginDatabase::DecryptedString( 22 LoginDatabase::EncryptionResult LoginDatabase::DecryptedString(
23 const std::string& cipher_text, 23 const std::string& cipher_text,
24 base::string16* plain_text) { 24 base::string16* plain_text) {
25 *plain_text = base::string16(); 25 return OSCrypt::DecryptString16(cipher_text, plain_text)
26 return ENCRYPTION_RESULT_SUCCESS; 26 ? ENCRYPTION_RESULT_SUCCESS
27 : ENCRYPTION_RESULT_SERVICE_FAILURE;
27 } 28 }
28 29
29 } // namespace password_manager 30 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698