diff 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
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/RarAes.h	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,62 @@
     1.4 +// Crypto/RarAes.h
     1.5 +
     1.6 +#ifndef __CRYPTO_RAR_AES_H
     1.7 +#define __CRYPTO_RAR_AES_H
     1.8 +
     1.9 +extern "C"
    1.10 +{
    1.11 +#include "../../../C/Aes.h"
    1.12 +}
    1.13 +
    1.14 +#include "Common/Buffer.h"
    1.15 +#include "Common/MyCom.h"
    1.16 +
    1.17 +#include "../ICoder.h"
    1.18 +#include "../IPassword.h"
    1.19 +
    1.20 +namespace NCrypto {
    1.21 +namespace NRar29 {
    1.22 +
    1.23 +const UInt32 kRarAesKeySize = 16;
    1.24 +
    1.25 +class CDecoder:
    1.26 +  public ICompressFilter,
    1.27 +  public ICompressSetDecoderProperties2,
    1.28 +  public ICryptoSetPassword,
    1.29 +  public CMyUnknownImp
    1.30 +{
    1.31 +  Byte _salt[8];
    1.32 +  bool _thereIsSalt;
    1.33 +  CByteBuffer buffer;
    1.34 +  Byte aesKey[kRarAesKeySize];
    1.35 +  Byte aesInit[AES_BLOCK_SIZE];
    1.36 +  bool _needCalculate;
    1.37 +
    1.38 +  CAesCbc Aes;
    1.39 +
    1.40 +  bool _rar350Mode;
    1.41 +
    1.42 +  void Calculate();
    1.43 +
    1.44 +public:
    1.45 +
    1.46 +  MY_UNKNOWN_IMP2(
    1.47 +    ICryptoSetPassword,
    1.48 +    ICompressSetDecoderProperties2)
    1.49 +
    1.50 +  STDMETHOD(Init)();
    1.51 +
    1.52 +  STDMETHOD_(UInt32, Filter)(Byte *data, UInt32 size);
    1.53 +
    1.54 +  STDMETHOD(CryptoSetPassword)(const Byte *aData, UInt32 aSize);
    1.55 +
    1.56 +  // ICompressSetDecoderProperties
    1.57 +  STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
    1.58 +
    1.59 +  CDecoder();
    1.60 +  void SetRar350Mode(bool rar350Mode) { _rar350Mode = rar350Mode; }
    1.61 +};
    1.62 +
    1.63 +}}
    1.64 +
    1.65 +#endif