RInteger Class Reference

class RInteger : public TInteger

A TInteger derived class allowing the construction of variable length big integers. See the Cryptography API guide for further information.

TInteger

Inherits from

Public Member Functions
RInteger(void)
RInteger(const RInteger &)
IMPORT_C voidCallClose(TAny *)
IMPORT_C voidClose(void)
IMPORT_C RIntegerNewEmptyL(TUint)
IMPORT_C RIntegerNewL(void)
IMPORT_C RIntegerNewL(const TDesC8 &)
IMPORT_C RIntegerNewL(const TInteger &)
IMPORT_C RIntegerNewL(TInt)
IMPORT_C RIntegerNewL(TUint)
IMPORT_C RIntegerNewPrimeL(TUint, TRandomAttribute)
IMPORT_C RIntegerNewRandomL(TUint, TRandomAttribute)
IMPORT_C RIntegerNewRandomL(const TInteger &, const TInteger &)
IMPORT_Coperator TCleanupItem()
IMPORT_C RInteger &operator=(const RInteger &)
Inherited Functions
TInteger::Bit(TUint)const
TInteger::BitCount(void)const
TInteger::BufferLC()const
TInteger::BufferWithNoTruncationLC()const
TInteger::ByteCount(void)const
TInteger::CleanGrowL(TUint)
TInteger::CleanNewL(TUint)
TInteger::CleanResizeL(TUint)
TInteger::Construct(TInt)
TInteger::Construct(TUint)
TInteger::Construct(const TDesC8 &)
TInteger::Construct(const TInteger &)
TInteger::ConstructStack(TUint,TUint)
TInteger::ConstructStack(TUint,const TInteger &)
TInteger::ConvertToLong(void)const
TInteger::ConvertToLongL(void)const
TInteger::ConvertToUnsignedLong(void)const
TInteger::CopyL(const TInt,TBool)
TInteger::CopyL(const TInteger &,TBool)
TInteger::CreateNewL(TUint)
TInteger::DivideL(RInteger &,RInteger &,const TInteger &,const TInteger &)const
TInteger::DivideL(TUint &,RInteger &,const TInteger &,TUint)const
TInteger::DividedByL(TUint)const
TInteger::DividedByL(const TInteger &)const
TInteger::ExponentiateL(const TInteger &)const
TInteger::GCDL(const TInteger &)const
TInteger::InverseModL(const TInteger &)const
TInteger::IsConvertableToLong(void)const
TInteger::IsEven()const
TInteger::IsHeapBased(void)const
TInteger::IsNegative()const
TInteger::IsOdd()const
TInteger::IsPositive()const
TInteger::IsPrimeL(void)const
TInteger::IsStackBased(void)const
TInteger::IsZero()const
TInteger::MinusL(const TInteger &)const
TInteger::ModularExponentiateL(const TInteger &,const TInteger &,const TInteger &)
TInteger::ModularMultiplyL(const TInteger &,const TInteger &,const TInteger &)
TInteger::Modulo(const TInteger &,TUint)const
TInteger::ModuloL(TUint)const
TInteger::ModuloL(const TInteger &)const
TInteger::Negate(void)
TInteger::NotNegative()const
TInteger::NotPositive()const
TInteger::NotZero()const
TInteger::One(void)
TInteger::PlusL(const TInteger &)const
TInteger::PositiveAddL(const TInteger &,const TInteger &)const
TInteger::PositiveDivide(TUint &,TInteger &,const TInteger &,TUint)const
TInteger::PositiveDivideL(RInteger &,RInteger &,const TInteger &,const TInteger &)const
TInteger::PositiveMultiplyL(const TInteger &,const TInteger &)const
TInteger::PositiveSubtractL(const TInteger &,const TInteger &)const
TInteger::PrimeRandomizeL(TUint,TRandomAttribute)
TInteger::Ptr(void)const
TInteger::RandomizeL(TUint,TRandomAttribute)
TInteger::RandomizeL(const TInteger &,const TInteger &)
TInteger::Set(const RInteger &)
TInteger::SetBit(TUint)
TInteger::SetHeapBased(void)
TInteger::SetPtr(TUint *)
TInteger::SetSign(TSign)
TInteger::SetSize(TUint)
TInteger::SetStackBased(void)
TInteger::Sign(void)const
TInteger::SignedCompare(TInt)const
TInteger::SignedCompare(const TInteger &)const
TInteger::Size(void)const
TInteger::SmallPrimeRandomizeL(void)
TInteger::SquaredL(void)const
TInteger::TInteger(void)
TInteger::TimesL(const TInteger &)const
TInteger::Two(void)
TInteger::UnsignedCompare(const TInteger &)const
TInteger::WordCount(void)const
TInteger::Zero(void)
TInteger::operator!()const
TInteger::operator!=(TInt)const
TInteger::operator!=(const TInteger &)const
TInteger::operator%=(TInt)
TInteger::operator%=(const TInteger &)
TInteger::operator*=(TInt)
TInteger::operator*=(const TInteger &)
TInteger::operator++()
TInteger::operator+=(TInt)
TInteger::operator+=(const TInteger &)
TInteger::operator--()
TInteger::operator-=(TInt)
TInteger::operator-=(const TInteger &)
TInteger::operator/=(TInt)
TInteger::operator/=(const TInteger &)
TInteger::operator<(TInt)const
TInteger::operator<(const TInteger &)const
TInteger::operator<<=(TUint)
TInteger::operator<=(TInt)const
TInteger::operator<=(const TInteger &)const
TInteger::operator==(TInt)const
TInteger::operator==(const TInteger &)const
TInteger::operator>(TInt)const
TInteger::operator>(const TInteger &)const
TInteger::operator>=(TInt)const
TInteger::operator>=(const TInteger &)const
TInteger::operator>>=(TUint)
Inherited Enumerations
TInteger:TRandomAttribute
TInteger:TSign
Inherited Attributes
TInteger::iPtr
TInteger::iSize

Constructor & Destructor Documentation

RInteger(void)

IMPORT_CRInteger(void)

Creates an RInteger object with no associated internal (heap) storage.

All data members are initialised to zero. It is safe (although not strictly necessary) to push such an RInteger object onto the CleanupStack. This is useful, for example, if you want to pass an RInteger object by reference into a function and have it create the representation of the actual integer for you.

Note that performing any operation on such an RInteger object other than the default assignment operator or copy constructor will panic your code.

Parameters

void

RInteger(const RInteger &)

IMPORT_CRInteger(const RInteger &aInteger)

Copy constructor

This function performs a shallow copy, i.e. the memory holding the integer is not copied.

Parameters

const RInteger & aInteger

Member Functions Documentation

CallClose(TAny *)

IMPORT_C voidCallClose(TAny *aPtr)[static]

Helper function registered with the cleanup stack that just calls Close() for this RInteger object.

Parameters

TAny * aPtrA pointer to the object for which clean-up is to be performed.

Close(void)

IMPORT_C voidClose(void)

Zeros and then frees any memory owned by this RInteger object.

An RInteger object that has been closed can safely fall off the stack.

Parameters

void

NewEmptyL(TUint)

IMPORT_C RIntegerNewEmptyL(TUintaNumWords)[static]

Creates a new integer with a preallocated internal storage of aNumWords all initialised to zero.

The resulting RInteger object is logically equivalent to RInteger::NewL(0). The only difference is that the internal storage requirements have been specified to be larger than the default. This is useful if you are about to perform an operation on this integer, that you know the resulting size requirements of, and wish to avoid a heap resize.

Parameters

TUint aNumWordsThe number of words for to preallocated and zero fill.

NewL(void)

IMPORT_C RIntegerNewL(void)[static]

Creates a new integer representing 0.

Parameters

void

NewL(const TDesC8 &)

IMPORT_C RIntegerNewL(const TDesC8 &aValue)[static]

Creates a new integer object representing a specified value.

Parameters

const TDesC8 & aValueA descriptor containing the big-endian binary representation of the value.

NewL(const TInteger &)

IMPORT_C RIntegerNewL(const TInteger &aInteger)[static]

Creates an exact copy of an aInteger object.

Parameters

const TInteger & aIntegerThe integer you wish to copy

NewL(TInt)

IMPORT_C RIntegerNewL(TIntaInteger)[static]

Creates a new integer from the value represented by aInteger.

Parameters

TInt aIntegerA signed word sized integer.

NewL(TUint)

IMPORT_C RIntegerNewL(TUintaInteger)[static]

Creates a new integer from the value represented by aInteger.

Parameters

TUint aIntegerAn unsigned word sized integer.

NewPrimeL(TUint, TRandomAttribute)

IMPORT_C RIntegerNewPrimeL(TUintaBits,
TRandomAttributeaAttr = EAllBitsRandom
)[static]

Finds a random prime integer in the range of [2, 2^aBits].

This is done by picking a random integer and using that as a starting point for a sequential search for a prime. To verify the primality of number, this algorithm uses a probablistic primality test. This means that it is possible, although extremely improbable, that the number returned is a pseudoprime.

Parameters

TUint aBitsThe number of bits you wish to randomly select your prime from.
TRandomAttribute aAttr = EAllBitsRandomEnum specifying whether specific bits in the random number should be set. See TRandomAttribute for more information.

NewRandomL(TUint, TRandomAttribute)

IMPORT_C RIntegerNewRandomL(TUintaBits,
TRandomAttributeaAttr = EAllBitsRandom
)[static]

Creates a random integer uniformly distributed over [0, 2^aBits].

Parameters

TUint aBitsThe number of bits you wish to randomly select.
TRandomAttribute aAttr = EAllBitsRandomEnum specifying whether specific bits in the random number should be set. See TRandomAttribute for more information.

NewRandomL(const TInteger &, const TInteger &)

IMPORT_C RIntegerNewRandomL(const TInteger &aMin,
const TInteger &aMax
)[static]

Creates a random integer uniformly distributed over [x | min <= x <= max].

Parameters

const TInteger & aMinThe smallest possible value for the random integer (inclusive).
const TInteger & aMaxThe largest possible value for the random integer (inclusive).

operator TCleanupItem()

IMPORT_Coperator TCleanupItem()

An overloaded TCleanupItem() allowing the RIntegers to be pushed, popped, and destroyed via the CleanupStack like any other CBase derived object.

operator=(const RInteger &)

IMPORT_C RInteger &operator=(const RInteger &aInteger)

Assignment operator

This function performs a shallow copy, i.e. the memory holding the integer is not copied.

Parameters

const RInteger & aInteger