Skip navigation links

Oracle Security Developer Tools Crypto Java API Reference
11g (11.1.1)

E10668-02


oracle.security.crypto.core
Class DHKey

java.lang.Object
  extended by oracle.security.crypto.core.DHKey

All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, ASN1Object, Key, Streamable
Direct Known Subclasses:
DHPrivateKey, DHPublicKey

public abstract class DHKey
extends java.lang.Object
implements Key, ASN1Object

An abstract class for Diffie-Hellman keys.

See Also:
DHParams, DHPublicKey, DHPrivateKey, Serialized Form

Field Summary
protected  DHParams params
          The Diffie Hellman parameters of this key.

 

Constructor Summary
protected DHKey()
          Empty constructor.
protected DHKey(DHParams params)
          Creates a DHKey with the specified DHParams.
protected DHKey(java.io.InputStream is)
          Creates a DHKey from the specified input stream.

 

Method Summary
abstract  java.lang.Object clone()
          Create a deep clone of this DHKey object.
 java.lang.String getAlgorithm()
          Returns the algorithm for which this key is primarily used.
 int getBitLength()
          Returns the number of bits required to represent this key's defining key material.
 DHParams getParams()
          Returns the Diffie-Hellman parameters for this key.
 void readExternal(java.io.ObjectInput is)
          Reads the input stream and initializes the Diffie Hellman key.
abstract  void setParams(DHParams params)
          Sets the parameters for the Diffie-Hellman key.
 void writeExternal(java.io.ObjectOutput os)
          Writes to the output stream the DER encoding of this object.

 

Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Methods inherited from interface oracle.security.crypto.core.Key
erase, getAllowExport, getEncoded, getFormat

 

Methods inherited from interface oracle.security.crypto.util.Streamable
input, length, output

 

Field Detail

params

protected DHParams params
The Diffie Hellman parameters of this key.

Constructor Detail

DHKey

protected DHKey()
Empty constructor.

DHKey

protected DHKey(DHParams params)
Creates a DHKey with the specified DHParams.
Parameters:
params - The DH parameters of this key.

DHKey

protected DHKey(java.io.InputStream is)
         throws java.io.IOException
Creates a DHKey from the specified input stream.
Parameters:
is - The stream to read the key from.
Throws:
java.io.IOException

Method Detail

getAlgorithm

public java.lang.String getAlgorithm()
Description copied from interface: Key
Returns the algorithm for which this key is primarily used.
Specified by:
getAlgorithm in interface Key

getBitLength

public int getBitLength()
Description copied from interface: Key
Returns the number of bits required to represent this key's defining key material. For example, in the case of an RSA key, the bit length of the modulus would be returned.
Specified by:
getBitLength in interface Key

clone

public abstract java.lang.Object clone()
Create a deep clone of this DHKey object.
Specified by:
clone in interface Key
Overrides:
clone in class java.lang.Object
Returns:
A deep clone of the Key instance.

getParams

public DHParams getParams()
Returns the Diffie-Hellman parameters for this key.
Returns:
A DHParams object, or null if none is present in this DHKey.

setParams

public abstract void setParams(DHParams params)
Sets the parameters for the Diffie-Hellman key. This method is used to set Diffie-Hellman parameters common to a group of users which are known from application context.
Parameters:
params - An instance of DHParams.
Throws:
java.lang.IllegalArgumentException - If p, q or g is missing from the params.

writeExternal

public void writeExternal(java.io.ObjectOutput os)
                   throws java.io.IOException
Writes to the output stream the DER encoding of this object.
Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
os - The output stream to write the encoding to.
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput is)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Reads the input stream and initializes the Diffie Hellman key.
Specified by:
readExternal in interface java.io.Externalizable
Parameters:
is - The stream to read from.
Throws:
java.io.IOException
java.lang.ClassNotFoundException

Skip navigation links

Oracle Security Developer Tools Crypto Java API Reference
11g (11.1.1)

E10668-02


Copyright © 2005, 2009, Oracle. All rights reserved.