• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_IE7_PASSWORD_H_
6 #define CHROME_BROWSER_PASSWORD_MANAGER_IE7_PASSWORD_H_
7 #pragma once
8 
9 #include <windows.h>
10 #include <string>
11 #include <vector>
12 
13 #include "base/basictypes.h"
14 #include "base/time.h"
15 
16 // Contains the information read from the IE7/IE8 Storage2 key in the registry.
17 struct IE7PasswordInfo {
18   // Hash of the url.
19   std::wstring url_hash;
20 
21   // Encrypted data containing the username, password and some more undocumented
22   // fields.
23   std::vector<unsigned char> encrypted_data;
24 
25   // When the login was imported.
26   base::Time date_created;
27 };
28 
29 namespace ie7_password {
30 
31 // Parses a data structure to find the password and the username.
32 bool GetUserPassFromData(const std::vector<unsigned char>& data,
33                          std::wstring* username,
34                          std::wstring* password);
35 
36 // Decrypts the username and password for a given data vector using the url as
37 // the key.
38 bool DecryptPassword(const std::wstring& url,
39                      const std::vector<unsigned char>& data,
40                      std::wstring* username, std::wstring* password);
41 
42 // Returns the hash of a url.
43 std::wstring GetUrlHash(const std::wstring& url);
44 
45 }  // namespace ie7_password
46 
47 #endif  // CHROME_BROWSER_PASSWORD_MANAGER_IE7_PASSWORD_H_
48