javax.crypto.spec
Class DHParameterSpec

java.lang.Object
  |
  +--javax.crypto.spec.DHParameterSpec

public class DHParameterSpec
extends java.lang.Object
implements AlgorithmParameterSpec

Diffie Hellman parameter specification.


Attention:  This is not a SUN implementation!

This class has been developed by IAIK according to the documentation publically available.
For SUNīs documentation of this class see http://java.sun.com/security/JCE1.2/spec/apidoc/index.html


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.

This class represents a specification for the prime modulus (p), base ganerator (g) and exponent length (l) parameters, as used by the Diffie-Hellman key exchange algorithm according to PKCS#3 (Diffie-Hellman Key Agreement Standard).

See Also:
AlgorithmParameterSpec, DHGenParameterSpec

Constructor Summary
DHParameterSpec(java.math.BigInteger p, java.math.BigInteger g)
          Creates a Diffie-Hellman parameter specification, based on given prime modulus p and base generator g.
DHParameterSpec(java.math.BigInteger p, java.math.BigInteger g, int l)
          Creates a Diffie-Hellman parameter specification, based on given prime modulus p, base generator g, and random exponent size l.
 
Method Summary
 java.math.BigInteger getG()
          Returns the base generator g.
 int getL()
          Returns the random exponent size l, in bits.
 java.math.BigInteger getP()
          Returns the prime modulus p.
 java.lang.String toString()
          Returns a string representation of this Object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DHParameterSpec

public DHParameterSpec(java.math.BigInteger p,
                       java.math.BigInteger g)
Creates a Diffie-Hellman parameter specification, based on given prime modulus p and base generator g.
Parameters:
p - the prime modulus
g - the base generator

DHParameterSpec

public DHParameterSpec(java.math.BigInteger p,
                       java.math.BigInteger g,
                       int l)
Creates a Diffie-Hellman parameter specification, based on given prime modulus p, base generator g, and random exponent size l.
Parameters:
p - the prime modulus
g - the base generator
l - the random exponent size in bits
Method Detail

getP

public java.math.BigInteger getP()
Returns the prime modulus p.
Returns:
the prime modulus p

getG

public java.math.BigInteger getG()
Returns the base generator g.
Returns:
the base generator g

getL

public int getL()
Returns the random exponent size l, in bits.
Returns:
the random exponent size in bits, or 0 if the size has not been specified

toString

public java.lang.String toString()
Returns a string representation of this Object.
Overrides:
toString in class java.lang.Object
Returns:
a string representation