|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Random
java.security.SecureRandom
org.random.rjgodoy.trng.MH_SecureRandom
public class MH_SecureRandom
A SecureRandom implementation accessing www.random.org.
Instances of this class do not require RjgodoyProvider
to be registered.
Before an instance of this class is constructed (either implicitly by SecureRandom
methods, or explicitly by invoking this class constructor
),
several System properties must be defined for configuring the shared the HTTP connection. Modifying these properties after an instance of this class has been created has no effect.
Other properties (namely INSTANCE_*) are instance-specific and apply to the subsequently created instances.
The org.random.rjgodoy.trng.pool_daemon
property is neither a global property nor an instance one:
there will be no daemon if all SecureRandomSpi
were instantiated with org.random.rjgodoy.trng.pool_daemon equal to false
;
otherwise, if at least one SecureRandomSpi
was instantiated while this property was true
and that SecureRandomSpi
is reachable,
then a daemon will be mantained.
Initialization based on system properties is synchronized with the MH_SecureRandom class object.
TODO: The reachable thing is not implemented. The daemon will be alive forever.
Field Summary | |
---|---|
static String |
CERTFILE
Local file with the public certificate of www.random.org. |
static String |
INSTANCE_FALLBACK
The FallbackPolicy that will be used. |
static String |
INSTANCE_MODE
The GeneratorMode that will be used. |
static String |
INSTANCE_PRNG_ALGORITHM
The algorithm of the auxiliar PRNG used. |
static String |
INSTANCE_PRNG_PROVIDER
The provider of the auxiliar PRNG used. |
static String |
MAX_REDIRECTS
How many HTTP redirects will be followed. |
static String |
POOL_DAEMON
Enables a thread running in the background for collectiong some bits from the remote source whenever the quota is 1.000.000. |
static String |
SSL_PROTOCOL
SSL Protocol parameter for instantiating SSLContext . |
static String |
SSL_PROVIDER
SSL Provider parameter for instantiating SSLContext . |
static String |
TIMEOUT
How long will the client wait for results from the server (in minutes). |
static String |
USER
Your mail address. |
Constructor Summary | |
---|---|
MH_SecureRandom()
Initializes a new instance of SecureRandom using the MH_SecureRandomSpi implementation. |
Method Summary |
---|
Methods inherited from class java.security.SecureRandom |
---|
generateSeed, getAlgorithm, getInstance, getInstance, getInstance, getProvider, getSeed, next, nextBytes, setSeed, setSeed |
Methods inherited from class java.util.Random |
---|
nextBoolean, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String USER
This property is required (see http://www.random.org/clients/) and should be a valid email address. However, you may provide a fake email address because of privacy issues (for this purpose, @example.org domain addresses are strongly encouraged).
This address will be ONLY used for contacting you if your client instance cause problems. Note that providing a fake email address will not disallow access, but if any problem occurs it will be impossible to contact you, and your IP may be banned in consequence.
Property | org.random.rjgodoy.trng.user. |
Scope | global |
public static final String TIMEOUT
This only applies to submitted request, it has nothing to do about waiting after the quota is exhausted. Use a long timeout value for your requests. Unless you have used up your quota, the RANDOM.ORG server actually tries to satisfy all requests, so if you use a short timeout value, your request will be abandoned halfways and the numbers discarded. This increases load on the server and probably will decrement your quota (because the server had consumed the randomness source, even though it could not deliver the result). Allow at least a couple of minutes for the server to complete your request.
Property | org.random.rjgodoy.trng.timeout |
Default | 2 minutes |
Minimum | 1 minute |
Maximum | 596.5232352 minutes (or 0 for "infinite") |
Scope | global |
public static final String CERTFILE
Property | org.random.rjgodoy.trng.certfile |
Default | null (i.e. do not check).
|
Scope | global |
public static final String SSL_PROVIDER
SSLContext
.
Property | org.random.rjgodoy.trng.ssl_provider |
Default value | null (i.e. any provider)
|
Scope | global |
public static final String SSL_PROTOCOL
SSLContext
.
If this property is null
then SSL will be disabled (a plain HTTP connection will be used).
See Appendix A in the
Java Secure Socket Extension Reference Guide
for information about standard protocol names. Some allowed values are SSL, TLS, TLSv1.1, etc.
Property | org.random.rjgodoy.trng.ssl_protocol |
Default value | null (i.e. SSL disabled)
|
Scope | global |
public static final String MAX_REDIRECTS
Property | org.random.rjgodoy.trng.max_redirects |
Default value | 99 |
Minimum value | 0 |
Maximum value | 2147483647 |
Scope | global |
public static final String INSTANCE_FALLBACK
FallbackPolicy
that will be used.
Property | org.random.rjgodoy.trng.fallback |
Default value | TRNG |
Allowed values | TRNG, PRNG |
Scope | instance |
public static final String INSTANCE_MODE
GeneratorMode
that will be used.
Property | org.random.rjgodoy.trng.mode |
Default value | TRNG |
Allowed values | TRNG, TRNG_XOR_PRNG |
Scope | instance |
public static final String INSTANCE_PRNG_PROVIDER
This property is ignored when fallback is TRNG
and the generator mode is GeneratorMode.TRNG
.
The RJGODOY provider must not be specified as it would result in an endless loop.
Property | org.random.rjgodoy.trng.prng_provider |
Default value | null (i.e. any provider) |
Scope | instance |
public static final String INSTANCE_PRNG_ALGORITHM
This property is ignored when fallback is TRNG
and the generator mode is GeneratorMode.TRNG
.
See Appendix A in the Java Secure Socket Extension Reference Guide for information about standard protocol names. As of Java 1.6 the only standard value is SHA1PRNG; other algorithms may be available in some platforms or from third-party libraries.
The algorithm must no be provided by RjgodoyProvider
.
Property | org.random.rjgodoy.trng.prng_algorithm |
Default value | null (i.e. default algorithm) |
Scope | instance |
public static final String POOL_DAEMON
The amount of bits which will be collected may be modified through MH_PoolDaemon.setBlockSize(long)
Property | org.random.rjgodoy.trng.pool_daemon |
Default value | false |
Allowed values | false, true |
Scope | shared |
Constructor Detail |
---|
public MH_SecureRandom() throws NoSuchAlgorithmException, NoSuchProviderException
SecureRandom
using the MH_SecureRandomSpi
implementation.
This constructor is only intended for using MH_SecureRandom as a stand-alone class. The preferred mechanism is registering the provider RjgodoyProvider
and creating an instance by SecureRandom.getInstance
("RJGODOY","MH_TRNG").
NoSuchAlgorithmException
NoSuchProviderException
|
|||||||||
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. |