<%@page
language="java" contentType="text/html; charset=UTF-8"
import="org.json.simple.JSONObject,
java.security.PrivateKey, java.security.cert.X509Certificate,
ksign.jce.util.Base64,
ksign.jce.util.JCEUtil,
ksign.jce.provider.pkcs.*"
%>
<%@page import="kr.or.kcue.com.util.EgovProperties"%>
<%
String cryptText = request.getParameter("cryptText");
String output = "";
try {
JCEUtil.initProvider();
// 암호화용 서버 인증서 정보를 가져옵니다.
//X509Certificate cert = (X509Certificate)JCEUtil.readCertificate("C:/eclipse/eclipse_exbuilder6/workspace/HTML5/WebContent/certificate/class1/SVRZ1234567094_env.cer");
//PrivateKey key = JCEUtil.readPrivateKey("epkiTest!2", "C:/eclipse/eclipse_exbuilder6/workspace/HTML5/WebContent/certificate/class1/SVRZ1234567094_env.key");
String strCert = EgovProperties.getProperty("Globals.certPath");
String strPrivateKey = EgovProperties.getProperty("Globals.privateKeyPath");
X509Certificate cert = (X509Certificate)JCEUtil.readCertificate(strCert);
PrivateKey key = JCEUtil.readPrivateKey("epkiTest!2", strPrivateKey);
EnvelopedData envelopedData = new EnvelopedData();
byte[] decBytes = envelopedData.decrypt(Base64.decode(cryptText), cert, key);
output = new String(decBytes);
} catch (Exception e) {
output = e.toString();
}
JSONObject jsonObj = new JSONObject();
jsonObj.put("out", output);
//out.print(jsonObj.toString()); //소스코드 점검결과 조치 시작 19.12.02
%>
'IT' 카테고리의 다른 글
제이쿼리 기본 삽입 스크립트 (0) | 2019.12.24 |
---|---|
<Jquery> 제이쿼리 로딩바 구현 (0) | 2019.12.24 |
Sign Server.jsp (0) | 2019.12.20 |
<IT> Block Cipher Encrypt.jsp (0) | 2019.12.20 |
<IT> L4/L7 스위치의 대안, 오픈 소스 로드 밸런서 HAProxy (0) | 2019.12.19 |
댓글