de.flexiprovider.core.mersa
Class MeRSA
java.lang.Object
|
+--javax.crypto.CipherSpi
|
+--de.flexiprovider.api.Cipher
|
+--de.flexiprovider.api.AsymmetricBlockCipher
|
+--de.flexiprovider.core.mersa.MeRSA
- public class MeRSA
- extends AsymmetricBlockCipher
This class implements the Multi-Exponent RSA algorithm in the OAEP (Optimal
Asymmetric Encryption Padding) mode. The OAEP mode is recommended for new
applications.
- Author:
- Erik Dahmen, Paul Nguentcheu
|
Constructor Summary |
MeRSA()
|
| Methods inherited from class de.flexiprovider.api.AsymmetricBlockCipher |
checkLength, doFinal, doFinal, getBlockSize, getIV, getOutputSize, getParameters, initDecrypt, initDecrypt, initEncrypt, initEncrypt, initEncrypt, initEncrypt, setMode, setPadding, update, update |
| Methods inherited from class de.flexiprovider.api.Cipher |
doFinal, doFinal, engineDoFinal, engineDoFinal, engineGetBlockSize, engineGetIV, engineGetKeySize, engineGetOutputSize, engineGetParameters, engineInit, engineInit, engineInit, engineSetMode, engineSetPadding, engineUpdate, engineUpdate, update |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MeRSA
public MeRSA()
getName
public final java.lang.String getName()
- Overrides:
getName in class Cipher
- Returns:
- the name of this cipher
getKeySize
public int getKeySize(Key key)
throws InvalidKeyException
- Returns the key size of the given key object. Checks whether the key
object is an instance of
RSAPublicKey or
MeRSAPrivateKey. Would be simpler to just check for
RSAKey but this breaks build with Java 1.2.
- Overrides:
getKeySize in class Cipher
- Parameters:
key - the key object- Returns:
- the key size of the given key object.
- Throws:
InvalidKeyException - if key is invalid.
initCipherEncrypt
protected void initCipherEncrypt(Key key,
AlgorithmParameterSpec params,
SecureRandom secureRandom)
throws InvalidKeyException
- This method initializes the block cipher with a certain key and
parameters for data encryption.
- Overrides:
initCipherEncrypt in class AsymmetricBlockCipher
- Parameters:
key - -
the key which has to be used to encrypt dataparams - -
the algorithm parameterssecureRandom - -
the source of randomness- Throws:
InvalidKeyException - if the given key is inappropriate for initializing this
cipher.
initCipherDecrypt
protected void initCipherDecrypt(Key key,
AlgorithmParameterSpec params)
throws InvalidKeyException
- This method initializes the block cipher with a certain key and
parameters for data encryption.
- Overrides:
initCipherDecrypt in class AsymmetricBlockCipher
- Parameters:
key - -
the key which has to be used to decrypt dataparams - -
the algorithm parameters- Throws:
InvalidKeyException - if the given key is inappropriate for initializing this
cipher.
messageEncrypt
protected byte[] messageEncrypt(byte[] input)
- Encrypt a message.
- Overrides:
messageEncrypt in class AsymmetricBlockCipher
- Parameters:
input - -
the plaintext- Returns:
- the encrypted plaintext
messageDecrypt
protected byte[] messageDecrypt(byte[] input)
- Decrypt a ciphertext.
- Overrides:
messageDecrypt in class AsymmetricBlockCipher
- Parameters:
input - -
the ciphertext- Returns:
- the decrypted ciphertext