/* * mTranskey * (C) 2013. RAONSECURE,Inc. All rights reserved. * Version 4.6.12.0 * 2019-02-11 */ //config var transkey_url='/transkeyM/transkey_mobile'; var transkey_surl ='/jsppage/transkeyServlet'; var mtk_useButton=false; var mtk_useTranskey=true; var useFakeKey=true; var mtk_useTalkBack=true; var useCheckTranskey=true; var tk_comments=""; var transkey_encDelimiter = ","; var transkey_delimiter='$'; var transkey_divType=1;//0fixed //1flexible var useCORS=false; var tk_origin=""; var keyboardLayouts = ["qwertyMobile", "numberMobile"]; //show license config var showLicense = true; //ture : show | false : not show var licenseType =""; var licExpiredDate = ""; var onKeyboard_allocate=false; //config document.write(''); document.write(''); document.write(''); document.write(''); document.write(''); document.write(''); var transkey=[]; var mtk=null; var tk_btn_arr=[]; function initmTranskey(){ setMaxDigits(131); if(mtk==null){ transkey.objs= new Array(); mtk = new mTranskey(); mtk.getPublicKey(transkey_surl); mtk.getClientWidth(); if(useCheckTranskey){ if (document.addEventListener) { document.addEventListener("mousedown", checkTransKey, false); } else if (document.attachEvent) { document.attachEvent("onmousedown", checkTransKey); } } if(window.addEventListener){ window.addEventListener("resize", function(){ setTimeout("mtk.reSizeListener()", 100); }, false); }else{ window.attachEvent("onresize", function(){ setTimeout("mtk.reSizeListener()", 100); }); } } var inputs = document.getElementsByTagName("input"); for(var i = 0; i < inputs.length; i++){ var input = inputs.item(i); if(input.getAttribute("data-tk-kbdType")!=null&&transkey[input.id]==null) mtk.setKeyboard(inputs.item(i)); } } if (typeof XMLHttpRequest == "undefined") { XMLHttpRequest = function() { try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch(e) { }; try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch(e) { }; try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { }; try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { }; throw new Error("This browser does not support XMLHttpRequest or XMLHTTP."); }; }; function mTranskeyObj(inputObj, width, div, keyType, keyboardType, dataType){ this.ele=null; this.allocate=false; this.id=inputObj.id; this.keyboardType=keyboardType+"Mobile"; this.width=width; this.div=div; this.numberDiv=div.children["mtk_"+this.id+"_number"]; this.lowerDiv=div.children["mtk_"+this.id+"_lower"]; this.upperDiv=div.children["mtk_"+this.id+"_upper"]; this.specialDiv=div.children["mtk_"+this.id+"_special"]; this.keyTypeIndex=""; // "l ","u ","s ","" this.useUpper=false; this.useLower=false; this.useCaps=false; this.useSpecial=false; this.keyType=keyType; this.cap=false; this.special=false; this.useTranskey=mtk_useTranskey; this.useButton=false; this.button=null; this.inputObj=inputObj; this.hidden=document.getElementById("transkey_"+inputObj.id); this.hmac=document.getElementById("transkey_HM_"+inputObj.id); this.ExE2E=document.getElementById("transkey_ExE2E_"+inputObj.id); this.exE2E=inputObj.getAttribute("data-tk-ExE2E")==null?"false":inputObj.getAttribute("data-tk-ExE2E"); this.fieldType=inputObj.type; this.bgImgChecked=false; this.imgWidth=""; this.talkBack=mtk_useTalkBack; this.dki=new Array(); this.keyboard = inputObj.getAttribute("data-tk-keyboard"); this.allocationIndex = new GenKey().tk_getrnd_int(); this.nextFocus=null; this.useInput=false; this.useInputDiv=null; if(inputObj.getAttribute("data-tk-nextFocusId")!=null) this.nextFocus = inputObj.getAttribute("data-tk-nextFocusId"); if(this.keyboard==null) this.keyboard = this.keyboardType; if(!useSession) { this.keyIndex = document.getElementById("keyIndex_"+inputObj.id).value; document.getElementById("keyboardType_"+inputObj.id).value = this.keyboardType; document.getElementById("fieldType_"+inputObj.id).value = this.fieldType; } var self = this; this.initKeyType = function(){ this.cap=false; this.special=false; }; this.setUrl = function(){ if(transkey_divType==0){ if(this.keyboardType=="numberMobile"){ var numberImg = new Image(); numberImg.onload = function(){ self.allocate=true; if(mtk_useTalkBack) self.getDummy(); //self.setKeyType(self.keyType); }; numberImg.src = getUrl("getKey", self, "single", self.allocationIndex)+"&talkBack="+self.talkBack+tk_origin; this.numberDiv.style.backgroundImage="url('"+numberImg.src+"')"; this.numberDiv.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader( src='"+numberImg.src+"', sizingMethod='scale')"; }else{ var quertyImg = new Image(); quertyImg.onload = function(){ self.allocate=true; var url = getUrl("getKey", self, "upper", self.allocationIndex)+"&talkBack="+self.talkBack+tk_origin; self.upperDiv.style.backgroundImage="url('"+url+"')"; self.upperDiv.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader( src='"+url+"', sizingMethod='scale')"; url = getUrl("getKey", self, "special", self.allocationIndex)+"&talkBack="+self.talkBack+tk_origin; self.specialDiv.style.backgroundImage="url('"+url+"')"; self.specialDiv.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader( src='"+url+"', sizingMethod='scale')"; if(mtk_useTalkBack) self.getDummy(); }; quertyImg.src = getUrl("getKey", this, "lower", this.allocationIndex)+"&talkBack="+this.talkBack+tk_origin; this.lowerDiv.style.backgroundImage="url('"+quertyImg.src+"')"; this.lowerDiv.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader( src='"+quertyImg.src+"', sizingMethod='scale')"; } } }; this.getDummy = function(){ var request = new XMLHttpRequest(); request.open("POST", transkey_surl, true); if(useCORS) request.withCredentials = true; request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); request.onreadystatechange = function(){ if (request.readyState == 4 && request.status == 200) { if(request.responseText.indexOf("SessionError")>-1){ var errCodes = request.responseText.split("="); if(errCodes[1]=="1"){ mtk.alert("session"); if(useSession) { mtk.resetToken(transkey_surl); mtk.resetSessionKey(transkey_surl); } } }else{ self.allocate=true; if(self.talkBack){ if(self.keyboardType=="numberMobile"){ self.talkBackNumberText=this.responseText.split(","); self.talkBackNumberText.splice(12, 3); }else{ self.dki = this.responseText.split(","); } if(transkey_divType==0) mtk.setTalkBackKeys(self); mtk.setTalkBackText(self); } } } }; try { request.send(getUrlPost("getDummy", self, "")+"&talkBack="+self.talkBack+tk_origin); } catch(e) { alert("TransKey error: Cannot load TransKey. Network is not available."); return false; } } this.checkInitTime = function(){ var nowTime = new Date(); var year = nowTime.getFullYear() - decInitTime.substring(0,4); var month = nowTime.getMonth()+1 - decInitTime.substring(4,6); var day = nowTime.getDate() - decInitTime.substring(6,8); var hour = nowTime.getHours() - decInitTime.substring(8,10); var min = nowTime.getMinutes() - decInitTime.substring(10,12); year *= 525600; month *= 44640; day *= 1440; hour *= 60; var elapsedTime = year + month + day + hour + min; if(elapsedTime > limitTime) { decInitTime = nowTime; alert("½Ã°£ÀÌ ¸¸·áµÇ¾ú½À´Ï´Ù."); var request = new XMLHttpRequest(); request.open("GET", transkey_surl+"?op=getInitTime&"+new Date().getTime()+tk_origin, false); request.onreadystatechange = function(){ if (request.readyState == 4 && request.status == 200) { decInitTime = request.responseText.split(";")[0]; decInitTime = decInitTime.split("=")[1]; decInitTime = decInitTime.replace("'",""); decInitTime = decInitTime.replace("'",""); initTime = request.responseText.split(";")[1]; initTime = initTime.split("=")[1]; initTime = initTime.replace("'",""); initTime = initTime.replace("'",""); } }; try { request.send(); } catch(e) { alert("TransKey error: Cannot load TransKey. Network is not available."); return false; } document.getElementById("initTime").value = initTime; return; } } this.setBgImageForDivType1 = function(type){ var img = new Image(); img.onload = function(){ if(self.allocate == false) { self.allocate=true; if(mtk_useTalkBack) self.getDummy(); //self.setKeyType(self.keyType); } }; img.src = getUrl("getKey", this, type, this.allocationIndex); if(type=="single"){ for(var i=1; 5>i; i++){ for(var j=0; 4>j; j++){ try{ this.div.childNodes[i].childNodes[j].childNodes[0].style.backgroundImage="url('"+img.src+"')"; }catch(e){ } } } // try{ // this.div.childNodes[4].childNodes[0].childNodes[0].style.backgroundImage="url('"+url+"')"; // }catch(e){ // // } }else{ for(var i=1; 5>i; i++){ for(var j=0; 11>j; j++){ try{ this.div.childNodes[i].childNodes[j].childNodes[0].style.backgroundImage="url('"+img.src+"')"; }catch(e){ } } } for(var j=0; 3>j; j++){ try{ this.div.childNodes[5].childNodes[j].childNodes[0].style.backgroundImage="url('"+img.src+"')"; }catch(e){ } } } }; this.setDataType = function(dataType){ if(keyboardType=="number") return; if(dataType==null){ this.useCaps=true; this.useSpecial=true; this.useLower=true; this.useUpper=true; }else{ for(var i=0; dataType.length>i; i++){ switch(dataType.charAt(i)){ case 'a': this.useLower=true; break; case 'A': this.useUpper=true; break; case '@' : this.useSpecial=true; break; } } if(this.useLower&&this.useUpper) this.useCaps=true; if(!this.useLower&&!this.useUpper) this.useSpecial=false; } }; this.setExE2E = function(ExE2E){ this.ExE2E.value=ExE2E; }; function getUrl(op, o, keyType, allocationIndex){ if(!useSession){ return transkey_surl+"?op="+op+"&name="+o.id+"&keyType="+keyType+"&keyboardType="+o.keyboard+"&fieldType=" +o.fieldType+"&inputName="+o.inputObj.name+"&transkeyUuid="+mtk.transkeyUuid+"&exE2E="+o.exE2E +"&TK_requestToken="+TK_requestToken+"&allocationIndex="+allocationIndex+"&keyIndex="+o.keyIndex+"&initTime="+initTime+tk_origin; } else { return transkey_surl+"?op="+op+"&name="+o.id+"&keyType="+keyType+"&keyboardType="+o.keyboard+"&fieldType=" +o.fieldType+"&inputName="+o.inputObj.name+"&transkeyUuid="+mtk.transkeyUuid+"&exE2E="+o.exE2E +"&TK_requestToken="+TK_requestToken+"&allocationIndex="+allocationIndex+tk_origin; } } function getUrlPost(op, o, keyType, allocationIndex){ if(!useSession) { return "op="+op+"&name="+o.id+"&keyType="+keyType+"&keyboardType="+o.keyboard+"&fieldType=" +o.fieldType+"&inputName="+o.inputObj.name+"&transkeyUuid="+mtk.transkeyUuid+"&exE2E="+o.exE2E+ "&TK_requestToken="+TK_requestToken+"&allocationIndex="+allocationIndex+"&keyIndex="+o.keyIndex+"&initTime="+initTime+tk_origin; } else { return "op="+op+"&name="+o.id+"&keyType="+keyType+"&keyboardType="+o.keyboard+"&fieldType=" +o.fieldType+"&inputName="+o.inputObj.name+"&transkeyUuid="+mtk.transkeyUuid+"&exE2E="+o.exE2E+ "&TK_requestToken="+TK_requestToken+"&allocationIndex="+allocationIndex+tk_origin; } } this.setWidth(width); this.setDataType(dataType); this.setKeyType(keyType); } mTranskeyObj.prototype.setButton = function(useB){ this.useButton=useB; this.button = document.getElementById(this.inputObj.id+"_tk_btn"); if(useB){ if(mtk_useTranskey){ this.button.className = "tk_btn_"; this.button.setAttribute("data-tk-btnValue","true"); }else{ this.button.className = "tk_btn"; this.button.setAttribute("data-tk-btnValue","false"); } tk_btn_arr[this.button.id]=this.id; if(this.button.addEventListener ){ this.button.addEventListener("click", mtk.buttonListener, false); }else{ this.button.attachEvent("onclick", mtk.buttonListener); } } }; mTranskeyObj.prototype.setKeyType = function(keyT){ this.keyType = keyT; if(transkey_divType==1) this.setBgImageForDivType1(keyT); if(keyT=="single"){ this.keyTypeIndex = ""; }else{ if(transkey_divType==0) this[keyT+"Div"].style.display="block"; this.keyTypeIndex = keyT.charAt(0)+" "; if(keyT=="upper"){ this.cap=true; } else if(keyT=="special"){ this.special=true; } } if(this.allocate&&this.talkBack) mtk.setTalkBackText(this); }; mTranskeyObj.prototype.setWidth = function(width){ if(width>=600&&!mtk.horizontal){ this.width=600; }else if(width>=360) this.width=360; else this.width=320; }; mTranskeyObj.prototype.setQwertyKey = function(key){ if(transkey_divType==0){ this.lowerDiv.style.display="none"; this.upperDiv.style.display="none"; this.specialDiv.style.display="none"; this[key+"Div"].style.display="block"; } }; mTranskeyObj.prototype.clear = function(){ this.inputObj.value = ""; this.hidden.value = ""; this.hmac.value = ""; if(this.useInput) this.useInputDiv.childNodes[0].value = ""; }; mTranskeyObj.prototype.getCipherData = function(xecureRandomData, crtType){ var v = mtk.inputFillEncData(this.inputObj); var aCipher = null; var aCipherArray = null; var aInputValue = null; var aInputHMValue = null; var encXecureRanData = null; var aRequest = null; aInputValue = v.hidden; if (aInputValue == null || aInputValue == "") { aCipher = ""; return aCipher; } aInputHMValue = v.hmac; var PKey = mtk.getPKey(); encXecureRanData = mtk.phpbb_encrypt2048(xecureRandomData, PKey.k, PKey.e, PKey.n); var rsaPubKey=""; var crtTypeParam = crtType; if(crtType=="pkc"){ rsaPubKey = mtk.getCertPublicKey(); crtTypeParam = "yettie"; } var sPort = location.port; if(sPort.length<=0) sPort = '80'; aRequest = new XMLHttpRequest(); aRequest.open("POST", transkey_surl, false); aRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); aRequest.setRequestHeader("Cache-Control", "no-cache"); if (aRequest.readyState == 4 && aRequest.status == 200) { if(aRequest.responseText.indexOf("LimitTimeOver")>-1){ alert("½Ã°£ÀÌ ¸¸·áµÇ¾ú½À´Ï´Ù."); } } if(!useSession) { var seedKey = document.getElementById("seedKey").value; aRequest.send("op=getPlainText&name=" + this.id + "&value=" + aInputValue + "&hmac=" + aInputHMValue + "&crtType=" + crtTypeParam + "&encXecureRanData=" + encXecureRanData + "&sPort=" + sPort+"&pubKey=" + rsaPubKey+"&keyIndex=" + this.keyIndex+"&fieldType=" + this.fieldType+"&keyboardType=" + this.keyboardType + "&encSeedKey=" + seedKey+"&initTime="+initTime); } else { aRequest.send("op=getPlainText&name=" + this.id + "&value=" + aInputValue + "&hmac=" + aInputHMValue + "&crtType=" + crtTypeParam + "&encXecureRanData=" + encXecureRanData + "&transkeyUuid=" + mtk.transkeyUuid + "&sPort=" + sPort + "&pubKey="+ rsaPubKey +"&TK_requestToken="+TK_requestToken); } if (aRequest.readyState != 4 || aRequest.status != 200) { aCipher = ""; return aCipher; } aCipher = aRequest.responseText.replace(/\n/gi, ''); if(crtType=="pkc"){ return aRequest.responseText; } aCipherArray = aCipher.split(','); aCipher = ""; for ( var i = 0; i < aCipherArray.length - 1; i++) { if (aCipherArray[i].length == 1) { aCipher += '0'; } aCipher += aCipherArray[i]; } return aCipher; }; mTranskeyObj.prototype.setDiv = function(div){ this.div=div; this.numberDiv=div.children["mtk_"+this.id+"_number"]; this.lowerDiv=div.children["mtk_"+this.id+"_lower"]; this.upperDiv=div.children["mtk_"+this.id+"_upper"]; this.specialDiv=div.children["mtk_"+this.id+"_special"]; }; mTranskeyObj.prototype.done = function(){ }; function mTranskey(){ var startEvent; this.isiPad = navigator.userAgent.indexOf("iPad")>-1; this.isiPhone = navigator.userAgent.indexOf("iPhone")>-1; if(mtk_useTalkBack){ startEvent="onmousedown"; }else{ if ('ontouchstart' in document.documentElement) { if(navigator.userAgent.indexOf("Android 4.0")>-1){ startEvent="onmousedown"; } else{ startEvent="ontouchstart"; } } else { if(this.isiPhone||this.isiPad){ startEvent="ontouchstart"; }else{ startEvent="onmousedown"; } } } var sessionKey = [, , , , , , , , , , , , , , , ]; var genKey = new GenKey(); var useCert = "true"; var cert_pub = ""; var cert_ca = "-----BEGIN CERTIFICATE-----MIIEHjCCAwagAwIBAgIJALcMNEp1tPYgMA0GCSqGSIb3DQEBCwUAMGcxCzAJBgNVBAYTAktSMR0wGwYDVQQKExRSYW9uU2VjdXJlIENvLiwgTHRkLjEaMBgGA1UECxMRUXVhbGl0eSBBc3N1cmFuY2UxHTAbBgNVBAMTFFJhb25TZWN1cmUgQ28uLCBMdGQuMB4XDTEzMDIwNzA5MDYyNVoXDTQzMDEzMTA5MDYyNVowZzELMAkGA1UEBhMCS1IxHTAbBgNVBAoTFFJhb25TZWN1cmUgQ28uLCBMdGQuMRowGAYDVQQLExFRdWFsaXR5IEFzc3VyYW5jZTEdMBsGA1UEAxMUUmFvblNlY3VyZSBDby4sIEx0ZC4wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCqB0MsUuAi7pWVmRWaCS7kAactycMghmOM7RiMbmXyHmatXJbrtOlNrGH8Xl4fdkCJjyUE2829zQy+lTJ2O3Uo3Nn7zK3+3Um9nDQXN2tapambthOXs0aHjnRCtuLMOSPlAx06o0yHP1nOGaV7hfY9PyJjIVh9Lk/oFp5A+wsi0wiQ+INMDrm/6xZrooEY7/TLMnE4v+nr+cpIf3hSrvI1gGTykFtGCy2Le1huqaTKkE9K0CF/Sd8Kvebj6R+MhlieDXiMZXZD++pRmd4cAmGAmnGn4YdJMyh16TCccPjT60KkMv84uNVjXBvnar8ZlzRQSgIhwp1KkRiMErMbVWCnAgMBAAGjgcwwgckwHQYDVR0OBBYEFPzIDKwqK4PCklaP6Mq4YXdq8McyMIGZBgNVHSMEgZEwgY6AFPzIDKwqK4PCklaP6Mq4YXdq8McyoWukaTBnMQswCQYDVQQGEwJLUjEdMBsGA1UEChMUUmFvblNlY3VyZSBDby4sIEx0ZC4xGjAYBgNVBAsTEVF1YWxpdHkgQXNzdXJhbmNlMR0wGwYDVQQDExRSYW9uU2VjdXJlIENvLiwgTHRkLoIJALcMNEp1tPYgMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHBRlEB4nu/gHwVFRzqbFOloR7aB0xIaMDykMWtovXHUQcTmmGyYQn0bMWaGVCD7SgRh1FisfciJzLP7f8OI5f7rA2tiBZD1PBtLMU7MytGIYlV/gcfWPbnqBVsKDm15AEUqH7ZahOm7np4d5Fr87r1bj2baXQPKSNd9yjh89fl6LthWLEQRYKKwhPYAA/QkeB2RE9MftmuOXJ6MnYyyx5xEZK2ofqwrRBvDmV/PjwdCSxhloiJVFHrp8lKPCsZywJ3v9IPpudjgBQ7SWqhDcPNo2diGB2dQ252g36K1H7u3aT9Xha33MFQXTTEDzVDhaXzaGk7X6T9v25dsOyOaLAo=-----END CERTIFICATE-----"; rng = new SecureRandom(); var mKey = new Array(); for(var i=0; keyboardLayouts.length>i; i++){ mKey[keyboardLayouts[i]] = null; } this.now = null; this.fakeKey = null; this.getTextEnd=false; this.cssText = new Array(); this.cssText["qwertyMobile"] = new Array(); this.cssText["numberMobile"] = new Array(); this.transkeyUuid; this.clientWidth; this.horizontal = false; this.webkitTapHighlightColor=""; var genSessionKey = ""; if(!useSession) { var qwertyMobileSize = ""; var numberMobileSize = ""; } this.talkBackLowerText = ['1','2','3','4','5','6','7','8','9','0','q','w','e','r','t','y','u','i','o','p','a','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m']; this.talkBackUpperText = ['1','2','3','4','5','6','7','8','9','0','´ë¹®ÀÚQ','´ë¹®ÀÚW','´ë¹®ÀÚE','´ë¹®ÀÚR','´ë¹®ÀÚT','´ë¹®ÀÚY','´ë¹®ÀÚU','´ë¹®ÀÚI','´ë¹®ÀÚO','´ë¹®ÀÚP','´ë¹®ÀÚA','´ë¹®ÀÚS','´ë¹®ÀÚD','´ë¹®ÀÚF','´ë¹®ÀÚG','´ë¹®ÀÚH','´ë¹®ÀÚJ','´ë¹®ÀÚK','´ë¹®ÀÚL','´ë¹®ÀÚZ','´ë¹®ÀÚX','´ë¹®ÀÚC','´ë¹®ÀÚV','´ë¹®ÀÚB','´ë¹®ÀÚN','´ë¹®ÀÚM']; this.talkBackSpecialText = ['¾î±Ý±âÈ£','¹°°áÇ¥½Ã','´À³¦Ç¥','°ñ¹ðÀÌ','¿ì¹°Á¤','´Þ·¯±âÈ£','ÆÛ¼¾Æ®','²©¼è','¿¥ÆÛ»÷µå','º°Ç¥','¿ÞÂÊ°ýÈ£','¿À¸¥ÂÊ°ýÈ£','»©±â','¹ØÁÙ','µîÈ£','´õÇϱâ','¿ÞÂÊ´ë°ýÈ£','¿ÞÂÊÁß°ýÈ£','¿À¸¥ÂÊ´ë°ýÈ£','¿À¸¥ÂÊÁß°ýÈ£','¿ª½½·¡½Ã','¼öÁ÷¸·´ë','¼¼¹ÌÄÝ·Ð','ÄÝ·Ð','½½·¡½Ã','¹°À½Ç¥','½°Ç¥','¿ÞÂʲ©¼è°ýÈ£','¸¶Ä§Ç¥','¿À¸¥Âʲ©¼è°ýÈ£','ÀÛÀºµû¿ÈÇ¥','µû¿ÈÇ¥','´õÇϱâ','»©±â','º°Ç¥','½½·¡½Ã']; this.talkBackNumberText = ['1','2','3','4','5','6','7','8','9','0']; this.getPKey = function(){ var pKey = _x509_getPublicKeyHexArrayFromCertPEM(cert_pub); var PKey = new Array(); PKey["n"] = pKey[0]; PKey["k"] = 256; // length of n in bytes PKey["e"] = pKey[1]; return PKey; }; this.getCertPublicKey = function(){ return encodeURIComponent(this.crtPublicKey); }; this.getPublicKey = function(url){ var operation = "getPublicKey"; var request = new XMLHttpRequest(); request.open("POST", url, false); if(useCORS) request.withCredentials = true; request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); request.onreadystatechange = function(){ if (request.readyState == 4 && request.status == 200) { if (request.responseText) { cert_pub = request.responseText; mtk.generateSessionKey(transkey_surl); } } }; try { request.send("op=" + operation +"&TK_requestToken="+TK_requestToken+tk_origin); } catch(e) { alert("TransKey error: Cannot load TransKey. Network is not available."); return false; } }; this.generateSessionKey = function(url) { if(genSessionKey.length>0) return true; var vCA = verifyCA(); if( vCA == false || vCA =="expired"){ if(vCA==false) alert("transkey : CA °ËÁõÀÌ ½ÇÆÐ ÇÏ¿´½À´Ï´Ù. ÇÁ·Î±×·¥ÀÌ Á¤»óÀÛµ¿ ÇÏÁö ¾ÊÀ» ¼ö ÀÖ½À´Ï´Ù."); return false; } var pKey = _x509_getPublicKeyHexArrayFromCertPEM(cert_pub); var n = pKey[0]; var k = 256; // length of n in bytes var e = pKey[1]; this.transkeyUuid = genKey.tk_sh1prng(); genSessionKey = genKey.GenerateKey(128); for(var i=0; i<16; i++) { sessionKey[i] = Number("0x0" + genSessionKey.charAt(i)); } var encSessionKey = mtk.phpbb_encrypt2048(genSessionKey, k, e, n); var licType = 0; if(!useSession) var operation = "getKeyInfo"; else var operation = "setSessionKey"; var request = new XMLHttpRequest(); request.open("POST", url, false); if(useCORS) request.withCredentials = true; request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); request.onreadystatechange = function(){ if (request.readyState == 4 && request.status == 200) { if(request.responseText.indexOf("LicenseError")>-1){ var errCodes = request.responseText.split("="); mtk.alert(errCodes[1]); mtk= null; return false; } if (request.responseXML) { var result = request.responseXML.firstChild; var res = null; var returns = "return ["; for(var i=0; keyboardLayouts.length>i; i++){ if(i==keyboardLayouts.length-1){ returns += keyboardLayouts[i]+","; }else{ returns += keyboardLayouts[i]+","; } } returns += "]"; for ( var i = 0; i < result.childNodes.length; i++) { var node = result.childNodes[i]; if (node.tagName == "script") { for ( var j = 0; j < node.childNodes.length; j++) { if(node.childNodes[j].nodeValue.length>10){ res = ( new Function( Key+node.childNodes[j].nodeValue.replace("//", "") +returns ) )(); licType = ( new Function( Key+node.childNodes[j].nodeValue.replace("//", "") +"return licType" ) )(); licExpiredDate = ( new Function( Key+node.childNodes[j].nodeValue.replace("//", "") +"return licExpiredDate" ) )(); if(!useSession) { qwertyMobileSize = ( new Function( Key+node.childNodes[j].nodeValue.replace("//", "") +"return qwertyMobileSize" ) )(); numberMobileSize = ( new Function( Key+node.childNodes[j].nodeValue.replace("//", "") +"return numberMobileSize" ) )(); } } } } } for(var i=0; keyboardLayouts.length>i; i++){ mKey[keyboardLayouts[i]] = res[i]; } var year = licExpiredDate.substr(0,4); var month = licExpiredDate.substr(5,2); var day = licExpiredDate.substr(8,2); licExpiredDate = "¸¸·á ³¯Â¥ : " + year + "³â" + month + "¿ù" + day + "ÀÏ"; if(licType == 1) { licenseType = "Àӽà ¶óÀ̼±½º"; } } } }; try { request.send("op=" + operation + "&key=" + encSessionKey + "&transkeyUuid=" + this.transkeyUuid+ "&useCert=" + useCert+"&TK_requestToken="+TK_requestToken+ "&mode=Mobile"+tk_origin); } catch(e) { alert("TransKey error: Cannot load TransKey. Network is not available."); return false; } }; this.resetToken = function(url){ var request = new XMLHttpRequest(); if(useCORS) request.withCredentials = true; request.open("GET", url+"?op=getToken&"+new Date().getTime()+tk_origin, false); request.onreadystatechange = function(){ if (request.readyState == 4 && request.status == 200) { TK_requestToken = request.responseText.split("=")[1]; TK_requestToken = TK_requestToken.replace(";",""); mtk.resetSessionKey(transkey_surl); } }; try { request.send(); } catch(e) { alert("TransKey error: Cannot load TransKey. Network is not available."); return false; } } this.resetSessionKey = function(url){ if( verifyCA() == false ){ alert("CA °ËÁõÀÌ ½ÇÆÐ ÇÏ¿´½À´Ï´Ù. ÇÁ·Î±×·¥ÀÌ Á¤»óÀÛµ¿ ÇÏÁö ¾ÊÀ» ¼ö ÀÖ½À´Ï´Ù."); return false; } var pKey = _x509_getPublicKeyHexArrayFromCertPEM(cert_pub); var n = pKey[0]; var k = 256; // length of n in bytes var e = pKey[1]; var encSessionKey = mtk.phpbb_encrypt2048(genSessionKey, k, e, n); var operation = "setSessionKey"; var request = new XMLHttpRequest(); if(useCORS) request.withCredentials = true; request.open("POST", url, false); request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); request.onreadystatechange = function(){ if (request.readyState == 4 && request.status == 200) { if(request.responseText.indexOf("LicenseError")>-1){ var errCodes = request.responseText.split("="); mtk.alert(errCodes[1]); mtk= null; return false; } } }; try { request.send("op=" + operation + "&key=" + encSessionKey + "&transkeyUuid=" + this.transkeyUuid+ "&useCert=" + useCert+"&TK_requestToken="+TK_requestToken+ "&mode=Mobile"+tk_origin); } catch(e) { alert("TransKey error: Cannot load TransKey. Network is not available."); return false; } }; this.inputFillEncData = function(input){ var tkObj = transkey[input.id]; var hidden = tkObj.hidden.value; var hmac = ""; var maxSize = input.value.length+genKey.tk_getrnd_int()%10; var geo = "d 0 0"; for(var j=input.value.length; j