Class AsymmetricRSAPrivateKey
- java.lang.Object
-
- org.bouncycastle.crypto.asymmetric.AsymmetricRSAKey
-
- org.bouncycastle.crypto.asymmetric.AsymmetricRSAPrivateKey
-
- All Implemented Interfaces:
javax.security.auth.Destroyable
,AsymmetricKey
,AsymmetricPrivateKey
,Key
public final class AsymmetricRSAPrivateKey extends AsymmetricRSAKey implements javax.security.auth.Destroyable, AsymmetricPrivateKey
Class for RSA private keys.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.bouncycastle.crypto.asymmetric.AsymmetricRSAKey
AsymmetricRSAKey.Usage
-
-
Field Summary
-
Fields inherited from class org.bouncycastle.crypto.asymmetric.AsymmetricRSAKey
DEF_ALG_ID, modulus, rsaAlgIdentifier
-
-
Constructor Summary
Constructors Constructor Description AsymmetricRSAPrivateKey(Algorithm algorithm, byte[] privateKeyInfoEncoding)
AsymmetricRSAPrivateKey(Algorithm algorithm, java.math.BigInteger modulus, java.math.BigInteger privateExponent)
AsymmetricRSAPrivateKey(Algorithm algorithm, java.math.BigInteger modulus, java.math.BigInteger publicExponent, java.math.BigInteger privateExponent, java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger dp, java.math.BigInteger dq, java.math.BigInteger qInv)
AsymmetricRSAPrivateKey(Algorithm algorithm, PrivateKeyInfo privateKeyInfo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
boolean
equals(java.lang.Object o)
Return true if o is an equivalent key to this.protected void
finalize()
Algorithm
getAlgorithm()
Return the algorithm this RSA key is for.java.math.BigInteger
getDP()
java.math.BigInteger
getDQ()
byte[]
getEncoded()
Return an ASN.1 encoding of the key wrapped in a PrivateKeyInfo or a SubjectPublicKeyInfo structure.java.math.BigInteger
getModulus()
Return the modulus for this RSA key.java.math.BigInteger
getP()
java.math.BigInteger
getPrivateExponent()
java.math.BigInteger
getPublicExponent()
java.math.BigInteger
getQ()
java.math.BigInteger
getQInv()
int
hashCode()
Return the hashCode for the key.boolean
isDestroyed()
-
Methods inherited from class org.bouncycastle.crypto.asymmetric.AsymmetricRSAKey
canBeUsed, checkApprovedOnlyModeStatus, zeroize
-
-
-
-
Constructor Detail
-
AsymmetricRSAPrivateKey
public AsymmetricRSAPrivateKey(Algorithm algorithm, java.math.BigInteger modulus, java.math.BigInteger publicExponent, java.math.BigInteger privateExponent, java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger dp, java.math.BigInteger dq, java.math.BigInteger qInv)
-
AsymmetricRSAPrivateKey
public AsymmetricRSAPrivateKey(Algorithm algorithm, java.math.BigInteger modulus, java.math.BigInteger privateExponent)
-
AsymmetricRSAPrivateKey
public AsymmetricRSAPrivateKey(Algorithm algorithm, byte[] privateKeyInfoEncoding)
-
AsymmetricRSAPrivateKey
public AsymmetricRSAPrivateKey(Algorithm algorithm, PrivateKeyInfo privateKeyInfo)
-
-
Method Detail
-
getAlgorithm
public Algorithm getAlgorithm()
Return the algorithm this RSA key is for.- Specified by:
getAlgorithm
in interfaceKey
- Overrides:
getAlgorithm
in classAsymmetricRSAKey
- Returns:
- the key's algorithm.
-
getModulus
public java.math.BigInteger getModulus()
Return the modulus for this RSA key.- Overrides:
getModulus
in classAsymmetricRSAKey
- Returns:
- the key's modulus.
-
getPublicExponent
public java.math.BigInteger getPublicExponent()
-
getPrivateExponent
public java.math.BigInteger getPrivateExponent()
-
getP
public java.math.BigInteger getP()
-
getQ
public java.math.BigInteger getQ()
-
getDP
public java.math.BigInteger getDP()
-
getDQ
public java.math.BigInteger getDQ()
-
getQInv
public java.math.BigInteger getQInv()
-
getEncoded
public final byte[] getEncoded()
Description copied from interface:AsymmetricKey
Return an ASN.1 encoding of the key wrapped in a PrivateKeyInfo or a SubjectPublicKeyInfo structure.- Specified by:
getEncoded
in interfaceAsymmetricKey
- Returns:
- an encoding of a PrivateKeyInfo or a SubjectPublicKeyInfo structure.
-
destroy
public void destroy()
- Specified by:
destroy
in interfacejavax.security.auth.Destroyable
-
isDestroyed
public boolean isDestroyed()
- Specified by:
isDestroyed
in interfacejavax.security.auth.Destroyable
-
equals
public boolean equals(java.lang.Object o)
Description copied from interface:Key
Return true if o is an equivalent key to this.
-
hashCode
public int hashCode()
Description copied from interface:Key
Return the hashCode for the key.
-
finalize
protected void finalize() throws java.lang.Throwable
- Overrides:
finalize
in classjava.lang.Object
- Throws:
java.lang.Throwable
-
-