Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle Security Developer Tools Crypto Java API Reference 10g Release 3 (10.1.3) B25378-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.security.crypto.core
Class RandomBitsSource

`java.lang.Object
oracle.security.crypto.core.RandomBitsSource`

Direct Known Subclasses:
  DigestRandomBitsSource

public abstract class RandomBitsSource
extends java.lang.Object

An abstract class representing secure PRNG (pseudo-random number generator) implementations.

Please note that, by the very nature of PRNGs, the security of their output depends crucially on the amount and "quality" of seeding entropy used. Implementing classes should provide guidance as to their proper initialization and use.

See Also:
  `EntropySource`, `SpinnerEntropySource`

Constructor Summary
`protected` | `RandomBitsSource()`

Method Summary
`abstract void` | `clear()` Clears out sensitive data pools within the PRNG.
`static RandomBitsSource` | `getDefault()` Get the default random bits source.
`java.math.BigInteger` | `randomBigInteger(int len)` Provided as an alternative to `BigInteger(int, java.util.Random)`.
`abstract byte` | `randomByte()` Generate a random byte.
`byte[]` | `randomBytes(byte[] bytes)` Fill a byte array with random bytes.
`void` | `seed()` Seed from the system default entropy source.
`abstract void` | `seed(byte[] seed)` Seed the PRNG with the supplied array of bytes.
`abstract void` | `seed(EntropySource egs)` Seed the PRNG with a default number of bytes from the supplied entropy source.\
`static void` | `setDefault(RandomBitsSource rbs)` Sets the default random bits source for the current run-time environment.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### RandomBitsSource

    protected RandomBitsSource()

Method Detail

### seed

    public abstract void seed(byte[] seed)

  Seed the PRNG with the supplied array of bytes.

### seed

    public abstract void seed(EntropySource egs)

  Seed the PRNG with a default number of bytes from the supplied entropy source.\

  Note that entropy source algorithms are frequently time and/or resource-intensive, which may cause significant delay before this method returns.

### seed

    public void seed()

  Seed from the system default entropy source.

### randomByte

    public abstract byte randomByte()

  Generate a random byte.

### randomBytes

    public byte[] randomBytes(byte[] bytes)

  Fill a byte array with random bytes.

### randomBigInteger

    public java.math.BigInteger randomBigInteger(int len)

  Provided as an alternative to `BigInteger(int, java.util.Random)`. Returns a BigInteger uniformly distributed within the interval of the requested length (polling for as many random bytes from the random bits source as necessary). (Note that, as a consequence, the bit length of the returned integer will -- exactly half the time -- be less than the length requested.)

### getDefault

    public static RandomBitsSource getDefault()

  Get the default random bits source. If the default is not set, a new MD5RandomBitsSource is created, seeded and returned. Note: Successive calls to `getDefault` will return additional references to the same `RandomBitsSource` instance. This must be taken into consideration by programmers developing multi-threaded applications.
  See Also:
    `setDefault(oracle.security.crypto.core.RandomBitsSource)`

### setDefault

    public static void setDefault(RandomBitsSource rbs)

  Sets the default random bits source for the current run-time environment.
  See Also:
    `getDefault()`

### clear

    public abstract void clear()

  Clears out sensitive data pools within the PRNG. Note that in so doing, the PRNG may be brought to an unusable state (e.g. requiring new seed material). Implementing classes should throw an exception when random bytes are request in this case.

Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle Security Developer Tools Crypto Java API Reference 10g Release 3 (10.1.3) B25378-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005, 2006 , Oracle. All rights reserved.