CPBEncryptParms Class Reference

class CPBEncryptParms : public CBase

Contains the Password Based Encryption parameters. An object of this class can be input for CPBEncryptElement or CPBEncryptSet objects.

Since
v7.0s

Inherits from

Nested Classes and Structures

Public Member Functions
~CPBEncryptParms (void)
IMPORT_C TPBECipher Cipher ()
void DeriveKeyL (const TDesC8 &, TDes8 &)
IMPORT_C void ExternalizeL ( RWriteStream &)
IMPORT_C TPtrC8 IV ()
IMPORT_C TInt Iterations ()
IMPORT_C TKdf Kdf ()
IMPORT_C CPBEncryptParms * NewL ( TPBECipher , const TDesC8 &, const TDesC8 &, TUint )
IMPORT_C CPBEncryptParms * NewL (const CPBEncryptParms &)
IMPORT_C CPBEncryptParms * NewL ( RReadStream &)
IMPORT_C CPBEncryptParms * NewL ()
IMPORT_C CPBEncryptParms * NewLC ( TPBECipher , const TDesC8 &, const TDesC8 &, TUint )
IMPORT_C CPBEncryptParms * NewLC (const CPBEncryptParms &)
IMPORT_C CPBEncryptParms * NewLC ( RReadStream &)
IMPORT_C CPBEncryptParms * NewLC ()
IMPORT_C void ResizeSaltL ( TInt )
IMPORT_C TPtrC8 Salt ()
IMPORT_C void SetCipher ( TPBECipher )
void SetCipherL ( TPBECipher )
IMPORT_C void SetIV (const TDesC8 &)
IMPORT_C void SetIterations ( TInt )
IMPORT_C void SetKdf ( TKdf )
Protected Member Functions
CPBEncryptParms (void)
void ConstructL ()
void ConstructL ( TPBECipher , const TDesC8 &, const TDesC8 &, TUint )
void ConstructL (const CPBEncryptParms &)
void ConstructL ( RReadStream &)
Private Member Functions
CPBEncryptParms (const CPBEncryptParms &)
CPBEncryptParms & operator= (const CPBEncryptParms &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enum TKdf { EKdfPkcs5 , EKdfPkcs12 }
Private Attributes
TParamsData * iData
HBufC8 * iIV
TUint iIterations
HBufC8 * iSalt

Constructor & Destructor Documentation

CPBEncryptParms(void)

IMPORT_C CPBEncryptParms ( void ) [protected]

Constructor

Parameters

void

CPBEncryptParms(const CPBEncryptParms &)

CPBEncryptParms ( const CPBEncryptParms & ) [private]

Parameters

const CPBEncryptParms &

~CPBEncryptParms(void)

~CPBEncryptParms ( void ) [virtual]

Destructor

Parameters

void

Member Functions Documentation

Cipher()

IMPORT_C TPBECipher Cipher ( ) const

Gets the PBE cipher

ConstructL()

void ConstructL ( ) [protected]

Initialize this object with default cipher, kdf (PKCS#5,) salt length, iteration count, and IV.

ConstructL(TPBECipher, const TDesC8 &, const TDesC8 &, TUint)

void ConstructL ( TPBECipher aCipher,
const TDesC8 & aSalt,
const TDesC8 & aIV,
TUint aIterations
) [protected]

Parameters

TPBECipher aCipher
const TDesC8 & aSalt
const TDesC8 & aIV
TUint aIterations

ConstructL(const CPBEncryptParms &)

void ConstructL ( const CPBEncryptParms & aParms ) [protected]

Parameters

const CPBEncryptParms & aParms

ConstructL(RReadStream &)

void ConstructL ( RReadStream & aStream ) [protected]

Parameters

RReadStream & aStream

DeriveKeyL(const TDesC8 &, TDes8 &)

void DeriveKeyL ( const TDesC8 & aPassword,
TDes8 & aKeyBuf
) const

Derive a key from this object's kdf, salt, amd iteration count.

Parameters

const TDesC8 & aPassword User-supplied password used to generate key.
TDes8 & aKeyBuf Buffer to populate with new key. On entry it must be set to the required key length.

ExternalizeL(RWriteStream &)

IMPORT_C void ExternalizeL ( RWriteStream & aStream ) const

Externalizes the encryption parameters into a write stream.

Parameters

RWriteStream & aStream The stream to write to

IV()

IMPORT_C TPtrC8 IV ( ) const

Gets the PBE Initialization Vector

Iterations()

IMPORT_C TInt Iterations ( ) const

Gets the number of iterations for the PKCS#5 algorithm.

Kdf()

IMPORT_C TKdf Kdf ( ) const

Gets the key derivation function (KDF.)

Accessor function returns the key derivation function (KDF) specified by this object.

NewL(TPBECipher, const TDesC8 &, const TDesC8 &, TUint)

IMPORT_C CPBEncryptParms * NewL ( TPBECipher aCipher,
const TDesC8 & aSalt,
const TDesC8 & aIV,
TUint aIterations
) [static]

Creates a new CPBEncryptParms object.

Parameters

TPBECipher aCipher The cipher to use
const TDesC8 & aSalt The salt
const TDesC8 & aIV The Initialization Vector
TUint aIterations The number of iterations of the PBE algorithm

NewL(const CPBEncryptParms &)

IMPORT_C CPBEncryptParms * NewL ( const CPBEncryptParms & aParms ) [static]

Creates a new CPBEncryptParms object from an existing object.

Parameters

const CPBEncryptParms & aParms The existing encryption parameters object

NewL(RReadStream &)

IMPORT_C CPBEncryptParms * NewL ( RReadStream & aStream ) [static]

Internalizes encryption parameter data from a read stream.

Parameters

RReadStream & aStream The read stream to be internalized

NewL()

IMPORT_C CPBEncryptParms * NewL ( ) [static]

This factory function allocates an encryption parameters object with default settings. The individual settings can be retrieved and modified with the accessor and mutator functions after this object has been created.

This factory function is provided so that individual parameters can be modified without providing many factory functions.

NewLC(TPBECipher, const TDesC8 &, const TDesC8 &, TUint)

IMPORT_C CPBEncryptParms * NewLC ( TPBECipher aCipher,
const TDesC8 & aSalt,
const TDesC8 & aIV,
TUint aIterations
) [static]

Creates a new CPBEncryptParms object and puts a pointer to it onto the cleanup stack.

Parameters

TPBECipher aCipher The cipher to use
const TDesC8 & aSalt The salt
const TDesC8 & aIV The Initialization Vector
TUint aIterations The number of iterations of the PBE algorithm

NewLC(const CPBEncryptParms &)

IMPORT_C CPBEncryptParms * NewLC ( const CPBEncryptParms & aParms ) [static]

Creates a new CPBEncryptParms object from an existing object and puts a pointer to it onto the cleanup stack.

Parameters

const CPBEncryptParms & aParms The existing encryption parameters object

NewLC(RReadStream &)

IMPORT_C CPBEncryptParms * NewLC ( RReadStream & aStream ) [static]

Internalizes encryption parameter data from a read stream, and puts a pointer to the new object onto the cleanup stack.

Parameters

RReadStream & aStream The read stream to be internalized

NewLC()

IMPORT_C CPBEncryptParms * NewLC ( ) [static]

Similar to the NewL overload which takes no arguments, this function additionally puts the allocated instance of CPBEncryptParms on the cleanup stack.

ResizeSaltL(TInt)

IMPORT_C void ResizeSaltL ( TInt aNewLen )

Resize the current salt and replace its contents.

Parameters

TInt aNewLen New salt length.

Salt()

IMPORT_C TPtrC8 Salt ( ) const

Gets the PBE salt

SetCipher(TPBECipher)

IMPORT_C void SetCipher ( TPBECipher aCipher )

Replace the current cipher. This function resizes the IV and replaces its existing contents.

Use SetCipherL instead. SetCipherL

Parameters

TPBECipher aCipher New cipher.

SetCipherL(TPBECipher)

void SetCipherL ( TPBECipher aCipher ) [inline]

Replace the current cipher. This function resizes the IV and replaces its existing contents.

leave
System wide error code.

Parameters

TPBECipher aCipher New cipher.

SetIV(const TDesC8 &)

IMPORT_C void SetIV ( const TDesC8 & aNewIv )

Replace the initialization vector.

Parameters

const TDesC8 & aNewIv New initialization vector length. This must have no more than KPBEMaxCipherIVBytes bytes.

SetIterations(TInt)

IMPORT_C void SetIterations ( TInt aIterCount )

Replace the current iteration count with the supplied value.

Parameters

TInt aIterCount Number of iterations to apply in the KDF.

SetKdf(TKdf)

IMPORT_C void SetKdf ( TKdf aKdf )

Replace the current key derivation function.

Parameters

TKdf aKdf Key derivation function.

operator=(const CPBEncryptParms &)

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

Parameters

const CPBEncryptParms &

Member Enumerations Documentation

Enum TKdf

Key derivation function. This does not affect the authentication key, which always uses PKCS#5.

Enumerators

EKdfPkcs5
EKdfPkcs12

Member Data Documentation

TParamsData * iData

TParamsData * iData [private]

HBufC8 * iIV

HBufC8 * iIV [private]

TUint iIterations

TUint iIterations [private]

HBufC8 * iSalt

HBufC8 * iSalt [private]