OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/password_manager/encryptor.h" | 5 #include "components/webdata/encryptor/encryptor.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <wincrypt.h> | 8 #include <wincrypt.h> |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 | 10 |
11 #pragma comment(lib, "crypt32.lib") | 11 #pragma comment(lib, "crypt32.lib") |
12 | 12 |
13 bool Encryptor::EncryptString16(const string16& plaintext, | 13 bool Encryptor::EncryptString16(const string16& plaintext, |
14 std::string* ciphertext) { | 14 std::string* ciphertext) { |
15 return EncryptString(UTF16ToUTF8(plaintext), ciphertext); | 15 return EncryptString(UTF16ToUTF8(plaintext), ciphertext); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 DATA_BLOB output; | 56 DATA_BLOB output; |
57 BOOL result = CryptUnprotectData(&input, NULL, NULL, NULL, NULL, | 57 BOOL result = CryptUnprotectData(&input, NULL, NULL, NULL, NULL, |
58 0, &output); | 58 0, &output); |
59 if (!result) | 59 if (!result) |
60 return false; | 60 return false; |
61 | 61 |
62 plaintext->assign(reinterpret_cast<char*>(output.pbData), output.cbData); | 62 plaintext->assign(reinterpret_cast<char*>(output.pbData), output.cbData); |
63 LocalFree(output.pbData); | 63 LocalFree(output.pbData); |
64 return true; | 64 return true; |
65 } | 65 } |
OLD | NEW |