Class BCRSAPrivateKey
- java.lang.Object
-
- org.bouncycastle.jcajce.provider.asymmetric.rsa.BCRSAPrivateKey
-
- All Implemented Interfaces:
java.io.Serializable,java.security.interfaces.RSAKey,java.security.interfaces.RSAPrivateKey,java.security.Key,java.security.PrivateKey,javax.security.auth.Destroyable,BCKey,PKCS12BagAttributeCarrier
- Direct Known Subclasses:
BCRSAPrivateCrtKey
public class BCRSAPrivateKey extends java.lang.Object implements java.security.interfaces.RSAPrivateKey, javax.security.auth.Destroyable, PKCS12BagAttributeCarrier, BCKey
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected AlgorithmIdentifieralgorithmIdentifierprotected PKCS12BagAttributeCarrierImplattrCarrierprotected java.math.BigIntegermodulusprotected java.math.BigIntegerprivateExponentprotected RSAKeyParametersrsaPrivateKey
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Destroy this key, clearing the key material it holds.booleanequals(java.lang.Object o)java.lang.StringgetAlgorithm()ASN1EncodablegetBagAttribute(ASN1ObjectIdentifier oid)java.util.EnumerationgetBagAttributeKeys()byte[]getEncoded()java.lang.StringgetFormat()java.math.BigIntegergetModulus()java.math.BigIntegergetPrivateExponent()booleanhasFriendlyName()inthashCode()booleanisDestroyed()voidsetBagAttribute(ASN1ObjectIdentifier oid, ASN1Encodable attribute)voidsetFriendlyName(java.lang.String friendlyName)java.lang.StringtoString()
-
-
-
Field Detail
-
modulus
protected java.math.BigInteger modulus
-
privateExponent
protected java.math.BigInteger privateExponent
-
algorithmIdentifier
protected transient AlgorithmIdentifier algorithmIdentifier
-
rsaPrivateKey
protected transient RSAKeyParameters rsaPrivateKey
-
attrCarrier
protected transient PKCS12BagAttributeCarrierImpl attrCarrier
-
-
Method Detail
-
getModulus
public java.math.BigInteger getModulus()
- Specified by:
getModulusin interfacejava.security.interfaces.RSAKey
-
getPrivateExponent
public java.math.BigInteger getPrivateExponent()
- Specified by:
getPrivateExponentin interfacejava.security.interfaces.RSAPrivateKey
-
getAlgorithm
public java.lang.String getAlgorithm()
- Specified by:
getAlgorithmin interfacejava.security.Key
-
getFormat
public java.lang.String getFormat()
- Specified by:
getFormatin interfacejava.security.Key
-
getEncoded
public byte[] getEncoded()
- Specified by:
getEncodedin interfacejava.security.Key
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
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 interfacejavax.security.auth.Destroyable
-
isDestroyed
public boolean isDestroyed()
- Specified by:
isDestroyedin interfacejavax.security.auth.Destroyable
-
setBagAttribute
public void setBagAttribute(ASN1ObjectIdentifier oid, ASN1Encodable attribute)
- Specified by:
setBagAttributein interfacePKCS12BagAttributeCarrier
-
getBagAttribute
public ASN1Encodable getBagAttribute(ASN1ObjectIdentifier oid)
- Specified by:
getBagAttributein interfacePKCS12BagAttributeCarrier
-
getBagAttributeKeys
public java.util.Enumeration getBagAttributeKeys()
- Specified by:
getBagAttributeKeysin interfacePKCS12BagAttributeCarrier
-
hasFriendlyName
public boolean hasFriendlyName()
- Specified by:
hasFriendlyNamein interfacePKCS12BagAttributeCarrier
-
setFriendlyName
public void setFriendlyName(java.lang.String friendlyName)
- Specified by:
setFriendlyNamein interfacePKCS12BagAttributeCarrier
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-