<%@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 plainText = request.getParameter("plainText");
String output = "";
try {
JCEUtil.initProvider();
// �������� ���ڼ��� �ϴ� ����̱� ������ ����� �������� Ű�� �����´�.
//X509Certificate signCert = (X509Certificate)JCEUtil.readCertificate("C:/eclipse/eclipse_exbuilder6/workspace/HTML5/WebContent/certificate/class1/SVRZ1234567094_sig.cer");
//PrivateKey signPriKey = JCEUtil.readPrivateKey("epkiTest!2", "C:/eclipse/eclipse_exbuilder6/workspace/HTML5/WebContent/certificate/class1/SVRZ1234567094_sig.key");
String strCert = EgovProperties.getProperty("Globals.certPath");
String strPrivateKey = EgovProperties.getProperty("Globals.privateKeyPath");
X509Certificate signCert = (X509Certificate)JCEUtil.readCertificate(strCert);
PrivateKey signPriKey = JCEUtil.readPrivateKey("epkiTest!2", strPrivateKey);
SignedData signedData = new SignedData();
signedData.setMessage(plainText.getBytes());
byte[] signedBytes = signedData.generate(signCert, signPriKey, "SHA256");
output = plainText;
output = new String(signedBytes);
output = new String(Base64.encode(signedBytes));
} catch (Exception e) {
output = e.toString();
}
JSONObject jsonObj = new JSONObject();
jsonObj.put("out", output);
//out.print(jsonObj.toString()); //소스코드 점검결과 조치 시작 19.12.02
%>
'IT' 카테고리의 다른 글
<Jquery> 제이쿼리 로딩바 구현 (0) | 2019.12.24 |
---|---|
Developed data.jsp (0) | 2019.12.20 |
<IT> Block Cipher Encrypt.jsp (0) | 2019.12.20 |
<IT> L4/L7 스위치의 대안, 오픈 소스 로드 밸런서 HAProxy (0) | 2019.12.19 |
비즈니스아키텍쳐(BA), 데이터아키텍쳐(DA), 어플리케이션아키텍쳐(AA), 테크닉컬아키텍쳐(TA) (0) | 2019.12.16 |
댓글