com.ibm.crypto.fips.provider
Class DHKeyPairGenerator
- java.lang.Object
-
- java.security.KeyPairGeneratorSpi
-
- com.ibm.crypto.fips.provider.DHKeyPairGenerator
-
public final class DHKeyPairGenerator extends java.security.KeyPairGeneratorSpiThis class represents the key pair generator for Diffie-Hellman key pairs.This key pair generator may be initialized in two different ways:
- By providing the size in bits of the prime modulus. This will be used to create a prime modulus and base generator, which will then be used to create the Diffie-Hellman key pair. The default size of the prime modulus is 2048 bits.
- By providing a prime modulus and base generator.
- See Also:
KeyPairGenerator
-
-
Constructor Summary
Constructors Constructor and Description DHKeyPairGenerator()
-
Method Summary
Methods Modifier and Type Method and Description protected voidfinalize()This function resets the class variables.java.security.KeyPairgenerateKeyPair()Generates a key pair.voidinitialize(java.security.spec.AlgorithmParameterSpec algParams, java.security.SecureRandom random)Initializes this key pair generator for the specified parameter set and source of randomness.voidinitialize(int keysize, java.security.SecureRandom random)Initializes this key pair generator for a certain keysize and source of randomness.protected java.security.KeyPairinternalGenerateKeyPair()Generates a key pair.protected voidinternalInitialize(java.security.spec.AlgorithmParameterSpec algParams, java.security.SecureRandom random)Initializes this key pair generator for the specified parameter set and source of randomness.protected voidinternalInitialize(int keysize, java.security.SecureRandom random)Initializes this key pair generator for a certain keysize and source of randomness.
-
-
-
Method Detail
-
initialize
public void initialize(int keysize, java.security.SecureRandom random)Initializes this key pair generator for a certain keysize and source of randomness. The keysize is specified as the size in bits of the prime modulus.- Specified by:
initializein classjava.security.KeyPairGeneratorSpi- Parameters:
keysize- the keysize (size of prime modulus) in bitsrandom- the source of randomness
-
internalInitialize
protected void internalInitialize(int keysize, java.security.SecureRandom random)Initializes this key pair generator for a certain keysize and source of randomness. The keysize is specified as the size in bits of the prime modulus.- Parameters:
keysize- the keysize (size of prime modulus) in bitsrandom- the source of randomness
-
initialize
public void initialize(java.security.spec.AlgorithmParameterSpec algParams, java.security.SecureRandom random) throws java.security.InvalidAlgorithmParameterExceptionInitializes this key pair generator for the specified parameter set and source of randomness.The given parameter set contains the prime modulus, the base generator, and optionally the requested size in bits of the random exponent (private value).
- Overrides:
initializein classjava.security.KeyPairGeneratorSpi- Parameters:
params- the parameter set used to generate the key pairrandom- the source of randomness- Throws:
java.security.InvalidAlgorithmParameterException- if the given parameters are inappropriate for this key pair generator
-
internalInitialize
protected void internalInitialize(java.security.spec.AlgorithmParameterSpec algParams, java.security.SecureRandom random) throws java.security.InvalidAlgorithmParameterExceptionInitializes this key pair generator for the specified parameter set and source of randomness.The given parameter set contains the prime modulus, the base generator, and optionally the requested size in bits of the random exponent (private value).
- Parameters:
params- the parameter set used to generate the key pairrandom- the source of randomness- Throws:
java.security.InvalidAlgorithmParameterException- if the given parameters are inappropriate for this key pair generator
-
generateKeyPair
public java.security.KeyPair generateKeyPair()
Generates a key pair.- Specified by:
generateKeyPairin classjava.security.KeyPairGeneratorSpi- Returns:
- the new key pair
-
internalGenerateKeyPair
protected java.security.KeyPair internalGenerateKeyPair()
Generates a key pair.- Returns:
- the new key pair
-
finalize
protected void finalize()
This function resets the class variables.- Overrides:
finalizein classjava.lang.Object
-
-