mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-10 06:07:07 -06:00
4.50 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
7038848692
commit
980e181dcc
@@ -1,12 +1,11 @@
|
||||
// RarAES.cpp
|
||||
// This code is based on UnRar sources
|
||||
// Note: you must include Crypto/AES/MyAES.cpp to project to initialize AES tables
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "RarAES.h"
|
||||
#include "../../Common/MethodId.h"
|
||||
#include "../Hash/Sha1.h"
|
||||
#include "../AES/MyAES.h"
|
||||
|
||||
namespace NCrypto {
|
||||
namespace NRar29 {
|
||||
@@ -77,19 +76,14 @@ STDMETHODIMP CDecoder::CryptoSetPassword(const Byte *data, UInt32 size)
|
||||
STDMETHODIMP CDecoder::Init()
|
||||
{
|
||||
Calculate();
|
||||
if (!_aesFilter)
|
||||
_aesFilter = new CAES_CBC_Decoder;
|
||||
CMyComPtr<ICryptoProperties> cp;
|
||||
RINOK(_aesFilter.QueryInterface(IID_ICryptoProperties, &cp));
|
||||
RINOK(cp->SetKey(aesKey, 16));
|
||||
RINOK(cp->SetInitVector(aesInit, 16));
|
||||
_aesFilter->Init();
|
||||
AesSetKeyDecode(&Aes.aes, aesKey, kRarAesKeySize);
|
||||
AesCbcInit(&Aes, aesInit);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP_(UInt32) CDecoder::Filter(Byte *data, UInt32 size)
|
||||
{
|
||||
return _aesFilter->Filter(data, size);
|
||||
return AesCbcDecode(&Aes, data, size);
|
||||
}
|
||||
|
||||
void CDecoder::Calculate()
|
||||
|
||||
@@ -10,9 +10,16 @@
|
||||
#include "../../ICoder.h"
|
||||
#include "../../IPassword.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "../../../../C/Crypto/Aes.h"
|
||||
}
|
||||
|
||||
namespace NCrypto {
|
||||
namespace NRar29 {
|
||||
|
||||
const kRarAesKeySize = 16;
|
||||
|
||||
class CDecoder:
|
||||
public ICompressFilter,
|
||||
public ICompressSetDecoderProperties2,
|
||||
@@ -22,11 +29,11 @@ class CDecoder:
|
||||
Byte _salt[8];
|
||||
bool _thereIsSalt;
|
||||
CByteBuffer buffer;
|
||||
Byte aesKey[16];
|
||||
Byte aesInit[16];
|
||||
Byte aesKey[kRarAesKeySize];
|
||||
Byte aesInit[AES_BLOCK_SIZE];
|
||||
bool _needCalculate;
|
||||
|
||||
CMyComPtr<ICompressFilter> _aesFilter;
|
||||
CAesCbc Aes;
|
||||
|
||||
bool _rar350Mode;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user