view src/win32/7zip/7z/CPP/7zip/Crypto/RarAes.h @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
line wrap: on
line source
1 // Crypto/RarAes.h
3 #ifndef __CRYPTO_RAR_AES_H
4 #define __CRYPTO_RAR_AES_H
6 extern "C"
7 {
8 #include "../../../C/Aes.h"
9 }
11 #include "Common/Buffer.h"
12 #include "Common/MyCom.h"
14 #include "../ICoder.h"
15 #include "../IPassword.h"
17 namespace NCrypto {
18 namespace NRar29 {
20 const UInt32 kRarAesKeySize = 16;
22 class CDecoder:
23 public ICompressFilter,
24 public ICompressSetDecoderProperties2,
25 public ICryptoSetPassword,
26 public CMyUnknownImp
27 {
28 Byte _salt[8];
29 bool _thereIsSalt;
30 CByteBuffer buffer;
31 Byte aesKey[kRarAesKeySize];
32 Byte aesInit[AES_BLOCK_SIZE];
33 bool _needCalculate;
35 CAesCbc Aes;
37 bool _rar350Mode;
39 void Calculate();
41 public:
43 MY_UNKNOWN_IMP2(
44 ICryptoSetPassword,
45 ICompressSetDecoderProperties2)
47 STDMETHOD(Init)();
49 STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
51 STDMETHOD(CryptoSetPassword)(const Byte *aData, UInt32 aSize);
53 // ICompressSetDecoderProperties
54 STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
56 CDecoder();
57 void SetRar350Mode(bool rar350Mode) { _rar350Mode = rar350Mode; }
58 };
60 }}
62 #endif