Bouncy Castle Cryptography Library 1.85.2

org.bouncycastle.crypto.params
Class RSAKeyParameters

java.lang.Object
  extended byorg.bouncycastle.crypto.params.AsymmetricKeyParameter
      extended byorg.bouncycastle.crypto.params.RSAKeyParameters
All Implemented Interfaces:
CipherParameters, javax.security.auth.Destroyable
Direct Known Subclasses:
RSAPrivateCrtKeyParameters

public class RSAKeyParameters
extends AsymmetricKeyParameter
implements javax.security.auth.Destroyable


Constructor Summary
RSAKeyParameters(boolean isPrivate, java.math.BigInteger modulus, java.math.BigInteger exponent)
           
RSAKeyParameters(boolean isPrivate, java.math.BigInteger modulus, java.math.BigInteger exponent, boolean isInternal)
           
 
Method Summary
 void destroy()
          Destroy this object, dropping its reference to the exponent.
 java.math.BigInteger getExponent()
           
 java.math.BigInteger getModulus()
           
 boolean isDestroyed()
           
static java.math.BigInteger validateModulus(java.math.BigInteger modulus)
           
 
Methods inherited from class org.bouncycastle.crypto.params.AsymmetricKeyParameter
isPrivate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RSAKeyParameters

public RSAKeyParameters(boolean isPrivate,
                        java.math.BigInteger modulus,
                        java.math.BigInteger exponent)

RSAKeyParameters

public RSAKeyParameters(boolean isPrivate,
                        java.math.BigInteger modulus,
                        java.math.BigInteger exponent,
                        boolean isInternal)
Method Detail

validateModulus

public static java.math.BigInteger validateModulus(java.math.BigInteger modulus)

getModulus

public java.math.BigInteger getModulus()

getExponent

public java.math.BigInteger getExponent()

destroy

public void destroy()
Destroy this object, dropping its reference to the exponent. The (public) modulus is retained.

As BigInteger is immutable the exponent cannot be zeroized in place; destruction drops the internal reference so the value becomes unreachable (cleared on garbage collection). After destruction getExponent() throws IllegalStateException.

This type also backs RSA public keys; destroying one of those drops the (non-secret) public exponent, which is harmless but renders the key unusable.

Specified by:
destroy in interface javax.security.auth.Destroyable

isDestroyed

public boolean isDestroyed()
Specified by:
isDestroyed in interface javax.security.auth.Destroyable

Bouncy Castle Cryptography Library 1.85.2