|
|
@ -58,14 +58,17 @@ export function encryptByMd5(password: string) { |
|
|
|
export const encryptionLogin = (params: encryptionLoginModel): LoginParams => { |
|
|
|
export const encryptionLogin = (params: encryptionLoginModel): LoginParams => { |
|
|
|
let { data, param, key } = params; |
|
|
|
let { data, param, key } = params; |
|
|
|
const result = JSON.parse(JSON.stringify(data)); |
|
|
|
const result = JSON.parse(JSON.stringify(data)); |
|
|
|
const aesEncryption = new AesEncryption({ key }); |
|
|
|
|
|
|
|
param.forEach(ele => { |
|
|
|
param.forEach(ele => { |
|
|
|
const data = result[ele]; |
|
|
|
const data = result[ele]; |
|
|
|
result[ele] = aesEncryption.encryptByAES(data, { |
|
|
|
const encryptKey= CryptoJS.enc.Latin1.parse(key); |
|
|
|
mode: CryptoJS.mode.ECB, |
|
|
|
const iv = encryptKey; |
|
|
|
padding: CryptoJS.pad.NoPadding, |
|
|
|
// 加密
|
|
|
|
iv: CryptoJS.enc.Latin1.parse(key) |
|
|
|
const encrypted = CryptoJS.AES.encrypt(data, encryptKey, { |
|
|
|
}).toString(); |
|
|
|
iv: iv, |
|
|
|
|
|
|
|
mode: CryptoJS.mode.CFB, |
|
|
|
|
|
|
|
padding: CryptoJS.pad.NoPadding |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
result[ele] = encrypted.toString(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
}; |
|
|
|
}; |
|
|
|