diff --git a/push.cmd b/push.cmd index d190b2a..29ec526 100644 --- a/push.cmd +++ b/push.cmd @@ -4,4 +4,5 @@ cd src hugo cd .. +xcopy swa www\swa /s /e /y scp -r www root@n4.fullstack.club:/app/fullstack/ diff --git a/swa/ic/index.html b/swa/ic/index.html index 1cb9ebb..e9b9434 100644 --- a/swa/ic/index.html +++ b/swa/ic/index.html @@ -37,6 +37,13 @@ margin: 0.5rem 0; } + .line span { + display: inline-block; + width: 150px; + font-size: 0.8rem; + color: var(--mainColor); + } + @@ -56,11 +63,11 @@
  • - 文件操作 + 内部信息维护
  • - PIN 管理 + Active 程序
  • @@ -71,12 +78,44 @@
    -
    +
    +

    帮助

    +
      +
    • + 清空 +

      仅清空 3 个输入框。

      +
    • +
    • + 临存 +

      将 3 个输入框的内容临时保存在本地。

      +
    • +
    • + 临取 +

      将临时保存在本地的信息填入 3 个输入框。

      +
    • +
    • + 返显 +

      尝试读取 IC 卡内部信息。IC 卡内部信息错误时有可能显示乱码。

      +
    • +
    • + 发行 +

      将发行信息写入 IC 卡。

      +
    • +
    + +
    + +
    + + + + + + + + - - -
    @@ -89,50 +128,64 @@ + +
    +
    +

    帮助

    +

    本页所有值都是 HEX

    +
    - - +
    - +
    + IC卡属主 (20h+1) + +
    + +
    + 特征字串 (30h+16) + +
    + +
    + 主密钥分量 (40h+5) + +
    + +
    + LMK0 (50h+16) + +
    + +
    + LMK分量 (100h) + +
    - - - - - - + +
    -
    -
    - - - -
    +
    - -
    - - - - - - -
    +
      +
    • +

      V1.0 (点击下载)

      +

      【2022年12月22日】

      +

      第一个发行版本

      +
    • +
    diff --git a/swa/u/Setup_V1.0.1.exe b/swa/u/Setup_V1.0.1.exe new file mode 100644 index 0000000..011e81a Binary files /dev/null and b/swa/u/Setup_V1.0.1.exe differ diff --git a/swa/u/index.html b/swa/u/index.html index fddee66..c7076d0 100644 --- a/swa/u/index.html +++ b/swa/u/index.html @@ -76,6 +76,10 @@ PIN 管理 +
  • + 驱动程序 +
  • + @@ -116,12 +120,13 @@ + placeholder="文件"> + + >
    @@ -149,6 +154,17 @@
    +
    + + + +
    + @@ -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 () { diff --git a/swa/u/ukey.js b/swa/u/ukey.js index b8b96a9..40aa8d1 100644 --- a/swa/u/ukey.js +++ b/swa/u/ukey.js @@ -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, diff --git a/www/MetaSelector/index.html b/www/MetaSelector/index.html index 993b1c2..d3e43e1 100644 --- a/www/MetaSelector/index.html +++ b/www/MetaSelector/index.html @@ -132,7 +132,7 @@