Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / components / os_crypt / ie7_password_win.h
blob459fd92ea1efc2a5d5b3ebdbbbce101e4b9ecea5
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.
5 #ifndef COMPONENTS_OS_CRYPT_IE7_PASSWORD_WIN_H_
6 #define COMPONENTS_OS_CRYPT_IE7_PASSWORD_WIN_H_
8 #include <windows.h>
9 #include <string>
10 #include <vector>
12 #include "base/basictypes.h"
13 #include "base/time/time.h"
15 // Contains the information read from the IE7/IE8 Storage2 key in the registry.
16 struct IE7PasswordInfo {
17 // Hash of the url.
18 std::wstring url_hash;
20 // Encrypted data containing the username, password and some more undocumented
21 // fields.
22 std::vector<unsigned char> encrypted_data;
24 // When the login was imported.
25 base::Time date_created;
28 namespace ie7_password {
30 struct DecryptedCredentials {
31 std::wstring username;
32 std::wstring password;
35 // Parses a data structure to find passwords and usernames.
36 // The collection of bytes in |data| is interpreted as a special PasswordEntry
37 // structure. IE saves the login information as a binary dump of this structure.
38 // Credentials extracted from |data| end up in |credentials|.
39 bool GetUserPassFromData(const std::vector<unsigned char>& data,
40 std::vector<DecryptedCredentials>* credentials);
42 // Decrypts usernames and passwords for a given data vector using the url as
43 // the key.
44 // Output ends up in |credentials|.
45 bool DecryptPasswords(const std::wstring& url,
46 const std::vector<unsigned char>& data,
47 std::vector<DecryptedCredentials>* credentials);
49 // Returns the hash of a url.
50 std::wstring GetUrlHash(const std::wstring& url);
52 } // namespace ie7_password
54 #endif // COMPONENTS_OS_CRYPT_IE7_PASSWORD_WIN_H_