| 4728 | } |
| 4729 | |
| 4730 | bool WizDatabase::extractZiwFileToFolder(const WIZDOCUMENTDATA& document, |
| 4731 | const QString& strFolder) |
| 4732 | { |
| 4733 | CString strZipFileName = getDocumentFileName(document.strGUID); |
| 4734 | if (!WizPathFileExists(strZipFileName)) { |
| 4735 | return false; |
| 4736 | } |
| 4737 | // |
| 4738 | bool isProtected = WizZiwReader::isEncryptedFile(strZipFileName); |
| 4739 | |
| 4740 | if (!isProtected) { |
| 4741 | return WizUnzipFile::extractZip(strZipFileName, strFolder); |
| 4742 | } |
| 4743 | // |
| 4744 | QString password = WizUserCertPassword::Instance().getPassword(bizGuid()); |
| 4745 | if (password.isEmpty()) { |
| 4746 | return false; |
| 4747 | } |
| 4748 | |
| 4749 | QString strDecryptedFileName = Utils::WizPathResolve::tempPath() + document.strGUID + "-decrypted"; |
| 4750 | QFile::remove(strDecryptedFileName); |
| 4751 | |
| 4752 | if (!m_ziwReader->decryptFileToFile(strZipFileName, strDecryptedFileName)) { |
| 4753 | // force clear usercipher |
| 4754 | WizUserCertPassword::Instance().setPassword(bizGuid(), ""); |
| 4755 | return false; |
| 4756 | } |
| 4757 | // |
| 4758 | return WizUnzipFile::extractZip(strDecryptedFileName, strFolder); |
| 4759 | } |
| 4760 | |
| 4761 | bool WizDatabase::encryptDocument(WIZDOCUMENTDATA& document) |
| 4762 | { |
nothing calls this directly
no test coverage detected