|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.crypto.AbstractPseudoRandomSource
net.rim.device.api.crypto.FIPS186PseudoRandomSource
public final class FIPS186PseudoRandomSource
Implements the pseudo random number generator as found in FIPS 186-2. Both versions of the PseudoRandomSource algorithm are implemented with the revised ( and more secure ) version used by default.
Constructor Summary | ||
---|---|---|
|
FIPS186PseudoRandomSource(byte[] seed)
Creates a FIPS186PseudoRandomSource (PRNG) object using a given seed key and
the revised FIPS 186-2 version of this algorithm. |
|
|
FIPS186PseudoRandomSource(byte[] seed,
byte[] additionalSeed)
Creates a FIPS186PseudoRandomSource (PRNG) object using a given seed key, the
additional user seed and
the revised FIPS 186-2 version of this algorithm. |
|
|
FIPS186PseudoRandomSource(byte[] seed,
int offset,
int length)
Creates a FIPS186PseudoRandomSource (PRNG) object using a given seed key and
the revised FIPS 186-2 version of this algorithm. |
|
|
FIPS186PseudoRandomSource(byte[] seed,
int offset,
int length,
byte[] additionalSeed,
int additionalSeedOffset,
int additionalSeedLength,
boolean useRevisedAlgorithm)
Creates a FIPS186PseudoRandomSource (PRNG) object using a given seed key, the
additional user seed the optional to specify whether to use the orignal or revised version of this
algorithm as defined in FIPS 186/182-2. |
Method Summary | ||
---|---|---|
|
String |
getAlgorithm()
Returns the name of this algorithm, "FIPS186". |
|
int |
getAvailable()
Returns the number of pseudo random bytes currently available (this value is reset to the value returned by getMaxAvailable()
with calls to reset() ). |
|
int |
getMaxAvailable()
Returns the maximum number of pseudo random bytes that this PRNG can produce following a call to reset() . |
|
void |
xorBytes(byte[] buffer,
int offset,
int length)
Exclusive-OR's (xor) random bytes into the specified buffer starting at the specified array offset. |
Methods inherited from class net.rim.device.api.crypto.AbstractPseudoRandomSource |
---|
getBytes, getBytes, getBytes, xorBytes, xorBytes, xorCopy, xorCopy |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.rim.device.api.crypto.PseudoRandomSource |
---|
getBytes, getBytes, getBytes, xorBytes, xorBytes, xorCopy, xorCopy |
Constructor Detail |
---|
public FIPS186PseudoRandomSource(byte[] seed)
FIPS186PseudoRandomSource
(PRNG) object using a given seed key and
the revised FIPS 186-2 version of this algorithm.
seed
- The seed key to use. Note that seed.length must be between 20 and 64 bytes.public FIPS186PseudoRandomSource(byte[] seed, int offset, int length)
FIPS186PseudoRandomSource
(PRNG) object using a given seed key and
the revised FIPS 186-2 version of this algorithm.
seed
- The seed key to use.offset
- The starting offset of the seed data.length
- The number of bytes to use as seed data. Note that length must be between 20 and 64 bytes.public FIPS186PseudoRandomSource(byte[] seed, byte[] additionalSeed)
FIPS186PseudoRandomSource
(PRNG) object using a given seed key, the
additional user seed and
the revised FIPS 186-2 version of this algorithm.
seed
- The seed key to use. Note that seed.length must be between 20 and 64 bytes.additionalSeed
- The additional user seed to use. Note that additionalSeed.length must be between 20 and 64 bytes.public FIPS186PseudoRandomSource(byte[] seed, int offset, int length, byte[] additionalSeed, int additionalSeedOffset, int additionalSeedLength, boolean useRevisedAlgorithm)
FIPS186PseudoRandomSource
(PRNG) object using a given seed key, the
additional user seed the optional to specify whether to use the orignal or revised version of this
algorithm as defined in FIPS 186/182-2.
seed
- The seed key to use.offset
- The starting offset of the seed data.length
- The number of bytes to use as seed data. Note that length must be between 20 and 64 bytes.additionalSeed
- The additional user seed to use.additionalSeedoffset
- The starting offset of the additional user seed. If additionalSeed
is
null
, this value is ignored.additionalSeedLength
- The number of bytes to use as additional user seed. Note that additionalSeedLength
must be between 20 and 64 bytes. If additionalSeed
is null
, this value is ignored.useRevisedAlgorithm
- A flag to indicate which verison of the algorithm to use. If true, use the revised
FIPS 186-2 algorithm, else use the original algorithmMethod Detail |
---|
public String getAlgorithm()
This method will always return the String "FIPS186".
getAlgorithm
in interface PseudoRandomSource
public void xorBytes(byte[] buffer, int offset, int length)
xorBytes
in interface PseudoRandomSource
xorBytes
in class AbstractPseudoRandomSource
buffer
- The buffer to xor the bytes into.offset
- The starting offset, or initial position of the data, within buffer.length
- The number of bytes to xor.public int getAvailable()
getMaxAvailable()
with calls to reset()
).
For PRNG sources that have an indefinite length but implement this interface, the value returned is the maximum signed value that will fit into an int.
getAvailable
in interface PseudoRandomSource
public int getMaxAvailable()
reset()
.
For PRNG sources that have an indefinite length but implement this interface, the value returned is the maximum signed value that will fit into an int.
getMaxAvailable
in interface PseudoRandomSource
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal