package nlib.cmm.web;

import java.util.List;

import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import nlib.cmm.NlibCommonController;

/**
 * <pre>
 * @Class Name : EncryptorConfigTest.java
 * 
 * @Description : properties 암호화 로그 및 테스트
 * 
 * 
 * @프로젝트명: 지방문화원 통합자료관리시스템 구축사업 (2021)
 *
 * </pre>
 *
 * @ ------------    --------    ---------------------------
 * @ 수정일                     수정자             수정내용
 * @ ------------    --------    ---------------------------
 * @ 2021. 12. 21.    KNKIM       최초 생성
 *
 * 
 * @author 이씨플라자 * DIGITALSHIP KNKIM
 * @since 2021. 12. 21.
 * @version 1.0
 *
 */
@Controller
public class EncryptorConfigTest {

	private static final Logger log = LoggerFactory.getLogger(EncryptorConfigTest.class);
	
	@RequestMapping(value = "/system/EncryptorTest.do")
	public String EncryptorTest(String key,String value,ModelMap model) {
		StandardPBEStringEncryptor pbeEnc = new StandardPBEStringEncryptor();
        pbeEnc.setAlgorithm("PBEWithMD5AndDES");
        pbeEnc.setPassword(key); // PBE 값(XML PASSWORD설정)
        log.info("키값 : "+ key + " 암호화할 값 : " + value + " -> 암호화된 값 : " + pbeEnc.encrypt(value));
        
        model.addAttribute("code", "정상");
        model.addAttribute("message", "정상적으로 처리되었습니다.");
        return "nlib/cmm/common";
	}
}