Save This Page
Home » apache-harmony-6.0-src-r917296-snapshot » java » security » [javadoc | source]
java.security
public class: SecureRandom [javadoc | source]
java.lang.Object
   java.util.Random
      java.security.SecureRandom

All Implemented Interfaces:
    Serializable

{@code SecureRandom} is an engine class which is capable of generating cryptographically secure pseudo-random numbers.
Constructor:
 public SecureRandom() 
 public SecureRandom(byte[] seed) 
 protected SecureRandom(SecureRandomSpi secureRandomSpi,
    Provider provider) 
    Constructs a new instance of {@code SecureRandom} using the given implementation from the specified provider.
    Parameters:
    secureRandomSpi - the implementation.
    provider - the security provider.
Method from java.security.SecureRandom Summary:
generateSeed,   getAlgorithm,   getInstance,   getInstance,   getInstance,   getProvider,   getSeed,   next,   nextBytes,   setSeed,   setSeed
Methods from java.util.Random:
next,   nextBoolean,   nextBytes,   nextDouble,   nextFloat,   nextGaussian,   nextInt,   nextInt,   nextLong,   setSeed
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from java.security.SecureRandom Detail:
 public byte[] generateSeed(int numBytes) 
    Generates and returns the specified number of seed bytes, computed using the seed generation algorithm used by this {@code SecureRandom}.
 public String getAlgorithm() 
    Returns the name of the algorithm of this {@code SecureRandom}.
 public static SecureRandom getInstance(String algorithm) throws NoSuchAlgorithmException 
    Returns a new instance of {@code SecureRandom} that utilizes the specified algorithm.
 public static SecureRandom getInstance(String algorithm,
    String provider) throws NoSuchAlgorithmException, NoSuchProviderException 
    Returns a new instance of {@code SecureRandom} that utilizes the specified algorithm from the specified provider.
 public static SecureRandom getInstance(String algorithm,
    Provider provider) throws NoSuchAlgorithmException 
    Returns a new instance of {@code SecureRandom} that utilizes the specified algorithm from the specified provider.
 public final Provider getProvider() 
    Returns the provider associated with this {@code SecureRandom}.
 public static byte[] getSeed(int numBytes) 
    Generates and returns the specified number of seed bytes, computed using the seed generation algorithm used by this {@code SecureRandom}.
 protected final int next(int numBits) 
    Generates and returns an {@code int} containing the specified number of random bits (right justified, with leading zeros).
 public synchronized  void nextBytes(byte[] bytes) 
    Generates and stores random bytes in the given {@code byte[]} for each array element.
 public synchronized  void setSeed(byte[] seed) 
    Reseeds this {@code SecureRandom} instance with the specified {@code seed}. The seed of this {@code SecureRandom} instance is supplemented, not replaced.
 public  void setSeed(long seed) 
    Reseeds this this {@code SecureRandom} instance with the eight bytes described by the representation of the given {@code long seed}. The seed of this {@code SecureRandom} instance is supplemented, not replaced.