iaik.security.random
Class FIPS186Random

java.lang.Object
  |
  +--java.util.Random
        |
        +--java.security.SecureRandom
              |
              +--iaik.security.random.SecRandom
                    |
                    +--iaik.security.random.FIPS186Random
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
RipeMd160FIPS186Random, SHA1FIPS186Random, SHA256FIPS186Random, SHA384FIPS186Random, SHA512FIPS186Random

public abstract class FIPS186Random
extends SecRandom

This class implements a secure pseudo-random number generator based on a MessageDigest. It cannot be used directly and has to be subclassed. Subclasses just have to call the superclass constructor with the MessageDigest object as parameter, everything else is taken care of.

This pseudo random works according to FIPS PUB 186-2 with an hash function as one-way function G(t,c). As this is a general purpose random generator, the mod q operation is omitted. As a consequence of omitting this modulo operation, the changes to the FIPS PUB 186-2 pseudo random generator need not be considered, because they have no influence in this case.

The concrete classes are derived from this class and provide a raw hash algorithm. The raw hash provides access to the raw compression function. This algorithm requires a raw hash rather than a complete hash, because this FIPS algorithm operates on the compression function part and not on the complete hash function. The complete hash function includes a certain padding, which this algorithm does not; it simply appends zeros up to the required block size.

Version:
File Revision 7
See Also:
SHA1FIPS186Random, SHA256FIPS186Random, SHA384FIPS186Random, SHA512FIPS186Random, RipeMd160FIPS186Random, SeedGenerator, Serialized Form

Constructor Summary
protected FIPS186Random(RawHash hash)
          Constructor for use by subclasses.
 
Method Summary
protected  void engineNextBytes(byte[] bytes)
          Return bytes.length random bytes.
protected  void engineSetSeed(byte[] seed)
          Add this seed to the internal seed.
 
Methods inherited from class iaik.security.random.SecRandom
getDefault, nextBytes, setDefault, setSeed, setSeed, setSeed
 
Methods inherited from class java.security.SecureRandom
generateSeed, getInstance, getInstance, getProvider, getSeed, next
 
Methods inherited from class java.util.Random
nextBoolean, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FIPS186Random

protected FIPS186Random(RawHash hash)
Constructor for use by subclasses. The given raw Hash object itself will be used, it will not be cloned.
Parameters:
digest - The raw hash function to use.
Method Detail

engineSetSeed

protected void engineSetSeed(byte[] seed)
Add this seed to the internal seed.
Overrides:
engineSetSeed in class SecRandom
Parameters:
seed - The seed to feed into this pseudo random generator.

engineNextBytes

protected void engineNextBytes(byte[] bytes)
Return bytes.length random bytes.
Overrides:
engineNextBytes in class SecRandom
Parameters:
bytes - The buffer to fill with random bytes.

This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK