This commit is contained in:
Cheney 2024-06-05 16:04:45 +08:00
parent aab6b69780
commit 422d44df1b
4 changed files with 122 additions and 0 deletions

83
Readme.md Normal file
View File

@ -0,0 +1,83 @@
# Fake UKey
1. 暂时无法实现 UKEY 复制, 只能从初始化时就使用 Fake UKEY。
## API
请求:
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
URLhttp://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
}

1
api.md Normal file
View File

@ -0,0 +1 @@
enumDevByArray

27
backend/src/main.js Normal file
View File

@ -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}`);
});

11
config.json Normal file
View File

@ -0,0 +1,11 @@
{
"app" : "",
"title" : "",
"icon" : "",
"backend" : "",
"frontend" : "",
"window" : {
"width" : "",
"height" : ""
}
}