nimservice.js 31 KB

1
  1. var __nimservice=function(k){function m(a,e,b){var d=JSON.parse(a),c={};c.messageNumber=e;c.operation=d.operation;c.callback=b;c.valid=!0;10<=C&&(C=0);u[C]=c;C+=1;f+=1;try{document.getElementById("hsmiframe").contentWindow.postMessage(a,"https://127.0.0.1:15018")}catch(r){null!=b&&b(-1)}}function t(){return"touchen"==k.ESVS.SecureKeyboardType&&k.bsUtil().isTouchEnKeyUsable()?1:"ahnlab"==k.ESVS.SecureKeyboardType&&k.bsUtil().isAhnlabProtectorUsable()?2:0}function p(a){return 0==t()?k.bsUtil().GetEnvelopedPwd(a):a}function E(a){m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[0],manager:"ccsign"}),f,a)}function M(a,e,b,c,d){m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[7],manager:"ccsign",version:a,siteInfo:e,securityInfo:b,downloadURL:c}),f,d)}function I(a,e,b,c,d,r,g){m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[9],manager:"ccsign",sitecode:a,modcode:e,siteURL:b,serviceIP:c,servicePort:d,downloadURL:r}),f,g)}function F(a,e,b,c){a={messageNumber:f,sessionID:""+l,operation:h[42],manager:"ccsign",pki:k.ESVS.PKI,lang:"ko_kr"==k.ESVS.Language?0:1,device:a,drive:e,pin:p(b),options:{seckeyboard:t()}};m(JSON.stringify(a),f,c)}function G(a,e){m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[43],manager:"ccsign",index:a,includeCertPath:1}),f,e)}function J(a,e,b,c,d,r,g,z,k,n,u){a={messageNumber:f,sessionID:""+l,operation:h[24],manager:"ccsign",index:a,pwd:p(e),input:{inputdata:{plaintype:b,hashalg:c,authattr:n?1:0,plaintext:d}},inCon:1==g?1:0,charset:r,kmcert:z,multiuse:1==k?1:0,options:{seckeyboard:t()}};m(JSON.stringify(a),f,u)}function K(a,e){e=e.split(".");a=a.split(".");len=4;for(var b=0;b<len;b++){if(e[b]&&!a[b]&&0<x(e[b])||x(e[b])>x(a[b]))return!0;if(a[b]&&!e[b]&&0<x(a[b])||x(e[b])<x(a[b]))break}return!1}function x(a){return 1*a.replace(/\./g,"")}function A(a){switch(a){case 0:for(a=0;a<u.length;a++)if(u[a].operation==h[42]||u[a].operation==h[43])u[a].valid=!1;break;case 1:for(a=0;a<u.length;a++)u[a].operation==h[43]&&(u[a].valid=!1)}}var f=0,y=Math.pow(10,28),l=Math.round(Math.random()*y)/y,h="GetVersion InitUniSignWebToolkit GetLastErrorCode GetLastErrorMessage GetCertForKeyboardEncrypt SetSecureField GetDiskList SetMobileOptions GetHSMList SetUSIMOptions IsInstalledUSIMModule ClearAllUserCertList CopyCert DeleteCert ChangePassword ImportCert ExportCert GetPfxCertList VerifyCertificate GetCACertificates CheckPassword CheckSCardConnected CheckSCardPin GetSignDataP1 GetSignDataP7 VerifyP1SignData VerifySignedData GetSignFileP7 VerifyVID ExportCertEx ImportCertEx MakeHash EnvelopData DeEnvelopData EncryptData EncryptDataWithSymmKey DecryptDataWithSymmKey MakeXMLDSIG IssueCertificate RenewCertificate RevokeCertificate IssueKMCertificate GetAllUserCertListNum GetSignCertFromCertList VerifySignedFile CheckPasswdCombination CheckNewPasswdCombination GetBackupedDriveList BackupToUSB GetBackupedSlot RecoverFromUSB GetSDList IsSDInstalled GetMacAddress GetBackupedCertList CheckConnectToCAServer SetSystemTimeFromTimeServer IsUBIkeyInstalled GetRValueFromKey GetCertPath ExportCertString".split(" "),n="Init SendReceiverInfo ImportPFX Finalize Stop GetSenderInfoMsg GetCertNum GetQRCodeData AsyncWaitForReceiver GetPassword ExportPFX AbnormalFinalize VerifyCertNum ConnectToSmartPhone ExportPFXEx ImportPFXEx".split(" "),N={device:2,name:"PKCS#11 TOKEN"},v=!1,B=null,d="",c="",L=k.nimVersion,C=0,u=[];y=0;var D=function(a){if("https://127.0.0.1:15018"==a.origin&&(v=!0,!(null==a.data||0>=a.data.length))){var e,b=null;a=JSON.parse(a.data);for(e=0;e<u.length;e++)if("object"===typeof u[e]&&u[e].messageNumber==a.messageNumber){if(0==u[e].valid)return;b=u[e].callback;u[e]=0;break}268500992==a.resultCode&&(k.uiUtil().msgBox(k.uiUtil().getErrorMessageLang().IDS_MSGBOX_LOCALSERVER_UNLOAD),k.ActiveUI.dispose());a.operation==h[0]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(a.resultCode,a.resultMessage)):(B=a.version,e=B.split("."),B=e[0]+"."+e[1]+"."+e[2]+".0",b(a.resultCode,a.resultMessage,a.version)):a.operation==h[1]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[4]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(a.resultCode,a.resultMessage)):b(a.resultCode,a.resultMessage,a.pub):a.operation==h[6]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(d,c)):a.disklist?(e="object"!=typeof a.disklist?k.CustomEval(a.disklist):a.disklist,b(a.resultCode,a.resultMessage,e)):b(a.resultCode,a.resultMessage,""):a.operation==h[7]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[8]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(d,c)):a.hsmlist?(e="object"!=typeof a.hsmlist?k.CustomEval(a.hsmlist):a.hsmlist,b(a.resultCode,a.resultMessage,e)):b(a.resultCode,a.resultMessage,""):a.operation==h[9]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[10]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[11]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[12]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[13]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[14]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[15]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[16]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(d,c)):b(a.resultCode,a.resultMessage,a.filepath):a.operation==h[17]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage,a.index)):a.operation==h[18]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[19]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage,a.cacert,a.rootcert,a.rootcerthex)):a.operation==h[20]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[21]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[22]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[23]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(d,c)):b(a.resultCode,a.resultMessage,a.signeddata,a.encRValue,a.cert,a.label):a.operation==h[24]||a.operation==h[27]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(d,c)):b(a.resultCode,a.resultMessage,a.signeddata,a.encRValue,a.cert,a.label):a.operation==h[25]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[26]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(d,c)):b(a.resultCode,a.resultMessage,a.plaintext):a.operation==h[28]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[29]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(a.resultCode,a.resultMessage)):b(a.resultCode,a.resultMessage,a.pfx):a.operation==h[30]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[31]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(a.resultCode,a.resultMessage)):b(a.resultCode,a.resultMessage,a.hashdata):a.operation==h[32]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(a.resultCode,a.resultMessage)):b(a.resultCode,a.resultMessage,a.envelopeddata):a.operation==h[33]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(a.resultCode,a.resultMessage)):b(a.resultCode,a.resultMessage,a.plaintext):a.operation==h[34]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(a.resultCode,a.resultMessage)):b(a.resultCode,a.resultMessage,a.encrypteddata):a.operation==h[35]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(a.resultCode,a.resultMessage)):b(a.resultCode,a.resultMessage,a.encrypteddata):a.operation==h[36]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(a.resultCode,a.resultMessage)):b(a.resultCode,a.resultMessage,a.plaintext):a.operation==h[37]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(d,c)):b(a.resultCode,a.resultMessage,a.signeddata,a.encRValue,a.cert,a.label):a.operation==h[38]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[39]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage,a.cert)):a.operation==h[40]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[41]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[42]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(a.resultCode,a.resultMessage)):b(a.resultCode,a.resultMessage,a.certcnt):a.operation==h[43]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(a.resultCode,a.resultMessage)):b(a.resultCode,a.resultMessage,a.signcert,a.certPath):a.operation==h[44]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(a.resultCode,a.resultMessage)):b(a.resultCode,a.resultMessage,a.plaintext,a.signcert):a.operation==h[45]||a.operation==h[46]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[47]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(a.resultCode,a.resultMessage)):a.disklist?(e="object"!=typeof a.disklist?k.CustomEval(a.disklist):a.disklist,b(a.resultCode,a.resultMessage,e)):b(a.resultCode,a.resultMessage,""):a.operation==h[48]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[49]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(a.resultCode,a.resultMessage)):b(a.resultCode,a.resultMessage,a.slot):a.operation==h[50]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[51]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(d,c)):a.hsmlist?(e="object"!=typeof a.disklist?k.CustomEval(a.disklist):a.disklist,b(a.resultCode,a.resultMessage,e)):b(a.resultCode,a.resultMessage,""):a.operation==h[52]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[53]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(a.resultCode,a.resultMessage)):b(a.resultCode,a.resultMessage,a.mac):a.operation==h[54]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(a.resultCode,a.resultMessage)):b(a.resultCode,a.resultMessage,a.certlist):a.operation==h[55]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[56]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[57]?(0!=a.resultCode&&(d=a.resultCode,c=a.resultMessage),b(a.resultCode,a.resultMessage)):a.operation==h[58]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(d,c)):b(a.resultCode,a.resultMessage,a.RValue):a.operation==h[59]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(d,c)):b(a.resultCode,a.resultMessage,a.certPath):a.operation==h[60]?0!=a.resultCode?(d=a.resultCode,c=a.resultMessage,b(a.resultCode,a.resultMessage)):b(a.resultCode,a.resultMessage,a.pfx):a.operation==n[0]?0!=a.resultCode||"ok"!=a.resultMessage?(d=a.resultCode,c=a.resultMessage,b(d,c)):b(a.resultCode,a.resultMessage,a.context):a.operation==n[1]?0!=a.resultCode||"ok"!=a.resultMessage?(d=a.resultCode,c=a.resultMessage,b(d,c)):b(a.resultCode,a.resultMessage):a.operation==n[2]?0!=a.resultCode||"ok"!=a.resultMessage?(d=a.resultCode,c=a.resultMessage,b(d,c)):b(a.resultCode,a.resultMessage,a.pfx,a.pfxpwd):a.operation==n[3]?0!=a.resultCode||"ok"!=a.resultMessage?(d=a.resultCode,c=a.resultMessage,b(d,c)):b(a.resultCode,a.resultMessage):a.operation==n[4]?0!=a.resultCode||"ok"!=a.resultMessage?(d=a.resultCode,c=a.resultMessage,b(d,c)):b(a.resultCode,a.resultMessage):a.operation==n[5]?0!=a.resultCode||"ok"!=a.resultMessage?(d=a.resultCode,c=a.resultMessage,b(d,c)):b(a.resultCode,a.resultMessage,a.senderInfo):a.operation==n[6]?0!=a.resultCode||"ok"!=a.resultMessage?(d=a.resultCode,c=a.resultMessage,b(d,c)):b(a.resultCode,a.resultMessage,a.certnum):a.operation==n[7]?0!=a.resultCode||"ok"!=a.resultMessage?(d=a.resultCode,c=a.resultMessage,b(d,c)):b(a.resultCode,a.resultMessage,a.qrCodeData):a.operation==n[8]?0!=a.resultCode||"ok"!=a.resultMessage?(d=a.resultCode,c=a.resultMessage,b(d,c)):b(a.resultCode,a.resultMessage,a.transtype,a.deviceinfo,a.devicename,a.deviceos):a.operation==n[9]?0!=a.resultCode||"ok"!=a.resultMessage?(d=a.resultCode,c=a.resultMessage,b(d,c)):b(a.resultCode,a.resultMessage,a.pfxpwd):a.operation==n[10]?b(a.resultCode,a.resultMessage):a.operation==n[11]?b(a.resultCode,a.resultMessage):a.operation==n[12]?b(a.resultCode,a.resultMessage):a.operation==n[13]?0!=a.resultCode?b(a.resultCode,a.resultMessage):b(a.resultCode,a.resultMessage,a.policy,a.direction,a.phonekind):a.operation==n[14]?b(a.resultCode,a.resultMessage):a.operation==n[15]?b(a.resultCode,a.resultMessage,a.pfx,a.pfxpwd):(k.uiUtil().loadingBox(!1,"us-div-list-load"),k.uiUtil().createLoadingBox("hide","us-div-loading-dialog"),a&&a.resultMessage&&a.resultCode?k.uiUtil().errMsgBox(a.resultMessage,a.resultCode):k.uiUtil().errMsgBox(k.uiUtil().getErrorMessageLang().IDS_ERROR_REQUEST_RESPONSE,a.resultCode))}},H=function(a){v=!1;var e=!0,b=function(b,c){e?(e=!1,b&&b.parentNode&&b.parentNode.removeChild(b),c?k.ESVS.chkEXESetup?(v=!0,setTimeout(function(){a(!0)},500)):(document.getElementById("hsmiframe").src="about:blank",document.getElementById("hsmiframe").src="https://127.0.0.1:15018",setTimeout(function(){E(function(b,c,d){if("0"==b||0==b)if(b=d.split("."),K(b[0]+"."+b[1]+"."+b[2]+"."+b[3],L))e=!0,v=!1,k.ESVS.chkEXESetup=!1,a(!1);else{b=document.getElementsByClassName("us-download-select").length;if(0<b)for(--b;0<=b;b--)document.getElementsByClassName("us-download-select")[b].parentNode.removeChild(document.getElementsByClassName("us-download-select")[b]);v=k.ESVS.chkEXESetup=!0;setTimeout(function(){a(!0)},500)}else a(!1)})},500)):(e=!0,v=c,k.ESVS.chkEXESetup=!1,setTimeout(function(){a(c)},500))):(e=!0,v=c,k.ESVS.chkEXESetup=!1,setTimeout(function(){a(c)},500))};if(-1!=navigator.userAgent.indexOf("MSIE 7.0"))var c=document.createElement("<img id='hsmImg' src='https://127.0.0.1:15018/CRS?cd="+Math.random()+"' onload='' onerror='fnResult(this, false)' />");else c=document.createElement("img"),c.setAttribute("id","hsmImg"),c.setAttribute("src","https://127.0.0.1:15018/CRS?cd="+Math.random());c.onerror=function(){b(c,!1)};c.onload=function(){b(c,!0)};c.style.display="none";document.body.appendChild(c);if(-1!=navigator.userAgent.indexOf("MSIE 8")){var d=function(){0==v?setTimeout(d,100):b(null,!0)};setTimeout(d,100)}};0<y&&(y--,"function"===typeof window.addEventListener?window.removeEventListener("message",D,!1):window.detachEvent("onmessage",D));"function"===typeof window.addEventListener?window.addEventListener("message",D,!1):window.attachEvent("onmessage",D);y++;var g=function(a,e){if(-1!=e){var b=document.getElementById("us-div-cert-list-load");null!=b?k.uiUtil().loadingBox(!0,"us-div-cert-list-load",e):(b=document.getElementById("us-div-list-load"),k.uiUtil().loadingBox(!0,"us-div-list-load",e))}H(function(b){if(b)k.changeDefaultMedia(),a();else if(confirm(k.uiUtil().getErrorMessageLang().IDS_ERROR_NIM_NOT_INSTALL_CFM)){b={width:"800px",height:"500px",toolbar:"no",menubar:"no",scrollbar:"no",resizable:"yes"};var e="";if("object"==typeof k.ESVS.installPageOpenOption){var c=k.ESVS.installPageOpenOption,d;for(d in c)e+=d+"="+c[d]+", ",delete b[d]}for(d in b)e+=d+"="+b[d]+", ";window.open(k.nimCheckUrl,"install UniSign",e);var f=function(b){b?(k.changeDefaultMedia(),a()):k.ESVS._chkEXESetupCancel||setTimeout(function(){H(f)},1500)};k.ESVS._chkEXESetupCancel||setTimeout(function(){H(f)},1500)}})};return{GetLastErrorCode:function(){return d},GetLastErrorMessage:function(){return c},GetVersion:function(a){g(function(){null==B?E(a):a(0,"",B)},-1)},IsAvailable:function(){return v},InitUniSignWebToolkit:function(a,e,b){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[1],manager:"ccsign",pki:k.ESVS.PKI,lang:"ko_kr"==k.ESVS.Language?0:1,domain:a,license:e}),f,b)},13)},GetCertForKeyboardEncrypt:function(a,e,b){g(function(){d=-1;c="";var q={messageNumber:f,sessionID:""+l,operation:h[4],manager:"ccsign",domain:a,license:e,options:{seckeyboard:t()}};m(JSON.stringify(q),f,b)})},SetUSIMOptions:function(a,e,b,f,h,l,m){g(function(){d=-1;c="";I(a,e,b,f,h,l,m)},14)},GetDiskList:function(a){g(function(){A(0);d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[6],manager:"ccsign"}),f,a)},14)},GetHSMList:function(a,e){g(function(){A(0);d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[8],manager:"ccsign",listtype:a}),f,e)},14)},IsInstalledUSIMModule:function(a,e,b){g(function(){A(0);d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[10],manager:"ccsign",vendor:a,checkonly:1==e?1:0}),f,b)},14)},IssueCertificate:function(a,e,b,q,w,r,k,z,n,u){g(function(){d=-1;c="";var g=n;k==N&&(g=pwd);g={messageNumber:f,sessionID:""+l,operation:h[38],manager:"ccsign",ip:a,port:e,refnum:b,authcode:q,newpwd:p(w),newrepwd:p(r),device:k,drive:z,pin:p(g),options:{seckeyboard:t()}};m(JSON.stringify(g),f,u)},15)},IssueKMCertificate:function(a,e,b,q,w){g(function(){d=-1;c="";var g={messageNumber:f,sessionID:""+l,operation:h[41],manager:"ccsign",ip:a,port:e,index:b,pwd:p(q),options:{seckeyboard:t()}};m(JSON.stringify(g),f,w)},15)},RenewCertificate:function(a,e,b,q,w,r,k,z){g(function(){d=-1;c="";var g={messageNumber:f,sessionID:""+l,operation:h[39],manager:"ccsign",ip:a,port:e,index:b,newpwd:p(q),newrepwd:p(w),oldpwd:p(r),multiuse:1==k?1:0,options:{seckeyboard:t()}};m(JSON.stringify(g),f,z)},4)},RevokeCertificate:function(a,e,b,q,w,r,k){g(function(){d=-1;c="";var g={messageNumber:f,sessionID:""+l,operation:h[40],manager:"ccsign",ip:a,port:e,index:b,pwd:p(q),reason:w,deletecert:r,options:{seckeyboard:t()}};m(JSON.stringify(g),f,k)},4)},GetAllUserCertListNum:function(a,e,b,f){g(function(){A(0);d=-1;c="";4==a?M(k.ubiKeyEnv.version,k.ubiKeyEnv.siteInfo,k.ubiKeyEnv.securityInfo,k.ubiKeyEnv.downloadURL,function(c){0==c?F(a,e,b,f):f(c,0)}):6==a?I(k.usimEnv.sitecode,k.usimEnv.modecode,k.usimEnv.siteURL,k.usimEnv.serviceIP,k.usimEnv.servicePort,k.usimEnv.downloadURL,function(c){0==c?F(a,e,b,f):f(c,0)}):F(a,e,b,f)},0)},GetAllUserCert:function(a,e){g(function(){function b(f,h,g,q){if(0==f)null!=g&&0<g.length&&(f={},f.index=c+1,f.cert=g,f.path=q,d[c]=f);else return e(f),!1;if(a==d.length)return __callback=null,e(0,d),!0;c+=1;G(c+1,b)}A(1);var c=0,d=[];G(c+1,b)},0)},ClearAllUserCertList:function(a){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[11],manager:"ccsign"}),f,a)},0)},GetSignCertFromCertList:function(a,e){g(function(){d=-1;c="";G(a,e)},0)},CheckPassword:function(a,e,b,q,k,r){g(function(){d=-1;c="";var g={messageNumber:f,sessionID:""+l,operation:h[20],manager:"ccsign",index:b,device:a,drive:e,checkKMPassword:k?0:1,pwd:p(q),options:{seckeyboard:t()}};m(JSON.stringify(g),f,r)},9)},CheckSCardConnected:function(a){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[21],manager:"ccsign"}),f,a)},9)},CheckSCardPin:function(a,e){g(function(){d=-1;c="";var b={messageNumber:f,sessionID:""+l,operation:h[22],manager:"ccsign",pin:p(a),options:{seckeyboard:t()}};m(JSON.stringify(b),f,e)},9)},GetPfxCertList:function(a,e,b,q){g(function(){d=-1;c="";var g={messageNumber:f,sessionID:""+l,operation:h[17],manager:"ccsign",input:{inputtype:a,inputdata:e},pwd:p(b),options:{seckeyboard:t()}};m(JSON.stringify(g),f,q)},0)},VerifyCertificate:function(a,e,b){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[18],manager:"ccsign",index:a,verifytype:e}),f,b)},12)},GetCACertificates:function(a,e){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[19],manager:"ccsign",index:a}),f,e)},-1)},GetSignDataP7:function(a,e,b,f,h,l,m,k,p){g(function(){d=-1;c="";J(a,e,0,"",b,f,h,l,m,k,p)},1)},GetSignDataP7WithHash:function(a,e,b,f,h,l,m,k,p,n){g(function(){d=-1;c="";J(a,e,1,b,f,h,l,m,k,p,n)},1)},GetSignDataP1:function(a,e,b,q,k,r){g(function(){d=-1;c="";var g={messageNumber:f,sessionID:""+l,operation:h[23],manager:"ccsign",index:a,pwd:p(e),plaintext:b,kmcert:q,multiuse:1==k?1:0,options:{seckeyboard:t()}};m(JSON.stringify(g),f,r)},1)},VerifySignedData:function(a,e,b){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[26],manager:"ccsign",signeddata:e,plaintext:a}),f,b)},16)},VerifyP1SignData:function(a,e,b,q){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[25],manager:"ccsign",plaintext:a,signeddata:e,cert:b}),f,q)},16)},GetSignFileP7:function(a,e,b,q,k,r){g(function(){d=-1;c="";var g={messageNumber:f,sessionID:""+l,operation:h[27],manager:"ccsign",index:a,pwd:p(e),input:{inputdata:b[0],rewrite:b[3]},inCon:1==q?1:0,rettype:b[1],outfilepath:b[2],kmcert:k,options:{seckeyboard:t()}};m(JSON.stringify(g),f,r)},1)},DeleteCert:function(a,e,b){g(function(){d=-1;c="";var g={messageNumber:f,sessionID:""+l,operation:h[13],manager:"ccmanager",index:a,pwd:p(e),options:{seckeyboard:t()}};m(JSON.stringify(g),f,b)},3)},ImportCert:function(a,e,b,q,k,r,n){g(function(){d=-1;c="";var g={messageNumber:f,sessionID:""+l,operation:h[15],manager:"ccmanager",input:{inputtype:a,inputdata:e},pwd:p(b),device:q,drive:k,pin:p(r),options:{seckeyboard:t()}};m(JSON.stringify(g),f,n)},6)},ExportCert:function(a,e,b){g(function(){d=-1;c="";var g={messageNumber:f,sessionID:""+l,operation:h[16],manager:"ccmanager_exp",index:a,pwd:p(e),options:{seckeyboard:t()}};m(JSON.stringify(g),f,b)},7)},CopyCert:function(a,e,b,q,k,r){g(function(){d=-1;c="";var g={messageNumber:f,sessionID:""+l,operation:h[12],manager:"ccmanager",index:a,pwd:p(e),device:b,drive:q,pin:p(k),options:{seckeyboard:t()}};m(JSON.stringify(g),f,r)},5)},ChangePassword:function(a,e,b,q){g(function(){d=-1;c="";var g={messageNumber:f,sessionID:""+l,operation:h[14],manager:"ccmanager",index:a,pwd:p(e),newpwd:p(b),options:{seckeyboard:t()}};m(JSON.stringify(g),f,q)},8)},VerifyVID:function(a,e,b,q,w){g(function(){d=-1;c="";var g=0==b?k.bsUtil().GetEnvelopedPwd(q):p(q);g={userin:b,ssn:g};g={messageNumber:f,sessionID:""+l,operation:h[28],manager:"ccsign",index:a,pwd:p(e),ssn:g,multiuse:1==k.ESVS.multiuse?1:0,options:{seckeyboard:t()}};m(JSON.stringify(g),f,w)},12)},VerifySignedFile:function(a,e,b,q,k,r){g(function(){d=-1;c="";var g=0;null!=a&&(g=1);m(JSON.stringify(0==g?{messageNumber:f,sessionID:""+l,operation:h[44],manager:"ccsign",signtype:g,signdatatype:e,signeddata:b,rettype:q,outfilepath:k}:{messageNumber:f,sessionID:""+l,operation:h[44],manager:"ccsign",signtype:g,plaintext:a,signdatatype:e,signeddata:b,rettype:q,outfilepath:k}),f,r)})},EnvelopData:function(a,e,b,q,k,r,n){g(function(){d=-1;c="";var g=1;"kmcert"==a&&(g=2);g={messageNumber:f,sessionID:""+l,operation:h[32],manager:"ccsign",certtype:g,index:e,pwd:p(b),kmcert:q,plaintext:k,multiuse:1==r?1:0,options:{seckeyboard:t()}};m(JSON.stringify(g),f,n)},10)},DeEnvelopData:function(a,e,b,k,n){g(function(){d=-1;c="";var g=1;"kmcert"==a&&(g=2);g={messageNumber:f,sessionID:""+l,operation:h[33],manager:"ccsign",certtype:g,index:e,pwd:p(b),envelopeddata:k,options:{seckeyboard:t()}};m(JSON.stringify(g),f,n)},11)},ExportCertString:function(a,e,b,k,n,r){g(function(){d=-1;c="";var g={messageNumber:f,sessionID:""+l,operation:h[60],manager:"ccsign",device:a,drive:e,index:b,pfxpwd:k,pwd:p(n),options:{seckeyboard:t()}};m(JSON.stringify(g),f,r)},7)},ExportCertEx:function(a,e,b,k,n,r){g(function(){d=-1;c="";var g={messageNumber:f,sessionID:""+l,operation:h[29],manager:"ccsign",device:a,drive:e,index:b,pfxpwd:k,pwd:p(n),options:{seckeyboard:t()}};m(JSON.stringify(g),f,r)},7)},ImportCertEx:function(a,e,b,k,n,r,u){g(function(){d=-1;c="";var g={messageNumber:f,sessionID:""+l,operation:h[30],manager:"ccsign",device:a,drive:e,pin:p(b),pwd:p(k),pfx:n,pfxpwd:r,options:{seckeyboard:t()}};m(JSON.stringify(g),f,u)},6)},CheckPasswdCombination:function(a,e,b,k,n){g(function(){d=-1;c="";var g={messageNumber:f,sessionID:""+l,operation:h[45],manager:"ccsign",pwd:p(a),pwdmin:e,pwdmax:b,pwdlevel:k,options:{seckeyboard:t()}};m(JSON.stringify(g),f,n)},8)},CheckNewPasswdCombination:function(a,e,b,k,n,r){g(function(){d=-1;c="";var g={messageNumber:f,sessionID:""+l,operation:h[46],manager:"ccsign",newpwd:p(a),newrepwd:p(e),pwdmin:b,pwdmax:k,pwdlevel:n,options:{seckeyboard:t()}};m(JSON.stringify(g),f,r)},8)},GetBackupedDriveList:function(a){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[47],manager:"ccsign"}),f,a)},14)},BackupToUSB:function(a,e,b,k){g(function(){d=-1;c="";var g={messageNumber:f,sessionID:""+l,operation:h[48],manager:"ccsign",index:a,drive:e,pwd:p(b),options:{seckeyboard:t()}};m(JSON.stringify(g),f,k)},17)},GetBackupedSlot:function(a,e){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[49],manager:"ccsign",drive:a}),f,e)},17)},GetBackupedCertList:function(a,e){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[54],manager:"ccsign",drive:a}),f,e)},0)},RecoverFromUSB:function(a,e,b,k){g(function(){d=-1;c="";var g={messageNumber:f,sessionID:""+l,operation:h[50],manager:"ccsign",drive:a,index:e,pwd:p(b),options:{seckeyboard:t()}};m(JSON.stringify(g),f,k)},18)},GetSDList:function(a){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[51],manager:"ccsign"}),f,a)},14)},IsSDInstalled:function(a){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[52],manager:"ccsign"}),f,a)},14)},MakeHash:function(a,e,b,k){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[31],manager:"ccsign",inputtype:a,inputdata:e,hashalg:b}),f,k)},19)},EncryptData:function(a,e){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[34],manager:"ccsign",plaintext:a}),f,e)},20)},EncryptDataWithSymmKey:function(a,e,b,k,n,r){function q(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[35],manager:"ccsign",alg:a,symmkey:e,charset:k,plaintext:b}),f,r)}n?g(q,20):g(q,-1)},DecryptDataWithSymmKey:function(a,e,b,k,n,r){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[36],manager:"ccsign",alg:a,symmkey:e,fromcharset:k,charset:n,encrypteddata:b}),f,r)},20)},GetMacAddress:function(a,c){g(function(){m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[53],manager:"ccsign",mode:a}),f,c)})},MakeXMLDSIG:function(a,c,b,d,k,n){g(function(){var e={messageNumber:f,sessionID:""+l,operation:h[37],manager:"ccsign",index:a,pwd:p(c),inCon:0,plaintext:b,kmcert:d,multiuse:k,options:{seckeyboard:t()}};m(JSON.stringify(e),f,n)},1)},GetRValueFromKey:function(a,c,b){g(function(){var e={messageNumber:f,sessionID:""+l,operation:h[58],manager:"ccsign",index:a,pwd:p(c),options:{seckeyboard:t()}};m(JSON.stringify(e),f,b)},1)},GetCertPath:function(a,c){g(function(){m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[59],manager:"ccsign",index:a}),f,c)},1)},CheckConnectToCAServer:function(a,c,b,d,k){g(function(){m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[55],manager:"ccmanager",ip:a,port:c,dirip:b,dirport:d}),f,k)},1)},SetSystemTimeFromTimeServer:function(a,c,b){g(function(){m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[56],manager:"ccmanager",ip:a,port:c}),f,b)},1)},IsUBIkeyInstalled:function(a){g(function(){m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:h[57],manager:"ccmanager"}),f,a)},14)},checkInstall:function(a){var c=!0,b=function(b,d){c?(c=!1,b&&b.parentNode&&b.parentNode.removeChild(b),d?k.ESVS.chkEXESetup?a(d):setTimeout(function(){E(function(b,c,e){if("0"==b||0==b)if(b=e.split("."),K(b[0]+"."+b[1]+"."+b[2]+"."+b[3],L))k.ESVS.chkEXESetup=!1,a(d);else if(document.getElementById("hsmiframe").src="about:blank",document.getElementById("hsmiframe").src="https://127.0.0.1:15018",k.ESVS.chkEXESetup=!0,a(d),b=document.getElementsByClassName("us-download-select").length,0<b)for(--b;0<=b;b--)document.getElementsByClassName("us-download-select")[b].parentNode.removeChild(document.getElementsByClassName("us-download-select")[b])})},300):(k.ESVS.chkEXESetup=!1,a(d))):(k.ESVS.chkEXESetup=!1,a(d))};if(-1!=navigator.userAgent.indexOf("MSIE 7.0"))var d=document.createElement("<img id='hsmImg' src='https://127.0.0.1:15018/CRS?cd="+Math.random()+"' onload='' onerror='fnResult(this, false)' />");else d=document.createElement("img"),d.setAttribute("id","hsmImg"),d.setAttribute("src","https://127.0.0.1:15018/CRS?cd="+Math.random());d.onerror=function(){b(d,!1)};d.onload=function(){b(d,!0)};d.style.display="none";document.body.appendChild(d);if(-1!=navigator.userAgent.indexOf("MSIE 8")){var f=function(){0==v?setTimeout(f,100):b(null,!0)};setTimeout(f,100)}},Init:function(a,e,b,h){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:n[0],domain:"unisign.co.kr",serverip:a,serverport:e,license:b}),f,h)},1)},SendReceiverInfo:function(a,e,b,h){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:n[1],machinetype:e,certnum:b}),f,h)},1)},ImportPFX:function(a,e){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:n[2]}),f,e)},1)},Finalize:function(a,e){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:n[3]}),f,e)},1)},Stop:function(a,e){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:n[4]}),f,e)},1)},GetSenderInfoMsg:function(a,e){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:n[5]}),f,e)},1)},GetCertNum:function(a,e,b){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:n[6],senderInfo:e}),f,b)},1)},GetQRCodeData:function(a,e,b){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:n[7],certnum:e}),f,b)},1)},AsyncWaitForReceiver:function(a,e){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:n[8]}),f,e)},1)},GetPassword:function(a,e){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:n[9]}),f,e)},1)},ExportPFX:function(a,e,b,h){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:n[10],pfxpwd:e,pfx:b}),f,h)},1)},AbnormalFinalize:function(a,e){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:n[11]}),f,e)},1)},VerifyCertNum:function(a,e,b){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:n[12],certnum:e}),f,b)},1)},ConnectToSmartPhone:function(a,e,b){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:n[13],certnum:e}),f,b)},1)},ExportPFXEx:function(a,e,b,h,k){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:n[14],version:e,pfx:b,pfxpwd:h}),f,k)},1)},ImportPFXEx:function(a,e,b){g(function(){d=-1;c="";m(JSON.stringify({messageNumber:f,sessionID:""+l,operation:n[15],version:e}),f,b)},1)}}};