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
Member Functions Documentation
DoProcess(TDes8 &)
void
|
DoProcess
|
(
|
TDes8
&
|
aData
|
)
|
[protected, virtual]
|
Performs an ARC4 encryption or decryption on supplied data.
Note:
ARC4 encryption and decryption are symmetrical.
Parameters
TDes8
& aData
|
On input, data to be transformed; on return, transformed data.
|
KeySize(void)
TInt
|
KeySize
|
(
|
void
|
|
)
|
const [virtual]
|
Gets the key size in bits.
NewL(const TDesC8 &, TUint)
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
& aKey
|
The 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)
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.
Parameters
const
TDesC8
& aKey
|
The 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)
void
|
Reset
|
(
|
void
|
|
)
|
[virtual]
|
Resets the cipher back to its original state. Clears all its buffers.
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.