Package org.bouncycastle.crypto.engines
Class RSABlindedEngine
java.lang.Object
org.bouncycastle.crypto.engines.RSABlindedEngine
- All Implemented Interfaces:
AsymmetricBlockCipher
this does your basic RSA algorithm with blinding
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Return the maximum size for an input block to this engine.int
Return the maximum size for an output block to this engine.void
init
(boolean forEncryption, CipherParameters parameters) initialise the RSA engine.protected SecureRandom
initSecureRandom
(boolean needed, SecureRandom provided) byte[]
processBlock
(byte[] in, int inOff, int inLen) Process a single block using the basic RSA algorithm.
-
Constructor Details
-
RSABlindedEngine
public RSABlindedEngine()
-
-
Method Details
-
init
initialise the RSA engine.- Specified by:
init
in interfaceAsymmetricBlockCipher
- Parameters:
forEncryption
- true if we are encrypting, false otherwise.parameters
- the key and other data required by the cipher.param
- the necessary RSA key parameters.
-
getInputBlockSize
public int getInputBlockSize()Return the maximum size for an input block to this engine. For RSA this is always one byte less than the key size on encryption, and the same length as the key size on decryption.- Specified by:
getInputBlockSize
in interfaceAsymmetricBlockCipher
- Returns:
- maximum size for an input block.
-
getOutputBlockSize
public int getOutputBlockSize()Return the maximum size for an output block to this engine. For RSA this is always one byte less than the key size on decryption, and the same length as the key size on encryption.- Specified by:
getOutputBlockSize
in interfaceAsymmetricBlockCipher
- Returns:
- maximum size for an output block.
-
processBlock
public byte[] processBlock(byte[] in, int inOff, int inLen) Process a single block using the basic RSA algorithm.- Specified by:
processBlock
in interfaceAsymmetricBlockCipher
- Parameters:
in
- the input array.inOff
- the offset into the input buffer where the data starts.inLen
- the length of the data to be processed.- Returns:
- the result of the RSA process.
- Throws:
DataLengthException
- the input block is too large.
-
initSecureRandom
-