For the latest news and information visit
The GNU Crypto project

gnu.crypto.key.dh
Class GnuDHKey

java.lang.Object
  extended bygnu.crypto.key.dh.GnuDHKey
All Implemented Interfaces:
javax.crypto.interfaces.DHKey, java.security.Key, java.io.Serializable
Direct Known Subclasses:
GnuDHPrivateKey, GnuDHPublicKey

public abstract class GnuDHKey
extends java.lang.Object
implements java.security.Key, javax.crypto.interfaces.DHKey

A base asbtract class for both public and private Diffie-Hellman keys. It encapsulates the two DH numbers: p, and g.

According to the JDK, cryptographic Keys all have a format. The format used in this implementation is called Raw, and basically consists of the raw byte sequences of algorithm parameters. The exact order of the byte sequences and the implementation details are given in each of the relevant getEncoded() methods of each of the private and public keys.

Reference:

  1. Diffie-Hellman Key Agreement Method
    Eric Rescorla.

Version:
$Revision: 1.2 $
See Also:
Serialized Form

Field Summary
protected  java.math.BigInteger g
          The generator g.
protected  java.math.BigInteger p
          The public prime p.
protected  java.math.BigInteger q
          The public prime q.
 
Fields inherited from interface java.security.Key
serialVersionUID
 
Constructor Summary
protected GnuDHKey(java.math.BigInteger q, java.math.BigInteger p, java.math.BigInteger g)
          Trivial protected constructor.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Returns true if the designated object is an instance of DHKey and has the same Diffie-Hellman parameter values as this one.
 java.lang.String getAlgorithm()
           
 java.lang.String getFormat()
           
 javax.crypto.spec.DHParameterSpec getParams()
           
 java.math.BigInteger getQ()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.security.Key
getEncoded
 

Field Detail

q

protected java.math.BigInteger q
The public prime q. A prime divisor of p-1.


p

protected java.math.BigInteger p
The public prime p.


g

protected java.math.BigInteger g
The generator g.

Constructor Detail

GnuDHKey

protected GnuDHKey(java.math.BigInteger q,
                   java.math.BigInteger p,
                   java.math.BigInteger g)

Trivial protected constructor.

Parameters:
q - a prime divisor of p-1.
p - the public prime.
g - the generator of the group.
Method Detail

getParams

public javax.crypto.spec.DHParameterSpec getParams()
Specified by:
getParams in interface javax.crypto.interfaces.DHKey

getAlgorithm

public java.lang.String getAlgorithm()
Specified by:
getAlgorithm in interface java.security.Key

getFormat

public java.lang.String getFormat()
Specified by:
getFormat in interface java.security.Key

getQ

public java.math.BigInteger getQ()

equals

public boolean equals(java.lang.Object obj)

Returns true if the designated object is an instance of DHKey and has the same Diffie-Hellman parameter values as this one.

Parameters:
obj - the other non-null DH key to compare to.
Returns:
true if the designated object is of the same type and value as this one.

For the latest news and information visit
The GNU Crypto project

Copyright © 2001, 2002, 2003 Free Software Foundation, Inc. All Rights Reserved.