public class SecureRandomFactoryBean
extends java.lang.Object
implements org.springframework.beans.factory.FactoryBean<java.security.SecureRandom>
SecureRandom instance.| Constructor and Description |
|---|
SecureRandomFactoryBean() |
| Modifier and Type | Method and Description |
|---|---|
java.security.SecureRandom |
getObject() |
java.lang.Class<java.security.SecureRandom> |
getObjectType() |
boolean |
isSingleton() |
void |
setAlgorithm(java.lang.String algorithm)
Allows the Pseudo Random Number Generator (PRNG) algorithm to be nominated.
|
void |
setSeed(org.springframework.core.io.Resource seed)
Allows the user to specify a resource which will act as a seed for the
SecureRandom instance. |
public java.security.SecureRandom getObject()
throws java.lang.Exception
getObject in interface org.springframework.beans.factory.FactoryBean<java.security.SecureRandom>java.lang.Exceptionpublic java.lang.Class<java.security.SecureRandom> getObjectType()
getObjectType in interface org.springframework.beans.factory.FactoryBean<java.security.SecureRandom>public boolean isSingleton()
isSingleton in interface org.springframework.beans.factory.FactoryBean<java.security.SecureRandom>public void setAlgorithm(java.lang.String algorithm)
algorithm - to use (mandatory)public void setSeed(org.springframework.core.io.Resource seed)
SecureRandom instance. Specifically, the resource will be read into an
InputStream and those bytes presented to the
SecureRandom.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).seed - to use, or null if no additional seeding is needed