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

Side by Side Diff: components/autofill/browser/crypto/rc4_decryptor.h

Issue 12434004: Move remaining Autofill code to //components/autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix long lines 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_AUTOFILL_CRYPTO_RC4_DECRYPTOR_H_ 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_CRYPTO_RC4_DECRYPTOR_H_
6 #define CHROME_BROWSER_AUTOFILL_CRYPTO_RC4_DECRYPTOR_H_ 6 #define COMPONENTS_AUTOFILL_BROWSER_CRYPTO_RC4_DECRYPTOR_H_
7 7
8 #include <string> 8 #include <string>
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 11
12 // This is modified RC4 decryption used for import of Toolbar autofill data 12 // This is modified RC4 decryption used for import of Toolbar autofill data
13 // only. The difference from the Crypto Api implementation is twofold: 13 // only. The difference from the Crypto Api implementation is twofold:
14 // First, it uses a non-standard key size (160 bit), not supported by Microsoft 14 // First, it uses a non-standard key size (160 bit), not supported by Microsoft
15 // (it supports only 40 and 128 bit for RC4). Second, it codes 128 words with 15 // (it supports only 40 and 128 bit for RC4). Second, it codes 128 words with
16 // value 0x0020 at the beginning of the code to enhance security. 16 // value 0x0020 at the beginning of the code to enhance security.
17 // This class used in chrome/browser/autofill/autofill_ie_toolbar_import_win.cc. 17 //
18 // This class used in
19 // components/autofill/browser/autofill_ie_toolbar_import_win.cc.
20 //
18 // This class should not be used anywhere else!!! 21 // This class should not be used anywhere else!!!
19 class RC4Decryptor { 22 class RC4Decryptor {
20 public: 23 public:
21 explicit RC4Decryptor(wchar_t const* password) { 24 explicit RC4Decryptor(wchar_t const* password) {
22 PrepareKey(reinterpret_cast<const uint8 *>(password), 25 PrepareKey(reinterpret_cast<const uint8 *>(password),
23 wcslen(password) * sizeof(wchar_t)); 26 wcslen(password) * sizeof(wchar_t));
24 std::wstring data; 27 std::wstring data;
25 // First 128 bytes should be spaces. 28 // First 128 bytes should be spaces.
26 data.resize(128, L' '); 29 data.resize(128, L' ');
27 Run(data.c_str()); 30 Run(data.c_str());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 xor_index = (state[x] + state[y]) % kKeyDataSize; 96 xor_index = (state[x] + state[y]) % kKeyDataSize;
94 buffer[counter] ^= state[xor_index]; 97 buffer[counter] ^= state[xor_index];
95 } 98 }
96 key_.x = x; 99 key_.x = x;
97 key_.y = y; 100 key_.y = y;
98 } 101 }
99 102
100 Rc4Key key_; 103 Rc4Key key_;
101 }; 104 };
102 105
103 #endif // CHROME_BROWSER_AUTOFILL_CRYPTO_RC4_DECRYPTOR_H_ 106 #endif // COMPONENTS_AUTOFILL_BROWSER_CRYPTO_RC4_DECRYPTOR_H_
OLDNEW
« no previous file with comments | « components/autofill/browser/credit_card_unittest.cc ('k') | components/autofill/browser/data_driven_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698