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

Side by Side Diff: sync/util/data_encryption_win.cc

Issue 12902030: Make Encryptor a component. Used by //chrome and (soon) //components/webdata. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove duplicate include. Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « components/webdata/encryptor/encryptor_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "sync/util/data_encryption_win.h" 5 #include "sync/util/data_encryption_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <wincrypt.h> 8 #include <wincrypt.h>
9 9
10 #include <cstddef> 10 #include <cstddef>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 13
14 #pragma comment(lib, "crypt32.lib") 14 #pragma comment(lib, "crypt32.lib")
15 15
16 // TODO(akalin): Merge this with similar code in 16 // TODO(akalin): Merge this with similar code in
17 // chrome/browser/password_manager/encryptor_win.cc. Preferably, all 17 // components/webdata/encryptor/encryptor_win.cc. Preferably, all
18 // this stuff would live in crypto/. 18 // this stuff would live in crypto/.
19 19
20 namespace syncer { 20 namespace syncer {
21 21
22 std::vector<uint8> EncryptData(const std::string& data) { 22 std::vector<uint8> EncryptData(const std::string& data) {
23 DATA_BLOB unencrypted_data = { 0 }; 23 DATA_BLOB unencrypted_data = { 0 };
24 unencrypted_data.pbData = (BYTE*)(data.data()); 24 unencrypted_data.pbData = (BYTE*)(data.data());
25 unencrypted_data.cbData = data.size(); 25 unencrypted_data.cbData = data.size();
26 DATA_BLOB encrypted_data = { 0 }; 26 DATA_BLOB encrypted_data = { 0 };
27 27
(...skipping 20 matching lines...) Expand all
48 return false; 48 return false;
49 } else { 49 } else {
50 out_data->assign(reinterpret_cast<const char*>(decrypted_data.pbData), 50 out_data->assign(reinterpret_cast<const char*>(decrypted_data.pbData),
51 decrypted_data.cbData); 51 decrypted_data.cbData);
52 LocalFree(decrypted_data.pbData); 52 LocalFree(decrypted_data.pbData);
53 return true; 53 return true;
54 } 54 }
55 } 55 }
56 56
57 } // namespace syncer 57 } // namespace syncer
OLDNEW
« no previous file with comments | « components/webdata/encryptor/encryptor_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698