Class AsymmetricRSAKey
java.lang.Object
org.bouncycastle.crypto.asymmetric.AsymmetricRSAKey
- All Implemented Interfaces:
AsymmetricKey
,Key
- Direct Known Subclasses:
AsymmetricRSAPrivateKey
,AsymmetricRSAPublicKey
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".
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final AlgorithmIdentifier
protected static final AlgorithmIdentifier
protected final AlgorithmIdentifier
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canBeUsed
(AsymmetricRSAKey.Usage usage) Check to see if a key can be used for a specific usage.protected final void
Return the algorithm this RSA key is for.Return the modulus for this RSA key.protected final boolean
protected void
zeroize()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.bouncycastle.crypto.AsymmetricKey
getEncoded
-
Field Details
-
DEF_ALG_ID
-
PSS_ALG_ID
-
rsaAlgIdentifier
-
-
Method Details
-
getAlgorithm
Return the algorithm this RSA key is for.- Specified by:
getAlgorithm
in interfaceKey
- Returns:
- the key's algorithm.
-
getModulus
Return the modulus for this RSA key.- Returns:
- the key's modulus.
-
canBeUsed
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()
-