MCPcopy Create free account
hub / github.com/altairwei/WizNotePlus / loadDocumentDecryptedData

Method loadDocumentDecryptedData

src/database/WizDatabase.cpp:4144–4174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4142}
4143
4144bool 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
4176bool WizDatabase::loadFileData(const QString& strFileName, QByteArray& arrayData)
4177{

Callers 1

copyDocumentToMethod · 0.80

Calls 4

WizPathFileExistsFunction · 0.85
isEmptyMethod · 0.80
decryptFileToFileMethod · 0.80
setPasswordMethod · 0.45

Tested by

no test coverage detected