public final class DHPublicKey
extends java.lang.Object
implements java.security.PublicKey, javax.crypto.interfaces.DHPublicKey, java.io.Serializable
DHPrivateKey,
java.security.KeyAgreement,
Serialized Form| Constructor and Description |
|---|
DHPublicKey(java.math.BigInteger y,
java.math.BigInteger p,
java.math.BigInteger g)
Make a DH public key out of a public value
y, a prime
modulus p, and a base generator g. |
DHPublicKey(java.math.BigInteger y,
java.math.BigInteger p,
java.math.BigInteger g,
int l)
Make a DH public key out of a public value
y, a prime
modulus p, a base generator g, and a
private-value length l. |
DHPublicKey(byte[] encodedKey)
Make a DH public key from its DER encoding (X.509).
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getAlgorithm()
Returns the name of the algorithm associated with this key: "DH"
|
byte[] |
getEncoded()
Get the encoding of the key.
|
java.lang.String |
getFormat()
Returns the encoding format of this key: "X.509"
|
javax.crypto.spec.DHParameterSpec |
getParams()
Returns the key parameters.
|
java.math.BigInteger |
getY()
Returns the public value,
y. |
int |
hashCode()
Calculates a hash code value for the object.
|
java.lang.String |
toString() |
void |
zeroize()
This function zeroizes the key so that it isn't in memory
|
public DHPublicKey(java.math.BigInteger y,
java.math.BigInteger p,
java.math.BigInteger g)
throws java.security.InvalidKeyException
y, a prime
modulus p, and a base generator g.y - the public valuep - the prime modulusg - the base generatorjava.security.InvalidKeyException - if the key cannot be encodedpublic DHPublicKey(java.math.BigInteger y,
java.math.BigInteger p,
java.math.BigInteger g,
int l)
throws java.security.InvalidKeyException
y, a prime
modulus p, a base generator g, and a
private-value length l.y - the public valuep - the prime modulusg - the base generatorl - the private-value lengthjava.security.InvalidKeyException - if the key cannot be encodedpublic DHPublicKey(byte[] encodedKey)
throws java.security.InvalidKeyException
encodedKey - the encoded keyjava.security.InvalidKeyException - if the encoded key does not represent
a Diffie-Hellman public keypublic java.lang.String getFormat()
getFormat in interface java.security.Keypublic java.lang.String getAlgorithm()
getAlgorithm in interface java.security.Keypublic byte[] getEncoded()
getEncoded in interface java.security.Keypublic java.math.BigInteger getY()
y.getY in interface javax.crypto.interfaces.DHPublicKeyypublic javax.crypto.spec.DHParameterSpec getParams()
getParams in interface javax.crypto.interfaces.DHKeypublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic void zeroize()
© Portions Copyright 2003, 2012 IBM Corporation. All rights reserved.
© Portions Copyright 2003, 2012, Oracle and/or its affiliates. All rights reserved.