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

Side by Side Diff: chrome/browser/importer/nss_decryptor_linux.h

Issue 160077: Linux: Fix NSSDecryptor to import Firefox passwords from the user database correctly. (Closed)
Patch Set: Add comments. Created 11 years, 5 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_LINUX_H_ 5 #ifndef CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_LINUX_H_
6 #define CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_LINUX_H_ 6 #define CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_LINUX_H_
7 7
8 #include <secmodt.h>
8 #include <string> 9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
12 13
13 namespace webkit_glue { 14 namespace webkit_glue {
14 struct PasswordForm; 15 struct PasswordForm;
15 } 16 }
16 17
17 // A wrapper for Firefox NSS decrypt component. 18 // A wrapper for Firefox NSS decrypt component.
18 class NSSDecryptor { 19 class NSSDecryptor {
19 public: 20 public:
20 NSSDecryptor(); 21 NSSDecryptor();
21 ~NSSDecryptor(); 22 ~NSSDecryptor();
22 23
23 // Initializes NSS if it hasn't already been initialized. 24 // Initializes NSS if it hasn't already been initialized.
24 bool Init(const std::wstring& /* dll_path */, 25 bool Init(const std::wstring& /* dll_path */,
25 const std::wstring& /* db_path */); 26 const std::wstring& db_path);
26 27
27 // Decrypts Firefox stored passwords. Before using this method, 28 // Decrypts Firefox stored passwords. Before using this method,
28 // make sure Init() returns true. 29 // make sure Init() returns true.
29 std::wstring Decrypt(const std::string& crypt) const; 30 std::wstring Decrypt(const std::string& crypt) const;
30 31
31 // Parses the Firefox password file content, decrypts the 32 // Parses the Firefox password file content, decrypts the
32 // username/password and reads other related information. 33 // username/password and reads other related information.
33 // The result will be stored in |forms|. 34 // The result will be stored in |forms|.
34 void ParseSignons(const std::string& content, 35 void ParseSignons(const std::string& content,
35 std::vector<webkit_glue::PasswordForm>* forms); 36 std::vector<webkit_glue::PasswordForm>* forms);
36 37
37 private: 38 private:
39 // Does not actually free the slot, since we'll free it when NSSDecryptor is
40 // destroyed.
41 void FreeSlot(PK11SlotInfo* slot) const {};
42 PK11SlotInfo* GetKeySlotForDB() const { return db_slot_; }
43
44 SECStatus PK11SDR_DecryptWithSlot(
45 PK11SlotInfo* slot, SECItem* data, SECItem* result, void* cx) const;
46
38 bool is_nss_initialized_; 47 bool is_nss_initialized_;
48 PK11SlotInfo* db_slot_;
39 49
40 DISALLOW_COPY_AND_ASSIGN(NSSDecryptor); 50 DISALLOW_COPY_AND_ASSIGN(NSSDecryptor);
41 }; 51 };
42 52
43 #endif // CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_LINUX_H_ 53 #endif // CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_LINUX_H_
OLDNEW
« no previous file with comments | « chrome/browser/importer/nss_decryptor.cc ('k') | chrome/browser/importer/nss_decryptor_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698