SignDataP7GetR.html 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <!--!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"-->
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
  7. <title></title>
  8. <!-- 전자인증 모듈 설정 //-->
  9. <link rel="stylesheet" type="text/css" href="../CC_WSTD_home/unisignweb/rsrc/css/certcommon.css?v=1" />
  10. <script type="text/javascript" src="../CC_WSTD_home/unisignweb/js/unisignwebclient.js?v=1"></script>
  11. <script type="text/javascript" src="./UniSignWeb_Multi_Init_Nim.js?v=1"></script>
  12. <!-- 전자인증 모듈 설정 //-->
  13. <script>
  14. function GetRValueFromKey(userDN) {
  15. unisign.GetRValueFromKey(userDN, "", function( resultObject ) {
  16. var rValueBox = document.getElementById('rvalue');
  17. if( !resultObject || resultObject.resultCode != 0 ){
  18. alert( resultObject.resultMessage + "\n오류코드 : " + resultObject.resultCode );
  19. return;
  20. }
  21. rValueBox.value=resultObject.RValue; // R 값
  22. });
  23. }
  24. function SignData()
  25. {
  26. if (document.frm.plainText.value == "")
  27. {
  28. alert("서명할 원문이 없습니다.");
  29. return;
  30. }
  31. unisign.SignDataNonEnveloped( document.frm.plainText.value, null, "", function( resultObject )
  32. {
  33. document.frm.signedText.value = resultObject.signedData; //결과출력
  34. if( !resultObject || resultObject.resultCode !=0 )
  35. {
  36. alert( resultObject.resultMessage + "\n오류코드 : " + resultObject.resultCode );
  37. return;
  38. }
  39. alert( resultObject.certAttrs.subjectName);
  40. GetRValueFromKey(resultObject.certAttrs.subjectName);
  41. //alert('전자서명에 성공했습니다.');
  42. });
  43. }
  44. function FnSign()
  45. {
  46. SignData();
  47. }
  48. function Send()
  49. {
  50. if (document.frm.signedText.value == "")
  51. {
  52. alert("전자서명값이 없습니다.");
  53. return;
  54. }
  55. document.frm.method = "post";
  56. document.frm.action = "verifyGetR.jsp";
  57. document.frm.submit();
  58. }
  59. </script>
  60. </head>
  61. <body>
  62. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  63. <tr>
  64. <td height="37" bgcolor="#0099CC">&nbsp;<font color="#FFFFFF"><b>[전자서명 페이지]</b></font>
  65. </td>
  66. </tr>
  67. </table>
  68. <h3><font color="red"> hidden 처리 대상 : 원문, 전자서명값</font></h3><br>
  69. 서버에서 신원확인을 하는 샘플 , 인증서 전자서명 + DB에 저장된 주민/사업자번호를 통해 신원확인 검증한다. <br>
  70. <br><br>
  71. <form name="frm" onsubmit="return false">
  72. <table cellpadding="0" cellspacing="0" width="100%" align = "center">
  73. <tr>
  74. <td align = "center">
  75. <textarea name="plainText" rows="5" cols="40">TestData</textarea>
  76. <br>
  77. <br><br>DB에서 검색할 주민/사업자번호 <br>
  78. <input type = text id="ssn" name="ssn" value = ""><br><br><br>
  79. <input type = "button" value = "전자서명(인증서선택)" onclick="FnSign();" >
  80. </td>
  81. <td align = "center">전자서명값<br>
  82. <textarea name="signedText" rows="5" cols="40"></textarea>
  83. <br><br>
  84. <center>
  85. <br><br>사용자 인증서 R값<br><textarea id="rvalue" name="rvalue" rows="5" cols="40">
  86. </textarea>
  87. </center>
  88. <br>
  89. <input type=button value="전송(verifyGetR.jsp)" onclick="Send();">
  90. </td>
  91. </tr>
  92. </table>
  93. </form>
  94. </body>
  95. </html>