yinjihuan/monkey-api-encrypt

版本1.2.2,前端解密出现异常Malformed UTF-8 data

Opened this issue · 2 comments

版本1.2.2,前端解密出现异常Malformed UTF-8 data

有具体的吗,这个没有详细信息啊

ChannD commented

我这边也是这样的问题
js
export function decrypt(data) {
console.log('data first::', data)
data = data.toString().replace(/[\r\n|\r|\n|\n\r]/g, '')
console.log('data second::', data)
let decrypt = CryptoJS.AES.decrypt(data, key, {
mode: CryptoJS.mode.ECB,
padding: CryptoJS.pad.Pkcs7,
})
decrypt = decrypt.toString().replace(/[\r\n|\r|\n|\n\r]/g, '')
console.log('decrypt::', decrypt)
return JSON.parse(CryptoJS.enc.Utf8.stringify(decrypt).toString())
}