Top Description Fields Constructors Methods
org.bouncycastle.crypto.asymmetric

public final Class AsymmetricDHPrivateKey

extends AsymmetricDHKey
implements AsymmetricPrivateKey
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.AsymmetricPrivateKey, org.bouncycastle.crypto.AsymmetricKey, org.bouncycastle.crypto.Key, javax.security.auth.Destroyable
Imports
java.io.IOException, java.math.BigInteger, java.util.concurrent.atomic.AtomicBoolean, org.bouncycastle.asn1.ASN1Integer, .DERBitString, org.bouncycastle.asn1.oiw.ElGamalParameter, .OIWObjectIdentifiers, org.bouncycastle.asn1.pkcs.DHParameter, .PKCSObjectIdentifiers, .PrivateKeyInfo, org.bouncycastle.asn1.x509.AlgorithmIdentifier, org.bouncycastle.asn1.x9.DomainParameters, .ValidationParams, .X9ObjectIdentifiers, org.bouncycastle.crypto.Algorithm, .AsymmetricPrivateKey, org.bouncycastle.crypto.internal.Permissions

Class for Diffie-Hellman private keys.

Field Summary

Modifier and TypeField and Description
private final AtomicBoolean
private int
private BigInteger
x

Inherited from org.bouncycastle.crypto.asymmetric.AsymmetricDHKey:
algorithmapprovedModeOnlydomainParameters

Constructor Summary

AccessConstructor and Description
public
public
AsymmetricDHPrivateKey(Algorithm algorithm, byte[] enc)

public
AsymmetricDHPrivateKey(Algorithm algorithm, PrivateKeyInfo privateKeyInfo)

Method Summary

Modifier and TypeMethod and Description
private int
public void
destroy()

Overrides default javax.security.auth.Destroyable.destroy.

Destroy this Object.
public boolean
equals(Object
object to compare to.
o
)

Overrides java.lang.Object.equals.

Implements org.bouncycastle.crypto.Key.equals.

Return true if o is an equivalent key to this.
public final Algorithm

Returns:

the key's algorithm.
getAlgorithm
()

Overrides org.bouncycastle.crypto.asymmetric.AsymmetricDHKey.getAlgorithm.

Implements org.bouncycastle.crypto.Key.getAlgorithm.

Return the algorithm this Diffie-Hellman key is for.
public final DHDomainParameters

Returns:

the Diffie-Hellman domain parameters for this key.
getDomainParameters
()

Overrides org.bouncycastle.crypto.asymmetric.AsymmetricDHKey.getDomainParameters.

Return the Diffie-Hellman domain parameters associated with this key.
public final byte[]
getEncoded()

Implements org.bouncycastle.crypto.AsymmetricKey.getEncoded.

Return an ASN.1 encoding of the key wrapped in a PrivateKeyInfo or a SubjectPublicKeyInfo structure.
public BigInteger
getX()

public int
hashCode()

Overrides java.lang.Object.hashCode.

Implements org.bouncycastle.crypto.Key.hashCode.

Return the hashCode for the key.
public boolean
isDestroyed()

Overrides default javax.security.auth.Destroyable.isDestroyed.

Determine if this Object has been destroyed.
private static BigInteger
Inherited from org.bouncycastle.crypto.asymmetric.AsymmetricDHKey:
checkApprovedOnlyModeStatuszeroize

Field Detail

hasBeenDestroyedback to summary
private final AtomicBoolean hasBeenDestroyed
hashCodeback to summary
private int hashCode
xback to summary
private BigInteger x

Constructor Detail

AsymmetricDHPrivateKeyback to summary
public AsymmetricDHPrivateKey(Algorithm algorithm, DHDomainParameters params, BigInteger x)
AsymmetricDHPrivateKeyback to summary
public AsymmetricDHPrivateKey(Algorithm algorithm, byte[] enc)
AsymmetricDHPrivateKeyback to summary
public AsymmetricDHPrivateKey(Algorithm algorithm, PrivateKeyInfo privateKeyInfo)

Method Detail

calculateHashCodeback to summary
private int calculateHashCode()
destroyback to summary
public void destroy()

Overrides default javax.security.auth.Destroyable.destroy.

Doc from javax.security.auth.Destroyable.destroy.

Destroy this Object.

Sensitive information associated with this Object is destroyed or cleared. Subsequent calls to certain methods on this Object will result in an IllegalStateException being thrown.

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Implements org.bouncycastle.crypto.Key.equals.

Doc from org.bouncycastle.crypto.Key.equals.

Return true if o is an equivalent key to this.

Parameters
o:Object

object to compare to.

Returns:boolean

true if o is the same or equivalent key, false otherwise.

Annotations
@Override
getAlgorithmback to summary
public final Algorithm getAlgorithm()

Overrides org.bouncycastle.crypto.asymmetric.AsymmetricDHKey.getAlgorithm.

Implements org.bouncycastle.crypto.Key.getAlgorithm.

Return the algorithm this Diffie-Hellman key is for.

Returns:Algorithm

the key's algorithm.

getDomainParametersback to summary
public final DHDomainParameters getDomainParameters()

Overrides org.bouncycastle.crypto.asymmetric.AsymmetricDHKey.getDomainParameters.

Return the Diffie-Hellman domain parameters associated with this key.

Returns:DHDomainParameters

the Diffie-Hellman domain parameters for this key.

getEncodedback to summary
public final byte[] getEncoded()

Implements org.bouncycastle.crypto.AsymmetricKey.getEncoded.

Doc from org.bouncycastle.crypto.AsymmetricKey.getEncoded.

Return an ASN.1 encoding of the key wrapped in a PrivateKeyInfo or a SubjectPublicKeyInfo structure.

Returns:byte[]

an encoding of a PrivateKeyInfo or a SubjectPublicKeyInfo structure.

getXback to summary
public BigInteger getX()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Implements org.bouncycastle.crypto.Key.hashCode.

Doc from org.bouncycastle.crypto.Key.hashCode.

Return the hashCode for the key.

Returns:int

the key's hashCode.

Annotations
@Override
isDestroyedback to summary
public boolean isDestroyed()

Overrides default javax.security.auth.Destroyable.isDestroyed.

Doc from javax.security.auth.Destroyable.isDestroyed.

Determine if this Object has been destroyed.

Returns:boolean

true if this Object has been destroyed, false otherwise.

parsePrivateKeyback to summary
private static BigInteger parsePrivateKey(PrivateKeyInfo info)