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 String
decrypt(String value)
Decrypt an encrypted String.String
decrypt(String value, byte[] iv)
Decrypt an encrypted String.String
encrypt(String value)
Encrypt a clear text String.String
encrypt(String value, byte[] iv)
Encrypt a clear text String.void
setKey(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:Encryptor
Encrypt a clear text String.
-
encrypt
public String encrypt(String value, byte[] iv)
Description copied from interface:Encryptor
Encrypt a clear text String.
-
decrypt
public String decrypt(String value)
Description copied from interface:Encryptor
Decrypt an encrypted String.
-
decrypt
public String decrypt(String value, byte[] iv)
Description copied from interface:Encryptor
Decrypt an encrypted String.
-
-