Mercurial > vba-linux
diff 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 diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/win32/7zip/7z/CPP/7zip/Crypto/ZipStrong.h Sat Mar 03 10:31:27 2012 -0600 1.3 @@ -0,0 +1,53 @@ 1.4 +// Crypto/ZipStrong.h 1.5 + 1.6 +#ifndef __CRYPTO_ZIP_STRONG_H 1.7 +#define __CRYPTO_ZIP_STRONG_H 1.8 + 1.9 +#include "Common/MyCom.h" 1.10 +#include "Common/Buffer.h" 1.11 + 1.12 +#include "../ICoder.h" 1.13 +#include "../IPassword.h" 1.14 + 1.15 +namespace NCrypto { 1.16 +namespace NZipStrong { 1.17 + 1.18 +struct CKeyInfo 1.19 +{ 1.20 + Byte MasterKey[32]; 1.21 + UInt32 KeySize; 1.22 + void SetPassword(const Byte *data, UInt32 size); 1.23 +}; 1.24 + 1.25 +class CBaseCoder: 1.26 + public ICompressFilter, 1.27 + public ICryptoSetPassword, 1.28 + public CMyUnknownImp 1.29 +{ 1.30 +protected: 1.31 + CKeyInfo _key; 1.32 + CMyComPtr<ICompressFilter> _aesFilter; 1.33 + CByteBuffer _buf; 1.34 +public: 1.35 + STDMETHOD(Init)(); 1.36 + STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size) = 0; 1.37 + 1.38 + STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size); 1.39 +}; 1.40 + 1.41 +class CDecoder: 1.42 + public CBaseCoder 1.43 +{ 1.44 + UInt32 _ivSize; 1.45 + Byte _iv[16]; 1.46 + UInt32 _remSize; 1.47 +public: 1.48 + MY_UNKNOWN_IMP1(ICryptoSetPassword) 1.49 + STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size); 1.50 + HRESULT ReadHeader(ISequentialInStream *inStream, UInt32 crc, UInt64 unpackSize); 1.51 + HRESULT CheckPassword(bool &passwOK); 1.52 +}; 1.53 + 1.54 +}} 1.55 + 1.56 +#endif