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.
See the Keysize Restriction sections of the
JDK Providers
document for information on the AlgorithmParameterGenerator defaults
used by JDK providers.
However, note that defaults may vary across different providers.
Additionally, the default value for a provider may change in a future
version. Therefore, it is recommended to explicitly initialize the
AlgorithmParameterGenerator
instead of relying on provider-specific
defaults.
Every implementation of the Java platform is required to support the
following standard AlgorithmParameterGenerator
algorithms and
keysizes in parentheses:
DiffieHellman
(1024, 2048)DSA
(1024, 2048)AlgorithmParameters
, java.security.spec.AlgorithmParameterSpec
Modifier and Type | Field and Description |
---|---|
private final String | |
private final AlgorithmParameterGeneratorSpi | |
private final Provider |
Access | Constructor and Description |
---|---|
protected | AlgorithmParameterGenerator(AlgorithmParameterGeneratorSpi
the delegate paramGenSpi, Provider the provider provider, String the algorithm algorithm)Creates an |
Modifier and Type | Method and Description |
---|---|
public final AlgorithmParameters | |
public final String | Returns: the string name of the algorithm.Returns the standard name of the algorithm this parameter generator is associated with. |
public static AlgorithmParameterGenerator | Returns: the newAlgorithmParameterGenerator objectthe name of the algorithm this
parameter generator is associated with.
See the AlgorithmParameterGenerator section in the
Java Security Standard Algorithm Names Specification
for information about standard algorithm names. algorithm)Returns an |
public static AlgorithmParameterGenerator | Returns: the newAlgorithmParameterGenerator objectthe name of the algorithm this
parameter generator is associated with.
See the AlgorithmParameterGenerator section in the
Java Security Standard Algorithm Names Specification
for information about standard algorithm names. algorithm, String the string name of the provider)Provider .Returns an |
public static AlgorithmParameterGenerator | Returns: the newAlgorithmParameterGenerator objectthe string name of the algorithm this
parameter generator is associated with.
See the AlgorithmParameterGenerator section in the
Java Security Standard Algorithm Names Specification
for information about standard algorithm names. algorithm, Provider the provider)Provider object.Returns an |
public final Provider | Returns: the provider of this algorithm parameter generator objectReturns the provider of this algorithm parameter generator object. |
public final void | |
public final void | init(int
the size (number of bits). size, SecureRandom the source of randomness. random)Initializes this parameter generator for a certain size and source of randomness. |
public final void | init(AlgorithmParameterSpec
the set of algorithm-specific parameter generation values. genParamSpec)Initializes this parameter generator with a set of algorithm-specific parameter generation values. |
public final void | init(AlgorithmParameterSpec
the set of algorithm-specific parameter generation values. genParamSpec, SecureRandom the source of randomness. random)Initializes this parameter generator with a set of algorithm-specific parameter generation values. |
algorithm | back to summary |
---|---|
private final String algorithm |
paramGenSpi | back to summary |
---|---|
private final AlgorithmParameterGeneratorSpi paramGenSpi |
provider | back to summary |
---|---|
private final Provider provider |
AlgorithmParameterGenerator | back to summary |
---|---|
protected AlgorithmParameterGenerator(AlgorithmParameterGeneratorSpi paramGenSpi, Provider provider, String algorithm) Creates an
|
generateParameters | back to summary |
---|---|
public final AlgorithmParameters generateParameters() Generates the parameters.
|
getAlgorithm | back to summary |
---|---|
public final String getAlgorithm() Returns the standard name of the algorithm this parameter generator is associated with.
|
getInstance | back to summary |
---|---|
public static AlgorithmParameterGenerator getInstance(String algorithm) throws NoSuchAlgorithmException Returns an This method traverses the list of registered security providers,
starting with the most preferred provider.
A new Note that the list of registered providers may be retrieved via
the Implementation Note The JDK Reference Implementation additionally uses the
|
getInstance | back to summary |
---|---|
public static AlgorithmParameterGenerator getInstance(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException Returns an A new Note that the list of registered providers may be retrieved via
the
|
getInstance | back to summary |
---|---|
public static AlgorithmParameterGenerator getInstance(String algorithm, Provider provider) throws NoSuchAlgorithmException Returns an A new
|
getProvider | back to summary |
---|---|
public final Provider getProvider() Returns the provider of this algorithm parameter generator object.
|
init | back to summary |
---|---|
public final void init(int size) Initializes this parameter generator for a certain size.
To create the parameters, the
|
init | back to summary |
---|---|
public final void init(int size, SecureRandom random) Initializes this parameter generator for a certain size and source of randomness.
|
init | back to summary |
---|---|
public final void init(AlgorithmParameterSpec genParamSpec) throws InvalidAlgorithmParameterException Initializes this parameter generator with a set of algorithm-specific
parameter generation values.
To generate the parameters, the
|
init | back to summary |
---|---|
public final void init(AlgorithmParameterSpec genParamSpec, SecureRandom random) throws InvalidAlgorithmParameterException Initializes this parameter generator with a set of algorithm-specific parameter generation values.
|