Check USB device path access when prompting users to select a device.
[chromium-blink-merge.git] / chrome / utility / importer / nss_decryptor_system_nss.h
blob23ad3c9906157fc302636f8c8575c77e40eeba3c
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_
8 #include <secmodt.h>
9 #include <string>
10 #include <vector>
12 #include "base/basictypes.h"
13 #include "base/strings/string16.h"
15 namespace autofill {
16 struct PasswordForm;
19 namespace base {
20 class FilePath;
23 // A wrapper for Firefox NSS decrypt component.
24 class NSSDecryptor {
25 public:
26 NSSDecryptor();
27 ~NSSDecryptor();
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);
47 private:
48 // Does not actually free the slot, since we'll free it when NSSDecryptor is
49 // destroyed.
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_