mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-21 03:19:52 +00:00
perf: 支持配置文件加密 (#8699)
* crypto * perf: 暂存一下 * perf: 支持配置文件加密 * perf: 修改位置 * perf: 优化拆分出去 * stash * perf: js 强制 key 最大 16 * pref: 修改语法 * fix: 修复启用 gm 后,又关闭导致的用户无法登录 Co-authored-by: ibuler <ibuler@qq.com>
This commit is contained in:
@@ -1504,17 +1504,11 @@ function getStatusIcon(status, mapping, title) {
|
||||
|
||||
|
||||
function fillKey(key) {
|
||||
let keySize = 128
|
||||
// 如果超过 key 16 位, 最大取 32 位,需要更改填充
|
||||
if (key.length > 16) {
|
||||
key = key.slice(0, 32)
|
||||
keySize = keySize * 2
|
||||
const KeyLength = 16
|
||||
if (key.length > KeyLength) {
|
||||
key = key.slice(0, KeyLength)
|
||||
}
|
||||
const filledKeyLength = keySize / 8
|
||||
if (key.length >= filledKeyLength) {
|
||||
return key.slice(0, filledKeyLength)
|
||||
}
|
||||
const filledKey = Buffer.alloc(keySize / 8)
|
||||
const filledKey = Buffer.alloc(KeyLength)
|
||||
const keys = Buffer.from(key)
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
filledKey[i] = keys[i]
|
||||
|
Reference in New Issue
Block a user