APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.security.provider

pack-priv Class DSAKeyPairGenerator

extends KeyPairGenerator
Class Inheritance
Known Direct Subclasses
sun.security.provider.DSAKeyPairGenerator.Current, sun.security.provider.DSAKeyPairGenerator.Legacy
Imports
java.math.BigInteger, java.security.SecureRandom, java.security.*, java.security.interfaces.DSAParams, java.security.spec.AlgorithmParameterSpec, .DSAParameterSpec, sun.security.jca.JCAUtil

This class generates DSA key parameters and public/private key pairs according to the DSS standard NIST FIPS 186. It uses the updated version of SHA, SHA-1 as described in FIPS 180-1.
Authors
Benjamin Renaud, Andreas Sterbenz

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class

Field Summary

Modifier and TypeField and Description
pack-priv boolean
private DSAParameterSpec
private int
private int
private SecureRandom

Constructor Summary

AccessConstructor and Description
pack-priv
DSAKeyPairGenerator(int defaultKeySize)

Method Summary

Modifier and TypeMethod and Description
private static void
checkStrength(int sizeP, int sizeQ)

public KeyPair
generateKeyPair()

Overrides java.security.KeyPairGenerator.generateKeyPair.

Generates a pair of keys usable by any JavaSecurity compliant DSA implementation.

private KeyPair
private BigInteger
generateX(SecureRandom random, BigInteger q)

Generate the private key component of the key pair using the provided source of random bits.

pack-priv BigInteger
generateY(BigInteger
the private key component.
x
,
BigInteger
the base parameter.
p
,
BigInteger g)

Generate the public key component y of the key pair.

pack-priv void
init(int modlen, SecureRandom random, boolean forceNew)

pack-priv void
init(DSAParameterSpec params, SecureRandom random, boolean forceNew)

public void
initialize(int modlen, SecureRandom random)

Overrides java.security.KeyPairGenerator.initialize.

Initializes the key pair generator for a certain keysize with the given source of randomness (and a default parameter set).

public void
initialize(AlgorithmParameterSpec
the parameter set to be used to generate the keys.
params
,
SecureRandom
the source of randomness for this generator.
random
)

Overrides java.security.KeyPairGenerator.initialize.

Initializes the DSA object using a parameter object.

Inherited from java.security.KeyPairGenerator:
genKeyPairgetAlgorithmgetInstancegetInstancegetInstancegetProviderinitializeinitialize

Field Detail

forceNewParametersback to summary
pack-priv boolean forceNewParameters
paramsback to summary
private DSAParameterSpec params
plenback to summary
private int plen
qlenback to summary
private int qlen
randomback to summary
private SecureRandom random

Constructor Detail

DSAKeyPairGeneratorback to summary
pack-priv DSAKeyPairGenerator(int defaultKeySize)

Method Detail

checkStrengthback to summary
private static void checkStrength(int sizeP, int sizeQ)
generateKeyPairback to summary
public KeyPair generateKeyPair()

Overrides java.security.KeyPairGenerator.generateKeyPair.

Generates a pair of keys usable by any JavaSecurity compliant DSA implementation.

generateKeyPairback to summary
private KeyPair generateKeyPair(BigInteger p, BigInteger q, BigInteger g, SecureRandom random)
generateXback to summary
private BigInteger generateX(SecureRandom random, BigInteger q)

Generate the private key component of the key pair using the provided source of random bits. This method uses the random but source passed to generate a seed and then calls the seed-based generateX method.

generateYback to summary
pack-priv BigInteger generateY(BigInteger x, BigInteger p, BigInteger g)

Generate the public key component y of the key pair.

Parameters
x:BigInteger

the private key component.

p:BigInteger

the base parameter.

initback to summary
pack-priv void init(int modlen, SecureRandom random, boolean forceNew)
initback to summary
pack-priv void init(DSAParameterSpec params, SecureRandom random, boolean forceNew)
initializeback to summary
public void initialize(int modlen, SecureRandom random)

Overrides java.security.KeyPairGenerator.initialize.

Doc from java.security.KeyPairGenerator.initialize.

Initializes the key pair generator for a certain keysize with the given source of randomness (and a default parameter set).

initializeback to summary
public void initialize(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException

Overrides java.security.KeyPairGenerator.initialize.

Initializes the DSA object using a parameter object.

Parameters
params:AlgorithmParameterSpec

the parameter set to be used to generate the keys.

random:SecureRandom

the source of randomness for this generator.

Exceptions
InvalidAlgorithmParameterException:
if the given parameters are inappropriate for this key pair generator
sun.security.provider back to summary

public final Class DSAKeyPairGenerator.Current

extends DSAKeyPairGenerator
Class Inheritance

Field Summary

Inherited from sun.security.provider.DSAKeyPairGenerator:
forceNewParameters

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from sun.security.provider.DSAKeyPairGenerator:
generateKeyPairgenerateYinitinitinitializeinitialize

Constructor Detail

Currentback to summary
public Current()
sun.security.provider back to summary

public final Class DSAKeyPairGenerator.Legacy

extends DSAKeyPairGenerator
implements DSAKeyPairGenerator
Class Inheritance
All Implemented Interfaces
java.security.interfaces.DSAKeyPairGenerator

Field Summary

Inherited from sun.security.provider.DSAKeyPairGenerator:
forceNewParameters

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
initialize(int modlen, boolean genParams, SecureRandom random)

Implements java.security.interfaces.DSAKeyPairGenerator.initialize.

Initializes the DSA key pair generator.

public void
initialize(DSAParams
a fully initialized DSA parameter object.
params
,
SecureRandom random)

Implements java.security.interfaces.DSAKeyPairGenerator.initialize.

Initializes the DSA object using a DSA parameter object.

Inherited from sun.security.provider.DSAKeyPairGenerator:
generateKeyPairgenerateYinitinitinitializeinitialize

Constructor Detail

Legacyback to summary
public Legacy()

Method Detail

initializeback to summary
public void initialize(int modlen, boolean genParams, SecureRandom random) throws InvalidParameterException

Implements java.security.interfaces.DSAKeyPairGenerator.initialize.

Initializes the DSA key pair generator. If genParams is false, a set of pre-computed parameters is used.

Annotations
@Override
Exceptions
InvalidParameterException:

Doc from java.security.interfaces.DSAKeyPairGenerator.initialize.

if modlen is invalid, or unsupported, or if genParams is false and there are no precomputed parameters for the requested modulus length.

initializeback to summary
public void initialize(DSAParams params, SecureRandom random) throws InvalidParameterException

Implements java.security.interfaces.DSAKeyPairGenerator.initialize.

Initializes the DSA object using a DSA parameter object.

Parameters
params:DSAParams

a fully initialized DSA parameter object.

Annotations
@Override
Exceptions
InvalidParameterException:

Doc from java.security.interfaces.DSAKeyPairGenerator.initialize.

if the params value is invalid, null, or unsupported.