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:
- The algorithm-independent approach uses the fact that all parameter generators share the concept of a "size" and a source of randomness. The measure of size is universally shared by all algorithm parameters, though it is interpreted differently for different algorithms. For example, in the case of parameters for the DSA algorithm, "size" corresponds to the size of the prime modulus (in bits). When using this approach, algorithm-specific parameter generation values - if any - default to some standard values, unless they can be derived from the specified size.
- The other approach initializes a parameter generator object using algorithm-specific semantics, which are represented by a set of algorithm-specific parameter generation values. To generate Diffie-Hellman system parameters, for example, the parameter generation values usually consist of the size of the prime modulus and the size of the random exponent, both specified in number of bits.
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 Moved out of a link with destination https://docs.oracle.com/pls/topic/lookup?ctx=javase20&id=security_guide_jdk_providers.Moved to a link with destination https://docs.oracle.com/pls/topic/lookup?ctx=javase21&id=security_guide_jdk_providers.JDK ProvidersMoved out of a link with destination https://docs.oracle.com/pls/topic/lookup?ctx=javase20&id=security_guide_jdk_providers.Moved to a link with destination https://docs.oracle.com/pls/topic/lookup?ctx=javase21&id=security_guide_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)
- Since:
- 1.2
- See Also:
Constructors
- ✓protected AlgorithmParameterGenerator(java.security.AlgorithmParameterGeneratorSpi arg0, java.security.Provider arg1, java.lang.String arg2)
Methods
- ✓public final java.security.AlgorithmParameters generateParameters()
- ✓public final java.lang.String getAlgorithm()
- ✓public static java.security.AlgorithmParameterGenerator getInstance(java.lang.String arg0) throws java.security.NoSuchAlgorithmException
- ✓public static java.security.AlgorithmParameterGenerator getInstance(java.lang.String arg0, java.lang.String arg1) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException
- ✓public static java.security.AlgorithmParameterGenerator getInstance(java.lang.String arg0, java.security.Provider arg1) throws java.security.NoSuchAlgorithmException
- ✓public final java.security.Provider getProvider()
- ✓public final void init(int arg0)
- ✓public final void init(int arg0, java.security.SecureRandom arg1)
- ✓public final void init(java.security.spec.AlgorithmParameterSpec arg0) throws java.security.InvalidAlgorithmParameterException
- ✓public final void init(java.security.spec.AlgorithmParameterSpec arg0, java.security.SecureRandom arg1) throws java.security.InvalidAlgorithmParameterException
Summary
| Elements | Comments | Descriptions | Total | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Added | Changed | Removed | Added | Changed | Removed | Added | Changed | Removed | ||
| AlgorithmParameterGenerator | 2 | 2 | ||||||||
| Total | 2 | 2 | ||||||||