| OLD | NEW |
| 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_IMPORTER_NSS_DECRYPTOR_WIN_H_ | 5 #ifndef CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_WIN_H_ |
| 6 #define CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_WIN_H_ | 6 #define CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_WIN_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 // A wrapper for Firefox NSS decrypt component. | 111 // A wrapper for Firefox NSS decrypt component. |
| 112 class NSSDecryptor { | 112 class NSSDecryptor { |
| 113 public: | 113 public: |
| 114 NSSDecryptor(); | 114 NSSDecryptor(); |
| 115 ~NSSDecryptor(); | 115 ~NSSDecryptor(); |
| 116 | 116 |
| 117 // Loads NSS3 library and returns true if successful. | 117 // Loads NSS3 library and returns true if successful. |
| 118 // |dll_path| indicates the location of NSS3 DLL files, and |db_path| | 118 // |dll_path| indicates the location of NSS3 DLL files, and |db_path| |
| 119 // is the location of the database file that stores the keys. | 119 // is the location of the database file that stores the keys. |
| 120 bool Init(const FilePath& dll_path, const FilePath& db_path); | 120 bool Init(const base::FilePath& dll_path, const base::FilePath& db_path); |
| 121 | 121 |
| 122 // Frees the libraries. | 122 // Frees the libraries. |
| 123 void Free(); | 123 void Free(); |
| 124 | 124 |
| 125 // Decrypts Firefox stored passwords. Before using this method, | 125 // Decrypts Firefox stored passwords. Before using this method, |
| 126 // make sure Init() returns true. | 126 // make sure Init() returns true. |
| 127 string16 Decrypt(const std::string& crypt) const; | 127 string16 Decrypt(const std::string& crypt) const; |
| 128 | 128 |
| 129 // Parses the Firefox password file content, decrypts the | 129 // Parses the Firefox password file content, decrypts the |
| 130 // username/password and reads other related information. | 130 // username/password and reads other related information. |
| 131 // The result will be stored in |forms|. | 131 // The result will be stored in |forms|. |
| 132 void ParseSignons(const std::string& content, | 132 void ParseSignons(const std::string& content, |
| 133 std::vector<content::PasswordForm>* forms); | 133 std::vector<content::PasswordForm>* forms); |
| 134 | 134 |
| 135 // Reads and parses the Firefox password sqlite db, decrypts the | 135 // Reads and parses the Firefox password sqlite db, decrypts the |
| 136 // username/password and reads other related information. | 136 // username/password and reads other related information. |
| 137 // The result will be stored in |forms|. | 137 // The result will be stored in |forms|. |
| 138 bool ReadAndParseSignons(const FilePath& sqlite_file, | 138 bool ReadAndParseSignons(const base::FilePath& sqlite_file, |
| 139 std::vector<content::PasswordForm>* forms); | 139 std::vector<content::PasswordForm>* forms); |
| 140 | 140 |
| 141 private: | 141 private: |
| 142 // Call NSS initialization funcs. | 142 // Call NSS initialization funcs. |
| 143 bool InitNSS(const FilePath& db_path, | 143 bool InitNSS(const base::FilePath& db_path, |
| 144 base::NativeLibrary plds4_dll, | 144 base::NativeLibrary plds4_dll, |
| 145 base::NativeLibrary nspr4_dll); | 145 base::NativeLibrary nspr4_dll); |
| 146 | 146 |
| 147 PK11SlotInfo* GetKeySlotForDB() const { return PK11_GetInternalKeySlot(); } | 147 PK11SlotInfo* GetKeySlotForDB() const { return PK11_GetInternalKeySlot(); } |
| 148 void FreeSlot(PK11SlotInfo* slot) const { PK11_FreeSlot(slot); } | 148 void FreeSlot(PK11SlotInfo* slot) const { PK11_FreeSlot(slot); } |
| 149 | 149 |
| 150 // Methods in Firefox security components. | 150 // Methods in Firefox security components. |
| 151 NSSInitFunc NSS_Init; | 151 NSSInitFunc NSS_Init; |
| 152 NSSShutdownFunc NSS_Shutdown; | 152 NSSShutdownFunc NSS_Shutdown; |
| 153 PK11GetInternalKeySlotFunc PK11_GetInternalKeySlot; | 153 PK11GetInternalKeySlotFunc PK11_GetInternalKeySlot; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 169 base::NativeLibrary nss3_dll_; | 169 base::NativeLibrary nss3_dll_; |
| 170 base::NativeLibrary softokn3_dll_; | 170 base::NativeLibrary softokn3_dll_; |
| 171 | 171 |
| 172 // True if NSS_Init() has been called | 172 // True if NSS_Init() has been called |
| 173 bool is_nss_initialized_; | 173 bool is_nss_initialized_; |
| 174 | 174 |
| 175 DISALLOW_COPY_AND_ASSIGN(NSSDecryptor); | 175 DISALLOW_COPY_AND_ASSIGN(NSSDecryptor); |
| 176 }; | 176 }; |
| 177 | 177 |
| 178 #endif // CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_WIN_H_ | 178 #endif // CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_WIN_H_ |
| OLD | NEW |