Class AsymmetricRSAKey

java.lang.Object
org.bouncycastle.crypto.asymmetric.AsymmetricRSAKey
All Implemented Interfaces:
AsymmetricKey, Key
Direct Known Subclasses:
AsymmetricRSAPrivateKey, AsymmetricRSAPublicKey

public abstract class AsymmetricRSAKey extends Object implements AsymmetricKey
Base class for RSA keys.

Note: the module attempts to prevent accidental recent use of RSA keys for signing and encryption purposes by associating a specific usage with a modulus. If the module is not running in approved mode this behavior can be overridden by setting the system property "org.bouncycastle.rsa.allow_multi_use" to "true".

  • Field Details

  • Method Details

    • getAlgorithm

      public Algorithm getAlgorithm()
      Return the algorithm this RSA key is for.
      Specified by:
      getAlgorithm in interface Key
      Returns:
      the key's algorithm.
    • getModulus

      public BigInteger getModulus()
      Return the modulus for this RSA key.
      Returns:
      the key's modulus.
    • canBeUsed

      public boolean canBeUsed(AsymmetricRSAKey.Usage usage)
      Check to see if a key can be used for a specific usage. Essentially this will return false if the modulus is associated with a different usage already. The system property "org.bouncycastle.rsa.allow_multi_use" can be set to "true" to override this check.
      Parameters:
      usage - usage for the RSA key.
      Returns:
      true if the modulus is already associated with the usage, or has not being used already.
    • zeroize

      protected void zeroize()
    • isThreadCorrectMode

      protected final boolean isThreadCorrectMode()
    • checkApprovedOnlyModeStatus

      protected final void checkApprovedOnlyModeStatus()