gnu.crypto.key.dh

Class GnuDHKey

public abstract class GnuDHKey extends Object implements Key, 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 $

Field Summary
protected BigIntegerg
The generator g.
protected BigIntegerp
The public prime p.
protected BigIntegerq
The public prime q.
Constructor Summary
protected GnuDHKey(BigInteger q, BigInteger p, BigInteger g)

Trivial protected constructor.

Method Summary
booleanequals(Object obj)

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

StringgetAlgorithm()
StringgetFormat()
DHParameterSpecgetParams()
BigIntegergetQ()

Field Detail

g

protected BigInteger g
The generator g.

p

protected BigInteger p
The public prime p.

q

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

Constructor Detail

GnuDHKey

protected GnuDHKey(BigInteger q, BigInteger p, 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

equals

public boolean equals(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.

getAlgorithm

public String getAlgorithm()

getFormat

public String getFormat()

getParams

public DHParameterSpec getParams()

getQ

public BigInteger getQ()
Copyright © 2001, 2002, 2003 Free Software Foundation, Inc. All Rights Reserved.