javax.crypto.spec
Class DHParameterSpec

java.lang.Object
  extended by javax.crypto.spec.DHParameterSpec
All Implemented Interfaces:
AlgorithmParameterSpec

public class DHParameterSpec
extends Object
implements AlgorithmParameterSpec

The base set of parameters necessary to perform Diffie-Hellman key exchange. Each party in the key exchange shares these parameters.

Each set of parameters consists of a base generator g, a prime modulus p, and an optional length, in bits, of the private exponent.

See PKCS #3 - Diffie-Hellman Key Agreement Standard for more information.

Since:
1.4
See Also:
KeyAgreement

Constructor Summary
DHParameterSpec(BigInteger p, BigInteger g)
          Create a new set of Diffie-Hellman parameters.
DHParameterSpec(BigInteger p, BigInteger g, int l)
          Create a new set of Diffie-Hellman parameters.
 
Method Summary
 BigInteger getG()
          Get the base generator, g.
 int getL()
          Get the length of the private exponent, in bits.
 BigInteger getP()
          Get the prime modulus, p.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DHParameterSpec

public DHParameterSpec(BigInteger p,
                       BigInteger g)
Create a new set of Diffie-Hellman parameters.

Parameters:
p - The prime modulus.
g - The base generator.

DHParameterSpec

public DHParameterSpec(BigInteger p,
                       BigInteger g,
                       int l)
Create a new set of Diffie-Hellman parameters.

Parameters:
p - The prime modulus.
g - The base generator.
l - The size of the private exponent, in bits.
Method Detail

getG

public BigInteger getG()
Get the base generator, g.

Returns:
The base generator g.

getL

public int getL()
Get the length of the private exponent, in bits.

Returns:
The length of the private exponent, in bits, or 0 if this has not been explicitly set.

getP

public BigInteger getP()
Get the prime modulus, p.

Returns:
The prime modulus, p.