iaik.security.random
Class AnsiRandom

java.lang.Object
  |
  +--java.util.Random
        |
        +--java.security.SecureRandom
              |
              +--iaik.security.random.SecRandom
                    |
                    +--iaik.security.random.AnsiRandom
All Implemented Interfaces:
Serializable

public class AnsiRandom
extends SecRandom

This class implements a secure pseudorandom generator as specified in ANSI X9.17. It was specified for the generation of DES initialization vectors, and consequently uses a seed of only 64 bits. Therefore, it cannot be recommended for general use. Because Triple DES is used to generate the output, the IAIK provider must be installed.

In addition to the seed, X9.17 defines that it shall use the current system time. That means, if you generate two instances of AnsiRandom, they will output a different pseudo random sequence even if you specified the same seed. A setI() method is defined to allow modification of that second seed value.

Version:
File Revision 16
See Also:
Serialized Form

Constructor Summary
AnsiRandom()
          Generate a new AnsiRandom with the specified seed.
 
Method Summary
protected  void engineNextBytes(byte[] bytes)
          Return the next bytes.length pseudo random bytes.
protected  void engineSetSeed(byte[] seed)
          Set the seed to the given byte array.
 void setI()
          Set the I vector to the current time.
 void setI(long time)
          Set the I vector to the specified long.
 
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

AnsiRandom

public AnsiRandom()
           throws RandomException
Generate a new AnsiRandom with the specified seed. The seed must be at least eight bytes long, other bytes are ignored. The IAIK provider must be installed with Triple DES, otherwise a RandomException will be thrown.
Method Detail

setI

public void setI()
Set the I vector to the current time.

setI

public void setI(long time)
Set the I vector to the specified long. The I vector is a second seed value used in number generation.

engineNextBytes

protected void engineNextBytes(byte[] bytes)
Return the next bytes.length pseudo random bytes.
Overrides:
engineNextBytes in class SecRandom

engineSetSeed

protected void engineSetSeed(byte[] seed)
Set the seed to the given byte array. It must be at least eight bytes long, further bytes are ignored.
Overrides:
engineSetSeed in class SecRandom

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