ECB模式 没有IV key是上面随机生成的
p = IU()
协议头中 Encrypt-Key 就是对这个P进行RSA加密提交到服务器
[JavaScript] 纯文本查看 复制代码 const p = IU();
try {
const e = vV();
f = ((e,t)=>pV.AES.encrypt(e, t, {
mode: pV.mode.ECB,
padding: pV.pad.Pkcs7
}).toString())(u, p),
s = vV().diff(e)
} catch (d) {
return RU.error(this, `请求数据加密失败:[${t.url}] [${u}] 返回数据异常:${d}`),
o.msg = "请求数据加密失败",
this.errorHandle(o.msg, o),
o
}
e = {
method: "POST",
url: "/" + lj.generateGUID(),
data: f
},
e.headers = new tB,
e.headers.set("encrypt-key", ((e,t)=>{
const n = new _R;
n.setPublicKey(t);
const r = n.getKey()
, o = (r.n.bitLength() + 7 >> 3) - 11;
try {
let t = ""
, n = ""
, i = 0
, a = 0
, s = 0
, l = 0;
const c = e.length;
for (let u = 0; u < c; u++) {
const c = e.charCodeAt(u);
s += c <= 127 ? 1 : c <= 2047 ? 2 : c <= 65535 ? 3 : 4,
s > o ? (t = e.substring(i, a),
n += r.encrypt(t),
i = a,
s -= l) : (a = u,
l = s)
}
return t = e.substring(i, c),
n += r.encrypt(t),
xB(n)
} catch (i) {
return ""
}
}
)((l = p,
pV.enc.Base64.stringify(l)), "MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ=="))
}
|