rlm@1: // Crypto/ZipStrong.h rlm@1: rlm@1: #ifndef __CRYPTO_ZIP_STRONG_H rlm@1: #define __CRYPTO_ZIP_STRONG_H rlm@1: rlm@1: #include "Common/MyCom.h" rlm@1: #include "Common/Buffer.h" rlm@1: rlm@1: #include "../ICoder.h" rlm@1: #include "../IPassword.h" rlm@1: rlm@1: namespace NCrypto { rlm@1: namespace NZipStrong { rlm@1: rlm@1: struct CKeyInfo rlm@1: { rlm@1: Byte MasterKey[32]; rlm@1: UInt32 KeySize; rlm@1: void SetPassword(const Byte *data, UInt32 size); rlm@1: }; rlm@1: rlm@1: class CBaseCoder: rlm@1: public ICompressFilter, rlm@1: public ICryptoSetPassword, rlm@1: public CMyUnknownImp rlm@1: { rlm@1: protected: rlm@1: CKeyInfo _key; rlm@1: CMyComPtr _aesFilter; rlm@1: CByteBuffer _buf; rlm@1: public: rlm@1: STDMETHOD(Init)(); rlm@1: STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size) = 0; rlm@1: rlm@1: STDMETHOD(CryptoSetPassword)(const Byte *data, UInt32 size); rlm@1: }; rlm@1: rlm@1: class CDecoder: rlm@1: public CBaseCoder rlm@1: { rlm@1: UInt32 _ivSize; rlm@1: Byte _iv[16]; rlm@1: UInt32 _remSize; rlm@1: public: rlm@1: MY_UNKNOWN_IMP1(ICryptoSetPassword) rlm@1: STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size); rlm@1: HRESULT ReadHeader(ISequentialInStream *inStream, UInt32 crc, UInt64 unpackSize); rlm@1: HRESULT CheckPassword(bool &passwOK); rlm@1: }; rlm@1: rlm@1: }} rlm@1: rlm@1: #endif