view src/win32/7zip/7z/CPP/7zip/Crypto/ZipStrong.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/ZipStrong.h
3 #ifndef __CRYPTO_ZIP_STRONG_H
4 #define __CRYPTO_ZIP_STRONG_H
6 #include "Common/MyCom.h"
7 #include "Common/Buffer.h"
9 #include "../ICoder.h"
10 #include "../IPassword.h"
12 namespace NCrypto {
13 namespace NZipStrong {
15 struct CKeyInfo
16 {
17 Byte MasterKey[32];
18 UInt32 KeySize;
19 void SetPassword(const Byte *data, UInt32 size);
20 };
22 class CBaseCoder:
23 public ICompressFilter,
24 public ICryptoSetPassword,
25 public CMyUnknownImp
26 {
27 protected:
28 CKeyInfo _key;
29 CMyComPtr<ICompressFilter> _aesFilter;
30 CByteBuffer _buf;
31 public:
32 STDMETHOD(Init)();
33 STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size) = 0;
35 STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size);
36 };
38 class CDecoder:
39 public CBaseCoder
40 {
41 UInt32 _ivSize;
42 Byte _iv[16];
43 UInt32 _remSize;
44 public:
45 MY_UNKNOWN_IMP1(ICryptoSetPassword)
46 STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
47 HRESULT ReadHeader(ISequentialInStream *inStream, UInt32 crc, UInt64 unpackSize);
48 HRESULT CheckPassword(bool &passwOK);
49 };
51 }}
53 #endif