陈鹏飞
4 years ago
10 changed files with 860 additions and 60 deletions
@ -0,0 +1,6 @@
|
||||
<object id="mTokenPlugin" type="application/x-mtokenplugin" width="0" height="0"> |
||||
<param value="pluginLoaded" /> |
||||
</object> |
||||
<div style="text-align: center; margin-top: 10%;"> |
||||
<countdown [config]="{leftTime: 5,format: '密钥验证失败,本页面将于s秒后关闭'}" (event)="handleEvent($event)"></countdown> |
||||
</div> |
@ -0,0 +1,3 @@
|
||||
.count-down { |
||||
font-size: 50px; |
||||
} |
@ -0,0 +1,97 @@
|
||||
import { Component, OnInit, Injectable } from '@angular/core'; |
||||
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router'; |
||||
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; |
||||
import {MTokenK1Service} from './m-token-k1.service' //引入服务
|
||||
declare var mToken : any; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
@Component({ |
||||
selector: 'app-m-token-k1', |
||||
templateUrl: './m-token-k1.component.html', |
||||
styleUrls: ['./m-token-k1.component.scss'] |
||||
}) |
||||
export class MTokenK1Component implements OnInit { |
||||
|
||||
constructor(private router: Router,public snackBar: MatSnackBar,public mTokenK1: MTokenK1Service) { } |
||||
|
||||
ngOnInit(): void { |
||||
} |
||||
|
||||
// 路由守卫
|
||||
canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean { |
||||
return this.checkKey(); |
||||
} |
||||
|
||||
K1mToken = new mToken("mTokenPlugin") |
||||
keyBase64 = '5YyX5Lqs5a6J5L+h4oCU5LqM57u06aKE5qGI57yW5Yi25bel5YW3d2Vi'; //秘钥验证base64字符
|
||||
password='12345678'; //秘钥验证用户密码
|
||||
|
||||
|
||||
|
||||
checkKey(): boolean { |
||||
this.K1mToken.LoadLibrary() |
||||
|
||||
try { //try 捕获错误
|
||||
let keyIndex = this.K1mToken.K1_mTokenFindDevice() //查找秘钥是否插入
|
||||
|
||||
if (keyIndex > 0) { //秘钥已插入
|
||||
let keyUID = this.K1mToken.K1_mTokenGetUID(keyIndex) //读取秘钥UID
|
||||
let isLogin = this.K1mToken.K1_mTokenOpen(keyUID,this.password) |
||||
|
||||
if (isLogin == 0 ) { //密码验证成功
|
||||
let keyMSG = window.atob( this.K1mToken.K1_mTokenReadUserStorage(keyUID,0,56) ) |
||||
|
||||
if (keyMSG==this.keyBase64) { //base64转码 验证
|
||||
const config = new MatSnackBarConfig(); |
||||
config.verticalPosition = 'top'; |
||||
config.duration = 3000 |
||||
this.snackBar.open('密钥验证成功','确定',config); |
||||
this.mTokenK1.startUp() //开始定时验证秘钥是否拔出
|
||||
return true |
||||
} else { //base64验证失败
|
||||
const config = new MatSnackBarConfig(); |
||||
config.verticalPosition = 'top'; |
||||
config.duration = 5000 |
||||
this.snackBar.open('密钥错误,不为本公司发放密钥','确定',config); |
||||
this.router.navigate(['/login']) |
||||
return false |
||||
} |
||||
} else { //密码验证失败
|
||||
const config = new MatSnackBarConfig(); |
||||
config.verticalPosition = 'top'; |
||||
config.duration = 5000 |
||||
this.snackBar.open('密钥密码错误,请使用初始密码','确定',config); |
||||
this.router.navigate(['/login']) |
||||
return false |
||||
} |
||||
|
||||
} else { //秘钥未插入
|
||||
const config = new MatSnackBarConfig(); |
||||
config.verticalPosition = 'top'; |
||||
config.duration = 5000 |
||||
this.snackBar.open('密钥未插入','确定',config); |
||||
this.router.navigate(['/login']) |
||||
return false |
||||
} |
||||
|
||||
} catch (error) { |
||||
const config = new MatSnackBarConfig(); |
||||
config.verticalPosition = 'top'; |
||||
config.duration = 5000 |
||||
this.snackBar.open('请检查您密钥是否插入或者驱动是否已启动','确定',config); |
||||
this.router.navigate(['/login']) |
||||
return false |
||||
} |
||||
|
||||
} //路由守卫
|
||||
|
||||
//倒计时插件关闭页面
|
||||
handleEvent (e) { |
||||
if (e.left===0) {
|
||||
window.close()
|
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,62 @@
|
||||
import { Injectable } from '@angular/core'; |
||||
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; |
||||
import { Router } from '@angular/router'; |
||||
declare var mToken : any; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class MTokenK1Service { |
||||
|
||||
constructor(public snackBar: MatSnackBar,private router: Router,) { } |
||||
|
||||
public mTokenK1Timer; //定时器查询
|
||||
K1mToken = new mToken("mTokenPlugin") |
||||
keyBase64 = '5YyX5Lqs5a6J5L+h4oCU5LqM57u06aKE5qGI57yW5Yi25bel5YW3d2Vi'; //秘钥验证base64字符
|
||||
password='12345678'; //秘钥验证用户密码
|
||||
public verificationURL = '/login' //验证url地址是否为验证页面
|
||||
public verificationURLTwo = '/register' //验证url地址是否为验证页面
|
||||
|
||||
//验证秘钥定时器
|
||||
startUp = ():void=>{ |
||||
window.clearInterval(this.mTokenK1Timer) |
||||
this.mTokenK1Timer = window.setInterval( ()=>{ |
||||
let url = this.router.url |
||||
if (url == this.verificationURL || url == this.verificationURLTwo) { |
||||
|
||||
} else { |
||||
this.K1mToken.LoadLibrary() |
||||
let keyIndex = this.K1mToken.K1_mTokenFindDevice() //查找秘钥是否插入
|
||||
|
||||
if (keyIndex < 1) { //秘钥被拔出
|
||||
this.goToEdit()
|
||||
} else if (keyIndex > 0) { //秘钥存在
|
||||
let keyUID = this.K1mToken.K1_mTokenGetUID(keyIndex) //读取秘钥UID
|
||||
let isLogin = this.K1mToken.K1_mTokenOpen(keyUID,this.password) |
||||
if (isLogin==0) { //密码验证成功
|
||||
let keyMSG = window.atob( this.K1mToken.K1_mTokenReadUserStorage(keyUID,0,56) ) |
||||
if (keyMSG!=this.keyBase64) { //base64转码 验证失败
|
||||
this.goToEdit() } |
||||
} else { //密码验证失败
|
||||
this.goToEdit()
|
||||
} |
||||
} |
||||
} |
||||
|
||||
},10000) |
||||
} |
||||
|
||||
//秘钥拔出,删除验证定时器,跳转页面
|
||||
goToEdit () { |
||||
window.clearInterval(this.mTokenK1Timer) //删除定时器
|
||||
const config = new MatSnackBarConfig(); |
||||
config.verticalPosition = 'top'; |
||||
config.duration = 5000 |
||||
this.snackBar.open('密钥已被拔出,即将跳转页面','确定',config); |
||||
let that = this |
||||
window.setTimeout(()=>{ |
||||
that.router.navigate(['/login']) |
||||
},5000) |
||||
} |
||||
|
||||
} |
@ -0,0 +1,646 @@
|
||||
|
||||
function isIe() |
||||
{ |
||||
return ("ActiveXObject" in window); |
||||
} |
||||
|
||||
function mToken(obj){ |
||||
this.obj = obj;
|
||||
|
||||
|
||||
var g_mTokenPlugin = null; |
||||
|
||||
|
||||
this.LoadLibrary = function() |
||||
{ |
||||
g_mTokenPlugin = new K1ClientPlugin();//新
|
||||
|
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return -1; |
||||
} |
||||
|
||||
return 0; |
||||
}; |
||||
|
||||
this.K1_mTokenGetVersion = function() |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenGetVersion(); |
||||
}; |
||||
|
||||
this.K1_mTokenFindDevice = function() |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return -1; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenFindDevice(); |
||||
}; |
||||
|
||||
this.K1_mTokenGetLastError = function() |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return -1; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenGetLastError(); |
||||
}; |
||||
|
||||
this.K1_mTokenGetUID = function(keyIndex) |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenGetUID(keyIndex); |
||||
}; |
||||
|
||||
this.K1_mTokenOpen = function(keyUID, keyPassword) |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return -1; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenOpen(keyUID, keyPassword, 1); |
||||
}; |
||||
|
||||
this.K1_mTokenClose = function() |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return -1; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenClose(); |
||||
}; |
||||
|
||||
this.K1_mTokenChangePwd = function(keyUID,oldPassword, newPassword) |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return -1; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenChangePwd(keyUID, 1, oldPassword, newPassword); |
||||
}; |
||||
|
||||
this.K1_mTokenSHA1WithSeed = function(keyUID, randomStr) |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenSHA1WithSeed(keyUID, randomStr); |
||||
}; |
||||
|
||||
this.K1_mTokenSHA1WithSeedMac = function(keyUID, randomStr) |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenSHA1WithSeedMac(keyUID, randomStr); |
||||
}; |
||||
|
||||
|
||||
this.K1_mTokenGenResetPwdRequest = function(keyUID, userInfo) |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return -1; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenGenResetPwdRequest(keyUID, userInfo); |
||||
}; |
||||
|
||||
this.K1_mTokenResetPassword = function(keyUID, serverResponse) |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return -1; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenResetPassword(keyUID, serverResponse); |
||||
}; |
||||
|
||||
this.K1_mTokenGenRandom = function(keyUID, randomLength) |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenGenRandom(keyUID, randomLength); |
||||
}; |
||||
|
||||
this.K1_mTokenReadSecureStorage = function(keyUID, offset, dataLength) |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenReadSecureStorage(keyUID, offset, dataLength); |
||||
}; |
||||
|
||||
this.K1_mTokenWriteSecureStorag = function(keyUID, offset, writeData) |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return -1; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenWriteSecureStorage(keyUID, offset, writeData); |
||||
}; |
||||
|
||||
this.K1_mTokenReadUserStorage = function(keyUID, offset, dataLength) |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenReadUserStorage(keyUID, offset, dataLength); |
||||
}; |
||||
|
||||
this.K1_mTokenWriteUserStorage = function(keyUID, offset, writeData) |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return -1; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenWriteUserStorage(keyUID, offset, writeData); |
||||
}; |
||||
|
||||
this.K1_mTokenGetURL = function(keyUID) |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenGetURL(keyUID); |
||||
}; |
||||
|
||||
this.K1_mTokenGetLabel = function(keyUID) |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenGetLabel(keyUID); |
||||
}; |
||||
|
||||
this.K1_mTokenGetCompanyName = function(keyUID) |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenGetCompanyName(keyUID); |
||||
}; |
||||
|
||||
this.K1_mTokenGetRemark = function(keyUID) |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenGetRemarks(keyUID); |
||||
}; |
||||
this.K1_mTokenGetOpenType = function(keyUID) |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenGetOpenType(keyUID); |
||||
};
|
||||
|
||||
this.K1_mTokenPwdRetryCount = function(keyUID) |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenPwdRetryCount(keyUID, 1); |
||||
};
|
||||
this.K1_mTokenEncrypt = function(keyUID, method, data) |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenEncrypt(keyUID, method, 1, data); |
||||
};
|
||||
this.K1_mTokenDecrypt = function(keyUID, method, data) |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenDecrypt(keyUID, method, 1, data); |
||||
};
|
||||
|
||||
this.K1_GetMacAddr = function() |
||||
{ |
||||
if(g_mTokenPlugin == null) |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
return g_mTokenPlugin.mTokenGetMacAddr(); |
||||
}; |
||||
|
||||
var _TimerErrorMessage; |
||||
var _ExpireUrl; |
||||
/******************************************************* |
||||
* |
||||
* 函数名称:K1_CheckExist() |
||||
* 功 能:检查USB Key是否存在 |
||||
* 说 明:此方法结合K1_StartCheckTimer方法可用来定时 |
||||
* 检测USB Key是否存在,不存在即返回到指定页面( |
||||
* _ExpireUrl) |
||||
* |
||||
**********************************************************/ |
||||
function K1_CheckExist() |
||||
{ |
||||
var rtn =g_mTokenPlugin.mTokenFindDevice(); |
||||
if(rtn < 1) |
||||
{ |
||||
if(_TimerErrorMessage != null) |
||||
{ |
||||
alert(_TimerErrorMessage + " Error Code: " +g_mTokenPlugin.mTokenGetLastError()); |
||||
} |
||||
if(_ExpireUrl != null) |
||||
{ |
||||
window.location = _ExpireUrl; |
||||
} |
||||
} |
||||
return rtn; |
||||
}; |
||||
/******************************************************* |
||||
* |
||||
* 函数名称:K1_StartCheckTimer() |
||||
* 功 能:定时操作方法 |
||||
* 输 入:interval:时间1000/秒;errMsg:输出的错误信息 |
||||
* logonUrl:跳转地址 |
||||
* 说 明:此方法结合CheckExist方法可用来定时检测加 |
||||
* 密Key是否存在,不存在即返回到指定页面(_ExpireUrl) |
||||
* |
||||
**********************************************************/ |
||||
this.K1_StartCheckTimer = function(interval, errMsg, logonUrl) |
||||
{ |
||||
_TimerErrorMessage = errMsg; |
||||
_ExpireUrl = logonUrl; |
||||
//定时检测
|
||||
window.setInterval(K1_CheckExist, interval); |
||||
}; |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
function K1ClientPlugin() |
||||
{ |
||||
var url = "http://127.0.0.1:51111/K1_Client"; |
||||
|
||||
var xmlhttp ; |
||||
function AjaxIO(json) { |
||||
if(xmlhttp == null) { |
||||
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
|
||||
xmlhttp = new XMLHttpRequest(); |
||||
} else {// code for IE6, IE5
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); |
||||
} |
||||
} |
||||
if("https:" == document.location.protocol) |
||||
{ |
||||
url = "https://127.0.0.1:51121/K1_Client"; |
||||
} |
||||
xmlhttp.open("POST", url, false); |
||||
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); |
||||
xmlhttp.send("json=" + json); |
||||
} |
||||
|
||||
this.mTokenGetVersion = function() |
||||
{ |
||||
var json = '{"function":"mTokenGetVersion"}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.outData; |
||||
}else{ |
||||
return ""; |
||||
} |
||||
}; |
||||
|
||||
this.mTokenFindDevice = function() |
||||
{ |
||||
var json = '{"function":"mTokenFindDevice"}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.devCount; |
||||
}else{ |
||||
return -2; |
||||
} |
||||
}; |
||||
|
||||
this.mTokenGetLastError = function() |
||||
{ |
||||
var json = '{"function":"mTokenGetLastError"}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.errorCode; |
||||
}else{ |
||||
return -2; |
||||
} |
||||
}; |
||||
|
||||
this.mTokenGetUID = function(keyIndex) |
||||
{ |
||||
var json = '{"function":"mTokenGetUID", "keyIndex":' + keyIndex + '}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.outData; |
||||
}else{ |
||||
return ""; |
||||
} |
||||
}; |
||||
|
||||
this.mTokenOpen = function(keyUID, keyPassword, type) |
||||
{ |
||||
var json = '{"function":"mTokenOpen", "keyUID":"' + keyUID + '", "passWd":"' + keyPassword + '", "passWdType":' + type + '}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.rtn; |
||||
}else{ |
||||
return 1; |
||||
} |
||||
}; |
||||
|
||||
this.mTokenClose = function() |
||||
{ |
||||
var json = '{"function":"mTokenClose"}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.rtn; |
||||
}else{ |
||||
return 1; |
||||
} |
||||
}; |
||||
|
||||
this.mTokenChangePwd = function(keyUID, type, oldPassword, newPassword) |
||||
{ |
||||
var json = '{"function":"mTokenChangePwd", "keyUID":"' + keyUID + '", "oldUpin":"' + oldPassword + '", "newUpin":"' + newPassword + '", "passWdType":' + type + '}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.rtn; |
||||
}else{ |
||||
return 1; |
||||
} |
||||
}; |
||||
|
||||
this.mTokenSHA1WithSeed = function(keyUID, randomStr) |
||||
{ |
||||
var json = '{"function":"mTokenSHA1WithSeed", "keyUID":"' + keyUID + '", "random":"' + randomStr + '"}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.outData; |
||||
}else{ |
||||
return ""; |
||||
} |
||||
}; |
||||
|
||||
this.mTokenSHA1WithSeedMac = function(keyUID, randomStr) |
||||
{ |
||||
var json = '{"function":"mTokenSHA1WithSeed", "keyUID":"' + keyUID + '", "random":"' + randomStr + '", "useMac":1}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.outData; |
||||
}else{ |
||||
return ""; |
||||
} |
||||
}; |
||||
|
||||
this.mTokenGenResetPwdRequest = function(keyUID, userInfo) |
||||
{ |
||||
var json = '{"function":"mTokenGenResetPwdRequest", "keyUID":"' + keyUID + '", "userInfo":"' + userInfo + '"}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.outData; |
||||
}else{ |
||||
return ""; |
||||
} |
||||
}; |
||||
|
||||
this.mTokenResetPassword = function(keyUID, serverResponse) |
||||
{ |
||||
var json = '{"function":"mTokenResetPassword", "keyUID":"' + keyUID + '", "response":"' + serverResponse + '"}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.rtn; |
||||
}else{ |
||||
return 1; |
||||
} |
||||
}; |
||||
|
||||
this.mTokenGenRandom = function(keyUID, randomLength) |
||||
{ |
||||
var json = '{"function":"mTokenGenRandom", "keyUID":"' + keyUID + '", "inDataLen":' + randomLength + '}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.outData; |
||||
}else{ |
||||
return ""; |
||||
} |
||||
}; |
||||
|
||||
this.mTokenReadSecureStorage = function(keyUID, offset, dataLength) |
||||
{ |
||||
var json = '{"function":"mTokenReadSecureStorage", "keyUID":"' + keyUID + '", "offset":' + offset + ', "inDataLen":' + dataLength + '}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.outData; |
||||
}else{ |
||||
return ""; |
||||
} |
||||
}; |
||||
|
||||
this.mTokenWriteSecureStorage = function(keyUID, offset, writeData) |
||||
{ |
||||
var json = '{"function":"mTokenWriteSecureStorage", "keyUID":"' + keyUID + '", "offset":' + offset + ', "inData":"' + writeData + '"}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.rtn; |
||||
}else{ |
||||
return 1; |
||||
} |
||||
}; |
||||
|
||||
this.mTokenReadUserStorage = function(keyUID, offset, dataLength) |
||||
{ |
||||
var json = '{"function":"mTokenReadUserStorage", "keyUID":"' + keyUID + '", "offset":' + offset + ', "inDataLen":' + dataLength + '}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.outData; |
||||
}else{ |
||||
return ""; |
||||
} |
||||
}; |
||||
|
||||
this.mTokenWriteUserStorage = function(keyUID, offset, writeData) |
||||
{ |
||||
var json = '{"function":"mTokenWriteUserStorage", "keyUID":"' + keyUID + '", "offset":' + offset + ', "inData":"' + writeData + '"}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.rtn; |
||||
}else{ |
||||
return 1; |
||||
} |
||||
}; |
||||
|
||||
this.mTokenGetURL = function(keyUID) |
||||
{ |
||||
var json = '{"function":"mTokenGetURL", "keyUID":"' + keyUID + '"}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.outData; |
||||
}else{ |
||||
return ""; |
||||
} |
||||
}; |
||||
|
||||
this.mTokenGetLabel = function(keyUID) |
||||
{ |
||||
var json = '{"function":"mTokenGetLabel", "keyUID":"' + keyUID + '"}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.outData; |
||||
}else{ |
||||
return ""; |
||||
} |
||||
}; |
||||
|
||||
this.mTokenGetCompanyName = function(keyUID) |
||||
{ |
||||
var json = '{"function":"mTokenGetCompanyName", "keyUID":"' + keyUID + '"}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.outData; |
||||
}else{ |
||||
return ""; |
||||
} |
||||
}; |
||||
|
||||
this.mTokenGetRemarks = function(keyUID) |
||||
{ |
||||
var json = '{"function":"mTokenGetRemarks", "keyUID":"' + keyUID + '"}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.outData; |
||||
}else{ |
||||
return ""; |
||||
} |
||||
}; |
||||
|
||||
this.mTokenGetOpenType = function(keyUID) |
||||
{ |
||||
var json = '{"function":"mTokenGetOpenType", "keyUID":"' + keyUID + '"}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.openType; |
||||
}else{ |
||||
return -1; |
||||
} |
||||
};
|
||||
|
||||
this.mTokenPwdRetryCount = function(keyUID, passwdType) |
||||
{
|
||||
var json = '{"function":"mTokenPwdRetryCount", "keyUID":"' + keyUID + '", "passWdType":' + passwdType + '}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.pwdRetryCount; |
||||
}else{ |
||||
return -1; |
||||
} |
||||
};
|
||||
|
||||
this.mTokenEncrypt = function(keyUID, method, paddingType, data) |
||||
{ |
||||
var json = '{"function":"mTokenEncrypt", "keyUID":"' + keyUID + '", "method":' + method + ', "paddingType":' + paddingType + ', "inData":"' + data + '"}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.outData; |
||||
}else{ |
||||
return ""; |
||||
} |
||||
};
|
||||
|
||||
this.mTokenDecrypt = function(keyUID, method, paddingType, data) |
||||
{ |
||||
var json = '{"function":"mTokenDecrypt", "keyUID":"' + keyUID + '", "method":' + method + ', "paddingType":' + paddingType + ', "inData":"' + data + '"}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.outData; |
||||
}else{ |
||||
return ""; |
||||
}
|
||||
};
|
||||
|
||||
this.mTokenGetMacAddr = function() |
||||
{ |
||||
var json = '{"function":"mTokenGetMacAddr"}'; |
||||
AjaxIO(json); |
||||
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
||||
var obj = eval("(" + xmlhttp.responseText + ")"); |
||||
return obj.outData; |
||||
}else{ |
||||
return ""; |
||||
}
|
||||
} |
||||
|
||||
} |
||||
|
Loading…
Reference in new issue