#include <padding.h>
class CPadding : public CBase |
Public Member Functions | |
---|---|
IMPORT_C TInt | BlockSize(void) |
TInt | GetExtension(TUint, TAny *&, TAny *) |
virtual IMPORT_C TInt | MaxPaddedLength(TInt) |
virtual IMPORT_C TInt | MaxUnPaddedLength(TInt) |
pure virtual TInt | MinPaddingLength(void) |
IMPORT_C void | PadL(const TDesC8 &, TDes8 &) |
IMPORT_C void | SetBlockSize(TInt) |
pure virtual void | UnPadL(const TDesC8 &, TDes8 &) |
Protected Member Functions | |
---|---|
CPadding(TInt) |
Abstract base class defining the interface to padding schemes.
It is designed to be used by both symmetric and asymmetric ciphers.
IMPORT_C | CPadding | ( | TInt | aBlockBytes | ) | [protected] |
Constructor
Parameter | Description |
---|---|
aBlockBytes | The block size in bytes. |
IMPORT_C TInt | BlockSize | ( | void | ) | const |
Retrieves the block size for this padding system.
Returns: The block size in bytes.
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.
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.
Parameter | Description |
---|---|
aInputBytes | The amount of data to be padded out in bytes. |
Returns: A TInt representing the maximum amount of padded output data (in bytes) for a given block and input size.
Gets the size of the aOutput buffer, in a call to UnPadL(), must be in order to accommodate an input size of aInputBytes.
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.
Parameter | Description |
---|---|
aInputBytes | The amount of data to be unpadded in bytes. |
Returns: A TInt containing the maximum amount of unpadded output data (in bytes) for a given padded input.
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.
Returns: A TInt containing the smallest number of padding bytes possible.
Pads aInput to be BlockSize() bytes long and places the result in aOutput.
Parameter | Description |
---|---|
aInput | Data to be padded. The size must be less than or equal to BlockSize() minus MinPaddingLength(). |
aOutput | On return, the resulting padded, block size aligned data appended to aOutput. |
IMPORT_C void | SetBlockSize | ( | TInt | aBlockBytes | ) |
Sets the block size for this padding system.
Parameter | Description |
---|---|
aBlockBytes | The block size in bytes. |