|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.security.SecureRandomSpi
org.random.rjgodoy.trng.MH_SecureRandomSpi
public class MH_SecureRandomSpi
SecureRandomSpi implementation that uses the True Random Number generator from
www.random.org.
Before the first instance of this class is constructed, several global System properties must be defined for configuring the shared the HTTP connection (which cannot be modified later).
Other properties are related to the TRNG behaviour, then they are instance-specific and may be specified before constructing each instance.
See MH_SecureRandom
.
Constructor Summary | |
---|---|
MH_SecureRandomSpi()
Initializes an instance of MH_SecureRandomSpi. |
Method Summary | |
---|---|
protected byte[] |
engineGenerateSeed(int numBytes)
Returns the given number of seed bytes. |
protected void |
engineNextBytes(byte[] bytes)
Generates a user-specified number of random bytes. |
protected void |
engineSetSeed(byte[] seed)
Reseeds this random object. |
protected void |
finalize()
Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MH_SecureRandomSpi() throws NoSuchAlgorithmException, NoSuchProviderException
The execution of this constructor is synchronized with the MH_SecureRandom class object for reading system properties
NoSuchAlgorithmException
- if org.random.rjgodoy.trng.prng_algorithm
was specified, but no provider implements such algorithm.
NoSuchProviderException
- if org.random.rjgodoy.trng.prng_provider
wsas specified, but it is not installed
IllegalArgumentException
- if any of org.random.rjgodoy.trng.mode
, org.random.rjgodoy.trng.fallback
is specified and it is invalidMethod Detail |
---|
protected byte[] engineGenerateSeed(int numBytes)
This method invoked engineNextBytes(byte[])
and pass it a byte array of length numBytes
.
engineGenerateSeed
in class SecureRandomSpi
numBytes
- the number of seed bytes to generate.
ProviderException
- see engineNextBytes(byte[])
protected void engineSetSeed(byte[] seed)
If a PRNG is being used, this method invokes the PNRG's SecureRandom.setSeed(byte[])
method with the given argument.
If no PRNG is being used, this method does nothing.
engineSetSeed
in class SecureRandomSpi
seed
- the seed.protected void engineNextBytes(byte[] bytes)
If a call to engineSetSeed(byte[])
had not occurred previously,
the first call to this method forces this SecureRandom implementation to seed itself.
This self-seeding will not occur if engineSetSeed was previously called.
engineNextBytes
in class SecureRandomSpi
bytes
- the array to be filled in with random bytes.
ProviderException
- if fallback is TRNG
,
there are no available bytes,
and the thread is interrupted while waiting for the quota top-up.protected void finalize() throws Throwable
Closes the shared socket upon finalization.
finalize
in class Object
Throwable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Submit a bug or request a feature | Copyright © (2008-2011) Roberto Javier Godoy |
Project Web Hosted by | SouceForge.net is registered trademark of SourceForge, Inc., in the United States and other countries. |