CARC4 Class Reference

class CARC4 : public CStreamCipher

Implements an RC4-compatible stream cipher that outputs a pseudorandom stream of bits, having been initialised with a key.

Constructor & Destructor Documentation

CARC4()

CARC4()[protected]

Member Functions Documentation

DoProcess(TDes8 &)

voidDoProcess(TDes8 &aData)[protected, virtual]

Performs an ARC4 encryption or decryption on supplied data.

Note:

ARC4 encryption and decryption are symmetrical.

Parameters

TDes8 & aDataOn input, data to be transformed; on return, transformed data.

KeySize(void)

TInt KeySize(void)const [virtual]

Gets the key size in bits.

Parameters

void

NewL(const TDesC8 &, TUint)

IMPORT_C CARC4 *NewL(const TDesC8 &aKey,
TUintaDiscardBytes =  KDefaultDiscardBytes
)[static]

Constructs an instance of a CARC4 object, and initialises it with a key and (optionally) the number of initial bytes to discard. Defaults to 256.

The number of dropped bytes must be agreed with the other party, with which information is to be exchanged, prior to encipherment.

Note:

Several papers have been published indicating that there are weaknesses in the first bytes of an ARC4 byte stream. A search for "ARC4 discard" should find these papers. Recommended practice is to drop the first KDefaultDiscardBytes bytes of the key stream.

leave
KErrKeyNotWeakEnough If the key size is larger than that allowed by the cipher strength restrictions of the crypto library. See TCrypto::IsSymmetricWeakEnoughL()

Parameters

const TDesC8 & aKeyThe key to use. aKey must be less than or equal to KRC4MaxKeySizeBytes.
TUint aDiscardBytes =  KDefaultDiscardBytes The number of bytes to drop from the beginning of the key stream.

NewLC(const TDesC8 &, TUint)

IMPORT_C CARC4 *NewLC(const TDesC8 &aKey,
TUintaDiscardBytes =  KDefaultDiscardBytes
)[static]

Constructs an instance of a CARC4 object, and initialises it with a key and (optionally) the number of initial bytes to discard. Defaults to 256.

The number of dropped bytes must be agreed with the other party, with which information is to be exchanged, prior to encipherment.

CARC4::NewL()
leave
KErrKeyNotWeakEnough If the key size is larger than that allowed by the cipher strength restrictions of the crypto library. See TCrypto::IsSymmetricWeakEnoughL()

Parameters

const TDesC8 & aKeyThe key to use. aKey must be less than or equal to KRC4MaxKeySizeBytes.
TUint aDiscardBytes =  KDefaultDiscardBytes The number of bytes to drop from the beginning of the key stream.

Reset(void)

voidReset(void)[virtual]

Resets the cipher back to its original state. Clears all its buffers.

Parameters

void