diff --git a/LICENSE-3RD-PARTY.md b/LICENSE-3RD-PARTY.md index a44bb45..9c89449 100644 --- a/LICENSE-3RD-PARTY.md +++ b/LICENSE-3RD-PARTY.md @@ -53,9 +53,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------------- jsencrypt -File: src/LICENSE.txt +File: /src/LICENSE.txt The MIT License (MIT) -Copyright (c) 2013 AllPlayers.com +Copyright (c) 2015 Form.io Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the @@ -74,8 +74,7 @@ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTIO OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -File: lib/jsrsasign/LICENSE.txt +File: /lib/jsrsasign/LICENSE.txt CONTAINS CODE FROM YUI LIBRARY SEE LICENSE @ http://yuilibrary.com/license/ @@ -101,47 +100,50 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +File: /lib/jsbn/LICENSE.txt -File: lib/jsbn/LICENSE.txt +Licensing +--------- This software is covered under the following copyright: -Copyright (c) 2003-2005 Tom Wu -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, -EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY -WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. -IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, -INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER -RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF -THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT -OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -In addition, the following condition applies: -All redistributions must retain an intact copy of this copyright notice -and disclaimer. - +/* + * Copyright (c) 2003-2005 Tom Wu + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER + * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF + * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * In addition, the following condition applies: + * + * All redistributions must retain an intact copy of this copyright notice + * and disclaimer. + */ Address all questions regarding this license to: -Tom Wu -tjw@cs.Stanford.EDU - - -File: lib/asn1js/LICENSE.txt + Tom Wu + tjw@cs.Stanford.EDU +File: /lib/asn1js/LICENSE.txt ASN.1 JavaScript decoder diff --git a/tpayLibs/src/View/JS/jsencrypt.min.js b/tpayLibs/src/View/JS/jsencrypt.min.js index d525906..b36656c 100644 --- a/tpayLibs/src/View/JS/jsencrypt.min.js +++ b/tpayLibs/src/View/JS/jsencrypt.min.js @@ -1,1069 +1,2 @@ -var JSEncryptExports = {}; -(function (T) { - function e(a, b, c) { - null != a && ("number" == typeof a ? this.fromNumber(a, b, c) : null == b && "string" != typeof a ? this.fromString(a, 256) : this.fromString(a, b)) - } - - function l() { - return new e(null) - } - - function U(a, b, c, d, f, e) { - for (; 0 <= --e;) { - var g = b * this[a++] + c[d] + f; - f = Math.floor(g / 67108864); - c[d++] = g & 67108863 - } - return f - } - - function V(a, b, c, d, f, e) { - var g = b & 32767; - for (b >>= 15; 0 <= --e;) { - var h = this[a] & 32767, l = this[a++] >> 15, k = b * h + l * g, h = g * h + ((k & 32767) << 15) + c[d] + (f & 1073741823); - f = (h >>> 30) + (k >>> 15) + b * l + (f >>> 30); - c[d++] = h & 1073741823 - } - return f - } - - function W(a, b, c, d, f, e) { - var g = b & 16383; - for (b >>= 14; 0 <= --e;) { - var h = this[a] & 16383, l = this[a++] >> 14, k = b * h + l * g, h = g * h + ((k & 16383) << 14) + c[d] + f; - f = (h >> 28) + (k >> 14) + b * l; - c[d++] = h & 268435455 - } - return f - } - - function N(a, b) { - var c = F[a.charCodeAt(b)]; - return null == c ? -1 : c - } - - function w(a) { - var b = l(); - b.fromInt(a); - return b - } - - function G(a) { - var b = 1, c; - if (0 != (c = a >>> 16))a = c, b += 16; - if (0 != (c = a >> 8))a = c, b += 8; - if (0 != (c = a >> 4))a = c, b += 4; - if (0 != (c = a >> 2))a = c, b += 2; - 0 != a >> 1 && (b += 1); - return b - } - - function y(a) { - this.m = a - } - - function z(a) { - this.m = a; - this.mp = a.invDigit(); - this.mpl = this.mp & 32767; - this.mph = this.mp >> 15; - this.um = (1 << a.DB - 15) - 1; - this.mt2 = 2 * a.t - } - - function X(a, b) { - return a & b - } - - function I(a, b) { - return a | b - } - - function O(a, b) { - return a ^ b - } - - function P(a, b) { - return a & ~b - } - - function E() { - } - - function Q(a) { - return a - } - - function B(a) { - this.r2 = l(); - this.q3 = l(); - e.ONE.dlShiftTo(2 * a.t, this.r2); - this.mu = this.r2.divide(a); - this.m = a - } - - function J() { - this.j = this.i = 0; - this.S = [] - } - - function R(a) { - s[m++] ^= a & 255; - s[m++] ^= a >> 8 & 255; - s[m++] ^= a >> 16 & 255; - s[m++] ^= a >> 24 & 255; - m >= K && (m -= K) - } - - function L() { - } - - function t(a, b) { - return new e(a, - b) - } - - function p() { - this.n = null; - this.e = 0; - this.coeff = this.dmq1 = this.dmp1 = this.q = this.p = this.d = null - } - - function M(a) { - var b, c, d = ""; - for (b = 0; b + 3 <= a.length; b += 3)c = parseInt(a.substring(b, b + 3), 16), d += C.charAt(c >> 6) + C.charAt(c & 63); - b + 1 == a.length ? (c = parseInt(a.substring(b, b + 1), 16), d += C.charAt(c << 2)) : b + 2 == a.length && (c = parseInt(a.substring(b, b + 2), 16), d += C.charAt(c >> 2) + C.charAt((c & 3) << 4)); - for (; 0 < (d.length & 3);)d += S; - return d - } - - function Y(a) { - var b = "", c, d = 0, f; - for (c = 0; c < a.length && a.charAt(c) != S; ++c)v = C.indexOf(a.charAt(c)), - 0 > v || (0 == d ? (b += u.charAt(v >> 2), f = v & 3, d = 1) : 1 == d ? (b += u.charAt(f << 2 | v >> 4), f = v & 15, d = 2) : 2 == d ? (b += u.charAt(f), b += u.charAt(v >> 2), f = v & 3, d = 3) : (b += u.charAt(f << 2 | v >> 4), b += u.charAt(v & 15), d = 0)); - 1 == d && (b += u.charAt(f << 2)); - return b - } - - var k; - "Microsoft Internet Explorer" == navigator.appName ? (e.prototype.am = V, k = 30) : "Netscape" != navigator.appName ? (e.prototype.am = U, k = 26) : (e.prototype.am = W, k = 28); - e.prototype.DB = k; - e.prototype.DM = (1 << k) - 1; - e.prototype.DV = 1 << k; - e.prototype.FV = Math.pow(2, 52); - e.prototype.F1 = 52 - k; - e.prototype.F2 = 2 * k - - 52; - var u = "0123456789abcdefghijklmnopqrstuvwxyz", F = [], n; - k = 48; - for (n = 0; 9 >= n; ++n)F[k++] = n; - k = 97; - for (n = 10; 36 > n; ++n)F[k++] = n; - k = 65; - for (n = 10; 36 > n; ++n)F[k++] = n; - y.prototype.convert = function (a) { - return 0 > a.s || 0 <= a.compareTo(this.m) ? a.mod(this.m) : a - }; - y.prototype.revert = function (a) { - return a - }; - y.prototype.reduce = function (a) { - a.divRemTo(this.m, null, a) - }; - y.prototype.mulTo = function (a, b, c) { - a.multiplyTo(b, c); - this.reduce(c) - }; - y.prototype.sqrTo = function (a, b) { - a.squareTo(b); - this.reduce(b) - }; - z.prototype.convert = function (a) { - var b = - l(); - a.abs().dlShiftTo(this.m.t, b); - b.divRemTo(this.m, null, b); - 0 > a.s && 0 < b.compareTo(e.ZERO) && this.m.subTo(b, b); - return b - }; - z.prototype.revert = function (a) { - var b = l(); - a.copyTo(b); - this.reduce(b); - return b - }; - z.prototype.reduce = function (a) { - for (; a.t <= this.mt2;)a[a.t++] = 0; - for (var b = 0; b < this.m.t; ++b) { - var c = a[b] & 32767, d = c * this.mpl + ((c * this.mph + (a[b] >> 15) * this.mpl & this.um) << 15) & a.DM, c = b + this.m.t; - for (a[c] += this.m.am(0, d, a, b, 0, this.m.t); a[c] >= a.DV;)a[c] -= a.DV, a[++c]++ - } - a.clamp(); - a.drShiftTo(this.m.t, a); - 0 <= a.compareTo(this.m) && - a.subTo(this.m, a) - }; - z.prototype.mulTo = function (a, b, c) { - a.multiplyTo(b, c); - this.reduce(c) - }; - z.prototype.sqrTo = function (a, b) { - a.squareTo(b); - this.reduce(b) - }; - e.prototype.copyTo = function (a) { - for (var b = this.t - 1; 0 <= b; --b)a[b] = this[b]; - a.t = this.t; - a.s = this.s - }; - e.prototype.fromInt = function (a) { - this.t = 1; - this.s = 0 > a ? -1 : 0; - 0 < a ? this[0] = a : -1 > a ? this[0] = a + DV : this.t = 0 - }; - e.prototype.fromString = function (a, b) { - var c; - if (16 == b)c = 4; else if (8 == b)c = 3; else if (256 == b)c = 8; else if (2 == b)c = 1; else if (32 == b)c = 5; else if (4 == b)c = 2; else { - this.fromRadix(a, - b); - return - } - this.s = this.t = 0; - for (var d = a.length, f = !1, j = 0; 0 <= --d;) { - var g = 8 == c ? a[d] & 255 : N(a, d); - 0 > g ? "-" == a.charAt(d) && (f = !0) : (f = !1, 0 == j ? this[this.t++] = g : j + c > this.DB ? (this[this.t - 1] |= (g & (1 << this.DB - j) - 1) << j, this[this.t++] = g >> this.DB - j) : this[this.t - 1] |= g << j, j += c, j >= this.DB && (j -= this.DB)) - } - 8 == c && 0 != (a[0] & 128) && (this.s = -1, 0 < j && (this[this.t - 1] |= (1 << this.DB - j) - 1 << j)); - this.clamp(); - f && e.ZERO.subTo(this, this) - }; - e.prototype.clamp = function () { - for (var a = this.s & this.DM; 0 < this.t && this[this.t - 1] == a;)--this.t - }; - e.prototype.dlShiftTo = - function (a, b) { - var c; - for (c = this.t - 1; 0 <= c; --c)b[c + a] = this[c]; - for (c = a - 1; 0 <= c; --c)b[c] = 0; - b.t = this.t + a; - b.s = this.s - }; - e.prototype.drShiftTo = function (a, b) { - for (var c = a; c < this.t; ++c)b[c - a] = this[c]; - b.t = Math.max(this.t - a, 0); - b.s = this.s - }; - e.prototype.lShiftTo = function (a, b) { - var c = a % this.DB, d = this.DB - c, f = (1 << d) - 1, e = Math.floor(a / this.DB), g = this.s << c & this.DM, h; - for (h = this.t - 1; 0 <= h; --h)b[h + e + 1] = this[h] >> d | g, g = (this[h] & f) << c; - for (h = e - 1; 0 <= h; --h)b[h] = 0; - b[e] = g; - b.t = this.t + e + 1; - b.s = this.s; - b.clamp() - }; - e.prototype.rShiftTo = function (a, - b) { - b.s = this.s; - var c = Math.floor(a / this.DB); - if (c >= this.t)b.t = 0; else { - var d = a % this.DB, f = this.DB - d, e = (1 << d) - 1; - b[0] = this[c] >> d; - for (var g = c + 1; g < this.t; ++g)b[g - c - 1] |= (this[g] & e) << f, b[g - c] = this[g] >> d; - 0 < d && (b[this.t - c - 1] |= (this.s & e) << f); - b.t = this.t - c; - b.clamp() - } - }; - e.prototype.subTo = function (a, b) { - for (var c = 0, d = 0, f = Math.min(a.t, this.t); c < f;)d += this[c] - a[c], b[c++] = d & this.DM, d >>= this.DB; - if (a.t < this.t) { - for (d -= a.s; c < this.t;)d += this[c], b[c++] = d & this.DM, d >>= this.DB; - d += this.s - } else { - for (d += this.s; c < a.t;)d -= a[c], b[c++] = d & - this.DM, d >>= this.DB; - d -= a.s - } - b.s = 0 > d ? -1 : 0; - -1 > d ? b[c++] = this.DV + d : 0 < d && (b[c++] = d); - b.t = c; - b.clamp() - }; - e.prototype.multiplyTo = function (a, b) { - var c = this.abs(), d = a.abs(), f = c.t; - for (b.t = f + d.t; 0 <= --f;)b[f] = 0; - for (f = 0; f < d.t; ++f)b[f + c.t] = c.am(0, d[f], b, f, 0, c.t); - b.s = 0; - b.clamp(); - this.s != a.s && e.ZERO.subTo(b, b) - }; - e.prototype.squareTo = function (a) { - for (var b = this.abs(), c = a.t = 2 * b.t; 0 <= --c;)a[c] = 0; - for (c = 0; c < b.t - 1; ++c) { - var d = b.am(c, b[c], a, 2 * c, 0, 1); - if ((a[c + b.t] += b.am(c + 1, 2 * b[c], a, 2 * c + 1, d, b.t - c - 1)) >= b.DV)a[c + b.t] -= b.DV, a[c + b.t + - 1] = 1 - } - 0 < a.t && (a[a.t - 1] += b.am(c, b[c], a, 2 * c, 0, 1)); - a.s = 0; - a.clamp() - }; - e.prototype.divRemTo = function (a, b, c) { - var d = a.abs(); - if (!(0 >= d.t)) { - var f = this.abs(); - if (f.t < d.t)null != b && b.fromInt(0), null != c && this.copyTo(c); else { - null == c && (c = l()); - var j = l(), g = this.s; - a = a.s; - var h = this.DB - G(d[d.t - 1]); - 0 < h ? (d.lShiftTo(h, j), f.lShiftTo(h, c)) : (d.copyTo(j), f.copyTo(c)); - d = j.t; - f = j[d - 1]; - if (0 != f) { - var k = f * (1 << this.F1) + (1 < d ? j[d - 2] >> this.F2 : 0), p = this.FV / k, k = (1 << this.F1) / k, m = 1 << this.F2, A = c.t, n = A - d, r = null == b ? l() : b; - j.dlShiftTo(n, r); - 0 <= c.compareTo(r) && - (c[c.t++] = 1, c.subTo(r, c)); - e.ONE.dlShiftTo(d, r); - for (r.subTo(j, j); j.t < d;)j[j.t++] = 0; - for (; 0 <= --n;) { - var q = c[--A] == f ? this.DM : Math.floor(c[A] * p + (c[A - 1] + m) * k); - if ((c[A] += j.am(0, q, c, n, 0, d)) < q) { - j.dlShiftTo(n, r); - for (c.subTo(r, c); c[A] < --q;)c.subTo(r, c) - } - } - null != b && (c.drShiftTo(d, b), g != a && e.ZERO.subTo(b, b)); - c.t = d; - c.clamp(); - 0 < h && c.rShiftTo(h, c); - 0 > g && e.ZERO.subTo(c, c) - } - } - } - }; - e.prototype.invDigit = function () { - if (1 > this.t)return 0; - var a = this[0]; - if (0 == (a & 1))return 0; - var b = a & 3, b = b * (2 - (a & 15) * b) & 15, b = b * (2 - (a & 255) * b) & 255, b = b * - (2 - ((a & 65535) * b & 65535)) & 65535, b = b * (2 - a * b % this.DV) % this.DV; - return 0 < b ? this.DV - b : -b - }; - e.prototype.isEven = function () { - return 0 == (0 < this.t ? this[0] & 1 : this.s) - }; - e.prototype.exp = function (a, b) { - if (4294967295 < a || 1 > a)return e.ONE; - var c = l(), d = l(), f = b.convert(this), j = G(a) - 1; - for (f.copyTo(c); 0 <= --j;)if (b.sqrTo(c, d), 0 < (a & 1 << j))b.mulTo(d, f, c); else var g = c, c = d, d = g; - return b.revert(c) - }; - e.prototype.toString = function (a) { - if (0 > this.s)return "-" + this.negate().toString(a); - if (16 == a)a = 4; else if (8 == a)a = 3; else if (2 == a)a = 1; else if (32 == - a)a = 5; else if (4 == a)a = 2; else return this.toRadix(a); - var b = (1 << a) - 1, c, d = !1, f = "", e = this.t, g = this.DB - e * this.DB % a; - if (0 < e--) { - if (g < this.DB && 0 < (c = this[e] >> g))d = !0, f = u.charAt(c); - for (; 0 <= e;)g < a ? (c = (this[e] & (1 << g) - 1) << a - g, c |= this[--e] >> (g += this.DB - a)) : (c = this[e] >> (g -= a) & b, 0 >= g && (g += this.DB, --e)), 0 < c && (d = !0), d && (f += u.charAt(c)) - } - return d ? f : "0" - }; - e.prototype.negate = function () { - var a = l(); - e.ZERO.subTo(this, a); - return a - }; - e.prototype.abs = function () { - return 0 > this.s ? this.negate() : this - }; - e.prototype.compareTo = function (a) { - var b = - this.s - a.s; - if (0 != b)return b; - var c = this.t, b = c - a.t; - if (0 != b)return 0 > this.s ? -b : b; - for (; 0 <= --c;)if (0 != (b = this[c] - a[c]))return b; - return 0 - }; - e.prototype.bitLength = function () { - return 0 >= this.t ? 0 : this.DB * (this.t - 1) + G(this[this.t - 1] ^ this.s & this.DM) - }; - e.prototype.mod = function (a) { - var b = l(); - this.abs().divRemTo(a, null, b); - 0 > this.s && 0 < b.compareTo(e.ZERO) && a.subTo(b, b); - return b - }; - e.prototype.modPowInt = function (a, b) { - var c; - c = 256 > a || b.isEven() ? new y(b) : new z(b); - return this.exp(a, c) - }; - e.ZERO = w(0); - e.ONE = w(1); - E.prototype.convert = - Q; - E.prototype.revert = Q; - E.prototype.mulTo = function (a, b, c) { - a.multiplyTo(b, c) - }; - E.prototype.sqrTo = function (a, b) { - a.squareTo(b) - }; - B.prototype.convert = function (a) { - if (0 > a.s || a.t > 2 * this.m.t)return a.mod(this.m); - if (0 > a.compareTo(this.m))return a; - var b = l(); - a.copyTo(b); - this.reduce(b); - return b - }; - B.prototype.revert = function (a) { - return a - }; - B.prototype.reduce = function (a) { - a.drShiftTo(this.m.t - 1, this.r2); - a.t > this.m.t + 1 && (a.t = this.m.t + 1, a.clamp()); - this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3); - for (this.m.multiplyLowerTo(this.q3, - this.m.t + 1, this.r2); 0 > a.compareTo(this.r2);)a.dAddOffset(1, this.m.t + 1); - for (a.subTo(this.r2, a); 0 <= a.compareTo(this.m);)a.subTo(this.m, a) - }; - B.prototype.mulTo = function (a, b, c) { - a.multiplyTo(b, c); - this.reduce(c) - }; - B.prototype.sqrTo = function (a, b) { - a.squareTo(b); - this.reduce(b) - }; - var q = [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 = 67108864 / q[q.length - 1]; - e.prototype.chunkSize = function (a) { - return Math.floor(Math.LN2 * - this.DB / Math.log(a)) - }; - e.prototype.toRadix = function (a) { - null == a && (a = 10); - if (0 == this.signum() || 2 > a || 36 < a)return "0"; - var b = this.chunkSize(a), b = Math.pow(a, b), c = w(b), d = l(), f = l(), e = ""; - for (this.divRemTo(c, d, f); 0 < d.signum();)e = (b + f.intValue()).toString(a).substr(1) + e, d.divRemTo(c, d, f); - return f.intValue().toString(a) + e - }; - e.prototype.fromRadix = function (a, b) { - this.fromInt(0); - null == b && (b = 10); - for (var c = this.chunkSize(b), d = Math.pow(b, c), f = !1, j = 0, g = 0, h = 0; h < a.length; ++h) { - var l = N(a, h); - 0 > l ? "-" == a.charAt(h) && 0 == this.signum() && - (f = !0) : (g = b * g + l, ++j >= c && (this.dMultiply(d), this.dAddOffset(g, 0), g = j = 0)) - } - 0 < j && (this.dMultiply(Math.pow(b, j)), this.dAddOffset(g, 0)); - f && e.ZERO.subTo(this, this) - }; - e.prototype.fromNumber = function (a, b, c) { - if ("number" == typeof b)if (2 > a)this.fromInt(1); else { - this.fromNumber(a, c); - this.testBit(a - 1) || this.bitwiseTo(e.ONE.shiftLeft(a - 1), I, this); - for (this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(b);)this.dAddOffset(2, 0), this.bitLength() > a && this.subTo(e.ONE.shiftLeft(a - 1), this) - } else { - c = []; - var d = a & 7; - c.length = - (a >> 3) + 1; - b.nextBytes(c); - c[0] = 0 < d ? c[0] & (1 << d) - 1 : 0; - this.fromString(c, 256) - } - }; - e.prototype.bitwiseTo = function (a, b, c) { - var d, f, e = Math.min(a.t, this.t); - for (d = 0; d < e; ++d)c[d] = b(this[d], a[d]); - if (a.t < this.t) { - f = a.s & this.DM; - for (d = e; d < this.t; ++d)c[d] = b(this[d], f); - c.t = this.t - } else { - f = this.s & this.DM; - for (d = e; d < a.t; ++d)c[d] = b(f, a[d]); - c.t = a.t - } - c.s = b(this.s, a.s); - c.clamp() - }; - e.prototype.changeBit = function (a, b) { - var c = e.ONE.shiftLeft(a); - this.bitwiseTo(c, b, c); - return c - }; - e.prototype.addTo = function (a, b) { - for (var c = 0, d = 0, f = Math.min(a.t, - this.t); c < f;)d += this[c] + a[c], b[c++] = d & this.DM, d >>= this.DB; - if (a.t < this.t) { - for (d += a.s; c < this.t;)d += this[c], b[c++] = d & this.DM, d >>= this.DB; - d += this.s - } else { - for (d += this.s; c < a.t;)d += a[c], b[c++] = d & this.DM, d >>= this.DB; - d += a.s - } - b.s = 0 > d ? -1 : 0; - 0 < d ? b[c++] = d : -1 > d && (b[c++] = this.DV + d); - b.t = c; - b.clamp() - }; - e.prototype.dMultiply = function (a) { - this[this.t] = this.am(0, a - 1, this, 0, 0, this.t); - ++this.t; - this.clamp() - }; - e.prototype.dAddOffset = function (a, b) { - if (0 != a) { - for (; this.t <= b;)this[this.t++] = 0; - for (this[b] += a; this[b] >= this.DV;)this[b] -= - this.DV, ++b >= this.t && (this[this.t++] = 0), ++this[b] - } - }; - e.prototype.multiplyLowerTo = function (a, b, c) { - var d = Math.min(this.t + a.t, b); - c.s = 0; - for (c.t = d; 0 < d;)c[--d] = 0; - var f; - for (f = c.t - this.t; d < f; ++d)c[d + this.t] = this.am(0, a[d], c, d, 0, this.t); - for (f = Math.min(a.t, b); d < f; ++d)this.am(0, a[d], c, d, 0, b - d); - c.clamp() - }; - e.prototype.multiplyUpperTo = function (a, b, c) { - --b; - var d = c.t = this.t + a.t - b; - for (c.s = 0; 0 <= --d;)c[d] = 0; - for (d = Math.max(b - this.t, 0); d < a.t; ++d)c[this.t + d - b] = this.am(b - d, a[d], c, 0, 0, this.t + d - b); - c.clamp(); - c.drShiftTo(1, c) - }; - e.prototype.modInt = function (a) { - if (0 >= a)return 0; - var b = this.DV % a, c = 0 > this.s ? a - 1 : 0; - if (0 < this.t)if (0 == b)c = this[0] % a; else for (var d = this.t - 1; 0 <= d; --d)c = (b * c + this[d]) % a; - return c - }; - e.prototype.millerRabin = function (a) { - var b = this.subtract(e.ONE), c = b.getLowestSetBit(); - if (0 >= c)return !1; - var d = b.shiftRight(c); - a = a + 1 >> 1; - a > q.length && (a = q.length); - for (var f = l(), j = 0; j < a; ++j) { - f.fromInt(q[Math.floor(Math.random() * q.length)]); - var g = f.modPow(d, this); - if (0 != g.compareTo(e.ONE) && 0 != g.compareTo(b)) { - for (var h = 1; h++ < c && 0 != g.compareTo(b);)if (g = - g.modPowInt(2, this), 0 == g.compareTo(e.ONE))return !1; - if (0 != g.compareTo(b))return !1 - } - } - return !0 - }; - e.prototype.clone = function () { - var a = l(); - this.copyTo(a); - return a - }; - e.prototype.intValue = function () { - if (0 > this.s) { - if (1 == this.t)return this[0] - this.DV; - if (0 == this.t)return -1 - } else { - if (1 == this.t)return this[0]; - if (0 == this.t)return 0 - } - return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0] - }; - e.prototype.byteValue = function () { - return 0 == this.t ? this.s : this[0] << 24 >> 24 - }; - e.prototype.shortValue = function () { - return 0 == this.t ? this.s : this[0] << - 16 >> 16 - }; - e.prototype.signum = function () { - return 0 > this.s ? -1 : 0 >= this.t || 1 == this.t && 0 >= this[0] ? 0 : 1 - }; - e.prototype.toByteArray = function () { - var a = this.t, b = []; - b[0] = this.s; - var c = this.DB - a * this.DB % 8, d, f = 0; - if (0 < a--) { - if (c < this.DB && (d = this[a] >> c) != (this.s & this.DM) >> c)b[f++] = d | this.s << this.DB - c; - for (; 0 <= a;)if (8 > c ? (d = (this[a] & (1 << c) - 1) << 8 - c, d |= this[--a] >> (c += this.DB - 8)) : (d = this[a] >> (c -= 8) & 255, 0 >= c && (c += this.DB, --a)), 0 != (d & 128) && (d |= -256), 0 == f && (this.s & 128) != (d & 128) && ++f, 0 < f || d != this.s)b[f++] = d - } - return b - }; - e.prototype.equals = - function (a) { - return 0 == this.compareTo(a) - }; - e.prototype.min = function (a) { - return 0 > this.compareTo(a) ? this : a - }; - e.prototype.max = function (a) { - return 0 < this.compareTo(a) ? this : a - }; - e.prototype.and = function (a) { - var b = l(); - this.bitwiseTo(a, X, b); - return b - }; - e.prototype.or = function (a) { - var b = l(); - this.bitwiseTo(a, I, b); - return b - }; - e.prototype.xor = function (a) { - var b = l(); - this.bitwiseTo(a, O, b); - return b - }; - e.prototype.andNot = function (a) { - var b = l(); - this.bitwiseTo(a, P, b); - return b - }; - e.prototype.not = function () { - for (var a = l(), b = 0; b < this.t; ++b)a[b] = - this.DM & ~this[b]; - a.t = this.t; - a.s = ~this.s; - return a - }; - e.prototype.shiftLeft = function (a) { - var b = l(); - 0 > a ? this.rShiftTo(-a, b) : this.lShiftTo(a, b); - return b - }; - e.prototype.shiftRight = function (a) { - var b = l(); - 0 > a ? this.lShiftTo(-a, b) : this.rShiftTo(a, b); - return b - }; - e.prototype.getLowestSetBit = function () { - for (var a = 0; a < this.t; ++a)if (0 != this[a]) { - var b = a * this.DB; - a = this[a]; - if (0 == a)a = -1; else { - var c = 0; - 0 == (a & 65535) && (a >>= 16, c += 16); - 0 == (a & 255) && (a >>= 8, c += 8); - 0 == (a & 15) && (a >>= 4, c += 4); - 0 == (a & 3) && (a >>= 2, c += 2); - 0 == (a & 1) && ++c; - a = c - } - return b + - a - } - return 0 > this.s ? this.t * this.DB : -1 - }; - e.prototype.bitCount = function () { - for (var a = 0, b = this.s & this.DM, c = 0; c < this.t; ++c) { - for (var d = this[c] ^ b, f = 0; 0 != d;)d &= d - 1, ++f; - a += f - } - return a - }; - e.prototype.testBit = function (a) { - var b = Math.floor(a / this.DB); - return b >= this.t ? 0 != this.s : 0 != (this[b] & 1 << a % this.DB) - }; - e.prototype.setBit = function (a) { - return this.changeBit(a, I) - }; - e.prototype.clearBit = function (a) { - return this.changeBit(a, P) - }; - e.prototype.flipBit = function (a) { - return this.changeBit(a, O) - }; - e.prototype.add = function (a) { - var b = l(); - this.addTo(a, b); - return b - }; - e.prototype.subtract = function (a) { - var b = l(); - this.subTo(a, b); - return b - }; - e.prototype.multiply = function (a) { - var b = l(); - this.multiplyTo(a, b); - return b - }; - e.prototype.divide = function (a) { - var b = l(); - this.divRemTo(a, b, null); - return b - }; - e.prototype.remainder = function (a) { - var b = l(); - this.divRemTo(a, null, b); - return b - }; - e.prototype.divideAndRemainder = function (a) { - var b = l(), c = l(); - this.divRemTo(a, b, c); - return [b, c] - }; - e.prototype.modPow = function (a, b) { - var c = a.bitLength(), d, f = w(1), e; - if (0 >= c)return f; - d = 18 > - c ? 1 : 48 > c ? 3 : 144 > c ? 4 : 768 > c ? 5 : 6; - e = 8 > c ? new y(b) : b.isEven() ? new B(b) : new z(b); - var g = [], h = 3, k = d - 1, p = (1 << d) - 1; - g[1] = e.convert(this); - if (1 < d) { - c = l(); - for (e.sqrTo(g[1], c); h <= p;)g[h] = l(), e.mulTo(c, g[h - 2], g[h]), h += 2 - } - for (var m = a.t - 1, n, q = !0, r = l(), c = G(a[m]) - 1; 0 <= m;) { - c >= k ? n = a[m] >> c - k & p : (n = (a[m] & (1 << c + 1) - 1) << k - c, 0 < m && (n |= a[m - 1] >> this.DB + c - k)); - for (h = d; 0 == (n & 1);)n >>= 1, --h; - if (0 > (c -= h))c += this.DB, --m; - if (q)g[n].copyTo(f), q = !1; else { - for (; 1 < h;)e.sqrTo(f, r), e.sqrTo(r, f), h -= 2; - 0 < h ? e.sqrTo(f, r) : (h = f, f = r, r = h); - e.mulTo(r, g[n], f) - } - for (; 0 <= - m && 0 == (a[m] & 1 << c);)e.sqrTo(f, r), h = f, f = r, r = h, 0 > --c && (c = this.DB - 1, --m) - } - return e.revert(f) - }; - e.prototype.modInverse = function (a) { - var b = a.isEven(); - if (this.isEven() && b || 0 == a.signum())return e.ZERO; - for (var c = a.clone(), d = this.clone(), f = w(1), j = w(0), g = w(0), h = w(1); 0 != c.signum();) { - for (; c.isEven();) { - c.rShiftTo(1, c); - if (b) { - if (!f.isEven() || !j.isEven())f.addTo(this, f), j.subTo(a, j); - f.rShiftTo(1, f) - } else j.isEven() || j.subTo(a, j); - j.rShiftTo(1, j) - } - for (; d.isEven();) { - d.rShiftTo(1, d); - if (b) { - if (!g.isEven() || !h.isEven())g.addTo(this, - g), h.subTo(a, h); - g.rShiftTo(1, g) - } else h.isEven() || h.subTo(a, h); - h.rShiftTo(1, h) - } - 0 <= c.compareTo(d) ? (c.subTo(d, c), b && f.subTo(g, f), j.subTo(h, j)) : (d.subTo(c, d), b && g.subTo(f, g), h.subTo(j, h)) - } - if (0 != d.compareTo(e.ONE))return e.ZERO; - if (0 <= h.compareTo(a))return h.subtract(a); - if (0 > h.signum())h.addTo(a, h); else return h; - return 0 > h.signum() ? h.add(a) : h - }; - e.prototype.pow = function (a) { - return this.exp(a, new E) - }; - e.prototype.gcd = function (a) { - var b = 0 > this.s ? this.negate() : this.clone(); - a = 0 > a.s ? a.negate() : a.clone(); - if (0 > b.compareTo(a)) { - var c = - b, b = a; - a = c - } - var c = b.getLowestSetBit(), d = a.getLowestSetBit(); - if (0 > d)return b; - c < d && (d = c); - 0 < d && (b.rShiftTo(d, b), a.rShiftTo(d, a)); - for (; 0 < b.signum();)0 < (c = b.getLowestSetBit()) && b.rShiftTo(c, b), 0 < (c = a.getLowestSetBit()) && a.rShiftTo(c, a), 0 <= b.compareTo(a) ? (b.subTo(a, b), b.rShiftTo(1, b)) : (a.subTo(b, a), a.rShiftTo(1, a)); - 0 < d && a.lShiftTo(d, a); - return a - }; - e.prototype.isProbablePrime = function (a) { - var b, c = this.abs(); - if (1 == c.t && c[0] <= q[q.length - 1]) { - for (b = 0; b < q.length; ++b)if (c[0] == q[b])return !0; - return !1 - } - if (c.isEven())return !1; - for (b = 1; b < q.length;) { - for (var d = q[b], e = b + 1; e < q.length && d < Z;)d *= q[e++]; - for (d = c.modInt(d); b < e;)if (0 == d % q[b++])return !1 - } - return c.millerRabin(a) - }; - e.prototype.square = function () { - var a = l(); - this.squareTo(a); - return a - }; - J.prototype.init = function (a) { - var b, c, d; - for (b = 0; 256 > b; ++b)this.S[b] = b; - for (b = c = 0; 256 > b; ++b)c = c + this.S[b] + a[b % a.length] & 255, d = this.S[b], this.S[b] = this.S[c], this.S[c] = d; - this.j = this.i = 0 - }; - J.prototype.next = function () { - var a; - this.i = this.i + 1 & 255; - this.j = this.j + this.S[this.i] & 255; - a = this.S[this.i]; - this.S[this.i] = - this.S[this.j]; - this.S[this.j] = a; - return this.S[a + this.S[this.i] & 255] - }; - var K = 256, H, s, m; - if (null == s) { - s = []; - m = 0; - if ("Netscape" == navigator.appName && "5" > navigator.appVersion && window.crypto) { - n = window.crypto.random(32); - for (k = 0; k < n.length; ++k)s[m++] = n.charCodeAt(k) & 255 - } - for (; m < K;)k = Math.floor(65536 * Math.random()), s[m++] = k >>> 8, s[m++] = k & 255; - m = 0; - R((new Date).getTime()) - } - L.prototype.nextBytes = function (a) { - var b; - for (b = 0; b < a.length; ++b) { - var c = a, d = b, e; - if (null == H) { - R((new Date).getTime()); - H = new J; - H.init(s); - for (m = 0; m < s.length; ++m)s[m] = - 0; - m = 0 - } - e = H.next(); - c[d] = e - } - }; - p.prototype.doPublic = function (a) { - return a.modPowInt(this.e, this.n) - }; - p.prototype.setPublic = function (a, b) { - null != a && null != b && 0 < a.length && 0 < b.length ? (this.n = t(a, 16), this.e = parseInt(b, 16)) : alert("Invalid RSA public key") - }; - p.prototype.encrypt = function (a) { - var b; - b = this.n.bitLength() + 7 >> 3; - if (b < a.length + 11)alert("Message too long for RSA"), b = null; else { - for (var c = [], d = a.length - 1; 0 <= d && 0 < b;) { - var f = a.charCodeAt(d--); - 128 > f ? c[--b] = f : 127 < f && 2048 > f ? (c[--b] = f & 63 | 128, c[--b] = f >> 6 | 192) : (c[--b] = - f & 63 | 128, c[--b] = f >> 6 & 63 | 128, c[--b] = f >> 12 | 224) - } - c[--b] = 0; - a = new L; - for (d = []; 2 < b;) { - for (d[0] = 0; 0 == d[0];)a.nextBytes(d); - c[--b] = d[0] - } - c[--b] = 2; - c[--b] = 0; - b = new e(c) - } - if (null == b)return null; - b = this.doPublic(b); - if (null == b)return null; - b = b.toString(16); - return 0 == (b.length & 1) ? b : "0" + b - }; - p.prototype.doPrivate = function (a) { - if (null == this.p || null == this.q)return a.modPow(this.d, this.n); - var b = a.mod(this.p).modPow(this.dmp1, this.p); - for (a = a.mod(this.q).modPow(this.dmq1, this.q); 0 > b.compareTo(a);)b = b.add(this.p); - return b.subtract(a).multiply(this.coeff).mod(this.p).multiply(this.q).add(a) - }; - p.prototype.setPrivate = function (a, b, c) { - null != a && null != b && 0 < a.length && 0 < b.length ? (this.n = t(a, 16), this.e = parseInt(b, 16), this.d = t(c, 16)) : alert("Invalid RSA private key") - }; - p.prototype.setPrivateEx = function (a, b, c, d, e, j, g, h) { - null != a && null != b && 0 < a.length && 0 < b.length ? (this.n = t(a, 16), this.e = parseInt(b, 16), this.d = t(c, 16), this.p = t(d, 16), this.q = t(e, 16), this.dmp1 = t(j, 16), this.dmq1 = t(g, 16), this.coeff = t(h, 16)) : alert("Invalid RSA private key") - }; - p.prototype.generate = function (a, b) { - var c = new L, d = a >> 1; - this.e = parseInt(b, - 16); - for (var f = new e(b, 16); ;) { - for (; !(this.p = new e(a - d, 1, c), 0 == this.p.subtract(e.ONE).gcd(f).compareTo(e.ONE) && this.p.isProbablePrime(10));); - for (; !(this.q = new e(d, 1, c), 0 == this.q.subtract(e.ONE).gcd(f).compareTo(e.ONE) && this.q.isProbablePrime(10));); - if (0 >= this.p.compareTo(this.q)) { - var j = this.p; - this.p = this.q; - this.q = j - } - var j = this.p.subtract(e.ONE), g = this.q.subtract(e.ONE), h = j.multiply(g); - if (0 == h.gcd(f).compareTo(e.ONE)) { - this.n = this.p.multiply(this.q); - this.d = f.modInverse(h); - this.dmp1 = this.d.mod(j); - this.dmq1 = - this.d.mod(g); - this.coeff = this.q.modInverse(this.p); - break - } - } - }; - p.prototype.decrypt = function (a) { - a = t(a, 16); - a = this.doPrivate(a); - if (null == a)return null; - a:{ - var b = this.n.bitLength() + 7 >> 3; - a = a.toByteArray(); - for (var c = 0; c < a.length && 0 == a[c];)++c; - if (a.length - c != b - 1 || 2 != a[c])a = null; else { - for (++c; 0 != a[c];)if (++c >= a.length) { - a = null; - break a - } - for (b = ""; ++c < a.length;) { - var d = a[c] & 255; - 128 > d ? b += String.fromCharCode(d) : 191 < d && 224 > d ? (b += String.fromCharCode((d & 31) << 6 | a[c + 1] & 63), ++c) : (b += String.fromCharCode((d & 15) << 12 | (a[c + 1] & 63) << - 6 | a[c + 2] & 63), c += 2) - } - a = b - } - } - return a - }; - var C = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", S = "="; - p.prototype.parseKey = function (a) { - a = this.prepareKey(a); - var b = this.structure(), c = 0, d = null, e = null, j = 0, g; - for (g in b)d = b[g], d.hasOwnProperty("offset") && (c += 2 * d.offset), j = "string" == typeof d.length ? this[d.length] : d.length, j *= 2, e = a.substr(c, j), d.hasOwnProperty("type") && ("int" == d.type ? e = parseInt(e, 16) : "bigint" == d.type && (e = t(e, 16))), c += j, this[g] = e - }; - p.prototype.char64ToHex = function (a) { - var b = ""; - a = - atob(a); - for (var c = 0; c < a.length; ++c) { - var d = a.charCodeAt(c).toString(16); - 1 === d.length && (d = "0" + d); - b += d - } - return b - }; - p.prototype.prepareKey = function (a) { - a = a.replace(/^\s+|\s+$/g, ""); - a = a.split(/\r?\n/); - "-----BEGIN" == a[0].substring(0, 10) && (a = a.slice(1, a.length - 1)); - a = a.join(""); - return this.char64ToHex(a) - }; - p.prototype.getBaseKey = function () { - var a = "", b = this.structure(), c = null, d = null, e = 0, j; - for (j in b)c = b[j], c.variable && (d = this[j].toString(16), d.length % 2 && (d = "0" + d), c.hasOwnProperty("padded") && c.padded && (d = "00" + d), - e = d.length / 2, e = e.toString(16), e.length % 2 && (e = "0" + e), c.hasOwnProperty("extraspace") && (a += e), a += e, a += d, a += "02"); - return a.slice(0, -2) - }; - p.prototype.wordwrap = function (a, b) { - b = b || 64; - return !a ? a : a.match(RegExp("(.{1," + b + "})( +|$\n?)|(.{1," + b + "})", "g")).join("\n") - }; - p.prototype.getPrivateKey = function () { - var a = "-----BEGIN RSA PRIVATE KEY-----\n", b; - b = "3082025e02010002" + this.getBaseKey(); - a += this.wordwrap(M(b)) + "\n"; - return a + "-----END RSA PRIVATE KEY-----" - }; - p.prototype.getPublicKey = function () { - var a = "-----BEGIN PUBLIC KEY-----\n", - b; - b = "30819f300d06092a864886f70d010101050003818d0030818902" + this.getBaseKey(); - a += this.wordwrap(M(b)) + "\n"; - return a + "-----END PUBLIC KEY-----" - }; - var D = function (a) { - p.call(this); - a && this.parseKey(a) - }; - D.prototype = new p; - D.prototype.constructor = D; - D.prototype.structure = function () { - return { - header: {length: 4}, - versionlength: {length: 1, offset: 1, type: "int"}, - version: {length: "versionlength", type: "int"}, - n_length: {length: 1, offset: 2, type: "int"}, - n: {length: "n_length", type: "bigint", variable: !0, padded: !0, extraspace: !0}, - e_length: { - length: 1, - offset: 1, type: "int" - }, - e: {length: "e_length", type: "int", variable: !0}, - d_length: {length: 1, offset: 2, type: "int"}, - d: {length: "d_length", type: "bigint", variable: !0, padded: !0, extraspace: !0}, - p_length: {length: 1, offset: 1, type: "int"}, - p: {length: "p_length", type: "bigint", variable: !0, padded: !0}, - q_length: {length: 1, offset: 1, type: "int"}, - q: {length: "q_length", type: "bigint", variable: !0, padded: !0}, - dmp1_length: {length: 1, offset: 1, type: "int"}, - dmp1: {length: "dmp1_length", type: "bigint", variable: !0}, - dmq1_length: { - length: 1, offset: 1, - type: "int" - }, - dmq1: {length: "dmq1_length", type: "bigint", variable: !0, padded: !0}, - coeff_length: {length: 1, offset: 1, type: "int"}, - coeff: {length: "coeff_length", type: "bigint", variable: !0, padded: !0} - } - }; - var x = function (a) { - p.call(this); - a && ("string" == typeof a ? this.parseKey(a) : a.hasOwnProperty("n") && a.hasOwnProperty("e") && (this.n = a.n, this.e = a.e)) - }; - x.prototype = new p; - x.prototype.constructor = x; - x.prototype.structure = function () { - return { - header: {length: 25}, n_length: {length: 1, offset: 2, type: "int"}, n: { - length: "n_length", type: "bigint", - variable: !0, padded: !0, extraspace: !0 - }, e_length: {length: 1, offset: 1, type: "int"}, e: {length: "e_length", type: "int", variable: !0} - } - }; - k = function () { - this.pubkey = this.privkey = null - }; - k.prototype.setPrivateKey = function (a) { - this.privkey = new D(a); - this.pubkey = new x(this.privkey) - }; - k.prototype.setPublicKey = function (a) { - this.pubkey = new x(a) - }; - k.prototype.decrypt = function (a) { - return this.privkey ? this.privkey.decrypt(Y(a)) : !1 - }; - k.prototype.encrypt = function (a) { - var b = this.pubkey || this.privkey; - return b ? M(b.encrypt(a)) : !1 - }; - k.prototype.getPrivateKey = - function () { - this.privkey || (this.privkey = new D, this.privkey.generate(1024, "010001"), this.pubkey = new x(this.privkey)); - return this.privkey.getPrivateKey() - }; - k.prototype.getPublicKey = function () { - this.pubkey || (this.pubkey = new x, this.pubkey.generate(1024, "010001")); - return this.pubkey.getPublicKey() - }; - T.JSEncrypt = k -})(JSEncryptExports); -var JSEncrypt = JSEncryptExports.JSEncrypt; +/*! For license information please see jsencrypt.min.js.LICENSE.txt */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.JSEncrypt=e():t.JSEncrypt=e()}(window,(()=>(()=>{var t={155:t=>{var e,i,r=t.exports={};function n(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(t){if(e===setTimeout)return setTimeout(t,0);if((e===n||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(i){try{return e.call(null,t,0)}catch(i){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:n}catch(t){e=n}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(t){i=s}}();var h,a=[],u=!1,c=-1;function f(){u&&h&&(u=!1,h.length?a=h.concat(a):c=-1,a.length&&l())}function l(){if(!u){var t=o(f);u=!0;for(var e=a.length;e;){for(h=a,a=[];++c1)for(var i=1;i{for(var r in e)i.o(e,r)&&!i.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var r={};return(()=>{"use strict";i.d(r,{default:()=>ct});var t="0123456789abcdefghijklmnopqrstuvwxyz";function e(e){return t.charAt(e)}function n(t,e){return t&e}function s(t,e){return t|e}function o(t,e){return t^e}function h(t,e){return t&~e}function a(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function u(t){for(var e=0;0!=t;)t&=t-1,++e;return e}var c,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l="=";function p(t){var e,i,r="";for(e=0;e+3<=t.length;e+=3)i=parseInt(t.substring(e,e+3),16),r+=f.charAt(i>>6)+f.charAt(63&i);for(e+1==t.length?(i=parseInt(t.substring(e,e+1),16),r+=f.charAt(i<<2)):e+2==t.length&&(i=parseInt(t.substring(e,e+2),16),r+=f.charAt(i>>2)+f.charAt((3&i)<<4));(3&r.length)>0;)r+=l;return r}function g(t){var i,r="",n=0,s=0;for(i=0;i>2),s=3&o,n=1):1==n?(r+=e(s<<2|o>>4),s=15&o,n=2):2==n?(r+=e(s),r+=e(o>>2),s=3&o,n=3):(r+=e(s<<2|o>>4),r+=e(15&o),n=0))}return 1==n&&(r+=e(s<<2)),r}var d,v={decode:function(t){var e;if(void 0===d){var i="= \f\n\r\t \u2028\u2029";for(d=Object.create(null),e=0;e<64;++e)d["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)]=e;for(d["-"]=62,d._=63,e=0;e=4?(r[r.length]=n>>16,r[r.length]=n>>8&255,r[r.length]=255&n,n=0,s=0):n<<=6}}switch(s){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=n>>10;break;case 3:r[r.length]=n>>16,r[r.length]=n>>8&255}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(t){var e=v.re.exec(t);if(e)if(e[1])t=e[1];else{if(!e[2])throw new Error("RegExp out of sync");t=e[2]}return v.decode(t)}},m=1e13,y=function(){function t(t){this.buf=[+t||0]}return t.prototype.mulAdd=function(t,e){var i,r,n=this.buf,s=n.length;for(i=0;i0&&(n[i]=e)},t.prototype.sub=function(t){var e,i,r=this.buf,n=r.length;for(e=0;e=0;--r)i+=(m+e[r]).toString().substring(1);return i},t.prototype.valueOf=function(){for(var t=this.buf,e=0,i=t.length-1;i>=0;--i)e=e*m+t[i];return e},t.prototype.simplify=function(){var t=this.buf;return 1==t.length?t[0]:this},t}(),b="…",T=/^(\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)?)?$/,S=/^(\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 E(t,e){return t.length>e&&(t=t.substring(0,e)+b),t}var w,D=function(){function t(e,i){this.hexDigits="0123456789ABCDEF",e instanceof t?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=i)}return t.prototype.get=function(t){if(void 0===t&&(t=this.pos++),t>=this.enc.length)throw new Error("Requesting byte offset ".concat(t," on a stream of length ").concat(this.enc.length));return"string"==typeof this.enc?this.enc.charCodeAt(t):this.enc[t]},t.prototype.hexByte=function(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)},t.prototype.hexDump=function(t,e,i){for(var r="",n=t;n176)return!1}return!0},t.prototype.parseStringISO=function(t,e){for(var i="",r=t;r191&&n<224?String.fromCharCode((31&n)<<6|63&this.get(r++)):String.fromCharCode((15&n)<<12|(63&this.get(r++))<<6|63&this.get(r++))}return i},t.prototype.parseStringBMP=function(t,e){for(var i,r,n="",s=t;s127,s=n?255:0,o="";r==s&&++t4){for(o=r,i<<=3;0==(128&(+o^s));)o=+o<<1,--i;o="("+i+" bit)\n"}n&&(r-=256);for(var h=new y(r),a=t+1;a=a;--u)s+=h>>u&1?"1":"0";if(s.length>i)return n+E(s,i)}return n+s},t.prototype.parseOctetString=function(t,e,i){if(this.isASCII(t,e))return E(this.parseStringISO(t,e),i);var r=e-t,n="("+r+" byte)\n";r>(i/=2)&&(e=t+i);for(var s=t;si&&(n+=b),n},t.prototype.parseOID=function(t,e,i){for(var r="",n=new y,s=0,o=t;oi)return E(r,i);n=new y,s=0}}return s>0&&(r+=".incomplete"),r},t}(),x=function(){function t(t,e,i,r,n){if(!(r instanceof R))throw new Error("Invalid tag value.");this.stream=t,this.header=e,this.length=i,this.tag=r,this.sub=n}return t.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()}},t.prototype.content=function(t){if(void 0===this.tag)return null;void 0===t&&(t=1/0);var e=this.posContent(),i=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+i,t);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(e)?"false":"true";case 2:return this.stream.parseInteger(e,e+i);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+i,t);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+i,t);case 6:return this.stream.parseOID(e,e+i,t);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return E(this.stream.parseStringUTF(e,e+i),t);case 18:case 19:case 20:case 21:case 22:case 26:return E(this.stream.parseStringISO(e,e+i),t);case 30:return E(this.stream.parseStringBMP(e,e+i),t);case 23:case 24:return this.stream.parseTime(e,e+i,23==this.tag.tagNumber)}return null},t.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},t.prototype.toPrettyString=function(t){void 0===t&&(t="");var e=t+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(e+=" (encapsulates)"),e+="\n",null!==this.sub){t+=" ";for(var i=0,r=this.sub.length;i6)throw new Error("Length over 48 bits not supported at position "+(t.pos-1));if(0===i)return null;e=0;for(var r=0;r>6,this.tagConstructed=0!=(32&e),this.tagNumber=31&e,31==this.tagNumber){var i=new y;do{e=t.get(),i.mulAdd(128,127&e)}while(128&e);this.tagNumber=i.simplify()}}return t.prototype.isUniversal=function(){return 0===this.tagClass},t.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},t}(),B=[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],O=(1<<26)/B[B.length-1],A=function(){function t(t,e,i){null!=t&&("number"==typeof t?this.fromNumber(t,e,i):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}return t.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var i;if(16==t)i=4;else if(8==t)i=3;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return this.toRadix(t);i=2}var r,n=(1<0)for(a>a)>0&&(s=!0,o=e(r));h>=0;)a>(a+=this.DB-i)):(r=this[h]>>(a-=i)&n,a<=0&&(a+=this.DB,--h)),r>0&&(s=!0),s&&(o+=e(r));return s?o:"0"},t.prototype.negate=function(){var e=M();return t.ZERO.subTo(this,e),e},t.prototype.abs=function(){return this.s<0?this.negate():this},t.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var i=this.t;if(0!=(e=i-t.t))return this.s<0?-e:e;for(;--i>=0;)if(0!=(e=this[i]-t[i]))return e;return 0},t.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+K(this[this.t-1]^this.s&this.DM)},t.prototype.mod=function(e){var i=M();return this.abs().divRemTo(e,null,i),this.s<0&&i.compareTo(t.ZERO)>0&&e.subTo(i,i),i},t.prototype.modPowInt=function(t,e){var i;return i=t<256||e.isEven()?new I(e):new N(e),this.exp(t,i)},t.prototype.clone=function(){var t=M();return this.copyTo(t),t},t.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24},t.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},t.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},t.prototype.toByteArray=function(){var t=this.t,e=[];e[0]=this.s;var i,r=this.DB-t*this.DB%8,n=0;if(t-- >0)for(r>r)!=(this.s&this.DM)>>r&&(e[n++]=i|this.s<=0;)r<8?(i=(this[t]&(1<>(r+=this.DB-8)):(i=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),0!=(128&i)&&(i|=-256),0==n&&(128&this.s)!=(128&i)&&++n,(n>0||i!=this.s)&&(e[n++]=i);return e},t.prototype.equals=function(t){return 0==this.compareTo(t)},t.prototype.min=function(t){return this.compareTo(t)<0?this:t},t.prototype.max=function(t){return this.compareTo(t)>0?this:t},t.prototype.and=function(t){var e=M();return this.bitwiseTo(t,n,e),e},t.prototype.or=function(t){var e=M();return this.bitwiseTo(t,s,e),e},t.prototype.xor=function(t){var e=M();return this.bitwiseTo(t,o,e),e},t.prototype.andNot=function(t){var e=M();return this.bitwiseTo(t,h,e),e},t.prototype.not=function(){for(var t=M(),e=0;e=this.t?0!=this.s:0!=(this[e]&1<1){var c=M();for(r.sqrTo(o[1],c);h<=u;)o[h]=M(),r.mulTo(c,o[h-2],o[h]),h+=2}var f,l,p=t.t-1,g=!0,d=M();for(n=K(t[p])-1;p>=0;){for(n>=a?f=t[p]>>n-a&u:(f=(t[p]&(1<0&&(f|=t[p-1]>>this.DB+n-a)),h=i;0==(1&f);)f>>=1,--h;if((n-=h)<0&&(n+=this.DB,--p),g)o[f].copyTo(s),g=!1;else{for(;h>1;)r.sqrTo(s,d),r.sqrTo(d,s),h-=2;h>0?r.sqrTo(s,d):(l=s,s=d,d=l),r.mulTo(d,o[f],s)}for(;p>=0&&0==(t[p]&1<=0?(r.subTo(n,r),i&&s.subTo(h,s),o.subTo(a,o)):(n.subTo(r,n),i&&h.subTo(s,h),a.subTo(o,a))}return 0!=n.compareTo(t.ONE)?t.ZERO:a.compareTo(e)>=0?a.subtract(e):a.signum()<0?(a.addTo(e,a),a.signum()<0?a.add(e):a):a},t.prototype.pow=function(t){return this.exp(t,new V)},t.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),i=t.s<0?t.negate():t.clone();if(e.compareTo(i)<0){var r=e;e=i,i=r}var n=e.getLowestSetBit(),s=i.getLowestSetBit();if(s<0)return e;for(n0&&(e.rShiftTo(s,e),i.rShiftTo(s,i));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=i.getLowestSetBit())>0&&i.rShiftTo(n,i),e.compareTo(i)>=0?(e.subTo(i,e),e.rShiftTo(1,e)):(i.subTo(e,i),i.rShiftTo(1,i));return s>0&&i.lShiftTo(s,i),i},t.prototype.isProbablePrime=function(t){var e,i=this.abs();if(1==i.t&&i[0]<=B[B.length-1]){for(e=0;e=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},t.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},t.prototype.fromString=function(e,i){var r;if(16==i)r=4;else if(8==i)r=3;else if(256==i)r=8;else if(2==i)r=1;else if(32==i)r=5;else{if(4!=i)return void this.fromRadix(e,i);r=2}this.t=0,this.s=0;for(var n=e.length,s=!1,o=0;--n>=0;){var h=8==r?255&+e[n]:F(e,n);h<0?"-"==e.charAt(n)&&(s=!0):(s=!1,0==o?this[this.t++]=h:o+r>this.DB?(this[this.t-1]|=(h&(1<>this.DB-o):this[this.t-1]|=h<=this.DB&&(o-=this.DB))}8==r&&0!=(128&+e[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t},t.prototype.dlShiftTo=function(t,e){var i;for(i=this.t-1;i>=0;--i)e[i+t]=this[i];for(i=t-1;i>=0;--i)e[i]=0;e.t=this.t+t,e.s=this.s},t.prototype.drShiftTo=function(t,e){for(var i=t;i=0;--h)e[h+s+1]=this[h]>>r|o,o=(this[h]&n)<=0;--h)e[h]=0;e[s]=o,e.t=this.t+s+1,e.s=this.s,e.clamp()},t.prototype.rShiftTo=function(t,e){e.s=this.s;var i=Math.floor(t/this.DB);if(i>=this.t)e.t=0;else{var r=t%this.DB,n=this.DB-r,s=(1<>r;for(var o=i+1;o>r;r>0&&(e[this.t-i-1]|=(this.s&s)<>=this.DB;if(t.t>=this.DB;r+=this.s}else{for(r+=this.s;i>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[i++]=this.DV+r:r>0&&(e[i++]=r),e.t=i,e.clamp()},t.prototype.multiplyTo=function(e,i){var r=this.abs(),n=e.abs(),s=r.t;for(i.t=s+n.t;--s>=0;)i[s]=0;for(s=0;s=0;)t[i]=0;for(i=0;i=e.DV&&(t[i+e.t]-=e.DV,t[i+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(i,e[i],t,2*i,0,1)),t.s=0,t.clamp()},t.prototype.divRemTo=function(e,i,r){var n=e.abs();if(!(n.t<=0)){var s=this.abs();if(s.t0?(n.lShiftTo(u,o),s.lShiftTo(u,r)):(n.copyTo(o),s.copyTo(r));var c=o.t,f=o[c-1];if(0!=f){var l=f*(1<1?o[c-2]>>this.F2:0),p=this.FV/l,g=(1<=0&&(r[r.t++]=1,r.subTo(y,r)),t.ONE.dlShiftTo(c,y),y.subTo(o,o);o.t=0;){var b=r[--v]==f?this.DM:Math.floor(r[v]*p+(r[v-1]+d)*g);if((r[v]+=o.am(0,b,r,m,0,c))0&&r.rShiftTo(u,r),h<0&&t.ZERO.subTo(r,r)}}},t.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},t.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},t.prototype.exp=function(e,i){if(e>4294967295||e<1)return t.ONE;var r=M(),n=M(),s=i.convert(this),o=K(e)-1;for(s.copyTo(r);--o>=0;)if(i.sqrTo(r,n),(e&1<0)i.mulTo(n,s,r);else{var h=r;r=n,n=h}return i.revert(r)},t.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},t.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),i=Math.pow(t,e),r=U(i),n=M(),s=M(),o="";for(this.divRemTo(r,n,s);n.signum()>0;)o=(i+s.intValue()).toString(t).substr(1)+o,n.divRemTo(r,n,s);return s.intValue().toString(t)+o},t.prototype.fromRadix=function(e,i){this.fromInt(0),null==i&&(i=10);for(var r=this.chunkSize(i),n=Math.pow(i,r),s=!1,o=0,h=0,a=0;a=r&&(this.dMultiply(n),this.dAddOffset(h,0),o=0,h=0))}o>0&&(this.dMultiply(Math.pow(i,o)),this.dAddOffset(h,0)),s&&t.ZERO.subTo(this,this)},t.prototype.fromNumber=function(e,i,r){if("number"==typeof i)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(t.ONE.shiftLeft(e-1),s,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(t.ONE.shiftLeft(e-1),this);else{var n=[],o=7&e;n.length=1+(e>>3),i.nextBytes(n),o>0?n[0]&=(1<>=this.DB;if(t.t>=this.DB;r+=this.s}else{for(r+=this.s;i>=this.DB;r+=t.s}e.s=r<0?-1:0,r>0?e[i++]=r:r<-1&&(e[i++]=this.DV+r),e.t=i,e.clamp()},t.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},t.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},t.prototype.multiplyLowerTo=function(t,e,i){var r=Math.min(this.t+t.t,e);for(i.s=0,i.t=r;r>0;)i[--r]=0;for(var n=i.t-this.t;r=0;)i[r]=0;for(r=Math.max(e-this.t,0);r0)if(0==e)i=this[0]%t;else for(var r=this.t-1;r>=0;--r)i=(e*i+this[r])%t;return i},t.prototype.millerRabin=function(e){var i=this.subtract(t.ONE),r=i.getLowestSetBit();if(r<=0)return!1;var n=i.shiftRight(r);(e=e+1>>1)>B.length&&(e=B.length);for(var s=M(),o=0;o0&&(i.rShiftTo(o,i),r.rShiftTo(o,r));var h=function(){(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),(s=r.getLowestSetBit())>0&&r.rShiftTo(s,r),i.compareTo(r)>=0?(i.subTo(r,i),i.rShiftTo(1,i)):(r.subTo(i,r),r.rShiftTo(1,r)),i.signum()>0?setTimeout(h,0):(o>0&&r.lShiftTo(o,r),setTimeout((function(){e(r)}),0))};setTimeout(h,10)}},t.prototype.fromNumberAsync=function(e,i,r,n){if("number"==typeof i)if(e<2)this.fromInt(1);else{this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(t.ONE.shiftLeft(e-1),s,this),this.isEven()&&this.dAddOffset(1,0);var o=this,h=function(){o.dAddOffset(2,0),o.bitLength()>e&&o.subTo(t.ONE.shiftLeft(e-1),o),o.isProbablePrime(i)?setTimeout((function(){n()}),0):setTimeout(h,0)};setTimeout(h,0)}else{var a=[],u=7&e;a.length=1+(e>>3),i.nextBytes(a),u>0?a[0]&=(1<=0?t.mod(this.m):t},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},t.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),N=function(){function t(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e},t.prototype.revert=function(t){var e=M();return t.copyTo(e),this.reduce(e),e},t.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(t[i=e+this.m.t]+=this.m.am(0,r,t,e,0,this.m.t);t[i]>=t.DV;)t[i]-=t.DV,t[++i]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),P=function(){function t(t){this.m=t,this.r2=M(),this.q3=M(),A.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t)}return t.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=M();return t.copyTo(e),this.reduce(e),e},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,i){t.multiplyTo(e,i),this.reduce(i)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}();function M(){return new A(null)}function L(t,e){return new A(t,e)}var j="undefined"!=typeof navigator;j&&"Microsoft Internet Explorer"==navigator.appName?(A.prototype.am=function(t,e,i,r,n,s){for(var o=32767&e,h=e>>15;--s>=0;){var a=32767&this[t],u=this[t++]>>15,c=h*a+u*o;n=((a=o*a+((32767&c)<<15)+i[r]+(1073741823&n))>>>30)+(c>>>15)+h*u+(n>>>30),i[r++]=1073741823&a}return n},w=30):j&&"Netscape"!=navigator.appName?(A.prototype.am=function(t,e,i,r,n,s){for(;--s>=0;){var o=e*this[t++]+i[r]+n;n=Math.floor(o/67108864),i[r++]=67108863&o}return n},w=26):(A.prototype.am=function(t,e,i,r,n,s){for(var o=16383&e,h=e>>14;--s>=0;){var a=16383&this[t],u=this[t++]>>14,c=h*a+u*o;n=((a=o*a+((16383&c)<<14)+i[r]+n)>>28)+(c>>14)+h*u,i[r++]=268435455&a}return n},w=28),A.prototype.DB=w,A.prototype.DM=(1<>>16)&&(t=e,i+=16),0!=(e=t>>8)&&(t=e,i+=8),0!=(e=t>>4)&&(t=e,i+=4),0!=(e=t>>2)&&(t=e,i+=2),0!=(e=t>>1)&&(t=e,i+=1),i}A.ZERO=U(0),A.ONE=U(1);var k,_,z=function(){function t(){this.i=0,this.j=0,this.S=[]}return t.prototype.init=function(t){var e,i,r;for(e=0;e<256;++e)this.S[e]=e;for(i=0,e=0;e<256;++e)i=i+this.S[e]+t[e%t.length]&255,r=this.S[e],this.S[e]=this.S[i],this.S[i]=r;this.i=0,this.j=0},t.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]},t}(),Z=256,G=null;if(null==G){G=[],_=0;var $=void 0;if("undefined"!=typeof window&&window.crypto&&window.crypto.getRandomValues){var Y=new Uint32Array(256);for(window.crypto.getRandomValues(Y),$=0;$=256||_>=Z)window.removeEventListener?window.removeEventListener("mousemove",X,!1):window.detachEvent&&window.detachEvent("onmousemove",X);else try{var e=t.x+t.y;G[_++]=255&e,J+=1}catch(t){}};"undefined"!=typeof window&&(window.addEventListener?window.addEventListener("mousemove",X,!1):window.attachEvent&&window.attachEvent("onmousemove",X))}function Q(){if(null==k){for(k=new z;_0&&e.length>0?(this.n=L(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")},t.prototype.encrypt=function(t){var e=this.n.bitLength()+7>>3,i=function(t,e){if(e=0&&e>0;){var n=t.charCodeAt(r--);n<128?i[--e]=n:n>127&&n<2048?(i[--e]=63&n|128,i[--e]=n>>6|192):(i[--e]=63&n|128,i[--e]=n>>6&63|128,i[--e]=n>>12|224)}i[--e]=0;for(var s=new W,o=[];e>2;){for(o[0]=0;0==o[0];)s.nextBytes(o);i[--e]=o[0]}return i[--e]=2,i[--e]=0,new A(i)}(t,e);if(null==i)return null;var r=this.doPublic(i);if(null==r)return null;for(var n=r.toString(16),s=n.length,o=0;o<2*e-s;o++)n="0"+n;return n},t.prototype.setPrivate=function(t,e,i){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=L(t,16),this.e=parseInt(e,16),this.d=L(i,16)):console.error("Invalid RSA private key")},t.prototype.setPrivateEx=function(t,e,i,r,n,s,o,h){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=L(t,16),this.e=parseInt(e,16),this.d=L(i,16),this.p=L(r,16),this.q=L(n,16),this.dmp1=L(s,16),this.dmq1=L(o,16),this.coeff=L(h,16)):console.error("Invalid RSA private key")},t.prototype.generate=function(t,e){var i=new W,r=t>>1;this.e=parseInt(e,16);for(var n=new A(e,16);;){for(;this.p=new A(t-r,1,i),0!=this.p.subtract(A.ONE).gcd(n).compareTo(A.ONE)||!this.p.isProbablePrime(10););for(;this.q=new A(r,1,i),0!=this.q.subtract(A.ONE).gcd(n).compareTo(A.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var s=this.p;this.p=this.q,this.q=s}var o=this.p.subtract(A.ONE),h=this.q.subtract(A.ONE),a=o.multiply(h);if(0==a.gcd(n).compareTo(A.ONE)){this.n=this.p.multiply(this.q),this.d=n.modInverse(a),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(h),this.coeff=this.q.modInverse(this.p);break}}},t.prototype.decrypt=function(t){var e=L(t,16),i=this.doPrivate(e);return null==i?null:function(t,e){for(var i=t.toByteArray(),r=0;r=i.length)return null;for(var n="";++r191&&s<224?(n+=String.fromCharCode((31&s)<<6|63&i[r+1]),++r):(n+=String.fromCharCode((15&s)<<12|(63&i[r+1])<<6|63&i[r+2]),r+=2)}return n}(i,this.n.bitLength()+7>>3)},t.prototype.generateAsync=function(t,e,i){var r=new W,n=t>>1;this.e=parseInt(e,16);var s=new A(e,16),o=this,h=function(){var e=function(){if(o.p.compareTo(o.q)<=0){var t=o.p;o.p=o.q,o.q=t}var e=o.p.subtract(A.ONE),r=o.q.subtract(A.ONE),n=e.multiply(r);0==n.gcd(s).compareTo(A.ONE)?(o.n=o.p.multiply(o.q),o.d=s.modInverse(n),o.dmp1=o.d.mod(e),o.dmq1=o.d.mod(r),o.coeff=o.q.modInverse(o.p),setTimeout((function(){i()}),0)):setTimeout(h,0)},a=function(){o.q=M(),o.q.fromNumberAsync(n,1,r,(function(){o.q.subtract(A.ONE).gcda(s,(function(t){0==t.compareTo(A.ONE)&&o.q.isProbablePrime(10)?setTimeout(e,0):setTimeout(a,0)}))}))},u=function(){o.p=M(),o.p.fromNumberAsync(t-n,1,r,(function(){o.p.subtract(A.ONE).gcda(s,(function(t){0==t.compareTo(A.ONE)&&o.p.isProbablePrime(10)?setTimeout(a,0):setTimeout(u,0)}))}))};setTimeout(u,0)};setTimeout(h,0)},t.prototype.sign=function(t,e,i){var r=function(t,e){if(e15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);return(128+i).toString(16)+e},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},rt.asn1.DERAbstractString=function(t){rt.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},it.lang.extend(rt.asn1.DERAbstractString,rt.asn1.ASN1Object),rt.asn1.DERAbstractTime=function(t){rt.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){return utc=t.getTime()+6e4*t.getTimezoneOffset(),new Date(utc)},this.formatDate=function(t,e,i){var r=this.zeroPadding,n=this.localDateToUTC(t),s=String(n.getFullYear());"utc"==e&&(s=s.substr(2,2));var o=s+r(String(n.getMonth()+1),2)+r(String(n.getDate()),2)+r(String(n.getHours()),2)+r(String(n.getMinutes()),2)+r(String(n.getSeconds()),2);if(!0===i){var h=n.getMilliseconds();if(0!=h){var a=r(String(h),3);o=o+"."+(a=a.replace(/[0]+$/,""))}}return o+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(t)},this.setByDateValue=function(t,e,i,r,n,s){var o=new Date(Date.UTC(t,e-1,i,r,n,s,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}},it.lang.extend(rt.asn1.DERAbstractTime,rt.asn1.ASN1Object),rt.asn1.DERAbstractStructured=function(t){rt.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},it.lang.extend(rt.asn1.DERAbstractStructured,rt.asn1.ASN1Object),rt.asn1.DERBoolean=function(){rt.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},it.lang.extend(rt.asn1.DERBoolean,rt.asn1.ASN1Object),rt.asn1.DERInteger=function(t){rt.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=rt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new A(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},it.lang.extend(rt.asn1.DERInteger,rt.asn1.ASN1Object),rt.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=rt.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}rt.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7=2?(n[n.length]=s,s=0,o=0):s<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return n}(t):v.unarmor(t),n=x.decode(r);if(3===n.sub.length&&(n=n.sub[2].sub[0]),9===n.sub.length){e=n.sub[1].getHexStringValue(),this.n=L(e,16),i=n.sub[2].getHexStringValue(),this.e=parseInt(i,16);var s=n.sub[3].getHexStringValue();this.d=L(s,16);var o=n.sub[4].getHexStringValue();this.p=L(o,16);var h=n.sub[5].getHexStringValue();this.q=L(h,16);var a=n.sub[6].getHexStringValue();this.dmp1=L(a,16);var u=n.sub[7].getHexStringValue();this.dmq1=L(u,16);var f=n.sub[8].getHexStringValue();this.coeff=L(f,16)}else{if(2!==n.sub.length)return!1;if(n.sub[0].sub){var l=n.sub[1].sub[0];e=l.sub[0].getHexStringValue(),this.n=L(e,16),i=l.sub[1].getHexStringValue(),this.e=parseInt(i,16)}else e=n.sub[0].getHexStringValue(),this.n=L(e,16),i=n.sub[1].getHexStringValue(),this.e=parseInt(i,16)}return!0}catch(t){return!1}},e.prototype.getPrivateBaseKey=function(){var t={array:[new rt.asn1.DERInteger({int:0}),new rt.asn1.DERInteger({bigint:this.n}),new rt.asn1.DERInteger({int:this.e}),new rt.asn1.DERInteger({bigint:this.d}),new rt.asn1.DERInteger({bigint:this.p}),new rt.asn1.DERInteger({bigint:this.q}),new rt.asn1.DERInteger({bigint:this.dmp1}),new rt.asn1.DERInteger({bigint:this.dmq1}),new rt.asn1.DERInteger({bigint:this.coeff})]};return new rt.asn1.DERSequence(t).getEncodedHex()},e.prototype.getPrivateBaseKeyB64=function(){return p(this.getPrivateBaseKey())},e.prototype.getPublicBaseKey=function(){var t=new rt.asn1.DERSequence({array:[new rt.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new rt.asn1.DERNull]}),e=new rt.asn1.DERSequence({array:[new rt.asn1.DERInteger({bigint:this.n}),new rt.asn1.DERInteger({int:this.e})]}),i=new rt.asn1.DERBitString({hex:"00"+e.getEncodedHex()});return new rt.asn1.DERSequence({array:[t,i]}).getEncodedHex()},e.prototype.getPublicBaseKeyB64=function(){return p(this.getPublicBaseKey())},e.wordwrap=function(t,e){if(!t)return t;var i="(.{1,"+(e=e||64)+"})( +|$\n?)|(.{1,"+e+"})";return t.match(RegExp(i,"g")).join("\n")},e.prototype.getPrivateKey=function(){var t="-----BEGIN RSA PRIVATE KEY-----\n";return(t+=e.wordwrap(this.getPrivateBaseKeyB64())+"\n")+"-----END RSA PRIVATE KEY-----"},e.prototype.getPublicKey=function(){var t="-----BEGIN PUBLIC KEY-----\n";return(t+=e.wordwrap(this.getPublicBaseKeyB64())+"\n")+"-----END PUBLIC KEY-----"},e.hasPublicKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")},e.hasPrivateKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")&&t.hasOwnProperty("d")&&t.hasOwnProperty("p")&&t.hasOwnProperty("q")&&t.hasOwnProperty("dmp1")&&t.hasOwnProperty("dmq1")&&t.hasOwnProperty("coeff")},e.prototype.parsePropertiesFrom=function(t){this.n=t.n,this.e=t.e,t.hasOwnProperty("d")&&(this.d=t.d,this.p=t.p,this.q=t.q,this.dmp1=t.dmp1,this.dmq1=t.dmq1,this.coeff=t.coeff)},e}(tt),at=i(155),ut=void 0!==at?null===(st=at.env)||void 0===st?void 0:"3.3.2":void 0;const ct=function(){function t(t){void 0===t&&(t={}),t=t||{},this.default_key_size=t.default_key_size?parseInt(t.default_key_size,10):1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=null}return t.prototype.setKey=function(t){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new ht(t)},t.prototype.setPrivateKey=function(t){this.setKey(t)},t.prototype.setPublicKey=function(t){this.setKey(t)},t.prototype.decrypt=function(t){try{return this.getKey().decrypt(g(t))}catch(t){return!1}},t.prototype.encrypt=function(t){try{return p(this.getKey().encrypt(t))}catch(t){return!1}},t.prototype.sign=function(t,e,i){try{return p(this.getKey().sign(t,e,i))}catch(t){return!1}},t.prototype.verify=function(t,e,i){try{return this.getKey().verify(t,g(e),i)}catch(t){return!1}},t.prototype.getKey=function(t){if(!this.key){if(this.key=new ht,t&&"[object Function]"==={}.toString.call(t))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,t);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},t.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},t.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},t.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},t.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},t.version=ut,t}()})(),r.default})())); \ No newline at end of file diff --git a/tpayLibs/src/View/JS/jsencrypt.min.js.LICENSE.txt b/tpayLibs/src/View/JS/jsencrypt.min.js.LICENSE.txt new file mode 100644 index 0000000..307590d --- /dev/null +++ b/tpayLibs/src/View/JS/jsencrypt.min.js.LICENSE.txt @@ -0,0 +1,8 @@ +/** + * @fileOverview + * @name asn1-1.0.js + * @author Kenji Urushima kenji.urushima@gmail.com + * @version asn1 1.0.13 (2017-Jun-02) + * @since jsrsasign 2.1 + * @license MIT License + */