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

View File

@ -4,4 +4,5 @@
cd src cd src
hugo hugo
cd .. cd ..
xcopy swa www\swa /s /e /y
scp -r www root@n4.fullstack.club:/app/fullstack/ scp -r www root@n4.fullstack.club:/app/fullstack/

View File

@ -37,6 +37,13 @@
margin: 0.5rem 0; margin: 0.5rem 0;
} }
.line span {
display: inline-block;
width: 150px;
font-size: 0.8rem;
color: var(--mainColor);
}
</style> </style>
<link rel="stylesheet" type="text/css" href="tabs.css"> <link rel="stylesheet" type="text/css" href="tabs.css">
<link rel="stylesheet" type="text/css" href="layx.min.css"> <link rel="stylesheet" type="text/css" href="layx.min.css">
@ -56,11 +63,11 @@
</li> </li>
<li> <li>
<a href="#" name="tab_file">文件操作</a> <a href="#" name="tab_file">内部信息维护</a>
</li> </li>
<li> <li>
<a href="#" name="tab_pin">PIN 管理</a> <a href="#" name="tab_active">Active 程序</a>
</li> </li>
@ -71,12 +78,44 @@
<div class="tab tab_public"> <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> </div>
@ -89,50 +128,64 @@
<button id="btn_nameplate_release" style="margin-right: 1rem">&emsp;&emsp;</button> <button id="btn_nameplate_release" style="margin-right: 1rem">&emsp;&emsp;</button>
</div> </div>
<div class="tab tab_file"> <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" <div style="height: 1rem"></div>
placeholder="文件目录">
<button id="btn_list_path" style="margin-right: 1rem">&emsp;&emsp;</button>
<textarea id="ta_files" style="display: block; margin: 1rem 0; width: 375px; height: 100px;" <div class="line">
readonly></textarea> <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" <button>读取所有</button>
maxlength="6" placeholder="文件"> <button>写入所有</button>
<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>
</div> </div>
<div class="tab tab_pin"> <div class="tab tab_active" style="padding-top: 1rem">
<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>
<ul>
<div class="form group"> <li>
<input id="old_pwd" style="width: 360px;height: 1.06rem" type="password" maxlength="8" <h4 style="color: var(--mainColor);">V1.0 <span style="font-size: 0.5rem; font-weight: normal; cursor: pointer">(点击下载)</span> </h4>
placeholder="旧口令8 个数字"> <p>【2022年12月22日】</p>
<input id="new_pwd1" style="width: 360px;height: 1.06rem" type="password" maxlength="8" <p>第一个发行版本</p>
placeholder="新口令8 个数字"> </li>
<input id="new_pwd2" style="width: 360px;height: 1.06rem" type="password" maxlength="8" </ul>
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>
</div> </div>

BIN
swa/u/Setup_V1.0.1.exe Normal file

Binary file not shown.

View File

@ -76,6 +76,10 @@
<a href="#" name="tab_pin">PIN 管理</a> <a href="#" name="tab_pin">PIN 管理</a>
</li> </li>
<li>
<a href="#" name="tab_active">驱动程序</a>
</li>
</ul> </ul>
@ -116,12 +120,13 @@
<input id="filepath" style="width: 300px; height: 1.06rem" type="text" value="\root\mana\name" <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_read" style="margin-right: 0.5rem"></button>
<button id="btn_write" style="margin-right: 1rem"></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;" <textarea id="ta_txt" style="display: block; margin: 1rem 0; width: 375px; height: 100px;"
readonly></textarea> ></textarea>
</div> </div>
@ -149,6 +154,17 @@
</div> </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>
</div> </div>
@ -256,17 +272,51 @@
}) })
$("#btn_read").click(function () { $("#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() $("#ta_txt").val( txt )
var idx = filepath.lastIndexOf("\\") success("读取成功")
var folder = filepath.substr(0, idx) } catch (e) {
var file = filepath.substr(idx + 1) alert("读取失败:" + e.message)
var txt = window.UKey.readFile(folder, file); }
$("#ta_txt").text(JSON.stringify(txt, null, 4))
}) })
$("#btn_write").click(function () { $("#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 () { $("#btn_nameplate_tmp_load").click(function () {

View File

@ -1,6 +1,6 @@
(function( root ){ (function( root ){
var DIR = DIRR var DIR = "\\root\\mana"
var FISECKEY = root.FISECKEY; var FISECKEY = root.FISECKEY;
var hDevice = undefined; var hDevice = undefined;
@ -12,12 +12,12 @@
function stringToHex(str){ function stringToHex(str){
var val = ""; var val = "";
for (var i = 0; i < str.length; i++) { for (var i = 0; i < str.length; i++) {
if (val == "") var v = str.charCodeAt(i).toString(16);
val = str.charCodeAt(i).toString(16); if ( v.length < 2 ) {
else v = "0" + v;
val += str.charCodeAt(i).toString(16); }
val += v;
} }
val += ""
return 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) { function readFile(dir, file) {
if ( ! hDevice ) { if ( ! hDevice ) {
throw new Error("设备未登录") throw new Error("设备未登录")
@ -102,7 +110,9 @@
var hash = FISECKEY.FILE_ReadFile(hDevice, dir, file, 2 + len, 2); var hash = FISECKEY.FILE_ReadFile(hDevice, dir, file, 2 + len, 2);
if ( sum === hash ) { if ( sum === hash ) {
return JSON.parse(hexToString(data)); var str = hexToString(data);
console.log( "read", data )
return JSON.parse(str);
} }
throw new Error("文件读取失败") throw new Error("文件读取失败")
} }
@ -112,12 +122,24 @@
throw new Error("设备未登录") 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() data = stringToHex( data ).toUpperCase()
var len = data.length / 2 var len = data.length / 2
len = "0000" + len; len = "0000" + len;
len = len.substr( len.length -4 ); len = len.substr( len.length -4 );
FISECKEY.FILE_WriteFile(hDevice, DIR, "name", 0, 2, len); FISECKEY.FILE_WriteFile(hDevice, dir, file, 0, 2, len);
FISECKEY.FILE_WriteFile(hDevice, DIR, "name", 2, data.length/2, data); FISECKEY.FILE_WriteFile(hDevice, dir, file, 2, data.length/2, data);
// console.log( "writeFile=" + len ) // console.log( "writeFile=" + len )
// console.log( "writeFile=" + data ) // console.log( "writeFile=" + data )
@ -125,7 +147,7 @@
var hash = sumHash(data); var hash = sumHash(data);
// console.log( "writeFile hash=" + hash ) // 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, catRelease : catRelease,
readFile: readFile, readFile: readFile,
writeFile : writeFile, writeFile : writeFile,
deleteFile : deleteFile,
login : login, login : login,
logout : logout, logout : logout,
updatePin : updatePin, updatePin : updatePin,

View File

@ -132,7 +132,7 @@
<footer class="main-footer sticky footer-type-1 fixed"> <footer class="main-footer sticky footer-type-1 fixed">
<div class="footer-inner"> <div class="footer-inner">
<div class="footer-text"> <div class="footer-text">
<strong>本站内容源自互联网如有内容侵犯了你的权益请联系删除相关内容联系邮箱postmaster@fullstack.club <br/>© 2021 - 2022 By <a href="https://www.fullstack.club">FullStack Club</a> | <a href="http://beian.miit.gov.cn/">浙ICP备14009836号-5</a><br/></strong> <strong>本站内容源自互联网如有内容侵犯了你的权益请联系删除相关内容联系邮箱postmaster@fullstack.club <br/>© 2021 - 2023 By <a href="https://www.fullstack.club">FullStack Club</a> | <a href="http://beian.miit.gov.cn/">浙ICP备14009836号-5</a><br/></strong>
</div> </div>
<div class="go-up"> <div class="go-up">
<a href="#" rel="go-top"> <a href="#" rel="go-top">

View File

@ -70,7 +70,7 @@
<footer class="main-footer sticky footer-type-1 fixed"> <footer class="main-footer sticky footer-type-1 fixed">
<div class="footer-inner"> <div class="footer-inner">
<div class="footer-text"> <div class="footer-text">
<strong>本站内容源自互联网如有内容侵犯了你的权益请联系删除相关内容联系邮箱postmaster@fullstack.club <br/>© 2021 - 2022 By <a href="https://www.fullstack.club">FullStack Club</a> | <a href="http://beian.miit.gov.cn/">浙ICP备14009836号-5</a><br/></strong> <strong>本站内容源自互联网如有内容侵犯了你的权益请联系删除相关内容联系邮箱postmaster@fullstack.club <br/>© 2021 - 2023 By <a href="https://www.fullstack.club">FullStack Club</a> | <a href="http://beian.miit.gov.cn/">浙ICP备14009836号-5</a><br/></strong>
</div> </div>
<div class="go-up"> <div class="go-up">
<a href="#" rel="go-top"> <a href="#" rel="go-top">

View File

@ -3741,7 +3741,7 @@
</a> </a>
</div> </div>
<div class="footer-inner"> <div class="footer-inner">
<div class="footer-text">本站内容源自互联网如有内容侵犯了你的权益请联系删除相关内容联系邮箱postmaster@fullstack.club <br/>© 2021 - 2022 By <a href="https://www.fullstack.club">FullStack Club</a> | <a href="http://beian.miit.gov.cn/">浙ICP备14009836号-5</a><br/></div> <div class="footer-text">本站内容源自互联网如有内容侵犯了你的权益请联系删除相关内容联系邮箱postmaster@fullstack.club <br/>© 2021 - 2023 By <a href="https://www.fullstack.club">FullStack Club</a> | <a href="http://beian.miit.gov.cn/">浙ICP备14009836号-5</a><br/></div>
</div> </div>
</footer> </footer>
</div> </div>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/2019nCoV.iml" filepath="$PROJECT_DIR$/.idea/2019nCoV.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,196 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="379ce94e-8b54-4e06-8584-ec8f1cc09b79" name="Default Changelist" comment="" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="84">
<caret line="4" column="33" selection-start-line="4" selection-start-column="33" selection-end-line="4" selection-end-column="33" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/bkp.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2079">
<caret line="99" column="17" selection-start-line="99" selection-start-column="17" selection-end-line="99" selection-end-column="17" />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>loader</find>
<find>Controls</find>
<find>OrbitControls</find>
<find>camera</find>
<find>initStats</find>
<find>human</find>
</findStrings>
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/test1.html" />
<option value="$PROJECT_DIR$/index.html" />
</list>
</option>
</component>
<component name="MacroExpansionManager">
<option name="directoryName" value="YjjLpnxw" />
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="380" />
<option name="y" value="134" />
<option name="width" value="744" />
<option name="height" value="456" />
</component>
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="ProjectPane" />
<pane id="PackagesPane" />
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="go.gopath.indexing.explicitly.defined" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../dragonfly" />
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="C:\Users\Cheney\projects\js\2019nCoV" />
</key>
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="379ce94e-8b54-4e06-8584-ec8f1cc09b79" name="Default Changelist" comment="" />
<created>1580969553492</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1580969553492</updated>
<workItem from="1580969556504" duration="4692000" />
<workItem from="1581142261901" duration="389000" />
<workItem from="1581145978472" duration="229000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="5310000" />
</component>
<component name="ToolWindowManager">
<frame x="-6" y="-6" width="1564" height="1093" extended-state="6" />
<layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.2563081" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Designer" order="2" />
<window_info id="UI Designer" order="3" />
<window_info id="Favorites" order="4" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Version Control" order="8" />
<window_info anchor="bottom" id="Terminal" order="9" />
<window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="right" id="Palette" order="3" />
<window_info anchor="right" id="Cargo" order="4" />
<window_info anchor="right" id="Maven" order="5" />
<window_info anchor="right" id="Palette&#9;" order="6" />
<window_info anchor="right" id="SciView" order="7" />
</layout>
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/three.js">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/ColladaLoader.js">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/stats.min.js">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/SVGRenderer.js">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/OrbitControls.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-67">
<caret line="15" selection-start-line="15" selection-end-line="15" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/jquery.min.js">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="file://$PROJECT_DIR$/index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="84">
<caret line="4" column="33" selection-start-line="4" selection-start-column="33" selection-end-line="4" selection-end-column="33" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/bkp.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2079">
<caret line="99" column="17" selection-start-line="99" selection-start-column="17" selection-end-line="99" selection-end-column="17" />
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>

View File

@ -119,10 +119,10 @@ class ActiveEpc {
__check(v, re, msg, reject) { __check(v, re, msg, reject) {
if (!re.test(v)) { if (!re.test(v)) {
return { reject && reject({
msg, msg,
code: "C0" code: "C0"
} })
} }
} }
@ -137,23 +137,9 @@ class ActiveEpc {
}) })
} }
var e = _this.__check(uid, /\d{1,2}/g, "用户编号填写错误!") _this.__check(uid, /\d{1,2}/g, "用户编号填写错误!", reject);
if ( e ) { _this.__check(utype, /\d{1}/g, "用户类型填写错误!", reject);
reject && reject(e); _this.__check(pwd, /\d{6}/g, "密码填写错误!", reject);
return
}
e = _this.__check(utype, /\d{1}/g, "用户类型填写错误!");
if ( e ) {
reject && reject(e);
return
}
e = _this.__check(pwd, /\d{6}/g, "密码填写错误!");
if ( e ) {
reject && reject(e);
return
}
_this.__send("login", { _this.__send("login", {
uid, utype, pwd uid, utype, pwd
@ -213,11 +199,7 @@ class ActiveEpc {
var _this = this; var _this = this;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
var e = _this.__check(minutes, /\d{1,2}/g, "时间填写错误!"); _this.__check(minutes, /\d{1,2}/g, "时间填写错误!", reject);
if ( e ) {
reject && reject(e);
return
}
var v = parseInt(minutes, 10); var v = parseInt(minutes, 10);
if( v > 20 || v < 2 ) { if( v > 20 || v < 2 ) {
@ -257,21 +239,9 @@ class ActiveEpc {
}) })
} }
var e = _this.__check(uid, /\d{1,2}/g, "用户编号填写错误!"); _this.__check(uid, /\d{1,2}/g, "用户编号填写错误!", reject);
if ( e ) { _this.__check(utype, /\d{1}/g, "用户类型填写错误!", reject);
reject && reject(e); _this.__check(pwd, /\d{6}/g, "密码填写错误!", reject);
return
}
e = _this.__check(utype, /\d{1}/g, "用户类型填写错误!");
if ( e ) {
reject && reject(e);
return
}
e = _this.__check(pwd, /\d{6}/g, "密码填写错误!");
if ( e ) {
reject && reject(e);
return
}
_this.__send("modifyPassword", { _this.__send("modifyPassword", {
uid, utype, pwd uid, utype, pwd
@ -299,31 +269,11 @@ class ActiveEpc {
var e = _this.__check(accu, /\d{1,32}/g, "收方账户填写错误!"); _this.__check(accu, /\d{1,32}/g, "收方账户填写错误!", reject);
if ( e ) { _this.__check(ticketType, /\d{1}/g, "票据类型填写错误!", reject);
reject && reject(e); _this.__check(ticketNo, /\d{1,8}/g, "票据编号填写错误!", reject);
return _this.__check(date, /^(?:(?:1[6-9]|[2-9][0-9])[0-9]{2}([-/.]?)(?:(?:0?[1-9]|1[0-2])\1(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])\1(?:29|30)|(?:0?[13578]|1[02])\1(?:31))|(?:(?:1[6-9]|[2-9][0-9])(?:0[48]|[2468][048]|[13579][26])|(?:16|[2468][048]|[3579][26])00)([-/.]?)0?2\2(?:29))$/g, "时间填写错误!", reject);
} _this.__check(banlance, /\d{1,16}/g, "金额填写错误!", reject);
e = _this.__check(ticketType, /\d{1}/g, "票据类型填写错误!");
if ( e ) {
reject && reject(e);
return
}
e = _this.__check(ticketNo, /\d{1,8}/g, "票据编号填写错误!");
if ( e ) {
reject && reject(e);
return
}
e = _this.__check(date, /^(?:(?:1[6-9]|[2-9][0-9])[0-9]{2}([-/.]?)(?:(?:0?[1-9]|1[0-2])\1(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])\1(?:29|30)|(?:0?[13578]|1[02])\1(?:31))|(?:(?:1[6-9]|[2-9][0-9])(?:0[48]|[2468][048]|[13579][26])|(?:16|[2468][048]|[3579][26])00)([-/.]?)0?2\2(?:29))$/g, "时间填写错误!", reject);
if ( e ) {
reject && reject(e);
return
}
e = _this.__check(banlance, /\d{1,16}/g, "金额填写错误!");
if ( e ) {
reject && reject(e);
return
}
if ( '4' == ticketType || '5' == ticketType ) { if ( '4' == ticketType || '5' == ticketType ) {
if ( undefined === accr || "" === accr ) { if ( undefined === accr || "" === accr ) {
reject({ reject({

View File

@ -5,17 +5,11 @@
<title>无线支付密码器 js 接口示例</title> <title>无线支付密码器 js 接口示例</title>
<style> <style>
body { body {
width: 100%; width: 430px;
overflow-x: hidden; overflow-x: hidden;
color: sienna; color: sienna;
margin-top: 50px;
} }
.wrap{
display:flex;
display: -webkit-flex;
justify-content: center;
}
.step { .step {
margin: 1rem; margin: 1rem;
@ -64,11 +58,11 @@
</style> </style>
<link href="layx.min.css" rel="stylesheet" type="text/css" /> <link href="layx.min.css" rel="stylesheet" type="text/css" />
</head> </head>
<body class="wrap"> <body>
<div style="width: 430px">
<div id="title-warning" style="width: 100%; color:#f3b223; font-size: 2rem ;text-align: center"><span>您的浏览器不支持! </span></div> <div id="title-warning" style="width: 100%; color:#f3b223; font-size: 2rem ;text-align: center"><span>您的浏览器不支持! </span></div>
<div style="text-align: center"><h2>功能测试<small>(<a target="_blank" href="./active_cpe_setup.exe">active 驱动下载</a>)</small></h2></div> <div style="text-align: center"><h2>功能测试</h2></div>
<div class="step"> <div class="step">
<h3>基本功能</h3> <h3>基本功能</h3>
@ -149,7 +143,7 @@
</div> </div>
</div> </div>
</div>
<!-- 仅此示例程序需要依赖 jquery --> <!-- 仅此示例程序需要依赖 jquery -->
<script src="jquery.min.js"></script> <script src="jquery.min.js"></script>

410
www/swa/ic/index.html Normal file
View File

@ -0,0 +1,410 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>IC 卡维护工具</title>
<style>
:root {
--mainColor: #0062cc;
}
html, body {
margin: 0;
width: 100%;
height: 100%;
}
.title {
color: var(--mainColor);
}
.container {
margin: 2rem auto;
border: var(--mainColor) solid 2px;
border-radius: 10px;
width: 80%;
height: 80%;
text-align: left;
}
.group {
padding: 1rem;
margin: 1rem;
}
.form input {
display: block;
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">
</head>
<body>
<div style="width: 100%; text-align: center;">
<h2 class="title">信雅达 IC 卡发行工具</h2>
</div>
<div class="container">
<div class="group" style="height: 10rem">
<ul class="tabs">
<li>
<a href="#" name="tab_public">IC 卡发行</a>
</li>
<li>
<a href="#" name="tab_file">内部信息维护</a>
</li>
<li>
<a href="#" name="tab_active">Active 程序</a>
</li>
</ul>
<div class="tabs-content">
<div class="tab tab_public">
<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)">
</div>
<div style="margin: 1rem 0 ">
<button id="btn_nameplate_clear" style="margin-right: 1rem">清空</button>
<button id="btn_nameplate_tmp_save" style="margin-right: 1rem">临存</button>
<button id="btn_nameplate_tmp_load" style="margin-right: 1rem">临取</button>
<button id="btn_nameplate_read" style="margin-right: 1rem">返显</button>
</div>
<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>
<div style="height: 1rem"></div>
<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>
<button>读取所有</button>
<button>写入所有</button>
</div>
<div class="tab tab_active" style="padding-top: 1rem">
<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>
</div>
</div>
</div>
<!-- UKey 支持, 共 3 个 js-->
<!-- jquery -->
<script type="text/javascript" src="./jquery.min.js"></script>
<script type="text/javascript" src="./fiseckey.js"></script>
<script type="text/javascript" src="./ukey.js"></script>
<!-- 演示程序 -->
<script type="text/javascript" src="./tabs.js"></script>
<script type="application/javascript" src="layx.min.js"></script>
<script type="application/javascript" src="tools.js"></script>
<script type="application/javascript">
$(function () {
function refresh() {
var list = window.UKey.enumDevByArray()
if (list) {
var ll = list.split("|");
var options = ""
for (var i = 0; i < ll.length; i++) {
var value = ll[i].split(",")[0]
options += "<option value =\"" + value + "\">" + ll[i] + "</option>"
}
$("#ukeys").html(options);
}
}
refresh();
$("#btn_refresh").click(function () {
refresh()
success("刷新成功")
})
$("#btn_list_path").click(function () {
var path = $("#path").val();
try {
var ret = window.UKey.enumDir(path)
var out = ""
for (var i = 0; i < ret.folders.length; i++) {
out += "文件夹:\t" + ret.folders[i] + "\r\n"
}
for (var i = 0; i < ret.files.length; i++) {
out += "文件:\t" + ret.files[i] + "\r\n"
}
$("#ta_files").text(out)
success("枚举成功")
} catch (e) {
alert("枚举失败:" + e.message)
}
})
$("#login2").click(function () {
var pwd2 = $("#pwd2").val();
check(pwd2, /\d{8}/, "口令输入错误")
var ukey = $("#ukeys").val();
try {
window.UKey.admin(ukey, pwd2)
success("登录成功")
} catch (e) {
alert("登录失败:" + e.message)
}
})
$("#login2_def").click(function () {
$("#pwd2").val("12345678");
$("#login2").click()
})
$("#login").click(function () {
var pwd1 = $("#pwd1").val();
check(pwd1, /\d{8}/, "口令输入错误")
var ukey = $("#ukeys").val();
try {
window.UKey.login(ukey, pwd1)
success("登录成功")
} catch (e) {
alert("登录失败:" + e.message)
}
})
$("#login_def").click(function () {
$("#pwd1").val("12345678");
$("#login").click()
})
$("#btn_nameplate_clear").click(function () {
$("#manufactor").val("");
$("#system").val("");
$("#customer").val("");
})
$("#btn_read").click(function () {
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))
})
$("#btn_write").click(function () {
alert("暂不开放")
})
$("#btn_nameplate_tmp_load").click(function () {
var def = {
manufactor: "sunyard",
system: "hsm",
customer: "ICBC"
}
$("#manufactor").val(def.manufactor);
$("#system").val(def.system);
$("#customer").val(def.customer);
})
$("#btn_nameplate_read").click(function () {
try {
var txt = window.UKey.catRelease();
var def = Object.assign({
manufactor: "",
system: "",
customer: ""
}, txt)
$("#manufactor").val(def.manufactor);
$("#system").val(def.system);
$("#customer").val(def.customer);
success("返显成功")
} catch (e) {
alert("返显失败:" + e.message)
}
})
$("#btn_nameplate_tmp_load").click(function () {
var json = localStorage.getItem("tmp")
var def = {
manufactor: "sunyard",
system: "hsm",
customer: "ICBC"
}
try {
def = JSON.parse(json)
} catch (e) {
}
$("#manufactor").val(def.manufactor);
$("#system").val(def.system);
$("#customer").val(def.customer);
})
$("#btn_nameplate_tmp_save").click(function () {
var def = {
manufactor: $("#manufactor").val(),
system: $("#system").val(),
customer: $("#customer").val()
}
localStorage.setItem("tmp", JSON.stringify(def))
})
$("#btn_nameplate_release").click(function () {
var def = {
manufactor: $("#manufactor").val(),
system: $("#system").val(),
customer: $("#customer").val()
}
check(def.manufactor, /\w+/, "厂家标记填写错误")
check(def.system, /\w+/, "系统信息填写错误")
check(def.customer, /\w+/, "客户信息填写错误")
try {
window.UKey.release(def)
success("发行成功")
} catch (e) {
alert("发行失败:" + e.message)
}
})
$("#reset").click(function () {
alert("暂不开放")
})
$("#update1").click(function () {
alert("暂不开放")
})
$("#update2").click(function () {
alert("暂不开放")
})
})
</script>
</body>
</html>

4
www/swa/ic/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
www/swa/ic/layx.min.css vendored Normal file

File diff suppressed because one or more lines are too long

5
www/swa/ic/layx.min.js vendored Normal file

File diff suppressed because one or more lines are too long

55
www/swa/ic/tabs.css Normal file
View File

@ -0,0 +1,55 @@
.tabs {
overflow: hidden;
width: 100%;
margin: 0;
padding: 0;
list-style: none;
}
.tabs li {
float: left;
margin: 0 -15px 0 0;
}
.tabs a {
float: left;
position: relative;
padding: 0 40px;
height: 0;
line-height: 30px;
text-transform: uppercase;
text-decoration: none;
color: #fff;
border-right: 30px solid transparent;
border-bottom: 30px solid var(--mainColor);
/*border-bottom-color: #777 \9;*/
opacity: .3;
filter: alpha(opacity=30);
}
.tabs a:hover {
border-bottom-color: var(--mainColor);
opacity: 0.5;
filter: alpha(opacity=50);
}
.tabs a:focus {
outline: 0;
}
.tabs .current {
z-index: 3;
border-bottom-color: var(--mainColor);
opacity: 1;
filter: alpha(opacity=100);
}
.tabs-content {
background: #fff;
border-top: 2px solid var(--mainColor);
padding: 1rem 0;
}
.tabs-content h2, #content h3, #content p {
margin: 0 0 15px 0;
}

19
www/swa/ic/tabs.js Normal file
View File

@ -0,0 +1,19 @@
$(function (){
var $e = $(".tabs a").first();
$e.addClass("current")
showHideBlock( $e )
function showHideBlock($e){
$(".tabs-content .tab").hide()
var block = ".tabs-content .tab" + "." + $e.attr("name")
$(block).show()
}
$(".tabs a").click(function (){
$(".tabs a").removeClass("current")
$(this).addClass("current")
showHideBlock( $(this) )
})
})

45
www/swa/ic/tools.js Normal file
View File

@ -0,0 +1,45 @@
// 覆盖默认行为
function success(msg){
layx.notice({
title: '成功',
type: 'success',
message: msg
});
}
// 覆盖默认行为
function warning(msg){
layx.notice({
title: '警告',
type: 'warning',
message: msg
});
}
// 覆盖默认行为
function alert(msg){
layx.notice({
title: '错误',
type: 'error',
message: msg
});
}
function check(v, re, msg) {
if (!re.test(v)) {
alert("参数校验失败:" + msg)
throw "参数校验失败"
}
}
function getyyyyMMdd(){
var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth() + 1;
var curr_year = d.getFullYear();
String(curr_month).length < 2 ? (curr_month = "0" + curr_month): curr_month;
String(curr_date).length < 2 ? (curr_date = "0" + curr_date): curr_date;
var yyyyMMdd = curr_year + "" + curr_month +""+ curr_date;
return yyyyMMdd;
}

BIN
www/swa/u/Setup_V1.0.1.exe Normal file

Binary file not shown.

1611
www/swa/u/fiseckey.js Normal file

File diff suppressed because it is too large Load Diff

405
www/swa/u/index.html Normal file
View File

@ -0,0 +1,405 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>U 盾维护工具</title>
<style>
:root {
--mainColor: salmon;
}
html, body {
margin: 0;
width: 100%;
height: 100%;
}
.title {
color: var(--mainColor);
}
.container {
margin: 2rem auto;
border: var(--mainColor) solid 2px;
border-radius: 10px;
width: 80%;
height: 80%;
text-align: left;
}
.group {
padding: 1rem;
margin: 1rem;
}
.form input {
display: block;
margin: 0.5rem 0;
}
</style>
<link rel="stylesheet" type="text/css" href="tabs.css">
<link rel="stylesheet" type="text/css" href="layx.min.css">
</head>
<body>
<div style="width: 100%; text-align: center;">
<h2 class="title">信雅达 UKey 发行工具</h2>
</div>
<div class="container">
<div class="group" style="width: 100%; ">
<select id="ukeys" style="height: 1.5rem; width: 308px">
</select>
<button id="btn_refresh" style="margin-right: 1rem">&emsp;&emsp;</button>
</div>
<div class="group" style="width: 100%;">
<input id="pwd1" style="width: 300px;height: 1.06rem" type="password" maxlength="8" placeholder="口令8 个数字">
<button id="login" style="margin-right: 1rem">&emsp;&emsp;</button>
<button id="login_def" style="margin-right: 1rem">默认口令</button>
</div>
<div class="group" style="height: 10rem">
<ul class="tabs">
<li>
<a href="#" name="tab_public">UKey 发行</a>
</li>
<li>
<a href="#" name="tab_file">文件操作</a>
</li>
<li>
<a href="#" name="tab_pin">PIN 管理</a>
</li>
<li>
<a href="#" name="tab_active">驱动程序</a>
</li>
</ul>
<div class="tabs-content">
<div class="tab tab_public">
<div class="form">
<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>
<div style="margin: 1rem 0 ">
<button id="btn_nameplate_clear" style="margin-right: 1rem">清空</button>
<button id="btn_nameplate_tmp_save" style="margin-right: 1rem">临存</button>
<button id="btn_nameplate_tmp_load" style="margin-right: 1rem">临取</button>
<button id="btn_nameplate_read" style="margin-right: 1rem">返显</button>
</div>
<button id="btn_nameplate_release" style="margin-right: 1rem">&emsp;&emsp;</button>
</div>
<div class="tab tab_file">
<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>
<textarea id="ta_files" style="display: block; margin: 1rem 0; width: 375px; height: 100px;"
readonly></textarea>
<input id="filepath" style="width: 300px; height: 1.06rem" type="text" value="\root\mana\name"
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;"
></textarea>
</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="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>
</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>
</div>
<!-- UKey 支持, 共 3 个 js-->
<!-- jquery -->
<script type="text/javascript" src="./jquery.min.js"></script>
<script type="text/javascript" src="./fiseckey.js"></script>
<script type="text/javascript" src="./ukey.js"></script>
<!-- 演示程序 -->
<script type="text/javascript" src="./tabs.js"></script>
<script type="application/javascript" src="layx.min.js"></script>
<script type="application/javascript" src="tools.js"></script>
<script type="application/javascript">
$(function () {
function refresh() {
var list = window.UKey.enumDevByArray()
if (list) {
var ll = list.split("|");
var options = ""
for (var i = 0; i < ll.length; i++) {
var value = ll[i].split(",")[0]
options += "<option value =\"" + value + "\">" + ll[i] + "</option>"
}
$("#ukeys").html(options);
}
}
refresh();
$("#btn_refresh").click(function () {
refresh()
success("刷新成功")
})
$("#btn_list_path").click(function () {
var path = $("#path").val();
try {
var ret = window.UKey.enumDir(path)
var out = ""
for (var i = 0; i < ret.folders.length; i++) {
out += "文件夹:\t" + ret.folders[i] + "\r\n"
}
for (var i = 0; i < ret.files.length; i++) {
out += "文件:\t" + ret.files[i] + "\r\n"
}
$("#ta_files").text(out)
success("枚举成功")
} catch (e) {
alert("枚举失败:" + e.message)
}
})
$("#login2").click(function () {
var pwd2 = $("#pwd2").val();
check(pwd2, /\d{8}/, "口令输入错误")
var ukey = $("#ukeys").val();
try {
window.UKey.admin(ukey, pwd2)
success("登录成功")
} catch (e) {
alert("登录失败:" + e.message)
}
})
$("#login2_def").click(function () {
$("#pwd2").val("12345678");
$("#login2").click()
})
$("#login").click(function () {
var pwd1 = $("#pwd1").val();
check(pwd1, /\d{8}/, "口令输入错误")
var ukey = $("#ukeys").val();
try {
window.UKey.login(ukey, pwd1)
success("登录成功")
} catch (e) {
alert("登录失败:" + e.message)
}
})
$("#login_def").click(function () {
$("#pwd1").val("12345678");
$("#login").click()
})
$("#btn_nameplate_clear").click(function () {
$("#manufactor").val("");
$("#system").val("");
$("#customer").val("");
})
$("#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)
$("#ta_txt").val( txt )
debugger
success("读取成功")
} catch (e) {
alert("读取失败:" + e.message)
}
})
$("#btn_write").click(function () {
// 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.writeFile(folder, file, txt);
success("写入成功")
} catch (e) {
alert("写入失败:" + e.message)
}
})
$("#btn_nameplate_tmp_load").click(function () {
var def = {
manufactor: "sunyard",
system: "hsm",
customer: "ICBC"
}
$("#manufactor").val(def.manufactor);
$("#system").val(def.system);
$("#customer").val(def.customer);
})
$("#btn_nameplate_read").click(function () {
try {
var txt = window.UKey.catRelease();
var def = Object.assign({
manufactor: "",
system: "",
customer: ""
}, txt)
$("#manufactor").val(def.manufactor);
$("#system").val(def.system);
$("#customer").val(def.customer);
success("返显成功")
} catch (e) {
alert("返显失败:" + e.message)
}
})
$("#btn_nameplate_tmp_load").click(function () {
var json = localStorage.getItem("tmp")
var def = {
manufactor: "sunyard",
system: "hsm",
customer: "ICBC"
}
try {
def = JSON.parse(json)
} catch (e) {
}
$("#manufactor").val(def.manufactor);
$("#system").val(def.system);
$("#customer").val(def.customer);
})
$("#btn_nameplate_tmp_save").click(function () {
var def = {
manufactor: $("#manufactor").val(),
system: $("#system").val(),
customer: $("#customer").val()
}
localStorage.setItem("tmp", JSON.stringify(def))
})
$("#btn_nameplate_release").click(function () {
var def = {
manufactor: $("#manufactor").val(),
system: $("#system").val(),
customer: $("#customer").val()
}
check(def.manufactor, /\w+/, "厂家标记填写错误")
check(def.system, /\w+/, "系统信息填写错误")
check(def.customer, /\w+/, "客户信息填写错误")
try {
window.UKey.release(def)
success("发行成功")
} catch (e) {
alert("发行失败:" + e.message)
}
})
$("#reset").click(function () {
alert("暂不开放")
})
$("#update1").click(function () {
alert("暂不开放")
})
$("#update2").click(function () {
alert("暂不开放")
})
})
</script>
</body>
</html>

4
www/swa/u/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
www/swa/u/layx.min.css vendored Normal file

File diff suppressed because one or more lines are too long

5
www/swa/u/layx.min.js vendored Normal file

File diff suppressed because one or more lines are too long

55
www/swa/u/tabs.css Normal file
View File

@ -0,0 +1,55 @@
.tabs {
overflow: hidden;
width: 100%;
margin: 0;
padding: 0;
list-style: none;
}
.tabs li {
float: left;
margin: 0 -15px 0 0;
}
.tabs a {
float: left;
position: relative;
padding: 0 40px;
height: 0;
line-height: 30px;
text-transform: uppercase;
text-decoration: none;
color: #fff;
border-right: 30px solid transparent;
border-bottom: 30px solid var(--mainColor);
/*border-bottom-color: #777 \9;*/
opacity: .3;
filter: alpha(opacity=30);
}
.tabs a:hover {
border-bottom-color: var(--mainColor);
opacity: 0.5;
filter: alpha(opacity=50);
}
.tabs a:focus {
outline: 0;
}
.tabs .current {
z-index: 3;
border-bottom-color: var(--mainColor);
opacity: 1;
filter: alpha(opacity=100);
}
.tabs-content {
background: #fff;
border-top: 2px solid var(--mainColor);
padding: 1rem 0;
}
.tabs-content h2, #content h3, #content p {
margin: 0 0 15px 0;
}

19
www/swa/u/tabs.js Normal file
View File

@ -0,0 +1,19 @@
$(function (){
var $e = $(".tabs a").first();
$e.addClass("current")
showHideBlock( $e )
function showHideBlock($e){
$(".tabs-content .tab").hide()
var block = ".tabs-content .tab" + "." + $e.attr("name")
$(block).show()
}
$(".tabs a").click(function (){
$(".tabs a").removeClass("current")
$(this).addClass("current")
showHideBlock( $(this) )
})
})

1597
www/swa/u/test2.html Normal file

File diff suppressed because it is too large Load Diff

45
www/swa/u/tools.js Normal file
View File

@ -0,0 +1,45 @@
// 覆盖默认行为
function success(msg){
layx.notice({
title: '成功',
type: 'success',
message: msg
});
}
// 覆盖默认行为
function warning(msg){
layx.notice({
title: '警告',
type: 'warning',
message: msg
});
}
// 覆盖默认行为
function alert(msg){
layx.notice({
title: '错误',
type: 'error',
message: msg
});
}
function check(v, re, msg) {
if (!re.test(v)) {
alert("参数校验失败:" + msg)
throw "参数校验失败"
}
}
function getyyyyMMdd(){
var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth() + 1;
var curr_year = d.getFullYear();
String(curr_month).length < 2 ? (curr_month = "0" + curr_month): curr_month;
String(curr_date).length < 2 ? (curr_date = "0" + curr_date): curr_date;
var yyyyMMdd = curr_year + "" + curr_month +""+ curr_date;
return yyyyMMdd;
}

288
www/swa/u/ukey.js Normal file
View File

@ -0,0 +1,288 @@
(function( root ){
var DIR = "\\root\\mana"
var FISECKEY = root.FISECKEY;
var hDevice = undefined;
if ( ! FISECKEY ) {
console.error("缺少 FISECKEY 支持 !!!")
}
function stringToHex(str){
var val = "";
for (var i = 0; i < str.length; i++) {
var v = str.charCodeAt(i).toString(16);
if ( v.length < 2 ) {
v = "0" + v;
}
val += v;
}
return val
}
function hexToString(hex){
var arr = hex.split("")
var out = ""
for (var i = 0; i < arr.length / 2; i++) {
var tmp = "0x" + arr[i * 2] + arr[i * 2 + 1]
var charValue = String.fromCharCode(tmp);
out += charValue
}
return out
}
function admin( dev, pin ){
if ( ! hDevice ) {
hDevice = FISECKEY.OpenBySerial(dev, "4");
}
if ( ! hDevice ) {
throw new Error("设备打开失败")
}
FISECKEY.ADMIN_Login(hDevice, pin);
return hDevice;
}
function login( dev, pin ){
hDevice = FISECKEY.OpenBySerial(dev, "4");
if ( ! hDevice ) {
throw new Error("设备打开失败")
}
FISECKEY.USER_Login(hDevice, pin);
return hDevice;
}
function logout(){
FISECKEY.USER_Logout(hDevice, 0);
FISECKEY.CloseDevice(hDevice);
hDevice = undefined
}
function sumHash(data){
var sum = 0;
for (var i =0 ; i < data.length; i++) {
sum += data.charCodeAt(i)
}
sum += "";
return sum.substr( sum.length -4 );
}
function release( info ){
if ( ! hDevice ) {
throw new Error("设备未登录")
}
FISECKEY.FILE_Init(hDevice);
FISECKEY.FILE_CreateDir(hDevice, DIR, 0);
FISECKEY.FILE_CreateFile(hDevice, DIR, "name", 2048, 0);
var data = JSON.stringify(info)
writeFile(DIR, "name", data)
readFile(DIR, "name")
}
function readFile(dir, file) {
if ( ! hDevice ) {
throw new Error("设备未登录")
}
var len = FISECKEY.FILE_ReadFile(hDevice, dir, file, 0, 2);
len = parseInt( len, 10 );
var data = FISECKEY.FILE_ReadFile(hDevice, dir, file, 2, len);
var sum = sumHash(data);
var hash = FISECKEY.FILE_ReadFile(hDevice, dir, file, 2 + len, 2);
if ( sum === hash ) {
var str = hexToString(data);
console.log( "read", data )
return JSON.parse(str);
}
throw new Error("文件读取失败")
}
function writeFile(dir, file, data){
if ( ! hDevice ) {
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, file, 0, 2, len);
FISECKEY.FILE_WriteFile(hDevice, dir, file, 2, data.length/2, data);
// console.log( "writeFile=" + len )
// console.log( "writeFile=" + data )
// console.log( "writeFile=" + data.length )
var hash = sumHash(data);
// console.log( "writeFile hash=" + hash )
FISECKEY.FILE_WriteFile(hDevice, dir, file, 2 + (data.length/2), 2, hash);
}
// 枚举序列号与名称
function enumDevByArray() {
return FISECKEY.EnumByArray();
}
function enumDir( path ){
if ( ! hDevice ) {
throw new Error("设备未登录")
}
var folders = FISECKEY.FILE_EnmuDir(hDevice, path);
var fos = folders.split("|")
folders = []
for ( var i = 0 ; i < fos.length ; i++ ) {
if ( fos[i] ) {
folders.push( path + "\\" + fos[i] );
}
}
var files = FISECKEY.FILE_EnmuFile(hDevice, path);
var fs = files.split("|")
files = []
for ( var i = 0 ; i < fs.length ; i++ ) {
if ( fs[i] ) {
files.push( path + "\\" + fs[i] );
}
}
return {
folders : folders,
files : files
}
}
function loadLMK(){
return readFile(DIR, "lmk")
}
/**
*
* @param no 1/2/3
* @param mkey HEX48 字节
*/
function saveLMK(no, lmk, pk, sk) {
if ( ! hDevice ) {
throw new Error("设备未登录")
}
var info = {
pk : pk , sk : sk
}
switch ( no ) {
case 1: {
info = Object.assign( info, {
no : no,
lmk1 : lmk.substr(0, 32),
lmk2 : lmk.substr(32, 64)
})
break;
}
case 2: {
// 0 16 32 48
// 0 32 64 96
info = Object.assign( info, {
no : no,
lmk2 : lmk.substr(32, 64),
lmk3 : lmk.substr(64, 96)
})
break;
}
case 3: {
info = Object.assign( info, {
no : no,
lmk3 : lmk.substr(64, 96),
lmk1 : lmk.substr(0, 32)
})
break;
}
default :
throw new Error("不支持的分量")
}
var data = JSON.stringify(info)
FISECKEY.FILE_DeleteFile(hDevice, DIR, "lmk");
FISECKEY.FILE_CreateFile(hDevice, DIR, "lmk", 2048, 0);
writeFile( DIR, "lmk" , data);
var auth = {
uid : no,
rid : no
}
FISECKEY.FILE_DeleteFile(hDevice, DIR, "auth");
FISECKEY.FILE_CreateFile(hDevice, DIR, "auth", 2048, 0);
writeFile( DIR, "auth" , auth);
}
function saveAuth(uid, rid){
var auth = {
uid : no,
rid : no
}
FISECKEY.FILE_DeleteFile(hDevice, DIR, "auth");
FISECKEY.FILE_CreateFile(hDevice, DIR, "auth", 2048, 0);
writeFile( DIR, "auth" , auth);
}
function loadAuth(){
return readFile(DIR, "auth")
}
function catRelease(){
return readFile(DIR, "name")
}
/**
* 修改口令
*/
function updatePin(oldpin, newpin){
FISECKEY.USER_ChangePin(hDevice, 1, oldpin, newpin);
}
root.UKey = {
release: release,
catRelease : catRelease,
readFile: readFile,
writeFile : writeFile,
login : login,
logout : logout,
updatePin : updatePin,
admin : admin,
enumDevByArray : enumDevByArray,
enumDir: enumDir,
saveLMK : saveLMK,
loadLMK : loadLMK,
saveAuth : saveAuth,
loadAuth : loadAuth
}
})( window )