From 917af8fc3275be3256d1ed24f7e03a908df23e29 Mon Sep 17 00:00:00 2001 From: cheney Date: Thu, 30 Apr 2026 16:29:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=89=88=20ukey=20=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + css/styles.css | 436 ++++++++ fiseckey.js | 2073 ++++++++++++++++++++++++++++++++++++ html/appmanager.html | 351 ++++++ html/authmanager.html | 240 +++++ html/containermanager.html | 247 +++++ html/devicemanager.html | 270 +++++ html/filemanager.html | 397 +++++++ html/service.html | 1156 ++++++++++++++++++++ index.html | 90 ++ 10 files changed, 5261 insertions(+) create mode 100644 .gitignore create mode 100644 css/styles.css create mode 100644 fiseckey.js create mode 100644 html/appmanager.html create mode 100644 html/authmanager.html create mode 100644 html/containermanager.html create mode 100644 html/devicemanager.html create mode 100644 html/filemanager.html create mode 100644 html/service.html create mode 100644 index.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..62c8935 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ \ No newline at end of file diff --git a/css/styles.css b/css/styles.css new file mode 100644 index 0000000..f118a0c --- /dev/null +++ b/css/styles.css @@ -0,0 +1,436 @@ +* { + margin: 0; + box-sizing: border-box; +} + +html { + overflow-x: hidden; + background-color: #b9dad8; +} + +body { + line-height: 120%; + font-weight: 400; +} + +header{ + background: #39c5bb; + padding: 20px; + text-align: center; +} +.footer{ + height: 25%; + width: 100%; + /*position: fixed;*/ + bottom: 0px; + z-index: 9999; + background-color: #b9dad800; +} +.footconsole{ + display: block; + width:100%; + height: 100%; + border-radius: 3px; + border:2px solid rgba(203, 93, 93, 0.25); +} +.footclear{ + height: 20px; + background:#39c5bb; + color:white; + border: 1px solid #39c5bb; + border-radius: 2px; + cursor: pointer; + font-weight: 500; + font-size: 5px; + float: right; +} + +.title{ + font-size: 25px; + text-align: center; +} +.menu{ + margin-top:20px; + margin-bottom:10px; +} +.menu li{ + display: inline-block; + margin-right: 20px; +} +.menu li a{ + color:black; + text-decoration: none; + padding:3px; + font-weight: 900; +}.active { + border-bottom:3px solid black; +} + +main { + padding: 30px 50px 30px 50px; +} +.content{ + margin:15px auto; + padding:10px; + border-radius: 5px; +} +.s1 { + background-color: #41817c; + color:white; +} + +.nav-Service{ + float: left; + height: 440px; + overflow-y: auto; + width: 5%; +} +.nav-btn{ + margin: 0; + float: left; + height: 50px; + width:125%; + background:#39c5bb; + color:white; + border: 2px solid rgb(0, 0, 0, 0.2); + border-radius: 5px; + cursor: pointer; + font-weight: 900; + text-transform: uppercase; +} + +.serviceForm{ + float: right; + border: 1px solid rgb(0, 0, 0, 0.2);; + border-radius: 5px; + /* height: 440px; */ + overflow-y: auto; + width: 95%; +} +.serviceForm::-webkit-scrollbar { + width:10px; + height: 1px; +} +.serviceForm::-webkit-scrollbar-thumb { + border-radius: 10px; + box-shadow:inset 0 0 5px rgb(0, 0, 0, 0.2); + background-color: #535353; +} +.serviceForm::-webkit-scrollbar-track { + border-radius: 10px; + box-shadow:inset 0 0 5px rgb(0, 0, 0, 0.2); + background-color: #EDEDED; +} +@media screen and (max-height : 1500px) { + .serviceForm{height: 720px;} +} +@media screen and (max-height : 1000px) { + .serviceForm{height: 580px;} +} +@media screen and (max-height : 760px) { + .serviceForm{height: 440px;} +} + +.form-service { + float: left; + height: 440px; + width: 100%; +} + +.form1 { + float: left; + border: 1px solid rgb(0, 0, 0, 0.2);; + border-radius: 5px; + height: 440px; + overflow-y: auto; + width: 100%; +} +.form1::-webkit-scrollbar { + width:10px; + height: 1px; +} +.form1::-webkit-scrollbar-thumb { + border-radius: 10px; + box-shadow:inset 0 0 5px rgb(0, 0, 0, 0.2); + background-color: #535353; +} +.form1::-webkit-scrollbar-track { + border-radius: 10px; + box-shadow:inset 0 0 5px rgb(0, 0, 0, 0.2); + background-color: #EDEDED; +} +.checkarea{ + display: table; +} +.form-group { + margin:10px auto; + margin-top: 0px; + border-radius: 5px; + width: 85%; + background-color: rgb(100, 71, 155); + color:white; +} + +input[type='date'], +input[type='email']{ + display: block; + padding:8px; + width:80%; + border-radius: 3px; + border:2px solid rgba(203, 93, 93, 0.25); + margin-top:3px; +} +input[type='password'] { + padding:8px; + float: left; + width:95%; + border-radius: 3px; + border:2px solid rgba(203, 93, 93, 0.25); + margin-top:3px; + margin-left: 10px; + margin-right: 10px; +} +input[type='text'] { + padding:8px; + float: left; + width:95%; + border-radius: 3px; + border:2px solid rgba(203, 93, 93, 0.25); + margin-top:3px; + margin-left: 10px; + margin-right: 10px; +} +input[type='text1'] { + padding:8px; + float: left; + width:30%; + border-radius: 3px; + border:2px solid rgba(203, 93, 93, 0.25); + margin-top:3px; + margin-left: 10px; + margin-right: 10px; +} +input[type='textCon'] { + background-color: #459792; + color: #EDEDED; + font-size: medium; + font-weight: 700; + cursor:default; + padding:8px; + float: left; + width:30%; + border-radius: 3px; + border:2px solid rgba(203, 93, 93, 0.25); + margin-top:3px; + margin-left: 10px; + margin-right: 10px; +} + +textarea{ + float: right; + display: block; + padding:8px; + width:100%; + border-radius: 3px; + border:2px solid rgba(203, 93, 93, 0.25); + margin-top:3px; +} +.textarea1{ + resize:vertical; + padding:8px; + float: left; + width:95%; + border-radius: 3px; + border:2px solid rgba(203, 93, 93, 0.25); + margin-top:3px; + margin-bottom:3px; + margin-left: 10px; + margin-right: 10px; +} +select { + float: left; + display: block; + padding:8px; + width:30%; + border-radius: 3px; + border:2px solid rgba(203, 93, 93, 0.25); + margin-top:3px; + margin-left: 10px; + margin-right: 10px; +} +.select1 { + padding:8px; + float: right; + width:55%; + border-radius: 3px; + border:2px solid rgba(203, 93, 93, 0.25); + margin-top:3px; + margin-left: 10px; + margin-right: 1px; +} +.select2 { + padding:8px; + float: left; + width:75%; + border-radius: 3px; + border:2px solid rgba(203, 93, 93, 0.25); + margin-top:3px; + margin-left: 10px; + margin-right: 1px; +} + +input[type='text']:hover, +input[type='date']:hover, +input[type='email']:hover, +textarea:hover, +select:hover { + border: 2px solid rgba(203, 93, 93, 1); +} + +.btn{ + padding: 10px 25px; + background:rgb(69, 204, 69); + color:white; + border: 2px solid rgb(69, 204, 69); + border-radius: 5px; + cursor: pointer; + font-weight: 900; + text-transform: uppercase; +} + +.help-tip{ + top: 18px; + right: 18px; + text-align: center; + background-color: #696fce; + border-radius: 50%; + width: 16px; + height: 16px; + font-size: 8px; + line-height: 16px; + cursor: default; + margin: 5px; + margin-top: 12px; +} + +.help-tip:before{ + content:'?'; + font-weight: bold; + color:#fff; +} +.help-tip:hover{ + background-color: #6bb0db; +} +.help-tip:hover p{ + display:block; + transform-origin: 100% 0%; + -webkit-animation: fadeIn 0.3s ease-in-out; + animation: fadeIn 0.3s ease-in-out; + margin-top: 5px; + background-color: #666c6e; +} + +.help-tip p{ + display: none; + text-align: left; + background-color: #1E2021; + padding: 20px; + width: 300px; + position:relative; + border-radius: 3px; + box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2); + right: -4px; + color: #FFF; + font-size: 13px; + line-height: 1.4; +} + +.help-tip p:before{ + position: relative; + content: ''; + width:0; + height: 0; +} + +.help-tip p:after{ + width:100%; + height:40px; + content:''; + position: relative; + top:-40px; + left:0; +} + +.line{ + width: 80%; + float: left; + margin-top: 5px; + margin-bottom: 5px; +} +.lineleft{ + width: 13%; + float: left; +} +.lineright{ + width: 87%; + float: left; +} + +.line-help{ + width: 10%; + float: left; + margin-top: 5px; + margin-bottom: 5px; +} +.shortline{ + width: 60%; + float: left; + margin-top: 5px; + margin-bottom: 5px; +} + +label{ + display: inline-block; + vertical-align: middle; + color:black; + font-weight: 900; +} + +.labelhead{ + top: 50%; + transform: translateY(50%); + float: left; + vertical-align: middle; + color:black; + font-weight: 900; +} + +.labelService{ + float: left; + vertical-align: middle; + color:black; + font-weight: 900; +} + +.hrline{ + width: 100%; + height: 1px; + background-color: #46449b; + overflow: hidden; +} +.hrlineshort{ + width: 615px; + height: 2px; + background-color: #ffffff; + overflow: hidden; +} + +.hrlineService{ + float: left; + width: 40%; + height: 2px; + margin-top: 10px; + margin-bottom: 10px; + background-color: #1b0772; + overflow: hidden; +} diff --git a/fiseckey.js b/fiseckey.js new file mode 100644 index 0000000..d8c7609 --- /dev/null +++ b/fiseckey.js @@ -0,0 +1,2073 @@ +/** + * Description: 通用Ukey的js接口 + * Author: duanlang + * Version: V3.3.0 + * Update: 20221017 + */ + var jsversion = "3.3.0_S" +var initurl = "http://127.0.0.1:8090/do"; +var keyType = 4; +var ppid = 0;//sm3 hash时默认id +// jQuery.support.cors=true; +if (isIE()&&isSSL()) { + initurl = "https://127.0.0.1:433/do"; + //alert(initurl); +} +function isSSL() { + var url = window.location.href; + if (url.indexOf("https")!=-1) { + return true; + } + return false; +} +function isIE() { + var userAgent = navigator.userAgent; + //alert(userAgent); + var isIE = userAgent.indexOf("NET") > -1 && userAgent.indexOf("rv") > -1 ; + isIE = isIE || (userAgent.indexOf("MSIE") > -1); + return isIE; +} + +var xmlhttp; +if(window.XMLHttpRequest) +{ + xmlhttp=new XMLHttpRequest(); +} +else +{ + xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); +} +function batchHeader() { + xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8"); + if (isIE()&&isSSL()) { + xmlhttp.setRequestHeader("Access-Control-Allow-Origin","https://127.0.0.1:433"); + }else{ + xmlhttp.setRequestHeader("Access-Control-Allow-Origin","http://127.0.0.1:8090"); + } + +} + +function encodeMessage(Message) { + var data = ""; + for(var key in Message){ + // alert(key + " " +Message[key]); + data=data+key+"="+Message[key]+"&"; + } + data = data.substring(0,data.length -1); + return data; +} +function decodeMessage(Message,key) { + var data = JSON.parse(Message); + return data[key]; +} + +var SKFKEY = { + GetVersion : function() { + return jsversion; + }, + + SKF_EnumDev : function() { + var result = null; + var rawdata = { + "order":'02000004' + }; + rawdata["flag"] = arguments[0]; + if(arguments.length > 1){ + if(arguments[1] != null && arguments[1] != "") + rawdata["provider"] = arguments[1]; + } + + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"NameList"); + }else{ + throw new Error("枚举失败,rev = " + data.rev); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_ConnectDev : function() { + var result = null; + var rawdata = { + "order":'02000005' + }; + rawdata["devName"] = arguments[0]; + if(arguments.length > 1){ + if(arguments[1] != null && arguments[1] != "") + rawdata["provider"] = arguments[1]; + } + + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"hDev"); + }else{ + throw new Error("连接失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_DisConnect : function() { + var result = null; + var rawdata = { + "order":'02000006' + }; + rawdata["hDev"] = arguments[0]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("枚举失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_GetDevState : function() { + var result = null; + var rawdata = { + "order":'02000007' + }; + rawdata["devName"] = arguments[0]; + if(arguments.length > 1){ + if(arguments[1] != null && arguments[1] != "") + rawdata["provider"] = arguments[1]; + } + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"state"); + }else{ + throw new Error("枚举失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_SetLabel : function() { + var result = null; + var rawdata = { + "order":'02000008' + }; + rawdata["hDev"] = arguments[0]; + rawdata["Label"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("设置失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_GetDevInfo : function() { + var result = null; + var rawdata = { + "order":'02000009' + }; + rawdata["hDev"] = arguments[0]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"devInfo"); + }else{ + throw new Error("设置失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_LockDev : function() { + var result = null; + var rawdata = { + "order":'02000010' + }; + rawdata["hDev"] = arguments[0]; + rawdata["timeOut"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("锁定失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_UnlockDev : function() { + var result = null; + var rawdata = { + "order":'02000011' + }; + rawdata["hDev"] = arguments[0]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev");`` + }else{ + throw new Error("解锁失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_ChangeDevAuthKey : function() { + var result = null; + var rawdata = { + "order":'02000012' + }; + rawdata["hDev"] = arguments[0]; + rawdata["authKey"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("设置失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_DevAuth : function() { + var result = null; + var rawdata = { + "order":'02000013' + }; + rawdata["hDev"] = arguments[0]; + rawdata["authData"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("验证失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_ChangePIN : function() { + var result = null; + var rawdata = { + "order":'02000014' + }; + rawdata["happ"] = arguments[0]; + rawdata["pintype"] = arguments[1]; + rawdata["oldPin"] = arguments[2]; + rawdata["newPin"] = arguments[3]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("更改失败,count=" + decodeMessage(xmlhttp.responseText,"count")+",rev="+decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_GetPINInfo : function() { + var result = null; + var rawdata = { + "order":'02000015' + }; + rawdata["happ"] = arguments[0]; + rawdata["pintype"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"pininfo"); + }else{ + throw new Error("获取失败,rev=" + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_VerifyPIN : function() { + var result = null; + var rawdata = { + "order":'02000016' + }; + rawdata["happ"] = arguments[0]; + rawdata["pintype"] = arguments[1]; + rawdata["pin"] = arguments[2]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("校验失败,count=" + decodeMessage(xmlhttp.responseText,"count")+",rev="+decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_UnblockPIN : function() { + var result = null; + var rawdata = { + "order":'02000017' + }; + rawdata["happ"] = arguments[0]; + rawdata["adminpin"] = arguments[1]; + rawdata["usrpin"] = arguments[2]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("解锁失败,count=" + decodeMessage(xmlhttp.responseText,"count")+",rev="+decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_ClearSecureState : function() { + var result = null; + var rawdata = { + "order":'02000018' + }; + rawdata["happ"] = arguments[0]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("清除安全状态失败,rev=" + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + + SKF_CreateApplication : function() { + var result = null; + var rawdata = { + "order":'02000019' + }; + rawdata["hDev"] = arguments[0]; + rawdata["appname"] = arguments[1]; + rawdata["adminPin"] = arguments[2]; + rawdata["adminretry"] = arguments[3]; + rawdata["usrPin"] = arguments[4]; + rawdata["usrretry"] = arguments[5]; + rawdata["fileright"] = arguments[6]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"hApp"); + }else{ + throw new Error("创建失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_EnumApplication : function() { + var result = null; + var rawdata = { + "order":'02000020' + }; + rawdata["hDev"] = arguments[0]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"appList"); + }else{ + throw new Error("枚举失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_DeleteApplication : function() { + var result = null; + var rawdata = { + "order":'02000021' + }; + rawdata["hDev"] = arguments[0]; + rawdata["appname"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("删除失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_OpenApplication : function() { + var result = null; + var rawdata = { + "order":'02000022' + }; + rawdata["hDev"] = arguments[0]; + rawdata["appname"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"hApp"); + }else{ + throw new Error("打开失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_CloseApplication : function() { + var result = null; + var rawdata = { + "order":'02000023' + }; + rawdata["happ"] = arguments[0]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("关闭失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_CreateFile : function() { + var result = null; + var rawdata = { + "order":'02000024' + }; + rawdata["happ"] = arguments[0]; + rawdata["filename"] = arguments[1]; + rawdata["filesize"] = arguments[2]; + rawdata["readright"] = arguments[3]; + rawdata["writeright"] = arguments[4]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("创建文件失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_DeleteFile : function() { + var result = null; + var rawdata = { + "order":'02000025' + }; + rawdata["happ"] = arguments[0]; + rawdata["filename"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("删除文件失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_EnumFiles : function() { + var result = null; + var rawdata = { + "order":'02000026' + }; + rawdata["happ"] = arguments[0]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"fileList"); + }else{ + throw new Error("文件枚举失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_GetFileInfo : function() { + var result = null; + var rawdata = { + "order":'02000027' + }; + rawdata["happ"] = arguments[0]; + rawdata["filename"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"fileInfo"); + }else{ + throw new Error("获取文件信息失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_ReadFile : function() { + var result = null; + var rawdata = { + "order":'02000028' + }; + rawdata["happ"] = arguments[0]; + rawdata["filename"] = arguments[1]; + rawdata["offset"] = arguments[2]; + rawdata["size"] = arguments[3]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"outData"); + }else{ + throw new Error("读取文件数据失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_WriteFile : function() { + var result = null; + var rawdata = { + "order":'02000029' + }; + rawdata["happ"] = arguments[0]; + rawdata["filename"] = arguments[1]; + rawdata["offset"] = arguments[2]; + rawdata["size"] = arguments[3]; + rawdata["data"] = arguments[4]; + var data = encodeMessage(rawdata); + + console.log(data) + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("写入文件数据失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + return result; + }, + + SKF_CreateContainer : function() { + var result = null; + var rawdata = { + "order":'02000030' + }; + rawdata["happ"] = arguments[0]; + rawdata["conName"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"hCon"); + }else{ + throw new Error("创建容器失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + return result; + }, + + SKF_DeleteContainer : function() { + var result = null; + var rawdata = { + "order":'02000031' + }; + rawdata["happ"] = arguments[0]; + rawdata["conName"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("删除容器失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + return result; + }, + + SKF_OpenContainer : function() { + var result = null; + var rawdata = { + "order":'02000032' + }; + rawdata["happ"] = arguments[0]; + rawdata["conName"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"hCon"); + }else{ + throw new Error("打开容器失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + return result; + }, + + SKF_CloseContainer : function() { + var result = null; + var rawdata = { + "order":'02000033' + }; + rawdata["hCon"] = arguments[0]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("关闭容器失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + return result; + }, + + SKF_EnumContainer : function() { + var result = null; + var rawdata = { + "order":'02000034' + }; + rawdata["happ"] = arguments[0]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"conList"); + }else{ + throw new Error("枚举容器失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + return result; + }, + + SKF_GetContainerType : function() { + var result = null; + var rawdata = { + "order":'02000035' + }; + rawdata["hCon"] = arguments[0]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"conType"); + }else{ + throw new Error("获取容器类型失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + return result; + }, + + SKF_ImportCertificate : function() { + var result = null; + var rawdata = { + "order":'02000036' + }; + rawdata["hCon"] = arguments[0]; + rawdata["flag"] = arguments[1]; + rawdata["cert"] = arguments[2]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("导入证书失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + return result; + }, + + SKF_ExportCertificate : function() { + var result = null; + var rawdata = { + "order":'02000037' + }; + rawdata["hCon"] = arguments[0]; + rawdata["flag"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"outData"); + }else{ + throw new Error("导出证书失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + return result; + }, + + SKF_GenRandom : function(hDev, len) { + var result = null; + var rawdata = { + "order":'02000038' + }; + rawdata["hDev"] = arguments[0]; + rawdata["randomLen"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"ranData"); + }else{ + throw new Error("生成失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_GenExtRSAKey : function() { + var result = null; + var rawdata = { + "order":'02000039' + }; + rawdata["hDev"] = arguments[0]; + rawdata["bitsLen"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"priKey"); + }else{ + throw new Error("生成失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_GenRSAKeyPair : function() { + var result = null; + var rawdata = { + "order":'02000040' + }; + rawdata["hCon"] = arguments[0]; + rawdata["bitsLen"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"pubKey"); + }else{ + throw new Error("生成失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_ImportRSAKeyPair : function() { + var result = null; + var rawdata = { + "order":'02000041' + }; + rawdata["hCon"] = arguments[0]; + rawdata["SymAlg"] = arguments[1]; + rawdata["warppedKey"] = arguments[2]; + rawdata["encryptedData"] = arguments[3]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"pubKey"); + }else{ + throw new Error("导入失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_RSASignData : function() { + var result = null; + var rawdata = { + "order":'02000042' + }; + rawdata["hCon"] = arguments[0]; + rawdata["inData"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"signData"); + }else{ + throw new Error("签名失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_RSAVerify : function() { + var result = null; + var rawdata = { + "order":'02000043' + }; + rawdata["hDev"] = arguments[0]; + rawdata["pubKey"] = arguments[1]; + rawdata["inData"] = arguments[2]; + rawdata["signData"] = arguments[3]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("验签失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_RSAExportSessionKey : function() { + var result = null; + var rawdata = { + "order":'02000044' + }; + rawdata["hCon"] = arguments[0]; + rawdata["alg"] = arguments[1]; + rawdata["pubkey"] = arguments[2]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"data"); + }else{ + throw new Error("生成会话密钥失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_ExtRSAPubKeyOperation : function() { + var result = null; + var rawdata = { + "order":'02000045' + }; + rawdata["hDev"] = arguments[0]; + rawdata["pubKey"] = arguments[1]; + rawdata["inData"] = arguments[2]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"outData"); + }else{ + throw new Error("公钥运算失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_ExtRSAPriKeyOperation : function() { + var result = null; + var rawdata = { + "order":'02000046' + }; + rawdata["hDev"] = arguments[0]; + rawdata["priKey"] = arguments[1]; + rawdata["inData"] = arguments[2]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"outData"); + }else{ + throw new Error("私钥运算失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_GenECCKeyPair : function() { + var result = null; + var rawdata = { + "order":'02000048' + }; + rawdata["hCon"] = arguments[0]; + rawdata["alg"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"pubKey"); + }else{ + throw new Error("生成失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_GenExtECCKey : function() {//暂不支持 + var result = null; + var rawdata = { + "order":'02000049' + }; + rawdata["hCon"] = arguments[0]; + rawdata["alg"] = arguments[1]; + var data = encodeMessage(rawdata); + + // xmlhttp.open("post",initurl,false); + // xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8"); + // xmlhttp.send(data); + + // if(xmlhttp.status==200){ + // if(decodeMessage(xmlhttp.responseText,"rev")==0){ + // result = decodeMessage(xmlhttp.responseText,"pubKey"); + // }else{ + // throw new Error("生成失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + // } + // } + // else{ + // throw new Error("http 失败,http status = " + xmlhttp.status); + // } + + return result; + }, + + SKF_ImportECCKeyPair : function() { + var result = null; + var rawdata = { + "order":'02000050' + }; + rawdata["hCon"] = arguments[0]; + rawdata["envelopedKey"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("导入失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_ECCSignData : function() { + var result = null; + var rawdata = { + "order":'02000051' + }; + rawdata["hCon"] = arguments[0]; + rawdata["inData"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"signData"); + }else{ + throw new Error("签名失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_ECCVerify : function() { + var result = null; + var rawdata = { + "order":'02000052' + }; + rawdata["hCon"] = arguments[0]; + rawdata["pubKey"] = arguments[1]; + rawdata["inData"] = arguments[2]; + rawdata["signData"] = arguments[3]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("验签失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_ECCExportSessionKey : function() { + var result = null; + var rawdata = { + "order":'02000053' + }; + rawdata["hCon"] = arguments[0]; + rawdata["alg"] = arguments[1]; + rawdata["pubKey"] = arguments[2]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"data"); + }else{ + throw new Error("导出会话密钥失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_ExtECCEncrypt : function() { + var result = null; + var rawdata = { + "order":'02000054' + }; + rawdata["hDev"] = arguments[0]; + rawdata["pubKey"] = arguments[1]; + rawdata["inData"] = arguments[2]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"cipher"); + }else{ + throw new Error("外部加密失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_ExtECCDecrypt : function() { + var result = null; + var rawdata = { + "order":'02000055' + }; + rawdata["hDev"] = arguments[0]; + rawdata["priKey"] = arguments[1]; + rawdata["cipher"] = arguments[2]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"outData"); + }else{ + throw new Error("外部解密失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_ExtECCSign : function() { + var result = null; + var rawdata = { + "order":'02000057' + }; + rawdata["hDev"] = arguments[0]; + rawdata["priKey"] = arguments[1]; + rawdata["inData"] = arguments[2]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"signData"); + }else{ + throw new Error("外部签名失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_ExtECCVerify : function() { + var result = null; + var rawdata = { + "order":'02000058' + }; + rawdata["hDev"] = arguments[0]; + rawdata["pubKey"] = arguments[1]; + rawdata["inData"] = arguments[2]; + rawdata["signData"] = arguments[3]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("外部签名失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_ExportPublicKey : function() { + var result = null; + var rawdata = { + "order":'02000062' + }; + rawdata["hCon"] = arguments[0]; + rawdata["signFlag"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"keyData"); + }else{ + throw new Error("导出公钥失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_ImportSessionKey : function() { + var result = null; + var rawdata = { + "order":'02000063' + }; + rawdata["hCon"] = arguments[0]; + rawdata["alg"] = arguments[1]; + rawdata["wrapedData"] = arguments[2]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"phKey"); + }else{ + throw new Error("导入会话密钥失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_SetSymmKey : function() { + var result = null; + var rawdata = { + "order":'02000064' + }; + rawdata["hDev"] = arguments[0]; + rawdata["symkey"] = arguments[1]; + rawdata["symalg"] = arguments[2]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"phKey"); + }else{ + throw new Error("设置会话密钥失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_EncryptInit : function() { + var result = null; + var rawdata = { + "order":'02000065' + }; + rawdata["hkey"] = arguments[0]; + rawdata["iv"] = arguments[1]; + rawdata["padding"] = arguments[2]; + rawdata["feedbitlen"] = arguments[3]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("初始化加密失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_Encrypt : function() { + var result = null; + var rawdata = { + "order":'02000066' + }; + rawdata["hkey"] = arguments[0]; + rawdata["data"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"encData"); + }else{ + throw new Error("加密失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_EncryptUpdate : function() { + var result = null; + var rawdata = { + "order":'02000067' + }; + rawdata["hkey"] = arguments[0]; + rawdata["data"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"encData"); + }else{ + throw new Error("多包加密失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_EncryptFinal : function() { + var result = null; + var rawdata = { + "order":'02000068' + }; + rawdata["hkey"] = arguments[0]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"encData"); + }else{ + throw new Error("结束多包加密失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_DecryptInit : function() { + var result = null; + var rawdata = { + "order":'02000069' + }; + rawdata["hkey"] = arguments[0]; + rawdata["iv"] = arguments[1]; + rawdata["padding"] = arguments[2]; + rawdata["feedbitlen"] = arguments[3]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("生成失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_Decrypt : function() { + var result = null; + var rawdata = { + "order":'02000070' + }; + rawdata["hkey"] = arguments[0]; + rawdata["data"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"decData"); + }else{ + throw new Error("加密失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_DecryptUpdate : function() { + var result = null; + var rawdata = { + "order":'02000071' + }; + rawdata["hkey"] = arguments[0]; + rawdata["data"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"decData"); + }else{ + throw new Error("多包加密失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_DecryptFinal : function() { + var result = null; + var rawdata = { + "order":'02000072' + }; + rawdata["hkey"] = arguments[0]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"decData"); + }else{ + throw new Error("结束多包加密失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_DigestInit : function() { + var result = null; + var rawdata = { + "order":'02000073' + }; + rawdata["hDev"] = arguments[0]; + rawdata["alg"] = arguments[1]; + rawdata["pubkey"] = arguments[2]; + rawdata["id"] = arguments[3]; + + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"hHash"); + }else{ + throw new Error("初始化杂凑失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_Digest : function() { + var result = null; + var rawdata = { + "order":'02000074' + }; + rawdata["hHash"] = arguments[0]; + rawdata["inData"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"hashData"); + }else{ + throw new Error("单包杂凑失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_DigestUpdate : function() { + var result = null; + var rawdata = { + "order":'02000075' + }; + rawdata["hHash"] = arguments[0]; + rawdata["inData"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("多包杂凑失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_DigestFinal : function() { + var result = null; + var rawdata = { + "order":'02000076' + }; + rawdata["hHash"] = arguments[0]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"hashData"); + }else{ + throw new Error("多包杂凑结束失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_MacInit : function() { + var result = null; + var rawdata = { + "order":'02000077' + }; + rawdata["hkey"] = arguments[0]; + rawdata["iv"] = arguments[1]; + rawdata["padding"] = arguments[2]; + rawdata["feedbitlen"] = arguments[3]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"hMac"); + }else{ + throw new Error("初始化MAC失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_Mac : function() { + var result = null; + var rawdata = { + "order":'02000078' + }; + rawdata["hMac"] = arguments[0]; + rawdata["iData"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"macData"); + }else{ + throw new Error("单包MAC失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_MacUpdate : function() { + var result = null; + var rawdata = { + "order":'02000079' + }; + rawdata["hMac"] = arguments[0]; + rawdata["iData"] = arguments[1]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("多包MAC失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_MacFinal : function() { + var result = null; + var rawdata = { + "order":'02000080' + }; + rawdata["hMac"] = arguments[0]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"macData"); + }else{ + throw new Error("多包MAC结束失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + }, + + SKF_CloseHandle : function() { + var result = null; + var rawdata = { + "order":'02000081' + }; + rawdata["hKey"] = arguments[0]; + var data = encodeMessage(rawdata); + + xmlhttp.open("post",initurl,false); + batchHeader(); + xmlhttp.send(data); + + if(xmlhttp.status==200){ + if(decodeMessage(xmlhttp.responseText,"rev")==0){ + result = decodeMessage(xmlhttp.responseText,"rev"); + }else{ + throw new Error("关闭句柄失败,rev = " + decodeMessage(xmlhttp.responseText,"rev")); + } + } + else{ + throw new Error("http 失败,http status = " + xmlhttp.status); + } + + return result; + } +} diff --git a/html/appmanager.html b/html/appmanager.html new file mode 100644 index 0000000..bd93774 --- /dev/null +++ b/html/appmanager.html @@ -0,0 +1,351 @@ + + + + + SFK测试 + + + + + + + +
+
+

+ SKF FisecKey demo +

+ +
+
+
+
+
+
+ +
+
+ +
+
+ || + +
+ + +
+
+
+ +
+
+ +
+
+
+
+

+ 应用名称:需要枚举或输入要管理的应用名 +

+
+
+
+ + || + + + || + +
+
+
+
+ +
+
+ +
+
+
+
+

+ 应用名称:需要创建或删除的应用名称 +

+
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+

+ 重试次数:Pin码最大重试次数 +

+
+
+
+
+ +
+
+ + + + + + + + +
+
+
+ +
+
+
+
+
+ + + + diff --git a/html/authmanager.html b/html/authmanager.html new file mode 100644 index 0000000..722c20d --- /dev/null +++ b/html/authmanager.html @@ -0,0 +1,240 @@ + + + + + SFK测试 + + + + + + + +
+
+

+ SKF FisecKey demo +

+ +
+
+
+
+
+
+
+
+ + +
+
+ +
+
+
+ + + || + +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+

+ 当为修改PIN码时,此框传入旧的PIN码。当为解锁PIN码时,此框传入管理员PIN码 +

+
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+ + +
+
+
+
+
+ + + + diff --git a/html/containermanager.html b/html/containermanager.html new file mode 100644 index 0000000..4b438f9 --- /dev/null +++ b/html/containermanager.html @@ -0,0 +1,247 @@ + + + + + SFK测试 + + + + + + + +
+
+

+ SKF FisecKey demo +

+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+ + || + + + || + + + +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+

+ 输入的证书数据是PEM结构 +

+
+
+
+ + +
+ +
+
+
+
+ + + + diff --git a/html/devicemanager.html b/html/devicemanager.html new file mode 100644 index 0000000..32f2f3e --- /dev/null +++ b/html/devicemanager.html @@ -0,0 +1,270 @@ + + + + + SFK测试 + + + + + + + +
+
+

+ SKF FisecKey demo +

+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+

+ 设备类型:根据不同厂商的key填入不同的厂商缩写或缩写前的序号。厂商的序号可以在配置文件里修改。 + 目前支持渔翁、龙脉、海泰、飞天、国新key。置空则枚举全部厂商设备 +
1:F-OLD、2:F-ST、3:F-3310、4:LM、5:HT、6:FT、7:GX、 +

+
+
+
+
+ +
+
+ +
+
+
+
+

+ 设备序列号:通过枚举设备获得的设备的标识,相同序列号取第一个。 +

+
+
+
+ + || + + +
+
+
+
+ +
+
+ +
+
+
+
+

+ 设备标签:设备别名,总长度需要小于32字节,中文不超过10个。 +

+
+
+
+ + + || + + || + + +
+
+
+
+
+ + + + diff --git a/html/filemanager.html b/html/filemanager.html new file mode 100644 index 0000000..d95b9ce --- /dev/null +++ b/html/filemanager.html @@ -0,0 +1,397 @@ + + + + + SFK测试 + + + + + + + +
+
+

+ SKF FisecKey demo +

+ +
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+ + + || + + +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+

+ 写入数据为原始数据的HEX串,相应的数据长度应为HEX串的一半 +

+
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+ + + + +
+
+
+
+
+ + + + diff --git a/html/service.html b/html/service.html new file mode 100644 index 0000000..2ced4fc --- /dev/null +++ b/html/service.html @@ -0,0 +1,1156 @@ + + + + + SFK测试 + + + + + + + +
+
+

+ SKF FisecKey demo +

+ +
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+ +
+
+ +
+
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+ + +
+
+
+
+ +
+
+ +
+
+
+
+

+ 对称原文/密文:此项在对称加密时输入原文,解密时输入密文 +

+
+
+
+
+ +
+
+ +
+
+
+
+

+ 对称IV:此项在对称加密模式为CBC时输入iv值,ecb时置空即可 +

+
+
+
+
+ +
+
+ +
+
+
+ + || + + || + + +
+
+
+ + || + + || + + +
+
+ + + + + + + + + + + +
+
+
+
+ + + + diff --git a/index.html b/index.html new file mode 100644 index 0000000..7681417 --- /dev/null +++ b/index.html @@ -0,0 +1,90 @@ + + + + + SFK测试 + + + + + +
+
+
+

+ SKF FisecKey demo +

+ +
+
+
+
+

+ 国标渔翁密码钥匙测试,适配版本3.1.0 +

+
+
+
+ +