241 lines
10 KiB
HTML
241 lines
10 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<title>SFK测试</title>
|
|
<link rel='stylesheet' href="../css/styles.css" />
|
|
<script type="text/javascript" src="../fiseckey.js"></script>
|
|
<script language="JavaScript">
|
|
var dev = 0;
|
|
var app = 0;
|
|
var con = 0;
|
|
var conname = 0;
|
|
var flag = 0;
|
|
|
|
function PrintInfo(info) {
|
|
deviceManagerText.value = deviceManagerText.value + info + "\r\n";
|
|
document.getElementById("deviceManagerText").scrollTop = document.getElementById("deviceManagerText").scrollHeight;
|
|
}
|
|
function clearconsole() {
|
|
deviceManagerText.value = "";
|
|
document.getElementById("deviceManagerText").scrollTop = document.getElementById("deviceManagerText").scrollHeight;
|
|
}
|
|
|
|
function seturl(dev,app,con,conname) {
|
|
document.getElementById("indexhtml").href="../index.html?dev="+dev+"&app="+app+"&con="+con+"&conname="+conname;
|
|
document.getElementById("devhtml").href="./devicemanager.html?dev="+dev+"&app="+app+"&con="+con+"&conname="+conname;
|
|
document.getElementById("authhtml").href="./authmanager.html?dev="+dev+"&app="+app+"&con="+con+"&conname="+conname;
|
|
document.getElementById("apphtml").href="./appmanager.html?dev="+dev+"&app="+app+"&con="+con+"&conname="+conname;
|
|
document.getElementById("filehtml").href="./filemanager.html?dev="+dev+"&app="+app+"&con="+con+"&conname="+conname;
|
|
document.getElementById("containerhtml").href="./containermanager.html?dev="+dev+"&app="+app+"&con="+con+"&conname="+conname;
|
|
document.getElementById("servicehtml").href="./service.html?dev="+dev+"&app="+app+"&con="+con+"&conname="+conname;
|
|
flag = 1;
|
|
}
|
|
|
|
function decodeurl() {
|
|
var url = window.location.href;
|
|
var tmp = url.split('?');
|
|
var param = tmp[1].split('&');
|
|
dev = param[0].split('=')[1];
|
|
app = param[1].split('=')[1];
|
|
con = param[2].split('=')[1];
|
|
conname = param[3].split('=')[1];
|
|
}
|
|
|
|
window.onload=function() {
|
|
if(flag != 1)
|
|
decodeurl();
|
|
seturl(dev,app,con,conname);
|
|
}
|
|
|
|
function reload() {
|
|
if(flag != 1)
|
|
decodeurl();
|
|
seturl(dev,app,con,conname);
|
|
}
|
|
|
|
//function
|
|
function ChangePIN() {
|
|
try{
|
|
var pintype = authManage.pintype1.value;
|
|
var oldpin = authManage.oldpin.value;
|
|
var newpin = authManage.newpin.value;
|
|
var newpin1 = authManage.newpin1.value;
|
|
if(newpin != newpin1){
|
|
alert("两次输入的PIN码不一致")
|
|
return;
|
|
}
|
|
var result = SKFKEY.SKF_ChangePIN(app, pintype, oldpin, newpin);
|
|
if(result == 0)
|
|
PrintInfo("修改成功");
|
|
}catch (e) {
|
|
PrintInfo(e.message);
|
|
}
|
|
}
|
|
|
|
function GetPINInfo() {
|
|
try{
|
|
var pintype = authManage.pintype.value;
|
|
var result = SKFKEY.SKF_GetPINInfo(app, pintype);
|
|
PrintInfo(JSON.stringify(result));
|
|
}catch (e) {
|
|
PrintInfo(e.message);
|
|
}
|
|
}
|
|
|
|
function VerifyPIN() {
|
|
try{
|
|
var pintype = authManage.pintype.value;
|
|
var pin = authManage.verifypin.value;
|
|
var result = SKFKEY.SKF_VerifyPIN(app, pintype, pin);
|
|
if(result == 0)
|
|
PrintInfo("校验成功");
|
|
}catch (e) {
|
|
PrintInfo(e.message);
|
|
}
|
|
}
|
|
|
|
function UnblockPIN() {
|
|
try{
|
|
var pintype = authManage.pintype1.value;
|
|
var adminpin = authManage.oldpin.value;
|
|
var usrpin = authManage.newpin.value;
|
|
var newpin1 = authManage.newpin1.value;
|
|
if(usrpin != newpin1){
|
|
alert("两次输入的PIN码不一致")
|
|
return;
|
|
}
|
|
var result = SKFKEY.SKF_UnblockPIN(app, adminpin, usrpin);
|
|
if(result == 0)
|
|
PrintInfo("解锁成功");
|
|
}catch (e) {
|
|
PrintInfo(e.message);
|
|
}
|
|
}
|
|
|
|
function ClearSecureState() {
|
|
try{
|
|
var result = SKFKEY.SKF_ClearSecureState(app);
|
|
if(result == 0)
|
|
PrintInfo("清除成功");
|
|
}catch (e) {
|
|
PrintInfo(e.message);
|
|
}
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<div="root">
|
|
<header>
|
|
<div>
|
|
<h1 class="title">
|
|
SKF FisecKey demo
|
|
</h1>
|
|
<ul class="menu">
|
|
<li>
|
|
<a id = indexhtml onclick="reload()" href="../index.html?dev=0&app=0&con=0&conname=0">简介</a>
|
|
</li>
|
|
<li>
|
|
<a id = devhtml onclick="reload()" href="./devicemanager.html?dev=0&app=0&con=0&conname=0">设备管理</a>
|
|
</li>
|
|
<li>
|
|
<a id = apphtml onclick="reload()" href="./appmanager.html?dev=0&app=0&con=0&conname=0">应用管理</a>
|
|
</li>
|
|
<li>
|
|
<a id = authhtml onclick="reload()" href="./authmanager.html?dev=0&app=0&con=0&conname=0" class='active'>访问控制</a>
|
|
</li>
|
|
<li>
|
|
<a id = filehtml onclick="reload()" href="./filemanager.html?dev=0&app=0&con=0&conname=0">文件管理</a>
|
|
</li>
|
|
<li>
|
|
<a id = containerhtml onclick="reload()" href="./containermanager.html?dev=0&app=0&con=0&conname=0">容器管理</a>
|
|
</li>
|
|
<li>
|
|
<a id = servicehtml onclick="reload()" href="./service.html?dev=0&app=0&con=0&conname=0">密码服务</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</header>
|
|
<main>
|
|
<div class = "form1">
|
|
<form name = "authManage">
|
|
<div class="form-group">
|
|
<div class="line">
|
|
<div class="lineleft">
|
|
<label class="labelhead" for="verifypin">PIN</label>
|
|
<select class="select1" name="pintypeName" id="pintype">
|
|
<option value="1">操作员</option>
|
|
<option value="0">管理员</option>
|
|
</select>
|
|
</div>
|
|
<div class="lineright">
|
|
<input type="password" id="verifypin" value="12345678"/>
|
|
</div>
|
|
</div>
|
|
<div class="line">
|
|
<input class="btn" type="button" value="获取PIN码信息" onclick="GetPINInfo()" />
|
|
<input class="btn" type="button" value="校验PIN码" onclick="VerifyPIN()" />
|
|
||
|
|
<input class="btn" type="button" value="清除应用安全状态" onclick="ClearSecureState()" />
|
|
</div>
|
|
<div class="line"><div class="hrline"></div></div>
|
|
<div class="line">
|
|
<div class="lineleft">
|
|
<label class="labelhead" for="oldpin">用户类型</label>
|
|
</div>
|
|
<div class="lineright">
|
|
<select class="select" name="pintypeName1" id="pintype1">
|
|
<option value="1">操作员</option>
|
|
<option value="0">管理员</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="line">
|
|
<div class="lineleft">
|
|
<label class="labelhead" for="oldpin">旧/管理员PIN码</label>
|
|
</div>
|
|
<div class="lineright">
|
|
<input type="password" id="oldpin"/>
|
|
</div>
|
|
</div>
|
|
<div class="line-help">
|
|
<div class="help-tip">
|
|
<p>
|
|
当为修改PIN码时,此框传入旧的PIN码。当为解锁PIN码时,此框传入管理员PIN码
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<div class="line">
|
|
<div class="lineleft">
|
|
<label class="labelhead" for="newpin">新PIN码</label>
|
|
</div>
|
|
<div class="lineright">
|
|
<input type="password" id="newpin"/>
|
|
</div>
|
|
</div>
|
|
<div class="line">
|
|
<div class="lineleft">
|
|
<label class="labelhead" for="newpin1">确认新PIN码</label>
|
|
</div>
|
|
<div class="lineright">
|
|
<input type="password" id="newpin1"/>
|
|
</div>
|
|
</div>
|
|
<div class="line">
|
|
<input class="btn" type="button" value="修改PIN码" onclick="ChangePIN()" />
|
|
<input class="btn" type="button" value="解锁PIN码" onclick="UnblockPIN()" />
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
<div class="footer">
|
|
<input type="button" class="footclear" value="清空" onclick="clearconsole()" />
|
|
<textarea class="footconsole" id="deviceManagerText" rows="8"></textarea>
|
|
</div>
|
|
</body>
|
|
</html>
|