Class AESEncryptor
java.lang.Object
org.deltava.crypt.SecretKeyEncryptor
org.deltava.crypt.AESEncryptor
A class to encrypt/decrypt data using AES.
- Since:
- 6.4
- Version:
- 10.1
- Author:
- Luke
-
Constructor Summary
ConstructorsConstructorDescriptionAESEncryptor(byte[] keyData) Create a new AES encryptor given an arbitrary key.AESEncryptor(byte[] keyData, byte[] iv) Create a new AES encryptor given an arbitrary key.AESEncryptor(String keyData) Create a new AES encryptor given an arbitrary key string. -
Method Summary
Methods inherited from class SecretKeyEncryptor
decrypt, encrypt, getAlgorithm, initKey, setKey, trimKeySizeModifier and TypeMethodDescriptionbyte[]decrypt(byte[] data) Decrypt a given amount of data.byte[]encrypt(byte[] data) Encrypt a given amount of data.final StringReturns the algorithm in use.protected voidInitialize the encryptor using a given key specification.protected voidInitialize the encryptor using a given secret key.protected static byte[]trimKeySize(byte[] rawKey, int maxSize) Helper method to trim a key if it is longer than a particular size.
-
Constructor Details
-
AESEncryptor
Create a new AES encryptor given an arbitrary key.- Parameters:
keyData- the key data. Only the first 16 or 32 bytes are used- Throws:
CryptoException- if the encryptor cannot be initialized
-
AESEncryptor
Create a new AES encryptor given an arbitrary key.- Parameters:
keyData- the key data. Only the first 16 or 32 bytes are usediv- the Initialization Vector, or null- Throws:
CryptoException- if the encryptor cannot be initialized
-
AESEncryptor
Create a new AES encryptor given an arbitrary key string.- Parameters:
keyData- the key string. Only the first 24 characters are used- Throws:
CryptoException- if the encryptor cannot be initialized
-