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
3 // found in the LICENSE file.
5 #ifndef CHROME_UTILITY_IMPORTER_NSS_DECRYPTOR_SYSTEM_NSS_H_
6 #define CHROME_UTILITY_IMPORTER_NSS_DECRYPTOR_SYSTEM_NSS_H_
12 #include "base/basictypes.h"
13 #include "base/strings/string16.h"
23 // A wrapper for Firefox NSS decrypt component.
29 // Initializes NSS if it hasn't already been initialized.
30 bool Init(const base::FilePath
& dll_path
, const base::FilePath
& db_path
);
32 // Decrypts Firefox stored passwords. Before using this method,
33 // make sure Init() returns true.
34 base::string16
Decrypt(const std::string
& crypt
) const;
36 // Parses the Firefox password file content, decrypts the
37 // username/password and reads other related information.
38 // The result will be stored in |forms|.
39 void ParseSignons(const std::string
& content
,
40 std::vector
<autofill::PasswordForm
>* forms
);
42 // Reads and parses the Firefox password sqlite db, decrypts the
43 // username/password and reads other related information.
44 // The result will be stored in |forms|.
45 bool ReadAndParseSignons(const base::FilePath
& sqlite_file
,
46 std::vector
<autofill::PasswordForm
>* forms
);
48 // Does not actually free the slot, since we'll free it when NSSDecryptor is
50 void FreeSlot(PK11SlotInfo
* slot
) const {}
51 PK11SlotInfo
* GetKeySlotForDB() const { return db_slot_
; }
53 SECStatus
PK11SDR_DecryptWithSlot(
54 PK11SlotInfo
* slot
, SECItem
* data
, SECItem
* result
, void* cx
) const;
56 bool is_nss_initialized_
;
57 PK11SlotInfo
* db_slot_
;
59 DISALLOW_COPY_AND_ASSIGN(NSSDecryptor
);
62 #endif // CHROME_UTILITY_IMPORTER_NSS_DECRYPTOR_SYSTEM_NSS_H_