Roll src/third_party/WebKit f298044:aa8346d (svn 202628:202629)
[chromium-blink-merge.git] / components / os_crypt / ie7_password_win.h
blob5babae38978e839451df9ebe15d2db36e6c408a3
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 IE7PasswordInfo();
18 ~IE7PasswordInfo();
20 // Hash of the url.
21 std::wstring url_hash;
23 // Encrypted data containing the username, password and some more undocumented
24 // fields.
25 std::vector<unsigned char> encrypted_data;
27 // When the login was imported.
28 base::Time date_created;
31 namespace ie7_password {
33 struct DecryptedCredentials {
34 std::wstring username;
35 std::wstring password;
38 // Parses a data structure to find passwords and usernames.
39 // The collection of bytes in |data| is interpreted as a special PasswordEntry
40 // structure. IE saves the login information as a binary dump of this structure.
41 // Credentials extracted from |data| end up in |credentials|.
42 bool GetUserPassFromData(const std::vector<unsigned char>& data,
43 std::vector<DecryptedCredentials>* credentials);
45 // Decrypts usernames and passwords for a given data vector using the url as
46 // the key.
47 // Output ends up in |credentials|.
48 bool DecryptPasswords(const std::wstring& url,
49 const std::vector<unsigned char>& data,
50 std::vector<DecryptedCredentials>* credentials);
52 // Returns the hash of a url.
53 std::wstring GetUrlHash(const std::wstring& url);
55 } // namespace ie7_password
57 #endif // COMPONENTS_OS_CRYPT_IE7_PASSWORD_WIN_H_