encode.js 87 KB

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