Index: ssts-web/src/main/webapp/js/rsa/jsencrypt.min.js =================================================================== diff -u -r35056 -r35068 --- ssts-web/src/main/webapp/js/rsa/jsencrypt.min.js (.../jsencrypt.min.js) (revision 35056) +++ ssts-web/src/main/webapp/js/rsa/jsencrypt.min.js (.../jsencrypt.min.js) (revision 35068) @@ -1,2913 +1,225 @@ -//jsencrypt.min.js源文件地址:https://cdn.bootcdn.net/ajax/libs/jsencrypt/3.2.1/jsencrypt.min.js -/*! 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, (function() { - return (()=>{ - "use strict"; - var t = [, (t,e,i)=>{ - function r(t) { - return "0123456789abcdefghijklmnopqrstuvwxyz".charAt(t) - } - 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 - } - i.d(e, { - default: ()=>nt - }); - var c, f = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - function l(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 += "="; - return r - } - function p(t) { - var e, i = "", n = 0, s = 0; - for (e = 0; e < t.length && "=" != t.charAt(e); ++e) { - var o = f.indexOf(t.charAt(e)); - o < 0 || (0 == n ? (i += r(o >> 2), - s = 3 & o, - n = 1) : 1 == n ? (i += r(s << 2 | o >> 4), - s = 15 & o, - n = 2) : 2 == n ? (i += r(s), - i += r(o >> 2), - s = 3 & o, - n = 3) : (i += r(s << 2 | o >> 4), - i += r(15 & o), - n = 0)) - } - return 1 == n && (i += r(s << 2)), - i - } - var g, d = { - decode: function(t) { - var e; - if (void 0 === g) { - var i = "= \f\n\r\t \u2028\u2029"; - for (g = Object.create(null), - e = 0; e < 64; ++e) - g["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)] = e; - for (g["-"] = 62, - g._ = 63, - e = 0; e < i.length; ++e) - g[i.charAt(e)] = -1 - } - var r = [] - , n = 0 - , s = 0; - for (e = 0; e < t.length; ++e) { - var o = t.charAt(e); - if ("=" == o) - break; - if (-1 != (o = g[o])) { - if (void 0 === o) - throw new Error("Illegal character at offset " + e); - n |= o, - ++s >= 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 = d.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 d.decode(t) - } - }, v = 1e13, m = 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; i < s; ++i) - (r = n[i] * t + e) < v ? e = 0 : r -= (e = 0 | r / v) * v, - n[i] = r; - e > 0 && (n[i] = e) - } - , - t.prototype.sub = function(t) { - var e, i, r = this.buf, n = r.length; - for (e = 0; e < n; ++e) - (i = r[e] - t) < 0 ? (i += v, - t = 1) : t = 0, - r[e] = i; - for (; 0 === r[r.length - 1]; ) - r.pop() - } - , - t.prototype.toString = function(t) { - if (10 != (t || 10)) - throw new Error("only base 10 is supported"); - for (var e = this.buf, i = e[e.length - 1].toString(), r = e.length - 2; r >= 0; --r) - i += (v + 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 * v + t[i]; - return e - } - , - t.prototype.simplify = function() { - var t = this.buf; - return 1 == t.length ? t[0] : this - } - , - t - }(), y = /^(\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)?)?$/, b = /^(\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 T(t, e) { - return t.length > e && (t = t.substring(0, e) + "…"), - t - } - var S, E = 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 " + t + " on a stream of length " + 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; n < e; ++n) - if (r += this.hexByte(this.get(n)), - !0 !== i) - switch (15 & n) { - case 7: - r += " "; - break; - case 15: - r += "\n"; - break; - default: - r += " " - } - return r - } - , - t.prototype.isASCII = function(t, e) { - for (var i = t; i < e; ++i) { - var r = this.get(i); - if (r < 32 || r > 176) - return !1 - } - return !0 - } - , - t.prototype.parseStringISO = function(t, e) { - for (var i = "", r = t; r < e; ++r) - i += String.fromCharCode(this.get(r)); - return i - } - , - t.prototype.parseStringUTF = function(t, e) { - for (var i = "", r = t; r < e; ) { - var n = this.get(r++); - i += n < 128 ? String.fromCharCode(n) : n > 191 && 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; s < e; ) - i = this.get(s++), - r = this.get(s++), - n += String.fromCharCode(i << 8 | r); - return n - } - , - t.prototype.parseTime = function(t, e, i) { - var r = this.parseStringISO(t, e) - , n = (i ? y : b).exec(r); - return n ? (i && (n[1] = +n[1], - n[1] += +n[1] < 70 ? 2e3 : 1900), - r = n[1] + "-" + n[2] + "-" + n[3] + " " + n[4], - n[5] && (r += ":" + n[5], - n[6] && (r += ":" + n[6], - n[7] && (r += "." + n[7]))), - n[8] && (r += " UTC", - "Z" != n[8] && (r += n[8], - n[9] && (r += ":" + n[9]))), - r) : "Unrecognized time: " + r - } - , - t.prototype.parseInteger = function(t, e) { - for (var i, r = this.get(t), n = r > 127, s = n ? 255 : 0, o = ""; r == s && ++t < e; ) - r = this.get(t); - if (0 == (i = e - t)) - return n ? -1 : 0; - if (i > 4) { - for (o = r, - i <<= 3; 0 == (128 & (+o ^ s)); ) - o = +o << 1, - --i; - o = "(" + i + " bit)\n" - } - n && (r -= 256); - for (var h = new m(r), a = t + 1; a < e; ++a) - h.mulAdd(256, this.get(a)); - return o + h.toString() - } - , - t.prototype.parseBitString = function(t, e, i) { - for (var r = this.get(t), n = "(" + ((e - t - 1 << 3) - r) + " bit)\n", s = "", o = t + 1; o < e; ++o) { - for (var h = this.get(o), a = o == e - 1 ? r : 0, u = 7; u >= a; --u) - s += h >> u & 1 ? "1" : "0"; - if (s.length > i) - return n + T(s, i) - } - return n + s - } - , - t.prototype.parseOctetString = function(t, e, i) { - if (this.isASCII(t, e)) - return T(this.parseStringISO(t, e), i); - var r = e - t - , n = "(" + r + " byte)\n"; - r > (i /= 2) && (e = t + i); - for (var s = t; s < e; ++s) - n += this.hexByte(this.get(s)); - return r > i && (n += "…"), - n - } - , - t.prototype.parseOID = function(t, e, i) { - for (var r = "", n = new m, s = 0, o = t; o < e; ++o) { - var h = this.get(o); - if (n.mulAdd(128, 127 & h), - s += 7, - !(128 & h)) { - if ("" === r) - if ((n = n.simplify())instanceof m) - n.sub(80), - r = "2." + n.toString(); - else { - var a = n < 80 ? n < 40 ? 0 : 1 : 2; - r = a + "." + (n - 40 * a) - } - else - r += "." + n.toString(); - if (r.length > i) - return T(r, i); - n = new m, - s = 0 - } - } - return s > 0 && (r += ".incomplete"), - r - } - , - t - }(), w = function() { - function t(t, e, i, r, n) { - if (!(r instanceof D)) - 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 T(this.stream.parseStringUTF(e, e + i), t); - case 18: - case 19: - case 20: - case 21: - case 22: - case 26: - return T(this.stream.parseStringISO(e, e + i), t); - case 30: - return T(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; i < r; ++i) - e += this.sub[i].toPrettyString(t) - } - return e - } - , - t.prototype.posStart = function() { - return this.stream.pos - } - , - t.prototype.posContent = function() { - return this.stream.pos + this.header - } - , - t.prototype.posEnd = function() { - return this.stream.pos + this.header + Math.abs(this.length) - } - , - t.prototype.toHexString = function() { - return this.stream.hexDump(this.posStart(), this.posEnd(), !0) - } - , - t.decodeLength = function(t) { - var e = t.get() - , i = 127 & e; - if (i == e) - return i; - if (i > 6) - 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 < i; ++r) - e = 256 * e + t.get(); - return e - } - , - t.prototype.getHexStringValue = function() { - var t = this.toHexString() - , e = 2 * this.header - , i = 2 * this.length; - return t.substr(e, i) - } - , - t.decode = function(e) { - var i; - i = e instanceof E ? e : new E(e,0); - var r = new E(i) - , n = new D(i) - , s = t.decodeLength(i) - , o = i.pos - , h = o - r.pos - , a = null - , u = function() { - var e = []; - if (null !== s) { - for (var r = o + s; i.pos < r; ) - e[e.length] = t.decode(i); - if (i.pos != r) - throw new Error("Content size is not correct for container starting at offset " + o) - } else - try { - for (; ; ) { - var n = t.decode(i); - if (n.tag.isEOC()) - break; - e[e.length] = n - } - s = o - i.pos - } catch (t) { - throw new Error("Exception while decoding undefined length content: " + t) - } - return e - }; - if (n.tagConstructed) - a = u(); - else if (n.isUniversal() && (3 == n.tagNumber || 4 == n.tagNumber)) - try { - if (3 == n.tagNumber && 0 != i.get()) - throw new Error("BIT STRINGs with unused bits cannot encapsulate."); - a = u(); - for (var c = 0; c < a.length; ++c) - if (a[c].tag.isEOC()) - throw new Error("EOC is not supposed to be actual content.") - } catch (t) { - a = null - } - if (null === a) { - if (null === s) - throw new Error("We can't skip over an invalid tag with undefined length at offset " + o); - i.pos = o + Math.abs(s) - } - return new t(r,h,s,n,a) - } - , - t - }(), D = function() { - function t(t) { - var e = t.get(); - if (this.tagClass = e >> 6, - this.tagConstructed = 0 != (32 & e), - this.tagNumber = 31 & e, - 31 == this.tagNumber) { - var i = new m; - 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 - }(), x = [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], R = (1 << 26) / x[x.length - 1], B = 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 e; - if (16 == t) - e = 4; - else if (8 == t) - e = 3; - else if (2 == t) - e = 1; - else if (32 == t) - e = 5; - else { - if (4 != t) - return this.toRadix(t); - e = 2 - } - var i, n = (1 << e) - 1, s = !1, o = "", h = this.t, a = this.DB - h * this.DB % e; - if (h-- > 0) - for (a < this.DB && (i = this[h] >> a) > 0 && (s = !0, - o = r(i)); h >= 0; ) - a < e ? (i = (this[h] & (1 << a) - 1) << e - a, - i |= this[--h] >> (a += this.DB - e)) : (i = this[h] >> (a -= e) & n, - a <= 0 && (a += this.DB, - --h)), - i > 0 && (s = !0), - s && (o += r(i)); - return s ? o : "0" - } - , - t.prototype.negate = function() { - var e = N(); - 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) + F(this[this.t - 1] ^ this.s & this.DM) - } - , - t.prototype.mod = function(e) { - var i = N(); - 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 A(e) : new V(e), - this.exp(t, i) - } - , - t.prototype.clone = function() { - var t = N(); - 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) << this.DB | this[0] - } - , - t.prototype.byteValue = function() { - return 0 == this.t ? this.s : this[0] << 24 >> 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 < this.DB && (i = this[t] >> r) != (this.s & this.DM) >> r && (e[n++] = i | this.s << this.DB - r); t >= 0; ) - r < 8 ? (i = (this[t] & (1 << r) - 1) << 8 - r, - i |= this[--t] >> (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 = N(); - return this.bitwiseTo(t, n, e), - e - } - , - t.prototype.or = function(t) { - var e = N(); - return this.bitwiseTo(t, s, e), - e - } - , - t.prototype.xor = function(t) { - var e = N(); - return this.bitwiseTo(t, o, e), - e - } - , - t.prototype.andNot = function(t) { - var e = N(); - return this.bitwiseTo(t, h, e), - e - } - , - t.prototype.not = function() { - for (var t = N(), e = 0; e < this.t; ++e) - t[e] = this.DM & ~this[e]; - return t.t = this.t, - t.s = ~this.s, - t - } - , - t.prototype.shiftLeft = function(t) { - var e = N(); - return t < 0 ? this.rShiftTo(-t, e) : this.lShiftTo(t, e), - e - } - , - t.prototype.shiftRight = function(t) { - var e = N(); - return t < 0 ? this.lShiftTo(-t, e) : this.rShiftTo(t, e), - e - } - , - t.prototype.getLowestSetBit = function() { - for (var t = 0; t < this.t; ++t) - if (0 != this[t]) - return t * this.DB + a(this[t]); - return this.s < 0 ? this.t * this.DB : -1 - } - , - t.prototype.bitCount = function() { - for (var t = 0, e = this.s & this.DM, i = 0; i < this.t; ++i) - t += u(this[i] ^ e); - return t - } - , - t.prototype.testBit = function(t) { - var e = Math.floor(t / this.DB); - return e >= this.t ? 0 != this.s : 0 != (this[e] & 1 << t % this.DB) - } - , - t.prototype.setBit = function(t) { - return this.changeBit(t, s) - } - , - t.prototype.clearBit = function(t) { - return this.changeBit(t, h) - } - , - t.prototype.flipBit = function(t) { - return this.changeBit(t, o) - } - , - t.prototype.add = function(t) { - var e = N(); - return this.addTo(t, e), - e - } - , - t.prototype.subtract = function(t) { - var e = N(); - return this.subTo(t, e), - e - } - , - t.prototype.multiply = function(t) { - var e = N(); - return this.multiplyTo(t, e), - e - } - , - t.prototype.divide = function(t) { - var e = N(); - return this.divRemTo(t, e, null), - e - } - , - t.prototype.remainder = function(t) { - var e = N(); - return this.divRemTo(t, null, e), - e - } - , - t.prototype.divideAndRemainder = function(t) { - var e = N() - , i = N(); - return this.divRemTo(t, e, i), - [e, i] - } - , - t.prototype.modPow = function(t, e) { - var i, r, n = t.bitLength(), s = C(1); - if (n <= 0) - return s; - i = n < 18 ? 1 : n < 48 ? 3 : n < 144 ? 4 : n < 768 ? 5 : 6, - r = n < 8 ? new A(e) : e.isEven() ? new I(e) : new V(e); - var o = [] - , h = 3 - , a = i - 1 - , u = (1 << i) - 1; - if (o[1] = r.convert(this), - i > 1) { - var c = N(); - for (r.sqrTo(o[1], c); h <= u; ) - o[h] = N(), - r.mulTo(c, o[h - 2], o[h]), - h += 2 - } - var f, l, p = t.t - 1, g = !0, d = N(); - for (n = F(t[p]) - 1; p >= 0; ) { - for (n >= a ? f = t[p] >> n - a & u : (f = (t[p] & (1 << n + 1) - 1) << a - n, - p > 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 << n); ) - r.sqrTo(s, d), - l = s, - s = d, - d = l, - --n < 0 && (n = this.DB - 1, - --p) - } - return r.revert(s) - } - , - t.prototype.modInverse = function(e) { - var i = e.isEven(); - if (this.isEven() && i || 0 == e.signum()) - return t.ZERO; - for (var r = e.clone(), n = this.clone(), s = C(1), o = C(0), h = C(0), a = C(1); 0 != r.signum(); ) { - for (; r.isEven(); ) - r.rShiftTo(1, r), - i ? (s.isEven() && o.isEven() || (s.addTo(this, s), - o.subTo(e, o)), - s.rShiftTo(1, s)) : o.isEven() || o.subTo(e, o), - o.rShiftTo(1, o); - for (; n.isEven(); ) - n.rShiftTo(1, n), - i ? (h.isEven() && a.isEven() || (h.addTo(this, h), - a.subTo(e, a)), - h.rShiftTo(1, h)) : a.isEven() || a.subTo(e, a), - a.rShiftTo(1, a); - r.compareTo(n) >= 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 O) - } - , - 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 (n < s && (s = n), - s > 0 && (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] <= x[x.length - 1]) { - for (e = 0; e < x.length; ++e) - if (i[0] == x[e]) - return !0; - return !1 - } - if (i.isEven()) - return !1; - for (e = 1; e < x.length; ) { - for (var r = x[e], n = e + 1; n < x.length && r < R; ) - r *= x[n++]; - for (r = i.modInt(r); e < n; ) - if (r % x[e++] == 0) - return !1 - } - return i.millerRabin(t) - } - , - t.prototype.copyTo = function(t) { - for (var e = this.t - 1; 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] : H(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) - 1) << o, - this[this.t++] = h >> this.DB - o) : this[this.t - 1] |= h << o, - (o += r) >= this.DB && (o -= this.DB)) - } - 8 == r && 0 != (128 & +e[0]) && (this.s = -1, - o > 0 && (this[this.t - 1] |= (1 << this.DB - o) - 1 << o)), - this.clamp(), - s && t.ZERO.subTo(this, this) - } - , - t.prototype.clamp = function() { - for (var t = this.s & this.DM; this.t > 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 < this.t; ++i) - e[i - t] = this[i]; - e.t = Math.max(this.t - t, 0), - e.s = this.s - } - , - t.prototype.lShiftTo = function(t, e) { - for (var i = t % this.DB, r = this.DB - i, n = (1 << r) - 1, s = Math.floor(t / this.DB), o = this.s << i & this.DM, h = this.t - 1; h >= 0; --h) - e[h + s + 1] = this[h] >> r | o, - o = (this[h] & n) << i; - for (h = s - 1; h >= 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) - 1; - e[0] = this[i] >> r; - for (var o = i + 1; o < this.t; ++o) - e[o - i - 1] |= (this[o] & s) << n, - e[o - i] = this[o] >> r; - r > 0 && (e[this.t - i - 1] |= (this.s & s) << n), - e.t = this.t - i, - e.clamp() - } - } - , - t.prototype.subTo = function(t, e) { - for (var i = 0, r = 0, n = Math.min(t.t, this.t); i < n; ) - r += this[i] - t[i], - e[i++] = r & this.DM, - r >>= this.DB; - if (t.t < this.t) { - for (r -= t.s; i < this.t; ) - r += this[i], - e[i++] = r & this.DM, - r >>= this.DB; - r += this.s - } else { - for (r += this.s; i < t.t; ) - r -= t[i], - e[i++] = r & this.DM, - r >>= 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 < n.t; ++s) - i[s + r.t] = r.am(0, n[s], i, s, 0, r.t); - i.s = 0, - i.clamp(), - this.s != e.s && t.ZERO.subTo(i, i) - } - , - t.prototype.squareTo = function(t) { - for (var e = this.abs(), i = t.t = 2 * e.t; --i >= 0; ) - t[i] = 0; - for (i = 0; i < e.t - 1; ++i) { - var r = e.am(i, e[i], t, 2 * i, 0, 1); - (t[i + e.t] += e.am(i + 1, 2 * e[i], t, 2 * i + 1, r, e.t - i - 1)) >= 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.t < n.t) - return null != i && i.fromInt(0), - void (null != r && this.copyTo(r)); - null == r && (r = N()); - var o = N() - , h = this.s - , a = e.s - , u = this.DB - F(n[n.t - 1]); - u > 0 ? (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 << this.F1) + (c > 1 ? o[c - 2] >> this.F2 : 0) - , p = this.FV / l - , g = (1 << this.F1) / l - , d = 1 << this.F2 - , v = r.t - , m = v - c - , y = null == i ? N() : i; - for (o.dlShiftTo(m, y), - r.compareTo(y) >= 0 && (r[r.t++] = 1, - r.subTo(y, r)), - t.ONE.dlShiftTo(c, y), - y.subTo(o, o); o.t < c; ) - o[o.t++] = 0; - for (; --m >= 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)) < b) - for (o.dlShiftTo(m, y), - r.subTo(y, r); r[v] < --b; ) - r.subTo(y, r) - } - null != i && (r.drShiftTo(c, i), - h != a && t.ZERO.subTo(i, i)), - r.t = c, - r.clamp(), - u > 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 = N() - , n = N() - , s = i.convert(this) - , o = F(e) - 1; - for (s.copyTo(r); --o >= 0; ) - if (i.sqrTo(r, n), - (e & 1 << o) > 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 = C(i) - , n = N() - , s = N() - , 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 < e.length; ++a) { - var u = H(e, a); - u < 0 ? "-" == e.charAt(a) && 0 == this.signum() && (s = !0) : (h = i * h + u, - ++o >= 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 << o) - 1 : n[0] = 0, - this.fromString(n, 256) - } - } - , - t.prototype.bitwiseTo = function(t, e, i) { - var r, n, s = Math.min(t.t, this.t); - for (r = 0; r < s; ++r) - i[r] = e(this[r], t[r]); - if (t.t < this.t) { - for (n = t.s & this.DM, - r = s; r < this.t; ++r) - i[r] = e(this[r], n); - i.t = this.t - } else { - for (n = this.s & this.DM, - r = s; r < t.t; ++r) - i[r] = e(n, t[r]); - i.t = t.t - } - i.s = e(this.s, t.s), - i.clamp() - } - , - t.prototype.changeBit = function(e, i) { - var r = t.ONE.shiftLeft(e); - return this.bitwiseTo(r, i, r), - r - } - , - t.prototype.addTo = function(t, e) { - for (var i = 0, r = 0, n = Math.min(t.t, this.t); i < n; ) - r += this[i] + t[i], - e[i++] = r & this.DM, - r >>= this.DB; - if (t.t < this.t) { - for (r += t.s; i < this.t; ) - r += this[i], - e[i++] = r & this.DM, - r >>= this.DB; - r += this.s - } else { - for (r += this.s; i < t.t; ) - r += t[i], - e[i++] = r & this.DM, - r >>= 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 < n; ++r) - i[r + this.t] = this.am(0, t[r], i, r, 0, this.t); - for (n = Math.min(t.t, e); r < n; ++r) - this.am(0, t[r], i, r, 0, e - r); - i.clamp() - } - , - t.prototype.multiplyUpperTo = function(t, e, i) { - --e; - var r = i.t = this.t + t.t - e; - for (i.s = 0; --r >= 0; ) - i[r] = 0; - for (r = Math.max(e - this.t, 0); r < t.t; ++r) - i[this.t + r - e] = this.am(e - r, t[r], i, 0, 0, this.t + r - e); - i.clamp(), - i.drShiftTo(1, i) - } - , - t.prototype.modInt = function(t) { - if (t <= 0) - return 0; - var e = this.DV % t - , i = this.s < 0 ? t - 1 : 0; - if (this.t > 0) - 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) > x.length && (e = x.length); - for (var s = N(), o = 0; o < e; ++o) { - s.fromInt(x[Math.floor(Math.random() * x.length)]); - var h = s.modPow(n, this); - if (0 != h.compareTo(t.ONE) && 0 != h.compareTo(i)) { - for (var a = 1; a++ < r && 0 != h.compareTo(i); ) - if (0 == (h = h.modPowInt(2, this)).compareTo(t.ONE)) - return !1; - if (0 != h.compareTo(i)) - return !1 - } - } - return !0 - } - , - t.prototype.square = function() { - var t = N(); - return this.squareTo(t), - t - } - , - t.prototype.gcda = function(t, e) { - var i = this.s < 0 ? this.negate() : this.clone() - , r = t.s < 0 ? t.negate() : t.clone(); - if (i.compareTo(r) < 0) { - var n = i; - i = r, - r = n - } - var s = i.getLowestSetBit() - , o = r.getLowestSetBit(); - if (o < 0) - e(i); - else { - s < o && (o = s), - o > 0 && (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 << u) - 1 : a[0] = 0, - this.fromString(a, 256) - } - } - , - t - }(), O = function() { - function t() {} - return t.prototype.convert = function(t) { - return t - } - , - t.prototype.revert = function(t) { - return t - } - , - t.prototype.mulTo = function(t, e, i) { - t.multiplyTo(e, i) - } - , - t.prototype.sqrTo = function(t, e) { - t.squareTo(e) - } - , - t - }(), A = function() { - function t(t) { - this.m = t - } - return t.prototype.convert = function(t) { - return t.s < 0 || t.compareTo(this.m) >= 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 - }(), V = function() { - function t(t) { - this.m = t, - this.mp = t.invDigit(), - this.mpl = 32767 & this.mp, - this.mph = this.mp >> 15, - this.um = (1 << t.DB - 15) - 1, - this.mt2 = 2 * t.t - } - return t.prototype.convert = function(t) { - var e = N(); - return t.abs().dlShiftTo(this.m.t, e), - e.divRemTo(this.m, null, e), - t.s < 0 && e.compareTo(B.ZERO) > 0 && this.m.subTo(e, e), - e - } - , - t.prototype.revert = function(t) { - var e = N(); - 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 < this.m.t; ++e) { - var i = 32767 & t[e] - , r = i * this.mpl + ((i * this.mph + (t[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 - }(), I = function() { - function t(t) { - this.m = t, - this.r2 = N(), - this.q3 = N(), - B.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 = N(); - 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 N() { - return new B(null) - } - function P(t, e) { - return new B(t,e) - } - var M = "undefined" != typeof navigator; - M && "Microsoft Internet Explorer" == navigator.appName ? (B.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 - } - , - S = 30) : M && "Netscape" != navigator.appName ? (B.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 - } - , - S = 26) : (B.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 - } - , - S = 28), - B.prototype.DB = S, - B.prototype.DM = (1 << S) - 1, - B.prototype.DV = 1 << S, - B.prototype.FV = Math.pow(2, 52), - B.prototype.F1 = 52 - S, - B.prototype.F2 = 2 * S - 52; - var j, q, L = []; - for (j = "0".charCodeAt(0), - q = 0; q <= 9; ++q) - L[j++] = q; - for (j = "a".charCodeAt(0), - q = 10; q < 36; ++q) - L[j++] = q; - for (j = "A".charCodeAt(0), - q = 10; q < 36; ++q) - L[j++] = q; - function H(t, e) { - var i = L[t.charCodeAt(e)]; - return null == i ? -1 : i - } - function C(t) { - var e = N(); - return e.fromInt(t), - e - } - function F(t) { - var e, i = 1; - return 0 != (e = t >>> 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 - } - B.ZERO = C(0), - B.ONE = C(1); - var U, K, k = 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 - }(), _ = null; - if (null == _) { - _ = [], - K = 0; - var z = void 0; - if (window.crypto && window.crypto.getRandomValues) { - var Z = new Uint32Array(256); - for (window.crypto.getRandomValues(Z), - z = 0; z < Z.length; ++z) - _[K++] = 255 & Z[z] - } - var G = 0 - , $ = function(t) { - if ((G = G || 0) >= 256 || K >= 256) - window.removeEventListener ? window.removeEventListener("mousemove", $, !1) : window.detachEvent && window.detachEvent("onmousemove", $); - else - try { - var e = t.x + t.y; - _[K++] = 255 & e, - G += 1 - } catch (t) {} - }; - window.addEventListener ? window.addEventListener("mousemove", $, !1) : window.attachEvent && window.attachEvent("onmousemove", $) - } - function Y() { - if (null == U) { - for (U = new k; K < 256; ) { - var t = Math.floor(65536 * Math.random()); - _[K++] = 255 & t - } - for (U.init(_), - K = 0; K < _.length; ++K) - _[K] = 0; - K = 0 - } - return U.next() - } - var J = function() { - function t() {} - return t.prototype.nextBytes = function(t) { - for (var e = 0; e < t.length; ++e) - t[e] = Y() - } - , - t - }() - , X = function() { - function t() { - 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 t.prototype.doPublic = function(t) { - return t.modPowInt(this.e, this.n) - } - , - t.prototype.doPrivate = function(t) { - if (null == this.p || null == this.q) - return t.modPow(this.d, this.n); - for (var e = t.mod(this.p).modPow(this.dmp1, this.p), i = t.mod(this.q).modPow(this.dmq1, this.q); e.compareTo(i) < 0; ) - e = e.add(this.p); - return e.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i) - } - , - t.prototype.setPublic = function(t, e) { - null != t && null != e && t.length > 0 && e.length > 0 ? (this.n = P(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 < t.length + 11) - return console.error("Message too long for RSA"), - null; - for (var i = [], r = t.length - 1; r >= 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 J, 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 B(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 = P(t, 16), - this.e = parseInt(e, 16), - this.d = P(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 = P(t, 16), - this.e = parseInt(e, 16), - this.d = P(i, 16), - this.p = P(r, 16), - this.q = P(n, 16), - this.dmp1 = P(s, 16), - this.dmq1 = P(o, 16), - this.coeff = P(h, 16)) : console.error("Invalid RSA private key") - } - , - t.prototype.generate = function(t, e) { - var i = new J - , r = t >> 1; - this.e = parseInt(e, 16); - for (var n = new B(e,16); ; ) { - for (; this.p = new B(t - r,1,i), - 0 != this.p.subtract(B.ONE).gcd(n).compareTo(B.ONE) || !this.p.isProbablePrime(10); ) - ; - for (; this.q = new B(r,1,i), - 0 != this.q.subtract(B.ONE).gcd(n).compareTo(B.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(B.ONE) - , h = this.q.subtract(B.ONE) - , a = o.multiply(h); - if (0 == a.gcd(n).compareTo(B.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 = P(t, 16) - , i = this.doPrivate(e); - return null == i ? null : function(t, e) { - for (var i = t.toByteArray(), r = 0; r < i.length && 0 == i[r]; ) - ++r; - if (i.length - r != e - 1 || 2 != i[r]) - return null; - for (++r; 0 != i[r]; ) - if (++r >= i.length) - return null; - for (var n = ""; ++r < i.length; ) { - var s = 255 & i[r]; - s < 128 ? n += String.fromCharCode(s) : s > 191 && 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 J - , n = t >> 1; - this.e = parseInt(e, 16); - var s = new B(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(B.ONE) - , r = o.q.subtract(B.ONE) - , n = e.multiply(r); - 0 == n.gcd(s).compareTo(B.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 = N(), - o.q.fromNumberAsync(n, 1, r, (function() { - o.q.subtract(B.ONE).gcda(s, (function(t) { - 0 == t.compareTo(B.ONE) && o.q.isProbablePrime(10) ? setTimeout(e, 0) : setTimeout(a, 0) - } - )) - } - )) - } - , u = function() { - o.p = N(), - o.p.fromNumberAsync(t - n, 1, r, (function() { - o.p.subtract(B.ONE).gcda(s, (function(t) { - 0 == t.compareTo(B.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 (e < t.length + 22) - return console.error("Message too long for RSA"), - null; - for (var i = e - t.length - 6, r = "", n = 0; n < i; n += 2) - r += "ff"; - return P("0001" + r + "00" + t, 16) - }((Q[i] || "") + e(t).toString(), this.n.bitLength() / 4); - if (null == r) - return null; - var n = this.doPrivate(r); - if (null == n) - return null; - var s = n.toString(16); - return 0 == (1 & s.length) ? s : "0" + s - } - , - t.prototype.verify = function(t, e, i) { - var r = P(e, 16) - , n = this.doPublic(r); - return null == n ? null : function(t) { - for (var e in Q) - if (Q.hasOwnProperty(e)) { - var i = Q[e] - , r = i.length; - if (t.substr(0, r) == i) - return t.substr(r) - } - return t - }(n.toString(16).replace(/^1f+00/, "")) == i(t).toString() - } - , - t - }() - , Q = { - md2: "3020300c06082a864886f70d020205000410", - md5: "3020300c06082a864886f70d020505000410", - sha1: "3021300906052b0e03021a05000414", - sha224: "302d300d06096086480165030402040500041c", - sha256: "3031300d060960864801650304020105000420", - sha384: "3041300d060960864801650304020205000430", - sha512: "3051300d060960864801650304020305000440", - ripemd160: "3021300906052b2403020105000414" - } - , W = {}; - W.lang = { - extend: function(t, e, i) { - if (!e || !t) - throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included."); - var r = function() {}; - if (r.prototype = e.prototype, - t.prototype = new r, - t.prototype.constructor = t, - t.superclass = e.prototype, - e.prototype.constructor == Object.prototype.constructor && (e.prototype.constructor = e), - i) { - var n; - for (n in i) - t.prototype[n] = i[n]; - var s = function() {} - , o = ["toString", "valueOf"]; - try { - /MSIE/.test(navigator.userAgent) && (s = function(t, e) { - for (n = 0; n < o.length; n += 1) { - var i = o[n] - , r = e[i]; - "function" == typeof r && r != Object.prototype[i] && (t[i] = r) - } - } - ) - } catch (t) {} - s(t.prototype, i) - } - } - }; - var tt = {}; - void 0 !== tt.asn1 && tt.asn1 || (tt.asn1 = {}), - tt.asn1.ASN1Util = new function() { - this.integerToByteHex = function(t) { - var e = t.toString(16); - return e.length % 2 == 1 && (e = "0" + e), - e - } - , - this.bigIntToMinTwosComplementsHex = function(t) { - var e = t.toString(16); - if ("-" != e.substr(0, 1)) - e.length % 2 == 1 ? e = "0" + e : e.match(/^[0-7]/) || (e = "00" + e); - else { - var i = e.substr(1).length; - i % 2 == 1 ? i += 1 : e.match(/^[0-7]/) || (i += 2); - for (var r = "", n = 0; n < i; n++) - r += "f"; - e = new B(r,16).xor(t).add(B.ONE).toString(16).replace(/^-/, "") - } - return e - } - , - this.getPEMStringFromHex = function(t, e) { - return hextopem(t, e) - } - , - this.newObject = function(t) { - var e = tt.asn1 - , i = e.DERBoolean - , r = e.DERInteger - , n = e.DERBitString - , s = e.DEROctetString - , o = e.DERNull - , h = e.DERObjectIdentifier - , a = e.DEREnumerated - , u = e.DERUTF8String - , c = e.DERNumericString - , f = e.DERPrintableString - , l = e.DERTeletexString - , p = e.DERIA5String - , g = e.DERUTCTime - , d = e.DERGeneralizedTime - , v = e.DERSequence - , m = e.DERSet - , y = e.DERTaggedObject - , b = e.ASN1Util.newObject - , T = Object.keys(t); - if (1 != T.length) - throw "key of param shall be only one."; - var S = T[0]; - if (-1 == ":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":" + S + ":")) - throw "undefined key: " + S; - if ("bool" == S) - return new i(t[S]); - if ("int" == S) - return new r(t[S]); - if ("bitstr" == S) - return new n(t[S]); - if ("octstr" == S) - return new s(t[S]); - if ("null" == S) - return new o(t[S]); - if ("oid" == S) - return new h(t[S]); - if ("enum" == S) - return new a(t[S]); - if ("utf8str" == S) - return new u(t[S]); - if ("numstr" == S) - return new c(t[S]); - if ("prnstr" == S) - return new f(t[S]); - if ("telstr" == S) - return new l(t[S]); - if ("ia5str" == S) - return new p(t[S]); - if ("utctime" == S) - return new g(t[S]); - if ("gentime" == S) - return new d(t[S]); - if ("seq" == S) { - for (var E = t[S], w = [], D = 0; D < E.length; D++) { - var x = b(E[D]); - w.push(x) - } - return new v({ - array: w - }) - } - if ("set" == S) { - for (E = t[S], - w = [], - D = 0; D < E.length; D++) - x = b(E[D]), - w.push(x); - return new m({ - array: w - }) - } - if ("tag" == S) { - var R = t[S]; - if ("[object Array]" === Object.prototype.toString.call(R) && 3 == R.length) { - var B = b(R[2]); - return new y({ - tag: R[0], - explicit: R[1], - obj: B - }) - } - var O = {}; - if (void 0 !== R.explicit && (O.explicit = R.explicit), - void 0 !== R.tag && (O.tag = R.tag), - void 0 === R.obj) - throw "obj shall be specified for 'tag'."; - return O.obj = b(R.obj), - new y(O) - } - } - , - this.jsonToASN1HEX = function(t) { - return this.newObject(t).getEncodedHex() - } - } - , - tt.asn1.ASN1Util.oidHexToInt = function(t) { - for (var e = "", i = parseInt(t.substr(0, 2), 16), r = (e = Math.floor(i / 40) + "." + i % 40, - ""), n = 2; n < t.length; n += 2) { - var s = ("00000000" + parseInt(t.substr(n, 2), 16).toString(2)).slice(-8); - r += s.substr(1, 7), - "0" == s.substr(0, 1) && (e = e + "." + new B(r,2).toString(10), - r = "") - } - return e - } - , - tt.asn1.ASN1Util.oidIntToHex = function(t) { - var e = function(t) { - var e = t.toString(16); - return 1 == e.length && (e = "0" + e), - e - } - , i = function(t) { - var i = "" - , r = new B(t,10).toString(2) - , n = 7 - r.length % 7; - 7 == n && (n = 0); - for (var s = "", o = 0; o < n; o++) - s += "0"; - for (r = s + r, - o = 0; o < r.length - 1; o += 7) { - var h = r.substr(o, 7); - o != r.length - 7 && (h = "1" + h), - i += e(parseInt(h, 2)) - } - return i - }; - if (!t.match(/^[0-9.]+$/)) - throw "malformed oid string: " + t; - var r = "" - , n = t.split(".") - , s = 40 * parseInt(n[0]) + parseInt(n[1]); - r += e(s), - n.splice(0, 2); - for (var o = 0; o < n.length; o++) - r += i(n[o]); - return r - } - , - tt.asn1.ASN1Object = function() { - this.getLengthHexFromValue = function() { - if (void 0 === this.hV || null == this.hV) - throw "this.hV is null or undefined."; - if (this.hV.length % 2 == 1) - throw "value hex must be even length: n=" + "".length + ",v=" + this.hV; - var t = this.hV.length / 2 - , e = t.toString(16); - if (e.length % 2 == 1 && (e = "0" + e), - t < 128) - return e; - var i = e.length / 2; - if (i > 15) - 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 "" - } - } - , - tt.asn1.DERAbstractString = function(t) { - tt.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)) - } - , - W.lang.extend(tt.asn1.DERAbstractString, tt.asn1.ASN1Object), - tt.asn1.DERAbstractTime = function(t) { - tt.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 - } - } - , - W.lang.extend(tt.asn1.DERAbstractTime, tt.asn1.ASN1Object), - tt.asn1.DERAbstractStructured = function(t) { - tt.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) - } - , - W.lang.extend(tt.asn1.DERAbstractStructured, tt.asn1.ASN1Object), - tt.asn1.DERBoolean = function() { - tt.asn1.DERBoolean.superclass.constructor.call(this), - this.hT = "01", - this.hTLV = "0101ff" - } - , - W.lang.extend(tt.asn1.DERBoolean, tt.asn1.ASN1Object), - tt.asn1.DERInteger = function(t) { - tt.asn1.DERInteger.superclass.constructor.call(this), - this.hT = "02", - this.setByBigInteger = function(t) { - this.hTLV = null, - this.isModified = !0, - this.hV = tt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t) - } - , - this.setByInteger = function(t) { - var e = new B(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)) - } - , - W.lang.extend(tt.asn1.DERInteger, tt.asn1.ASN1Object), - tt.asn1.DERBitString = function(t) { - if (void 0 !== t && void 0 !== t.obj) { - var e = tt.asn1.ASN1Util.newObject(t.obj); - t.hex = "00" + e.getEncodedHex() - } - tt.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 < t) - throw "unused bits shall be from 0 to 7: u = " + t; - var i = "0" + t; - this.hTLV = null, - this.isModified = !0, - this.hV = i + e - } - , - this.setByBinaryString = function(t) { - var e = 8 - (t = t.replace(/0+$/, "")).length % 8; - 8 == e && (e = 0); - for (var i = 0; i <= e; i++) - t += "0"; - var r = ""; - for (i = 0; i < t.length - 1; i += 8) { - var n = t.substr(i, 8) - , s = parseInt(n, 2).toString(16); - 1 == s.length && (s = "0" + s), - r += s - } - this.hTLV = null, - this.isModified = !0, - this.hV = "0" + e + r - } - , - this.setByBooleanArray = function(t) { - for (var e = "", i = 0; i < t.length; i++) - 1 == t[i] ? e += "1" : e += "0"; - this.setByBinaryString(e) - } - , - this.newFalseArray = function(t) { - for (var e = new Array(t), i = 0; i < t; i++) - e[i] = !1; - return e - } - , - this.getFreshValueHex = function() { - return this.hV - } - , - void 0 !== t && ("string" == typeof t && t.toLowerCase().match(/^[0-9a-f]+$/) ? this.setHexValueIncludingUnusedBits(t) : void 0 !== t.hex ? this.setHexValueIncludingUnusedBits(t.hex) : void 0 !== t.bin ? this.setByBinaryString(t.bin) : void 0 !== t.array && this.setByBooleanArray(t.array)) - } - , - W.lang.extend(tt.asn1.DERBitString, tt.asn1.ASN1Object), - tt.asn1.DEROctetString = function(t) { - if (void 0 !== t && void 0 !== t.obj) { - var e = tt.asn1.ASN1Util.newObject(t.obj); - t.hex = e.getEncodedHex() - } - tt.asn1.DEROctetString.superclass.constructor.call(this, t), - this.hT = "04" - } - , - W.lang.extend(tt.asn1.DEROctetString, tt.asn1.DERAbstractString), - tt.asn1.DERNull = function() { - tt.asn1.DERNull.superclass.constructor.call(this), - this.hT = "05", - this.hTLV = "0500" - } - , - W.lang.extend(tt.asn1.DERNull, tt.asn1.ASN1Object), - tt.asn1.DERObjectIdentifier = function(t) { - var e = function(t) { - var e = t.toString(16); - return 1 == e.length && (e = "0" + e), - e - } - , i = function(t) { - var i = "" - , r = new B(t,10).toString(2) - , n = 7 - r.length % 7; - 7 == n && (n = 0); - for (var s = "", o = 0; o < n; o++) - s += "0"; - for (r = s + r, - o = 0; o < r.length - 1; o += 7) { - var h = r.substr(o, 7); - o != r.length - 7 && (h = "1" + h), - i += e(parseInt(h, 2)) - } - return i - }; - tt.asn1.DERObjectIdentifier.superclass.constructor.call(this), - this.hT = "06", - this.setValueHex = function(t) { - this.hTLV = null, - this.isModified = !0, - this.s = null, - this.hV = t - } - , - this.setValueOidString = function(t) { - if (!t.match(/^[0-9.]+$/)) - throw "malformed oid string: " + t; - var r = "" - , n = t.split(".") - , s = 40 * parseInt(n[0]) + parseInt(n[1]); - r += e(s), - n.splice(0, 2); - for (var o = 0; o < n.length; o++) - r += i(n[o]); - this.hTLV = null, - this.isModified = !0, - this.s = null, - this.hV = r - } - , - this.setValueName = function(t) { - var e = tt.asn1.x509.OID.name2oid(t); - if ("" === e) - throw "DERObjectIdentifier oidName undefined: " + t; - this.setValueOidString(e) - } - , - this.getFreshValueHex = function() { - return this.hV - } - , - void 0 !== t && ("string" == typeof t ? t.match(/^[0-2].[0-9.]+$/) ? this.setValueOidString(t) : this.setValueName(t) : void 0 !== t.oid ? this.setValueOidString(t.oid) : void 0 !== t.hex ? this.setValueHex(t.hex) : void 0 !== t.name && this.setValueName(t.name)) - } - , - W.lang.extend(tt.asn1.DERObjectIdentifier, tt.asn1.ASN1Object), - tt.asn1.DEREnumerated = function(t) { - tt.asn1.DEREnumerated.superclass.constructor.call(this), - this.hT = "0a", - this.setByBigInteger = function(t) { - this.hTLV = null, - this.isModified = !0, - this.hV = tt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t) - } - , - this.setByInteger = function(t) { - var e = new B(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.int ? this.setByInteger(t.int) : "number" == typeof t ? this.setByInteger(t) : void 0 !== t.hex && this.setValueHex(t.hex)) - } - , - W.lang.extend(tt.asn1.DEREnumerated, tt.asn1.ASN1Object), - tt.asn1.DERUTF8String = function(t) { - tt.asn1.DERUTF8String.superclass.constructor.call(this, t), - this.hT = "0c" - } - , - W.lang.extend(tt.asn1.DERUTF8String, tt.asn1.DERAbstractString), - tt.asn1.DERNumericString = function(t) { - tt.asn1.DERNumericString.superclass.constructor.call(this, t), - this.hT = "12" - } - , - W.lang.extend(tt.asn1.DERNumericString, tt.asn1.DERAbstractString), - tt.asn1.DERPrintableString = function(t) { - tt.asn1.DERPrintableString.superclass.constructor.call(this, t), - this.hT = "13" - } - , - W.lang.extend(tt.asn1.DERPrintableString, tt.asn1.DERAbstractString), - tt.asn1.DERTeletexString = function(t) { - tt.asn1.DERTeletexString.superclass.constructor.call(this, t), - this.hT = "14" - } - , - W.lang.extend(tt.asn1.DERTeletexString, tt.asn1.DERAbstractString), - tt.asn1.DERIA5String = function(t) { - tt.asn1.DERIA5String.superclass.constructor.call(this, t), - this.hT = "16" - } - , - W.lang.extend(tt.asn1.DERIA5String, tt.asn1.DERAbstractString), - tt.asn1.DERUTCTime = function(t) { - tt.asn1.DERUTCTime.superclass.constructor.call(this, t), - this.hT = "17", - this.setByDate = function(t) { - this.hTLV = null, - this.isModified = !0, - this.date = t, - this.s = this.formatDate(this.date, "utc"), - this.hV = stohex(this.s) - } - , - this.getFreshValueHex = function() { - return void 0 === this.date && void 0 === this.s && (this.date = new Date, - this.s = this.formatDate(this.date, "utc"), - this.hV = stohex(this.s)), - this.hV - } - , - void 0 !== t && (void 0 !== t.str ? this.setString(t.str) : "string" == typeof t && t.match(/^[0-9]{12}Z$/) ? this.setString(t) : void 0 !== t.hex ? this.setStringHex(t.hex) : void 0 !== t.date && this.setByDate(t.date)) - } - , - W.lang.extend(tt.asn1.DERUTCTime, tt.asn1.DERAbstractTime), - tt.asn1.DERGeneralizedTime = function(t) { - tt.asn1.DERGeneralizedTime.superclass.constructor.call(this, t), - this.hT = "18", - this.withMillis = !1, - this.setByDate = function(t) { - this.hTLV = null, - this.isModified = !0, - this.date = t, - this.s = this.formatDate(this.date, "gen", this.withMillis), - this.hV = stohex(this.s) - } - , - this.getFreshValueHex = function() { - return void 0 === this.date && void 0 === this.s && (this.date = new Date, - this.s = this.formatDate(this.date, "gen", this.withMillis), - this.hV = stohex(this.s)), - this.hV - } - , - void 0 !== t && (void 0 !== t.str ? this.setString(t.str) : "string" == typeof t && t.match(/^[0-9]{14}Z$/) ? this.setString(t) : void 0 !== t.hex ? this.setStringHex(t.hex) : void 0 !== t.date && this.setByDate(t.date), - !0 === t.millis && (this.withMillis = !0)) - } - , - W.lang.extend(tt.asn1.DERGeneralizedTime, tt.asn1.DERAbstractTime), - tt.asn1.DERSequence = function(t) { - tt.asn1.DERSequence.superclass.constructor.call(this, t), - this.hT = "30", - this.getFreshValueHex = function() { - for (var t = "", e = 0; e < this.asn1Array.length; e++) - t += this.asn1Array[e].getEncodedHex(); - return this.hV = t, - this.hV - } - } - , - W.lang.extend(tt.asn1.DERSequence, tt.asn1.DERAbstractStructured), - tt.asn1.DERSet = function(t) { - tt.asn1.DERSet.superclass.constructor.call(this, t), - this.hT = "31", - this.sortFlag = !0, - this.getFreshValueHex = function() { - for (var t = new Array, e = 0; e < this.asn1Array.length; e++) { - var i = this.asn1Array[e]; - t.push(i.getEncodedHex()) - } - return 1 == this.sortFlag && t.sort(), - this.hV = t.join(""), - this.hV - } - , - void 0 !== t && void 0 !== t.sortflag && 0 == t.sortflag && (this.sortFlag = !1) - } - , - W.lang.extend(tt.asn1.DERSet, tt.asn1.DERAbstractStructured), - tt.asn1.DERTaggedObject = function(t) { - tt.asn1.DERTaggedObject.superclass.constructor.call(this), - this.hT = "a0", - this.hV = "", - this.isExplicit = !0, - this.asn1Object = null, - this.setASN1Object = function(t, e, i) { - this.hT = e, - this.isExplicit = t, - this.asn1Object = i, - this.isExplicit ? (this.hV = this.asn1Object.getEncodedHex(), - this.hTLV = null, - this.isModified = !0) : (this.hV = null, - this.hTLV = i.getEncodedHex(), - this.hTLV = this.hTLV.replace(/^../, e), - this.isModified = !1) - } - , - this.getFreshValueHex = function() { - return this.hV - } - , - void 0 !== t && (void 0 !== t.tag && (this.hT = t.tag), - void 0 !== t.explicit && (this.isExplicit = t.explicit), - void 0 !== t.obj && (this.asn1Object = t.obj, - this.setASN1Object(this.isExplicit, this.hT, this.asn1Object))) - } - , - W.lang.extend(tt.asn1.DERTaggedObject, tt.asn1.ASN1Object); - var et, it = (et = function(t, e) { - return (et = Object.setPrototypeOf || { - __proto__: [] - }instanceof Array && function(t, e) { - t.__proto__ = e - } - || function(t, e) { - for (var i in e) - Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]) - } - )(t, e) - } - , - function(t, e) { - if ("function" != typeof e && null !== e) - throw new TypeError("Class extends value " + String(e) + " is not a constructor or null"); - function i() { - this.constructor = t - } - et(t, e), - t.prototype = null === e ? Object.create(e) : (i.prototype = e.prototype, - new i) - } - ), rt = function(t) { - function e(i) { - var r = t.call(this) || this; - return i && ("string" == typeof i ? r.parseKey(i) : (e.hasPrivateKeyProperty(i) || e.hasPublicKeyProperty(i)) && r.parsePropertiesFrom(i)), - r - } - return it(e, t), - e.prototype.parseKey = function(t) { - try { - var e = 0 - , i = 0 - , r = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(t) ? function(t) { - var e; - if (void 0 === c) { - var i = "0123456789ABCDEF" - , r = " \f\n\r\t \u2028\u2029"; - for (c = {}, - e = 0; e < 16; ++e) - c[i.charAt(e)] = e; - for (i = i.toLowerCase(), - e = 10; e < 16; ++e) - c[i.charAt(e)] = e; - for (e = 0; e < r.length; ++e) - c[r.charAt(e)] = -1 - } - var n = [] - , s = 0 - , o = 0; - for (e = 0; e < t.length; ++e) { - var h = t.charAt(e); - if ("=" == h) - break; - if (-1 != (h = c[h])) { - if (void 0 === h) - throw new Error("Illegal character at offset " + e); - s |= h, - ++o >= 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) : d.unarmor(t) - , n = w.decode(r); - if (3 === n.sub.length && (n = n.sub[2].sub[0]), - 9 === n.sub.length) { - e = n.sub[1].getHexStringValue(), - this.n = P(e, 16), - i = n.sub[2].getHexStringValue(), - this.e = parseInt(i, 16); - var s = n.sub[3].getHexStringValue(); - this.d = P(s, 16); - var o = n.sub[4].getHexStringValue(); - this.p = P(o, 16); - var h = n.sub[5].getHexStringValue(); - this.q = P(h, 16); - var a = n.sub[6].getHexStringValue(); - this.dmp1 = P(a, 16); - var u = n.sub[7].getHexStringValue(); - this.dmq1 = P(u, 16); - var f = n.sub[8].getHexStringValue(); - this.coeff = P(f, 16) - } else { - if (2 !== n.sub.length) - return !1; - var l = n.sub[1].sub[0]; - e = l.sub[0].getHexStringValue(), - this.n = P(e, 16), - i = l.sub[1].getHexStringValue(), - this.e = parseInt(i, 16) - } - return !0 - } catch (t) { - return !1 - } - } - , - e.prototype.getPrivateBaseKey = function() { - var t = { - array: [new tt.asn1.DERInteger({ - int: 0 - }), new tt.asn1.DERInteger({ - bigint: this.n - }), new tt.asn1.DERInteger({ - int: this.e - }), new tt.asn1.DERInteger({ - bigint: this.d - }), new tt.asn1.DERInteger({ - bigint: this.p - }), new tt.asn1.DERInteger({ - bigint: this.q - }), new tt.asn1.DERInteger({ - bigint: this.dmp1 - }), new tt.asn1.DERInteger({ - bigint: this.dmq1 - }), new tt.asn1.DERInteger({ - bigint: this.coeff - })] - }; - return new tt.asn1.DERSequence(t).getEncodedHex() - } - , - e.prototype.getPrivateBaseKeyB64 = function() { - return l(this.getPrivateBaseKey()) - } - , - e.prototype.getPublicBaseKey = function() { - var t = new tt.asn1.DERSequence({ - array: [new tt.asn1.DERObjectIdentifier({ - oid: "1.2.840.113549.1.1.1" - }), new tt.asn1.DERNull] - }) - , e = new tt.asn1.DERSequence({ - array: [new tt.asn1.DERInteger({ - bigint: this.n - }), new tt.asn1.DERInteger({ - int: this.e - })] - }) - , i = new tt.asn1.DERBitString({ - hex: "00" + e.getEncodedHex() - }); - return new tt.asn1.DERSequence({ - array: [t, i] - }).getEncodedHex() - } - , - e.prototype.getPublicBaseKeyB64 = function() { - return l(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 - }(X); - const nt = 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 rt(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(p(t)) - } catch (t) { - return !1 - } - } - , - t.prototype.encrypt = function(t) { - try { - return l(this.getKey().encrypt(t)) - } catch (t) { - return !1 - } - } - , - t.prototype.sign = function(t, e, i) { - try { - return l(this.getKey().sign(t, e, i)) - } catch (t) { - return !1 - } - } - , - t.prototype.verify = function(t, e, i) { - try { - return this.getKey().verify(t, p(e), i) - } catch (t) { - return !1 - } - } - , - t.prototype.getKey = function(t) { - if (!this.key) { - if (this.key = new rt, - 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 = "3.2.1", - t - }() - } - ] - , e = { - d: (t,i)=>{ - for (var r in i) - e.o(i, r) && !e.o(t, r) && Object.defineProperty(t, r, { - enumerable: !0, - get: i[r] - }) - } - , - o: (t,e)=>Object.prototype.hasOwnProperty.call(t, e) - } - , i = {}; - return t[1](0, i, e), - i.default - } - )() +/*这个js库函数的解密函数功能不太正常,加密功能正常,可用于登录页面的用户名与密码加密*/ +var JSEncryptExports = {}; +(function(exports) { +function BigInteger(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 nbi(){ + return new BigInteger(null) +} +function am1(a,b,c,d,e,f){ + for(;--f>=0;){var g=b*this[a++]+c[d]+e;e=Math.floor(g/67108864),c[d++]=67108863&g}return e +} +function am2(a,b,c,d,e,f){ + for(var g=32767&b,h=b>>15;--f>=0;){var i=32767&this[a],j=this[a++]>>15,k=h*i+j*g;i=g*i+((32767&k)<<15)+c[d]+(1073741823&e),e=(i>>>30)+(k>>>15)+h*j+(e>>>30),c[d++]=1073741823&i}return e +} +function am3(a,b,c,d,e,f){ + for(var g=16383&b,h=b>>14;--f>=0;){var i=16383&this[a],j=this[a++]>>14,k=h*i+j*g;i=g*i+((16383&k)<<14)+c[d]+e,e=(i>>28)+(k>>14)+h*j,c[d++]=268435455&i}return e +} +function int2char(a){ + return BI_RM.charAt(a) +} +function intAt(a,b){ + var c=BI_RC[a.charCodeAt(b)];return null==c?-1:c +} +function bnpCopyTo(a){for(var b=this.t-1;b>=0;--b)a[b]=this[b];a.t=this.t,a.s=this.s} +function bnpFromInt(a){this.t=1,this.s=0>a?-1:0,a>0?this[0]=a:-1>a?this[0]=a+DV:this.t=0} +function nbv(a){var b=nbi();return b.fromInt(a),b} +function bnpFromString(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)return void this.fromRadix(a,b);c=2}this.t=0,this.s=0;for(var d=a.length,e=!1,f=0;--d>=0;){var g=8==c?255&a[d]:intAt(a,d);0>g?"-"==a.charAt(d)&&(e=!0):(e=!1,0==f?this[this.t++]=g:f+c>this.DB?(this[this.t-1]|=(g&(1<>this.DB-f):this[this.t-1]|=g<=this.DB&&(f-=this.DB))}8==c&&0!=(128&a[0])&&(this.s=-1,f>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==a;)--this.t} +function bnToString(a){if(this.s<0)return"-"+this.negate().toString(a);var b;if(16==a)b=4;else if(8==a)b=3;else if(2==a)b=1;else if(32==a)b=5;else{if(4!=a)return this.toRadix(a);b=2}var c,d=(1<0)for(h>h)>0&&(e=!0,f=int2char(c));g>=0;)b>h?(c=(this[g]&(1<>(h+=this.DB-b)):(c=this[g]>>(h-=b)&d,0>=h&&(h+=this.DB,--g)),c>0&&(e=!0),e&&(f+=int2char(c));return e?f:"0"} +function bnNegate(){var a=nbi();return BigInteger.ZERO.subTo(this,a),a} +function bnAbs(){return this.s<0?this.negate():this} +function bnCompareTo(a){var b=this.s-a.s;if(0!=b)return b;var c=this.t;if(b=c-a.t,0!=b)return this.s<0?-b:b;for(;--c>=0;)if(0!=(b=this[c]-a[c]))return b;return 0} +function nbits(a){var b,c=1;return 0!=(b=a>>>16)&&(a=b,c+=16),0!=(b=a>>8)&&(a=b,c+=8),0!=(b=a>>4)&&(a=b,c+=4),0!=(b=a>>2)&&(a=b,c+=2),0!=(b=a>>1)&&(a=b,c+=1),c} +function bnBitLength(){return this.t<=0?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)} +function bnpDLShiftTo(a,b){var c;for(c=this.t-1;c>=0;--c)b[c+a]=this[c];for(c=a-1;c>=0;--c)b[c]=0;b.t=this.t+a,b.s=this.s} +function bnpDRShiftTo(a,b){for(var c=a;c=0;--c)b[c+g+1]=this[c]>>e|h,h=(this[c]&f)<=0;--c)b[c]=0;b[g]=h,b.t=this.t+g+1,b.s=this.s,b.clamp()} +function bnpRShiftTo(a,b){b.s=this.s;var c=Math.floor(a/this.DB);if(c>=this.t)return void(b.t=0);var d=a%this.DB,e=this.DB-d,f=(1<>d;for(var g=c+1;g>d;d>0&&(b[this.t-c-1]|=(this.s&f)<c;)d+=this[c]-a[c],b[c++]=d&this.DM,d>>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d-=a.s}b.s=0>d?-1:0,-1>d?b[c++]=this.DV+d:d>0&&(b[c++]=d),b.t=c,b.clamp()} +function bnpMultiplyTo(a,b){var c=this.abs(),d=a.abs(),e=c.t;for(b.t=e+d.t;--e>=0;)b[e]=0;for(e=0;e=0;)a[c]=0;for(c=0;c=b.DV&&(a[c+b.t]-=b.DV,a[c+b.t+1]=1)}a.t>0&&(a[a.t-1]+=b.am(c,b[c],a,2*c,0,1)),a.s=0,a.clamp()} +function bnpDivRemTo(a,b,c){var d=a.abs();if(!(d.t<=0)){var e=this.abs();if(e.t0?(d.lShiftTo(i,f),e.lShiftTo(i,c)):(d.copyTo(f),e.copyTo(c));var j=f.t,k=f[j-1];if(0!=k){var l=k*(1<1?f[j-2]>>this.F2:0),m=this.FV/l,n=(1<=0&&(c[c.t++]=1,c.subTo(r,c)),BigInteger.ONE.dlShiftTo(j,r),r.subTo(f,f);f.t=0;){var s=c[--p]==k?this.DM:Math.floor(c[p]*m+(c[p-1]+o)*n);if((c[p]+=f.am(0,s,c,q,0,j))0&&c.rShiftTo(i,c),0>g&&BigInteger.ZERO.subTo(c,c)}}} +function bnMod(a){var b=nbi();return this.abs().divRemTo(a,null,b),this.s<0&&b.compareTo(BigInteger.ZERO)>0&&a.subTo(b,b),b} +function Classic(a){this.m=a}function cConvert(a){return a.s<0||a.compareTo(this.m)>=0?a.mod(this.m):a}function cRevert(a){return a}function cReduce(a){a.divRemTo(this.m,null,a)}function cMulTo(a,b,c){a.multiplyTo(b,c),this.reduce(c)}function cSqrTo(a,b){a.squareTo(b),this.reduce(b)}function bnpInvDigit(){if(this.t<1)return 0;var a=this[0];if(0==(1&a))return 0;var b=3&a;return b=b*(2-(15&a)*b)&15,b=b*(2-(255&a)*b)&255,b=b*(2-((65535&a)*b&65535))&65535,b=b*(2-a*b%this.DV)%this.DV,b>0?this.DV-b:-b}function Montgomery(a){this.m=a,this.mp=a.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(b,b),b}function montRevert(a){var b=nbi();return a.copyTo(b),this.reduce(b),b}function montReduce(a){for(;a.t<=this.mt2;)a[a.t++]=0;for(var b=0;b>15)*this.mpl&this.um)<<15)&a.DM;for(c=b+this.m.t,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),a.compareTo(this.m)>=0&&a.subTo(this.m,a)}function montSqrTo(a,b){a.squareTo(b),this.reduce(b)}function montMulTo(a,b,c){a.multiplyTo(b,c),this.reduce(c)}function bnpIsEven(){return 0==(this.t>0?1&this[0]:this.s)}function bnpExp(a,b){if(a>4294967295||1>a)return BigInteger.ONE;var c=nbi(),d=nbi(),e=b.convert(this),f=nbits(a)-1;for(e.copyTo(c);--f>=0;)if(b.sqrTo(c,d),(a&1<0)b.mulTo(d,e,c);else{var g=c;c=d,d=g}return b.revert(c)}function bnModPowInt(a,b){var c;return c=256>a||b.isEven()?new Classic(b):new Montgomery(b),this.exp(a,c)}function bnClone(){var a=nbi();return this.copyTo(a),a}function bnIntValue(){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}function bnShortValue(){return 0==this.t?this.s:this[0]<<16>>16}function bnpChunkSize(a){return Math.floor(Math.LN2*this.DB/Math.log(a))}function bnSigNum(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function bnpToRadix(a){if(null==a&&(a=10),0==this.signum()||2>a||a>36)return"0";var b=this.chunkSize(a),c=Math.pow(a,b),d=nbv(c),e=nbi(),f=nbi(),g="";for(this.divRemTo(d,e,f);e.signum()>0;)g=(c+f.intValue()).toString(a).substr(1)+g,e.divRemTo(d,e,f);return f.intValue().toString(a)+g}function bnpFromRadix(a,b){this.fromInt(0),null==b&&(b=10);for(var c=this.chunkSize(b),d=Math.pow(b,c),e=!1,f=0,g=0,h=0;hi?"-"==a.charAt(h)&&0==this.signum()&&(e=!0):(g=b*g+i,++f>=c&&(this.dMultiply(d),this.dAddOffset(g,0),f=0,g=0))}f>0&&(this.dMultiply(Math.pow(b,f)),this.dAddOffset(g,0)),e&&BigInteger.ZERO.subTo(this,this)}function bnpFromNumber(a,b,c){if("number"==typeof b)if(2>a)this.fromInt(1);else for(this.fromNumber(a,c),this.testBit(a-1)||this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>a&&this.subTo(BigInteger.ONE.shiftLeft(a-1),this);else{var d=new Array,e=7&a;d.length=(a>>3)+1,b.nextBytes(d),e>0?d[0]&=(1<0)for(d>d)!=(this.s&this.DM)>>d&&(b[e++]=c|this.s<=0;)8>d?(c=(this[a]&(1<>(d+=this.DB-8)):(c=this[a]>>(d-=8)&255,0>=d&&(d+=this.DB,--a)),0!=(128&c)&&(c|=-256),0==e&&(128&this.s)!=(128&c)&&++e,(e>0||c!=this.s)&&(b[e++]=c);return b}function bnEquals(a){return 0==this.compareTo(a)}function bnMin(a){return this.compareTo(a)<0?this:a}function bnMax(a){return this.compareTo(a)>0?this:a}function bnpBitwiseTo(a,b,c){var d,e,f=Math.min(a.t,this.t);for(d=0;f>d;++d)c[d]=b(this[d],a[d]);if(a.ta?this.rShiftTo(-a,b):this.lShiftTo(a,b),b}function bnShiftRight(a){var b=nbi();return 0>a?this.lShiftTo(-a,b):this.rShiftTo(a,b),b}function lbit(a){if(0==a)return-1;var b=0;return 0==(65535&a)&&(a>>=16,b+=16),0==(255&a)&&(a>>=8,b+=8),0==(15&a)&&(a>>=4,b+=4),0==(3&a)&&(a>>=2,b+=2),0==(1&a)&&++b,b}function bnGetLowestSetBit(){for(var a=0;a=this.t?0!=this.s:0!=(this[b]&1<c;)d+=this[c]+a[c],b[c++]=d&this.DM,d>>=this.DB;if(a.t>=this.DB;d+=this.s}else{for(d+=this.s;c>=this.DB;d+=a.s}b.s=0>d?-1:0,d>0?b[c++]=d:-1>d&&(b[c++]=this.DV+d),b.t=c,b.clamp()}function bnAdd(a){var b=nbi();return this.addTo(a,b),b}function bnSubtract(a){var b=nbi();return this.subTo(a,b),b}function bnMultiply(a){var b=nbi();return this.multiplyTo(a,b),b}function bnSquare(){var a=nbi();return this.squareTo(a),a}function bnDivide(a){var b=nbi();return this.divRemTo(a,b,null),b}function bnRemainder(a){var b=nbi();return this.divRemTo(a,null,b),b}function bnDivideAndRemainder(a){var b=nbi(),c=nbi();return this.divRemTo(a,b,c),new Array(b,c)}function bnpDMultiply(a){this[this.t]=this.am(0,a-1,this,0,0,this.t),++this.t,this.clamp()}function bnpDAddOffset(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]}}function NullExp(){}function nNop(a){return a}function nMulTo(a,b,c){a.multiplyTo(b,c)}function nSqrTo(a,b){a.squareTo(b)}function bnPow(a){return this.exp(a,new NullExp)}function bnpMultiplyLowerTo(a,b,c){var d=Math.min(this.t+a.t,b);for(c.s=0,c.t=d;d>0;)c[--d]=0;var e;for(e=c.t-this.t;e>d;++d)c[d+this.t]=this.am(0,a[d],c,d,0,this.t);for(e=Math.min(a.t,b);e>d;++d)this.am(0,a[d],c,d,0,b-d);c.clamp()}function bnpMultiplyUpperTo(a,b,c){--b;var d=c.t=this.t+a.t-b;for(c.s=0;--d>=0;)c[d]=0;for(d=Math.max(b-this.t,0);d2*this.m.t)return a.mod(this.m);if(a.compareTo(this.m)<0)return a;var b=nbi();return a.copyTo(b),this.reduce(b),b}function barrettRevert(a){return a}function barrettReduce(a){for(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),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);a.compareTo(this.r2)<0;)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);a.compareTo(this.m)>=0;)a.subTo(this.m,a)}function barrettSqrTo(a,b){a.squareTo(b),this.reduce(b)}function barrettMulTo(a,b,c){a.multiplyTo(b,c),this.reduce(c)} +function bnModPow(a,b){ + var c,d,e=a.bitLength(),f=nbv(1); + if(0>=e)return f; + c=18>e?1:48>e?3:144>e?4:768>e?5:6,d=8>e?new Classic(b):b.isEven()?new Barrett(b):new Montgomery(b); + var g=new Array,h=3,i=c-1,j=(1<1){ + var k=nbi();for(d.sqrTo(g[1],k);j>=h;)g[h]=nbi(),d.mulTo(k,g[h-2],g[h]),h+=2 + } + var l,m,n=a.t-1,o=!0,p=nbi(); + for(e=nbits(a[n])-1;n>=0;){ + for(e>=i?l=a[n]>>e-i&j:(l=(a[n]&(1<0&&(l|=a[n-1]>>this.DB+e-i)),h=c;0==(1&l);)l>>=1,--h; + if((e-=h)<0&&(e+=this.DB,--n),o)g[l].copyTo(f),o=!1; + else{ + for(;h>1;)d.sqrTo(f,p),d.sqrTo(p,f),h-=2; + h>0?d.sqrTo(f,p):(m=f,f=p,p=m),d.mulTo(p,g[l],f) + } + for(;n>=0&&0==(a[n]&1<f)return b;for(f>e&&(f=e),f>0&&(b.rShiftTo(f,b),c.rShiftTo(f,c));b.signum()>0;)(e=b.getLowestSetBit())>0&&b.rShiftTo(e,b),(e=c.getLowestSetBit())>0&&c.rShiftTo(e,c),b.compareTo(c)>=0?(b.subTo(c,b),b.rShiftTo(1,b)):(c.subTo(b,c),c.rShiftTo(1,c));return f>0&&c.lShiftTo(f,c),c +} +function bnpModInt(a){ + if(0>=a)return 0;var b=this.DV%a,c=this.s<0?a-1:0;if(this.t>0)if(0==b)c=this[0]%a;else for(var d=this.t-1;d>=0;--d)c=(b*c+this[d])%a;return c +} +function bnModInverse(a){ + var b=a.isEven();if(this.isEven()&&b||0==a.signum())return BigInteger.ZERO;for(var c=a.clone(),d=this.clone(),e=nbv(1),f=nbv(0),g=nbv(0),h=nbv(1);0!=c.signum();){for(;c.isEven();)c.rShiftTo(1,c),b?(e.isEven()&&f.isEven()||(e.addTo(this,e),f.subTo(a,f)),e.rShiftTo(1,e)):f.isEven()||f.subTo(a,f),f.rShiftTo(1,f);for(;d.isEven();)d.rShiftTo(1,d),b?(g.isEven()&&h.isEven()||(g.addTo(this,g),h.subTo(a,h)),g.rShiftTo(1,g)):h.isEven()||h.subTo(a,h),h.rShiftTo(1,h);c.compareTo(d)>=0?(c.subTo(d,c),b&&e.subTo(g,e),f.subTo(h,f)):(d.subTo(c,d),b&&g.subTo(e,g),h.subTo(f,h))}return 0!=d.compareTo(BigInteger.ONE)?BigInteger.ZERO:h.compareTo(a)>=0?h.subtract(a):h.signum()<0?(h.addTo(a,h),h.signum()<0?h.add(a):h):h +} +function bnIsProbablePrime(a){ + var b,c=this.abs();if(1==c.t&&c[0]<=lowprimes[lowprimes.length-1]){for(b=0;bd;)d*=lowprimes[e++];for(d=c.modInt(d);e>b;)if(d%lowprimes[b++]==0)return!1}return c.millerRabin(a) +} +function bnpMillerRabin(a){ + var b=this.subtract(BigInteger.ONE),c=b.getLowestSetBit();if(0>=c)return!1;var d=b.shiftRight(c);a=a+1>>1,a>lowprimes.length&&(a=lowprimes.length);for(var e=nbi(),f=0;a>f;++f){e.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]); + var g=e.modPow(d,this);if(0!=g.compareTo(BigInteger.ONE)&&0!=g.compareTo(b)){for(var h=1;h++b;++b)this.S[b]=b;for(c=0,b=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.i=0,this.j=0 +} +function ARC4next(){ + var a;return 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,this.S[a+this.S[this.i]&255] +} +function prng_newstate(){return new Arcfour} +function rng_get_byte(){ + if(null==rng_state){for(rng_state=prng_newstate();rng_psize>rng_pptr;){var a=Math.floor(65536*Math.random());rng_pool[rng_pptr++]=255&a}for(rng_state.init(rng_pool),rng_pptr=0;rng_pptra?"0"+a.toString(16):a.toString(16)} +function pkcs1pad2(a,b){if(b=0&&b>0;){var e=a.charCodeAt(d--);128>e?c[--b]=e:e>127&&2048>e?(c[--b]=63&e|128,c[--b]=e>>6|192):(c[--b]=63&e|128,c[--b]=e>>6&63|128,c[--b]=e>>12|224)}c[--b]=0;for(var f=new SecureRandom,g=new Array;b>2;){for(g[0]=0;0==g[0];)f.nextBytes(g);c[--b]=g[0]}return c[--b]=2,c[--b]=0,new BigInteger(c)} +function RSAKey(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null} +function RSASetPublic(a,b){null!=a&&null!=b&&a.length>0&&b.length>0?(this.n=parseBigInt(a,16),this.e=parseInt(b,16)):console.error("Invalid RSA public key")} +function RSADoPublic(a){return a.modPowInt(this.e,this.n)} +function RSAEncrypt(a){var b=pkcs1pad2(a,this.n.bitLength()+7>>3);if(null==b)return null;var c=this.doPublic(b);if(null==c)return null;var d=c.toString(16);return 0==(1&d.length)?d:"0"+d} +function pkcs1unpad2(a,b){for(var c=a.toByteArray(),d=0;d=c.length)return null;for(var e="";++df?e+=String.fromCharCode(f):f>191&&224>f?(e+=String.fromCharCode((31&f)<<6|63&c[d+1]),++d):(e+=String.fromCharCode((15&f)<<12|(63&c[d+1])<<6|63&c[d+2]),d+=2)}return e} +function RSASetPrivate(a,b,c){null!=a&&null!=b&&a.length>0&&b.length>0?(this.n=parseBigInt(a,16),this.e=parseInt(b,16),this.d=parseBigInt(c,16)):console.error("Invalid RSA private key")} +function RSASetPrivateEx(a,b,c,d,e,f,g,h){null!=a&&null!=b&&a.length>0&&b.length>0?(this.n=parseBigInt(a,16),this.e=parseInt(b,16),this.d=parseBigInt(c,16),this.p=parseBigInt(d,16),this.q=parseBigInt(e,16),this.dmp1=parseBigInt(f,16),this.dmq1=parseBigInt(g,16),this.coeff=parseBigInt(h,16)):console.error("Invalid RSA private key")} +function RSAGenerate(a,b){ + var c=new SecureRandom,d=a>>1;this.e=parseInt(b,16);for(var e=new BigInteger(b,16);;){for(;this.p=new BigInteger(a-d,1,c),0!=this.p.subtract(BigInteger.ONE).gcd(e).compareTo(BigInteger.ONE)||!this.p.isProbablePrime(10););for(;this.q=new BigInteger(d,1,c),0!=this.q.subtract(BigInteger.ONE).gcd(e).compareTo(BigInteger.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var f=this.p;this.p=this.q,this.q=f}var g=this.p.subtract(BigInteger.ONE),h=this.q.subtract(BigInteger.ONE),i=g.multiply(h);if(0==i.gcd(e).compareTo(BigInteger.ONE)){this.n=this.p.multiply(this.q),this.d=e.modInverse(i),this.dmp1=this.d.mod(g),this.dmq1=this.d.mod(h),this.coeff=this.q.modInverse(this.p);break}} +} +function RSADoPrivate(a){ + if(null==this.p||null==this.q) + return a.modPow(this.d,this.n); + for(var b=a.mod(this.p).modPow(this.dmp1,this.p),c=a.mod(this.q).modPow(this.dmq1,this.q);b.compareTo(c)<0;) + b=b.add(this.p); + return b.subtract(c).multiply(this.coeff).mod(this.p).multiply(this.q).add(c) +} +function RSADecrypt(a){ + var b=parseBigInt(a,16),c=this.doPrivate(b); + return null==c?null:pkcs1unpad2(c,this.n.bitLength()+7>>3) +} +function hex2b64(a){ + var b,c,d="";for(b=0;b+3<=a.length;b+=3)c=parseInt(a.substring(b,b+3),16),d+=b64map.charAt(c>>6)+b64map.charAt(63&c);for(b+1==a.length?(c=parseInt(a.substring(b,b+1),16),d+=b64map.charAt(c<<2)):b+2==a.length&&(c=parseInt(a.substring(b,b+2),16),d+=b64map.charAt(c>>2)+b64map.charAt((3&c)<<4));(3&d.length)>0;)d+=b64pad;return d +} +function b64tohex(a){var b,c,d="",e=0;for(b=0;bv||(0==e?(d+=int2char(v>>2),c=3&v,e=1):1==e?(d+=int2char(c<<2|v>>4),c=15&v,e=2):2==e?(d+=int2char(c),d+=int2char(v>>2),c=3&v,e=3):(d+=int2char(c<<2|v>>4),d+=int2char(15&v),e=0));return 1==e&&(d+=int2char(c<<2)),d} +function b64toBA(a){ + var b,c=b64tohex(a),d=new Array;for(b=0;2*b=vv;++vv)BI_RC[rr++]=vv; +for(rr="a".charCodeAt(0),vv=10;36>vv;++vv)BI_RC[rr++]=vv; +for(rr="A".charCodeAt(0),vv=10;36>vv;++vv)BI_RC[rr++]=vv; +Classic.prototype.convert=cConvert,Classic.prototype.revert=cRevert,Classic.prototype.reduce=cReduce,Classic.prototype.mulTo=cMulTo,Classic.prototype.sqrTo=cSqrTo,Montgomery.prototype.convert=montConvert,Montgomery.prototype.revert=montRevert,Montgomery.prototype.reduce=montReduce,Montgomery.prototype.mulTo=montMulTo,Montgomery.prototype.sqrTo=montSqrTo,BigInteger.prototype.copyTo=bnpCopyTo,BigInteger.prototype.fromInt=bnpFromInt,BigInteger.prototype.fromString=bnpFromString,BigInteger.prototype.clamp=bnpClamp,BigInteger.prototype.dlShiftTo=bnpDLShiftTo,BigInteger.prototype.drShiftTo=bnpDRShiftTo,BigInteger.prototype.lShiftTo=bnpLShiftTo,BigInteger.prototype.rShiftTo=bnpRShiftTo,BigInteger.prototype.subTo=bnpSubTo,BigInteger.prototype.multiplyTo=bnpMultiplyTo,BigInteger.prototype.squareTo=bnpSquareTo,BigInteger.prototype.divRemTo=bnpDivRemTo,BigInteger.prototype.invDigit=bnpInvDigit,BigInteger.prototype.isEven=bnpIsEven,BigInteger.prototype.exp=bnpExp,BigInteger.prototype.toString=bnToString,BigInteger.prototype.negate=bnNegate,BigInteger.prototype.abs=bnAbs,BigInteger.prototype.compareTo=bnCompareTo,BigInteger.prototype.bitLength=bnBitLength,BigInteger.prototype.mod=bnMod,BigInteger.prototype.modPowInt=bnModPowInt,BigInteger.ZERO=nbv(0),BigInteger.ONE=nbv(1),NullExp.prototype.convert=nNop,NullExp.prototype.revert=nNop,NullExp.prototype.mulTo=nMulTo,NullExp.prototype.sqrTo=nSqrTo,Barrett.prototype.convert=barrettConvert,Barrett.prototype.revert=barrettRevert,Barrett.prototype.reduce=barrettReduce,Barrett.prototype.mulTo=barrettMulTo,Barrett.prototype.sqrTo=barrettSqrTo; +var lowprimes=[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],lplim=(1<<26)/lowprimes[lowprimes.length-1]; +BigInteger.prototype.chunkSize=bnpChunkSize,BigInteger.prototype.toRadix=bnpToRadix,BigInteger.prototype.fromRadix=bnpFromRadix,BigInteger.prototype.fromNumber=bnpFromNumber,BigInteger.prototype.bitwiseTo=bnpBitwiseTo,BigInteger.prototype.changeBit=bnpChangeBit,BigInteger.prototype.addTo=bnpAddTo,BigInteger.prototype.dMultiply=bnpDMultiply,BigInteger.prototype.dAddOffset=bnpDAddOffset,BigInteger.prototype.multiplyLowerTo=bnpMultiplyLowerTo,BigInteger.prototype.multiplyUpperTo=bnpMultiplyUpperTo,BigInteger.prototype.modInt=bnpModInt,BigInteger.prototype.millerRabin=bnpMillerRabin,BigInteger.prototype.clone=bnClone,BigInteger.prototype.intValue=bnIntValue,BigInteger.prototype.byteValue=bnByteValue,BigInteger.prototype.shortValue=bnShortValue,BigInteger.prototype.signum=bnSigNum,BigInteger.prototype.toByteArray=bnToByteArray,BigInteger.prototype.equals=bnEquals,BigInteger.prototype.min=bnMin,BigInteger.prototype.max=bnMax,BigInteger.prototype.and=bnAnd,BigInteger.prototype.or=bnOr,BigInteger.prototype.xor=bnXor,BigInteger.prototype.andNot=bnAndNot,BigInteger.prototype.not=bnNot,BigInteger.prototype.shiftLeft=bnShiftLeft,BigInteger.prototype.shiftRight=bnShiftRight,BigInteger.prototype.getLowestSetBit=bnGetLowestSetBit,BigInteger.prototype.bitCount=bnBitCount,BigInteger.prototype.testBit=bnTestBit,BigInteger.prototype.setBit=bnSetBit,BigInteger.prototype.clearBit=bnClearBit,BigInteger.prototype.flipBit=bnFlipBit,BigInteger.prototype.add=bnAdd,BigInteger.prototype.subtract=bnSubtract,BigInteger.prototype.multiply=bnMultiply,BigInteger.prototype.divide=bnDivide,BigInteger.prototype.remainder=bnRemainder,BigInteger.prototype.divideAndRemainder=bnDivideAndRemainder, +BigInteger.prototype.modPow=bnModPow, +BigInteger.prototype.modInverse=bnModInverse,BigInteger.prototype.pow=bnPow,BigInteger.prototype.gcd=bnGCD,BigInteger.prototype.isProbablePrime=bnIsProbablePrime,BigInteger.prototype.square=bnSquare,Arcfour.prototype.init=ARC4init,Arcfour.prototype.next=ARC4next; +var rng_psize=256,rng_state,rng_pool,rng_pptr; +if(null==rng_pool){ + rng_pool=new Array,rng_pptr=0; + var t; + if(window.crypto&&window.crypto.getRandomValues){ + var z=new Uint32Array(256); + for(window.crypto.getRandomValues(z),t=0;t=256||rng_pptr>=rng_psize)return void(window.removeEventListener?window.removeEventListener("mousemove",onMouseMoveListener):window.detachEvent&&window.detachEvent("onmousemove",onMouseMoveListener)); + this.count+=1; + var b=a.x+a.y; + rng_pool[rng_pptr++]=255&b + }; + window.addEventListener?window.addEventListener("mousemove",onMouseMoveListener):window.attachEvent&&window.attachEvent("onmousemove",onMouseMoveListener) +} +SecureRandom.prototype.nextBytes=rng_get_bytes,RSAKey.prototype.doPublic=RSADoPublic,RSAKey.prototype.setPublic=RSASetPublic,RSAKey.prototype.encrypt=RSAEncrypt, +RSAKey.prototype.doPrivate=RSADoPrivate, +RSAKey.prototype.setPrivate=RSASetPrivate, +RSAKey.prototype.setPrivateEx=RSASetPrivateEx, +RSAKey.prototype.generate=RSAGenerate, +RSAKey.prototype.decrypt=RSADecrypt,function(){ + var a=function(a,b,c){ + var d=new SecureRandom,e=a>>1; + this.e=parseInt(b,16); + var f=new BigInteger(b,16),g=this, + h=function(){ + var b=function(){ + if(g.p.compareTo(g.q)<=0){var a=g.p;g.p=g.q,g.q=a}var b=g.p.subtract(BigInteger.ONE),d=g.q.subtract(BigInteger.ONE),e=b.multiply(d);0==e.gcd(f).compareTo(BigInteger.ONE)?(g.n=g.p.multiply(g.q),g.d=f.modInverse(e),g.dmp1=g.d.mod(b),g.dmq1=g.d.mod(d),g.coeff=g.q.modInverse(g.p),setTimeout(function(){c()},0)):setTimeout(h,0) + },i=function(){ + g.q=nbi(),g.q.fromNumberAsync(e,1,d,function(){g.q.subtract(BigInteger.ONE).gcda(f,function(a){0==a.compareTo(BigInteger.ONE)&&g.q.isProbablePrime(10)?setTimeout(b,0):setTimeout(i,0)})}) + },j=function(){ + g.p=nbi(),g.p.fromNumberAsync(a-e,1,d,function(){g.p.subtract(BigInteger.ONE).gcda(f,function(a){0==a.compareTo(BigInteger.ONE)&&g.p.isProbablePrime(10)?setTimeout(i,0):setTimeout(j,0)})}) + }; + setTimeout(j,0) + }; + setTimeout(h,0) + }; + RSAKey.prototype.generateAsync=a; + var b=function(a,b){ + var c=this.s<0?this.negate():this.clone(),d=a.s<0?a.negate():a.clone(); + if(c.compareTo(d)<0){var e=c;c=d,d=e}var f=c.getLowestSetBit(),g=d.getLowestSetBit();if(0>g)return void b(c);g>f&&(g=f),g>0&&(c.rShiftTo(g,c),d.rShiftTo(g,d));var h=function(){(f=c.getLowestSetBit())>0&&c.rShiftTo(f,c),(f=d.getLowestSetBit())>0&&d.rShiftTo(f,d),c.compareTo(d)>=0?(c.subTo(d,c),c.rShiftTo(1,c)):(d.subTo(c,d),d.rShiftTo(1,d)),c.signum()>0?setTimeout(h,0):(g>0&&d.lShiftTo(g,d),setTimeout(function(){b(d)},0))};setTimeout(h,10) + }; + BigInteger.prototype.gcda=b; + var c=function(a,b,c,d){ + if("number"==typeof b)if(2>a)this.fromInt(1);else{this.fromNumber(a,c),this.testBit(a-1)||this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this),this.isEven()&&this.dAddOffset(1,0);var e=this,f=function(){e.dAddOffset(2,0),e.bitLength()>a&&e.subTo(BigInteger.ONE.shiftLeft(a-1),e),e.isProbablePrime(b)?setTimeout(function(){d()},0):setTimeout(f,0)};setTimeout(f,0)}else{var g=new Array,h=7&a;g.length=(a>>3)+1,b.nextBytes(g),h>0?g[0]&=(1<f;f++)e+="f";var g=new BigInteger(e,16),h=g.xor(a).add(BigInteger.ONE);b=h.toString(16).replace(/^-/,"") + } + return b + }, + this.getPEMStringFromHex=function(a,b){ + var c=CryptoJS.enc.Hex.parse(a),d=CryptoJS.enc.Base64.stringify(c),e=d.replace(/(.{64})/g,"$1\r\n");return e=e.replace(/\r\n$/,""),"-----BEGIN "+b+"-----\r\n"+e+"\r\n-----END "+b+"-----\r\n" + } + }, + KJUR.asn1.ASN1Object=function(){var a="";this.getLengthHexFromValue=function(){if("undefined"==typeof this.hV||null==this.hV)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+a.length+",v="+this.hV;var b=this.hV.length/2,c=b.toString(16);if(c.length%2==1&&(c="0"+c),128>b)return c;var d=c.length/2;if(d>15)throw"ASN.1 length too long to represent by 8x: n = "+b.toString(16);var e=128+d;return e.toString(16)+c},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""}},KJUR.asn1.DERAbstractString=function(a){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);this.getString=function(){return this.s},this.setString=function(a){this.hTLV=null,this.isModified=!0,this.s=a,this.hV=stohex(this.s)},this.setStringHex=function(a){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=a},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof a&&("undefined"!=typeof a.str?this.setString(a.str):"undefined"!=typeof a.hex&&this.setStringHex(a.hex))},JSX.extend(KJUR.asn1.DERAbstractString,KJUR.asn1.ASN1Object),KJUR.asn1.DERAbstractTime=function(){KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);this.localDateToUTC=function(a){utc=a.getTime()+6e4*a.getTimezoneOffset();var b=new Date(utc);return b},this.formatDate=function(a,b){var c=this.zeroPadding,d=this.localDateToUTC(a),e=String(d.getFullYear());"utc"==b&&(e=e.substr(2,2));var f=c(String(d.getMonth()+1),2),g=c(String(d.getDate()),2),h=c(String(d.getHours()),2),i=c(String(d.getMinutes()),2),j=c(String(d.getSeconds()),2);return e+f+g+h+i+j+"Z"},this.zeroPadding=function(a,b){return a.length>=b?a:new Array(b-a.length+1).join("0")+a},this.getString=function(){return this.s},this.setString=function(a){this.hTLV=null,this.isModified=!0,this.s=a,this.hV=stohex(this.s)},this.setByDateValue=function(a,b,c,d,e,f){var g=new Date(Date.UTC(a,b-1,c,d,e,f,0));this.setByDate(g)},this.getFreshValueHex=function(){return this.hV}},JSX.extend(KJUR.asn1.DERAbstractTime,KJUR.asn1.ASN1Object),KJUR.asn1.DERAbstractStructured=function(a){KJUR.asn1.DERAbstractString.superclass.constructor.call(this);this.setByASN1ObjectArray=function(a){this.hTLV=null,this.isModified=!0,this.asn1Array=a},this.appendASN1Object=function(a){this.hTLV=null,this.isModified=!0,this.asn1Array.push(a)},this.asn1Array=new Array,"undefined"!=typeof a&&"undefined"!=typeof a.array&&(this.asn1Array=a.array)},JSX.extend(KJUR.asn1.DERAbstractStructured,KJUR.asn1.ASN1Object),KJUR.asn1.DERBoolean=function(){KJUR.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},JSX.extend(KJUR.asn1.DERBoolean,KJUR.asn1.ASN1Object),KJUR.asn1.DERInteger=function(a){KJUR.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(a){this.hTLV=null,this.isModified=!0,this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(a)},this.setByInteger=function(a){var b=new BigInteger(String(a),10);this.setByBigInteger(b)},this.setValueHex=function(a){this.hV=a},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof a&&("undefined"!=typeof a.bigint?this.setByBigInteger(a.bigint):"undefined"!=typeof a["int"]?this.setByInteger(a["int"]):"undefined"!=typeof a.hex&&this.setValueHex(a.hex))},JSX.extend(KJUR.asn1.DERInteger,KJUR.asn1.ASN1Object),KJUR.asn1.DERBitString=function(a){KJUR.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(a){this.hTLV=null,this.isModified=!0,this.hV=a},this.setUnusedBitsAndHexValue=function(a,b){if(0>a||a>7)throw"unused bits shall be from 0 to 7: u = "+a;var c="0"+a;this.hTLV=null,this.isModified=!0,this.hV=c+b},this.setByBinaryString=function(a){a=a.replace(/0+$/,"");var b=8-a.length%8;8==b&&(b=0);for(var c=0;b>=c;c++)a+="0";for(var d="",c=0;cc;c++)b[c]=!1;return b},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof a&&("undefined"!=typeof a.hex?this.setHexValueIncludingUnusedBits(a.hex):"undefined"!=typeof a.bin?this.setByBinaryString(a.bin):"undefined"!=typeof a.array&&this.setByBooleanArray(a.array))},JSX.extend(KJUR.asn1.DERBitString,KJUR.asn1.ASN1Object),KJUR.asn1.DEROctetString=function(a){KJUR.asn1.DEROctetString.superclass.constructor.call(this,a),this.hT="04"},JSX.extend(KJUR.asn1.DEROctetString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERNull=function(){KJUR.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},JSX.extend(KJUR.asn1.DERNull,KJUR.asn1.ASN1Object),KJUR.asn1.DERObjectIdentifier=function(a){var b=function(a){var b=a.toString(16);return 1==b.length&&(b="0"+b),b},c=function(a){var c="",d=new BigInteger(a,10),e=d.toString(2),f=7-e.length%7;7==f&&(f=0);for(var g="",h=0;f>h;h++)g+="0";e=g+e;for(var h=0;hd;++d)b[e.charAt(d)]=d;for(e=e.toLowerCase(),d=10;16>d;++d)b[e.charAt(d)]=d;for(d=0;d=2?(g[g.length]=h,h=0,i=0):h<<=4}}if(i)throw"Hex encoding incomplete: 4 bits missing";return g},window.Hex=c}(),function(a){"use strict";var b,c={};c.decode=function(c){var d;if(b===a){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f="= \f\n\r  \u2028\u2029";for(b=[],d=0;64>d;++d)b[e.charAt(d)]=d;for(d=0;d=4?(g[g.length]=h>>16,g[g.length]=h>>8&255,g[g.length]=255&h,h=0,i=0):h<<=6}}switch(i){case 1:throw"Base64 encoding incomplete: at least 2 bits missing";case 2:g[g.length]=h>>10;break;case 3:g[g.length]=h>>16,g[g.length]=h>>8&255}return g},c.re=/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,c.unarmor=function(a){var b=c.re.exec(a);if(b)if(b[1])a=b[1];else{if(!b[2])throw"RegExp out of sync";a=b[2]}return c.decode(a)},window.Base64=c}(),function(a){"use strict";function b(a,c){a instanceof b?(this.enc=a.enc,this.pos=a.pos):(this.enc=a,this.pos=c)}function c(a,b,c,d,e){this.stream=a,this.header=b,this.length=c,this.tag=d,this.sub=e}var d=100,e="…",f={tag:function(a,b){var c=document.createElement(a);return c.className=b,c},text:function(a){return document.createTextNode(a)}};b.prototype.get=function(b){if(b===a&&(b=this.pos++),b>=this.enc.length)throw"Requesting byte offset "+b+" on a stream of length "+this.enc.length;return this.enc[b]},b.prototype.hexDigits="0123456789ABCDEF",b.prototype.hexByte=function(a){return this.hexDigits.charAt(a>>4&15)+this.hexDigits.charAt(15&a)},b.prototype.hexDump=function(a,b,c){for(var d="",e=a;b>e;++e)if(d+=this.hexByte(this.get(e)),c!==!0)switch(15&e){case 7:d+=" ";break;case 15:d+="\n";break;default:d+=" "}return d},b.prototype.parseStringISO=function(a,b){for(var c="",d=a;b>d;++d)c+=String.fromCharCode(this.get(d));return c},b.prototype.parseStringUTF=function(a,b){for(var c="",d=a;b>d;){var e=this.get(d++);c+=String.fromCharCode(128>e?e:e>191&&224>e?(31&e)<<6|63&this.get(d++):(15&e)<<12|(63&this.get(d++))<<6|63&this.get(d++))}return c},b.prototype.parseStringBMP=function(a,b){for(var c="",d=a;b>d;d+=2){var e=this.get(d),f=this.get(d+1);c+=String.fromCharCode((e<<8)+f)}return c},b.prototype.reTime=/^((?:1[89]|2\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)?)?$/,b.prototype.parseTime=function(a,b){var c=this.parseStringISO(a,b),d=this.reTime.exec(c);return d?(c=d[1]+"-"+d[2]+"-"+d[3]+" "+d[4],d[5]&&(c+=":"+d[5],d[6]&&(c+=":"+d[6],d[7]&&(c+="."+d[7]))),d[8]&&(c+=" UTC","Z"!=d[8]&&(c+=d[8],d[9]&&(c+=":"+d[9]))),c):"Unrecognized time: "+c},b.prototype.parseInteger=function(a,b){var c=b-a;if(c>4){c<<=3;var d=this.get(a);if(0===d)c-=8;else for(;128>d;)d<<=1,--c;return"("+c+" bit)"}for(var e=0,f=a;b>f;++f)e=e<<8|this.get(f);return e},b.prototype.parseBitString=function(a,b){var c=this.get(a),d=(b-a-1<<3)-c,e="("+d+" bit)";if(20>=d){var f=c;e+=" ";for(var g=b-1;g>a;--g){for(var h=this.get(g),i=f;8>i;++i)e+=h>>i&1?"1":"0";f=0}}return e},b.prototype.parseOctetString=function(a,b){var c=b-a,f="("+c+" byte) ";c>d&&(b=a+d);for(var g=a;b>g;++g)f+=this.hexByte(this.get(g));return c>d&&(f+=e),f},b.prototype.parseOID=function(a,b){for(var c="",d=0,e=0,f=a;b>f;++f){var g=this.get(f);if(d=d<<7|127&g,e+=7,!(128&g)){if(""===c){var h=80>d?40>d?0:1:2;c=h+"."+(d-40*h)}else c+="."+(e>=31?"bigint":d);d=e=0}}return c},c.prototype.typeName=function(){if(this.tag===a)return"unknown";var b=this.tag>>6,c=(this.tag>>5&1,31&this.tag);switch(b){case 0:switch(c){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";default:return"Universal_"+c.toString(16)}case 1:return"Application_"+c.toString(16);case 2:return"["+c+"]";case 3:return"Private_"+c.toString(16)}},c.prototype.reSeemsASCII=/^[ -~]+$/,c.prototype.content=function(){if(this.tag===a)return null;var b=this.tag>>6,c=31&this.tag,f=this.posContent(),g=Math.abs(this.length);if(0!==b){if(null!==this.sub)return"("+this.sub.length+" elem)";var h=this.stream.parseStringISO(f,f+Math.min(g,d));return this.reSeemsASCII.test(h)?h.substring(0,2*d)+(h.length>2*d?e:""):this.stream.parseOctetString(f,f+g)}switch(c){case 1:return 0===this.stream.get(f)?"false":"true";case 2:return this.stream.parseInteger(f,f+g);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(f,f+g);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(f,f+g);case 6:return this.stream.parseOID(f,f+g);case 16:case 17:return"("+this.sub.length+" elem)";case 12:return this.stream.parseStringUTF(f,f+g);case 18:case 19:case 20:case 21:case 22:case 26:return this.stream.parseStringISO(f,f+g);case 30:return this.stream.parseStringBMP(f,f+g);case 23:case 24:return this.stream.parseTime(f,f+g)}return null},c.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},c.prototype.print=function(b){if(b===a&&(b=""),document.writeln(b+this),null!==this.sub){b+=" ";for(var c=0,d=this.sub.length;d>c;++c)this.sub[c].print(b)}},c.prototype.toPrettyString=function(b){b===a&&(b="");var c=b+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(c+="+"),c+=this.length,32&this.tag?c+=" (constructed)":3!=this.tag&&4!=this.tag||null===this.sub||(c+=" (encapsulates)"),c+="\n",null!==this.sub){b+=" ";for(var d=0,e=this.sub.length;e>d;++d)c+=this.sub[d].toPrettyString(b)}return c},c.prototype.toDOM=function(){var a=f.tag("div","node");a.asn1=this;var b=f.tag("div","head"),c=this.typeName().replace(/_/g," ");b.innerHTML=c;var d=this.content();if(null!==d){d=String(d).replace(/",c+="Length: "+this.header+"+",c+=this.length>=0?this.length:-this.length+" (undefined)",32&this.tag?c+="
(constructed)":3!=this.tag&&4!=this.tag||null===this.sub||(c+="
(encapsulates)"),null!==d&&(c+="
Value:
"+d+"","object"==typeof oids&&6==this.tag)){var h=oids[d];h&&(h.d&&(c+="
"+h.d),h.c&&(c+="
"+h.c),h.w&&(c+="
(warning!)"))}g.innerHTML=c,a.appendChild(g);var i=f.tag("div","sub");if(null!==this.sub)for(var j=0,k=this.sub.length;k>j;++j)i.appendChild(this.sub[j].toDOM());return a.appendChild(i),b.onclick=function(){a.className="node collapsed"==a.className?"node":"node collapsed"},a},c.prototype.posStart=function(){return this.stream.pos},c.prototype.posContent=function(){return this.stream.pos+this.header},c.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},c.prototype.fakeHover=function(a){this.node.className+=" hover",a&&(this.head.className+=" hover")},c.prototype.fakeOut=function(a){var b=/ ?hover/;this.node.className=this.node.className.replace(b,""),a&&(this.head.className=this.head.className.replace(b,""))},c.prototype.toHexDOM_sub=function(a,b,c,d,e){if(!(d>=e)){var g=f.tag("span",b);g.appendChild(f.text(c.hexDump(d,e))),a.appendChild(g)}},c.prototype.toHexDOM=function(b){var c=f.tag("span","hex");if(b===a&&(b=c),this.head.hexNode=c,this.head.onmouseover=function(){this.hexNode.className="hexCurrent"},this.head.onmouseout=function(){this.hexNode.className="hex"},c.asn1=this,c.onmouseover=function(){var a=!b.selected;a&&(b.selected=this.asn1,this.className="hexCurrent"),this.asn1.fakeHover(a)},c.onmouseout=function(){var a=b.selected==this.asn1;this.asn1.fakeOut(a),a&&(b.selected=null,this.className="hex")},this.toHexDOM_sub(c,"tag",this.stream,this.posStart(),this.posStart()+1),this.toHexDOM_sub(c,this.length>=0?"dlen":"ulen",this.stream,this.posStart()+1,this.posContent()),null===this.sub)c.appendChild(f.text(this.stream.hexDump(this.posContent(),this.posEnd())));else if(this.sub.length>0){var d=this.sub[0],e=this.sub[this.sub.length-1];this.toHexDOM_sub(c,"intro",this.stream,this.posContent(),d.posStart());for(var g=0,h=this.sub.length;h>g;++g)c.appendChild(this.sub[g].toHexDOM(b));this.toHexDOM_sub(c,"outro",this.stream,e.posEnd(),this.posEnd())}return c},c.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},c.decodeLength=function(a){var b=a.get(),c=127&b;if(c==b)return c;if(c>3)throw"Length over 24 bits not supported at position "+(a.pos-1);if(0===c)return-1;b=0;for(var d=0;c>d;++d)b=b<<8|a.get();return b},c.hasContent=function(a,d,e){if(32&a)return!0;if(3>a||a>4)return!1;var f=new b(e);3==a&&f.get();var g=f.get();if(g>>6&1)return!1;try{var h=c.decodeLength(f);return f.pos-e.pos+h==d}catch(i){return!1}},c.decode=function(a){a instanceof b||(a=new b(a,0));var d=new b(a),e=a.get(),f=c.decodeLength(a),g=a.pos-d.pos,h=null;if(c.hasContent(e,f,a)){var i=a.pos;if(3==e&&a.get(),h=[],f>=0){for(var j=i+f;a.posd;++d){var f=new b(a[d].value,0),g=c.decodeLength(f);g!=a[d].expected&&document.write("In test["+d+"] expected "+a[d].expected+" got "+g+"\n")}},window.ASN1=c}(),ASN1.prototype.getHexStringValue=function(){var a=this.toHexString(),b=2*this.header,c=2*this.length;return a.substr(b,c)},RSAKey.prototype.parseKey=function(a){try{var b=0,c=0,d=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/,e=d.test(a)?Hex.decode(a):Base64.unarmor(a),f=ASN1.decode(e);if(9===f.sub.length){b=f.sub[1].getHexStringValue(),this.n=parseBigInt(b,16),c=f.sub[2].getHexStringValue(),this.e=parseInt(c,16);var g=f.sub[3].getHexStringValue();this.d=parseBigInt(g,16);var h=f.sub[4].getHexStringValue();this.p=parseBigInt(h,16);var i=f.sub[5].getHexStringValue();this.q=parseBigInt(i,16);var j=f.sub[6].getHexStringValue();this.dmp1=parseBigInt(j,16);var k=f.sub[7].getHexStringValue();this.dmq1=parseBigInt(k,16);var l=f.sub[8].getHexStringValue();this.coeff=parseBigInt(l,16)}else{if(2!==f.sub.length)return!1;var m=f.sub[1],n=m.sub[0];b=n.sub[0].getHexStringValue(),this.n=parseBigInt(b,16),c=n.sub[1].getHexStringValue(),this.e=parseInt(c,16)}return!0}catch(o){return!1}},RSAKey.prototype.getPrivateBaseKey=function(){var a={array:[new KJUR.asn1.DERInteger({"int":0}),new KJUR.asn1.DERInteger({bigint:this.n}),new KJUR.asn1.DERInteger({"int":this.e}),new KJUR.asn1.DERInteger({bigint:this.d}),new KJUR.asn1.DERInteger({bigint:this.p}),new KJUR.asn1.DERInteger({bigint:this.q}),new KJUR.asn1.DERInteger({bigint:this.dmp1}),new KJUR.asn1.DERInteger({bigint:this.dmq1}),new KJUR.asn1.DERInteger({bigint:this.coeff})]},b=new KJUR.asn1.DERSequence(a);return b.getEncodedHex()},RSAKey.prototype.getPrivateBaseKeyB64=function(){return hex2b64(this.getPrivateBaseKey())},RSAKey.prototype.getPublicBaseKey=function(){var a={array:[new KJUR.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new KJUR.asn1.DERNull]},b=new KJUR.asn1.DERSequence(a);a={array:[new KJUR.asn1.DERInteger({bigint:this.n}),new KJUR.asn1.DERInteger({"int":this.e})]};var c=new KJUR.asn1.DERSequence(a);a={hex:"00"+c.getEncodedHex()};var d=new KJUR.asn1.DERBitString(a);a={array:[b,d]};var e=new KJUR.asn1.DERSequence(a);return e.getEncodedHex()},RSAKey.prototype.getPublicBaseKeyB64=function(){return hex2b64(this.getPublicBaseKey())},RSAKey.prototype.wordwrap=function(a,b){if(b=b||64,!a)return a;var c="(.{1,"+b+"})( +|$\n?)|(.{1,"+b+"})";return a.match(RegExp(c,"g")).join("\n")},RSAKey.prototype.getPrivateKey=function(){var a="-----BEGIN RSA PRIVATE KEY-----\n";return a+=this.wordwrap(this.getPrivateBaseKeyB64())+"\n",a+="-----END RSA PRIVATE KEY-----"},RSAKey.prototype.getPublicKey=function(){var a="-----BEGIN PUBLIC KEY-----\n";return a+=this.wordwrap(this.getPublicBaseKeyB64())+"\n",a+="-----END PUBLIC KEY-----"},RSAKey.prototype.hasPublicKeyProperty=function(a){return a=a||{},a.hasOwnProperty("n")&&a.hasOwnProperty("e")},RSAKey.prototype.hasPrivateKeyProperty=function(a){return a=a||{},a.hasOwnProperty("n")&&a.hasOwnProperty("e")&&a.hasOwnProperty("d")&&a.hasOwnProperty("p")&&a.hasOwnProperty("q")&&a.hasOwnProperty("dmp1")&&a.hasOwnProperty("dmq1")&&a.hasOwnProperty("coeff")},RSAKey.prototype.parsePropertiesFrom=function(a){this.n=a.n,this.e=a.e,a.hasOwnProperty("d")&&(this.d=a.d,this.p=a.p,this.q=a.q,this.dmp1=a.dmp1,this.dmq1=a.dmq1,this.coeff=a.coeff)};var JSEncryptRSAKey=function(a){RSAKey.call(this),a&&("string"==typeof a?this.parseKey(a):(this.hasPrivateKeyProperty(a)||this.hasPublicKeyProperty(a))&&this.parsePropertiesFrom(a))};JSEncryptRSAKey.prototype=new RSAKey,JSEncryptRSAKey.prototype.constructor=JSEncryptRSAKey;var JSEncrypt=function(a){a=a||{},this.default_key_size=parseInt(a.default_key_size)||1024,this.default_public_exponent=a.default_public_exponent||"010001",this.log=a.log||!1,this.key=null};JSEncrypt.prototype.setKey=function(a){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new JSEncryptRSAKey(a)},JSEncrypt.prototype.setPrivateKey=function(a){this.setKey(a)},JSEncrypt.prototype.setPublicKey=function(a){this.setKey(a)}, + JSEncrypt.prototype.decrypt=function(a){ + try{ + var keyObject = this.getKey(); + return keyObject.decrypt(b64tohex(a)) + }catch(b){ + return!1 + } + }, + JSEncrypt.prototype.encrypt=function(a){ + try{ + return hex2b64(this.getKey().encrypt(a)) + }catch(b){ + return!1 + } + },JSEncrypt.prototype.getKey=function(a){if(!this.key){if(this.key=new JSEncryptRSAKey,a&&"[object Function]"==={}.toString.call(a))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,a);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},JSEncrypt.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},JSEncrypt.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},JSEncrypt.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},JSEncrypt.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()};exports.JSEncrypt = JSEncrypt; +})(JSEncryptExports); +var JSEncrypt = JSEncryptExports.JSEncrypt;