public class SHA2withDSAGenParameterSpec
extends java.lang.Object
implements java.security.spec.AlgorithmParameterSpec
This class represents a DSA generation parameter specification to be used with a DSA FIPS 186-3 AlgorithmParameterGenerator for generating DSA parameters p, q and r (prime modulus, prime divisor and generator, respectively). This class allows to specify the desired length L of the prime modulus and the desired length N of the prime divisor.
FIPS 186-3 (June 2009) allows the following (L,N) pairs to may be used:
When using a SHA2withDSAGenParameterSpec with and DSA SHA-2 AlgorithmParameterGenerator you have to specify which L,N pair you want to use, e.g.:
int L = 3072; int N = 256; SHA2withDSAGenParameterSpec genParamSpec = new SHA2withDSAGenParameterSpec(L, N); AlgorithmParameterGenerator generator = AlgorithmParameterGenerator.getInstance("SHA256withDSA", "IAIK"); SecureRandom random = ...; generator.init(genParamSpec, random); AlgortithmParameters params = generator.generateParameters();
Constructor and Description |
---|
SHA2withDSAGenParameterSpec(int L,
int N)
Creates a DSA generation parameter specification with the
given prime modulus size and prime divisor size.
|
Modifier and Type | Method and Description |
---|---|
int |
getL()
Returns the prime modulus size in bits.
|
int |
getN()
Returns the prime divisor size in bits.
|
int |
getSeedlen()
Gets the seed length.
|
void |
setSeedlen(int seedlen)
Sets the seed length to be used.
|
public SHA2withDSAGenParameterSpec(int L, int N) throws java.lang.IllegalArgumentException
L
- the prime modulus size in bitsN
- the prime divisor size in bitsjava.lang.IllegalArgumentException
- if (L,N) is not a valid L, N pair according section 4.2 of
FIPS PUB 186-3 (valid pairs are (1024,160), (2048,224), (2048,256), (3072, 256))public void setSeedlen(int seedlen)
seedlen
- the lenth of the seed, in bitsjava.lang.IllegalArgumentException
- if the seedlen value
is shorter than N or is
not a multiple of 8public int getL()
public int getN()
public int getSeedlen()