javax.crypto.spec
Class DHParameterSpec

java.lang.Object
  |
  +--javax.crypto.spec.DHParameterSpec
All Implemented Interfaces:
AlgorithmParameterSpec
Direct Known Subclasses:
ESDHParameterSpec

public class DHParameterSpec
extends 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).

Version:
File Revision 18
See Also:
AlgorithmParameterSpec, DHGenParameterSpec

Field Summary
protected  BigInteger g
           
protected  BigInteger p
           
 
Constructor Summary
DHParameterSpec(BigInteger p, BigInteger g)
          Creates a Diffie-Hellman parameter specification, based on given prime modulus p and base generator g.
DHParameterSpec(BigInteger p, 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
 BigInteger getG()
          Returns the base generator g.
 int getL()
          Returns the random exponent size l, in bits.
 BigInteger getP()
          Returns the prime modulus p.
 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
 

Field Detail

p

protected BigInteger p

g

protected BigInteger g
Constructor Detail

DHParameterSpec

public DHParameterSpec(BigInteger p,
                       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(BigInteger p,
                       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 BigInteger getP()
Returns the prime modulus p.
Returns:
the prime modulus p

getG

public 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 String toString()
Returns a string representation of this Object.
Overrides:
toString in class Object
Returns:
a string representation

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).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK