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 3// found in the LICENSE file. 4 5#include "components/password_manager/core/browser/login_database.h" 6 7#include "base/strings/string_util.h" 8#include "components/os_crypt/os_crypt.h" 9 10namespace password_manager { 11 12LoginDatabase::EncryptionResult LoginDatabase::EncryptedString( 13 const base::string16& plain_text, 14 std::string* cipher_text) const { 15 if (OSCrypt::EncryptString16(plain_text, cipher_text)) 16 return ENCRYPTION_RESULT_SUCCESS; 17 return ENCRYPTION_RESULT_ITEM_FAILURE; 18} 19 20LoginDatabase::EncryptionResult LoginDatabase::DecryptedString( 21 const std::string& cipher_text, 22 base::string16* plain_text) const { 23 if (OSCrypt::DecryptString16(cipher_text, plain_text)) 24 return ENCRYPTION_RESULT_SUCCESS; 25 return ENCRYPTION_RESULT_ITEM_FAILURE; 26} 27 28} // namespace password_manager 29