diff --git a/Code/智慧营区/DOCManageAPP(阿克苏)/3DVisualization/js/init.js b/Code/智慧营区/DOCManageAPP(阿克苏)/3DVisualization/js/init.js index 71a472f..967d6af 100644 --- a/Code/智慧营区/DOCManageAPP(阿克苏)/3DVisualization/js/init.js +++ b/Code/智慧营区/DOCManageAPP(阿克苏)/3DVisualization/js/init.js @@ -1,5 +1,5 @@ -var _interfaceDocUrl="http://xzcamp.xfzn365.com/",//其他接口 +var _interfaceDocUrl="",//其他接口 _interfaceMhUrl="",//摄像头 _interfaceImgUrl = "",//图片前缀 _interfaceDjUrl = "/political";//党建接口 diff --git a/Code/智慧营区/DOCManageAPP(阿克苏)/3DVisualization/subitem/js/patrols.js b/Code/智慧营区/DOCManageAPP(阿克苏)/3DVisualization/subitem/js/patrols.js index dc513f6..44c5af9 100644 --- a/Code/智慧营区/DOCManageAPP(阿克苏)/3DVisualization/subitem/js/patrols.js +++ b/Code/智慧营区/DOCManageAPP(阿克苏)/3DVisualization/subitem/js/patrols.js @@ -39,7 +39,7 @@ var getData = { if(obj.EMP_PHOTO == null || obj.EMP_PHOTO == "") { picHtml += '
  • '; } else { - picHtml += '
  • '; + picHtml += '
  • '; } if(index == 0) { diff --git a/Code/智慧营区/DOCManageAPP(阿克苏)/DocManageAPP.csproj b/Code/智慧营区/DOCManageAPP(阿克苏)/DocManageAPP.csproj index f0f633e..8070d6d 100644 --- a/Code/智慧营区/DOCManageAPP(阿克苏)/DocManageAPP.csproj +++ b/Code/智慧营区/DOCManageAPP(阿克苏)/DocManageAPP.csproj @@ -2070,7 +2070,7 @@ - + @@ -4280,6 +4280,7 @@ + @@ -4652,6 +4653,7 @@ + @@ -6166,6 +6168,9 @@ SysUpdPartyEmpPhotoHandler.ashx + + SysUsersUkeyHandler.ashx + TblCameraGroupHandler.ashx @@ -6370,10 +6375,9 @@ FormDesigner.aspx - + Global.asax - - + diff --git a/Code/智慧营区/DOCManageAPP(阿克苏)/UISysManage/Emp/OrgEmpList.js b/Code/智慧营区/DOCManageAPP(阿克苏)/UISysManage/Emp/OrgEmpList.js index ee6f9b0..b9a017f 100644 --- a/Code/智慧营区/DOCManageAPP(阿克苏)/UISysManage/Emp/OrgEmpList.js +++ b/Code/智慧营区/DOCManageAPP(阿克苏)/UISysManage/Emp/OrgEmpList.js @@ -302,6 +302,7 @@ layui.config({ var retHtml = ""; retHtml += ''; retHtml += ''; + retHtml += ''; //判断是否允许同步ICC if (userInfo.IS_SYNC_ICC == "1") { @@ -722,6 +723,37 @@ layui.config({ }) } + function ukeyBinding(edit) { + var clientWidth = parseInt(document.body.clientWidth * 0.3) + 'px'; + var clientHeight = parseInt(document.body.clientHeight * 0.4) + 'px'; + var content = "UkeyBinDing.html"; + content += "?empid=" + edit.ID + "&userUid=" + edit.USERS_UID + "&OrgID=" + edit.ORG_ID; + + var index = layui.layer.open({ + title: "ukey绑定", + type: 2, + area: [clientWidth, clientHeight], + shadeClose: true, + shade: false, + maxmin: false, + content: content, + success: function (layero, index) { + var body = layui.layer.getChildFrame('body', index); + console.log(edit); + body.find("#empId").val(edit.ID); + body.find("#usersUid").val(edit.USERS_UID); + body.find("#empName").val(edit.EMP_NAME); + body.find("#orgId").val(edit.ORG_ID); + form.render(); + } + }) + window.sessionStorage.setItem("index", index); + //改变窗口大小时,重置弹窗的宽高,防止超出可视区域(如F12调出debug的操作) + $(window).on("resize", function () { + layui.layer.full(window.sessionStorage.getItem("index")); + }) + } + function adjustment(data) { var clientWidth = parseInt(document.body.clientWidth * 0.7) + 'px'; var clientHeight = parseInt(document.body.clientHeight * 0.9) + 'px'; @@ -1418,6 +1450,10 @@ layui.config({ case "account": Account(data); break; + //ukey绑定(用户) + case "ukey": + ukeyBinding(data); + break; //ICC授权 case "ICCSync": //alert(data.ID); diff --git a/Code/智慧营区/DOCManageAPP(阿克苏)/UISysManage/Emp/UkeyBinDing.html b/Code/智慧营区/DOCManageAPP(阿克苏)/UISysManage/Emp/UkeyBinDing.html new file mode 100644 index 0000000..528d9e8 --- /dev/null +++ b/Code/智慧营区/DOCManageAPP(阿克苏)/UISysManage/Emp/UkeyBinDing.html @@ -0,0 +1,214 @@ + + + + + 添加--菜单管理 + + + + + + + + + + + + + + +
    + + + + + + +
    + +
    + +
    +
    + +
    +
    + +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    分钟以后可以再次登录
    +
    +
    +
    + 提交 +
    +
    + + + + + + diff --git a/Code/智慧营区/DOCManageAPP(阿克苏)/UISysManage/UKey/UKeyList.html b/Code/智慧营区/DOCManageAPP(阿克苏)/UISysManage/UKey/UKeyList.html new file mode 100644 index 0000000..1dfaaf6 --- /dev/null +++ b/Code/智慧营区/DOCManageAPP(阿克苏)/UISysManage/UKey/UKeyList.html @@ -0,0 +1,138 @@ + + + + + 设备管理--科宁智慧安全社区后台管理 + + + + + + + + + + + + + +
    +
    + +
    +
    + +
    +
    + +
    + 搜索 +
    + +
    + * 如需ukey绑定,请前往【人员管理】页面进行ukey绑定操作 +
    + +
    +
    + + + + + + + + \ No newline at end of file diff --git a/Code/智慧营区/DOCManageAPP(阿克苏)/ashx/AppHandler.ashx.cs b/Code/智慧营区/DOCManageAPP(阿克苏)/ashx/AppHandler.ashx.cs index e5f7558..544d28d 100644 --- a/Code/智慧营区/DOCManageAPP(阿克苏)/ashx/AppHandler.ashx.cs +++ b/Code/智慧营区/DOCManageAPP(阿克苏)/ashx/AppHandler.ashx.cs @@ -2435,18 +2435,19 @@ namespace FangYar.WebUI.ashx try { string id = context.Request.Params["id"]; + string state = context.Request.Params["state"]; string OPINION = context.Request.Params["OPINION"]; - string sql = " update tbl_alarmdata set state='1',OPINION='"+ OPINION + "' where id='" + id + "' "; + string sql = " update tbl_alarmdata set state='"+ state + "',OPINION='"+ OPINION + "' where id='" + id + "' "; var n1 = FangYar.Common.MySqlHelper.Execute(sql); if (n1 > 0) { - msg = "审批成功!"; + msg = "操作成功!"; code = 1; } else { - msg = "审批失败!"; + msg = "操作失败!"; } } catch(Exception e) @@ -2568,18 +2569,19 @@ namespace FangYar.WebUI.ashx try { string id = context.Request.Params["id"]; + string state = context.Request.Params["state"]; string OPINION = context.Request.Params["OPINION"]; - string sql = " update tbl_alarmdata set state='1',OPINION='"+ OPINION + "' where id='" + id + "' "; + string sql = " update tbl_alarmdata set state='"+ state + "',OPINION='"+ OPINION + "' where id='" + id + "' "; var n1 = FangYar.Common.MySqlHelper.Execute(sql); if (n1 > 0) { - msg = "审批成功!"; + msg = "操作成功!"; code = 1; } else { - msg = "审批失败!"; + msg = "操作失败!"; } } catch(Exception e) diff --git a/Code/智慧营区/DOCManageAPP(阿克苏)/ashx/SysUsersUkeyHandler.ashx b/Code/智慧营区/DOCManageAPP(阿克苏)/ashx/SysUsersUkeyHandler.ashx new file mode 100644 index 0000000..43302a0 --- /dev/null +++ b/Code/智慧营区/DOCManageAPP(阿克苏)/ashx/SysUsersUkeyHandler.ashx @@ -0,0 +1 @@ +<%@ WebHandler Language="C#" CodeBehind="SysUsersUkeyHandler.ashx.cs" Class="FangYar.WebUI.ashx.SysUsersUkeyHandler" %> diff --git a/Code/智慧营区/DOCManageAPP(阿克苏)/ashx/SysUsersUkeyHandler.ashx.cs b/Code/智慧营区/DOCManageAPP(阿克苏)/ashx/SysUsersUkeyHandler.ashx.cs new file mode 100644 index 0000000..b3e9441 --- /dev/null +++ b/Code/智慧营区/DOCManageAPP(阿克苏)/ashx/SysUsersUkeyHandler.ashx.cs @@ -0,0 +1,356 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Data; + +namespace FangYar.WebUI.ashx +{ + /// + /// SysUsersRulesHandler 的摘要说明 + /// + public class SysUsersUkeyHandler : IHttpHandler + { + private FangYar.BLL.TBL.SysUSerRulesBLL bll = new BLL.TBL.SysUSerRulesBLL(); + public void ProcessRequest(HttpContext context) + { + + // 记录操作日志 + BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Other, "用户Ukey绑定操作请求", ""); + + context.Response.ContentType = "text/json"; + string action = context.Request.Params["Action"]; + string returnstr = ""; + switch (action) + { + case "List": + returnstr = GetModelList(context); + break; + case "Add": + returnstr = AddModel(context); + break; + case "Edit": + returnstr = EditModel(context); + break; + case "ForceEdit": + returnstr = ForceEditModel(context); + break; + case "Del": + returnstr = DelModel(context); + break; + case "getUserUkey": + returnstr = getUserUkey(context); + break; + } + context.Response.Write(returnstr); + + } + //查询 + private string GetModelList(HttpContext context) + { + string returnstr = ""; + try + { + string ukey = context.Request.Params["ukey"]; + string empName = context.Request.Params["empName"]; + string limit = context.Request.Params["limit"]; + string page = context.Request.Params["page"]; + int pageIndex = 1; + int pageSize = 10; + if (!string.IsNullOrEmpty(limit)) { pageIndex = int.Parse(page); } + if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); } + string where = null; + if (!string.IsNullOrEmpty(ukey)) + { + where = "u.ukey like '%" + ukey + "%'"; + } + if (!string.IsNullOrEmpty(empName)) + { + if (where != null) + { + where += " and "; + } + where += "u.emp_name like '%" + empName + "%' "; + } + returnstr = "{\"code\":0,\"data\":"; + + int startnum = (pageIndex - 1) * pageSize; + string sql = "select u.*,(select org_name from fire_org o where o.org_id = u.org_id) as org_name from tbl_sys_emp_ukey u "; + if (where != null && where != "") + { + sql += " where " + where; + } + sql += " order by u.updatetime desc"; + startnum = startnum < 0 ? 0 : startnum; + sql += " limit " + startnum + ", " + pageSize; + DataTable dt = FangYar.Common.MySqlHelper.QueryTable(sql); + if (dt.Rows.Count > 0) + { + returnstr += FangYar.Common.JsonHelper.ToJson(dt); + } + else + { + returnstr += "[]"; + } + returnstr += "}"; + } + catch (Exception e) + { + returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}"; + } + // 记录操作日志 + BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "用户ukey操作请求", "查询"); + return returnstr; + + } + // 添加 + private string AddModel(HttpContext context) + { + string returnstr = ""; + int code = -1; + string msg = ""; + try + { + string id = Guid.NewGuid().ToString("N"); + string empId = context.Request.Params["empId"]; + string usersUid = context.Request.Params["usersUid"]; + string empName = context.Request.Params["empName"]; + string ukey = context.Request.Params["ukey"]; + string lockTime = context.Request.Params["lockTime"]; + string orgId = context.Request.Params["orgId"]; + + if (string.IsNullOrEmpty(usersUid)) + { + return "{\"code\":" + code + ",\"msg\":\"登录账户不能为空!\"}"; + } + if (string.IsNullOrEmpty(empId)) + { + return "{\"code\":" + code + ",\"msg\":\"用户ID不能为空!\"}"; + } + + string isOnlyUkeySql = "select id,emp_name from tbl_sys_emp_ukey where ukey = '" + ukey + "'"; + DataTable isOnlyUkeyDt = FangYar.Common.MySqlHelper.QueryTable(isOnlyUkeySql); + if (isOnlyUkeyDt != null && isOnlyUkeyDt.Rows.Count > 0) + { + string emp_name = isOnlyUkeyDt.Rows[0]["emp_name"].ToString(); + if (!string.IsNullOrEmpty(emp_name)) + { + string editId = isOnlyUkeyDt.Rows[0]["id"].ToString(); + return "{\"code\":-2,\"id\":\""+ editId + "\",\"msg\":\"当前ukey:" + ukey + ",已经绑定给了【" + emp_name + "】,是否替换\"}"; + } + } + + string sql = "insert into tbl_sys_emp_ukey(id,emp_id,users_uid,emp_name,ukey,lock_time,org_id) values ('" + id + "','" + empId + "','" + usersUid + "','" + empName + "','" + ukey + "','" + lockTime + "','" + orgId + "')"; + if (FangYar.Common.MySqlHelper.Execute(sql) > 0) + { + msg = "添加成功!"; + code = 1; + } + else + { + msg = "添加失败!"; + } + } + catch (Exception e) + { + msg = "添加失败!"; + // 记录操作日志 + BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用户ukey操作请求", "添加异常:" + e); + } + returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}"; + // 记录操作日志 + BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Add, "用户ukey操作请求", "添加"); + return returnstr; + + } + //修改 + private string EditModel(HttpContext context) + { + string returnstr = ""; + int code = -1; + string msg = ""; + try + { + string id = context.Request.Params["id"]; + string empId = context.Request.Params["empId"]; + string usersUid = context.Request.Params["usersUid"]; + string empName = context.Request.Params["empName"]; + string ukey = context.Request.Params["ukey"]; + string lockTime = context.Request.Params["lockTime"]; + string orgId = context.Request.Params["orgId"]; + + if (string.IsNullOrEmpty(usersUid)) + { + return "{\"code\":" + code + ",\"msg\":\"登录账户不能为空!\"}"; + } + if (string.IsNullOrEmpty(empId)) + { + return "{\"code\":" + code + ",\"msg\":\"用户ID不能为空!\"}"; + } + + string isOnlyUkeySql = "select id,emp_name from tbl_sys_emp_ukey where ukey = '" + ukey + "'"; + DataTable isOnlyUkeyDt = FangYar.Common.MySqlHelper.QueryTable(isOnlyUkeySql); + if (isOnlyUkeyDt != null && isOnlyUkeyDt.Rows.Count > 0) + { + string emp_name = isOnlyUkeyDt.Rows[0]["emp_name"].ToString(); + if (!string.IsNullOrEmpty(emp_name)) + { + string editId = isOnlyUkeyDt.Rows[0]["id"].ToString(); + return "{\"code\":-2,\"id\":\"" + editId + "\",\"msg\":\"当前ukey:" + ukey + ",已经绑定给了【"+ emp_name + "】,是否替换\"}"; + } + } + + string sql = "update tbl_sys_emp_ukey set emp_id = '" + empId+ "',users_uid = '" + usersUid + "',emp_name = '" + empName + "',ukey = '" + ukey + "',lock_time = '" + lockTime + "',org_id = '" + orgId + "' where id = '" + id + "'"; + if (FangYar.Common.MySqlHelper.Execute(sql) > 0) + { + msg = "修改成功!"; + code = 1; + } + else + { + msg = "修改失败!"; + } + } + catch (Exception e) + { + msg = "修改失败!"; + // 记录操作日志 + BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用户ukey操作请求", "修改异常:" + e); + } + returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}"; + // 记录操作日志 + BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "用户ukey操作请求", "修改"); + return returnstr; + } + //强制修改 + private string ForceEditModel(HttpContext context) + { + string returnstr = ""; + int code = -1; + string msg = ""; + try + { + string id = context.Request.Params["id"]; + string empId = context.Request.Params["empId"]; + string usersUid = context.Request.Params["usersUid"]; + string empName = context.Request.Params["empName"]; + string ukey = context.Request.Params["ukey"]; + string lockTime = context.Request.Params["lockTime"]; + string orgId = context.Request.Params["orgId"]; + + if (string.IsNullOrEmpty(usersUid)) + { + return "{\"code\":" + code + ",\"msg\":\"登录账户不能为空!\"}"; + } + if (string.IsNullOrEmpty(empId)) + { + return "{\"code\":" + code + ",\"msg\":\"用户ID不能为空!\"}"; + } + + string sql = "update tbl_sys_emp_ukey set emp_id = '" + empId + "',users_uid = '" + usersUid + "',emp_name = '" + empName + "',ukey = '" + ukey + "',lock_time = '" + lockTime + "',org_id = '" + orgId + "' where id = '" + id + "'"; + if (FangYar.Common.MySqlHelper.Execute(sql) > 0) + { + msg = "修改成功!"; + code = 1; + } + else + { + msg = "修改失败!"; + } + } + catch (Exception e) + { + msg = "修改失败!"; + // 记录操作日志 + BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用户ukey操作请求", "修改异常:" + e); + } + returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}"; + // 记录操作日志 + BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Update, "用户ukey操作请求", "修改"); + return returnstr; + } + + //删除 + private string DelModel(HttpContext context) + { + string returnstr = ""; + int code = -1; + string msg = ""; + try + { + string UIDList = context.Request.Params["UIDList"]; + UIDList = UIDList.Replace(",", "','"); + + string sql = "delete from tbl_sys_emp_ukey where ID in('" + UIDList + "')"; + try + { + if (FangYar.Common.MySqlHelper.ExecuteSql(sql) > 0) + { + msg = "删除成功!"; + code = 1; + } + else + { + msg = "删除失败!"; + } + } + catch + { + msg = "删除失败!"; + } + } + catch (Exception e) + { + msg = "删除失败!"; + // 记录操作日志 + BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用户ukey操作请求", "删除异常:" + e); + } + returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}"; + // 记录操作日志 + BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Delete, "用户ukey操作请求", "删除"); + return returnstr; + } + //获取用户ukey(根据用户登录账号) + private string getUserUkey(HttpContext context) + { + + string usersUid = context.Request.Params["usersUid"]; + + string returnstr = ""; + try + { + returnstr = "{\"code\":0,\"data\":"; + + string sql = @"SELECT * FROM tbl_sys_emp_ukey WHERE users_uid = '" + usersUid + @"'"; + + DataTable dt = FangYar.Common.MySqlHelper.QueryTable(sql); + if (dt.Rows.Count > 0) + { + returnstr += FangYar.Common.JsonHelper.ToJson(dt); + } + else + { + returnstr += "[]"; + } + returnstr += "}"; + } + catch (Exception e) + { + returnstr = "{\"code\":-1,\"msg\":\"操作失败!\",\"data\":[]}"; + // 记录操作日志 + BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "用户ukey操作请求", "获取当前用户ukey异常:" + e); + } + // 记录操作日志 + BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "用户ukey操作请求", "获取当前用户ukey"); + return returnstr; + + } + public bool IsReusable + { + get + { + return false; + } + } + } +} \ No newline at end of file diff --git a/Code/智慧营区/DOCManageAPP(阿克苏)/images/ukeyBinding.png b/Code/智慧营区/DOCManageAPP(阿克苏)/images/ukeyBinding.png new file mode 100644 index 0000000..e5cf643 Binary files /dev/null and b/Code/智慧营区/DOCManageAPP(阿克苏)/images/ukeyBinding.png differ diff --git a/Code/智慧营区/DOCManageAPP(阿克苏)/js/fiseckey.js b/Code/智慧营区/DOCManageAPP(阿克苏)/js/fiseckey.js new file mode 100644 index 0000000..acf6cec --- /dev/null +++ b/Code/智慧营区/DOCManageAPP(阿克苏)/js/fiseckey.js @@ -0,0 +1,2071 @@ +/** + * 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); + + 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; + } +} \ No newline at end of file