CPBEncryptElement Class Reference

class CPBEncryptElement : public CPBEncryptionBase

Allows the password based encryption and decryption of elements. Contains the encryption key and its associated encryption data. See the Cryptography api-guide documentation for more information and sample code.

Inherits from

Public Member Functions
~CPBEncryptElement (void)
const CPBEncryptionData & EncryptionData (void)
TInt MaxCiphertextLength ( TInt )
TInt MaxPlaintextLength ( TInt )
CPBDecryptor * NewDecryptL (void)
CPBDecryptor * NewDecryptLC (void)
CPBEncryptor * NewEncryptL (void)
CPBEncryptor * NewEncryptLC (void)
IMPORT_C CPBEncryptElement * NewL (const TPBPassword &)
IMPORT_C CPBEncryptElement * NewL (const TPBPassword &, TPBECipher )
IMPORT_C CPBEncryptElement * NewL (const TPBPassword &, const CPBEncryptParms &)
IMPORT_C CPBEncryptElement * NewL (const CPBEncryptionData &, const TPBPassword &)
IMPORT_C CPBEncryptElement * NewLC (const TPBPassword &)
IMPORT_C CPBEncryptElement * NewLC (const TPBPassword &, TPBECipher )
IMPORT_C CPBEncryptElement * NewLC (const TPBPassword &, const CPBEncryptParms &)
IMPORT_C CPBEncryptElement * NewLC (const CPBEncryptionData &, const TPBPassword &)
Protected Member Functions
CPBEncryptElement (void)
TBool AuthenticateL (const TPBPassword &)
void ConstructL (const TDesC8 &)
void ConstructL (const TDesC8 &, const TPBECipher )
void ConstructL (const TDesC8 &, const CPBEncryptParms &)
void ConstructL (const CPBEncryptionData &, const TPBPassword &)
void MakeEncryptKeyL ( TUint , const TDesC8 &)
Private Member Functions
CPBEncryptElement (const CPBEncryptElement &)
CPBEncryptElement & operator= (const CPBEncryptElement &)
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()
Protected Attributes
CPBEncryptionData * iData
HBufC8 * iEncryptKey

Constructor & Destructor Documentation

CPBEncryptElement(void)

CPBEncryptElement ( void ) [protected]

Parameters

void

CPBEncryptElement(const CPBEncryptElement &)

CPBEncryptElement ( const CPBEncryptElement & ) [private]

Parameters

const CPBEncryptElement &

~CPBEncryptElement(void)

~CPBEncryptElement ( void ) [virtual]

Destructor

Parameters

void

Member Functions Documentation

AuthenticateL(const TPBPassword &)

TBool AuthenticateL ( const TPBPassword & aPassword ) [protected]

Parameters

const TPBPassword & aPassword

ConstructL(const TDesC8 &)

void ConstructL ( const TDesC8 & aPassword ) [protected]

Parameters

const TDesC8 & aPassword

ConstructL(const TDesC8 &, const TPBECipher)

void ConstructL ( const TDesC8 & aPassword,
const TPBECipher aCipher
) [protected]

Parameters

const TDesC8 & aPassword
const TPBECipher aCipher

ConstructL(const TDesC8 &, const CPBEncryptParms &)

void ConstructL ( const TDesC8 & aPassword,
const CPBEncryptParms & aParms
) [protected]

Parameters

const TDesC8 & aPassword
const CPBEncryptParms & aParms

ConstructL(const CPBEncryptionData &, const TPBPassword &)

void ConstructL ( const CPBEncryptionData & aData,
const TPBPassword & aPassword
) [protected]

Parameters

const CPBEncryptionData & aData
const TPBPassword & aPassword

EncryptionData(void)

const CPBEncryptionData & EncryptionData ( void ) const [virtual]

Gets the parameters allowing one to re-create the object with the same state at another point in the future.

In order to decrypt any information previously encrypted with this object, you must store this encryption data along with it. Failure to do this will result in the permanent loss of the encrypted information.

Parameters

void

MakeEncryptKeyL(TUint, const TDesC8 &)

void MakeEncryptKeyL ( TUint aKeySize,
const TDesC8 & aPassword
) [protected]

Parameters

TUint aKeySize
const TDesC8 & aPassword

MaxCiphertextLength(TInt)

TInt MaxCiphertextLength ( TInt aPlaintextLength ) const [virtual]

Gets the maximum output ciphertext length given a specified input plaintext length.

Parameters

TInt aPlaintextLength The plaintext length

MaxPlaintextLength(TInt)

TInt MaxPlaintextLength ( TInt aCiphertextLength ) const [virtual]

Gets the maximum output plaintext length given a specified input ciphertext length.

Parameters

TInt aCiphertextLength The ciphertext length

NewDecryptL(void)

CPBDecryptor * NewDecryptL ( void ) const [virtual]

Constructs a CPBDecryptor object allowing the decryption of data.

Parameters

void

NewDecryptLC(void)

CPBDecryptor * NewDecryptLC ( void ) const [virtual]

Constructs a CPBDecryptor object allowing the decryption of data.

Parameters

void

NewEncryptL(void)

CPBEncryptor * NewEncryptL ( void ) const [virtual]

Constructs a CPBEncryptor object allowing the encryption of data.

Parameters

void

NewEncryptLC(void)

CPBEncryptor * NewEncryptLC ( void ) const [virtual]

Constructs a CPBEncryptor object allowing the encryption of data.

Parameters

void

NewL(const TPBPassword &)

IMPORT_C CPBEncryptElement * NewL ( const TPBPassword & aPassword ) [static]

Creates a new CPBEncryptElement object for encryption of new data.

If strong cryptography is present, a 128 bit AES cipher is used; otherwise, for weak cryptography, a 56 bit DES cipher is used.

The symmetric key is derived from the password and a random salt using TPKCS5KDF::DeriveKeyL() .

Parameters

const TPBPassword & aPassword The user supplied password

NewL(const TPBPassword &, TPBECipher)

IMPORT_C CPBEncryptElement * NewL ( const TPBPassword & aPassword,
TPBECipher aCipher
) [static]

Creates a new CPBEncryptElement object for encryption of new data.

The symmetric key is derived from the password and a random salt using TPKCS5KDF::DeriveKeyL() .

Parameters

const TPBPassword & aPassword The user supplied password
TPBECipher aCipher The cipher to use

NewL(const TPBPassword &, const CPBEncryptParms &)

IMPORT_C CPBEncryptElement * NewL ( const TPBPassword & aPassword,
const CPBEncryptParms & aParms
) [static]

Creates a new CPBEncryptElement object for encryption of new data.

The symmetric key is derived from the password using TPKCS5KDF::DeriveKeyL() .

Parameters

const TPBPassword & aPassword The user supplied password
const CPBEncryptParms & aParms An encryption parameter object comprising the cipher, salt, IV, and iteration count value.

NewL(const CPBEncryptionData &, const TPBPassword &)

IMPORT_C CPBEncryptElement * NewL ( const CPBEncryptionData & aData,
const TPBPassword & aPassword
) [static]

Creates a new CPBEncryptElement object for decryption of existing data.

If the specified password is valid, the function regenerates the encryption key; otherwise, it leaves with KErrBadPassphrase.

leave
KErrBadPassphrase If the specified password is incorrect

Parameters

const CPBEncryptionData & aData The encryption data object
const TPBPassword & aPassword The user supplied password

NewLC(const TPBPassword &)

IMPORT_C CPBEncryptElement * NewLC ( const TPBPassword & aPassword ) [static]

Creates a new CPBEncryptElement object for encryption of new data.

If strong cryptography is present, a 128 bit AES cipher is used; otherwise, for weak cryptography, a 56 bit DES cipher is used.

The symmetric key is derived from the password and a random salt using TPKCS5KDF::DeriveKeyL() .

A pointer to the returned object is put onto the cleanup stack.

Parameters

const TPBPassword & aPassword The user supplied password

NewLC(const TPBPassword &, TPBECipher)

IMPORT_C CPBEncryptElement * NewLC ( const TPBPassword & aPassword,
TPBECipher aCipher
) [static]

Creates a new CPBEncryptElement object for encryption of new data.

The symmetric key is derived from the password and a random salt using TPKCS5KDF::DeriveKeyL() .

A pointer to the returned object is put onto the cleanup stack.

Parameters

const TPBPassword & aPassword The user supplied password
TPBECipher aCipher The cipher to use

NewLC(const TPBPassword &, const CPBEncryptParms &)

IMPORT_C CPBEncryptElement * NewLC ( const TPBPassword & aPassword,
const CPBEncryptParms & aParms
) [static]

Creates a new CPBEncryptElement object for encryption of new data.

The symmetric key is derived from the password using TPKCS5KDF::DeriveKeyL() .

A pointer to the returned object is put onto the cleanup stack.

Parameters

const TPBPassword & aPassword The user supplied password
const CPBEncryptParms & aParms An encryption parameter object comprising the cipher, salt, IV, and iteration count value.

NewLC(const CPBEncryptionData &, const TPBPassword &)

IMPORT_C CPBEncryptElement * NewLC ( const CPBEncryptionData & aData,
const TPBPassword & aPassword
) [static]

Creates a new CPBEncryptElement object for decryption of existing data.

If the specified password is valid, the function regenerates the encryption key; otherwise, it leaves with KErrBadPassphrase.

A pointer to the returned object is put onto the cleanup stack.

leave
KErrBadPassphrase If the specified password is incorrect

Parameters

const CPBEncryptionData & aData The encryption data object
const TPBPassword & aPassword The user supplied password

operator=(const CPBEncryptElement &)

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

Parameters

const CPBEncryptElement &

Member Data Documentation

CPBEncryptionData * iData

CPBEncryptionData * iData [protected]

The encryption data

HBufC8 * iEncryptKey

HBufC8 * iEncryptKey [protected]

The derived encryption key