CPadding Class Reference

class CPadding : public CBase

Abstract base class defining the interface to padding schemes.

It is designed to be used by both symmetric and asymmetric ciphers.

Inherits from

Constructor & Destructor Documentation

CPadding(TInt)

IMPORT_CCPadding(TIntaBlockBytes)[protected]

Constructor

Parameters

TInt aBlockBytesThe block size in bytes.

CPadding(void)

CPadding(void)[private]

Parameters

void

CPadding(const CPadding &)

CPadding(const CPadding &)[private]

Parameters

const CPadding &

Member Functions Documentation

BlockSize(void)

IMPORT_C TIntBlockSize(void)const

Retrieves the block size for this padding system.

Parameters

void

DoPadL(const TDesC8 &, TDes8 &)

voidDoPadL(const TDesC8 &aInput,
TDes8 &aOutput
)[private, pure virtual]

Parameters

const TDesC8 & aInput
TDes8 & aOutput

GetExtension(TUint, TAny *&, TAny *)

TInt GetExtension(TUintaExtensionId,
TAny *&a0,
TAny *a1
)

Used to retrieve the extended interfaces by id. For Crypto SPI internal use only.

Parameters

TUint aExtensionId
TAny *& a0
TAny * a1

MaxPaddedLength(TInt)

IMPORT_C TIntMaxPaddedLength(TIntaInputBytes)const [virtual]

Gets the size of the aOutput buffer, in a call to PadL(), must be in order to accommodate a block size of BlockSize() and an input size of aInputBytes.

Note:

By default, this function returns the output of BlockSize(). If a derived padding system outputs more than a single block of padding, one must override this function and return the appropriate value.

Parameters

TInt aInputBytesThe amount of data to be padded out in bytes.

MaxUnPaddedLength(TInt)

IMPORT_C TIntMaxUnPaddedLength(TIntaInputBytes)const [virtual]

Gets the size of the aOutput buffer, in a call to UnPadL(), must be in order to accommodate an input size of aInputBytes.

Note:

By default, this function returns the value of aInputBytes minus MinPaddingBytes(). Most padding systems cannot determine anything about the unpadded length without looking at the data. If your padding system allows you to give a better bound, then you should reimplement this function.

Parameters

TInt aInputBytesThe amount of data to be unpadded in bytes.

MinPaddingLength(void)

TInt MinPaddingLength(void)const [pure virtual]

Gets the smallest number of bytes that PadL() will ever add to aInput in order to get a valid block aligned aOutput.

For example, in SSLv3 padding, if the block size is 8 and aInput is 7 bytes, it will append 1 byte of padding. For SSLv3 padding, this is the smallest amount possible as an 8 byte input will add another block size (8 more bytes) of padded data.

Parameters

void

PadL(const TDesC8 &, TDes8 &)

IMPORT_C voidPadL(const TDesC8 &aInput,
TDes8 &aOutput
)

Pads aInput to be BlockSize() bytes long and places the result in aOutput.

Parameters

const TDesC8 & aInputData to be padded. The size must be less than or equal to BlockSize() minus MinPaddingLength().
TDes8 & aOutputOn return, the resulting padded, block size aligned data appended to aOutput.

SetBlockSize(TInt)

IMPORT_C voidSetBlockSize(TIntaBlockBytes)

Sets the block size for this padding system.

Parameters

TInt aBlockBytesThe block size in bytes.

UnPadL(const TDesC8 &, TDes8 &)

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

Removes padding from aInput and appends unpadded result to aOutput.

Parameters

const TDesC8 & aInputData to be unpadded.
TDes8 & aOutputOn return, the unpadded data.

operator=(const CPadding &)

CPadding &operator=(const CPadding &)[private]

Parameters

const CPadding &

Member Data Documentation

TInt iBlockBytes

TInt iBlockBytes[private]