login_database_win.cc revision 5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7
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 "base/strings/string_util.h"
6#include "components/password_manager/core/browser/login_database.h"
7#include "components/webdata/encryptor/encryptor.h"
8
9LoginDatabase::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;
15}
16
17LoginDatabase::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;
23}
24