| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 NSSDecryptor() | 112 NSSDecryptor() |
| 113 : NSS_Init(NULL), NSS_Shutdown(NULL), PK11_GetInternalKeySlot(NULL), | 113 : NSS_Init(NULL), NSS_Shutdown(NULL), PK11_GetInternalKeySlot(NULL), |
| 114 PK11_CheckUserPassword(NULL), PK11_FreeSlot(NULL), | 114 PK11_CheckUserPassword(NULL), PK11_FreeSlot(NULL), |
| 115 PK11_Authenticate(NULL), PK11SDR_Decrypt(NULL), SECITEM_FreeItem(NULL), | 115 PK11_Authenticate(NULL), PK11SDR_Decrypt(NULL), SECITEM_FreeItem(NULL), |
| 116 PL_ArenaFinish(NULL), PR_Cleanup(NULL), | 116 PL_ArenaFinish(NULL), PR_Cleanup(NULL), |
| 117 is_nss_initialized_(false) {} | 117 is_nss_initialized_(false) {} |
| 118 ~NSSDecryptor() {} | 118 ~NSSDecryptor() {} |
| 119 | 119 |
| 120 // Initializes NSS if it hasn't already been initialized. | 120 // Initializes NSS if it hasn't already been initialized. |
| 121 bool Init(const std::wstring& /* dll_path */, | 121 bool Init(const std::wstring& /* dll_path */, |
| 122 const std::wstring& /* db_path */) { | 122 const std::wstring& /* db_path */); |
| 123 // TODO(port): Load the NSS libraries and call InitNSS() | |
| 124 // http://code.google.com/p/chromium/issues/detail?id=15455 | |
| 125 NOTIMPLEMENTED(); | |
| 126 return false; | |
| 127 } | |
| 128 | 123 |
| 129 // Decrypts Firefox stored passwords. Before using this method, | 124 // Decrypts Firefox stored passwords. Before using this method, |
| 130 // make sure Init() returns true. | 125 // make sure Init() returns true. |
| 131 std::wstring Decrypt(const std::string& crypt) const; | 126 std::wstring Decrypt(const std::string& crypt) const; |
| 132 | 127 |
| 133 // Parses the Firefox password file content, decrypts the | 128 // Parses the Firefox password file content, decrypts the |
| 134 // username/password and reads other related information. | 129 // username/password and reads other related information. |
| 135 // The result will be stored in |forms|. | 130 // The result will be stored in |forms|. |
| 136 void ParseSignons(const std::string& content, | 131 void ParseSignons(const std::string& content, |
| 137 std::vector<webkit_glue::PasswordForm>* forms); | 132 std::vector<webkit_glue::PasswordForm>* forms); |
| 138 | 133 |
| 139 private: | 134 private: |
| 140 PK11SlotInfo* GetKeySlotForDB() const { return PK11_GetInternalKeySlot(); } | 135 PK11SlotInfo* GetKeySlotForDB() const { return PK11_GetInternalKeySlot(); } |
| 141 void FreeSlot(PK11SlotInfo* slot) const { PK11_FreeSlot(slot); } | 136 void FreeSlot(PK11SlotInfo* slot) const { PK11_FreeSlot(slot); } |
| 142 | 137 |
| 143 // Methods in Firefox security components. | 138 // Methods in Firefox security components. |
| 144 NSSInitFunc NSS_Init; | 139 NSSInitFunc NSS_Init; |
| 145 NSSShutdownFunc NSS_Shutdown; | 140 NSSShutdownFunc NSS_Shutdown; |
| 146 PK11GetInternalKeySlotFunc PK11_GetInternalKeySlot; | 141 PK11GetInternalKeySlotFunc PK11_GetInternalKeySlot; |
| 147 PK11CheckUserPasswordFunc PK11_CheckUserPassword; | 142 PK11CheckUserPasswordFunc PK11_CheckUserPassword; |
| 148 PK11FreeSlotFunc PK11_FreeSlot; | 143 PK11FreeSlotFunc PK11_FreeSlot; |
| 149 PK11AuthenticateFunc PK11_Authenticate; | 144 PK11AuthenticateFunc PK11_Authenticate; |
| 150 PK11SDRDecryptFunc PK11SDR_Decrypt; | 145 PK11SDRDecryptFunc PK11SDR_Decrypt; |
| 151 SECITEMFreeItemFunc SECITEM_FreeItem; | 146 SECITEMFreeItemFunc SECITEM_FreeItem; |
| 152 PLArenaFinishFunc PL_ArenaFinish; | 147 PLArenaFinishFunc PL_ArenaFinish; |
| 153 PRCleanupFunc PR_Cleanup; | 148 PRCleanupFunc PR_Cleanup; |
| 154 | 149 |
| 150 // Libraries necessary for decrypting the passwords. |
| 151 static const wchar_t kNSS3Library[]; |
| 152 static const wchar_t kSoftokn3Library[]; |
| 153 static const wchar_t kPLDS4Library[]; |
| 154 static const wchar_t kNSPR4Library[]; |
| 155 |
| 155 // True if NSS_Init() has been called | 156 // True if NSS_Init() has been called |
| 156 bool is_nss_initialized_; | 157 bool is_nss_initialized_; |
| 157 | 158 |
| 158 DISALLOW_COPY_AND_ASSIGN(NSSDecryptor); | 159 DISALLOW_COPY_AND_ASSIGN(NSSDecryptor); |
| 159 }; | 160 }; |
| 160 | 161 |
| 161 #endif // CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_MAC_H_ | 162 #endif // CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_MAC_H_ |
| OLD | NEW |