95 lines
2.8 KiB
Java
95 lines
2.8 KiB
Java
package itn.let.crypto.web;
|
|
|
|
import java.util.Map;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
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 org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
import itn.let.utl.fcc.service.EgovCryptoUtil;
|
|
|
|
/**
|
|
* 암호화/복호화 관한 controller 클래스를 정의한다.
|
|
* @author 공통서비스 개발팀 신용호
|
|
* @since 2018.12.03
|
|
* @version 3.8
|
|
* @see
|
|
*
|
|
* <pre>
|
|
* << 개정이력(Modification Information) >>
|
|
*
|
|
* 수정일 수정자 수정내용
|
|
* ---------- -------- ---------------------------
|
|
* 2018.12.03 신용호 최초 생성
|
|
* </pre>
|
|
*/
|
|
|
|
@Controller
|
|
public class EgovCryptoController {
|
|
|
|
/** 로그설정 */
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(EgovCryptoController.class);
|
|
|
|
/** 암호화서비스 */
|
|
//@Resource(name = "egovEnvCryptoService")
|
|
//EgovEnvCryptoService cryptoService;
|
|
|
|
//@Resource(name = "egovEnvPasswordEncoderService")
|
|
//EgovPasswordEncoder egovPasswordEncoder;
|
|
|
|
@Resource(name = "egovCryptoUtil")
|
|
EgovCryptoUtil egovCryptoUtil;
|
|
|
|
|
|
/** EgovMessageSource */
|
|
//@Resource(name="egovMessageSource")
|
|
//EgovMessageSource egovMessageSource;
|
|
|
|
/**
|
|
* 암호화/복호화 입력 및 요청 페이지를 호출한다.
|
|
*
|
|
* @return
|
|
*/
|
|
//@IncludedInfo(name="암호화/복호화", listUrl="/sec/pki/EgovCryptoInfo.do", order = 2200 ,gid = 90)
|
|
@RequestMapping(value="/web/sample/EgovCryptoInfo.do")
|
|
public String displayCryptoInfo( @RequestParam Map<?, ?> commandMap,
|
|
ModelMap model) throws Exception {
|
|
// 0. Spring Security 사용자권한 처리
|
|
/*
|
|
Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
|
|
if(!isAuthenticated) {
|
|
model.addAttribute("message", egovMessageSource.getMessage("fail.common.login"));
|
|
return "egovframework/com/uat/uia/EgovLoginUsr";
|
|
}
|
|
*/
|
|
|
|
System.out.println();
|
|
|
|
|
|
|
|
String plainText = (String)commandMap.get("plainText");
|
|
|
|
if ( plainText != null ) {
|
|
|
|
int plainTextLen = plainText.length();
|
|
//String cryptText = encrypt(plainText);
|
|
String cryptText = egovCryptoUtil.encrypt(plainText);
|
|
|
|
String decryptText = egovCryptoUtil.decrypt(cryptText);
|
|
int decryptTextLen = decryptText.length();
|
|
|
|
model.addAttribute("plainText", plainText);
|
|
model.addAttribute("plainTextLen", plainTextLen);
|
|
model.addAttribute("cryptText", cryptText);
|
|
model.addAttribute("decryptText", decryptText);
|
|
model.addAttribute("decryptTextLen", decryptTextLen);
|
|
}
|
|
|
|
return "web/sample/EgovCryptoInfo";
|
|
}
|
|
} |