GnuDHKey (GNU cryptographic primitives and tools)
Keywords: gnu.crypto.key.dh.GnuDHKey,GnuDHKey class

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| For the latest news and information visit The GNU Crypto project
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## gnu.crypto.key.dh
Class GnuDHKey

    java.lang.Object
      |
      +--gnu.crypto.key.dh.GnuDHKey

All Implemented 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, 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.

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()`
`DHParameterSpec` | `getParams()` Returns the key parameters.
`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 DHParameterSpec getParams()

  Description copied from interface: `DHKey`
  Returns the key parameters.

  Specified by:
    `getParams` in interface `DHKey`
  Returns:
    the key parameters

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

  Overrides:
    `equals` in class `java.lang.Object`
  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.

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| For the latest news and information visit The GNU Crypto project
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001, 2002, 2003, 2004 Free Software Foundation, Inc.