com.ibm.crypto.fips.provider
Class DHPublicKey
- java.lang.Object
com.ibm.crypto.fips.provider.DHPublicKey
All implemented interfaces:
java.io.Serializable, java.security.Key, java.security.PublicKey, javax.crypto.interfaces.DHKey, javax.crypto.interfaces.DHPublicKey
- public final class DHPublicKey
- extends java.lang.Object
- implements java.security.PublicKey, javax.crypto.interfaces.DHPublicKey, java.io.Serializable
Version:
1.0, 05/19/03
Author:
Jan Luehe, John Peck
See Also:
Constructor Summary
| 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).
|
Method Summary
| Modifier and Type | Method and Description |
|---|---|
|
equals(java.lang.Object obj)
|
|
finalize()
This function zeroizes the key so that it isn't in memory when GC is done.
|
|
getAlgorithm()
Returns the name of the algorithm associated with this key: "DH"
|
|
getEncoded()
Get the encoding of the key.
|
|
getFormat()
Returns the encoding format of this key: "X.509"
|
|
getParams()
Returns the key parameters.
|
|
getY()
Returns the public value,
y.
|
|
hashCode()
Calculates a hash code value for the object.
|
|
toString()
|
|
zeroize()
This function zeroizes the key so that it isn't in memory
|
| Methods inherited from class java.lang.Object |
|---|
clone, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail
DHPublicKey
- public DHPublicKey(java.math.BigInteger y,
- java.math.BigInteger p,
- java.math.BigInteger g)
- throws java.security.InvalidKeyException
Parameters:
y - the public value p - the prime modulus g - the base generator Throws:
java.security.InvalidKeyException - if the key cannot be encoded DHPublicKey
- public DHPublicKey(java.math.BigInteger y,
- java.math.BigInteger p,
- java.math.BigInteger g,
- int l)
- throws java.security.InvalidKeyException
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.
Parameters:
y - the public value p - the prime modulus g - the base generator l - the private-value length Throws:
java.security.InvalidKeyException - if the key cannot be encoded DHPublicKey
- public DHPublicKey(byte[] encodedKey)
- throws java.security.InvalidKeyException
Make a DH public key from its DER encoding (X.509).
Parameters:
encodedKey - the encoded key Throws:
java.security.InvalidKeyException - if the encoded key does not represent
a Diffie-Hellman public key Method Detail
getFormat
- public java.lang.String getFormat( )
Returns the encoding format of this key: "X.509"
Specified by:
getFormat in interface java.security.Key
getAlgorithm
- public java.lang.String getAlgorithm( )
Returns the name of the algorithm associated with this key: "DH"
Specified by:
getAlgorithm in interface java.security.Key
getEncoded
- public byte[] getEncoded()
Get the encoding of the key.
Specified by:
getEncoded in interface java.security.Key
getY
- public java.math.BigInteger getY( )
Returns the public value,
y.
Specified by:
getY in interface javax.crypto.interfaces.DHPublicKey
Returns:
the public value,
y getParams
- public javax.crypto.spec.DHParameterSpec getParams( )
Returns the key parameters.
Specified by:
getParams in interface javax.crypto.interfaces.DHKey
Returns:
the key parameters
toString
- public java.lang.String toString( )
Overrides:
toString in class java.lang.Object
hashCode
- public int hashCode()
Calculates a hash code value for the object.
Objects that are equal will also have the same hashcode.
Overrides:
hashCode in class java.lang.Object
equals
- public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
zeroize
- public void zeroize()
This function zeroizes the key so that it isn't in memory
finalize
- protected void finalize()
This function zeroizes the key so that it isn't in memory when GC is done.
Overrides:
finalize in class java.lang.Object
y, a prime modulusp, and a base generatorg.