Commit a61abdd0 authored by ElenaSubbotina's avatar ElenaSubbotina

EcmaCryptReader/Decoder - agile + standart

parent f1f535f9
......@@ -32,6 +32,7 @@
#pragma once
#include "IBinaryReader.h"
#include "../Common/FormatUtils.h"
class MemoryStream: public IBinaryReader
{
......
......@@ -116,8 +116,15 @@ bool COfficeFileFormatChecker::isDocFormatFile (POLE::Storage * storage)
POLE::Stream stream(storage, "WordDocument");
unsigned char buffer[10];
if (stream.read(buffer,10) >0)
if (stream.read(buffer,10) > 0)
{
//ms office 2007 encrypted contains stream WordDocument !!
std::list<std::string> entries = storage->entries("DataSpaces");
if (entries.size() > 0)
return false;
return true;
}
return false;
}
......
This diff is collapsed.
......@@ -50,7 +50,8 @@ namespace CRYPT_METHOD
XOR,
RC4,
AES_CBC,
AES_CFB
AES_CFB,
AES_ECB
};
}
......@@ -60,6 +61,14 @@ public:
struct _cryptData
{
//default ms2010
_cryptData() : cipherAlgorithm(CRYPT_METHOD::AES_CBC), hashAlgorithm(CRYPT_METHOD::SHA1), spinCount(100000),
keySize(0x10), hashSize(0x14), blockSize(0x10), saltSize(0x10), bAgile(true)
//default ms2013/ms2016
//_cryptData(): cipherAlgorithm(CRYPT_METHOD::AES_CBC), hashAlgorithm(CRYPT_METHOD::SHA256), spinCount(100000),
// keySize(0x20), hashSize(0x40), blockSize(0x10), saltSize(0x10), bAgile(true)
{
}
CRYPT_METHOD::_cipherAlgorithm cipherAlgorithm;
CRYPT_METHOD::_hashAlgorithm hashAlgorithm;
......@@ -78,6 +87,8 @@ public:
std::string encryptedHmacKey;
std::string encryptedHmacValue;
bool bAgile;
//..........
};
......@@ -86,8 +97,6 @@ public:
void Decrypt(unsigned char* data, int size, unsigned char*& data_out);
bool IsVerify(){}
bool SetPassword(std::wstring password);
void SetCryptData(_cryptData &data);
......
......@@ -38,29 +38,6 @@ class ECMACryptReader
{
public:
bool DecryptOfficeFile(std::wstring file_name_inp, std::wstring file_name_out, std::wstring password);
struct _keyEncryptor
{
std::string spinCount;
std::string saltSize;
std::string blockSize;
std::string keyBits;
std::string hashSize;
std::string cipherAlgorithm;
std::string cipherChaining;
std::string hashAlgorithm;
std::string saltValue;
std::string encryptedVerifierHashInput;
std::string encryptedVerifierHashValue;
std::string encryptedKeyValue;
};
struct _dataIntegrity
{
std::string encryptedHmacKey;
std::string encryptedHmacValue;
};
struct _refComponent
{
......@@ -72,13 +49,5 @@ public:
std::vector<_refComponent> refComponents;
std::wstring dataSpaceName;
};
private:
bool ReadEncryptionInfo(const std::string & xmlString);
std::vector<_mapEntry> mapEntries;
//--------------------------------------------------------------
_keyEncryptor keyData;
_dataIntegrity dataIntegrity;
std::vector<_keyEncryptor> keyEncryptors;
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment