From 422d44df1b9899b9104f372b3af52366823a118e Mon Sep 17 00:00:00 2001 From: Cheney Date: Wed, 5 Jun 2024 16:04:45 +0800 Subject: [PATCH] save --- Readme.md | 83 +++++++++++++++++++++++++++++++++++++++++++++ api.md | 1 + backend/src/main.js | 27 +++++++++++++++ config.json | 11 ++++++ 4 files changed, 122 insertions(+) create mode 100644 Readme.md create mode 100644 api.md create mode 100644 backend/src/main.js create mode 100644 config.json diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..85fab62 --- /dev/null +++ b/Readme.md @@ -0,0 +1,83 @@ +# Fake UKey + +1. 暂时无法实现 UKEY 复制, 只能从初始化时就使用 Fake UKEY。 + + +## API +请求: +Content-Type: application/x-www-form-urlencoded; charset=UTF-8 +URL:http://127.0.0.1:8090/do + +响应: +Access-Control-Allow-Origin : * +Content-Type : application/x-json +Server : fmkey server <0.1> + + + +### 枚举设备 +order : 01000005 + +{ +"EnumDeviceNameList": "K1426211102B1145,FMKEY|K1426221104B2502,Sunyard Technology Co.,Ltd", +"rev": 0 +} + + +### 打开设备 +order : 01000004 +devSerial : K1426210806B0227 + +{"hdev":"886A8002", "rev":0} + + + +### PIN 认证 +order : 01000027 +devSerial : K1426210806B0227 +pin : 12345678 + +{"huser":"", "count":0, "rev":0} + + +### 文件读取 +order : 01000035 +hdevice : 886A8002 +dir : \root\mana +file : auth +offset : 0 +size : 2 + +{"data":"0257", "rev":0} + + + +### 导出公钥 +order : 01000043 +hdevice : 886A8002 +keyNum : 1 + +{ +"keyData": "-----BEGIN ECDSA PUBLIC KEY-----MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAE9WIZc8AVgG4gcW08CBA/6zu/Tfh1h558+I56yfOJXkcp3+/NFKpxcwMGZgEpwsmb88e4Y6tjSeaSfOedOTyrvw==-----END ECDSA PUBLIC KEY-----", +"rev": 0 +} + + +### 签名 +order : 01000046 +hdevice : 886A8002 +keyNum : 1 +inData : VYDmUZ+LXcoewVo8ebuuTCaGYkgNaBrEfWWihagPM9E= +alg : 1 + +{ +"sigData": "MEUCIQDYFS+P3YgxWbC/11FlqNOrT2sbOJaUdHV9LTHSQqGT9wIgeW4Vjg7u0YHEEDtAVPoHY2DWJcFK40FKJElJbs1WvoU=", +"rev": 0 +} + + + + + + + diff --git a/api.md b/api.md new file mode 100644 index 0000000..e941a91 --- /dev/null +++ b/api.md @@ -0,0 +1 @@ +enumDevByArray diff --git a/backend/src/main.js b/backend/src/main.js new file mode 100644 index 0000000..508a65c --- /dev/null +++ b/backend/src/main.js @@ -0,0 +1,27 @@ +const express = require('express'); +const bodyParser = require('body-parser'); + +const app = express(); +const port = 3000; + +// 使用body-parser中间件来解析urlencoded格式的请求体 +app.use(bodyParser.urlencoded({ extended: true })); + +app.get("/", (req, res) => { + res.json({ + server : "Fake UKey", + version : "1.0" + }) +}) +app.post('/do', (req, res) => { + // 获取请求体中的数据 + const requestData = req.body; + // 设置响应类型为application/x-json + res.setHeader('Content-Type', 'application/x-json'); // 注意application/x-json不是标准MIME类型,通常使用application/json + // 将请求的数据返回为json格式的响应体 + res.json(requestData); +}); + +app.listen(port, () => { + console.log(`Server is running on port ${port}`); +}); diff --git a/config.json b/config.json new file mode 100644 index 0000000..3bee312 --- /dev/null +++ b/config.json @@ -0,0 +1,11 @@ +{ + "app" : "", + "title" : "", + "icon" : "", + "backend" : "", + "frontend" : "", + "window" : { + "width" : "", + "height" : "" + } +} \ No newline at end of file