%@ page language="java" import="java.io.*,java.util.*,crosscert.*" %>
<%@ page contentType = "text/html; charset=euc-kr" %>
<%
/*-------------------------½ÃÀÛ----------------------------*/
request.setCharacterEncoding("euc-kr");
response.setDateHeader("Expires",0);
response.setHeader("Prama","no-cache");
if(request.getProtocol().equals("HTTP/1.1"))
{
response.setHeader("Cache-Control","no-cache");
}
/*------------------------- ³¡----------------------------*/
String signeddata = request.getParameter("signedText"); // ¼¸íµÈ °ª
String getR = request.getParameter("rvalue"); // »ç¿ëÀÚ ÀÎÁõ¼ R°ª
String ssn = request.getParameter("ssn"); //DB¿¡¼ °Ë»öÇÑ »ç¾÷ÀÚ ¹øÈ£
int nRet;
boolean boolCertChk = true;
String ErrMsg = "";
String ErrCode = "";
crosscert.Base64 CBase64 = new crosscert.Base64();
nRet = CBase64.Decode(signeddata.getBytes(), signeddata.getBytes().length);
if(nRet==0)
{
Verifier CVerifier = new Verifier();
nRet=CVerifier.VerSignedData(CBase64.contentbuf, CBase64.contentlen);
if(nRet==0)
{
String sOrgData = new String(CVerifier.contentbuf);
out.println("ÀüÀÚ¼¸í °ËÁõ °á°ú : ¼º°ø
");
out.println("¿ø¹® : " + sOrgData + "
");
//ÀÎÁõ¼ Á¤º¸ ÃßÃâ °á°ú
Certificate CCertificate = new Certificate();
nRet=CCertificate.ExtractCertInfo(CVerifier.certbuf, CVerifier.certlen);
if(nRet==0)
{
out.println("ÀÎÁõ¼ Á¤º¸ ÃßÃâ °á°ú: ¼º°ø
");
out.println("ÀÎÁõ¼ DN : " + CCertificate.subject +"
");
out.println("==============================================
");
out.println("subject : " + CCertificate.subject +"
");
out.println("from : " + CCertificate.from +"
");
out.println("to : " + CCertificate.to +"
");
out.println("signatureAlgId : " + CCertificate.signatureAlgId +"
");
out.println("pubkey : " + CCertificate.pubkey +"
");
out.println("signature : " + CCertificate.signature +"
");
out.println("issuerAltName : " + CCertificate.issuerAltName +"
");
out.println("subjectAltName : " + CCertificate.subjectAltName +"
");
out.println("keyusage : " + CCertificate.keyusage +"
");
out.println("policy : " + CCertificate.policy +"
");
out.println("basicConstraint : " + CCertificate.basicConstraint +"
");
out.println("policyConstraint : " + CCertificate.policyConstraint +"
");
out.println("distributionPoint : " + CCertificate.distributionPoint +"
");
out.println("authorityKeyId : " + CCertificate.authorityKeyId +"
");
out.println("subjectKeyId : " + CCertificate.subjectKeyId +"
");
out.println("==============================================
");
String policies = "";
// °³ÀλóÈ£¿¬µ¿¿ë(¹ü¿ë) //
policies +="1.2.410.200004.5.2.1.2" + "|"; // Çѱ¹Á¤º¸ÀÎÁõ °³ÀÎ
policies +="1.2.410.200004.5.1.1.5" + "|"; // Çѱ¹Áõ±ÇÀü»ê °³ÀÎ
policies +="1.2.410.200005.1.1.1" + "|"; // ±ÝÀ¶°áÁ¦¿ø °³ÀÎ
policies +="1.2.410.200004.5.4.1.1" + "|"; // Çѱ¹ÀüÀÚÀÎÁõ °³ÀÎ
policies +="1.2.410.200012.1.1.1" + "|"; // Çѱ¹¹«¿ªÁ¤º¸Åë½Å °³ÀÎ
policies +="1.2.410.200004.5.5.1.1" + "|"; // ÀÌ´ÏÅØ °³ÀÎ
// ¹ýÀλóÈ£¿¬µ¿¿ë(¹ü¿ë)
policies +="1.2.410.200004.5.2.1.1" + "|"; // Çѱ¹Á¤º¸ÀÎÁõ ¹ýÀÎ
policies +="1.2.410.200004.5.1.1.7" + "|"; // Çѱ¹Áõ±ÇÀü»ê ¹ýÀÎ, ´Üü, °³Àλç¾÷ÀÚ
policies +="1.2.410.200005.1.1.5" + "|"; // ±ÝÀ¶°áÁ¦¿ø ¹ýÀÎ, ÀÓÀÇ´Üü, °³Àλç¾÷ÀÚ
policies +="1.2.410.200004.5.4.1.2" + "|"; // Çѱ¹ÀüÀÚÀÎÁõ ¹ýÀÎ, ´Üü, °³Àλç¾÷ÀÚ
policies +="1.2.410.200012.1.1.3" + "|"; // Çѱ¹¹«¿ªÁ¤º¸Åë½Å ¹ýÀÎ
policies +="1.2.410.200004.5.5.1.2" + "|"; // ÀÌ´ÏÅØ ¹ýÀÎ
// °³ÀÎ ¿ëµµÁ¦ÇÑ¿ë ÀÎÁõ¼Á¤Ã¥(OID) ¿ëµµ °øÀÎÀÎÁõ±â°ü
policies += "1.2.410.200004.5.4.1.101|"; // ÀºÇà°Å·¡¿ë/º¸Çè¿ë Çѱ¹ÀüÀÚÀÎÁõ
policies += "1.2.410.200004.5.4.1.102|"; // Áõ±Ç°Å·¡¿ë Çѱ¹ÀüÀÚÀÎÁõ
policies += "1.2.410.200004.5.4.1.103|"; // ½Å¿ëÄ«µå¿ë Çѱ¹ÀüÀÚÀÎÁõ
policies += "1.2.410.200004.5.4.1.104|"; // ÀüÀڹοø¿ë Çѱ¹ÀüÀÚÀÎÁõ
policies += "1.2.410.200004.5.2.1.7.1|"; // ÀºÇà°Å·¡¿ë/º¸Çè¿ë Çѱ¹Á¤º¸ÀÎÁõ
policies += "1.2.410.200004.5.2.1.7.2|"; // Áõ±Ç°Å·¡¿ë/º¸Çè¿ë Çѱ¹Á¤º¸ÀÎÁõ
policies += "1.2.410.200004.5.2.1.7.3|"; // ½Å¿ëÄ«µå¿ë Çѱ¹Á¤º¸ÀÎÁõ
policies += "1.2.410.200004.5.1.1.9|"; // Áõ±Ç°Å·¡¿ë/º¸Çè¿ë Çѱ¹ÁõÀü»ê
policies += "1.2.410.200004.5.1.1.9.2|"; // ½Å¿ëÄ«µå¿ë Çѱ¹ÁõÀü»ê
policies += "1.2.410.200005.1.1.4|"; // ÀºÇà°Å·¡¿ë/º¸Çè¿ë ±ÝÀ¶°áÁ¦¿ø
policies += "1.2.410.200005.1.1.6.2|"; // ½Å¿ëÄ«µå¿ë ±ÝÀ¶°áÁ¦¿ø
policies += "1.2.410.200012.1.1.101|"; // ÀºÇà°Å·¡¿ë/º¸Çè¿ë Çѱ¹¹«¿ªÁ¤º¸Åë½Å
policies += "1.2.410.200012.1.1.103|"; // Áõ±Ç°Å·¡¿ë/º¸Çè¿ë Çѱ¹¹«¿ªÁ¤º¸Åë½Å
policies += "1.2.410.200012.1.1.105|"; // ½Å¿ëÄ«µå¿ë Çѱ¹¹«¿ªÁ¤º¸Åë½Å
// ÀÎÁõ¼ °ËÁõ
nRet=CCertificate.ValidateCert(CVerifier.certbuf, CVerifier.certlen, policies, 1);
if(nRet==0)
{
out.println("ÀÎÁõ¼ °ËÁõ °á°ú : ¼º°ø
") ;
// ½Äº°¹øÈ£ °ËÁõ DB¿¡ ÀúÀåµÈ ÁÖ¹Î/»ç¾÷ÀÚ¹øÈ£¿Í getR °ªÀ» ÅëÇÑ ½Å¿øÈ®ÀÎ
nRet=CCertificate.VerifyVID(CVerifier.certbuf, CVerifier.certlen, getR.getBytes(), getR.length(), ssn);
if(nRet==0)
{
out.println("½Äº°¹øÈ£ °ËÁõ °á°ú : ¼º°ø
") ;
/*
ÀÎÁõ¼ ·ÎÁ÷ Á¾·á
»ç¿ëÀÚ DN DB¿¡ ÀúÀå : CCertificate.subject
»ç¿ëÀÚ ÀÎÁõ¼ ÁÖ¹Î/»ç¾÷ÀÚ¹øÈ£ : ssn
*/
}
else
{
boolCertChk = false;
out.println("½Äº°¹øÈ£ °ËÁõ °á°ú : ½ÇÆÐ
") ;
ErrMsg = "½Äº°¹øÈ£ °ËÁõ ½ÇÆÐ [ ¿¡·¯³»¿ë : " + CCertificate.errmessage + " ]";
ErrCode = "¿¡·¯ÄÚµå [ " + CCertificate.errcode + " ]";
out.println("ÀÎÁõ¼ ½Äº°¹øÈ£ °ËÁõ ½ÇÆÐ");
}
}
else
{
boolCertChk = false;
ErrMsg = "ÀÎÁõ¼ °ËÁõ ½ÇÆÐ [ ¿¡·¯³»¿ë : " + CCertificate.errmessage + " ]";
ErrCode = "¿¡·¯ÄÚµå [ " + CCertificate.errcode + " ]";
}// ÀÎÁõ¼¸¸ °ËÁõif¹® ³¡
}
else
{
boolCertChk = false;
ErrMsg = "ÀÎÁõ¼ ÃßÃâ ½ÇÆÐ [ ¿¡·¯³»¿ë : " + CCertificate.errmessage + " ]";
ErrCode = "¿¡·¯ÄÚµå [ " + CCertificate.errcode + " ]";
}
}//
else
{
boolCertChk = false;
ErrMsg = "ÀüÀÚ¼¸í °ËÁõ °á°ú ½ÇÆÐ [ ¿¡·¯³»¿ë : " + CVerifier.errmessage + " ]";
ErrCode = "¿¡·¯ÄÚµå [ " + CVerifier.errcode + " ]";
}
}//
else
{
boolCertChk = false;
ErrMsg = "¼¸í°ª Base64 Decode °á°ú ½ÇÆÐ [ ¿¡·¯³»¿ë : " + CBase64.errmessage + " ]";
ErrCode = "¿¡·¯ÄÚµå [ " + CBase64.errcode + " ]";
} //¼¸í°ª Base64 Decode If¹® ³¡...
if (boolCertChk == false)
{
%>
<%
}
else
{
out.print("ÀÎÁõ¼ ÃÖÁ¾°ËÁõ ¼º°ø
");
out.print("½Ã½ºÅÛ ÀÌ¿ëÇϱâ");
}
%>