Package org.craftercms.commons.crypto
Class SimpleCipher
java.lang.Object
org.craftercms.commons.crypto.SimpleCipher
Utility class for simplifying encryption/decryption with the
Cipher
class. By default, the
algorithm used is AES.- Author:
- Sumer Jabri, Alfonso Vásquez
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Cipher
byte[]
decrypt
(byte[] encrypted) decryptBase64
(String encrypted) byte[]
encrypt
(byte[] clear) encryptBase64
(String clear) byte[]
getIv()
getKey()
void
void
setIv
(byte[] iv) void
-
Field Details
-
LOG_KEY_ENC_SUCCESSFUL
- See Also:
-
LOG_KEY_DEC_SUCCESSFUL
- See Also:
-
LOG_KEY_KEY_GEN
- See Also:
-
LOG_KEY_IV_GEN
- See Also:
-
LOG_KEY_DEF_CIPHER_CREATED
- See Also:
-
ERROR_KEY_KEY_NOT_SET
- See Also:
-
ERROR_KEY_IV_NOT_SET
- See Also:
-
ERROR_KEY_ENC_ERROR
- See Also:
-
ERROR_KEY_DEC_ERROR
- See Also:
-
-
Constructor Details
-
SimpleCipher
public SimpleCipher()
-
-
Method Details
-
getKey
-
setKey
-
getIv
public byte[] getIv() -
setIv
public void setIv(byte[] iv) -
getCipher
-
setCipher
-
encryptBase64
- Throws:
CryptoException
-
encrypt
- Throws:
CryptoException
-
decryptBase64
- Throws:
CryptoException
-
decrypt
- Throws:
CryptoException
-
createDefaultCipher
-