Package org.jivesoftware.util
Class AesEncryptor
- java.lang.Object
-
- org.jivesoftware.util.AesEncryptor
-
- All Implemented Interfaces:
Encryptor
public class AesEncryptor extends Object implements Encryptor
Utility class providing symmetric AES encryption/decryption. To strengthen the encrypted result, use thesetKey(byte[])method to provide a custom key prior to invoking theencrypt(java.lang.String)ordecrypt(java.lang.String)methods.- Author:
- Tom Evans
-
-
Constructor Summary
Constructors Constructor Description AesEncryptor()Default constructorAesEncryptor(String key)Custom key constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringdecrypt(String value)Decrypt an encrypted String.Stringdecrypt(String value, byte[] iv)Decrypt an encrypted String.Stringencrypt(String value)Encrypt a clear text String.Stringencrypt(String value, byte[] iv)Encrypt a clear text String.voidsetKey(String key)Set the encryption key.
-
-
-
Constructor Detail
-
AesEncryptor
public AesEncryptor()
Default constructor
-
AesEncryptor
public AesEncryptor(String key)
Custom key constructor- Parameters:
key- the custom key
-
-
Method Detail
-
encrypt
public String encrypt(String value)
Description copied from interface:EncryptorEncrypt a clear text String.
-
encrypt
public String encrypt(String value, byte[] iv)
Description copied from interface:EncryptorEncrypt a clear text String.
-
decrypt
public String decrypt(String value)
Description copied from interface:EncryptorDecrypt an encrypted String.
-
decrypt
public String decrypt(String value, byte[] iv)
Description copied from interface:EncryptorDecrypt an encrypted String.
-
-