mirror of https://github.com/jumpserver/jumpserver
perf: 优化加密,没有rsa则不加密
parent
cb2bd0cf2c
commit
c26a786287
|
@ -1549,10 +1549,13 @@ function encryptPassword(password) {
|
||||||
if (!password) {
|
if (!password) {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
const aesKey = (Math.random() + 1).toString(36).substring(2)
|
|
||||||
// public key 是 base64 存储的
|
// public key 是 base64 存储的
|
||||||
const rsaPublicKeyText = getCookie('jms_public_key')
|
let rsaPublicKeyText = getCookie('jms_public_key')
|
||||||
.replaceAll('"', '')
|
if (!rsaPublicKeyText) {
|
||||||
|
return password
|
||||||
|
}
|
||||||
|
const aesKey = (Math.random() + 1).toString(36).substring(2)
|
||||||
|
rsaPublicKeyText = rsaPublicKeyText.replaceAll('"', '')
|
||||||
const rsaPublicKey = atob(rsaPublicKeyText)
|
const rsaPublicKey = atob(rsaPublicKeyText)
|
||||||
const keyCipher = rsaEncrypt(aesKey, rsaPublicKey)
|
const keyCipher = rsaEncrypt(aesKey, rsaPublicKey)
|
||||||
const passwordCipher = aesEncrypt(password, aesKey)
|
const passwordCipher = aesEncrypt(password, aesKey)
|
||||||
|
|
Loading…
Reference in New Issue