java.security
Class AlgorithmParameterGenerator

java.lang.Object
  |
  +--java.security.AlgorithmParameterGenerator

public class AlgorithmParameterGenerator
extends Object

Untamed: The AlgorithmParameterGenerator class is used to generate a set of parameters to be used with a certain algorithm. Parameter generators are constructed using the getInstance factory methods (static methods that return instances of a given class).

The object that will generate the parameters can be initialized in two different ways: in an algorithm-independent manner, or in an algorithm-specific manner:

In case the client does not explicitly initialize the AlgorithmParameterGenerator (via a call to an init method), each provider must supply (and document) a default initialization. For example, the Sun provider uses a default modulus prime size of 1024 bits for the generation of DSA parameters.

Since:
1.2
Version:
1.38, 12/03/01
Author:
Jan Luehe
See Also:
AlgorithmParameters, java.security.spec.AlgorithmParameterSpec

Field Summary
private  String algorithm
           
private  AlgorithmParameterGeneratorSpi paramGenSpi
           
private  Provider provider
           
 
Constructor Summary
protected AlgorithmParameterGenerator(AlgorithmParameterGeneratorSpi paramGenSpi, Provider provider, String algorithm)
          Creates an AlgorithmParameterGenerator object.
 
Method Summary
 AlgorithmParameters generateParameters()
          Enabled: Generates the parameters.
 String getAlgorithm()
          Enabled: Returns the standard name of the algorithm this parameter generator is associated with.
static AlgorithmParameterGenerator getInstance(String algorithm)
          Enabled: Generates an AlgorithmParameterGenerator object that implements the specified digest algorithm.
static AlgorithmParameterGenerator getInstance(String algorithm, Provider provider)
          Enabled: Generates an AlgorithmParameterGenerator object for the requested algorithm, as supplied from the specified provider, if such a parameter generator is available from the provider.
static AlgorithmParameterGenerator getInstance(String algorithm, String provider)
          Enabled: Generates an AlgorithmParameterGenerator object for the requested algorithm, as supplied from the specified provider, if such a parameter generator is available from the provider.
 Provider getProvider()
          Enabled: Returns the provider of this algorithm parameter generator object.
 void init(AlgorithmParameterSpec genParamSpec)
          Enabled: Initializes this parameter generator with a set of algorithm-specific parameter generation values.
 void init(AlgorithmParameterSpec genParamSpec, SecureRandom random)
          Enabled: Initializes this parameter generator with a set of algorithm-specific parameter generation values.
 void init(int size)
          Enabled: Initializes this parameter generator for a certain size.
 void init(int size, SecureRandom random)
          Enabled: Initializes this parameter generator for a certain size and source of randomness.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

provider

private Provider provider

paramGenSpi

private AlgorithmParameterGeneratorSpi paramGenSpi

algorithm

private String algorithm
Constructor Detail

AlgorithmParameterGenerator

protected AlgorithmParameterGenerator(AlgorithmParameterGeneratorSpi paramGenSpi,
                                      Provider provider,
                                      String algorithm)
Creates an AlgorithmParameterGenerator object.

Parameters:
paramGenSpi - the delegate
provider - the provider
algorithm - the algorithm
Method Detail

getAlgorithm

public final String getAlgorithm()
Enabled: Returns the standard name of the algorithm this parameter generator is associated with.

Returns:
the string name of the algorithm.

getInstance

public static AlgorithmParameterGenerator getInstance(String algorithm)
                                               throws NoSuchAlgorithmException
Enabled: Generates an AlgorithmParameterGenerator object that implements the specified digest algorithm. If the default provider package provides an implementation of the requested digest algorithm, an instance of AlgorithmParameterGenerator containing that implementation is returned. If the algorithm is not available in the default package, other packages are searched.

Parameters:
algorithm - the string name of the algorithm this parameter generator is associated with.
Returns:
the new AlgorithmParameterGenerator object.
NoSuchAlgorithmException

getInstance

public static AlgorithmParameterGenerator getInstance(String algorithm,
                                                      String provider)
                                               throws NoSuchAlgorithmException,
                                                      NoSuchProviderException
Enabled: Generates an AlgorithmParameterGenerator object for the requested algorithm, as supplied from the specified provider, if such a parameter generator is available from the provider.

Parameters:
algorithm - the string name of the algorithm.
provider - the string name of the provider.
Returns:
the new AlgorithmParameterGenerator object.
NoSuchAlgorithmException
NoSuchProviderException
See Also:
Provider

getInstance

public static AlgorithmParameterGenerator getInstance(String algorithm,
                                                      Provider provider)
                                               throws NoSuchAlgorithmException
Enabled: Generates an AlgorithmParameterGenerator object for the requested algorithm, as supplied from the specified provider, if such a parameter generator is available from the provider. Note: the provider doesn't have to be registered.

Parameters:
algorithm - the string name of the algorithm.
provider - the provider.
Returns:
the new AlgorithmParameterGenerator object.
NoSuchAlgorithmException
Since:
1.4
See Also:
Provider

getProvider

public final Provider getProvider()
Enabled: Returns the provider of this algorithm parameter generator object.

Returns:
the provider of this algorithm parameter generator object

init

public final void init(int size)
Enabled: Initializes this parameter generator for a certain size. To create the parameters, the SecureRandom implementation of the highest-priority installed provider is used as the source of randomness. (If none of the installed providers supply an implementation of SecureRandom, a system-provided source of randomness is used.)

Parameters:
size - the size (number of bits).

init

public final void init(int size,
                       SecureRandom random)
Enabled: Initializes this parameter generator for a certain size and source of randomness.

Parameters:
size - the size (number of bits).
random - the source of randomness.

init

public final void init(AlgorithmParameterSpec genParamSpec)
                throws InvalidAlgorithmParameterException
Enabled: Initializes this parameter generator with a set of algorithm-specific parameter generation values. To generate the parameters, the SecureRandom implementation of the highest-priority installed provider is used as the source of randomness. (If none of the installed providers supply an implementation of SecureRandom, a system-provided source of randomness is used.)

Parameters:
genParamSpec - the set of algorithm-specific parameter generation values.
InvalidAlgorithmParameterException

init

public final void init(AlgorithmParameterSpec genParamSpec,
                       SecureRandom random)
                throws InvalidAlgorithmParameterException
Enabled: Initializes this parameter generator with a set of algorithm-specific parameter generation values.

Parameters:
genParamSpec - the set of algorithm-specific parameter generation values.
random - the source of randomness.
InvalidAlgorithmParameterException

generateParameters

public final AlgorithmParameters generateParameters()
Enabled: Generates the parameters.

Returns:
the new AlgorithmParameters object.


comments?