|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.security.AlgorithmParameterGeneratorSpi | +--iaik.security.dh.DHParameterGenerator
This class implements an AlgorithmParameterGenerator that generates parameters for key-agreement according to the Diffie-Hellman protocol.
The algorithm used is taken from RFC 2631. It specifies a minimum prime length of 512 bit and minimum exponent length of 160 bit; defaults in this implementation are 1024 and 300 bits respectively. Access to the verification parameters provided by the generation algorithm is not possible with the current API.
Note that parameter generation is fairly slow but this should not be a problem as this is a hardly performed activity anyway. Typically they will be generated once per user group by the CA and then the users will generate their keys using the parameters provided.
The Diffie Hellman algorithm has been the first public-key algorithm. It only can be used for key-agreement, but not for data encrypting and decrypting.
PKCS#3 describes
a method for implementing the Diffie Hellman key agreement where two (or more)
entities use general Diffie Hellman parameters (an odd prime p
,
an integer base g
satisfying 0 < g < p
,
and optionally an integer l
prescribing the length of the private value),
generated from some central authority (which may an entity itself), for creating a
shared secret only known by them.
Applications shall use AlgorithmParameterGenerator.getInstance("DH")
for obtaining an AlgorithmParamterGenerator for generating DH parameters in opaque
representation. Once the generator has been created, it shall be properly initialized
by one of the several init
methods. If none explicit initialization is
done, per default the length of the prime modulus is set to 1024 bits and the length
of the exponent (private value) is chosen to be 300 bits. After
initializing the generator (or relying on default settings), the reguired parameters
actually are created by calling the generateParameters
method.
AlgorithmParameterGenerator
,
DHParameterSpec
,
DHParameters
,
DHPublicKey
,
DHPrivateKey
,
DHKeyPairGenerator
,
DHKeyFactory
,
DHKeyAgreement
Constructor Summary | |
DHParameterGenerator()
The default constructor. |
Method Summary | |
protected AlgorithmParameters |
engineGenerateParameters()
Actually generates the required DH AlgorithmParameters. |
protected void |
engineInit(AlgorithmParameterSpec param,
SecureRandom random)
Initializes this generator with DH-specific parameter generation values and some random seed. |
protected void |
engineInit(int primeLength,
SecureRandom random)
Initializes the parameter generator with given prime modulus length and random seed. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DHParameterGenerator()
AlgorithmParameterGenerator.getInstance
factory methods for obtaining an AlgorithmParamterGenerator for generating paramters
for Diffie Hellman key agreement.Method Detail |
protected void engineInit(int primeLength, SecureRandom random)
engineInit
in class AlgorithmParameterGeneratorSpi
primeLength
- the length of the prime modulus in bitsrandom
- the random seed for this generator.protected void engineInit(AlgorithmParameterSpec param, SecureRandom random) throws InvalidAlgorithmParameterException
From the given parameter specification DHGenParameterSpec
)
prime modulus length and exponent length are obtained for generating the
algorithm parameters.
Applications shall call init(param_spec, random)
for provider
independently accessing this method.
engineInit
in class AlgorithmParameterGeneratorSpi
param
- an instance of DHGenParameterSpecrandom
- the random seed to be used by this generator.InvalidAlgorithmParameterException
- if param
is not an
instance of DHGenParameterSpec
or if the size of the exponent
is not shorter than that of the
prime modulusprotected AlgorithmParameters engineGenerateParameters()
Applications shall call generatePrameters()
for provider independently accessing this method.
engineGenerateParameters
in class AlgorithmParameterGeneratorSpi
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |