1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/strings/string_util.h"
6 #include "chrome/browser/password_manager/login_database.h"
7 #include "components/webdata/encryptor/encryptor.h"
9 LoginDatabase::EncryptionResult
LoginDatabase::EncryptedString(
10 const base::string16
& plain_text
,
11 std::string
* cipher_text
) const {
12 if (Encryptor::EncryptString16(plain_text
, cipher_text
))
13 return ENCRYPTION_RESULT_SUCCESS
;
14 return ENCRYPTION_RESULT_ITEM_FAILURE
;
17 LoginDatabase::EncryptionResult
LoginDatabase::DecryptedString(
18 const std::string
& cipher_text
,
19 base::string16
* plain_text
) const {
20 if (Encryptor::DecryptString16(cipher_text
, plain_text
))
21 return ENCRYPTION_RESULT_SUCCESS
;
22 return ENCRYPTION_RESULT_ITEM_FAILURE
;