comparison 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
comparison
equal deleted inserted replaced
0:8ced16adf2e1 1:f9f4f1b99eed
1 // Crypto/RarAes.h
2
3 #ifndef __CRYPTO_RAR_AES_H
4 #define __CRYPTO_RAR_AES_H
5
6 extern "C"
7 {
8 #include "../../../C/Aes.h"
9 }
10
11 #include "Common/Buffer.h"
12 #include "Common/MyCom.h"
13
14 #include "../ICoder.h"
15 #include "../IPassword.h"
16
17 namespace NCrypto {
18 namespace NRar29 {
19
20 const UInt32 kRarAesKeySize = 16;
21
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;
34
35 CAesCbc Aes;
36
37 bool _rar350Mode;
38
39 void Calculate();
40
41 public:
42
43 MY_UNKNOWN_IMP2(
44 ICryptoSetPassword,
45 ICompressSetDecoderProperties2)
46
47 STDMETHOD(Init)();
48
49 STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
50
51 STDMETHOD(CryptoSetPassword)(const Byte *aData, UInt32 aSize);
52
53 // ICompressSetDecoderProperties
54 STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
55
56 CDecoder();
57 void SetRar350Mode(bool rar350Mode) { _rar350Mode = rar350Mode; }
58 };
59
60 }}
61
62 #endif