CBufferedTransformation Class Reference

class CBufferedTransformation : public CSymmetricCipher

Abstract class, deriving from CSymmetricCipher, encapsulating the buffering logic for block ciphers.

It is responsible for feeding complete blocks of plaintext or ciphertext to the underlying encryptor or decryptor. Since the only difference between block cipher encryption and decryption is the ProcessFinalL() call, CBufferedTransformation implements all functions (by buffering and/or forwarding to the encryptor/decryptor) except ProcessFinalL() and MaxFinalOutputLength().

See the Cryptography api-guide documentation for the rules that this class and derived classes must follow.

Inherits from

Constructor & Destructor Documentation

CBufferedTransformation()

CBufferedTransformation()[protected]

~CBufferedTransformation()

IMPORT_C~CBufferedTransformation()[virtual]

The destructor frees all resources owned by the object, prior to its destruction.

Member Functions Documentation

BlockSize()

TInt BlockSize()const [virtual]

Gets the block size in bits (8 for stream ciphers).

BlockTransformer()

IMPORT_C CBlockTransformation *BlockTransformer()const

Gets the underlying block transform.

ConstructL(CBlockTransformation *, CPadding *)

voidConstructL(CBlockTransformation *aBT,
CPadding *aPadding
)[protected]

Parameters

CBlockTransformation * aBT
CPadding * aPadding

KeySize()

TInt KeySize()const [virtual]

Gets the key size in bits.

MaxOutputLength(TInt)

TInt MaxOutputLength(TIntaInputLength)const [virtual]

Gets a tight upper bound on the number of bytes that would be returned by a call to Process() with aInputLength bytes of data.

Parameters

TInt aInputLengthThe length of data to be supplied to Process() in bytes.

Process(const TDesC8 &, TDes8 &)

voidProcess(const TDesC8 &aInput,
TDes8 &aOutput
)[virtual]

Encrypts or decrypts the input using the underlying block cipher, buffering the input as necessary.

See the Cryptography api-guide documentation.

Parameters

const TDesC8 & aInputThe input is appended to the internal buffer (initially empty), then all whole blocks are encrypted using the underlying block transformation and written into aOutput. Any leftover bytes will be buffered.
TDes8 & aOutputThe resulting processed data appended to aOutput. aOutput must have at least MaxOutputLength() empty bytes remaining in its length.

Reset()

voidReset()[virtual]

Resets the cipher back to its original state. Clears all its buffers.

Member Data Documentation

CBlockTransformation * iBT

CBlockTransformation *iBT[protected]

A block transformation object

TPtr8 iInputStore

TPtr8 iInputStore[protected]

A pointer to iInputStoreBuf

HBufC8 * iInputStoreBuf

HBufC8 *iInputStoreBuf[protected]

A descriptor which provides a buffer the length of the block size of iBT

CPadding * iPadding

CPadding *iPadding[protected]

The padding