Openfire 3.9.3 Javadoc

org.jivesoftware.util
Class AesEncryptor

java.lang.Object
  extended by 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 the setKey(byte[]) method to provide a custom key prior to invoking the encrypt(java.lang.String) or decrypt(java.lang.String) methods.

Author:
Tom Evans

Constructor Summary
AesEncryptor()
          Default constructor
AesEncryptor(String key)
          Custom key constructor
 
Method Summary
 String decrypt(String value)
          Decrypt an encrypted String.
 String encrypt(String value)
          Encrypt a clear text String.
 void setKey(String key)
          Set the encryption key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AesEncryptor

public AesEncryptor()
Default constructor


AesEncryptor

public AesEncryptor(String key)
Custom key constructor

Method Detail

encrypt

public String encrypt(String value)
Description copied from interface: Encryptor
Encrypt a clear text String.

Specified by:
encrypt in interface Encryptor
Parameters:
value - The clear text attribute
Returns:
The encrypted attribute, or null

decrypt

public String decrypt(String value)
Description copied from interface: Encryptor
Decrypt an encrypted String.

Specified by:
decrypt in interface Encryptor
Parameters:
value - The encrypted attribute in Base64 encoding
Returns:
The clear text attribute, or null

setKey

public void setKey(String key)
Description copied from interface: Encryptor
Set the encryption key. This will apply the user-defined key, truncated or filled (via the default key) as needed to meet the key length specifications.

Specified by:
setKey in interface Encryptor
Parameters:
key - The encryption key

Openfire 3.9.3 Javadoc

Copyright © 2003-2008 Jive Software.