UnRAR: Allow using key and IV instead of password

pull/2542/head
philsmd 4 years ago
parent 007913dfa7
commit be4e3df01b
No known key found for this signature in database
GPG Key ID: 4F25D016D9D6A8AF

@ -91,6 +91,11 @@ bool CryptData::SetCryptKeys(bool Encrypt,CRYPT_METHOD Method,
return true;
}
void CryptData::SetRijndalDecryptKey(byte *Key,byte *InitV)
{
CryptData::Method=CRYPT_RAR30;
rin.Init(false,Key,128,InitV);
}
// Use the current system time to additionally randomize data.
static void TimeRandomize(byte *RndBuf,size_t BufSize)

@ -81,6 +81,7 @@ class CryptData
bool SetCryptKeys(bool Encrypt,CRYPT_METHOD Method,SecPassword *Password,
const byte *Salt,const byte *InitV,uint Lg2Cnt,
byte *HashKey,byte *PswCheck);
void SetRijndalDecryptKey(byte *Key,byte *InitV);
void SetAV15Encryption();
void SetCmt13Encryption();
void EncryptBlock(byte *Buf,size_t Size);

@ -292,6 +292,13 @@ void ComprDataIO::SetEncryption(bool Encrypt,CRYPT_METHOD Method,
#endif
}
void ComprDataIO::InitRijindal(byte *Key,byte *InitV)
{
#ifndef RAR_NOCRYPT
Decryption=true;
Decrypt->SetRijndalDecryptKey(Key,InitV);
#endif
}
#if !defined(SFX_MODULE) && !defined(RAR_NOCRYPT)
void ComprDataIO::SetAV15Encryption()

@ -70,6 +70,7 @@ class ComprDataIO
void SetSubHeader(FileHeader *hd,int64 *Pos) {SubHead=hd;SubHeadPos=Pos;}
void SetEncryption(bool Encrypt,CRYPT_METHOD Method,SecPassword *Password,
const byte *Salt,const byte *InitV,uint Lg2Cnt,byte *HashKey,byte *PswCheck);
void InitRijindal(byte *Key,byte *InitV);
void SetAV15Encryption();
void SetCmt13Encryption();
void SetUnpackToMemory(byte *Addr,uint Size);

Loading…
Cancel
Save