public class BCRSAPrivateKey extends java.lang.Object implements java.security.interfaces.RSAPrivateKey, javax.security.auth.Destroyable, PKCS12BagAttributeCarrier, BCKey
| Modifier and Type | Field and Description |
|---|---|
protected AlgorithmIdentifier |
algorithmIdentifier |
protected PKCS12BagAttributeCarrierImpl |
attrCarrier |
protected java.math.BigInteger |
modulus |
protected java.math.BigInteger |
privateExponent |
protected RSAKeyParameters |
rsaPrivateKey |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroy this key, clearing the key material it holds.
|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getAlgorithm() |
ASN1Encodable |
getBagAttribute(ASN1ObjectIdentifier oid) |
java.util.Enumeration |
getBagAttributeKeys() |
byte[] |
getEncoded() |
java.lang.String |
getFormat() |
java.math.BigInteger |
getModulus() |
java.math.BigInteger |
getPrivateExponent() |
boolean |
hasFriendlyName() |
int |
hashCode() |
boolean |
isDestroyed() |
void |
setBagAttribute(ASN1ObjectIdentifier oid,
ASN1Encodable attribute) |
void |
setFriendlyName(java.lang.String friendlyName) |
java.lang.String |
toString() |
protected java.math.BigInteger modulus
protected java.math.BigInteger privateExponent
protected transient AlgorithmIdentifier algorithmIdentifier
protected transient RSAKeyParameters rsaPrivateKey
protected transient PKCS12BagAttributeCarrierImpl attrCarrier
public java.math.BigInteger getModulus()
getModulus in interface java.security.interfaces.RSAKeypublic java.math.BigInteger getPrivateExponent()
getPrivateExponent in interface java.security.interfaces.RSAPrivateKeypublic java.lang.String getAlgorithm()
getAlgorithm in interface java.security.Keypublic java.lang.String getFormat()
getFormat in interface java.security.Keypublic byte[] getEncoded()
getEncoded in interface java.security.Keypublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic void destroy()
The values are held as BigIntegers, which are immutable and so cannot be zeroized
in place - destruction drops the internal references so the values become unreachable
(cleared on garbage collection). The (public) modulus is retained, so hashCode()
and getModulus() remain stable across destruction. The underlying
RSAKeyParameters object is destroyed as well, so keys sharing it are invalidated
too. After destruction isDestroyed() returns true, getEncoded() and
getPrivateExponent() throw IllegalStateException, and the key can no
longer be serialized.
destroy in interface javax.security.auth.Destroyablepublic boolean isDestroyed()
isDestroyed in interface javax.security.auth.Destroyablepublic void setBagAttribute(ASN1ObjectIdentifier oid, ASN1Encodable attribute)
setBagAttribute in interface PKCS12BagAttributeCarrierpublic ASN1Encodable getBagAttribute(ASN1ObjectIdentifier oid)
getBagAttribute in interface PKCS12BagAttributeCarrierpublic java.util.Enumeration getBagAttributeKeys()
getBagAttributeKeys in interface PKCS12BagAttributeCarrierpublic boolean hasFriendlyName()
hasFriendlyName in interface PKCS12BagAttributeCarrierpublic void setFriendlyName(java.lang.String friendlyName)
setFriendlyName in interface PKCS12BagAttributeCarrierpublic java.lang.String toString()
toString in class java.lang.Object