| 4142 | } |
| 4143 | |
| 4144 | bool WizDatabase::loadDocumentDecryptedData(const QString& strDocumentGUID, QByteArray& arrayData) |
| 4145 | { |
| 4146 | CString strFileName = getDocumentFileName(strDocumentGUID); |
| 4147 | if (!WizPathFileExists(strFileName)) |
| 4148 | return false; |
| 4149 | |
| 4150 | WIZDOCUMENTDATA document; |
| 4151 | if (!documentFromGuid(strDocumentGUID, document)) |
| 4152 | return false; |
| 4153 | |
| 4154 | if (document.nProtected) { |
| 4155 | QString password = getCertPassword(); |
| 4156 | if (password.isEmpty()) |
| 4157 | return false; |
| 4158 | |
| 4159 | QString strDecryptedFileName = Utils::WizPathResolve::tempPath() + document.strGUID + "-decrypted"; |
| 4160 | QFile::remove(strDecryptedFileName); |
| 4161 | |
| 4162 | if (!m_ziwReader->decryptFileToFile(strFileName, strDecryptedFileName)) { |
| 4163 | // force clear usercipher |
| 4164 | WizUserCertPassword::Instance().setPassword(bizGuid(), ""); |
| 4165 | return false; |
| 4166 | } |
| 4167 | // |
| 4168 | return loadFileData(strDecryptedFileName, arrayData); |
| 4169 | // |
| 4170 | } else { |
| 4171 | // |
| 4172 | return loadFileData(strFileName, arrayData); |
| 4173 | } |
| 4174 | } |
| 4175 | |
| 4176 | bool WizDatabase::loadFileData(const QString& strFileName, QByteArray& arrayData) |
| 4177 | { |
no test coverage detected