OLD | NEW |
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_MAC_H_ | 5 #ifndef CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_MAC_H_ |
6 #define CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_MAC_H_ | 6 #define CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_MAC_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 struct PasswordForm; | 107 struct PasswordForm; |
108 } | 108 } |
109 | 109 |
110 // A wrapper for Firefox NSS decrypt component. | 110 // A wrapper for Firefox NSS decrypt component. |
111 class NSSDecryptor { | 111 class NSSDecryptor { |
112 public: | 112 public: |
113 NSSDecryptor() | 113 NSSDecryptor() |
114 : NSS_Init(NULL), NSS_Shutdown(NULL), PK11_GetInternalKeySlot(NULL), | 114 : NSS_Init(NULL), NSS_Shutdown(NULL), PK11_GetInternalKeySlot(NULL), |
115 PK11_CheckUserPassword(NULL), PK11_FreeSlot(NULL), | 115 PK11_CheckUserPassword(NULL), PK11_FreeSlot(NULL), |
116 PK11_Authenticate(NULL), PK11SDR_Decrypt(NULL), SECITEM_FreeItem(NULL), | 116 PK11_Authenticate(NULL), PK11SDR_Decrypt(NULL), SECITEM_FreeItem(NULL), |
117 PL_ArenaFinish(NULL), PR_Cleanup(NULL), | |
118 is_nss_initialized_(false) {} | 117 is_nss_initialized_(false) {} |
119 ~NSSDecryptor() {} | 118 ~NSSDecryptor(); |
120 | 119 |
121 // Initializes NSS if it hasn't already been initialized. | 120 // Initializes NSS if it hasn't already been initialized. |
122 bool Init(const std::wstring& /* dll_path */, | 121 bool Init(const std::wstring& /* dll_path */, |
123 const std::wstring& /* db_path */); | 122 const std::wstring& /* db_path */); |
124 | 123 |
125 // Decrypts Firefox stored passwords. Before using this method, | 124 // Decrypts Firefox stored passwords. Before using this method, |
126 // make sure Init() returns true. | 125 // make sure Init() returns true. |
127 std::wstring Decrypt(const std::string& crypt) const; | 126 std::wstring Decrypt(const std::string& crypt) const; |
128 | 127 |
129 // Parses the Firefox password file content, decrypts the | 128 // Parses the Firefox password file content, decrypts the |
(...skipping 13 matching lines...) Expand all Loading... |
143 | 142 |
144 // Methods in Firefox security components. | 143 // Methods in Firefox security components. |
145 NSSInitFunc NSS_Init; | 144 NSSInitFunc NSS_Init; |
146 NSSShutdownFunc NSS_Shutdown; | 145 NSSShutdownFunc NSS_Shutdown; |
147 PK11GetInternalKeySlotFunc PK11_GetInternalKeySlot; | 146 PK11GetInternalKeySlotFunc PK11_GetInternalKeySlot; |
148 PK11CheckUserPasswordFunc PK11_CheckUserPassword; | 147 PK11CheckUserPasswordFunc PK11_CheckUserPassword; |
149 PK11FreeSlotFunc PK11_FreeSlot; | 148 PK11FreeSlotFunc PK11_FreeSlot; |
150 PK11AuthenticateFunc PK11_Authenticate; | 149 PK11AuthenticateFunc PK11_Authenticate; |
151 PK11SDRDecryptFunc PK11SDR_Decrypt; | 150 PK11SDRDecryptFunc PK11SDR_Decrypt; |
152 SECITEMFreeItemFunc SECITEM_FreeItem; | 151 SECITEMFreeItemFunc SECITEM_FreeItem; |
153 PLArenaFinishFunc PL_ArenaFinish; | |
154 PRCleanupFunc PR_Cleanup; | |
155 | 152 |
156 // Libraries necessary for decrypting the passwords. | 153 // Libraries necessary for decrypting the passwords. |
157 static const wchar_t kNSS3Library[]; | 154 static const wchar_t kNSS3Library[]; |
158 static const wchar_t kSoftokn3Library[]; | |
159 static const wchar_t kPLDS4Library[]; | |
160 static const wchar_t kNSPR4Library[]; | |
161 | 155 |
162 // True if NSS_Init() has been called | 156 // True if NSS_Init() has been called |
163 bool is_nss_initialized_; | 157 bool is_nss_initialized_; |
164 | 158 |
165 DISALLOW_COPY_AND_ASSIGN(NSSDecryptor); | 159 DISALLOW_COPY_AND_ASSIGN(NSSDecryptor); |
166 }; | 160 }; |
167 | 161 |
168 #endif // CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_MAC_H_ | 162 #endif // CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_MAC_H_ |
OLD | NEW |