public class DHPublicKey extends DHKey implements PublicKey, javax.crypto.interfaces.DHPublicKey
The Diffie-Hellman public key contains a DHParams
and a public key value y is represented as the X509 type SubjectPublicKeyInfo.
DHKey
, DHPublicKey
, DHParams
, Serialized FormConstructor and Description |
---|
DHPublicKey()
Constructs a new, uninitialized instance.
|
DHPublicKey(java.math.BigInteger y, DHParams params)
Constructs a new instance with the given set of parameters and value of y.
|
DHPublicKey(java.io.InputStream is)
Constructs a new instance by reading its encoding from the given input stream.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Create a deep clone of this
DHKey object. |
void |
erase()
Erases the sensitive key material of a private or symmetric key, making the key un-usable.
|
AlgorithmIdentifier |
getAlgID()
Returns the algorithm identifier for this key.
|
boolean |
getAllowExport()
Always returns
true . |
ASN1Object |
getContents()
Returns the contents of this key.
|
byte[] |
getEncoded()
Returns the encoded form of this key.
|
java.lang.String |
getFormat()
Returns a string which indicates the format of this object's encoding.
|
java.math.BigInteger |
getY()
Gets the public key value y.
|
void |
initialize(AlgorithmIdentifier algID, ASN1Object contents)
Initializes this instance from the given algorithm paramters and key contents.
|
void |
input(java.io.InputStream is)
Inputs a
DHPublicKey object by reading its encoding from the given input stream. |
int |
length()
Gets the length of the encoding of this object.
|
void |
output(java.io.OutputStream os)
Outputs the ASN1 encoding of this object to a given output stream.
|
void |
setParams(DHParams params)
Sets the parameters for the Diffie-Hellman key.
|
java.lang.String |
toString()
Returns a string representation of this object.
|
getAlgorithm, getBitLength, getParams, readExternal, writeExternal
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAlgorithm, getBitLength
public DHPublicKey()
public DHPublicKey(java.math.BigInteger y, DHParams params)
y
- the value of yparams
- the DHParams
of this DHPublicKey
public DHPublicKey(java.io.InputStream is) throws java.io.IOException
is
- the input stream from which this object will be readjava.io.IOException
- If an input exception occuredpublic byte[] getEncoded()
Key
getEncoded
in interface java.security.Key
public boolean getAllowExport()
true
.FIPS_140_2.getAllowKeyExport()
public java.lang.String getFormat()
getFormat
in interface java.security.Key
public void erase()
Key
Note: After erase()
has been invoked, no other methods of the Key
object are guaranteed to function correctly. In particular, invoking another method after erase()
may result in a NullPointerException
being thrown.
public java.lang.Object clone()
DHKey
DHKey
object.public void initialize(AlgorithmIdentifier algID, ASN1Object contents) throws AlgorithmIdentifierException, InvalidInputException
PublicKey
public AlgorithmIdentifier getAlgID()
PublicKey
public ASN1Object getContents()
PublicKey
public void setParams(DHParams params)
DHKey
public java.math.BigInteger getY()
getY
in interface javax.crypto.interfaces.DHPublicKey
public java.lang.String toString()
toString
in class java.lang.Object
public void input(java.io.InputStream is) throws java.io.IOException
DHPublicKey
object by reading its encoding from the given input stream.input
in interface Streamable
is
- The input stream from which this object will be readjava.io.IOException
- If an input exception occured.public void output(java.io.OutputStream os) throws java.io.IOException
output
in interface Streamable
os
- The output stream to which the encoding of this object will be written.java.io.IOException
- If an output exception occured.public int length()
length
in interface Streamable