net.rim.device.api.crypto
Class FIPS186PseudoRandomSource

java.lang.Object
  extended by net.rim.device.api.crypto.AbstractPseudoRandomSource
      extended by net.rim.device.api.crypto.FIPS186PseudoRandomSource
All Implemented Interfaces:
PseudoRandomSource

public final class FIPS186PseudoRandomSource
extends AbstractPseudoRandomSource
implements PseudoRandomSource

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.

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

Constructor Summary
Category: Signed FIPS186PseudoRandomSource(byte[] seed)
          Creates a FIPS186PseudoRandomSource (PRNG) object using a given seed key and the revised FIPS 186-2 version of this algorithm.
Category: Signed 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.
Category: Signed 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.
Category: Signed 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
Category: Signed  String getAlgorithm()
          Returns the name of this algorithm, "FIPS186".
Category: Signed  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()).
Category: Signed  int getMaxAvailable()
          Returns the maximum number of pseudo random bytes that this PRNG can produce following a call to reset().
Category: Signed  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

FIPS186PseudoRandomSource

public FIPS186PseudoRandomSource(byte[] seed)
Creates a FIPS186PseudoRandomSource (PRNG) object using a given seed key and the revised FIPS 186-2 version of this algorithm.

Parameters:
seed - The seed key to use. Note that seed.length must be between 20 and 64 bytes.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

FIPS186PseudoRandomSource

public 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.

Parameters:
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.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

FIPS186PseudoRandomSource

public 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.

Parameters:
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.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

FIPS186PseudoRandomSource

public 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.

Parameters:
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 algorithm
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0


Method Detail

getAlgorithm

public String getAlgorithm()
Returns the name of this algorithm, "FIPS186".

This method will always return the String "FIPS186".

Specified by:
getAlgorithm in interface PseudoRandomSource
Returns:
A String representing the name of the algorithm.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

xorBytes

public void xorBytes(byte[] buffer,
                     int offset,
                     int length)
Exclusive-OR's (xor) random bytes into the specified buffer starting at the specified array offset.

Specified by:
xorBytes in interface PseudoRandomSource
Specified by:
xorBytes in class AbstractPseudoRandomSource
Parameters:
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.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getAvailable

public 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()).

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.

Specified by:
getAvailable in interface PseudoRandomSource
Returns:
An integer that represents the number of bytes.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0

getMaxAvailable

public int getMaxAvailable()
Returns the maximum number of pseudo random bytes that this PRNG can produce following a call 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.

Specified by:
getMaxAvailable in interface PseudoRandomSource
Returns:
An integer that specifies the maximum number of random bytes that can be produced.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 3.6.0





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