mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
.
This commit is contained in:
@ -1140,6 +1140,8 @@ int ECMAEncryptor::Encrypt(unsigned char* data_inp_ptr, int size, unsigned char*
|
||||
unsigned char* data_inp = data_inp_ptr;
|
||||
unsigned char* data_out = data_out_ptr + 8;
|
||||
|
||||
int result_size_out = 0;
|
||||
|
||||
if (cryptData.bAgile)
|
||||
{
|
||||
_buf pBlockKey ((unsigned char*)encrKeyValueBlockKey, 8);
|
||||
@ -1204,7 +1206,7 @@ int ECMAEncryptor::Encrypt(unsigned char* data_inp_ptr, int size, unsigned char*
|
||||
|
||||
enc_size += sz; i++;
|
||||
}
|
||||
return enc_size + 8;
|
||||
result_size_out = enc_size + 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1221,8 +1223,9 @@ int ECMAEncryptor::Encrypt(unsigned char* data_inp_ptr, int size, unsigned char*
|
||||
|
||||
EncryptCipher(hashKey, empty, pInp, pOut, cryptData.cipherAlgorithm/*, StreamTransformationFilter::ZEROS_PADDING*/);
|
||||
|
||||
return size_out + 8;
|
||||
result_size_out = size_out + 8;
|
||||
}
|
||||
return result_size_out;
|
||||
}
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
ODFDecryptor::ODFDecryptor()
|
||||
|
||||
@ -725,7 +725,7 @@ bool ECMACryptFile::EncryptOfficeFile(const std::wstring &file_name_inp, const s
|
||||
_UINT64 lengthFileSize = file.GetFileSize();
|
||||
DWORD lengthData = lengthFileSize, lengthDataRead = 0 ;
|
||||
|
||||
unsigned char* data = new unsigned char[lengthData];
|
||||
unsigned char* data = new unsigned char[lengthData];
|
||||
unsigned char* data_out = NULL;
|
||||
|
||||
file.ReadFile(data, lengthData, lengthDataRead);
|
||||
@ -734,9 +734,10 @@ bool ECMACryptFile::EncryptOfficeFile(const std::wstring &file_name_inp, const s
|
||||
|
||||
lengthData = cryptor.Encrypt(data, lengthData, data_out);
|
||||
|
||||
delete[]data; data = NULL;
|
||||
|
||||
if (NULL == data_out)
|
||||
{
|
||||
delete []data;
|
||||
return false;
|
||||
}
|
||||
cryptor.UpdateDataIntegrity(data_out, lengthData);
|
||||
@ -910,7 +911,7 @@ bool ECMACryptFile::EncryptOfficeFile(const std::wstring &file_name_inp, const s
|
||||
//
|
||||
// if (decryptor.SetPassword(password))
|
||||
// {
|
||||
// unsigned char* data_out2 = NULL;
|
||||
// unsigned char* data_out2 = NULL;
|
||||
// decryptor.Decrypt(data_out, lengthData, data_out2, 0);
|
||||
//
|
||||
// bool bDataIntegrity = decryptor.CheckDataIntegrity(data_out, lengthData);
|
||||
@ -1029,7 +1030,7 @@ bool ECMACryptFile::DecryptOfficeFile(const std::wstring &file_name_inp, const s
|
||||
{
|
||||
_UINT64 lengthData, lengthRead = pStream->size();
|
||||
|
||||
unsigned char* data = new unsigned char[lengthRead];
|
||||
unsigned char* data = new unsigned char[lengthRead];
|
||||
unsigned char* data_out = NULL;
|
||||
|
||||
int readTrue = pStream->read(data, lengthRead);
|
||||
|
||||
Reference in New Issue
Block a user