package org.openntf.xpt.core.dss.encryption;

import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;

public class EncryptionFactory {

	public static String encrypt(String strValue, SecretKeySpec key) {
		String strRC = "";
		try {
			Cipher aes = Cipher.getInstance("AES");
			aes.init(Cipher.ENCRYPT_MODE, key);
			byte[] ciphertext = aes.doFinal(strValue.getBytes());
			strRC = Base64.encodeBase64String(ciphertext);
			// strRC = Base64.encodeBase64String(ciphertext);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return strRC;
	}

	public static String decrypt(String strHash, SecretKeySpec key) {
		String strRC = "";
		try {

			Cipher aes = Cipher.getInstance("AES");
			byte[] ciphertext = Base64.decodeBase64(strHash);
			aes.init(Cipher.DECRYPT_MODE, key);
			strRC = new String(aes.doFinal(ciphertext));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return strRC;

	}
}

@@ -70,16 +70,64 @@
 ipher;%0D%0A
+import javax.crypto.IllegalBlockSizeException;%0D%0A
 import j
@@ -159,16 +159,18 @@
 ySpec;%0D%0A
+%0D%0A
 import o
@@ -958,24 +958,158 @@
 hertext));%0D%0A
+%09%09%7D catch (IllegalBlockSizeException e)%7B%0D%0A%09%09%09e.printStackTrace();%0D%0A%09%09%09//System.out.println(%22- NOT ENCRYPTED IN STORE - %22 + strHash);%0D%0A
 %09%09%7D catch (E

Remove print out