public class

SecureRandomFactoryBean

extends Object
java.lang.Object
   ↳ org.springframework.security.core.token.SecureRandomFactoryBean

Class Overview

Creates a SecureRandom instance.

Summary

Public Constructors
SecureRandomFactoryBean()
Public Methods
SecureRandom getObject()
Class<SecureRandom> getObjectType()
boolean isSingleton()
void setAlgorithm(String algorithm)
Allows the Pseudo Random Number Generator (PRNG) algorithm to be nominated.
void setSeed(Resource seed)
Allows the user to specify a resource which will act as a seed for the SecureRandom instance.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public SecureRandomFactoryBean ()

Public Methods

public SecureRandom getObject ()

Throws
Exception

public Class<SecureRandom> getObjectType ()

public boolean isSingleton ()

public void setAlgorithm (String algorithm)

Allows the Pseudo Random Number Generator (PRNG) algorithm to be nominated. Defaults to "SHA1PRNG".

Parameters
algorithm to use (mandatory)

public void setSeed (Resource seed)

Allows the user to specify a resource which will act as a seed for the SecureRandom instance. Specifically, the resource will be read into an InputStream and those bytes presented to the setSeed(byte[]) method. Note that this will simply supplement, rather than replace, the existing seed. As such, it is always safe to set a seed using this method (it never reduces randomness).

Parameters
seed to use, or null if no additional seeding is needed