encode.js 87 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553
  1. !function (t, e) {
  2. "object" == typeof exports && "undefined" != typeof module ? e(exports) : "function" == typeof define && define.amd ? define(["exports"], e) : e(t.JSEncrypt = {})
  3. }(this, function (t) {
  4. "use strict";
  5. var e = "0123456789abcdefghijklmnopqrstuvwxyz";
  6. function a(t) {
  7. return e.charAt(t)
  8. }
  9. function i(t, e) {
  10. return t & e
  11. }
  12. function u(t, e) {
  13. return t | e
  14. }
  15. function r(t, e) {
  16. return t ^ e
  17. }
  18. function n(t, e) {
  19. return t & ~e
  20. }
  21. function s(t) {
  22. if (0 == t) return -1;
  23. var e = 0;
  24. 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
  25. }
  26. function o(t) {
  27. for (var e = 0; 0 != t;) t &= t - 1, ++e;
  28. return e
  29. }
  30. var h = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  31. function c(t) {
  32. var e, i, r = "";
  33. 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);
  34. 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 += "=";
  35. return r
  36. }
  37. function f(t) {
  38. var e, i = "", r = 0, n = 0;
  39. for (e = 0; e < t.length && "=" != t.charAt(e); ++e) {
  40. var s = h.indexOf(t.charAt(e));
  41. 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))
  42. }
  43. return 1 == r && (i += a(n << 2)), i
  44. }
  45. var l, p = function (t, e) {
  46. return (p = Object.setPrototypeOf || {__proto__: []} instanceof Array && function (t, e) {
  47. t.__proto__ = e
  48. } || function (t, e) {
  49. for (var i in e) e.hasOwnProperty(i) && (t[i] = e[i])
  50. })(t, e)
  51. };
  52. var g, d = function (t) {
  53. var e;
  54. if (void 0 === l) {
  55. var i = "0123456789ABCDEF", r = " \f\n\r\t \u2028\u2029";
  56. for (l = {}, e = 0; e < 16; ++e) l[i.charAt(e)] = e;
  57. for (i = i.toLowerCase(), e = 10; e < 16; ++e) l[i.charAt(e)] = e;
  58. for (e = 0; e < r.length; ++e) l[r.charAt(e)] = -1
  59. }
  60. var n = [], s = 0, o = 0;
  61. for (e = 0; e < t.length; ++e) {
  62. var h = t.charAt(e);
  63. if ("=" == h) break;
  64. if (-1 != (h = l[h])) {
  65. if (void 0 === h) throw new Error("Illegal character at offset " + e);
  66. s |= h, 2 <= ++o ? (n[n.length] = s, o = s = 0) : s <<= 4
  67. }
  68. }
  69. if (o) throw new Error("Hex encoding incomplete: 4 bits missing");
  70. return n
  71. }, v = {
  72. decode: function (t) {
  73. var e;
  74. if (void 0 === g) {
  75. var i = "= \f\n\r\t \u2028\u2029";
  76. for (g = Object.create(null), e = 0; e < 64; ++e) g["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)] = e;
  77. for (e = 0; e < i.length; ++e) g[i.charAt(e)] = -1
  78. }
  79. var r = [], n = 0, s = 0;
  80. for (e = 0; e < t.length; ++e) {
  81. var o = t.charAt(e);
  82. if ("=" == o) break;
  83. if (-1 != (o = g[o])) {
  84. if (void 0 === o) throw new Error("Illegal character at offset " + e);
  85. 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
  86. }
  87. }
  88. switch (s) {
  89. case 1:
  90. throw new Error("Base64 encoding incomplete: at least 2 bits missing");
  91. case 2:
  92. r[r.length] = n >> 10;
  93. break;
  94. case 3:
  95. r[r.length] = n >> 16, r[r.length] = n >> 8 & 255
  96. }
  97. return r
  98. },
  99. re: /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,
  100. unarmor: function (t) {
  101. var e = v.re.exec(t);
  102. if (e) if (e[1]) t = e[1]; else {
  103. if (!e[2]) throw new Error("RegExp out of sync");
  104. t = e[2]
  105. }
  106. return v.decode(t)
  107. }
  108. }, m = 1e13, y = function () {
  109. function t(t) {
  110. this.buf = [+t || 0]
  111. }
  112. return t.prototype.mulAdd = function (t, e) {
  113. var i, r, n = this.buf, s = n.length;
  114. for (i = 0; i < s; ++i) (r = n[i] * t + e) < m ? e = 0 : r -= (e = 0 | r / m) * m, n[i] = r;
  115. 0 < e && (n[i] = e)
  116. }, t.prototype.sub = function (t) {
  117. var e, i, r = this.buf, n = r.length;
  118. for (e = 0; e < n; ++e) (i = r[e] - t) < 0 ? (i += m, t = 1) : t = 0, r[e] = i;
  119. for (; 0 === r[r.length - 1];) r.pop()
  120. }, t.prototype.toString = function (t) {
  121. if (10 != (t || 10)) throw new Error("only base 10 is supported");
  122. 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);
  123. return i
  124. }, t.prototype.valueOf = function () {
  125. for (var t = this.buf, e = 0, i = t.length - 1; 0 <= i; --i) e = e * m + t[i];
  126. return e
  127. }, t.prototype.simplify = function () {
  128. var t = this.buf;
  129. return 1 == t.length ? t[0] : this
  130. }, t
  131. }(), b = "…",
  132. 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)?)?$/,
  133. 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)?)?$/;
  134. function E(t, e) {
  135. return t.length > e && (t = t.substring(0, e) + b), t
  136. }
  137. var w, D = function () {
  138. function i(t, e) {
  139. this.hexDigits = "0123456789ABCDEF", t instanceof i ? (this.enc = t.enc, this.pos = t.pos) : (this.enc = t, this.pos = e)
  140. }
  141. return i.prototype.get = function (t) {
  142. 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);
  143. return "string" == typeof this.enc ? this.enc.charCodeAt(t) : this.enc[t]
  144. }, i.prototype.hexByte = function (t) {
  145. return this.hexDigits.charAt(t >> 4 & 15) + this.hexDigits.charAt(15 & t)
  146. }, i.prototype.hexDump = function (t, e, i) {
  147. for (var r = "", n = t; n < e; ++n) if (r += this.hexByte(this.get(n)), !0 !== i) switch (15 & n) {
  148. case 7:
  149. r += " ";
  150. break;
  151. case 15:
  152. r += "\n";
  153. break;
  154. default:
  155. r += " "
  156. }
  157. return r
  158. }, i.prototype.isASCII = function (t, e) {
  159. for (var i = t; i < e; ++i) {
  160. var r = this.get(i);
  161. if (r < 32 || 176 < r) return !1
  162. }
  163. return !0
  164. }, i.prototype.parseStringISO = function (t, e) {
  165. for (var i = "", r = t; r < e; ++r) i += String.fromCharCode(this.get(r));
  166. return i
  167. }, i.prototype.parseStringUTF = function (t, e) {
  168. for (var i = "", r = t; r < e;) {
  169. var n = this.get(r++);
  170. 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++))
  171. }
  172. return i
  173. }, i.prototype.parseStringBMP = function (t, e) {
  174. for (var i, r, n = "", s = t; s < e;) i = this.get(s++), r = this.get(s++), n += String.fromCharCode(i << 8 | r);
  175. return n
  176. }, i.prototype.parseTime = function (t, e, i) {
  177. var r = this.parseStringISO(t, e), n = (i ? T : S).exec(r);
  178. 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
  179. }, i.prototype.parseInteger = function (t, e) {
  180. for (var i, r = this.get(t), n = 127 < r, s = n ? 255 : 0, o = ""; r == s && ++t < e;) r = this.get(t);
  181. if (0 === (i = e - t)) return n ? -1 : 0;
  182. if (4 < i) {
  183. for (o = r, i <<= 3; 0 == (128 & (+o ^ s));) o = +o << 1, --i;
  184. o = "(" + i + " bit)\n"
  185. }
  186. n && (r -= 256);
  187. for (var h = new y(r), a = t + 1; a < e; ++a) h.mulAdd(256, this.get(a));
  188. return o + h.toString()
  189. }, i.prototype.parseBitString = function (t, e, i) {
  190. for (var r = this.get(t), n = "(" + ((e - t - 1 << 3) - r) + " bit)\n", s = "", o = t + 1; o < e; ++o) {
  191. for (var h = this.get(o), a = o == e - 1 ? r : 0, u = 7; a <= u; --u) s += h >> u & 1 ? "1" : "0";
  192. if (s.length > i) return n + E(s, i)
  193. }
  194. return n + s
  195. }, i.prototype.parseOctetString = function (t, e, i) {
  196. if (this.isASCII(t, e)) return E(this.parseStringISO(t, e), i);
  197. var r = e - t, n = "(" + r + " byte)\n";
  198. (i /= 2) < r && (e = t + i);
  199. for (var s = t; s < e; ++s) n += this.hexByte(this.get(s));
  200. return i < r && (n += b), n
  201. }, i.prototype.parseOID = function (t, e, i) {
  202. for (var r = "", n = new y, s = 0, o = t; o < e; ++o) {
  203. var h = this.get(o);
  204. if (n.mulAdd(128, 127 & h), s += 7, !(128 & h)) {
  205. if ("" === r) if ((n = n.simplify()) instanceof y) n.sub(80), r = "2." + n.toString(); else {
  206. var a = n < 80 ? n < 40 ? 0 : 1 : 2;
  207. r = a + "." + (n - 40 * a)
  208. } else r += "." + n.toString();
  209. if (r.length > i) return E(r, i);
  210. n = new y, s = 0
  211. }
  212. }
  213. return 0 < s && (r += ".incomplete"), r
  214. }, i
  215. }(), x = function () {
  216. function c(t, e, i, r, n) {
  217. if (!(r instanceof R)) throw new Error("Invalid tag value.");
  218. this.stream = t, this.header = e, this.length = i, this.tag = r, this.sub = n
  219. }
  220. return c.prototype.typeName = function () {
  221. switch (this.tag.tagClass) {
  222. case 0:
  223. switch (this.tag.tagNumber) {
  224. case 0:
  225. return "EOC";
  226. case 1:
  227. return "BOOLEAN";
  228. case 2:
  229. return "INTEGER";
  230. case 3:
  231. return "BIT_STRING";
  232. case 4:
  233. return "OCTET_STRING";
  234. case 5:
  235. return "NULL";
  236. case 6:
  237. return "OBJECT_IDENTIFIER";
  238. case 7:
  239. return "ObjectDescriptor";
  240. case 8:
  241. return "EXTERNAL";
  242. case 9:
  243. return "REAL";
  244. case 10:
  245. return "ENUMERATED";
  246. case 11:
  247. return "EMBEDDED_PDV";
  248. case 12:
  249. return "UTF8String";
  250. case 16:
  251. return "SEQUENCE";
  252. case 17:
  253. return "SET";
  254. case 18:
  255. return "NumericString";
  256. case 19:
  257. return "PrintableString";
  258. case 20:
  259. return "TeletexString";
  260. case 21:
  261. return "VideotexString";
  262. case 22:
  263. return "IA5String";
  264. case 23:
  265. return "UTCTime";
  266. case 24:
  267. return "GeneralizedTime";
  268. case 25:
  269. return "GraphicString";
  270. case 26:
  271. return "VisibleString";
  272. case 27:
  273. return "GeneralString";
  274. case 28:
  275. return "UniversalString";
  276. case 30:
  277. return "BMPString"
  278. }
  279. return "Universal_" + this.tag.tagNumber.toString();
  280. case 1:
  281. return "Application_" + this.tag.tagNumber.toString();
  282. case 2:
  283. return "[" + this.tag.tagNumber.toString() + "]";
  284. case 3:
  285. return "Private_" + this.tag.tagNumber.toString()
  286. }
  287. }, c.prototype.content = function (t) {
  288. if (void 0 === this.tag) return null;
  289. void 0 === t && (t = 1 / 0);
  290. var e = this.posContent(), i = Math.abs(this.length);
  291. if (!this.tag.isUniversal()) return null !== this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(e, e + i, t);
  292. switch (this.tag.tagNumber) {
  293. case 1:
  294. return 0 === this.stream.get(e) ? "false" : "true";
  295. case 2:
  296. return this.stream.parseInteger(e, e + i);
  297. case 3:
  298. return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseBitString(e, e + i, t);
  299. case 4:
  300. return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(e, e + i, t);
  301. case 6:
  302. return this.stream.parseOID(e, e + i, t);
  303. case 16:
  304. case 17:
  305. return null !== this.sub ? "(" + this.sub.length + " elem)" : "(no elem)";
  306. case 12:
  307. return E(this.stream.parseStringUTF(e, e + i), t);
  308. case 18:
  309. case 19:
  310. case 20:
  311. case 21:
  312. case 22:
  313. case 26:
  314. return E(this.stream.parseStringISO(e, e + i), t);
  315. case 30:
  316. return E(this.stream.parseStringBMP(e, e + i), t);
  317. case 23:
  318. case 24:
  319. return this.stream.parseTime(e, e + i, 23 == this.tag.tagNumber)
  320. }
  321. return null
  322. }, c.prototype.toString = function () {
  323. return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (null === this.sub ? "null" : this.sub.length) + "]"
  324. }, c.prototype.toPrettyString = function (t) {
  325. void 0 === t && (t = "");
  326. var e = t + this.typeName() + " @" + this.stream.pos;
  327. if (0 <= this.length && (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) {
  328. t += " ";
  329. for (var i = 0, r = this.sub.length; i < r; ++i) e += this.sub[i].toPrettyString(t)
  330. }
  331. return e
  332. }, c.prototype.posStart = function () {
  333. return this.stream.pos
  334. }, c.prototype.posContent = function () {
  335. return this.stream.pos + this.header
  336. }, c.prototype.posEnd = function () {
  337. return this.stream.pos + this.header + Math.abs(this.length)
  338. }, c.prototype.toHexString = function () {
  339. return this.stream.hexDump(this.posStart(), this.posEnd(), !0)
  340. }, c.decodeLength = function (t) {
  341. var e = t.get(), i = 127 & e;
  342. if (i == e) return i;
  343. if (6 < i) throw new Error("Length over 48 bits not supported at position " + (t.pos - 1));
  344. if (0 === i) return null;
  345. for (var r = e = 0; r < i; ++r) e = 256 * e + t.get();
  346. return e
  347. }, c.prototype.getHexStringValue = function () {
  348. var t = this.toHexString(), e = 2 * this.header, i = 2 * this.length;
  349. return t.substr(e, i)
  350. }, c.decode = function (t) {
  351. var r;
  352. r = t instanceof D ? t : new D(t, 0);
  353. var e = new D(r), i = new R(r), n = c.decodeLength(r), s = r.pos, o = s - e.pos, h = null, a = function () {
  354. var t = [];
  355. if (null !== n) {
  356. for (var e = s + n; r.pos < e;) t[t.length] = c.decode(r);
  357. if (r.pos != e) throw new Error("Content size is not correct for container starting at offset " + s)
  358. } else try {
  359. for (; ;) {
  360. var i = c.decode(r);
  361. if (i.tag.isEOC()) break;
  362. t[t.length] = i
  363. }
  364. n = s - r.pos
  365. } catch (t) {
  366. throw new Error("Exception while decoding undefined length content: " + t)
  367. }
  368. return t
  369. };
  370. if (i.tagConstructed) h = a(); else if (i.isUniversal() && (3 == i.tagNumber || 4 == i.tagNumber)) try {
  371. if (3 == i.tagNumber && 0 != r.get()) throw new Error("BIT STRINGs with unused bits cannot encapsulate.");
  372. h = a();
  373. for (var u = 0; u < h.length; ++u) if (h[u].tag.isEOC()) throw new Error("EOC is not supposed to be actual content.")
  374. } catch (t) {
  375. h = null
  376. }
  377. if (null === h) {
  378. if (null === n) throw new Error("We can't skip over an invalid tag with undefined length at offset " + s);
  379. r.pos = s + Math.abs(n)
  380. }
  381. return new c(e, o, n, i, h)
  382. }, c
  383. }(), R = function () {
  384. function t(t) {
  385. var e = t.get();
  386. if (this.tagClass = e >> 6, this.tagConstructed = 0 != (32 & e), this.tagNumber = 31 & e, 31 == this.tagNumber) {
  387. for (var i = new y; e = t.get(), i.mulAdd(128, 127 & e), 128 & e;) ;
  388. this.tagNumber = i.simplify()
  389. }
  390. }
  391. return t.prototype.isUniversal = function () {
  392. return 0 === this.tagClass
  393. }, t.prototype.isEOC = function () {
  394. return 0 === this.tagClass && 0 === this.tagNumber
  395. }, t
  396. }(),
  397. B = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997],
  398. A = (1 << 26) / B[B.length - 1], O = function () {
  399. function b(t, e, i) {
  400. null != t && ("number" == typeof t ? this.fromNumber(t, e, i) : null == e && "string" != typeof t ? this.fromString(t, 256) : this.fromString(t, e))
  401. }
  402. return b.prototype.toString = function (t) {
  403. if (this.s < 0) return "-" + this.negate().toString(t);
  404. var e;
  405. if (16 == t) e = 4; else if (8 == t) e = 3; else if (2 == t) e = 1; else if (32 == t) e = 5; else {
  406. if (4 != t) return this.toRadix(t);
  407. e = 2
  408. }
  409. var i, r = (1 << e) - 1, n = !1, s = "", o = this.t, h = this.DB - o * this.DB % e;
  410. if (0 < o--) for (h < this.DB && 0 < (i = this[o] >> h) && (n = !0, s = a(i)); 0 <= o;) h < e ? (i = (this[o] & (1 << h) - 1) << e - h, i |= this[--o] >> (h += this.DB - e)) : (i = this[o] >> (h -= e) & r, h <= 0 && (h += this.DB, --o)), 0 < i && (n = !0), n && (s += a(i));
  411. return n ? s : "0"
  412. }, b.prototype.negate = function () {
  413. var t = M();
  414. return b.ZERO.subTo(this, t), t
  415. }, b.prototype.abs = function () {
  416. return this.s < 0 ? this.negate() : this
  417. }, b.prototype.compareTo = function (t) {
  418. var e = this.s - t.s;
  419. if (0 != e) return e;
  420. var i = this.t;
  421. if (0 != (e = i - t.t)) return this.s < 0 ? -e : e;
  422. for (; 0 <= --i;) if (0 != (e = this[i] - t[i])) return e;
  423. return 0
  424. }, b.prototype.bitLength = function () {
  425. return this.t <= 0 ? 0 : this.DB * (this.t - 1) + U(this[this.t - 1] ^ this.s & this.DM)
  426. }, b.prototype.mod = function (t) {
  427. var e = M();
  428. return this.abs().divRemTo(t, null, e), this.s < 0 && 0 < e.compareTo(b.ZERO) && t.subTo(e, e), e
  429. }, b.prototype.modPowInt = function (t, e) {
  430. var i;
  431. return i = t < 256 || e.isEven() ? new I(e) : new N(e), this.exp(t, i)
  432. }, b.prototype.clone = function () {
  433. var t = M();
  434. return this.copyTo(t), t
  435. }, b.prototype.intValue = function () {
  436. if (this.s < 0) {
  437. if (1 == this.t) return this[0] - this.DV;
  438. if (0 == this.t) return -1
  439. } else {
  440. if (1 == this.t) return this[0];
  441. if (0 == this.t) return 0
  442. }
  443. return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0]
  444. }, b.prototype.byteValue = function () {
  445. return 0 == this.t ? this.s : this[0] << 24 >> 24
  446. }, b.prototype.shortValue = function () {
  447. return 0 == this.t ? this.s : this[0] << 16 >> 16
  448. }, b.prototype.signum = function () {
  449. return this.s < 0 ? -1 : this.t <= 0 || 1 == this.t && this[0] <= 0 ? 0 : 1
  450. }, b.prototype.toByteArray = function () {
  451. var t = this.t, e = [];
  452. e[0] = this.s;
  453. var i, r = this.DB - t * this.DB % 8, n = 0;
  454. if (0 < t--) for (r < this.DB && (i = this[t] >> r) != (this.s & this.DM) >> r && (e[n++] = i | this.s << this.DB - r); 0 <= t;) 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, (0 < n || i != this.s) && (e[n++] = i);
  455. return e
  456. }, b.prototype.equals = function (t) {
  457. return 0 == this.compareTo(t)
  458. }, b.prototype.min = function (t) {
  459. return this.compareTo(t) < 0 ? this : t
  460. }, b.prototype.max = function (t) {
  461. return 0 < this.compareTo(t) ? this : t
  462. }, b.prototype.and = function (t) {
  463. var e = M();
  464. return this.bitwiseTo(t, i, e), e
  465. }, b.prototype.or = function (t) {
  466. var e = M();
  467. return this.bitwiseTo(t, u, e), e
  468. }, b.prototype.xor = function (t) {
  469. var e = M();
  470. return this.bitwiseTo(t, r, e), e
  471. }, b.prototype.andNot = function (t) {
  472. var e = M();
  473. return this.bitwiseTo(t, n, e), e
  474. }, b.prototype.not = function () {
  475. for (var t = M(), e = 0; e < this.t; ++e) t[e] = this.DM & ~this[e];
  476. return t.t = this.t, t.s = ~this.s, t
  477. }, b.prototype.shiftLeft = function (t) {
  478. var e = M();
  479. return t < 0 ? this.rShiftTo(-t, e) : this.lShiftTo(t, e), e
  480. }, b.prototype.shiftRight = function (t) {
  481. var e = M();
  482. return t < 0 ? this.lShiftTo(-t, e) : this.rShiftTo(t, e), e
  483. }, b.prototype.getLowestSetBit = function () {
  484. for (var t = 0; t < this.t; ++t) if (0 != this[t]) return t * this.DB + s(this[t]);
  485. return this.s < 0 ? this.t * this.DB : -1
  486. }, b.prototype.bitCount = function () {
  487. for (var t = 0, e = this.s & this.DM, i = 0; i < this.t; ++i) t += o(this[i] ^ e);
  488. return t
  489. }, b.prototype.testBit = function (t) {
  490. var e = Math.floor(t / this.DB);
  491. return e >= this.t ? 0 != this.s : 0 != (this[e] & 1 << t % this.DB)
  492. }, b.prototype.setBit = function (t) {
  493. return this.changeBit(t, u)
  494. }, b.prototype.clearBit = function (t) {
  495. return this.changeBit(t, n)
  496. }, b.prototype.flipBit = function (t) {
  497. return this.changeBit(t, r)
  498. }, b.prototype.add = function (t) {
  499. var e = M();
  500. return this.addTo(t, e), e
  501. }, b.prototype.subtract = function (t) {
  502. var e = M();
  503. return this.subTo(t, e), e
  504. }, b.prototype.multiply = function (t) {
  505. var e = M();
  506. return this.multiplyTo(t, e), e
  507. }, b.prototype.divide = function (t) {
  508. var e = M();
  509. return this.divRemTo(t, e, null), e
  510. }, b.prototype.remainder = function (t) {
  511. var e = M();
  512. return this.divRemTo(t, null, e), e
  513. }, b.prototype.divideAndRemainder = function (t) {
  514. var e = M(), i = M();
  515. return this.divRemTo(t, e, i), [e, i]
  516. }, b.prototype.modPow = function (t, e) {
  517. var i, r, n = t.bitLength(), s = F(1);
  518. if (n <= 0) return s;
  519. i = n < 18 ? 1 : n < 48 ? 3 : n < 144 ? 4 : n < 768 ? 5 : 6, r = n < 8 ? new I(e) : e.isEven() ? new P(e) : new N(e);
  520. var o = [], h = 3, a = i - 1, u = (1 << i) - 1;
  521. if (o[1] = r.convert(this), 1 < i) {
  522. var c = M();
  523. for (r.sqrTo(o[1], c); h <= u;) o[h] = M(), r.mulTo(c, o[h - 2], o[h]), h += 2
  524. }
  525. var f, l, p = t.t - 1, g = !0, d = M();
  526. for (n = U(t[p]) - 1; 0 <= p;) {
  527. for (a <= n ? f = t[p] >> n - a & u : (f = (t[p] & (1 << n + 1) - 1) << a - n, 0 < p && (f |= t[p - 1] >> this.DB + n - a)), h = i; 0 == (1 & f);) f >>= 1, --h;
  528. if ((n -= h) < 0 && (n += this.DB, --p), g) o[f].copyTo(s), g = !1; else {
  529. for (; 1 < h;) r.sqrTo(s, d), r.sqrTo(d, s), h -= 2;
  530. 0 < h ? r.sqrTo(s, d) : (l = s, s = d, d = l), r.mulTo(d, o[f], s)
  531. }
  532. for (; 0 <= p && 0 == (t[p] & 1 << n);) r.sqrTo(s, d), l = s, s = d, d = l, --n < 0 && (n = this.DB - 1, --p)
  533. }
  534. return r.revert(s)
  535. }, b.prototype.modInverse = function (t) {
  536. var e = t.isEven();
  537. if (this.isEven() && e || 0 == t.signum()) return b.ZERO;
  538. for (var i = t.clone(), r = this.clone(), n = F(1), s = F(0), o = F(0), h = F(1); 0 != i.signum();) {
  539. for (; i.isEven();) i.rShiftTo(1, i), e ? (n.isEven() && s.isEven() || (n.addTo(this, n), s.subTo(t, s)), n.rShiftTo(1, n)) : s.isEven() || s.subTo(t, s), s.rShiftTo(1, s);
  540. for (; r.isEven();) r.rShiftTo(1, r), e ? (o.isEven() && h.isEven() || (o.addTo(this, o), h.subTo(t, h)), o.rShiftTo(1, o)) : h.isEven() || h.subTo(t, h), h.rShiftTo(1, h);
  541. 0 <= i.compareTo(r) ? (i.subTo(r, i), e && n.subTo(o, n), s.subTo(h, s)) : (r.subTo(i, r), e && o.subTo(n, o), h.subTo(s, h))
  542. }
  543. return 0 != r.compareTo(b.ONE) ? b.ZERO : 0 <= h.compareTo(t) ? h.subtract(t) : h.signum() < 0 ? (h.addTo(t, h), h.signum() < 0 ? h.add(t) : h) : h
  544. }, b.prototype.pow = function (t) {
  545. return this.exp(t, new V)
  546. }, b.prototype.gcd = function (t) {
  547. var e = this.s < 0 ? this.negate() : this.clone(), i = t.s < 0 ? t.negate() : t.clone();
  548. if (e.compareTo(i) < 0) {
  549. var r = e;
  550. e = i, i = r
  551. }
  552. var n = e.getLowestSetBit(), s = i.getLowestSetBit();
  553. if (s < 0) return e;
  554. for (n < s && (s = n), 0 < s && (e.rShiftTo(s, e), i.rShiftTo(s, i)); 0 < e.signum();) 0 < (n = e.getLowestSetBit()) && e.rShiftTo(n, e), 0 < (n = i.getLowestSetBit()) && i.rShiftTo(n, i), 0 <= e.compareTo(i) ? (e.subTo(i, e), e.rShiftTo(1, e)) : (i.subTo(e, i), i.rShiftTo(1, i));
  555. return 0 < s && i.lShiftTo(s, i), i
  556. }, b.prototype.isProbablePrime = function (t) {
  557. var e, i = this.abs();
  558. if (1 == i.t && i[0] <= B[B.length - 1]) {
  559. for (e = 0; e < B.length; ++e) if (i[0] == B[e]) return !0;
  560. return !1
  561. }
  562. if (i.isEven()) return !1;
  563. for (e = 1; e < B.length;) {
  564. for (var r = B[e], n = e + 1; n < B.length && r < A;) r *= B[n++];
  565. for (r = i.modInt(r); e < n;) if (r % B[e++] == 0) return !1
  566. }
  567. return i.millerRabin(t)
  568. }, b.prototype.copyTo = function (t) {
  569. for (var e = this.t - 1; 0 <= e; --e) t[e] = this[e];
  570. t.t = this.t, t.s = this.s
  571. }, b.prototype.fromInt = function (t) {
  572. this.t = 1, this.s = t < 0 ? -1 : 0, 0 < t ? this[0] = t : t < -1 ? this[0] = t + this.DV : this.t = 0
  573. }, b.prototype.fromString = function (t, e) {
  574. var i;
  575. if (16 == e) i = 4; else if (8 == e) i = 3; else if (256 == e) i = 8; else if (2 == e) i = 1; else if (32 == e) i = 5; else {
  576. if (4 != e) return void this.fromRadix(t, e);
  577. i = 2
  578. }
  579. this.t = 0, this.s = 0;
  580. for (var r = t.length, n = !1, s = 0; 0 <= --r;) {
  581. var o = 8 == i ? 255 & +t[r] : C(t, r);
  582. o < 0 ? "-" == t.charAt(r) && (n = !0) : (n = !1, 0 == s ? this[this.t++] = o : s + i > this.DB ? (this[this.t - 1] |= (o & (1 << this.DB - s) - 1) << s, this[this.t++] = o >> this.DB - s) : this[this.t - 1] |= o << s, (s += i) >= this.DB && (s -= this.DB))
  583. }
  584. 8 == i && 0 != (128 & +t[0]) && (this.s = -1, 0 < s && (this[this.t - 1] |= (1 << this.DB - s) - 1 << s)), this.clamp(), n && b.ZERO.subTo(this, this)
  585. }, b.prototype.clamp = function () {
  586. for (var t = this.s & this.DM; 0 < this.t && this[this.t - 1] == t;) --this.t
  587. }, b.prototype.dlShiftTo = function (t, e) {
  588. var i;
  589. for (i = this.t - 1; 0 <= i; --i) e[i + t] = this[i];
  590. for (i = t - 1; 0 <= i; --i) e[i] = 0;
  591. e.t = this.t + t, e.s = this.s
  592. }, b.prototype.drShiftTo = function (t, e) {
  593. for (var i = t; i < this.t; ++i) e[i - t] = this[i];
  594. e.t = Math.max(this.t - t, 0), e.s = this.s
  595. }, b.prototype.lShiftTo = function (t, e) {
  596. 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; 0 <= h; --h) e[h + s + 1] = this[h] >> r | o, o = (this[h] & n) << i;
  597. for (h = s - 1; 0 <= h; --h) e[h] = 0;
  598. e[s] = o, e.t = this.t + s + 1, e.s = this.s, e.clamp()
  599. }, b.prototype.rShiftTo = function (t, e) {
  600. e.s = this.s;
  601. var i = Math.floor(t / this.DB);
  602. if (i >= this.t) e.t = 0; else {
  603. var r = t % this.DB, n = this.DB - r, s = (1 << r) - 1;
  604. e[0] = this[i] >> r;
  605. for (var o = i + 1; o < this.t; ++o) e[o - i - 1] |= (this[o] & s) << n, e[o - i] = this[o] >> r;
  606. 0 < r && (e[this.t - i - 1] |= (this.s & s) << n), e.t = this.t - i, e.clamp()
  607. }
  608. }, b.prototype.subTo = function (t, e) {
  609. 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;
  610. if (t.t < this.t) {
  611. for (r -= t.s; i < this.t;) r += this[i], e[i++] = r & this.DM, r >>= this.DB;
  612. r += this.s
  613. } else {
  614. for (r += this.s; i < t.t;) r -= t[i], e[i++] = r & this.DM, r >>= this.DB;
  615. r -= t.s
  616. }
  617. e.s = r < 0 ? -1 : 0, r < -1 ? e[i++] = this.DV + r : 0 < r && (e[i++] = r), e.t = i, e.clamp()
  618. }, b.prototype.multiplyTo = function (t, e) {
  619. var i = this.abs(), r = t.abs(), n = i.t;
  620. for (e.t = n + r.t; 0 <= --n;) e[n] = 0;
  621. for (n = 0; n < r.t; ++n) e[n + i.t] = i.am(0, r[n], e, n, 0, i.t);
  622. e.s = 0, e.clamp(), this.s != t.s && b.ZERO.subTo(e, e)
  623. }, b.prototype.squareTo = function (t) {
  624. for (var e = this.abs(), i = t.t = 2 * e.t; 0 <= --i;) t[i] = 0;
  625. for (i = 0; i < e.t - 1; ++i) {
  626. var r = e.am(i, e[i], t, 2 * i, 0, 1);
  627. (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)
  628. }
  629. 0 < t.t && (t[t.t - 1] += e.am(i, e[i], t, 2 * i, 0, 1)), t.s = 0, t.clamp()
  630. }, b.prototype.divRemTo = function (t, e, i) {
  631. var r = t.abs();
  632. if (!(r.t <= 0)) {
  633. var n = this.abs();
  634. if (n.t < r.t) return null != e && e.fromInt(0), void (null != i && this.copyTo(i));
  635. null == i && (i = M());
  636. var s = M(), o = this.s, h = t.s, a = this.DB - U(r[r.t - 1]);
  637. 0 < a ? (r.lShiftTo(a, s), n.lShiftTo(a, i)) : (r.copyTo(s), n.copyTo(i));
  638. var u = s.t, c = s[u - 1];
  639. if (0 != c) {
  640. var f = c * (1 << this.F1) + (1 < u ? s[u - 2] >> this.F2 : 0), l = this.FV / f,
  641. p = (1 << this.F1) / f, g = 1 << this.F2, d = i.t, v = d - u, m = null == e ? M() : e;
  642. for (s.dlShiftTo(v, m), 0 <= i.compareTo(m) && (i[i.t++] = 1, i.subTo(m, i)), b.ONE.dlShiftTo(u, m), m.subTo(s, s); s.t < u;) s[s.t++] = 0;
  643. for (; 0 <= --v;) {
  644. var y = i[--d] == c ? this.DM : Math.floor(i[d] * l + (i[d - 1] + g) * p);
  645. if ((i[d] += s.am(0, y, i, v, 0, u)) < y) for (s.dlShiftTo(v, m), i.subTo(m, i); i[d] < --y;) i.subTo(m, i)
  646. }
  647. null != e && (i.drShiftTo(u, e), o != h && b.ZERO.subTo(e, e)), i.t = u, i.clamp(), 0 < a && i.rShiftTo(a, i), o < 0 && b.ZERO.subTo(i, i)
  648. }
  649. }
  650. }, b.prototype.invDigit = function () {
  651. if (this.t < 1) return 0;
  652. var t = this[0];
  653. if (0 == (1 & t)) return 0;
  654. var e = 3 & t;
  655. return 0 < (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) ? this.DV - e : -e
  656. }, b.prototype.isEven = function () {
  657. return 0 == (0 < this.t ? 1 & this[0] : this.s)
  658. }, b.prototype.exp = function (t, e) {
  659. if (4294967295 < t || t < 1) return b.ONE;
  660. var i = M(), r = M(), n = e.convert(this), s = U(t) - 1;
  661. for (n.copyTo(i); 0 <= --s;) if (e.sqrTo(i, r), 0 < (t & 1 << s)) e.mulTo(r, n, i); else {
  662. var o = i;
  663. i = r, r = o
  664. }
  665. return e.revert(i)
  666. }, b.prototype.chunkSize = function (t) {
  667. return Math.floor(Math.LN2 * this.DB / Math.log(t))
  668. }, b.prototype.toRadix = function (t) {
  669. if (null == t && (t = 10), 0 == this.signum() || t < 2 || 36 < t) return "0";
  670. var e = this.chunkSize(t), i = Math.pow(t, e), r = F(i), n = M(), s = M(), o = "";
  671. for (this.divRemTo(r, n, s); 0 < n.signum();) o = (i + s.intValue()).toString(t).substr(1) + o, n.divRemTo(r, n, s);
  672. return s.intValue().toString(t) + o
  673. }, b.prototype.fromRadix = function (t, e) {
  674. this.fromInt(0), null == e && (e = 10);
  675. for (var i = this.chunkSize(e), r = Math.pow(e, i), n = !1, s = 0, o = 0, h = 0; h < t.length; ++h) {
  676. var a = C(t, h);
  677. a < 0 ? "-" == t.charAt(h) && 0 == this.signum() && (n = !0) : (o = e * o + a, ++s >= i && (this.dMultiply(r), this.dAddOffset(o, 0), o = s = 0))
  678. }
  679. 0 < s && (this.dMultiply(Math.pow(e, s)), this.dAddOffset(o, 0)), n && b.ZERO.subTo(this, this)
  680. }, b.prototype.fromNumber = function (t, e, i) {
  681. if ("number" == typeof e) if (t < 2) this.fromInt(1); else for (this.fromNumber(t, i), this.testBit(t - 1) || this.bitwiseTo(b.ONE.shiftLeft(t - 1), u, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(e);) this.dAddOffset(2, 0), this.bitLength() > t && this.subTo(b.ONE.shiftLeft(t - 1), this); else {
  682. var r = [], n = 7 & t;
  683. r.length = 1 + (t >> 3), e.nextBytes(r), 0 < n ? r[0] &= (1 << n) - 1 : r[0] = 0, this.fromString(r, 256)
  684. }
  685. }, b.prototype.bitwiseTo = function (t, e, i) {
  686. var r, n, s = Math.min(t.t, this.t);
  687. for (r = 0; r < s; ++r) i[r] = e(this[r], t[r]);
  688. if (t.t < this.t) {
  689. for (n = t.s & this.DM, r = s; r < this.t; ++r) i[r] = e(this[r], n);
  690. i.t = this.t
  691. } else {
  692. for (n = this.s & this.DM, r = s; r < t.t; ++r) i[r] = e(n, t[r]);
  693. i.t = t.t
  694. }
  695. i.s = e(this.s, t.s), i.clamp()
  696. }, b.prototype.changeBit = function (t, e) {
  697. var i = b.ONE.shiftLeft(t);
  698. return this.bitwiseTo(i, e, i), i
  699. }, b.prototype.addTo = function (t, e) {
  700. 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;
  701. if (t.t < this.t) {
  702. for (r += t.s; i < this.t;) r += this[i], e[i++] = r & this.DM, r >>= this.DB;
  703. r += this.s
  704. } else {
  705. for (r += this.s; i < t.t;) r += t[i], e[i++] = r & this.DM, r >>= this.DB;
  706. r += t.s
  707. }
  708. e.s = r < 0 ? -1 : 0, 0 < r ? e[i++] = r : r < -1 && (e[i++] = this.DV + r), e.t = i, e.clamp()
  709. }, b.prototype.dMultiply = function (t) {
  710. this[this.t] = this.am(0, t - 1, this, 0, 0, this.t), ++this.t, this.clamp()
  711. }, b.prototype.dAddOffset = function (t, e) {
  712. if (0 != t) {
  713. for (; this.t <= e;) this[this.t++] = 0;
  714. for (this[e] += t; this[e] >= this.DV;) this[e] -= this.DV, ++e >= this.t && (this[this.t++] = 0), ++this[e]
  715. }
  716. }, b.prototype.multiplyLowerTo = function (t, e, i) {
  717. var r = Math.min(this.t + t.t, e);
  718. for (i.s = 0, i.t = r; 0 < r;) i[--r] = 0;
  719. for (var n = i.t - this.t; r < n; ++r) i[r + this.t] = this.am(0, t[r], i, r, 0, this.t);
  720. for (n = Math.min(t.t, e); r < n; ++r) this.am(0, t[r], i, r, 0, e - r);
  721. i.clamp()
  722. }, b.prototype.multiplyUpperTo = function (t, e, i) {
  723. --e;
  724. var r = i.t = this.t + t.t - e;
  725. for (i.s = 0; 0 <= --r;) i[r] = 0;
  726. 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);
  727. i.clamp(), i.drShiftTo(1, i)
  728. }, b.prototype.modInt = function (t) {
  729. if (t <= 0) return 0;
  730. var e = this.DV % t, i = this.s < 0 ? t - 1 : 0;
  731. if (0 < this.t) if (0 == e) i = this[0] % t; else for (var r = this.t - 1; 0 <= r; --r) i = (e * i + this[r]) % t;
  732. return i
  733. }, b.prototype.millerRabin = function (t) {
  734. var e = this.subtract(b.ONE), i = e.getLowestSetBit();
  735. if (i <= 0) return !1;
  736. var r = e.shiftRight(i);
  737. B.length < (t = t + 1 >> 1) && (t = B.length);
  738. for (var n = M(), s = 0; s < t; ++s) {
  739. n.fromInt(B[Math.floor(Math.random() * B.length)]);
  740. var o = n.modPow(r, this);
  741. if (0 != o.compareTo(b.ONE) && 0 != o.compareTo(e)) {
  742. for (var h = 1; h++ < i && 0 != o.compareTo(e);) if (0 == (o = o.modPowInt(2, this)).compareTo(b.ONE)) return !1;
  743. if (0 != o.compareTo(e)) return !1
  744. }
  745. }
  746. return !0
  747. }, b.prototype.square = function () {
  748. var t = M();
  749. return this.squareTo(t), t
  750. }, b.prototype.gcda = function (t, e) {
  751. var i = this.s < 0 ? this.negate() : this.clone(), r = t.s < 0 ? t.negate() : t.clone();
  752. if (i.compareTo(r) < 0) {
  753. var n = i;
  754. i = r, r = n
  755. }
  756. var s = i.getLowestSetBit(), o = r.getLowestSetBit();
  757. if (o < 0) e(i); else {
  758. s < o && (o = s), 0 < o && (i.rShiftTo(o, i), r.rShiftTo(o, r));
  759. var h = function () {
  760. 0 < (s = i.getLowestSetBit()) && i.rShiftTo(s, i), 0 < (s = r.getLowestSetBit()) && r.rShiftTo(s, r), 0 <= i.compareTo(r) ? (i.subTo(r, i), i.rShiftTo(1, i)) : (r.subTo(i, r), r.rShiftTo(1, r)), 0 < i.signum() ? setTimeout(h, 0) : (0 < o && r.lShiftTo(o, r), setTimeout(function () {
  761. e(r)
  762. }, 0))
  763. };
  764. setTimeout(h, 10)
  765. }
  766. }, b.prototype.fromNumberAsync = function (t, e, i, r) {
  767. if ("number" == typeof e) if (t < 2) this.fromInt(1); else {
  768. this.fromNumber(t, i), this.testBit(t - 1) || this.bitwiseTo(b.ONE.shiftLeft(t - 1), u, this), this.isEven() && this.dAddOffset(1, 0);
  769. var n = this, s = function () {
  770. n.dAddOffset(2, 0), n.bitLength() > t && n.subTo(b.ONE.shiftLeft(t - 1), n), n.isProbablePrime(e) ? setTimeout(function () {
  771. r()
  772. }, 0) : setTimeout(s, 0)
  773. };
  774. setTimeout(s, 0)
  775. } else {
  776. var o = [], h = 7 & t;
  777. o.length = 1 + (t >> 3), e.nextBytes(o), 0 < h ? o[0] &= (1 << h) - 1 : o[0] = 0, this.fromString(o, 256)
  778. }
  779. }, b
  780. }(), V = function () {
  781. function t() {
  782. }
  783. return t.prototype.convert = function (t) {
  784. return t
  785. }, t.prototype.revert = function (t) {
  786. return t
  787. }, t.prototype.mulTo = function (t, e, i) {
  788. t.multiplyTo(e, i)
  789. }, t.prototype.sqrTo = function (t, e) {
  790. t.squareTo(e)
  791. }, t
  792. }(), I = function () {
  793. function t(t) {
  794. this.m = t
  795. }
  796. return t.prototype.convert = function (t) {
  797. return t.s < 0 || 0 <= t.compareTo(this.m) ? t.mod(this.m) : t
  798. }, t.prototype.revert = function (t) {
  799. return t
  800. }, t.prototype.reduce = function (t) {
  801. t.divRemTo(this.m, null, t)
  802. }, t.prototype.mulTo = function (t, e, i) {
  803. t.multiplyTo(e, i), this.reduce(i)
  804. }, t.prototype.sqrTo = function (t, e) {
  805. t.squareTo(e), this.reduce(e)
  806. }, t
  807. }(), N = function () {
  808. function t(t) {
  809. 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
  810. }
  811. return t.prototype.convert = function (t) {
  812. var e = M();
  813. return t.abs().dlShiftTo(this.m.t, e), e.divRemTo(this.m, null, e), t.s < 0 && 0 < e.compareTo(O.ZERO) && this.m.subTo(e, e), e
  814. }, t.prototype.revert = function (t) {
  815. var e = M();
  816. return t.copyTo(e), this.reduce(e), e
  817. }, t.prototype.reduce = function (t) {
  818. for (; t.t <= this.mt2;) t[t.t++] = 0;
  819. for (var e = 0; e < this.m.t; ++e) {
  820. var i = 32767 & t[e],
  821. r = i * this.mpl + ((i * this.mph + (t[e] >> 15) * this.mpl & this.um) << 15) & t.DM;
  822. 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]++
  823. }
  824. t.clamp(), t.drShiftTo(this.m.t, t), 0 <= t.compareTo(this.m) && t.subTo(this.m, t)
  825. }, t.prototype.mulTo = function (t, e, i) {
  826. t.multiplyTo(e, i), this.reduce(i)
  827. }, t.prototype.sqrTo = function (t, e) {
  828. t.squareTo(e), this.reduce(e)
  829. }, t
  830. }(), P = function () {
  831. function t(t) {
  832. this.m = t, this.r2 = M(), this.q3 = M(), O.ONE.dlShiftTo(2 * t.t, this.r2), this.mu = this.r2.divide(t)
  833. }
  834. return t.prototype.convert = function (t) {
  835. if (t.s < 0 || t.t > 2 * this.m.t) return t.mod(this.m);
  836. if (t.compareTo(this.m) < 0) return t;
  837. var e = M();
  838. return t.copyTo(e), this.reduce(e), e
  839. }, t.prototype.revert = function (t) {
  840. return t
  841. }, t.prototype.reduce = function (t) {
  842. 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);
  843. for (t.subTo(this.r2, t); 0 <= t.compareTo(this.m);) t.subTo(this.m, t)
  844. }, t.prototype.mulTo = function (t, e, i) {
  845. t.multiplyTo(e, i), this.reduce(i)
  846. }, t.prototype.sqrTo = function (t, e) {
  847. t.squareTo(e), this.reduce(e)
  848. }, t
  849. }();
  850. function M() {
  851. return new O(null)
  852. }
  853. function q(t, e) {
  854. return new O(t, e)
  855. }
  856. "Microsoft Internet Explorer" == navigator.appName ? (O.prototype.am = function (t, e, i, r, n, s) {
  857. for (var o = 32767 & e, h = e >> 15; 0 <= --s;) {
  858. var a = 32767 & this[t], u = this[t++] >> 15, c = h * a + u * o;
  859. n = ((a = o * a + ((32767 & c) << 15) + i[r] + (1073741823 & n)) >>> 30) + (c >>> 15) + h * u + (n >>> 30), i[r++] = 1073741823 & a
  860. }
  861. return n
  862. }, w = 30) : "Netscape" != navigator.appName ? (O.prototype.am = function (t, e, i, r, n, s) {
  863. for (; 0 <= --s;) {
  864. var o = e * this[t++] + i[r] + n;
  865. n = Math.floor(o / 67108864), i[r++] = 67108863 & o
  866. }
  867. return n
  868. }, w = 26) : (O.prototype.am = function (t, e, i, r, n, s) {
  869. for (var o = 16383 & e, h = e >> 14; 0 <= --s;) {
  870. var a = 16383 & this[t], u = this[t++] >> 14, c = h * a + u * o;
  871. n = ((a = o * a + ((16383 & c) << 14) + i[r] + n) >> 28) + (c >> 14) + h * u, i[r++] = 268435455 & a
  872. }
  873. return n
  874. }, w = 28), O.prototype.DB = w, O.prototype.DM = (1 << w) - 1, O.prototype.DV = 1 << w;
  875. O.prototype.FV = Math.pow(2, 52), O.prototype.F1 = 52 - w, O.prototype.F2 = 2 * w - 52;
  876. var j, L, H = [];
  877. for (j = "0".charCodeAt(0), L = 0; L <= 9; ++L) H[j++] = L;
  878. for (j = "a".charCodeAt(0), L = 10; L < 36; ++L) H[j++] = L;
  879. for (j = "A".charCodeAt(0), L = 10; L < 36; ++L) H[j++] = L;
  880. function C(t, e) {
  881. var i = H[t.charCodeAt(e)];
  882. return null == i ? -1 : i
  883. }
  884. function F(t) {
  885. var e = M();
  886. return e.fromInt(t), e
  887. }
  888. function U(t) {
  889. var e, i = 1;
  890. 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
  891. }
  892. O.ZERO = F(0), O.ONE = F(1);
  893. var K = function () {
  894. function t() {
  895. this.i = 0, this.j = 0, this.S = []
  896. }
  897. return t.prototype.init = function (t) {
  898. var e, i, r;
  899. for (e = 0; e < 256; ++e) this.S[e] = e;
  900. for (e = i = 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;
  901. this.i = 0, this.j = 0
  902. }, t.prototype.next = function () {
  903. var t;
  904. 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]
  905. }, t
  906. }();
  907. var k, _, z = 256, Z = null;
  908. if (null == Z) {
  909. Z = [];
  910. var G = void (_ = 0);
  911. if (window.crypto && window.crypto.getRandomValues) {
  912. var $ = new Uint32Array(256);
  913. for (window.crypto.getRandomValues($), G = 0; G < $.length; ++G) Z[_++] = 255 & $[G]
  914. }
  915. var Y = function (t) {
  916. if (this.count = this.count || 0, 256 <= this.count || z <= _) window.removeEventListener ? window.removeEventListener("mousemove", Y, !1) : window.detachEvent && window.detachEvent("onmousemove", Y); else try {
  917. var e = t.x + t.y;
  918. Z[_++] = 255 & e, this.count += 1
  919. } catch (t) {
  920. }
  921. };
  922. window.addEventListener ? window.addEventListener("mousemove", Y, !1) : window.attachEvent && window.attachEvent("onmousemove", Y)
  923. }
  924. function J() {
  925. if (null == k) {
  926. for (k = new K; _ < z;) {
  927. var t = Math.floor(65536 * Math.random());
  928. Z[_++] = 255 & t
  929. }
  930. for (k.init(Z), _ = 0; _ < Z.length; ++_) Z[_] = 0;
  931. _ = 0
  932. }
  933. return k.next()
  934. }
  935. var X = function () {
  936. function t() {
  937. }
  938. return t.prototype.nextBytes = function (t) {
  939. for (var e = 0; e < t.length; ++e) t[e] = J()
  940. }, t
  941. }();
  942. var Q = function () {
  943. function t() {
  944. this.n = null, this.e = 0, this.d = null, this.p = null, this.q = null, this.dmp1 = null, this.dmq1 = null, this.coeff = null
  945. }
  946. return t.prototype.doPublic = function (t) {
  947. return t.modPowInt(this.e, this.n)
  948. }, t.prototype.doPrivate = function (t) {
  949. if (null == this.p || null == this.q) return t.modPow(this.d, this.n);
  950. 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);
  951. return e.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i)
  952. }, t.prototype.setPublic = function (t, e) {
  953. null != t && null != e && 0 < t.length && 0 < e.length ? (this.n = q(t, 16), this.e = parseInt(e, 16)) : console.error("Invalid RSA public key")
  954. }, t.prototype.encrypt = function (t) {
  955. var e = function (t, e) {
  956. if (e < t.length + 11) return console.error("Message too long for RSA"), null;
  957. for (var i = [], r = t.length - 1; 0 <= r && 0 < e;) {
  958. var n = t.charCodeAt(r--);
  959. n < 128 ? i[--e] = n : 127 < n && 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)
  960. }
  961. i[--e] = 0;
  962. for (var s = new X, o = []; 2 < e;) {
  963. for (o[0] = 0; 0 == o[0];) s.nextBytes(o);
  964. i[--e] = o[0]
  965. }
  966. return i[--e] = 2, i[--e] = 0, new O(i)
  967. }(t, this.n.bitLength() + 7 >> 3);
  968. if (null == e) return null;
  969. var i = this.doPublic(e);
  970. if (null == i) return null;
  971. var r = i.toString(16);
  972. return 0 == (1 & r.length) ? r : "0" + r
  973. }, t.prototype.setPrivate = function (t, e, i) {
  974. null != t && null != e && 0 < t.length && 0 < e.length ? (this.n = q(t, 16), this.e = parseInt(e, 16), this.d = q(i, 16)) : console.error("Invalid RSA private key")
  975. }, t.prototype.setPrivateEx = function (t, e, i, r, n, s, o, h) {
  976. null != t && null != e && 0 < t.length && 0 < e.length ? (this.n = q(t, 16), this.e = parseInt(e, 16), this.d = q(i, 16), this.p = q(r, 16), this.q = q(n, 16), this.dmp1 = q(s, 16), this.dmq1 = q(o, 16), this.coeff = q(h, 16)) : console.error("Invalid RSA private key")
  977. }, t.prototype.generate = function (t, e) {
  978. var i = new X, r = t >> 1;
  979. this.e = parseInt(e, 16);
  980. for (var n = new O(e, 16); ;) {
  981. for (; this.p = new O(t - r, 1, i), 0 != this.p.subtract(O.ONE).gcd(n).compareTo(O.ONE) || !this.p.isProbablePrime(10);) ;
  982. for (; this.q = new O(r, 1, i), 0 != this.q.subtract(O.ONE).gcd(n).compareTo(O.ONE) || !this.q.isProbablePrime(10);) ;
  983. if (this.p.compareTo(this.q) <= 0) {
  984. var s = this.p;
  985. this.p = this.q, this.q = s
  986. }
  987. var o = this.p.subtract(O.ONE), h = this.q.subtract(O.ONE), a = o.multiply(h);
  988. if (0 == a.gcd(n).compareTo(O.ONE)) {
  989. 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);
  990. break
  991. }
  992. }
  993. }, t.prototype.decrypt = function (t) {
  994. var e = q(t, 16), i = this.doPrivate(e);
  995. return null == i ? null : function (t, e) {
  996. var i = t.toByteArray(), r = 0;
  997. for (; r < i.length && 0 == i[r];) ++r;
  998. if (i.length - r != e - 1 || 2 != i[r]) return null;
  999. ++r;
  1000. for (; 0 != i[r];) if (++r >= i.length) return null;
  1001. var n = "";
  1002. for (; ++r < i.length;) {
  1003. var s = 255 & i[r];
  1004. s < 128 ? n += String.fromCharCode(s) : 191 < s && 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)
  1005. }
  1006. return n
  1007. }(i, this.n.bitLength() + 7 >> 3)
  1008. }, t.prototype.generateAsync = function (t, e, n) {
  1009. var s = new X, o = t >> 1;
  1010. this.e = parseInt(e, 16);
  1011. var h = new O(e, 16), a = this, u = function () {
  1012. var e = function () {
  1013. if (a.p.compareTo(a.q) <= 0) {
  1014. var t = a.p;
  1015. a.p = a.q, a.q = t
  1016. }
  1017. var e = a.p.subtract(O.ONE), i = a.q.subtract(O.ONE), r = e.multiply(i);
  1018. 0 == r.gcd(h).compareTo(O.ONE) ? (a.n = a.p.multiply(a.q), a.d = h.modInverse(r), a.dmp1 = a.d.mod(e), a.dmq1 = a.d.mod(i), a.coeff = a.q.modInverse(a.p), setTimeout(function () {
  1019. n()
  1020. }, 0)) : setTimeout(u, 0)
  1021. }, i = function () {
  1022. a.q = M(), a.q.fromNumberAsync(o, 1, s, function () {
  1023. a.q.subtract(O.ONE).gcda(h, function (t) {
  1024. 0 == t.compareTo(O.ONE) && a.q.isProbablePrime(10) ? setTimeout(e, 0) : setTimeout(i, 0)
  1025. })
  1026. })
  1027. }, r = function () {
  1028. a.p = M(), a.p.fromNumberAsync(t - o, 1, s, function () {
  1029. a.p.subtract(O.ONE).gcda(h, function (t) {
  1030. 0 == t.compareTo(O.ONE) && a.p.isProbablePrime(10) ? setTimeout(i, 0) : setTimeout(r, 0)
  1031. })
  1032. })
  1033. };
  1034. setTimeout(r, 0)
  1035. };
  1036. setTimeout(u, 0)
  1037. }, t.prototype.sign = function (t, e, i) {
  1038. var r = function (t, e) {
  1039. if (e < t.length + 22) return console.error("Message too long for RSA"), null;
  1040. for (var i = e - t.length - 6, r = "", n = 0; n < i; n += 2) r += "ff";
  1041. return q("0001" + r + "00" + t, 16)
  1042. }((W[i] || "") + e(t).toString(), this.n.bitLength() / 4);
  1043. if (null == r) return null;
  1044. var n = this.doPrivate(r);
  1045. if (null == n) return null;
  1046. var s = n.toString(16);
  1047. return 0 == (1 & s.length) ? s : "0" + s
  1048. }, t.prototype.verify = function (t, e, i) {
  1049. var r = q(e, 16), n = this.doPublic(r);
  1050. return null == n ? null : function (t) {
  1051. for (var e in W) if (W.hasOwnProperty(e)) {
  1052. var i = W[e], r = i.length;
  1053. if (t.substr(0, r) == i) return t.substr(r)
  1054. }
  1055. return t
  1056. }(n.toString(16).replace(/^1f+00/, "")) == i(t).toString()
  1057. }, t
  1058. }();
  1059. var W = {
  1060. md2: "3020300c06082a864886f70d020205000410",
  1061. md5: "3020300c06082a864886f70d020505000410",
  1062. sha1: "3021300906052b0e03021a05000414",
  1063. sha224: "302d300d06096086480165030402040500041c",
  1064. sha256: "3031300d060960864801650304020105000420",
  1065. sha384: "3041300d060960864801650304020205000430",
  1066. sha512: "3051300d060960864801650304020305000440",
  1067. ripemd160: "3021300906052b2403020105000414"
  1068. };
  1069. var tt = {};
  1070. tt.lang = {
  1071. extend: function (t, e, i) {
  1072. if (!e || !t) throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");
  1073. var r = function () {
  1074. };
  1075. if (r.prototype = e.prototype, t.prototype = new r, (t.prototype.constructor = t).superclass = e.prototype, e.prototype.constructor == Object.prototype.constructor && (e.prototype.constructor = e), i) {
  1076. var n;
  1077. for (n in i) t.prototype[n] = i[n];
  1078. var s = function () {
  1079. }, o = ["toString", "valueOf"];
  1080. try {
  1081. /MSIE/.test(navigator.userAgent) && (s = function (t, e) {
  1082. for (n = 0; n < o.length; n += 1) {
  1083. var i = o[n], r = e[i];
  1084. "function" == typeof r && r != Object.prototype[i] && (t[i] = r)
  1085. }
  1086. })
  1087. } catch (t) {
  1088. }
  1089. s(t.prototype, i)
  1090. }
  1091. }
  1092. };
  1093. var et = {};
  1094. void 0 !== et.asn1 && et.asn1 || (et.asn1 = {}), et.asn1.ASN1Util = new function () {
  1095. this.integerToByteHex = function (t) {
  1096. var e = t.toString(16);
  1097. return e.length % 2 == 1 && (e = "0" + e), e
  1098. }, this.bigIntToMinTwosComplementsHex = function (t) {
  1099. var e = t.toString(16);
  1100. if ("-" != e.substr(0, 1)) e.length % 2 == 1 ? e = "0" + e : e.match(/^[0-7]/) || (e = "00" + e); else {
  1101. var i = e.substr(1).length;
  1102. i % 2 == 1 ? i += 1 : e.match(/^[0-7]/) || (i += 2);
  1103. for (var r = "", n = 0; n < i; n++) r += "f";
  1104. e = new O(r, 16).xor(t).add(O.ONE).toString(16).replace(/^-/, "")
  1105. }
  1106. return e
  1107. }, this.getPEMStringFromHex = function (t, e) {
  1108. return hextopem(t, e)
  1109. }, this.newObject = function (t) {
  1110. var e = et.asn1, i = e.DERBoolean, r = e.DERInteger, n = e.DERBitString, s = e.DEROctetString,
  1111. o = e.DERNull, h = e.DERObjectIdentifier, a = e.DEREnumerated, u = e.DERUTF8String,
  1112. c = e.DERNumericString, f = e.DERPrintableString, l = e.DERTeletexString, p = e.DERIA5String,
  1113. g = e.DERUTCTime, d = e.DERGeneralizedTime, v = e.DERSequence, m = e.DERSet, y = e.DERTaggedObject,
  1114. b = e.ASN1Util.newObject, T = Object.keys(t);
  1115. if (1 != T.length) throw"key of param shall be only one.";
  1116. var S = T[0];
  1117. 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;
  1118. if ("bool" == S) return new i(t[S]);
  1119. if ("int" == S) return new r(t[S]);
  1120. if ("bitstr" == S) return new n(t[S]);
  1121. if ("octstr" == S) return new s(t[S]);
  1122. if ("null" == S) return new o(t[S]);
  1123. if ("oid" == S) return new h(t[S]);
  1124. if ("enum" == S) return new a(t[S]);
  1125. if ("utf8str" == S) return new u(t[S]);
  1126. if ("numstr" == S) return new c(t[S]);
  1127. if ("prnstr" == S) return new f(t[S]);
  1128. if ("telstr" == S) return new l(t[S]);
  1129. if ("ia5str" == S) return new p(t[S]);
  1130. if ("utctime" == S) return new g(t[S]);
  1131. if ("gentime" == S) return new d(t[S]);
  1132. if ("seq" == S) {
  1133. for (var E = t[S], w = [], D = 0; D < E.length; D++) {
  1134. var x = b(E[D]);
  1135. w.push(x)
  1136. }
  1137. return new v({array: w})
  1138. }
  1139. if ("set" == S) {
  1140. for (E = t[S], w = [], D = 0; D < E.length; D++) {
  1141. x = b(E[D]);
  1142. w.push(x)
  1143. }
  1144. return new m({array: w})
  1145. }
  1146. if ("tag" == S) {
  1147. var R = t[S];
  1148. if ("[object Array]" === Object.prototype.toString.call(R) && 3 == R.length) {
  1149. var B = b(R[2]);
  1150. return new y({tag: R[0], explicit: R[1], obj: B})
  1151. }
  1152. var A = {};
  1153. if (void 0 !== R.explicit && (A.explicit = R.explicit), void 0 !== R.tag && (A.tag = R.tag), void 0 === R.obj) throw"obj shall be specified for 'tag'.";
  1154. return A.obj = b(R.obj), new y(A)
  1155. }
  1156. }, this.jsonToASN1HEX = function (t) {
  1157. return this.newObject(t).getEncodedHex()
  1158. }
  1159. }, et.asn1.ASN1Util.oidHexToInt = function (t) {
  1160. 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) {
  1161. var s = ("00000000" + parseInt(t.substr(n, 2), 16).toString(2)).slice(-8);
  1162. if (r += s.substr(1, 7), "0" == s.substr(0, 1)) e = e + "." + new O(r, 2).toString(10), r = ""
  1163. }
  1164. return e
  1165. }, et.asn1.ASN1Util.oidIntToHex = function (t) {
  1166. var h = function (t) {
  1167. var e = t.toString(16);
  1168. return 1 == e.length && (e = "0" + e), e
  1169. }, e = function (t) {
  1170. var e = "", i = new O(t, 10).toString(2), r = 7 - i.length % 7;
  1171. 7 == r && (r = 0);
  1172. for (var n = "", s = 0; s < r; s++) n += "0";
  1173. i = n + i;
  1174. for (s = 0; s < i.length - 1; s += 7) {
  1175. var o = i.substr(s, 7);
  1176. s != i.length - 7 && (o = "1" + o), e += h(parseInt(o, 2))
  1177. }
  1178. return e
  1179. };
  1180. if (!t.match(/^[0-9.]+$/)) throw"malformed oid string: " + t;
  1181. var i = "", r = t.split("."), n = 40 * parseInt(r[0]) + parseInt(r[1]);
  1182. i += h(n), r.splice(0, 2);
  1183. for (var s = 0; s < r.length; s++) i += e(r[s]);
  1184. return i
  1185. }, et.asn1.ASN1Object = function () {
  1186. this.getLengthHexFromValue = function () {
  1187. if (void 0 === this.hV || null == this.hV) throw"this.hV is null or undefined.";
  1188. if (this.hV.length % 2 == 1) throw"value hex must be even length: n=" + "".length + ",v=" + this.hV;
  1189. var t = this.hV.length / 2, e = t.toString(16);
  1190. if (e.length % 2 == 1 && (e = "0" + e), t < 128) return e;
  1191. var i = e.length / 2;
  1192. if (15 < i) throw"ASN.1 length too long to represent by 8x: n = " + t.toString(16);
  1193. return (128 + i).toString(16) + e
  1194. }, this.getEncodedHex = function () {
  1195. 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
  1196. }, this.getValueHex = function () {
  1197. return this.getEncodedHex(), this.hV
  1198. }, this.getFreshValueHex = function () {
  1199. return ""
  1200. }
  1201. }, et.asn1.DERAbstractString = function (t) {
  1202. et.asn1.DERAbstractString.superclass.constructor.call(this), this.getString = function () {
  1203. return this.s
  1204. }, this.setString = function (t) {
  1205. this.hTLV = null, this.isModified = !0, this.s = t, this.hV = stohex(this.s)
  1206. }, this.setStringHex = function (t) {
  1207. this.hTLV = null, this.isModified = !0, this.s = null, this.hV = t
  1208. }, this.getFreshValueHex = function () {
  1209. return this.hV
  1210. }, 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))
  1211. }, tt.lang.extend(et.asn1.DERAbstractString, et.asn1.ASN1Object), et.asn1.DERAbstractTime = function (t) {
  1212. et.asn1.DERAbstractTime.superclass.constructor.call(this), this.localDateToUTC = function (t) {
  1213. return utc = t.getTime() + 6e4 * t.getTimezoneOffset(), new Date(utc)
  1214. }, this.formatDate = function (t, e, i) {
  1215. var r = this.zeroPadding, n = this.localDateToUTC(t), s = String(n.getFullYear());
  1216. "utc" == e && (s = s.substr(2, 2));
  1217. 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);
  1218. if (!0 === i) {
  1219. var h = n.getMilliseconds();
  1220. if (0 != h) {
  1221. var a = r(String(h), 3);
  1222. o = o + "." + (a = a.replace(/[0]+$/, ""))
  1223. }
  1224. }
  1225. return o + "Z"
  1226. }, this.zeroPadding = function (t, e) {
  1227. return t.length >= e ? t : new Array(e - t.length + 1).join("0") + t
  1228. }, this.getString = function () {
  1229. return this.s
  1230. }, this.setString = function (t) {
  1231. this.hTLV = null, this.isModified = !0, this.s = t, this.hV = stohex(t)
  1232. }, this.setByDateValue = function (t, e, i, r, n, s) {
  1233. var o = new Date(Date.UTC(t, e - 1, i, r, n, s, 0));
  1234. this.setByDate(o)
  1235. }, this.getFreshValueHex = function () {
  1236. return this.hV
  1237. }
  1238. }, tt.lang.extend(et.asn1.DERAbstractTime, et.asn1.ASN1Object), et.asn1.DERAbstractStructured = function (t) {
  1239. et.asn1.DERAbstractString.superclass.constructor.call(this), this.setByASN1ObjectArray = function (t) {
  1240. this.hTLV = null, this.isModified = !0, this.asn1Array = t
  1241. }, this.appendASN1Object = function (t) {
  1242. this.hTLV = null, this.isModified = !0, this.asn1Array.push(t)
  1243. }, this.asn1Array = new Array, void 0 !== t && void 0 !== t.array && (this.asn1Array = t.array)
  1244. }, tt.lang.extend(et.asn1.DERAbstractStructured, et.asn1.ASN1Object), et.asn1.DERBoolean = function () {
  1245. et.asn1.DERBoolean.superclass.constructor.call(this), this.hT = "01", this.hTLV = "0101ff"
  1246. }, tt.lang.extend(et.asn1.DERBoolean, et.asn1.ASN1Object), et.asn1.DERInteger = function (t) {
  1247. et.asn1.DERInteger.superclass.constructor.call(this), this.hT = "02", this.setByBigInteger = function (t) {
  1248. this.hTLV = null, this.isModified = !0, this.hV = et.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)
  1249. }, this.setByInteger = function (t) {
  1250. var e = new O(String(t), 10);
  1251. this.setByBigInteger(e)
  1252. }, this.setValueHex = function (t) {
  1253. this.hV = t
  1254. }, this.getFreshValueHex = function () {
  1255. return this.hV
  1256. }, 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))
  1257. }, tt.lang.extend(et.asn1.DERInteger, et.asn1.ASN1Object), et.asn1.DERBitString = function (t) {
  1258. if (void 0 !== t && void 0 !== t.obj) {
  1259. var e = et.asn1.ASN1Util.newObject(t.obj);
  1260. t.hex = "00" + e.getEncodedHex()
  1261. }
  1262. et.asn1.DERBitString.superclass.constructor.call(this), this.hT = "03", this.setHexValueIncludingUnusedBits = function (t) {
  1263. this.hTLV = null, this.isModified = !0, this.hV = t
  1264. }, this.setUnusedBitsAndHexValue = function (t, e) {
  1265. if (t < 0 || 7 < t) throw"unused bits shall be from 0 to 7: u = " + t;
  1266. var i = "0" + t;
  1267. this.hTLV = null, this.isModified = !0, this.hV = i + e
  1268. }, this.setByBinaryString = function (t) {
  1269. var e = 8 - (t = t.replace(/0+$/, "")).length % 8;
  1270. 8 == e && (e = 0);
  1271. for (var i = 0; i <= e; i++) t += "0";
  1272. var r = "";
  1273. for (i = 0; i < t.length - 1; i += 8) {
  1274. var n = t.substr(i, 8), s = parseInt(n, 2).toString(16);
  1275. 1 == s.length && (s = "0" + s), r += s
  1276. }
  1277. this.hTLV = null, this.isModified = !0, this.hV = "0" + e + r
  1278. }, this.setByBooleanArray = function (t) {
  1279. for (var e = "", i = 0; i < t.length; i++) 1 == t[i] ? e += "1" : e += "0";
  1280. this.setByBinaryString(e)
  1281. }, this.newFalseArray = function (t) {
  1282. for (var e = new Array(t), i = 0; i < t; i++) e[i] = !1;
  1283. return e
  1284. }, this.getFreshValueHex = function () {
  1285. return this.hV
  1286. }, 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))
  1287. }, tt.lang.extend(et.asn1.DERBitString, et.asn1.ASN1Object), et.asn1.DEROctetString = function (t) {
  1288. if (void 0 !== t && void 0 !== t.obj) {
  1289. var e = et.asn1.ASN1Util.newObject(t.obj);
  1290. t.hex = e.getEncodedHex()
  1291. }
  1292. et.asn1.DEROctetString.superclass.constructor.call(this, t), this.hT = "04"
  1293. }, tt.lang.extend(et.asn1.DEROctetString, et.asn1.DERAbstractString), et.asn1.DERNull = function () {
  1294. et.asn1.DERNull.superclass.constructor.call(this), this.hT = "05", this.hTLV = "0500"
  1295. }, tt.lang.extend(et.asn1.DERNull, et.asn1.ASN1Object), et.asn1.DERObjectIdentifier = function (t) {
  1296. var h = function (t) {
  1297. var e = t.toString(16);
  1298. return 1 == e.length && (e = "0" + e), e
  1299. }, s = function (t) {
  1300. var e = "", i = new O(t, 10).toString(2), r = 7 - i.length % 7;
  1301. 7 == r && (r = 0);
  1302. for (var n = "", s = 0; s < r; s++) n += "0";
  1303. i = n + i;
  1304. for (s = 0; s < i.length - 1; s += 7) {
  1305. var o = i.substr(s, 7);
  1306. s != i.length - 7 && (o = "1" + o), e += h(parseInt(o, 2))
  1307. }
  1308. return e
  1309. };
  1310. et.asn1.DERObjectIdentifier.superclass.constructor.call(this), this.hT = "06", this.setValueHex = function (t) {
  1311. this.hTLV = null, this.isModified = !0, this.s = null, this.hV = t
  1312. }, this.setValueOidString = function (t) {
  1313. if (!t.match(/^[0-9.]+$/)) throw"malformed oid string: " + t;
  1314. var e = "", i = t.split("."), r = 40 * parseInt(i[0]) + parseInt(i[1]);
  1315. e += h(r), i.splice(0, 2);
  1316. for (var n = 0; n < i.length; n++) e += s(i[n]);
  1317. this.hTLV = null, this.isModified = !0, this.s = null, this.hV = e
  1318. }, this.setValueName = function (t) {
  1319. var e = et.asn1.x509.OID.name2oid(t);
  1320. if ("" === e) throw"DERObjectIdentifier oidName undefined: " + t;
  1321. this.setValueOidString(e)
  1322. }, this.getFreshValueHex = function () {
  1323. return this.hV
  1324. }, 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))
  1325. }, tt.lang.extend(et.asn1.DERObjectIdentifier, et.asn1.ASN1Object), et.asn1.DEREnumerated = function (t) {
  1326. et.asn1.DEREnumerated.superclass.constructor.call(this), this.hT = "0a", this.setByBigInteger = function (t) {
  1327. this.hTLV = null, this.isModified = !0, this.hV = et.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)
  1328. }, this.setByInteger = function (t) {
  1329. var e = new O(String(t), 10);
  1330. this.setByBigInteger(e)
  1331. }, this.setValueHex = function (t) {
  1332. this.hV = t
  1333. }, this.getFreshValueHex = function () {
  1334. return this.hV
  1335. }, 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))
  1336. }, tt.lang.extend(et.asn1.DEREnumerated, et.asn1.ASN1Object), et.asn1.DERUTF8String = function (t) {
  1337. et.asn1.DERUTF8String.superclass.constructor.call(this, t), this.hT = "0c"
  1338. }, tt.lang.extend(et.asn1.DERUTF8String, et.asn1.DERAbstractString), et.asn1.DERNumericString = function (t) {
  1339. et.asn1.DERNumericString.superclass.constructor.call(this, t), this.hT = "12"
  1340. }, tt.lang.extend(et.asn1.DERNumericString, et.asn1.DERAbstractString), et.asn1.DERPrintableString = function (t) {
  1341. et.asn1.DERPrintableString.superclass.constructor.call(this, t), this.hT = "13"
  1342. }, tt.lang.extend(et.asn1.DERPrintableString, et.asn1.DERAbstractString), et.asn1.DERTeletexString = function (t) {
  1343. et.asn1.DERTeletexString.superclass.constructor.call(this, t), this.hT = "14"
  1344. }, tt.lang.extend(et.asn1.DERTeletexString, et.asn1.DERAbstractString), et.asn1.DERIA5String = function (t) {
  1345. et.asn1.DERIA5String.superclass.constructor.call(this, t), this.hT = "16"
  1346. }, tt.lang.extend(et.asn1.DERIA5String, et.asn1.DERAbstractString), et.asn1.DERUTCTime = function (t) {
  1347. et.asn1.DERUTCTime.superclass.constructor.call(this, t), this.hT = "17", this.setByDate = function (t) {
  1348. this.hTLV = null, this.isModified = !0, this.date = t, this.s = this.formatDate(this.date, "utc"), this.hV = stohex(this.s)
  1349. }, this.getFreshValueHex = function () {
  1350. 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
  1351. }, 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))
  1352. }, tt.lang.extend(et.asn1.DERUTCTime, et.asn1.DERAbstractTime), et.asn1.DERGeneralizedTime = function (t) {
  1353. et.asn1.DERGeneralizedTime.superclass.constructor.call(this, t), this.hT = "18", this.withMillis = !1, this.setByDate = function (t) {
  1354. this.hTLV = null, this.isModified = !0, this.date = t, this.s = this.formatDate(this.date, "gen", this.withMillis), this.hV = stohex(this.s)
  1355. }, this.getFreshValueHex = function () {
  1356. 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
  1357. }, 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))
  1358. }, tt.lang.extend(et.asn1.DERGeneralizedTime, et.asn1.DERAbstractTime), et.asn1.DERSequence = function (t) {
  1359. et.asn1.DERSequence.superclass.constructor.call(this, t), this.hT = "30", this.getFreshValueHex = function () {
  1360. for (var t = "", e = 0; e < this.asn1Array.length; e++) {
  1361. t += this.asn1Array[e].getEncodedHex()
  1362. }
  1363. return this.hV = t, this.hV
  1364. }
  1365. }, tt.lang.extend(et.asn1.DERSequence, et.asn1.DERAbstractStructured), et.asn1.DERSet = function (t) {
  1366. et.asn1.DERSet.superclass.constructor.call(this, t), this.hT = "31", this.sortFlag = !0, this.getFreshValueHex = function () {
  1367. for (var t = new Array, e = 0; e < this.asn1Array.length; e++) {
  1368. var i = this.asn1Array[e];
  1369. t.push(i.getEncodedHex())
  1370. }
  1371. return 1 == this.sortFlag && t.sort(), this.hV = t.join(""), this.hV
  1372. }, void 0 !== t && void 0 !== t.sortflag && 0 == t.sortflag && (this.sortFlag = !1)
  1373. }, tt.lang.extend(et.asn1.DERSet, et.asn1.DERAbstractStructured), et.asn1.DERTaggedObject = function (t) {
  1374. et.asn1.DERTaggedObject.superclass.constructor.call(this), this.hT = "a0", this.hV = "", this.isExplicit = !0, this.asn1Object = null, this.setASN1Object = function (t, e, i) {
  1375. 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)
  1376. }, this.getFreshValueHex = function () {
  1377. return this.hV
  1378. }, 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)))
  1379. }, tt.lang.extend(et.asn1.DERTaggedObject, et.asn1.ASN1Object);
  1380. var it = function (i) {
  1381. function r(t) {
  1382. var e = i.call(this) || this;
  1383. return t && ("string" == typeof t ? e.parseKey(t) : (r.hasPrivateKeyProperty(t) || r.hasPublicKeyProperty(t)) && e.parsePropertiesFrom(t)), e
  1384. }
  1385. return function (t, e) {
  1386. function i() {
  1387. this.constructor = t
  1388. }
  1389. p(t, e), t.prototype = null === e ? Object.create(e) : (i.prototype = e.prototype, new i)
  1390. }(r, i), r.prototype.parseKey = function (t) {
  1391. try {
  1392. var e = 0, i = 0, r = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(t) ? d(t) : v.unarmor(t),
  1393. n = x.decode(r);
  1394. if (3 === n.sub.length && (n = n.sub[2].sub[0]), 9 === n.sub.length) {
  1395. e = n.sub[1].getHexStringValue(), this.n = q(e, 16), i = n.sub[2].getHexStringValue(), this.e = parseInt(i, 16);
  1396. var s = n.sub[3].getHexStringValue();
  1397. this.d = q(s, 16);
  1398. var o = n.sub[4].getHexStringValue();
  1399. this.p = q(o, 16);
  1400. var h = n.sub[5].getHexStringValue();
  1401. this.q = q(h, 16);
  1402. var a = n.sub[6].getHexStringValue();
  1403. this.dmp1 = q(a, 16);
  1404. var u = n.sub[7].getHexStringValue();
  1405. this.dmq1 = q(u, 16);
  1406. var c = n.sub[8].getHexStringValue();
  1407. this.coeff = q(c, 16)
  1408. } else {
  1409. if (2 !== n.sub.length) return !1;
  1410. var f = n.sub[1].sub[0];
  1411. e = f.sub[0].getHexStringValue(), this.n = q(e, 16), i = f.sub[1].getHexStringValue(), this.e = parseInt(i, 16)
  1412. }
  1413. return !0
  1414. } catch (t) {
  1415. return !1
  1416. }
  1417. }, r.prototype.getPrivateBaseKey = function () {
  1418. var t = {array: [new et.asn1.DERInteger({int: 0}), new et.asn1.DERInteger({bigint: this.n}), new et.asn1.DERInteger({int: this.e}), new et.asn1.DERInteger({bigint: this.d}), new et.asn1.DERInteger({bigint: this.p}), new et.asn1.DERInteger({bigint: this.q}), new et.asn1.DERInteger({bigint: this.dmp1}), new et.asn1.DERInteger({bigint: this.dmq1}), new et.asn1.DERInteger({bigint: this.coeff})]};
  1419. return new et.asn1.DERSequence(t).getEncodedHex()
  1420. }, r.prototype.getPrivateBaseKeyB64 = function () {
  1421. return c(this.getPrivateBaseKey())
  1422. }, r.prototype.getPublicBaseKey = function () {
  1423. var t = new et.asn1.DERSequence({array: [new et.asn1.DERObjectIdentifier({oid: "1.2.840.113549.1.1.1"}), new et.asn1.DERNull]}),
  1424. e = new et.asn1.DERSequence({array: [new et.asn1.DERInteger({bigint: this.n}), new et.asn1.DERInteger({int: this.e})]}),
  1425. i = new et.asn1.DERBitString({hex: "00" + e.getEncodedHex()});
  1426. return new et.asn1.DERSequence({array: [t, i]}).getEncodedHex()
  1427. }, r.prototype.getPublicBaseKeyB64 = function () {
  1428. return c(this.getPublicBaseKey())
  1429. }, r.wordwrap = function (t, e) {
  1430. if (!t) return t;
  1431. var i = "(.{1," + (e = e || 64) + "})( +|$\n?)|(.{1," + e + "})";
  1432. return t.match(RegExp(i, "g")).join("\n")
  1433. }, r.prototype.getPrivateKey = function () {
  1434. var t = "-----BEGIN RSA PRIVATE KEY-----\n";
  1435. return t += r.wordwrap(this.getPrivateBaseKeyB64()) + "\n", t += "-----END RSA PRIVATE KEY-----"
  1436. }, r.prototype.getPublicKey = function () {
  1437. var t = "-----BEGIN PUBLIC KEY-----\n";
  1438. return t += r.wordwrap(this.getPublicBaseKeyB64()) + "\n", t += "-----END PUBLIC KEY-----"
  1439. }, r.hasPublicKeyProperty = function (t) {
  1440. return (t = t || {}).hasOwnProperty("n") && t.hasOwnProperty("e")
  1441. }, r.hasPrivateKeyProperty = function (t) {
  1442. 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")
  1443. }, r.prototype.parsePropertiesFrom = function (t) {
  1444. 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)
  1445. }, r
  1446. }(Q), rt = function () {
  1447. function t(t) {
  1448. t = t || {}, this.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
  1449. }
  1450. return t.prototype.setKey = function (t) {
  1451. this.log && this.key && console.warn("A key was already set, overriding existing."), this.key = new it(t)
  1452. }, t.prototype.setPrivateKey = function (t) {
  1453. this.setKey(t)
  1454. }, t.prototype.setPublicKey = function (t) {
  1455. this.setKey(t)
  1456. }, t.prototype.decrypt = function (t) {
  1457. try {
  1458. return this.getKey().decrypt(f(t))
  1459. } catch (t) {
  1460. return !1
  1461. }
  1462. }, t.prototype.encrypt = function (t) {
  1463. try {
  1464. return c(this.getKey().encrypt(t))
  1465. } catch (t) {
  1466. return !1
  1467. }
  1468. }, t.prototype.sign = function (t, e, i) {
  1469. try {
  1470. return c(this.getKey().sign(t, e, i))
  1471. } catch (t) {
  1472. return !1
  1473. }
  1474. }, t.prototype.verify = function (t, e, i) {
  1475. try {
  1476. return this.getKey().verify(t, f(e), i)
  1477. } catch (t) {
  1478. return !1
  1479. }
  1480. }, t.prototype.getKey = function (t) {
  1481. if (!this.key) {
  1482. if (this.key = new it, t && "[object Function]" === {}.toString.call(t)) return void this.key.generateAsync(this.default_key_size, this.default_public_exponent, t);
  1483. this.key.generate(this.default_key_size, this.default_public_exponent)
  1484. }
  1485. return this.key
  1486. }, t.prototype.getPrivateKey = function () {
  1487. return this.getKey().getPrivateKey()
  1488. }, t.prototype.getPrivateKeyB64 = function () {
  1489. return this.getKey().getPrivateBaseKeyB64()
  1490. }, t.prototype.getPublicKey = function () {
  1491. return this.getKey().getPublicKey()
  1492. }, t.prototype.getPublicKeyB64 = function () {
  1493. return this.getKey().getPublicBaseKeyB64()
  1494. }, t.version = "3.0.0-rc.1", t
  1495. }();
  1496. window.JSEncrypt = rt, t.JSEncrypt = rt, t.default = rt, Object.defineProperty(t, "__esModule", {value: !0})
  1497. });
  1498. eval(function (p, a, c, k, e, d) {
  1499. e = function (c) {
  1500. return (c < a ? "" : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36))
  1501. };
  1502. if (!''.replace(/^/, String)) {
  1503. while (c--) d[e(c)] = k[c] || e(c);
  1504. k = [function (e) {
  1505. return d[e]
  1506. }];
  1507. e = function () {
  1508. return '\\w+'
  1509. };
  1510. c = 1;
  1511. }
  1512. ;
  1513. while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]);
  1514. return p;
  1515. }('2 7={1:8 1(3){2 0=6 4();0.5("d/e/f+c/9+a");b 0.0(3)}};', 16, 16, 'encrypt|encode|var|data|JSEncrypt|setPublicKey|new|lli|function|cj73vHt7|BnJ7jbUCO6VQoo65lG8jZk81ZTU3PkQofk7jFFALviQ3wIDAQAB|return|YGtyEBApNDUl1zoP|MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDeKTRsDHw5XXf4eh5XkuBIww0Kx|6rbvtUhxw1uxkvG|rMiLvB7jvt9SuskwDrnZseT4fsdvCwykzbqV1UDbZvRufriCGwQGjezH'.split('|'), 0, {}))
  1516. // lli.encode("")