Class AesTextEncryptor
- java.lang.Object
-
- org.craftercms.commons.crypto.impl.AesTextEncryptor
-
- All Implemented Interfaces:
TextEncryptor
public class AesTextEncryptor extends Object implements TextEncryptor
Implementation ofTextEncryptor
that uses AES as it's cipher algorithm and Base 64 to encode raw bytes.- Author:
- avasquez
-
-
Constructor Summary
Constructors Constructor Description AesTextEncryptor(Key key)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
decrypt(String encrypted)
Decrypts the specified encrypted text.protected String
doDecrypt(String encrypted, Key key)
protected String
doEncrypt(String clear, Key key)
String
encrypt(String clear)
Encrypts the specified clear text.
-
-
-
Constructor Detail
-
AesTextEncryptor
public AesTextEncryptor(Key key)
-
-
Method Detail
-
encrypt
public String encrypt(String clear) throws CryptoException
Description copied from interface:TextEncryptor
Encrypts the specified clear text.- Specified by:
encrypt
in interfaceTextEncryptor
- Parameters:
clear
- the clear text to encrypt- Returns:
- the encrypted text
- Throws:
CryptoException
-
doEncrypt
protected String doEncrypt(String clear, Key key) throws CryptoException
- Throws:
CryptoException
-
decrypt
public String decrypt(String encrypted) throws CryptoException
Description copied from interface:TextEncryptor
Decrypts the specified encrypted text.- Specified by:
decrypt
in interfaceTextEncryptor
- Parameters:
encrypted
- the encrypted text to decrypt- Returns:
- the clear text
- Throws:
CryptoException
-
doDecrypt
protected String doDecrypt(String encrypted, Key key) throws CryptoException
- Throws:
CryptoException
-
-