Public Types | Public Member Functions | Static Public Member Functions | List of all members
CZipCryptograph Class Referenceabstract

#include <ZipCryptograph.h>

Inheritance diagram for CZipCryptograph:
Inheritance graph

Public Types

enum  EncryptionMethod {
  encStandard, encWinZipAes128, encWinZipAes192, encWinZipAes256,
  encNone = 0xFF
}
 

Public Member Functions

virtual bool CanHandle (int iEncryptionMethod)
 
virtual void Decode (char *pBuffer, DWORD uSize)=0
 
virtual void Encode (char *pBuffer, DWORD uSize)=0
 
virtual void FinishDecode (CZipFileHeader &currentFile, CZipStorage &storage)
 
virtual void FinishEncode (CZipFileHeader &currentFile, CZipStorage &storage)
 
virtual bool InitDecode (CZipAutoBuffer &password, CZipFileHeader &currentFile, CZipStorage &storage, bool ignoreCheck)=0
 
virtual void InitEncode (CZipAutoBuffer &password, CZipFileHeader &currentFile, CZipStorage &storage)=0
 

Static Public Member Functions

static CZipCryptographCreateCryptograph (int iEncryptionMethod)
 
static DWORD GetEncryptedInfoSize (int iEncryptionMethod)
 
static DWORD GetEncryptedInfoSizeAfterData (int iEncryptionMethod)
 
static DWORD GetEncryptedInfoSizeBeforeData (int iEncryptionMethod)
 
static bool IsEncryptionSupported (int iEncryptionMethod)
 
static bool IsWinZipAesEncryption (int iEncryptionMethod)
 

Detailed Description

The base class for cryptographs used in encryption and decryption of file data.

See Also
Encryption Methods: How to Best Protect Your Data

Definition at line 41 of file ZipCryptograph.h.

Member Enumeration Documentation

The encryption method.

See Also
Encryption Methods: How to Best Protect Your Data
Enumerator:
encStandard 

The traditional zip encryption.

encWinZipAes128 

WinZip AES 128-bit encryption.

encWinZipAes192 

WinZip AES 192-bit encryption.

encWinZipAes256 

WinZip AES 256-bit encryption.

encNone 

Indicates no encryption.

Definition at line 51 of file ZipCryptograph.h.

Member Function Documentation

virtual bool CZipCryptograph::CanHandle ( int  iEncryptionMethod)
inlinevirtual

Returns the value indicating whether the current compressor can handle the given encryption method.

Parameters
iEncryptionMethodThe encryption method to test. It can be one of the EncryptionMethod values.
Returns
true, if the current compressor can handle the given encryption method; false otherwise.

Reimplemented in CZipCrc32Cryptograph.

Definition at line 223 of file ZipCryptograph.h.

static CZipCryptograph* CZipCryptograph::CreateCryptograph ( int  iEncryptionMethod)
static

A factory method that creates an appropriate cryptograph for the given method.

Parameters
iEncryptionMethodThe encryption method to create a cryptograph for. It can be one of the EncryptionMethod values.
Returns
The new cryptograph. The caller is responsible for destroying the object. If the method is not supported, creates CZipCrc32Cryptograph.
virtual void CZipCryptograph::Decode ( char *  pBuffer,
DWORD  uSize 
)
pure virtual

Decodes the given data.

Parameters
pBufferThe buffer that holds the data to decode and that receives the results.
uSizeThe size of pBuffer.

Implemented in CZipCrc32Cryptograph.

virtual void CZipCryptograph::Encode ( char *  pBuffer,
DWORD  uSize 
)
pure virtual

Encodes the given data.

Parameters
pBufferThe buffer that holds the data to encode and that receives the results.
uSizeThe size of pBuffer.

Implemented in CZipCrc32Cryptograph.

virtual void CZipCryptograph::FinishDecode ( CZipFileHeader currentFile,
CZipStorage storage 
)
inlinevirtual

The method called at the end of the decoding process.

Parameters
currentFileThe file being decoded and extracted.
storageThe current CZipStorage.

Definition at line 201 of file ZipCryptograph.h.

virtual void CZipCryptograph::FinishEncode ( CZipFileHeader currentFile,
CZipStorage storage 
)
inlinevirtual

The method called at the end of the decoding process.

Parameters
currentFileThe file being compressed and encoded.
storageThe current CZipStorage.

Definition at line 212 of file ZipCryptograph.h.

static DWORD CZipCryptograph::GetEncryptedInfoSize ( int  iEncryptionMethod)
static

Returns the total size of the extra data that is added to the compression stream during encryption with the given method.

Parameters
iEncryptionMethodThe encryption method. It can be one of the EncryptionMethod values.
Returns
The total size of extra data for the given encryption method.
static DWORD CZipCryptograph::GetEncryptedInfoSizeAfterData ( int  iEncryptionMethod)
static

Returns the size of the extra data that is added after the compression stream during encryption with the given method.

Parameters
iEncryptionMethodThe encryption method. It can be one of the EncryptionMethod values.
Returns
The size of extra data at the end of the compression stream for the given encryption method.
static DWORD CZipCryptograph::GetEncryptedInfoSizeBeforeData ( int  iEncryptionMethod)
static

Returns the size of the extra data that is added before the compression stream during encryption with the given method.

Parameters
iEncryptionMethodThe encryption method. It can be one of the EncryptionMethod values.
Returns
The size of extra data at the beginning of the compression stream for the given encryption method.
virtual bool CZipCryptograph::InitDecode ( CZipAutoBuffer &  password,
CZipFileHeader currentFile,
CZipStorage storage,
bool  ignoreCheck 
)
pure virtual

The method called when an existing file is opened for extraction.

Parameters
passwordThe supplied password with the CZipArchive::SetPassword method.
currentFileThe file being decoded and extracted.
storageThe current CZipStorage.
ignoreCheckIf true, skips control bytes verifications.
Returns
true, if the password is initially considered correct; false otherwise.

Implemented in CZipCrc32Cryptograph.

virtual void CZipCryptograph::InitEncode ( CZipAutoBuffer &  password,
CZipFileHeader currentFile,
CZipStorage storage 
)
pure virtual

The method called when a new file is opened for compression.

Parameters
passwordThe supplied password with the CZipArchive::SetPassword method.
currentFileThe file being compressed and encoded.
storageThe current CZipStorage.

Implemented in CZipCrc32Cryptograph.

static bool CZipCryptograph::IsEncryptionSupported ( int  iEncryptionMethod)
inlinestatic

Returns the value indicating whether the given encryption method is supported by the current compilation of the ZipArchive Library.

Parameters
iEncryptionMethodThe encryption method to test. It can be one of the EncryptionMethod values.
Returns
true, if the method is supported; false otherwise.

Definition at line 131 of file ZipCryptograph.h.

static bool CZipCryptograph::IsWinZipAesEncryption ( int  iEncryptionMethod)
inlinestatic

Returns the value indicating whether the given method is one of the WinZip AES encryption methods.

Parameters
iEncryptionMethodThe encryption method to test. It can be one of the EncryptionMethod values.
Returns
true, if the method is one the WinZip AES encryption methods; false otherwise.

Definition at line 81 of file ZipCryptograph.h.


The documentation for this class was generated from the following file:

The ZipArchive Library Copyright © 2000 - 2022 Artpol Software - Tadeusz Dracz. Generated at Sat Dec 17 2022 19:57:04.