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