Class BCRSAPrivateKey
java.lang.Object
org.bouncycastle.jcajce.provider.asymmetric.rsa.BCRSAPrivateKey
- All Implemented Interfaces:
Serializable, AsymmetricKey, DEREncodablePREVIEW, RSAKey, RSAPrivateKey, Key, PrivateKey, Destroyable, BCKey, PKCS12BagAttributeCarrier
- Direct Known Subclasses:
BCRSAPrivateCrtKey
public class BCRSAPrivateKey
extends Object
implements RSAPrivateKey, Destroyable, PKCS12BagAttributeCarrier, BCKey
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AlgorithmIdentifierprotected PKCS12BagAttributeCarrierImplprotected BigIntegerprotected BigIntegerprotected RSAKeyParameters -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Destroy this key, clearing the key material it holds.booleanbyte[]booleaninthashCode()booleanvoidsetBagAttribute(ASN1ObjectIdentifier oid, ASN1Encodable attribute) voidsetFriendlyName(String friendlyName) toString()Methods inherited from interface RSAPrivateKey
getParams
-
Field Details
-
modulus
-
privateExponent
-
algorithmIdentifier
-
rsaPrivateKey
-
attrCarrier
-
-
Method Details
-
getModulus
- Specified by:
getModulusin interfaceRSAKey
-
getPrivateExponent
- Specified by:
getPrivateExponentin interfaceRSAPrivateKey
-
getAlgorithm
- Specified by:
getAlgorithmin interfaceKey
-
getFormat
-
getEncoded
public byte[] getEncoded()- Specified by:
getEncodedin interfaceKey
-
equals
-
hashCode
-
destroy
public void destroy()Destroy this key, clearing the key material it holds.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, sohashCode()andgetModulus()remain stable across destruction. The underlyingRSAKeyParametersobject is destroyed as well, so keys sharing it are invalidated too. After destructionisDestroyed()returns true,getEncoded()andgetPrivateExponent()throwIllegalStateException, and the key can no longer be serialized.- Specified by:
destroyin interfaceDestroyable
-
isDestroyed
public boolean isDestroyed()- Specified by:
isDestroyedin interfaceDestroyable
-
setBagAttribute
- Specified by:
setBagAttributein interfacePKCS12BagAttributeCarrier
-
getBagAttribute
- Specified by:
getBagAttributein interfacePKCS12BagAttributeCarrier
-
getBagAttributeKeys
- Specified by:
getBagAttributeKeysin interfacePKCS12BagAttributeCarrier
-
hasFriendlyName
public boolean hasFriendlyName()- Specified by:
hasFriendlyNamein interfacePKCS12BagAttributeCarrier
-
setFriendlyName
- Specified by:
setFriendlyNamein interfacePKCS12BagAttributeCarrier
-
toString
-