public abstract class DHKey extends java.lang.Object implements Key, ASN1Object, javax.crypto.interfaces.DHKey
DHParams
, DHPublicKey
, DHPrivateKey
, Serialized FormModifier and Type | Field and Description |
---|---|
protected DHParams |
params
The Diffie Hellman parameters of this key.
|
Modifier | Constructor and Description |
---|---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
erase, getAllowExport, getEncoded, getFormat
input, length, output
protected DHParams params
protected DHKey()
protected DHKey(DHParams params)
params
- The DH parameters of this key.protected DHKey(java.io.InputStream is) throws java.io.IOException
is
- The stream to read the key from.java.io.IOException
public java.lang.String getAlgorithm()
Key
getAlgorithm
in interface java.security.Key
public int getBitLength()
Key
public abstract java.lang.Object clone()
DHKey
object.clone
in class java.lang.Object
public DHParams getParams()
getParams
in interface javax.crypto.interfaces.DHKey
DHParams
object, or null
if none is present in this DHKey
.public abstract void setParams(DHParams params)
params
- An instance of DHParams
.java.lang.IllegalArgumentException
- If p, q or g is missing from the params.public void writeExternal(java.io.ObjectOutput os) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
os
- The output stream to write the encoding to.java.io.IOException
public void readExternal(java.io.ObjectInput is) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
is
- The stream to read from.java.io.IOException
java.lang.ClassNotFoundException