gnu.crypto.key.dh

Class GnuDHPublicKey

public class GnuDHPublicKey extends GnuDHKey implements DHPublicKey

An implementation of the Diffie-Hellman public key.

Reference:

  1. Diffie-Hellman Key Agreement Method
    Eric Rescorla.

Version: $Revision: 1.2 $

Constructor Summary
GnuDHPublicKey(BigInteger q, BigInteger p, BigInteger g, BigInteger y)
Method Summary
byte[]getEncoded()
byte[]getEncoded(int format)

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

BigIntegergetY()
static GnuDHPublicKeyvalueOf(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.

Constructor Detail

GnuDHPublicKey

public GnuDHPublicKey(BigInteger q, BigInteger p, BigInteger g, BigInteger y)

Method Detail

getEncoded

public byte[] getEncoded()

Deprecated: see getEncoded(int).

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: IllegalArgumentException if the format is not supported.

See Also: DHKeyPairRawCodec

getY

public BigInteger getY()

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: ArrayIndexOutOfBoundsException if there is not enough bytes, in k, to represent a valid encoding of an instance of this object. IllegalArgumentException if the byte sequence does not represent a valid encoding of an instance of this object.

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