Developed data.jsp
<%@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
%>