This commit is contained in:
cheney
2023-01-04 10:30:35 +08:00
parent 635587335b
commit 24f6019d1b
33 changed files with 4999 additions and 136 deletions
+92 -39
View File
@@ -37,6 +37,13 @@
margin: 0.5rem 0;
}
.line span {
display: inline-block;
width: 150px;
font-size: 0.8rem;
color: var(--mainColor);
}
</style>
<link rel="stylesheet" type="text/css" href="tabs.css">
<link rel="stylesheet" type="text/css" href="layx.min.css">
@@ -56,11 +63,11 @@
</li>
<li>
<a href="#" name="tab_file">文件操作</a>
<a href="#" name="tab_file">内部信息维护</a>
</li>
<li>
<a href="#" name="tab_pin">PIN 管理</a>
<a href="#" name="tab_active">Active 程序</a>
</li>
@@ -71,12 +78,44 @@
<div class="tab tab_public">
<div class="form">
<div style="float: right; width: 500px">
<h4 style="color: var(--mainColor)">帮助</h4>
<ul>
<li>
<span style="color: var(--mainColor); ">清空</span>
<p>仅清空 3 个输入框。</p>
</li>
<li>
<span style="color: var(--mainColor); ">临存</span>
<p>将 3 个输入框的内容临时保存在本地。</p>
</li>
<li>
<span style="color: var(--mainColor); ">临取</span>
<p>将临时保存在本地的信息填入 3 个输入框。</p>
</li>
<li>
<span style="color: var(--mainColor); ">返显</span>
<p>尝试读取 IC 卡内部信息。IC 卡内部信息错误时有可能显示乱码。</p>
</li>
<li>
<span style="color: var(--mainColor); ">发行</span>
<p>将发行信息写入 IC 卡。</p>
</li>
</ul>
</div>
<div class="form" style="padding-top: 2rem">
<input id="manufactor" style="width: 300px; height: 1.06rem" type="text" value="" maxlength="8"
placeholder="厂家标记(长度 8)">
<input id="system" style="width: 300px; height: 1.06rem" type="text" value="" maxlength="8" placeholder="系统信息(长度 8)">
<input id="customer" style="width: 300px; height: 1.06rem" type="text" value="" maxlength="16" placeholder="客户信息(长度 16)">
<input id="manufactor" style="width: 300px; height: 1.06rem" type="text" value=""
placeholder="厂家标记">
<input id="system" style="width: 300px; height: 1.06rem" type="text" value="" placeholder="系统信息">
<input id="customer" style="width: 300px; height: 1.06rem" type="text" value="" placeholder="客户信息">
</div>
@@ -89,50 +128,64 @@
<button id="btn_nameplate_release" style="margin-right: 1rem">发&emsp;&emsp;行</button>
</div>
<div class="tab tab_file">
<div style="float: right; width: 500px">
<h4 style="color: var(--mainColor)">帮助</h4>
<p>本页所有值都是 HEX</p>
</div>
<input id="path" style="width: 300px; height: 1.06rem" type="text" value="\root\mana"
placeholder="文件目录">
<button id="btn_list_path" style="margin-right: 1rem">枚&emsp;&emsp;举</button>
<div style="height: 1rem"></div>
<textarea id="ta_files" style="display: block; margin: 1rem 0; width: 375px; height: 100px;"
readonly></textarea>
<div class="line">
<span>IC卡属主 (20h+1)</span>
<input id="path" style="width: 300px; height: 1.06rem" type="text" value="\root\mana"
placeholder="文件目录">
</div>
<div class="line">
<span>特征字串 (30h+16)</span>
<input id="path" style="width: 300px; height: 1.06rem" type="text" value="\root\mana"
placeholder="文件目录">
</div>
<div class="line">
<span>主密钥分量 (40h+5)</span>
<input id="path" style="width: 300px; height: 1.06rem" type="text" value="\root\mana"
placeholder="文件目录">
</div>
<div class="line">
<span>LMK0 (50h+16)</span>
<input id="path" style="width: 300px; height: 1.06rem" type="text" value="\root\mana"
placeholder="文件目录">
</div>
<div class="line">
<span>LMK分量 (100h)</span>
<textarea id="ta_txt" style="display: block; margin: 1rem 0; width: 460px; height: 100px;"
readonly></textarea>
</div>
<input id="filepath" style="width: 300px; height: 1.06rem" type="text" value="\root\mana\name"
maxlength="6" placeholder="文件">
<button id="btn_read" style="margin-right: 0.5rem">读</button>
<button id="btn_write" style="margin-right: 1rem">写</button>
<textarea id="ta_txt" style="display: block; margin: 1rem 0; width: 375px; height: 100px;"
readonly></textarea>
<button>读取所有</button>
<button>写入所有</button>
</div>
<div class="tab tab_pin">
<div class="group" style="width: 100%; ">
<input id="pwd2" style="width: 300px;height: 1.06rem" type="password" maxlength="8"
placeholder="口令,8 个数字">
<button id="login2" style="margin-right: 1rem">授&emsp;&emsp;权</button>
<button id="login_def2" style="margin-right: 1rem">默认口令</button>
</div>
<div class="tab tab_active" style="padding-top: 1rem">
<div class="form group">
<input id="old_pwd" style="width: 360px;height: 1.06rem" type="password" maxlength="8"
placeholder="旧口令,8 个数字">
<input id="new_pwd1" style="width: 360px;height: 1.06rem" type="password" maxlength="8"
placeholder="新口令,8 个数字">
<input id="new_pwd2" style="width: 360px;height: 1.06rem" type="password" maxlength="8"
placeholder="重复新口令,8 个数字">
<button id="update1" style="margin-right: 1rem">修改操作员 PIN</button>
<button id="update2" style="margin-right: 1rem">修改管理员 PIN</button>
<button id="reset" style="margin-right: 1rem">解锁操作员 PIN</button>
</div>
<ul>
<li>
<h4 style="color: var(--mainColor);">V1.0 <span style="font-size: 0.5rem; font-weight: normal; cursor: pointer">(点击下载)</span> </h4>
<p>【2022年12月22日】</p>
<p>第一个发行版本</p>
</li>
</ul>
</div>
Binary file not shown.
+59 -9
View File
@@ -76,6 +76,10 @@
<a href="#" name="tab_pin">PIN 管理</a>
</li>
<li>
<a href="#" name="tab_active">驱动程序</a>
</li>
</ul>
@@ -116,12 +120,13 @@
<input id="filepath" style="width: 300px; height: 1.06rem" type="text" value="\root\mana\name"
maxlength="6" placeholder="文件">
placeholder="文件">
<button id="btn_read" style="margin-right: 0.5rem">读</button>
<button id="btn_write" style="margin-right: 1rem">写</button>
<button id="btn_delete" style="margin-right: 1rem">删</button>
<textarea id="ta_txt" style="display: block; margin: 1rem 0; width: 375px; height: 100px;"
readonly></textarea>
></textarea>
</div>
@@ -149,6 +154,17 @@
</div>
<div class="tab tab_active" style="padding-top: 1rem">
<ul>
<li>
<h4 style="color: var(--mainColor);"><span>【2023年01月01日】</span> V1.0.1 <a href="./Setup_V1.0.1.exe" style="text-decoration:none; font-size: 0.5rem; font-weight: normal; cursor: pointer">(点击下载)</a> </h4>
<p>渔翁 UKey</p>
</li>
</ul>
</div>
</div>
</div>
@@ -256,17 +272,51 @@
})
$("#btn_read").click(function () {
try {
var filepath = $("#filepath").val()
var idx = filepath.lastIndexOf("\\")
var folder = filepath.substr(0, idx)
var file = filepath.substr(idx + 1)
var txt = window.UKey.readFile(folder, file);
txt = JSON.stringify(txt, null, 4)
var filepath = $("#filepath").val()
var idx = filepath.lastIndexOf("\\")
var folder = filepath.substr(0, idx)
var file = filepath.substr(idx + 1)
var txt = window.UKey.readFile(folder, file);
$("#ta_txt").text(JSON.stringify(txt, null, 4))
$("#ta_txt").val( txt )
success("读取成功")
} catch (e) {
alert("读取失败:" + e.message)
}
})
$("#btn_write").click(function () {
alert("暂不开放")
// alert("暂不开放")
try {
var filepath = $("#filepath").val()
var idx = filepath.lastIndexOf("\\")
var folder = filepath.substr(0, idx)
var file = filepath.substr(idx + 1)
var txt = $("#ta_txt").val();
window.UKey.de(folder, file, txt);
success("写入成功")
} catch (e) {
alert("写入失败:" + e.message)
}
})
$("#btn_delete").click(function () {
// alert("暂不开放")
try {
var filepath = $("#filepath").val()
var idx = filepath.lastIndexOf("\\")
var folder = filepath.substr(0, idx)
var file = filepath.substr(idx + 1)
window.UKey.deleteFile(folder, file);
success("删除成功")
} catch (e) {
alert("删除失败:" + e.message)
}
})
$("#btn_nameplate_tmp_load").click(function () {
+33 -10
View File
@@ -1,6 +1,6 @@
(function( root ){
var DIR = DIRR
var DIR = "\\root\\mana"
var FISECKEY = root.FISECKEY;
var hDevice = undefined;
@@ -12,12 +12,12 @@
function stringToHex(str){
var val = "";
for (var i = 0; i < str.length; i++) {
if (val == "")
val = str.charCodeAt(i).toString(16);
else
val += str.charCodeAt(i).toString(16);
var v = str.charCodeAt(i).toString(16);
if ( v.length < 2 ) {
v = "0" + v;
}
val += v;
}
val += ""
return val
}
@@ -88,6 +88,14 @@
}
function deleteFile(dir, file){
if ( ! hDevice ) {
throw new Error("设备未登录")
}
FISECKEY.FILE_DeleteFile(hDevice, dir, file);
}
function readFile(dir, file) {
if ( ! hDevice ) {
throw new Error("设备未登录")
@@ -102,7 +110,9 @@
var hash = FISECKEY.FILE_ReadFile(hDevice, dir, file, 2 + len, 2);
if ( sum === hash ) {
return JSON.parse(hexToString(data));
var str = hexToString(data);
console.log( "read", data )
return JSON.parse(str);
}
throw new Error("文件读取失败")
}
@@ -112,12 +122,24 @@
throw new Error("设备未登录")
}
try {
FISECKEY.FILE_DeleteFile(hDevice, dir, file);
}catch (e) {
}
FISECKEY.FILE_CreateFile(hDevice, dir, file, 2048, 0);
console.log( "write", data )
console.log( "data.length" , data.length )
data = stringToHex( data ).toUpperCase()
var len = data.length / 2
len = "0000" + len;
len = len.substr( len.length -4 );
FISECKEY.FILE_WriteFile(hDevice, DIR, "name", 0, 2, len);
FISECKEY.FILE_WriteFile(hDevice, DIR, "name", 2, data.length/2, data);
FISECKEY.FILE_WriteFile(hDevice, dir, file, 0, 2, len);
FISECKEY.FILE_WriteFile(hDevice, dir, file, 2, data.length/2, data);
// console.log( "writeFile=" + len )
// console.log( "writeFile=" + data )
@@ -125,7 +147,7 @@
var hash = sumHash(data);
// console.log( "writeFile hash=" + hash )
FISECKEY.FILE_WriteFile(hDevice, DIR, "name", 2 + (data.length/2), 2, hash);
FISECKEY.FILE_WriteFile(hDevice, dir, file, 2 + (data.length/2), 2, hash);
}
// 枚举序列号与名称
@@ -260,6 +282,7 @@
catRelease : catRelease,
readFile: readFile,
writeFile : writeFile,
deleteFile : deleteFile,
login : login,
logout : logout,
updatePin : updatePin,