温馨提示:这篇文章已超过459天没有更新,请注意相关的内容是否还可用!
摘要:本案例介绍了在webpack中如何定位参数,特别是在之前已经发送公钥的情况下。通过详细分析,展示了如何在项目中集成webpack,并有效地管理和配置参数。还结合中国五矿的背景,探讨了实际应用中的挑战和解决方案。该案例对于理解webpack参数定位和优化项目配置具有一定的参考价值。
网址链接:中国五矿集团有限公司采购电子商务平台
定位到数据包,载荷中param是一个加密参数。
每一个数据包前都有一个public返回公钥。
点击查看返回的数据
如何定位参数加密位置?
复制公钥包url的后面,进行搜索 ,查看哪些js代码中有这串url。
进入js文件
分析代码,在return A.stop()打上断点。
在控制台打印:
s就是param的值,t.encryptLong(JSON.stringify(a))是加密的位置。缺少的参数值,前面有a,有t是怎么生成的,也有传入的参数r,r就是传入的公钥。
r = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCJUlosJ5+Ylm5UVYFU1jAqmXYFKqLsTDOIfosWTo6LLkwxSm1aAMBnIXyXFpFK+TTrcBg36arJOpfqctiGqx+as6Pyyd1r05QD9jN1fi9/wgeXhXqxjQQUugNTgP7u+O1udVEquHTXY8ClmSBMD2XXMfDUxHj+l3pOTIVOgFqlmQIDAQAB' t = new v["a"] t.setPublicKey(r); a = m(m({}, e), {}, { sign: f()(JSON.stringify(e)), timeStamp: +new Date }) s = t.encryptLong(JSON.stringify(a))
现在分析v是什么?v是一个对象,可以 往前翻。
看到这种格式,就要想到webpack,t肯定是加载器,9816是后面的字典中的键值。因此要定位到加载器,并复制,然后重新赋值变量。
打上断点,并刷新。
进入t,跳转到别的js文件,发现是一个webpack,复制 加载器,并进行补充。
var yangxin; var window=global; (function(A) { function e(e) { for (var n, r, i = e[0], o = e[1], g = e[2], c = 0, C = []; c结果展现:
现在要找到9816所对应的函数的位置,并复制。在最开始的也就是打断点的js文件中,搜索。
可以直接在控制台打印t('9816'),也可以搜索。
复制代码,在后面的加载器的最后的字典中。肯定会报错,因为缺少其他耦合的模块,因此在o函数中输入console.log(e),查看缺少哪些模块。
var yangxin; var window=global; (function(A) { function e(e) { for (var n, r, i = e[0], o = e[1], g = e[2], c = 0, C = []; c >= 16, t += 16), 0 == (255 & e) && (e >>= 8, t += 8), 0 == (15 & e) && (e >>= 4, t += 4), 0 == (3 & e) && (e >>= 2, t += 2), 0 == (1 & e) && ++t, t } function u(e) { var t = 0; while (0 != e) e &= e - 1, ++t; return t } var d, h = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", f = "="; function p(e) { var t, n, r = ""; for (t = 0; t + 3 > 6) + h.charAt(63 & n); t + 1 == e.length ? (n = parseInt(e.substring(t, t + 1), 16), r += h.charAt(n > 2) + h.charAt((3 & n) 0) r += f; return r } function m(e) { var t, n = "", r = 0, i = 0; for (t = 0; t > 2), i = 3 & a, r = 1) : 1 == r ? (n += o(i > 4), i = 15 & a, r = 2) : 2 == r ? (n += o(i), n += o(a >> 2), i = 3 & a, r = 3) : (n += o(i > 4), n += o(15 & a), r = 0)) } return 1 == r && (n += o(i = 2 ? (o[o.length] = i, i = 0, a = 0) : i > 16, o[o.length] = i >> 8 & 255, o[o.length] = 255 & i, i = 0, a = 0) : i 10; break; case 3: o[o.length] = i >> 16, o[o.length] = i >> 8 & 255; break } return o }, re: /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/, unarmor: function(e) { var t = b.re.exec(e); if (t) if (t[1]) e = t[1]; else { if (!t[2]) throw new Error("RegExp out of sync"); e = t[2] } return b.decode(e) } }, y = 1e13, _ = function() { function e(e) { this.buf = [+e || 0] } return e.prototype.mulAdd = function(e, t) { var n, r, o = this.buf, i = o.length; for (n = 0; n 0 && (o[n] = t) } , e.prototype.sub = function(e) { var t, n, r = this.buf, o = r.length; for (t = 0; t = 0; --r) n += (y + t[r]).toString().substring(1); return n } , e.prototype.valueOf = function() { for (var e = this.buf, t = 0, n = e.length - 1; n >= 0; --n) t = t * y + e[n]; return t } , e.prototype.simplify = function() { var e = this.buf; return 1 == e.length ? e[0] : this } , e }(), x = "…", w = /^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/, C = /^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/; function S(e, t) { return e.length > t && (e = e.substring(0, t) + x), e } var j, k = function() { function e(t, n) { this.hexDigits = "0123456789ABCDEF", t instanceof e ? (this.enc = t.enc, this.pos = t.pos) : (this.enc = t, this.pos = n) } return e.prototype.get = function(e) { if (void 0 === e && (e = this.pos++), e >= this.enc.length) throw new Error("Requesting byte offset " + e + " on a stream of length " + this.enc.length); return "string" === typeof this.enc ? this.enc.charCodeAt(e) : this.enc[e] } , e.prototype.hexByte = function(e) { return this.hexDigits.charAt(e >> 4 & 15) + this.hexDigits.charAt(15 & e) } , e.prototype.hexDump = function(e, t, n) { for (var r = "", o = e; o 176) return !1 } return !0 } , e.prototype.parseStringISO = function(e, t) { for (var n = "", r = e; r 191 && o n) return S(r, n); o = new _, i = 0 } } return i > 0 && (r += ".incomplete"), r } , e }(), O = function() { function e(e, t, n, r, o) { if (!(r instanceof M)) throw new Error("Invalid tag value."); this.stream = e, this.header = t, this.length = n, this.tag = r, this.sub = o } return e.prototype.typeName = function() { switch (this.tag.tagClass) { case 0: switch (this.tag.tagNumber) { case 0: return "EOC"; case 1: return "BOOLEAN"; case 2: return "INTEGER"; case 3: return "BIT_STRING"; case 4: return "OCTET_STRING"; case 5: return "NULL"; case 6: return "OBJECT_IDENTIFIER"; case 7: return "ObjectDescriptor"; case 8: return "EXTERNAL"; case 9: return "REAL"; case 10: return "ENUMERATED"; case 11: return "EMBEDDED_PDV"; case 12: return "UTF8String"; case 16: return "SEQUENCE"; case 17: return "SET"; case 18: return "NumericString"; case 19: return "PrintableString"; case 20: return "TeletexString"; case 21: return "VideotexString"; case 22: return "IA5String"; case 23: return "UTCTime"; case 24: return "GeneralizedTime"; case 25: return "GraphicString"; case 26: return "VisibleString"; case 27: return "GeneralString"; case 28: return "UniversalString"; case 30: return "BMPString" } return "Universal_" + this.tag.tagNumber.toString(); case 1: return "Application_" + this.tag.tagNumber.toString(); case 2: return "[" + this.tag.tagNumber.toString() + "]"; case 3: return "Private_" + this.tag.tagNumber.toString() } } , e.prototype.content = function(e) { if (void 0 === this.tag) return null; void 0 === e && (e = 1 / 0); var t = this.posContent() , n = Math.abs(this.length); if (!this.tag.isUniversal()) return null !== this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(t, t + n, e); switch (this.tag.tagNumber) { case 1: return 0 === this.stream.get(t) ? "false" : "true"; case 2: return this.stream.parseInteger(t, t + n); case 3: return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseBitString(t, t + n, e); case 4: return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(t, t + n, e); case 6: return this.stream.parseOID(t, t + n, e); case 16: case 17: return null !== this.sub ? "(" + this.sub.length + " elem)" : "(no elem)"; case 12: return S(this.stream.parseStringUTF(t, t + n), e); case 18: case 19: case 20: case 21: case 22: case 26: return S(this.stream.parseStringISO(t, t + n), e); case 30: return S(this.stream.parseStringBMP(t, t + n), e); case 23: case 24: return this.stream.parseTime(t, t + n, 23 == this.tag.tagNumber) } return null } , e.prototype.toString = function() { return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (null === this.sub ? "null" : this.sub.length) + "]" } , e.prototype.toPrettyString = function(e) { void 0 === e && (e = ""); var t = e + this.typeName() + " @" + this.stream.pos; if (this.length >= 0 && (t += "+"), t += this.length, this.tag.tagConstructed ? t += " (constructed)" : !this.tag.isUniversal() || 3 != this.tag.tagNumber && 4 != this.tag.tagNumber || null === this.sub || (t += " (encapsulates)"), t += "\n", null !== this.sub) { e += " "; for (var n = 0, r = this.sub.length; n 6) throw new Error("Length over 48 bits not supported at position " + (e.pos - 1)); if (0 === n) return null; t = 0; for (var r = 0; r > 6, this.tagConstructed = 0 !== (32 & t), this.tagNumber = 31 & t, 31 == this.tagNumber) { var n = new _; do { t = e.get(), n.mulAdd(128, 127 & t) } while (128 & t); this.tagNumber = n.simplify() } } return e.prototype.isUniversal = function() { return 0 === this.tagClass } , e.prototype.isEOC = function() { return 0 === this.tagClass && 0 === this.tagNumber } , e }(), T = 0xdeadbeefcafe, P = 15715070 == (16777215 & T), L = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997], z = (1 > l) > 0 && (i = !0, a = o(n)); while (s >= 0) l > (l -= t) & r, l 0 && (i = !0), i && (a += o(n)) } return i ? a : "0" } , e.prototype.negate = function() { var t = R(); return e.ZERO.subTo(this, t), t } , e.prototype.abs = function() { return this.s = 0) if (0 != (t = this[n] - e[n])) return t; return 0 } , e.prototype.bitLength = function() { return this.t 0 && t.subTo(n, n), n } , e.prototype.modPowInt = function(e, t) { var n; return n = e r) != (this.s & this.DM) >> r && (t[o++] = n | this.s = 0) r > (r -= 8) & 255, r 0 || n != this.s) && (t[o++] = n) } return t } , e.prototype.equals = function(e) { return 0 == this.compareTo(e) } , e.prototype.min = function(e) { return this.compareTo(e) 0 ? this : e } , e.prototype.and = function(e) { var t = R(); return this.bitwiseTo(e, i, t), t } , e.prototype.or = function(e) { var t = R(); return this.bitwiseTo(e, a, t), t } , e.prototype.xor = function(e) { var t = R(); return this.bitwiseTo(e, s, t), t } , e.prototype.andNot = function(e) { var t = R(); return this.bitwiseTo(e, l, t), t } , e.prototype.not = function() { for (var e = R(), t = 0; t = this.t ? 0 != this.s : 0 != (this[t] & 1 > o - l & c : (d = (e[f] & (1 > this.DB + o - l)), s = n; while (0 == (1 & d)) d >>= 1, --s; if ((o -= s) 1) r.sqrTo(i, m), r.sqrTo(m, i), s -= 2; s > 0 ? r.sqrTo(i, m) : (h = i, i = m, m = h), r.mulTo(m, a[d], i) } while (f >= 0 && 0 == (e[f] & 1 = 0 ? (r.subTo(o, r), n && i.subTo(s, i), a.subTo(l, a)) : (o.subTo(r, o), n && s.subTo(i, s), l.subTo(a, l)) } return 0 != o.compareTo(e.ONE) ? e.ZERO : l.compareTo(t) >= 0 ? l.subtract(t) : l.signum() 0 && (t.rShiftTo(i, t), n.rShiftTo(i, n)); while (t.signum() > 0) (o = t.getLowestSetBit()) > 0 && t.rShiftTo(o, t), (o = n.getLowestSetBit()) > 0 && n.rShiftTo(o, n), t.compareTo(n) >= 0 ? (t.subTo(n, t), t.rShiftTo(1, t)) : (n.subTo(t, n), n.rShiftTo(1, n)); return i > 0 && n.lShiftTo(i, n), n } , e.prototype.isProbablePrime = function(e) { var t, n = this.abs(); if (1 == n.t && n[0] = 0; --t) e[t] = this[t]; e.t = this.t, e.s = this.s } , e.prototype.fromInt = function(e) { this.t = 1, this.s = e 0 ? this[0] = e : e = 0) { var s = 8 == r ? 255 & +t[o] : K(t, o); s this.DB ? (this[this.t - 1] |= (s & (1 this.DB - a) : this[this.t - 1] |= s = this.DB && (a -= this.DB)) } 8 == r && 0 != (128 & +t[0]) && (this.s = -1, a > 0 && (this[this.t - 1] |= (1 = 0; --n) t[n + e] = this[n]; for (n = e - 1; n >= 0; --n) t[n] = 0; t.t = this.t + e, t.s = this.s } , e.prototype.drShiftTo = function(e, t) { for (var n = e; n r | a, a = (this[s] & o) = 0; --s) t[s] = 0; t[i] = a, t.t = this.t + i + 1, t.s = this.s, t.clamp() } , e.prototype.rShiftTo = function(e, t) { t.s = this.s; var n = Math.floor(e / this.DB); if (n >= this.t) t.t = 0; else { var r = e % this.DB , o = this.DB - r , i = (1 > r; for (var a = n + 1; a r; r > 0 && (t[this.t - n - 1] |= (this.s & i) >= this.DB; if (e.t >= this.DB; r += this.s } else { r += this.s; while (n >= this.DB; r -= e.s } t.s = r 0 && (t[n++] = r), t.t = n, t.clamp() } , e.prototype.multiplyTo = function(t, n) { var r = this.abs() , o = t.abs() , i = r.t; n.t = i + o.t; while (--i >= 0) n[i] = 0; for (i = 0; i = 0) e[n] = 0; for (n = 0; n = t.DV && (e[n + t.t] -= t.DV, e[n + t.t + 1] = 1) } e.t > 0 && (e[e.t - 1] += t.am(n, t[n], e, 2 * n, 0, 1)), e.s = 0, e.clamp() } , e.prototype.divRemTo = function(t, n, r) { var o = t.abs(); if (!(o.t 0 ? (o.lShiftTo(c, a), i.lShiftTo(c, r)) : (o.copyTo(a), i.copyTo(r)); var u = a.t , d = a[u - 1]; if (0 != d) { var h = d * (1 1 ? a[u - 2] >> this.F2 : 0) , f = this.FV / h , p = (1 = 0) { var y = r[--v] == d ? this.DM : Math.floor(r[v] * f + (r[v - 1] + m) * p); if ((r[v] += a.am(0, y, r, g, 0, u)) 0 && r.rShiftTo(c, r), s 0 ? this.DV - t : -t } , e.prototype.isEven = function() { return 0 == (this.t > 0 ? 1 & this[0] : this.s) } , e.prototype.exp = function(t, n) { if (t > 4294967295 || t = 0) if (n.sqrTo(r, o), (t & 1 0) n.mulTo(o, i, r); else { var s = r; r = o, o = s } return n.revert(r) } , e.prototype.chunkSize = function(e) { return Math.floor(Math.LN2 * this.DB / Math.log(e)) } , e.prototype.toRadix = function(e) { if (null == e && (e = 10), 0 == this.signum() || e 36) return "0"; var t = this.chunkSize(e) , n = Math.pow(e, t) , r = W(n) , o = R() , i = R() , a = ""; this.divRemTo(r, o, i); while (o.signum() > 0) a = (n + i.intValue()).toString(e).substr(1) + a, o.divRemTo(r, o, i); return i.intValue().toString(e) + a } , e.prototype.fromRadix = function(t, n) { this.fromInt(0), null == n && (n = 10); for (var r = this.chunkSize(n), o = Math.pow(n, r), i = !1, a = 0, s = 0, l = 0; l = r && (this.dMultiply(o), this.dAddOffset(s, 0), a = 0, s = 0)) } a > 0 && (this.dMultiply(Math.pow(n, a)), this.dAddOffset(s, 0)), i && e.ZERO.subTo(this, this) } , e.prototype.fromNumber = function(t, n, r) { if ("number" == typeof n) if (t t && this.subTo(e.ONE.shiftLeft(t - 1), this) } else { var o = [] , i = 7 & t; o.length = 1 + (t >> 3), n.nextBytes(o), i > 0 ? o[0] &= (1 >= this.DB; if (e.t >= this.DB; r += this.s } else { r += this.s; while (n >= this.DB; r += e.s } t.s = r 0 ? t[n++] = r : r = this.t && (this[this.t++] = 0), ++this[t] } } , e.prototype.multiplyLowerTo = function(e, t, n) { var r = Math.min(this.t + e.t, t); n.s = 0, n.t = r; while (r > 0) n[--r] = 0; for (var o = n.t - this.t; r = 0) n[r] = 0; for (r = Math.max(t - this.t, 0); r = 0; --r) n = (t * n + this[r]) % e; return n } , e.prototype.millerRabin = function(t) { var n = this.subtract(e.ONE) , r = n.getLowestSetBit(); if (r > 1, t > L.length && (t = L.length); for (var i = R(), a = 0; a 0 && (n.rShiftTo(a, n), r.rShiftTo(a, r)); var s = function() { (i = n.getLowestSetBit()) > 0 && n.rShiftTo(i, n), (i = r.getLowestSetBit()) > 0 && r.rShiftTo(i, r), n.compareTo(r) >= 0 ? (n.subTo(r, n), n.rShiftTo(1, n)) : (r.subTo(n, r), r.rShiftTo(1, r)), n.signum() > 0 ? setTimeout(s, 0) : (a > 0 && r.lShiftTo(a, r), setTimeout((function() { t(r) } ), 0)) }; setTimeout(s, 10) } } , e.prototype.fromNumberAsync = function(t, n, r, o) { if ("number" == typeof n) if (t t && i.subTo(e.ONE.shiftLeft(t - 1), i), i.isProbablePrime(n) ? setTimeout((function() { o() } ), 0) : setTimeout(s, 0) }; setTimeout(s, 0) } else { var l = [] , c = 7 & t; l.length = 1 + (t >> 3), n.nextBytes(l), c > 0 ? l[0] &= (1 = 0 ? e.mod(this.m) : e } , e.prototype.revert = function(e) { return e } , e.prototype.reduce = function(e) { e.divRemTo(this.m, null, e) } , e.prototype.mulTo = function(e, t, n) { e.multiplyTo(t, n), this.reduce(n) } , e.prototype.sqrTo = function(e, t) { e.squareTo(t), this.reduce(t) } , e }(), A = function() { function e(e) { this.m = e, this.mp = e.invDigit(), this.mpl = 32767 & this.mp, this.mph = this.mp >> 15, this.um = (1 0 && this.m.subTo(t, t), t } , e.prototype.revert = function(e) { var t = R(); return e.copyTo(t), this.reduce(t), t } , e.prototype.reduce = function(e) { while (e.t > 15) * this.mpl & this.um) = e.DV) e[n] -= e.DV, e[++n]++ } e.clamp(), e.drShiftTo(this.m.t, e), e.compareTo(this.m) >= 0 && e.subTo(this.m, e) } , e.prototype.mulTo = function(e, t, n) { e.multiplyTo(t, n), this.reduce(n) } , e.prototype.sqrTo = function(e, t) { e.squareTo(t), this.reduce(t) } , e }(), V = function() { function e(e) { this.m = e, this.r2 = R(), this.q3 = R(), D.ONE.dlShiftTo(2 * e.t, this.r2), this.mu = this.r2.divide(e) } return e.prototype.convert = function(e) { if (e.s 2 * this.m.t) return e.mod(this.m); if (e.compareTo(this.m) this.m.t + 1 && (e.t = this.m.t + 1, e.clamp()), this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); while (e.compareTo(this.r2) = 0) e.subTo(this.m, e) } , e.prototype.mulTo = function(e, t, n) { e.multiplyTo(t, n), this.reduce(n) } , e.prototype.sqrTo = function(e, t) { e.squareTo(t), this.reduce(t) } , e }(); function R() { return new D(null) } function I(e, t) { return new D(e,t) } var F = "undefined" !== typeof navigator; F && P && "Microsoft Internet Explorer" == navigator.appName ? (D.prototype.am = function(e, t, n, r, o, i) { var a = 32767 & t , s = t >> 15; while (--i >= 0) { var l = 32767 & this[e] , c = this[e++] >> 15 , u = s * l + c * a; l = a * l + ((32767 & u) >> 30) + (u >>> 15) + s * c + (o >>> 30), n[r++] = 1073741823 & l } return o } , j = 30) : F && P && "Netscape" != navigator.appName ? (D.prototype.am = function(e, t, n, r, o, i) { while (--i >= 0) { var a = t * this[e++] + n[r] + o; o = Math.floor(a / 67108864), n[r++] = 67108863 & a } return o } , j = 26) : (D.prototype.am = function(e, t, n, r, o, i) { var a = 16383 & t , s = t >> 14; while (--i >= 0) { var l = 16383 & this[e] , c = this[e++] >> 14 , u = s * l + c * a; l = a * l + ((16383 & u) > 28) + (u >> 14) + s * c, n[r++] = 268435455 & l } return o } , j = 28), D.prototype.DB = j, D.prototype.DM = (1 16) && (e = t, n += 16), 0 != (t = e >> 8) && (e = t, n += 8), 0 != (t = e >> 4) && (e = t, n += 4), 0 != (t = e >> 2) && (e = t, n += 2), 0 != (t = e >> 1) && (e = t, n += 1), n } D.ZERO = W(0), D.ONE = W(1); var q = function() { function e() { this.i = 0, this.j = 0, this.S = [] } return e.prototype.init = function(e) { var t, n, r; for (t = 0; t = 256 || J >= Z) window.removeEventListener ? window.removeEventListener("mousemove", re, !1) : window.detachEvent && window.detachEvent("onmousemove", re); else try { var t = e.x + e.y; Q[J++] = 255 & t, ne += 1 } catch (n) {} }; window.addEventListener ? window.addEventListener("mousemove", re, !1) : window.attachEvent && window.attachEvent("onmousemove", re) } function oe() { if (null == X) { X = G(); while (J = 0 && t > 0) { var o = e.charCodeAt(r--); o 127 && o > 6 | 192) : (n[--t] = 63 & o | 128, n[--t] = o >> 6 & 63 | 128, n[--t] = o >> 12 | 224) } n[--t] = 0; var i = new ie , a = []; while (t > 2) { a[0] = 0; while (0 == a[0]) i.nextBytes(a); n[--t] = a[0] } return n[--t] = 2, n[--t] = 0, new D(n) } var le = function() { function e() { this.n = null, this.e = 0, this.d = null, this.p = null, this.q = null, this.dmp1 = null, this.dmq1 = null, this.coeff = null } return e.prototype.doPublic = function(e) { return e.modPowInt(this.e, this.n) } , e.prototype.doPrivate = function(e) { if (null == this.p || null == this.q) return e.modPow(this.d, this.n); var t = e.mod(this.p).modPow(this.dmp1, this.p) , n = e.mod(this.q).modPow(this.dmq1, this.q); while (t.compareTo(n) 0 && t.length > 0 ? (this.n = I(e, 16), this.e = parseInt(t, 16)) : console.error("Invalid RSA public key") } , e.prototype.encrypt = function(e) { var t = this.n.bitLength() + 7 >> 3 , n = se(e, t); if (null == n) return null; var r = this.doPublic(n); if (null == r) return null; for (var o = r.toString(16), i = o.length, a = 0; a 0 && t.length > 0 ? (this.n = I(e, 16), this.e = parseInt(t, 16), this.d = I(n, 16)) : console.error("Invalid RSA private key") } , e.prototype.setPrivateEx = function(e, t, n, r, o, i, a, s) { null != e && null != t && e.length > 0 && t.length > 0 ? (this.n = I(e, 16), this.e = parseInt(t, 16), this.d = I(n, 16), this.p = I(r, 16), this.q = I(o, 16), this.dmp1 = I(i, 16), this.dmq1 = I(a, 16), this.coeff = I(s, 16)) : console.error("Invalid RSA private key") } , e.prototype.generate = function(e, t) { var n = new ie , r = e >> 1; this.e = parseInt(t, 16); for (var o = new D(t,16); ; ) { for (; ; ) if (this.p = new D(e - r,1,n), 0 == this.p.subtract(D.ONE).gcd(o).compareTo(D.ONE) && this.p.isProbablePrime(10)) break; for (; ; ) if (this.q = new D(r,1,n), 0 == this.q.subtract(D.ONE).gcd(o).compareTo(D.ONE) && this.q.isProbablePrime(10)) break; if (this.p.compareTo(this.q) > 3) } , e.prototype.generateAsync = function(e, t, n) { var r = new ie , o = e >> 1; this.e = parseInt(t, 16); var i = new D(t,16) , a = this , s = function() { var t = function() { if (a.p.compareTo(a.q) = n.length) return null; var o = ""; while (++r 191 && i
文章版权声明:除非注明,否则均为VPS857原创文章,转载或复制请以超链接形式并注明出处。
还没有评论,来说两句吧...