com.rsa.certj.provider.random

Class DefaultRandom

java.lang.Object
  |
  +--com.rsa.certj.Provider
        |
        +--com.rsa.certj.provider.random.DefaultRandom

public final class DefaultRandom
extends Provider

This class implements the default Cert-J random service provider. It uses HWRandom if available. If not, it uses SHA1Random.

Copyright © RSA Security Inc., 1999-2001. All rights reserved.


Constructor Summary

DefaultRandom(String name)

Constructs an instance of DefaultRandom named name.

DefaultRandom(String name, byte[] seed)

Constructs an instance of DefaultRandom named name, using the given byte array as a seed.

DefaultRandom(String name, long seed)

Constructs an instance of DefaultRandom named name, using the given long value as a seed.

 

Method Summary

 ProviderImplementation

instantiate(CertJ certJ)

Creates a ProviderImplementation object that handles the default random SPI methods.

 
Methods inherited from class com.rsa.certj.Provider
getName, getType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRandom

public DefaultRandom(String name)
              throws InvalidParameterException
Constructs an instance of DefaultRandom named name.

Parameters

         name  

A String indicating the name of this service provider.

Throws

InvalidParameterException - If any argument is invalid.

DefaultRandom

public DefaultRandom(String name,
                     long seed)
              throws InvalidParameterException
Constructs an instance of DefaultRandom named name, using the given long value as a seed.

Parameters

         name  

A String identifying this service provider.

         seed  

A long to used as a seed. Note that if you are using multiple threads each of which uses a separate copy of DefaultRandom with the same seed argument, a random number generated by one thread may collide with a random number generated by another thread. To avoid this situation, provide a thread-specific seed value. For example, some applications may use the random number provider to generate a transaction ID to send to a server. The server may reject your request if the transaction ID generated by one of your threads is already in use by one of your other threads.

Throws

InvalidParameterException - If any argument is invalid.

DefaultRandom

public DefaultRandom(String name,
                     byte[] seed)
              throws InvalidParameterException
Constructs an instance of DefaultRandom named name, using the given byte array as a seed.

Parameters

         name  

A String identifying this service provider.

         seed  

A byte array that is to be used as a seed. Note that if you are using multiple threads each of which uses a separate copy of DefaultRandom with the same seed argument, a random number generated by one thread may collide with a random number generated by another thread. To avoid this situation, provide a thread-specific seed value. For example, some applications may use the random number provider to generate a transaction ID to send to a server. The server may reject your request if the transaction ID generated by one of your threads is already in use by one of your other threads.

Throws

InvalidParameterException - If any argument is invalid.
Method Detail

instantiate

public ProviderImplementation instantiate(CertJ certJ)
                                   throws ProviderManagementException
Creates a ProviderImplementation object that handles the default random SPI methods. This method is called by CertJ.registerService when an object of the DefaultRandom class is being registered. Applications do not have to call this method.

Overrides

instantiate in class Provider

Parameters

         certJ  

A CertJ object for which the created provider is registered.

Returns

A ProviderImplementation object that provides the default random SPI implementations.

Throws

ProviderManagementException - If instantiation of the default random provider fails.


RSA BSAFE ® Cert-J 2.1.1 001-047007-211-001-000