/**
 * @(#)file    ItemSectListBiz.java
 * @(#)author  pej
 * @(#)version 1.0
 * @(#)date    2007.06-13
 * @(#)since   JDK1.4.1
 *
 * Copyright (c) 2002-2003 www.hwenc.com, Inc.  
 * All rights reserved.
 * This software is the proprietary information of hwenc, Inc.
 */
package kr.co.udapsoft.ebid.buyer.sycs.common.biz;
import com.udapsoft.waf.system.Biz;
import com.udapsoft.waf.system.HandlerStorage;

import kr.co.udapsoft.common.util.Encrypt;

public class CommEncryptBiz extends Biz {

    public CommEncryptBiz(HandlerStorage storage) {

        super(storage);        
    }
    public void doBiz() throws Exception {
    	String aa = "";
    	String bb = "";
    	String cc = "";
    	Encrypt encrypt = new Encrypt();
    	 
    	System.out.println("ori 1:" +  params.get("encrypt_data"));
    	System.out.println("ori 2:" +  params.get("decrypt_data"));
    	System.out.println("ori 3:" +  params.get("pass_data"));
    	
    	//양방향 암호화-주민번호
    	try {
    		aa = encrypt.encrypt( params.get("encrypt_data"));
    		params.set("encrypt_data_get", aa);
    	}
    	catch(Exception e){
    		System.out.println("=====" + e.getMessage());
        	params.set("encrypt_data_get", e.getMessage());
    	}
    	try {
    		bb = encrypt.decrypt( params.get("decrypt_data"));
    		params.set("decrypt_data_get", bb);
    	}
    	catch(Exception e){
    		System.out.println("=====" + e.getMessage());
        	params.set("decrypt_data_get", e.getMessage());
    	}
    	
    	//단방향 암호화 -비밀번호
    	try {
    		cc = encrypt.SHA256( params.get("pass_data"));
    		params.set("pass_data_get", cc);
    	}
    	catch(Exception e){
    		System.out.println("=====" + e.getMessage());
        	params.set("pass_data_get", e.getMessage());
    	}
    	System.out.println("1:" + aa);
    	System.out.println("2:" +bb);
    	System.out.println("3:" +cc);
    }
}
