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.
Constructor & Destructor Documentation
CPadding(TInt)
IMPORT_C
|
CPadding
|
(
|
TInt
|
aBlockBytes
|
)
|
[protected]
|
Parameters
TInt
aBlockBytes
|
The block size in bytes.
|
CPadding(void)
CPadding
|
(
|
void
|
|
)
|
[private]
|
CPadding(const CPadding &)
Member Functions Documentation
BlockSize(void)
IMPORT_C
TInt
|
BlockSize
|
(
|
void
|
|
)
|
const
|
Retrieves the block size for this padding system.
DoPadL(const TDesC8 &, TDes8 &)
void
|
DoPadL
|
(
|
const
TDesC8
&
|
aInput,
|
|
TDes8
&
|
aOutput
|
|
)
|
[private, pure virtual]
|
GetExtension(TUint, TAny *&, TAny *)
Used to retrieve the extended interfaces by id. For Crypto SPI internal use only.
MaxPaddedLength(TInt)
IMPORT_C
TInt
|
MaxPaddedLength
|
(
|
TInt
|
aInputBytes
|
)
|
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
aInputBytes
|
The amount of data to be padded out in bytes.
|
MaxUnPaddedLength(TInt)
IMPORT_C
TInt
|
MaxUnPaddedLength
|
(
|
TInt
|
aInputBytes
|
)
|
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
aInputBytes
|
The 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.
PadL(const TDesC8 &, TDes8 &)
IMPORT_C void
|
PadL
|
(
|
const
TDesC8
&
|
aInput,
|
|
TDes8
&
|
aOutput
|
|
)
|
|
Pads aInput to be
BlockSize()
bytes long and places the result in aOutput.
Parameters
const
TDesC8
& aInput
|
Data to be padded. The size must be less than or equal to BlockSize() minus MinPaddingLength().
|
TDes8
& aOutput
|
On return, the resulting padded, block size aligned data appended to aOutput.
|
SetBlockSize(TInt)
IMPORT_C void
|
SetBlockSize
|
(
|
TInt
|
aBlockBytes
|
)
|
|
Sets the block size for this padding system.
Parameters
TInt
aBlockBytes
|
The block size in bytes.
|
UnPadL(const TDesC8 &, TDes8 &)
void
|
UnPadL
|
(
|
const
TDesC8
&
|
aInput,
|
|
TDes8
&
|
aOutput
|
|
)
|
[pure virtual]
|
Removes padding from aInput and appends unpadded result to aOutput.
Parameters
const
TDesC8
& aInput
|
Data to be unpadded.
|
TDes8
& aOutput
|
On return, the unpadded data.
|
operator=(const CPadding &)
Member Data Documentation
TInt
iBlockBytes
TInt
|
iBlockBytes
|
[private]
|
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.