de.flexiprovider.core.dsa
Class DSAParameterGenerator

java.lang.Object
  |
  +--java.security.AlgorithmParameterGeneratorSpi
        |
        +--de.flexiprovider.api.parameters.AlgorithmParameterGenerator
              |
              +--de.flexiprovider.core.dsa.DSAParameterGenerator

public class DSAParameterGenerator
extends AlgorithmParameterGenerator

This class implements the DSAAlgorithmParameterGenerator. The parameter generation follows the proposal of the FIPS 186-2 standard, except for the generation of the random numbers.

The default bit length of the prime p is 1024 bits.

Author:
Thomas Wahrenbruch

Field Summary
static java.lang.String OID
          The OID of DSA.
static java.lang.String OID2
          An alternative OID of DSA.
 
Constructor Summary
DSAParameterGenerator()
           
 
Method Summary
 AlgorithmParameterSpec generateParameters()
          Generate DSA algorithm parameters.
protected  AlgorithmParameters getAlgorithmParameters()
           
 void init(AlgorithmParameterSpec genParams, SecureRandom random)
          Initialize the parameter generator with parameters and a source of randomness.
 void init(int size, SecureRandom random)
          Initialize the parameter generator with the size of the prime p and a source of randomness.
 
Methods inherited from class de.flexiprovider.api.parameters.AlgorithmParameterGenerator
engineGenerateParameters, engineInit, engineInit
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OID

public static final java.lang.String OID
The OID of DSA.

OID2

public static final java.lang.String OID2
An alternative OID of DSA.
Constructor Detail

DSAParameterGenerator

public DSAParameterGenerator()
Method Detail

getAlgorithmParameters

protected AlgorithmParameters getAlgorithmParameters()
Overrides:
getAlgorithmParameters in class AlgorithmParameterGenerator
Returns:
an instance of the AlgorithmParameters class corresponding to the generated parameters

init

public void init(AlgorithmParameterSpec genParams,
                 SecureRandom random)
          throws InvalidAlgorithmParameterException
Initialize the parameter generator with parameters and a source of randomness. If the parameters are null, the default parameters are used.
Overrides:
init in class AlgorithmParameterGenerator
Parameters:
genParams - the parameters
random - the source of randomness
Throws:
InvalidAlgorithmParameterException - if the parameters are not an instance of DSAParamGenParameterSpec.

init

public void init(int size,
                 SecureRandom random)
Initialize the parameter generator with the size of the prime p and a source of randomness.

If the size is not a multiple of 64, the next smaller multiple of 64 is used as size. If the size is > 1024 or < 512, the default size is used.

Overrides:
init in class AlgorithmParameterGenerator
Parameters:
size - the bit length of the prime p
random - the source of randomness

generateParameters

public AlgorithmParameterSpec generateParameters()
Generate DSA algorithm parameters.
Overrides:
generateParameters in class AlgorithmParameterGenerator
Returns:
the generated DSA parameters
See Also:
DSAParameterSpec