For the latest news and information visit
The GNU Crypto project

gnu.crypto.key.dh
Class GnuDHPublicKey

java.lang.Object
  extended bygnu.crypto.key.dh.GnuDHKey
      extended bygnu.crypto.key.dh.GnuDHPublicKey
All Implemented Interfaces:
javax.crypto.interfaces.DHKey, javax.crypto.interfaces.DHPublicKey, java.security.Key, java.security.PublicKey, java.io.Serializable

public class GnuDHPublicKey
extends GnuDHKey
implements javax.crypto.interfaces.DHPublicKey

An implementation of the Diffie-Hellman public key.

Reference:

  1. Diffie-Hellman Key Agreement Method
    Eric Rescorla.

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

Field Summary
 
Fields inherited from class gnu.crypto.key.dh.GnuDHKey
g, p, q
 
Fields inherited from interface java.security.PublicKey
serialVersionUID
 
Constructor Summary
GnuDHPublicKey(java.math.BigInteger q, java.math.BigInteger p, java.math.BigInteger g, java.math.BigInteger y)
           
 
Method Summary
 byte[] getEncoded()
          Deprecated. see getEncoded(int).
 byte[] getEncoded(int format)
          Returns the encoded form of this public key according to the designated format.
 java.math.BigInteger getY()
           
static GnuDHPublicKey valueOf(byte[] k)
          A class method that takes the output of the encodePublicKey() method of a DH keypair codec object (an instance implementing IKeyPairCodec for DSS keys, and re-constructs an instance of this object.
 
Methods inherited from class gnu.crypto.key.dh.GnuDHKey
equals, getAlgorithm, getFormat, getParams, getQ
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.crypto.interfaces.DHKey
getParams
 
Methods inherited from interface java.security.Key
getAlgorithm, getFormat
 

Constructor Detail

GnuDHPublicKey

public GnuDHPublicKey(java.math.BigInteger q,
                      java.math.BigInteger p,
                      java.math.BigInteger g,
                      java.math.BigInteger y)
Method Detail

valueOf

public static GnuDHPublicKey valueOf(byte[] k)

A class method that takes the output of the encodePublicKey() method of a DH keypair codec object (an instance implementing IKeyPairCodec for DSS keys, and re-constructs an instance of this object.

Parameters:
k - the contents of a previously encoded instance of this object.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if there is not enough bytes, in k, to represent a valid encoding of an instance of this object.
java.lang.IllegalArgumentException - if the byte sequence does not represent a valid encoding of an instance of this object.

getEncoded

public byte[] getEncoded()
Deprecated. see getEncoded(int).

Specified by:
getEncoded in interface java.security.Key

getY

public java.math.BigInteger getY()
Specified by:
getY in interface javax.crypto.interfaces.DHPublicKey

getEncoded

public byte[] getEncoded(int format)

Returns the encoded form of this public key according to the designated format.

Parameters:
format - the desired format identifier of the resulting encoding.
Returns:
the byte sequence encoding this key according to the designated format.
Throws:
java.lang.IllegalArgumentException - if the format is not supported.
See Also:
DHKeyPairRawCodec

For the latest news and information visit
The GNU Crypto project

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