Encryptor.java 734 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
package org.jivesoftware.util;

public interface Encryptor {

	/**
	 * Encrypt a clear text String. 
	 *
	 * @param value The clear text attribute
	 * @return The encrypted attribute, or null
	 */
	public abstract String encrypt(String value);

	/**
	 * Decrypt an encrypted String. 
	 *
	 * @param value The encrypted attribute in Base64 encoding
	 * @return The clear text attribute, or null
	 */
	public abstract String decrypt(String value);

	/**
	 * 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.
	 *
	 * @param key The encryption key
	 */
	public abstract void setKey(String key);

}