com.ibm.crypto.fips.provider
Class DSAParameterGenerator
- java.lang.Object
-
- java.security.AlgorithmParameterGeneratorSpi
-
- com.ibm.crypto.fips.provider.DSAParameterGenerator
-
- All Implemented Interfaces:
- NistDSAParam
public final class DSAParameterGenerator extends java.security.AlgorithmParameterGeneratorSpi implements NistDSAParam
This class generates parameters for the DSA signature.
-
-
Constructor Summary
Constructors Constructor and Description DSAParameterGenerator()Constructs a new instance of this class.
-
Method Summary
Methods Modifier and Type Method and Description protected java.security.AlgorithmParametersengineGenerateParameters()Answers the newly generated parameters.protected voidengineInit(java.security.spec.AlgorithmParameterSpec genParamSpec, java.security.SecureRandom random)Initializes the receiver with the specified parameters and source of randomness.protected voidengineInit(int size, java.security.SecureRandom random)Initializes the receiver with the specified parameter size and source of randomness.protected java.math.BigInteger[]generate_g_h(java.math.BigInteger p, java.math.BigInteger q)Generate and return g,h one of the DSA parametersprotected ProbablePrimeResultFFCgenerateParameters_SP186_2(int L, java.security.MessageDigest sha, byte[] paramSeed)Actual generation of DSA parametersprotected ProbablePrimeResultFFCgenerateParameters_SP186_4(int L, int N, java.security.MessageDigest md, byte[] paramSeed)Generate parameters for NIST SP186-4 specificationprotected java.security.AlgorithmParametersinternalGenerateParameters()Answers the newly generated parameters.protected voidinternalInit(java.security.spec.AlgorithmParameterSpec genParamSpec, java.security.SecureRandom random)Initializes the receiver with the specified parameters and source of randomness.protected voidinternalInit(int size, java.security.SecureRandom random)Initializes the receiver with the specified parameter size and source of randomness.protected intvalidate_g(java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger g)THis method will be used only Certificate lab requires that we validate g.
-
-
-
Constructor Detail
-
DSAParameterGenerator
public DSAParameterGenerator()
Constructs a new instance of this class.
-
-
Method Detail
-
engineGenerateParameters
protected java.security.AlgorithmParameters engineGenerateParameters()
Answers the newly generated parameters.- Specified by:
engineGenerateParametersin classjava.security.AlgorithmParameterGeneratorSpi- Returns:
- AlgorithmParameters the newly generated parameters.
- Throws:
FIPSRuntimeException- if SelfTest.isFipsRunnable returns false.
-
internalGenerateParameters
protected java.security.AlgorithmParameters internalGenerateParameters()
Answers the newly generated parameters.- Returns:
- AlgorithmParameters the newly generated parameters.
-
engineInit
protected void engineInit(java.security.spec.AlgorithmParameterSpec genParamSpec, java.security.SecureRandom random) throws java.security.InvalidAlgorithmParameterExceptionInitializes the receiver with the specified parameters and source of randomness.- Specified by:
engineInitin classjava.security.AlgorithmParameterGeneratorSpi- Parameters:
genParamSpec- AlgorithmParameterSpec parameters for this algorithmrandom- SecureRandom New secure random to use- Throws:
FIPSRuntimeException- if SelfTest.isFipsRunnable returns false.java.security.InvalidAlgorithmParameterException
-
internalInit
protected void internalInit(java.security.spec.AlgorithmParameterSpec genParamSpec, java.security.SecureRandom random) throws java.security.InvalidAlgorithmParameterExceptionInitializes the receiver with the specified parameters and source of randomness.- Parameters:
genParamSpec- AlgorithmParameterSpec parameters for this algorithmrandom- SecureRandom New secure random to use- Throws:
java.security.InvalidAlgorithmParameterException
-
engineInit
protected void engineInit(int size, java.security.SecureRandom random)Initializes the receiver with the specified parameter size and source of randomness.- Specified by:
engineInitin classjava.security.AlgorithmParameterGeneratorSpi- Parameters:
size- int Size of the parametersrandom- SecureRandom New secure random to use- Throws:
FIPSRuntimeException- if SelfTest.isFipsRunnable returns false.
-
internalInit
protected void internalInit(int size, java.security.SecureRandom random)Initializes the receiver with the specified parameter size and source of randomness.- Parameters:
size- int Size of the parametersrandom- SecureRandom New secure random to use
-
generate_g_h
protected java.math.BigInteger[] generate_g_h(java.math.BigInteger p, java.math.BigInteger q)Generate and return g,h one of the DSA parameters- Returns:
- BigInteger DSA parameter g and h
-
generateParameters_SP186_4
protected ProbablePrimeResultFFC generateParameters_SP186_4(int L, int N, java.security.MessageDigest md, byte[] paramSeed) throws java.lang.Exception
Generate parameters for NIST SP186-4 specification- Parameters:
L-N-md-paramSeed-- Throws:
java.lang.Exception
-
generateParameters_SP186_2
protected ProbablePrimeResultFFC generateParameters_SP186_2(int L, java.security.MessageDigest sha, byte[] paramSeed) throws java.lang.Exception
Actual generation of DSA parameters- Throws:
java.lang.Exception
-
validate_g
protected int validate_g(java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger g)THis method will be used only Certificate lab requires that we validate g. There is no complete validation for this class. The best we can do is PARTIALVALID.- Parameters:
p-q-g-- Returns:
-
-