Class AesTextEncryptor
- java.lang.Object
-
- org.craftercms.commons.crypto.impl.AesTextEncryptor
-
- All Implemented Interfaces:
TextEncryptor
public class AesTextEncryptor extends Object implements TextEncryptor
Implementation ofTextEncryptorthat 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 Stringdecrypt(String encrypted)Decrypts the specified encrypted text.protected StringdoDecrypt(String encrypted, Key key)protected StringdoEncrypt(String clear, Key key)Stringencrypt(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:TextEncryptorEncrypts the specified clear text.- Specified by:
encryptin 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:TextEncryptorDecrypts the specified encrypted text.- Specified by:
decryptin 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
-
-