public class SHA2withDSAParameterSpec
extends java.security.spec.DSAParameterSpec
This class extends the JCA DSAParameterSpec
to also allow
to get the validation parameters counter and domain parameter seed (if set) that
have been calculated during the DSA parameter generation procedure.
This class only may be used with an IAIK DSA SHA-2 algorithm parameter
generator like SHA224withDSAParameterGenerator
or SHA256withDSAParameterGenerator
, 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(); // get parameter specification SHA2withDSAParameterSpec paramSpec = (SHA2withDSAParameterSpec)params.getParameterSpec(SHA2withDSAParameterSpec.class); // get p BigInteger p = paramSpec.getP(); // get q BigInteger q = paramSpec.getQ(); // get g BigInteger g = paramSpec.getG(); // get counter (-1 if not set) int counter = paramSpec.getCounter(); // get domain parameter seed (null if not set) byte[] seed = paramSpec.getSeed();
Constructor and Description |
---|
SHA2withDSAParameterSpec(java.math.BigInteger p,
java.math.BigInteger q,
java.math.BigInteger g)
Creates a DSAParameterSpec for given prime modulus, prime divisor and generator.
|
Modifier and Type | Method and Description |
---|---|
int |
getCounter()
Gets the counter value.
|
byte[] |
getSeed()
Gets the domain parameter seed.
|
public SHA2withDSAParameterSpec(java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger g)
p
- the prime modulusq
- the prime divisorg
- the generatorpublic int getCounter()
public byte[] getSeed()
null
if the domain parameter seed has not been set