Package org.mycore.crypt
Class MCRAESCipher
java.lang.Object
org.mycore.crypt.MCRCipher
org.mycore.crypt.MCRAESCipher
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]
decryptImpl
(byte[] bytes) protected String
decryptImpl
(String text) protected byte[]
encryptImpl
(byte[] bytes) protected String
encryptImpl
(String text) void
If no keyfile exsits, generate the secret key an write it to the keyfile.void
Initialize the chipher by reading the key from file.boolean
Return whether cipher has been initialized.void
Generate the secret key an write it to the keyfile.void
reset()
Revert init process.void
setKeyFile
(String path) Methods inherited from class org.mycore.crypt.MCRCipher
decrypt, decrypt, encrypt, encrypt, getAclEnabled, setAclEnabled
-
Constructor Details
-
MCRAESCipher
public MCRAESCipher()
-
-
Method Details
-
setKeyFile
-
init
Description copied from class:MCRCipher
Initialize the chipher by reading the key from file. If the cipher can't initialized an exception will thrown. Common issue is an missing key. In this case the methods throws a MCRCryptKeyFileNotFoundException. Needs the id of cipher as parameter, because the id can't be set during instanciating by getSingleInstanceOf.- Specified by:
init
in classMCRCipher
- Parameters:
id
- ID of cipher as configured- Throws:
MCRCryptKeyFileNotFoundException
InvalidKeyException
-
isInitialized
public boolean isInitialized()Description copied from class:MCRCipher
Return whether cipher has been initialized.- Specified by:
isInitialized
in classMCRCipher
-
reset
public void reset()Description copied from class:MCRCipher
Revert init process. -
generateKeyFile
Description copied from class:MCRCipher
If no keyfile exsits, generate the secret key an write it to the keyfile.- Specified by:
generateKeyFile
in classMCRCipher
- Throws:
FileAlreadyExistsException
-
overwriteKeyFile
public void overwriteKeyFile()Description copied from class:MCRCipher
Generate the secret key an write it to the keyfile. Overwrites exsisting keyfile.- Specified by:
overwriteKeyFile
in classMCRCipher
-
encryptImpl
- Specified by:
encryptImpl
in classMCRCipher
- Throws:
MCRCryptCipherConfigurationException
-
decryptImpl
- Specified by:
decryptImpl
in classMCRCipher
- Throws:
MCRCryptCipherConfigurationException
-
encryptImpl
- Specified by:
encryptImpl
in classMCRCipher
- Throws:
MCRCryptCipherConfigurationException
-
decryptImpl
- Specified by:
decryptImpl
in classMCRCipher
- Throws:
MCRCryptCipherConfigurationException
-