package gov.va.med.esr.webservices.client;

import gov.va.med.fw.security.KeyManagerImpl;
import gov.va.med.fw.security.PasswordEncryptionServiceImpl;
import gov.va.med.fw.util.EncoderDecoderUtil;

import org.apache.commons.codec.binary.Base64;

public class EncryptionTest {
    
	public static void main(String[] args) throws Exception {

		 PasswordEncryptionServiceImpl eService = new PasswordEncryptionServiceImpl();
		 eService.setAlgorithm("AES/ECB/PKCS5Padding");
		 //eService.setEncryptionKey("491a686de6582a15f40497d954d6912adae94c516815c146");
		 eService.setDefaultCharacterEncoding("UTF-8");
		 eService.setKeySize(16);
		 
		 EncoderDecoderUtil edUtil = new EncoderDecoderUtil();
		 edUtil.setDecoder(new Base64());
		 edUtil.setEncoder(new Base64());
		 eService.setEncoderDecoder(edUtil);
		 //Base64
		 eService.setKeyManager(new KeyManagerImpl());
		 eService.afterPropertiesSet();

		/**
		ApplicationContext appContext = new ClassPathXmlApplicationContext(
				"/WEB-INF/spring-ws-servlet.xml");
		PasswordEncryptionServiceImpl eService = (PasswordEncryptionServiceImpl) appContext
				.getBean("passwordEncryptionService1");
				**/
		String encPassword = eService.encryptPassword("testPassword1!");
		System.out.println("encPassword=" + encPassword);

		
		
	}

}
