mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
.
This commit is contained in:
@ -747,8 +747,10 @@ bool ECMADecryptor::CheckDataIntegrity(unsigned char* data, int size)
|
||||
return (hmac == expected);
|
||||
}
|
||||
|
||||
void ECMADecryptor::Decrypt(unsigned char* data_inp, int size, unsigned char*& data_out, unsigned long start_iv_block)
|
||||
void ECMADecryptor::Decrypt(unsigned char* data_inp, int size, unsigned char*& data_out, unsigned long start_iv_block)
|
||||
{
|
||||
if (!data_inp || size < 0) return;
|
||||
|
||||
data_out = new unsigned char[size];
|
||||
|
||||
_buf pPassword (password);
|
||||
|
||||
@ -1084,18 +1084,18 @@ bool ECMACryptFile::DecryptOfficeFile(const std::wstring &file_name_inp, const s
|
||||
unsigned char* data = new unsigned char[lengthRead];
|
||||
unsigned char* data_out = NULL;
|
||||
|
||||
int readTrue = pStream->read(data, lengthRead);
|
||||
int readData = readTrue - 8;
|
||||
_UINT64 readTrue = pStream->read(data, lengthRead);
|
||||
_UINT64 readData = readTrue - 8;
|
||||
|
||||
lengthData = *((_UINT64*)data);
|
||||
lengthData = (std::min)(*((_UINT64*)data), readData);
|
||||
|
||||
decryptor.Decrypt(data + 8, readData, data_out, 0);//todoo сделать покусочное чтение декриптование
|
||||
decryptor.Decrypt(data + 8, (int)readData, data_out, 0);
|
||||
|
||||
if (data_out)
|
||||
{
|
||||
NSFile::CFileBinary f;
|
||||
f.CreateFileW(file_name_out);
|
||||
f.WriteFile(data_out, (std::min)((int)lengthData, readData));
|
||||
f.WriteFile(data_out, lengthData);
|
||||
f.CloseFile();
|
||||
|
||||
delete []data_out;
|
||||
|
||||
Reference in New Issue
Block a user