window = this; navigator = {}; ! function(t, e){ "object" == typeof exports && "undefined" != typeof module ? e(exports) : "function" == typeof define && define.amd ? define(["exports"], e) : e(t.JSEncrypt = {}) }(this, function(t){ "use strict"; var e = "0123456789abcdefghijklmnopqrstuvwxyz"; function a(t){ return e.charAt(t) } function i(t, e){ return t & e } function u(t, e){ return t | e } function r(t, e){ return t ^ e } function n(t, e){ return t & ~e } function s(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 o(t){ for(var e = 0; 0 != t;) t &= t - 1, ++e; return e } var h = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; function c(t){ var e, i, r = ""; for(e = 0; e + 3 <= t.length; e += 3) i = parseInt(t.substring(e, e + 3), 16), r += h.charAt(i >> 6) + h.charAt(63 & i); for(e + 1 == t.length ?(i = parseInt(t.substring(e, e + 1), 16), r += h.charAt(i << 2)) : e + 2 == t.length && (i = parseInt(t.substring(e, e + 2), 16), r += h.charAt(i >> 2) + h.charAt((3 & i) << 4)); 0 < (3 & r.length);) r += "="; return r } function f(t){ var e, i = "", r = 0, n = 0; for(e = 0; e < t.length && "=" != t.charAt(e); ++e){ var s = h.indexOf(t.charAt(e)); s < 0 ||(0 == r ?(i += a(s >> 2), n = 3 & s, r = 1) : 1 == r ?(i += a(n << 2 | s >> 4), n = 15 & s, r = 2) : 2 == r ?(i += a(n), i += a(s >> 2), n = 3 & s, r = 3) : (i += a(n << 2 | s >> 4), i += a(15 & s), r = 0)) } return 1 == r && (i += a(n << 2)), i } var l, p = function(t, e){ return(p = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, e){ t.__proto__ = e } || function(t, e){ for(var i in e) e.hasOwnProperty(i) && (t[i] = e[i]) })(t, e) }; var g, d = function(t){ var e; if(void 0 === l){ var i = "0123456789ABCDEF", r = " \f\n\r\t?\u2028\u2029"; for(l = {}, e = 0; e < 16; ++e) l[i.charAt(e)] = e; for(i = i.toLowerCase(), e = 10; e < 16; ++e) l[i.charAt(e)] = e; for(e = 0; e < r.length; ++e) l[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 = l[h])) { if(void 0 === h) throw new Error("Illegal character at offset " + e); s |= h, 2 <= ++o ?(n[n.length] = s, o = s = 0) : s <<= 4 } } if(o) throw new Error("Hex encoding incomplete: 4 bits missing"); return n }, v = { decode: function(t){ var e; if(void 0 === g){ var i = "= \f\n\r\t?\u2028\u2029"; for(g = {}, e = 0; e < 64; ++e) g["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)] = e; for(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, 4 <= ++s ?(r[r.length] = n >> 16, r[r.length] = n >> 8 & 255, r[r.length] = 255 & n, s = n = 0) : n <<= 6 } } switch(s){ case 1: throw new Error("Base64 encoding incomplete: at least 2 bits missing"); case 2: r[r.length] = n >> 10; break; case 3: r[r.length] = n >> 16, r[r.length] = n >> 8 & 255 } return r }, re: /-----BEGIN [^-]+----- ([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/, unarmor: function(t){ var e = v.re.exec(t); if(e)if(e[1]) t = e[1]; else { if(!e[2]) throw new Error("RegExp out of sync"); t = e[2] } return v.decode(t) } }, m = 1e13, y = function(){ function t(t){ this.buf = [+t || 0] } return t.prototype.mulAdd = function(t, e){ var i, r, n = this.buf, s = n.length; for(i = 0; i < s; ++i) (r = n[i] * t + e) < m ? e = 0 : r -= (e = 0 | r / m) * m, n[i] = r; 0 < e && (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 += m, 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; 0 <= r; --r) i += (m + e[r]).toString().substring(1); return i }, t.prototype.valueOf = function(){ for(var t = this.buf, e = 0, i = t.length - 1; 0 <= i; --i) e = e * m + t[i]; return e }, t.prototype.simplify = function(){ var t = this.buf; return 1 == t.length ? t[0] : this }, t }(), b = "…", T = /^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?: ([0-5]\d)(?: ([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/, S = /^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?: ([0-5]\d)(?: ([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/; function E(t, e){ return t.length > e && (t = t.substring(0, e) + b), t } var w, D = function(){ function i(t, e){ this.hexDigits = "0123456789ABCDEF", t instanceof i ?(this.enc = t.enc, this.pos = t.pos) : (this.enc = t, this.pos = e) } return i.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] }, i.prototype.hexByte = function(t){ return this.hexDigits.charAt(t >> 4 & 15) + this.hexDigits.charAt(15 & t) }, i.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 }, i.prototype.isASCII = function(t, e){ for(var i = t; i < e; ++i){ var r = this.get(i); if(r < 32 || 176 < r) return !1 } return !0 }, i.prototype.parseStringISO = function(t, e){ for(var i = "", r = t; r < e; ++r) i += String.fromCharCode(this.get(r)); return i }, i.prototype.parseStringUTF = function(t, e){ for(var i = "", r = t; r < e;){ var n = this.get(r++); i += n < 128 ? String.fromCharCode(n) : 191 < n && 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 }, i.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 }, i.prototype.parseTime = function(t, e, i){ var r = this.parseStringISO(t, e), n = (i ? T : S).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 }, i.prototype.parseInteger = function(t, e){ for(var i, r = this.get(t), n = 127 < r, s = n ? 255 : 0, o = ""; r == s && ++t < e;) r = this.get(t); if(0 === (i = e - t)) return n ? -1 : 0; if(4 < i){ for(o = r, i <<= 3; 0 == (128 & (+o ^ s));) o = +o << 1, --i; o = " (" + i + " bit)\n" } n && (r -= 256); for(var h = new y(r), a = t + 1; a < e; ++a) h.mulAdd(256, this.get(a)); return o + h.toString() }, i.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; a <= u; --u) s += h >> u & 1 ? "1" : "0"; if(s.length > i) return n + E(s, i) } return n + s }, i.prototype.parseOctetString = function(t, e, i){ if(this.isASCII(t, e)) return E(this.parseStringISO(t, e), i); var r = e - t, n = " (" + r + " byte)\n"; (i /= 2) < r && (e = t + i); for(var s = t; s < e; ++s) n += this.hexByte(this.get(s)); return i < r && (n += b), n }, i.prototype.parseOID = function(t, e, i){ for(var r = "", n = new y, 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 y) 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 E(r, i); n = new y, s = 0 } } return 0 < s && (r += ".incomplete"), r }, i }(), x = function(){ function c(t, e, i, r, n){ if(!(r instanceof R)) throw new Error("Invalid tag value."); this.stream = t, this.header = e, this.length = i, this.tag = r, this.sub = n } return c.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";