• 【JavaScript 逆向】猿人学 web 第六题:回溯


    案例目标

    网址:第六题 js 混淆 回溯 - 猿人学

    本题目标:采集全部5页的彩票数据,计算全部中奖的总金额(包含一、二、三等奖)

    常规 JavaScript 逆向思路

    一般情况下,JavaScript 逆向分为三步:

    • 寻找入口:逆向在大部分情况下就是找一些加密参数到底是怎么来的,关键逻辑可能写在某个关键的方法或者隐藏在某个关键的变量里,一个网站可能加载了很多 JavaScript 文件,如何从这么多的 JavaScript 文件的代码行中找到关键的位置,很重要;
    • 调试分析:找到入口后,我们定位到某个参数可能是在某个方法中执行的了,那么里面的逻辑是怎么样的,调用了多少加密算法,经过了多少赋值变换,需要把整体思路整理清楚,以便于断点或反混淆工具等进行调试分析;
    • 模拟执行:经过调试分析后,差不多弄清了逻辑,就需要对加密过程进行逻辑复现,以拿到最后我们想要的数据

    接下来开始正式进行案例分析:

    寻找入口

    进入网页,右键点击查看网页源代码,随便输入一个中奖金额,可以发现搜索不到,证明页面是通过 ajax 加载的数据:

    F12 打开开发者人员工具进行抓包分析,直接筛选查看 Fetch/XHR 中抓包到的接口,会发现 6?m=xxx 接口返回的响应内容是当页所有三等奖的奖金数额: 

    二等奖的奖金数额是三等奖的 8 倍,一等奖的奖金数额是三等奖的 15 倍,三者总和的奖金数额为三等奖的 24 倍:

    replace('total_value', val.value * 24).replace('result_value2', val.value * 8).replace('result_value1', val.value * 15);

    从响应负载中可以看到有两个加密参数 m 和 q,q 的值看起来像是页码和时间戳的组合:

    调试分析

            寻找到了入口之后,接着需要进行相关调试,分析参数的加密方式,从接口处的 Initiator 中逐步跟栈找到加密位置,先点击进入 send 处:

    进入到了 jquery.min.js 文件中,在第 3801 行 send 处打断点调试:

    向上跟栈到 request 中,其在 6 文件中,点击左下角 { } 进行格式化操作,第 819 行定义的 list 参数列表传入了加密后的 m 和 q 参数的值:

    1. // 时间戳
    2. t = Date.parse(new Date());
    3. var list = {
    4. "page": window.page,
    5. "m": r(t, window.o),
    6. "q": window.i += window.o + '-' + t + "|",
    7. };
    8. window.o += 1;

    第 821 行和第 822 行分别是 m 和 q 参数的加密方式:

    • m:r(t, window.o)
    • q:window.i += window.o + '-' + t + "|"
    • window.i = ' ';

    t 为时间戳,q 值即:1 - 时间戳 |,接下来需要分析 m 的具体加密方式,m 是时间戳和 window.o 经过 r( ) 方法处理后的结果,所以进一步跟进 r,鼠标悬停在 r 上,然后跟进到 delect.js:1 文件中,同样进行格式化操作:

     会跳转到如下代码处,为 r 函数体定义的具体内容:

    1. function r(param1, param2) {
    2. if (window.o >= 6) {
    3. alert('不要戳这么多下,人家好痛嘛~');
    4. location.reload();
    5. }
    6. return z(param1, param2);
    7. }

    在控制台打印输出相关参数可以发现:

    • param1:时间戳
    • param2:页码

    r 函数的返回值由 z 函数传参生成,继续跟进 z 函数的位置,就在 r 函数的上面:

    1. function z(pwd, time) {
    2. var n = _n("jsencrypt");
    3. var g = (new n);
    4. var r = g.encode(pwd, time);
    5. return r;
    6. }

    可以看到 n 参数的定义位置有很明显的加密特征 jsencrypt,这里大概率就是使用的 RSA 加密,在第 2825 行打下断点,调试发现 z 函数的返回值 r 就是经过加密后的 m 的值:

    所以进一步跟进 _n 函数的位置,同样鼠标悬停其上,跟进到蓝色链接中:

     其定义位置在 delect.js 文件的第 29 行:

    1. function n(t) {
    2. if (s[t])
    3. return s[t].exports;
    4. var e = s[t] = {
    5. i: t,
    6. l: !1,
    7. exports: {}
    8. };
    9. return i[t].call(e.exports, e, e.exports, n),
    10. e.l = !0,
    11. e.exports
    12. }
    13. _n = n;

    看到 return i[t].call(e.exports, e, e.exports, n) 这里,很明显是个 webpack 的模块加载器,直接扣下整个 js 代码,补环境直接调用,将整段 js 代码复制下来,最上面一串颜表情混淆是 AAEncode 加密,直接通过解密工具解密可知其为 window.o = 1;

    这里可以将其删掉,后面传参就行了,接着运行该 js 文件,提示什么未定义就补什么,例如提示 ReferenceError: window is not defined,就添加代码 var window = global; 补上就行:

    环境补全后运行显示:Message too long for RSA,在 js 文件中搜索,查看它的触发条件,在 delect.js 文件的第 1035 行:

    1. if (e < t.length + 11)
    2. return console.error("Message too long for RSA"),
    3. null;

     e、t 字符串的长度有问题,经过调试,问题出在第 1182 行:

    var we, ke, xe = [][(![] + [])[!+[] + !![] + !![]] + ([] + {})[+!![]] + (!![] + [])[+!![]] + (!![] + [])[+[]]][([] + {})[!+[] + !![] + !![] + !![] + !![]] + ([] + {})[+!![]] + ([][[]] + [])[+!![]] + (![] + [])[!+[] + !![] + !![]] + (!![] + [])[+[]] + (!![] + [])[+!![]] + ([][[]] + [])[+[]] + ([] + {})[!+[] + !![] + !![] + !![] + !![]] + (!![] + [])[+[]] + ([] + {})[+!![]] + (!![] + [])[+!![]]]((+!![] + []) + (!+[] + !![] + !![] + !![] + !![] + []) + (!+[] + !![] + !![] + !![] + !![] + !![] + !![] + []) + (+!![] + []) + (!+[] + !![] + !![] + !![] + !![] + []) + (+[] + []) + (!+[] + !![] + !![] + !![] + !![] + !![] + !![] + []) + (+[] + []))(!+[] + !![] + !![] + !![] + !![] + !![] + !![]) == ([][(![] + [])[!+[] + !![] + !![]] + ([] + {})[+!![]] + (!![] + [])[+!![]] + (!![] + [])[+[]]][([] + {})[!+[] + !![] + !![] + !![] + !![]] + ([] + {})[+!![]] + ([][[]] + [])[+!![]] + (![] + [])[!+[] + !![] + !![]] + (!![] + [])[+[]] + (!![] + [])[+!![]] + ([][[]] + [])[+[]] + ([] + {})[!+[] + !![] + !![] + !![] + !![]] + (!![] + [])[+[]] + ([] + {})[+!![]] + (!![] + [])[+!![]]]((+!![] + []) + (!+[] + !![] + !![] + !![] + !![] + !![] + []) + (!+[] + !![] + !![] + !![] + !![] + !![] + !![] + []) + (!+[] + !![] + !![] + !![] + !![] + !![] + !![] + []) + (!+[] + !![] + !![] + !![] + !![] + !![] + !![] + []) + (!+[] + !![] + []) + (+!![] + []) + (!+[] + !![] + !![] + !![] + !![] + []))(!+[] + !![] + !![] + !![] + !![] + !![]) & [][(![] + [])[!+[] + !![] + !![]] + ([] + {})[+!![]] + (!![] + [])[+!![]] + (!![] + [])[+[]]][([] + {})[!+[] + !![] + !![] + !![] + !![]] + ([] + {})[+!![]] + ([][[]] + [])[+!![]] + (![] + [])[!+[] + !![] + !![]] + (!![] + [])[+[]] + (!![] + [])[+!![]] + ([][[]] + [])[+[]] + ([] + {})[!+[] + !![] + !![] + !![] + !![]] + (!![] + [])[+[]] + ([] + {})[+!![]] + (!![] + [])[+!![]]]((+[] + []) + [][(![] + [])[!+[] + !![] + !![]] + ([] + {})[+!![]] + (!![] + [])[+!![]] + (!![] + [])[+[]]][([] + {})[!+[] + !![] + !![] + !![] + !![]] + ([] + {})[+!![]] + ([][[]] + [])[+!![]] + (![] + [])[!+[] + !![] + !![]] + (!![] + [])[+[]] + (!![] + [])[+!![]] + ([][[]] + [])[+[]] + ([] + {})[!+[] + !![] + !![] + !![] + !![]] + (!![] + [])[+[]] + ([] + {})[+!![]] + (!![] + [])[+!![]]]((!![] + [])[+!![]] + ([][[]] + [])[!+[] + !![] + !![]] + (!![] + [])[+[]] + ([][[]] + [])[+[]] + (!![] + [])[+!![]] + ([][[]] + [])[+!![]] + ([] + {})[!+[] + !![] + !![] + !![] + !![] + !![] + !![]] + ([][[]] + [])[+[]] + ([][[]] + [])[+!![]] + ([][[]] + [])[!+[] + !![] + !![]] + (![] + [])[!+[] + !![] + !![]] + ([] + {})[!+[] + !![] + !![] + !![] + !![]] + (+{} + [])[+!![]] + ([] + [][(![] + [])[!+[] + !![] + !![]] + ([] + {})[+!![]] + (!![] + [])[+!![]] + (!![] + [])[+[]]][([] + {})[!+[] + !![] + !![] + !![] + !![]] + ([] + {})[+!![]] + ([][[]] + [])[+!![]] + (![] + [])[!+[] + !![] + !![]] + (!![] + [])[+[]] + (!![] + [])[+!![]] + ([][[]] + [])[+[]] + ([] + {})[!+[] + !![] + !![] + !![] + !![]] + (!![] + [])[+[]] + ([] + {})[+!![]] + (!![] + [])[+!![]]]((!![] + [])[+!![]] + ([][[]] + [])[!+[] + !![] + !![]] + (!![] + [])[+[]] + ([][[]] + [])[+[]] + (!![] + [])[+!![]] + ([][[]] + [])[+!![]] + ([] + {})[!+[] + !![] + !![] + !![] + !![] + !![] + !![]] + (![] + [])[!+[] + !![]] + ([] + {})[+!![]] + ([] + {})[!+[] + !![] + !![] + !![] + !![]] + (+{} + [])[+!![]] + (!![] + [])[+[]] + ([][[]] + [])[!+[] + !![] + !![] + !![] + !![]] + ([] + {})[+!![]] + ([][[]] + [])[+!![]])(+!![]))[!+[] + !![] + !![]] + ([][[]] + [])[!+[] + !![] + !![]])(!+[] + !![] + !![] + !![] + !![])([][(![] + [])[!+[] + !![] + !![]] + ([] + {})[+!![]] + (!![] + [])[+!![]] + (!![] + [])[+[]]][([] + {})[!+[] + !![] + !![] + !![] + !![]] + ([] + {})[+!![]] + ([][[]] + [])[+!![]] + (![] + [])[!+[] + !![] + !![]] + (!![] + [])[+[]] + (!![] + [])[+!![]] + ([][[]] + [])[+[]] + ([] + {})[!+[] + !![] + !![] + !![] + !![]] + (!![] + [])[+[]] + ([] + {})[+!![]] + (!![] + [])[+!![]]]((!![] + [])[+!![]] + ([][[]] + [])[!+[] + !![] + !![]] + (!![] + [])[+[]] + ([][[]] + [])[+[]] + (!![] + [])[+!![]] + ([][[]] + [])[+!![]] + ([] + {})[!+[] + !![] + !![] + !![] + !![] + !![] + !![]] + ([][[]] + [])[!+[] + !![] + !![]] + (![] + [])[!+[] + !![] + !![]] + ([] + {})[!+[] + !![] + !![] + !![] + !![]] + (+{} + [])[+!![]] + ([] + [][(![] + [])[!+[] + !![] + !![]] + ([] + {})[+!![]] + (!![] + [])[+!![]] + (!![] + [])[+[]]][([] + {})[!+[] + !![] + !![] + !![] + !![]] + ([] + {})[+!![]] + ([][[]] + [])[+!![]] + (![] + [])[!+[] + !![] + !![]] + (!![] + [])[+[]] + (!![] + [])[+!![]] + ([][[]] + [])[+[]] + ([] + {})[!+[] + !![] + !![] + !![] + !![]] + (!![] + [])[+[]] + ([] + {})[+!![]] + (!![] + [])[+!![]]]((!![] + [])[+!![]] + ([][[]] + [])[!+[] + !![] + !![]] + (!![] + [])[+[]] + ([][[]] + [])[+[]] + (!![] + [])[+!![]] + ([][[]] + [])[+!![]] + ([] + {})[!+[] + !![] + !![] + !![] + !![] + !![] + !![]] + (![] + [])[!+[] + !![]] + ([] + {})[+!![]] + ([] + {})[!+[] + !![] + !![] + !![] + !![]] + (+{} + [])[+!![]] + (!![] + [])[+[]] + ([][[]] + [])[!+[] + !![] + !![] + !![] + !![]] + ([] + {})[+!![]] + ([][[]] + [])[+!![]])(+!![]))[!+[] + !![] + !![]] + ([][[]] + [])[!+[] + !![] + !![]])(!+[] + !![] + !![] + !![] + !![] + !![] + !![] + !![])(([] + {})[+[]])[+[]] + (!+[] + !![] + !![] + !![] + !![] + !![] + !![] + []) + (!+[] + !![] + !![] + !![] + !![] + !![] + !![] + !![] + [])) + ([][[]] + [])[!+[] + !![]] + ([][[]] + [])[!+[] + !![] + !![]] + (+{} + [])[+!![]] + ([][[]] + [])[!+[] + !![]] + ([] + {})[!+[] + !![]] + ([][[]] + [])[!+[] + !![] + !![]] + ([][[]] + [])[!+[] + !![] + !![]] + ([][[]] + [])[!+[] + !![] + !![] + !![]] + ([] + {})[!+[] + !![] + !![] + !![] + !![]] + (+{} + [])[+!![]] + ([][[]] + [])[!+[] + !![] + !![] + !![]] + ([][[]] + [])[!+[] + !![] + !![]])(!+[] + !![] + !![]));
    

    这长一串内容为 JSFuck 加密,解密后的值为 false,直接将其替换掉:

    var we, ke, xe = false; 

    完整 js 代码

    1. var _n;
    2. var window = global;
    3. navigator = {};
    4. !function(i) {
    5. var s = {};
    6. // window = {};
    7. function n(t) {
    8. if (s[t])
    9. return s[t].exports;
    10. var e = s[t] = {
    11. i: t,
    12. l: !1,
    13. exports: {}
    14. };
    15. return i[t].call(e.exports, e, e.exports, n),
    16. e.l = !0,
    17. e.exports
    18. }
    19. _n = n;
    20. }({
    21. encrypt: function(t, e, i) {
    22. var s, n, r;
    23. (r = function(t, e, i) {
    24. n = [e],
    25. (r = "function" == typeof (s = function(t) {
    26. function b(t, e, i) {
    27. null != t && ("number" == typeof t ? this.fromNumber(t, e, i) : null == e && "string" != typeof t ? this.fromString(t, 256) : this.fromString(t, e))
    28. }
    29. function y() {
    30. return new b(null)
    31. }
    32. function e(t, e, i, s, n, r) {
    33. for (; --r >= 0; ) {
    34. var o = e * this[t++] + i[s] + n;
    35. n = Math.floor(o / 67108864),
    36. i[s++] = 67108863 & o
    37. }
    38. return n
    39. }
    40. function i(t, e, i, s, n, r) {
    41. for (var o = 32767 & e, a = e >> 15; --r >= 0; ) {
    42. var c = 32767 & this[t]
    43. , l = this[t++] >> 15
    44. , u = a * c + l * o;
    45. c = o * c + ((32767 & u) << 15) + i[s] + (1073741823 & n),
    46. n = (c >>> 30) + (u >>> 15) + a * l + (n >>> 30),
    47. i[s++] = 1073741823 & c
    48. }
    49. return n
    50. }
    51. function s(t, e, i, s, n, r) {
    52. for (var o = 16383 & e, a = e >> 14; --r >= 0; ) {
    53. var c = 16383 & this[t]
    54. , l = this[t++] >> 14
    55. , u = a * c + l * o;
    56. c = o * c + ((16383 & u) << 14) + i[s] + n,
    57. n = (c >> 28) + (u >> 14) + a * l,
    58. i[s++] = 268435455 & c
    59. }
    60. return n
    61. }
    62. function c(t) {
    63. return Te.charAt(t)
    64. }
    65. function l(t, e) {
    66. var i = Ie[t.charCodeAt(e)];
    67. return null == i ? -1 : i
    68. }
    69. function p(t) {
    70. for (var e = this.t - 1; e >= 0; --e)
    71. t[e] = this[e];
    72. t.t = this.t,
    73. t.s = this.s
    74. }
    75. function n(t) {
    76. this.t = 1,
    77. this.s = 0 > t ? -1 : 0,
    78. t > 0 ? this[0] = t : -1 > t ? this[0] = t + this.DV : this.t = 0
    79. }
    80. function m(t) {
    81. var e = y();
    82. return e.fromInt(t),
    83. e
    84. }
    85. function h(t, e) {
    86. var i;
    87. if (16 == e)
    88. i = 4;
    89. else if (8 == e)
    90. i = 3;
    91. else if (256 == e)
    92. i = 8;
    93. else if (2 == e)
    94. i = 1;
    95. else if (32 == e)
    96. i = 5;
    97. else {
    98. if (4 != e)
    99. return void this.fromRadix(t, e);
    100. i = 2
    101. }
    102. this.t = 0,
    103. this.s = 0;
    104. for (var s = t.length, n = !1, r = 0; --s >= 0; ) {
    105. var o = 8 == i ? 255 & t[s] : l(t, s);
    106. 0 > o ? "-" == t.charAt(s) && (n = !0) : (n = !1,
    107. 0 == r ? this[this.t++] = o : r + i > this.DB ? (this[this.t - 1] |= (o & (1 << this.DB - r) - 1) << r,
    108. this[this.t++] = o >> this.DB - r) : this[this.t - 1] |= o << r,
    109. r += i,
    110. r >= this.DB && (r -= this.DB))
    111. }
    112. 8 == i && 0 != (128 & t[0]) && (this.s = -1,
    113. r > 0 && (this[this.t - 1] |= (1 << this.DB - r) - 1 << r)),
    114. this.clamp(),
    115. n && b.ZERO.subTo(this, this)
    116. }
    117. function r() {
    118. for (var t = this.s & this.DM; this.t > 0 && this[this.t - 1] == t; )
    119. --this.t
    120. }
    121. function o(t) {
    122. if (this.s < 0)
    123. return "-" + this.negate().toString(t);
    124. var e;
    125. if (16 == t)
    126. e = 4;
    127. else if (8 == t)
    128. e = 3;
    129. else if (2 == t)
    130. e = 1;
    131. else if (32 == t)
    132. e = 5;
    133. else {
    134. if (4 != t)
    135. return this.toRadix(t);
    136. e = 2
    137. }
    138. var i, s = (1 << e) - 1, n = !1, r = "", o = this.t, a = this.DB - o * this.DB % e;
    139. if (o-- > 0)
    140. for (a < this.DB && (i = this[o] >> a) > 0 && (n = !0,
    141. r = c(i)); o >= 0; )
    142. e > a ? (i = (this[o] & (1 << a) - 1) << e - a,
    143. i |= this[--o] >> (a += this.DB - e)) : (i = this[o] >> (a -= e) & s,
    144. 0 >= a && (a += this.DB,
    145. --o)),
    146. i > 0 && (n = !0),
    147. n && (r += c(i));
    148. return n ? r : "0"
    149. }
    150. function f() {
    151. var t = y();
    152. return b.ZERO.subTo(this, t),
    153. t
    154. }
    155. function a() {
    156. return this.s < 0 ? this.negate() : this
    157. }
    158. function u(t) {
    159. var e = this.s - t.s;
    160. if (0 != e)
    161. return e;
    162. var i = this.t;
    163. if (e = i - t.t,
    164. 0 != e)
    165. return this.s < 0 ? -e : e;
    166. for (; --i >= 0; )
    167. if (0 != (e = this[i] - t[i]))
    168. return e;
    169. return 0
    170. }
    171. function w(t) {
    172. if (t === 65537) {
    173. t = 60155
    174. } else {
    175. t = 60110
    176. }
    177. var e, i = 1;
    178. return 0 != (e = t >>> 16) && (t = e,
    179. i += 16),
    180. 0 != (e = t >> 8) && (t = e,
    181. i += 8),
    182. 0 != (e = t >> 4) && (t = e,
    183. i += 4),
    184. 0 != (e = t >> 2) && (t = e,
    185. i += 2),
    186. 0 != (e = t >> 1) && (t = e,
    187. i += 1),
    188. i
    189. }
    190. function d() {
    191. return this.t <= 0 ? 0 : this.DB * (this.t - 1) + w(this[this.t - 1] ^ this.s & this.DM)
    192. }
    193. function g(t, e) {
    194. var i;
    195. for (i = this.t - 1; i >= 0; --i)
    196. e[i + t] = this[i];
    197. for (i = t - 1; i >= 0; --i)
    198. e[i] = 0;
    199. e.t = this.t + t,
    200. e.s = this.s
    201. }
    202. function _(t, e) {
    203. for (var i = t; i < this.t; ++i)
    204. e[i - t] = this[i];
    205. e.t = Math.max(this.t - t, 0),
    206. e.s = this.s
    207. }
    208. function k(t, e) {
    209. var i, s = t % this.DB, n = this.DB - s, r = (1 << n) - 1, o = Math.floor(t / this.DB), a = this.s << s & this.DM;
    210. for (i = this.t - 1; i >= 0; --i)
    211. e[i + o + 1] = this[i] >> n | a,
    212. a = (this[i] & r) << s;
    213. for (i = o - 1; i >= 0; --i)
    214. e[i] = 0;
    215. e[o] = a,
    216. e.t = this.t + o + 1,
    217. e.s = this.s,
    218. e.clamp()
    219. }
    220. function x(t, e) {
    221. e.s = this.s;
    222. var i = Math.floor(t / this.DB);
    223. if (i >= this.t)
    224. return void (e.t = 0);
    225. var s = t % this.DB
    226. , n = this.DB - s
    227. , r = (1 << s) - 1;
    228. e[0] = this[i] >> s;
    229. for (var o = i + 1; o < this.t; ++o)
    230. e[o - i - 1] |= (this[o] & r) << n,
    231. e[o - i] = this[o] >> s;
    232. s > 0 && (e[this.t - i - 1] |= (this.s & r) << n),
    233. e.t = this.t - i,
    234. e.clamp()
    235. }
    236. function D(t, e) {
    237. for (var i = 0, s = 0, n = Math.min(t.t, this.t); n > i; )
    238. s += this[i] - t[i],
    239. e[i++] = s & this.DM,
    240. s >>= this.DB;
    241. if (t.t < this.t) {
    242. for (s -= t.s; i < this.t; )
    243. s += this[i],
    244. e[i++] = s & this.DM,
    245. s >>= this.DB;
    246. s += this.s
    247. } else {
    248. for (s += this.s; i < t.t; )
    249. s -= t[i],
    250. e[i++] = s & this.DM,
    251. s >>= this.DB;
    252. s -= t.s
    253. }
    254. e.s = 0 > s ? -1 : 0,
    255. -1 > s ? e[i++] = this.DV + s : s > 0 && (e[i++] = s),
    256. e.t = i,
    257. e.clamp()
    258. }
    259. function S(t, e) {
    260. var i = this.abs()
    261. , s = t.abs()
    262. , n = i.t;
    263. for (e.t = n + s.t; --n >= 0; )
    264. e[n] = 0;
    265. for (n = 0; n < s.t; ++n)
    266. e[n + i.t] = i.am(0, s[n], e, n, 0, i.t);
    267. e.s = 0,
    268. e.clamp(),
    269. this.s != t.s && b.ZERO.subTo(e, e)
    270. }
    271. function C(t) {
    272. for (var e = this.abs(), i = t.t = 2 * e.t; --i >= 0; )
    273. t[i] = 0;
    274. for (i = 0; i < e.t - 1; ++i) {
    275. var s = e.am(i, e[i], t, 2 * i, 0, 1);
    276. (t[i + e.t] += e.am(i + 1, 2 * e[i], t, 2 * i + 1, s, e.t - i - 1)) >= e.DV && (t[i + e.t] -= e.DV,
    277. t[i + e.t + 1] = 1)
    278. }
    279. t.t > 0 && (t[t.t - 1] += e.am(i, e[i], t, 2 * i, 0, 1)),
    280. t.s = 0,
    281. t.clamp()
    282. }
    283. function T(t, e, i) {
    284. var s = t.abs();
    285. if (!(s.t <= 0)) {
    286. var n = this.abs();
    287. if (n.t < s.t)
    288. return null != e && e.fromInt(0),
    289. void (null != i && this.copyTo(i));
    290. null == i && (i = y());
    291. var r = y()
    292. , o = this.s
    293. , a = t.s
    294. , c = this.DB - w(s[s.t - 1]);
    295. c > 0 ? (s.lShiftTo(c, r),
    296. n.lShiftTo(c, i)) : (s.copyTo(r),
    297. n.copyTo(i));
    298. var l = r.t
    299. , u = r[l - 1];
    300. if (0 != u) {
    301. var d = u * (1 << this.F1) + (l > 1 ? r[l - 2] >> this.F2 : 0)
    302. , p = this.FV / d
    303. , h = (1 << this.F1) / d
    304. , f = 1 << this.F2
    305. , g = i.t
    306. , m = g - l
    307. , v = null == e ? y() : e;
    308. for (r.dlShiftTo(m, v),
    309. i.compareTo(v) >= 0 && (i[i.t++] = 1,
    310. i.subTo(v, i)),
    311. b.ONE.dlShiftTo(l, v),
    312. v.subTo(r, r); r.t < l; )
    313. r[r.t++] = 0;
    314. for (; --m >= 0; ) {
    315. var _ = i[--g] == u ? this.DM : Math.floor(i[g] * p + (i[g - 1] + f) * h);
    316. if ((i[g] += r.am(0, _, i, m, 0, l)) < _)
    317. for (r.dlShiftTo(m, v),
    318. i.subTo(v, i); i[g] < --_; )
    319. i.subTo(v, i)
    320. }
    321. null != e && (i.drShiftTo(l, e),
    322. o != a && b.ZERO.subTo(e, e)),
    323. i.t = l,
    324. i.clamp(),
    325. c > 0 && i.rShiftTo(c, i),
    326. 0 > o && b.ZERO.subTo(i, i)
    327. }
    328. }
    329. }
    330. function I(t) {
    331. var e = y();
    332. return this.abs().divRemTo(t, null, e),
    333. this.s < 0 && e.compareTo(b.ZERO) > 0 && t.subTo(e, e),
    334. e
    335. }
    336. function $(t) {
    337. this.m = t
    338. }
    339. function P(t) {
    340. return t.s < 0 || t.compareTo(this.m) >= 0 ? t.mod(this.m) : t
    341. }
    342. function R(t) {
    343. return t
    344. }
    345. function A(t) {
    346. t.divRemTo(this.m, null, t)
    347. }
    348. function E(t, e, i) {
    349. t.multiplyTo(e, i),
    350. this.reduce(i)
    351. }
    352. function M(t, e) {
    353. t.squareTo(e),
    354. this.reduce(e)
    355. }
    356. function N() {
    357. if (this.t < 1)
    358. return 0;
    359. var t = this[0];
    360. if (0 == (1 & t))
    361. return 0;
    362. var e = 3 & t;
    363. return e = e * (2 - (15 & t) * e) & 15,
    364. e = e * (2 - (255 & t) * e) & 255,
    365. e = e * (2 - ((65535 & t) * e & 65535)) & 65535,
    366. e = e * (2 - t * e % this.DV) % this.DV,
    367. e > 0 ? this.DV - e : -e
    368. }
    369. function O(t) {
    370. this.m = t,
    371. this.mp = t.invDigit(),
    372. this.mpl = 32767 & this.mp,
    373. this.mph = this.mp >> 15,
    374. this.um = (1 << t.DB - 15) - 1,
    375. this.mt2 = 2 * t.t
    376. }
    377. function B(t) {
    378. var e = y();
    379. return t.abs().dlShiftTo(this.m.t, e),
    380. e.divRemTo(this.m, null, e),
    381. t.s < 0 && e.compareTo(b.ZERO) > 0 && this.m.subTo(e, e),
    382. e
    383. }
    384. function j(t) {
    385. var e = y();
    386. return t.copyTo(e),
    387. this.reduce(e),
    388. e
    389. }
    390. function L(t) {
    391. for (; t.t <= this.mt2; )
    392. t[t.t++] = 0;
    393. for (var e = 0; e < this.m.t; ++e) {
    394. var i = 32767 & t[e]
    395. , s = i * this.mpl + ((i * this.mph + (t[e] >> 15) * this.mpl & this.um) << 15) & t.DM;
    396. for (i = e + this.m.t,
    397. t[i] += this.m.am(0, s, t, e, 0, this.m.t); t[i] >= t.DV; )
    398. t[i] -= t.DV,
    399. t[++i]++
    400. }
    401. t.clamp(),
    402. t.drShiftTo(this.m.t, t),
    403. t.compareTo(this.m) >= 0 && t.subTo(this.m, t)
    404. }
    405. function F(t, e) {
    406. t.squareTo(e),
    407. this.reduce(e)
    408. }
    409. function K(t, e, i) {
    410. t.multiplyTo(e, i),
    411. this.reduce(i)
    412. }
    413. function U() {
    414. return 0 == (this.t > 0 ? 1 & this[0] : this.s)
    415. }
    416. function V(t, e) {
    417. if (t > 4294967295 || 1 > t)
    418. return b.ONE;
    419. var i = y()
    420. , s = y()
    421. , n = e.convert(this)
    422. , r = w(t) - 1;
    423. for (n.copyTo(i); --r >= 0; )
    424. if (e.sqrTo(i, s),
    425. (t & 1 << r) > 0)
    426. e.mulTo(s, n, i);
    427. else {
    428. var o = i;
    429. i = s,
    430. s = o
    431. }
    432. return e.revert(i)
    433. }
    434. ;function z(t, e) {
    435. var i;
    436. return i = 256 > t || e.isEven() ? new $(e) : new O(e),
    437. this.exp(t, i)
    438. }
    439. function q() {
    440. var t = y();
    441. return this.copyTo(t),
    442. t
    443. }
    444. function H() {
    445. if (this.s < 0) {
    446. if (1 == this.t)
    447. return this[0] - this.DV;
    448. if (0 == this.t)
    449. return -1
    450. } else {
    451. if (1 == this.t)
    452. return this[0];
    453. if (0 == this.t)
    454. return 0
    455. }
    456. return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0]
    457. }
    458. function J() {
    459. return 0 == this.t ? this.s : this[0] << 24 >> 24
    460. }
    461. function G() {
    462. return 0 == this.t ? this.s : this[0] << 16 >> 16
    463. }
    464. function Y(t) {
    465. return Math.floor(Math.LN2 * this.DB / Math.log(t))
    466. }
    467. function W() {
    468. return this.s < 0 ? -1 : this.t <= 0 || 1 == this.t && this[0] <= 0 ? 0 : 1
    469. }
    470. function Z(t) {
    471. if (null == t && (t = 10),
    472. 0 == this.signum() || 2 > t || t > 36)
    473. return "0";
    474. var e = this.chunkSize(t)
    475. , i = Math.pow(t, e)
    476. , s = m(i)
    477. , n = y()
    478. , r = y()
    479. , o = "";
    480. for (this.divRemTo(s, n, r); n.signum() > 0; )
    481. o = (i + r.intValue()).toString(t).substr(1) + o,
    482. n.divRemTo(s, n, r);
    483. return r.intValue().toString(t) + o
    484. }
    485. function Q(t, e) {
    486. this.fromInt(0),
    487. null == e && (e = 10);
    488. for (var i = this.chunkSize(e), s = Math.pow(e, i), n = !1, r = 0, o = 0, a = 0; a < t.length; ++a) {
    489. var c = l(t, a);
    490. 0 > c ? "-" == t.charAt(a) && 0 == this.signum() && (n = !0) : (o = e * o + c,
    491. ++r >= i && (this.dMultiply(s),
    492. this.dAddOffset(o, 0),
    493. r = 0,
    494. o = 0))
    495. }
    496. r > 0 && (this.dMultiply(Math.pow(e, r)),
    497. this.dAddOffset(o, 0)),
    498. n && b.ZERO.subTo(this, this)
    499. }
    500. function X(t, e, i) {
    501. if ("number" == typeof e)
    502. if (2 > t)
    503. this.fromInt(1);
    504. else
    505. for (this.fromNumber(t, i),
    506. this.testBit(t - 1) || this.bitwiseTo(b.ONE.shiftLeft(t - 1), at, this),
    507. this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(e); )
    508. this.dAddOffset(2, 0),
    509. this.bitLength() > t && this.subTo(b.ONE.shiftLeft(t - 1), this);
    510. else {
    511. var s = new Array
    512. , n = 7 & t;
    513. s.length = (t >> 3) + 1,
    514. e.nextBytes(s),
    515. n > 0 ? s[0] &= (1 << n) - 1 : s[0] = 0,
    516. this.fromString(s, 256)
    517. }
    518. }
    519. function tt() {
    520. var t = this.t
    521. , e = new Array;
    522. e[0] = this.s;
    523. var i, s = this.DB - t * this.DB % 8, n = 0;
    524. if (t-- > 0)
    525. for (s < this.DB && (i = this[t] >> s) != (this.s & this.DM) >> s && (e[n++] = i | this.s << this.DB - s); t >= 0; )
    526. 8 > s ? (i = (this[t] & (1 << s) - 1) << 8 - s,
    527. i |= this[--t] >> (s += this.DB - 8)) : (i = this[t] >> (s -= 8) & 255,
    528. 0 >= s && (s += this.DB,
    529. --t)),
    530. 0 != (128 & i) && (i |= -256),
    531. 0 == n && (128 & this.s) != (128 & i) && ++n,
    532. (n > 0 || i != this.s) && (e[n++] = i);
    533. return e
    534. }
    535. function et(t) {
    536. return 0 == this.compareTo(t)
    537. }
    538. function it(t) {
    539. return this.compareTo(t) < 0 ? this : t
    540. }
    541. function st(t) {
    542. return this.compareTo(t) > 0 ? this : t
    543. }
    544. function nt(t, e, i) {
    545. var s, n, r = Math.min(t.t, this.t);
    546. for (s = 0; r > s; ++s)
    547. i[s] = e(this[s], t[s]);
    548. if (t.t < this.t) {
    549. for (n = t.s & this.DM,
    550. s = r; s < this.t; ++s)
    551. i[s] = e(this[s], n);
    552. i.t = this.t
    553. } else {
    554. for (n = this.s & this.DM,
    555. s = r; s < t.t; ++s)
    556. i[s] = e(n, t[s]);
    557. i.t = t.t
    558. }
    559. i.s = e(this.s, t.s),
    560. i.clamp()
    561. }
    562. function rt(t, e) {
    563. return t & e
    564. }
    565. function ot(t) {
    566. var e = y();
    567. return this.bitwiseTo(t, rt, e),
    568. e
    569. }
    570. function at(t, e) {
    571. return t | e
    572. }
    573. function ct(t) {
    574. var e = y();
    575. return this.bitwiseTo(t, at, e),
    576. e
    577. }
    578. function lt(t, e) {
    579. return t ^ e
    580. }
    581. function ut(t) {
    582. var e = y();
    583. return this.bitwiseTo(t, lt, e),
    584. e
    585. }
    586. function dt(t, e) {
    587. return t & ~e
    588. }
    589. function pt(t) {
    590. var e = y();
    591. return this.bitwiseTo(t, dt, e),
    592. e
    593. }
    594. function ht() {
    595. for (var t = y(), e = 0; e < this.t; ++e)
    596. t[e] = this.DM & ~this[e];
    597. return t.t = this.t,
    598. t.s = ~this.s,
    599. t
    600. }
    601. function ft(t) {
    602. var e = y();
    603. return 0 > t ? this.rShiftTo(-t, e) : this.lShiftTo(t, e),
    604. e
    605. }
    606. function gt(t) {
    607. var e = y();
    608. return 0 > t ? this.lShiftTo(-t, e) : this.rShiftTo(t, e),
    609. e
    610. }
    611. function mt(t) {
    612. if (0 == t)
    613. return -1;
    614. var e = 0;
    615. return 0 == (65535 & t) && (t >>= 16,
    616. e += 16),
    617. 0 == (255 & t) && (t >>= 8,
    618. e += 8),
    619. 0 == (15 & t) && (t >>= 4,
    620. e += 4),
    621. 0 == (3 & t) && (t >>= 2,
    622. e += 2),
    623. 0 == (1 & t) && ++e,
    624. e
    625. }
    626. function vt() {
    627. for (var t = 0; t < this.t; ++t)
    628. if (0 != this[t])
    629. return t * this.DB + mt(this[t]);
    630. return this.s < 0 ? this.t * this.DB : -1
    631. }
    632. function _t(t) {
    633. for (var e = 0; 0 != t; )
    634. t &= t - 1,
    635. ++e;
    636. return e
    637. }
    638. function bt() {
    639. for (var t = 0, e = this.s & this.DM, i = 0; i < this.t; ++i)
    640. t += _t(this[i] ^ e);
    641. return t
    642. }
    643. function yt(t) {
    644. var e = Math.floor(t / this.DB);
    645. return e >= this.t ? 0 != this.s : 0 != (this[e] & 1 << t % this.DB)
    646. }
    647. function wt(t, e) {
    648. var i = b.ONE.shiftLeft(t);
    649. return this.bitwiseTo(i, e, i),
    650. i
    651. }
    652. function kt(t) {
    653. return this.changeBit(t, at)
    654. }
    655. function xt(t) {
    656. return this.changeBit(t, dt)
    657. }
    658. function Dt(t) {
    659. return this.changeBit(t, lt)
    660. }
    661. function St(t, e) {
    662. for (var i = 0, s = 0, n = Math.min(t.t, this.t); n > i; )
    663. s += this[i] + t[i],
    664. e[i++] = s & this.DM,
    665. s >>= this.DB;
    666. if (t.t < this.t) {
    667. for (s += t.s; i < this.t; )
    668. s += this[i],
    669. e[i++] = s & this.DM,
    670. s >>= this.DB;
    671. s += this.s
    672. } else {
    673. for (s += this.s; i < t.t; )
    674. s += t[i],
    675. e[i++] = s & this.DM,
    676. s >>= this.DB;
    677. s += t.s
    678. }
    679. e.s = 0 > s ? -1 : 0,
    680. s > 0 ? e[i++] = s : -1 > s && (e[i++] = this.DV + s),
    681. e.t = i,
    682. e.clamp()
    683. }
    684. function Ct(t) {
    685. var e = y();
    686. return this.addTo(t, e),
    687. e
    688. }
    689. function Tt(t) {
    690. var e = y();
    691. return this.subTo(t, e),
    692. e
    693. }
    694. function It(t) {
    695. var e = y();
    696. return this.multiplyTo(t, e),
    697. e
    698. }
    699. function $t() {
    700. var t = y();
    701. return this.squareTo(t),
    702. t
    703. }
    704. function Pt(t) {
    705. var e = y();
    706. return this.divRemTo(t, e, null),
    707. e
    708. }
    709. function Rt(t) {
    710. var e = y();
    711. return this.divRemTo(t, null, e),
    712. e
    713. }
    714. function At(t) {
    715. var e = y()
    716. , i = y();
    717. return this.divRemTo(t, e, i),
    718. new Array(e,i)
    719. }
    720. function Et(t) {
    721. this[this.t] = this.am(0, t - 1, this, 0, 0, this.t),
    722. ++this.t,
    723. this.clamp()
    724. }
    725. function Mt(t, e) {
    726. if (0 != t) {
    727. for (; this.t <= e; )
    728. this[this.t++] = 0;
    729. for (this[e] += t; this[e] >= this.DV; )
    730. this[e] -= this.DV,
    731. ++e >= this.t && (this[this.t++] = 0),
    732. ++this[e]
    733. }
    734. }
    735. function Nt() {}
    736. function Ot(t) {
    737. return t
    738. }
    739. function Bt(t, e, i) {
    740. t.multiplyTo(e, i)
    741. }
    742. function jt(t, e) {
    743. t.squareTo(e)
    744. }
    745. function Lt(t) {
    746. return this.exp(t, new Nt)
    747. }
    748. function Ft(t, e, i) {
    749. var s = Math.min(this.t + t.t, e);
    750. for (i.s = 0,
    751. i.t = s; s > 0; )
    752. i[--s] = 0;
    753. var n;
    754. for (n = i.t - this.t; n > s; ++s)
    755. i[s + this.t] = this.am(0, t[s], i, s, 0, this.t);
    756. for (n = Math.min(t.t, e); n > s; ++s)
    757. this.am(0, t[s], i, s, 0, e - s);
    758. i.clamp()
    759. }
    760. function Kt(t, e, i) {
    761. --e;
    762. var s = i.t = this.t + t.t - e;
    763. for (i.s = 0; --s >= 0; )
    764. i[s] = 0;
    765. for (s = Math.max(e - this.t, 0); s < t.t; ++s)
    766. i[this.t + s - e] = this.am(e - s, t[s], i, 0, 0, this.t + s - e);
    767. i.clamp(),
    768. i.drShiftTo(1, i)
    769. }
    770. function Ut(t) {
    771. this.r2 = y(),
    772. this.q3 = y(),
    773. b.ONE.dlShiftTo(2 * t.t, this.r2),
    774. this.mu = this.r2.divide(t),
    775. this.m = t
    776. }
    777. function Vt(t) {
    778. if (t.s < 0 || t.t > 2 * this.m.t)
    779. return t.mod(this.m);
    780. if (t.compareTo(this.m) < 0)
    781. return t;
    782. var e = y();
    783. return t.copyTo(e),
    784. this.reduce(e),
    785. e
    786. }
    787. function zt(t) {
    788. return t
    789. }
    790. function qt(t) {
    791. for (t.drShiftTo(this.m.t - 1, this.r2),
    792. t.t > this.m.t + 1 && (t.t = this.m.t + 1,
    793. t.clamp()),
    794. this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3),
    795. this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); t.compareTo(this.r2) < 0; )
    796. t.dAddOffset(1, this.m.t + 1);
    797. for (t.subTo(this.r2, t); t.compareTo(this.m) >= 0; )
    798. t.subTo(this.m, t)
    799. }
    800. function Ht(t, e) {
    801. t.squareTo(e),
    802. this.reduce(e)
    803. }
    804. function Jt(t, e, i) {
    805. t.multiplyTo(e, i),
    806. this.reduce(i)
    807. }
    808. function Gt(t, e) {
    809. var i, s, n = t.bitLength(), r = m(1);
    810. if (0 >= n)
    811. return r;
    812. i = 18 > n ? 1 : 48 > n ? 3 : 144 > n ? 4 : 768 > n ? 5 : 6,
    813. s = 8 > n ? new $(e) : e.isEven() ? new Ut(e) : new O(e);
    814. var o = new Array
    815. , a = 3
    816. , c = i - 1
    817. , l = (1 << i) - 1;
    818. if (o[1] = s.convert(this),
    819. i > 1) {
    820. var u = y();
    821. for (s.sqrTo(o[1], u); l >= a; )
    822. o[a] = y(),
    823. s.mulTo(u, o[a - 2], o[a]),
    824. a += 2
    825. }
    826. var d, p, h = t.t - 1, f = !0, g = y();
    827. for (n = w(t[h]) - 1; h >= 0; ) {
    828. for (n >= c ? d = t[h] >> n - c & l : (d = (t[h] & (1 << n + 1) - 1) << c - n,
    829. h > 0 && (d |= t[h - 1] >> this.DB + n - c)),
    830. a = i; 0 == (1 & d); )
    831. d >>= 1,
    832. --a;
    833. if ((n -= a) < 0 && (n += this.DB,
    834. --h),
    835. f)
    836. o[d].copyTo(r),
    837. f = !1;
    838. else {
    839. for (; a > 1; )
    840. s.sqrTo(r, g),
    841. s.sqrTo(g, r),
    842. a -= 2;
    843. a > 0 ? s.sqrTo(r, g) : (p = r,
    844. r = g,
    845. g = p),
    846. s.mulTo(g, o[d], r)
    847. }
    848. for (; h >= 0 && 0 == (t[h] & 1 << n); )
    849. s.sqrTo(r, g),
    850. p = r,
    851. r = g,
    852. g = p,
    853. --n < 0 && (n = this.DB - 1,
    854. --h)
    855. }
    856. return s.revert(r)
    857. }
    858. function Yt(t) {
    859. var e = this.s < 0 ? this.negate() : this.clone()
    860. , i = t.s < 0 ? t.negate() : t.clone();
    861. if (e.compareTo(i) < 0) {
    862. var s = e;
    863. e = i,
    864. i = s
    865. }
    866. var n = e.getLowestSetBit()
    867. , r = i.getLowestSetBit();
    868. if (0 > r)
    869. return e;
    870. for (r > n && (r = n),
    871. r > 0 && (e.rShiftTo(r, e),
    872. i.rShiftTo(r, i)); e.signum() > 0; )
    873. (n = e.getLowestSetBit()) > 0 && e.rShiftTo(n, e),
    874. (n = i.getLowestSetBit()) > 0 && i.rShiftTo(n, i),
    875. e.compareTo(i) >= 0 ? (e.subTo(i, e),
    876. e.rShiftTo(1, e)) : (i.subTo(e, i),
    877. i.rShiftTo(1, i));
    878. return r > 0 && i.lShiftTo(r, i),
    879. i
    880. }
    881. function Wt(t) {
    882. if (0 >= t)
    883. return 0;
    884. var e = this.DV % t
    885. , i = this.s < 0 ? t - 1 : 0;
    886. if (this.t > 0)
    887. if (0 == e)
    888. i = this[0] % t;
    889. else
    890. for (var s = this.t - 1; s >= 0; --s)
    891. i = (e * i + this[s]) % t;
    892. return i
    893. }
    894. function Zt(t) {
    895. var e = t.isEven();
    896. if (this.isEven() && e || 0 == t.signum())
    897. return b.ZERO;
    898. for (var i = t.clone(), s = this.clone(), n = m(1), r = m(0), o = m(0), a = m(1); 0 != i.signum(); ) {
    899. for (; i.isEven(); )
    900. i.rShiftTo(1, i),
    901. e ? (n.isEven() && r.isEven() || (n.addTo(this, n),
    902. r.subTo(t, r)),
    903. n.rShiftTo(1, n)) : r.isEven() || r.subTo(t, r),
    904. r.rShiftTo(1, r);
    905. for (; s.isEven(); )
    906. s.rShiftTo(1, s),
    907. e ? (o.isEven() && a.isEven() || (o.addTo(this, o),
    908. a.subTo(t, a)),
    909. o.rShiftTo(1, o)) : a.isEven() || a.subTo(t, a),
    910. a.rShiftTo(1, a);
    911. i.compareTo(s) >= 0 ? (i.subTo(s, i),
    912. e && n.subTo(o, n),
    913. r.subTo(a, r)) : (s.subTo(i, s),
    914. e && o.subTo(n, o),
    915. a.subTo(r, a))
    916. }
    917. return 0 != s.compareTo(b.ONE) ? b.ZERO : a.compareTo(t) >= 0 ? a.subtract(t) : a.signum() < 0 ? (a.addTo(t, a),
    918. a.signum() < 0 ? a.add(t) : a) : a
    919. }
    920. function Qt(t) {
    921. var e, i = this.abs();
    922. if (1 == i.t && i[0] <= $e[$e.length - 1]) {
    923. for (e = 0; e < $e.length; ++e)
    924. if (i[0] == $e[e])
    925. return !0;
    926. return !1
    927. }
    928. if (i.isEven())
    929. return !1;
    930. for (e = 1; e < $e.length; ) {
    931. for (var s = $e[e], n = e + 1; n < $e.length && Pe > s; )
    932. s *= $e[n++];
    933. for (s = i.modInt(s); n > e; )
    934. if (s % $e[e++] == 0)
    935. return !1
    936. }
    937. return i.millerRabin(t)
    938. }
    939. function Xt(t) {
    940. var e = this.subtract(b.ONE)
    941. , i = e.getLowestSetBit();
    942. if (0 >= i)
    943. return !1;
    944. var s = e.shiftRight(i);
    945. t = t + 1 >> 1,
    946. t > $e.length && (t = $e.length);
    947. for (var n = y(), r = 0; t > r; ++r) {
    948. var o = n.modPow(s, this);
    949. if (0 != o.compareTo(b.ONE) && 0 != o.compareTo(e)) {
    950. for (var a = 1; a++ < i && 0 != o.compareTo(e); )
    951. if (o = o.modPowInt(2, this),
    952. 0 == o.compareTo(b.ONE))
    953. return !1;
    954. if (0 != o.compareTo(e))
    955. return !1
    956. }
    957. }
    958. return !0
    959. }
    960. function te() {
    961. this.i = 0,
    962. this.j = 0,
    963. this.S = new Array
    964. }
    965. function ee(t) {
    966. var e, i, s;
    967. for (e = 0; 256 > e; ++e)
    968. this.S[e] = e;
    969. for (i = 0,
    970. e = 0; 256 > e; ++e)
    971. i = i + this.S[e] + t[e % t.length] & 255,
    972. s = this.S[e],
    973. this.S[e] = this.S[i],
    974. this.S[i] = s;
    975. this.i = 0,
    976. this.j = 0
    977. }
    978. function ie() {
    979. var t;
    980. return this.i = this.i + 1 & 255,
    981. this.j = this.j + this.S[this.i] & 255,
    982. t = this.S[this.i],
    983. this.S[this.i] = this.S[this.j],
    984. this.S[this.j] = t,
    985. this.S[t + this.S[this.i] & 255]
    986. }
    987. function se() {
    988. return new te
    989. }
    990. function ne() {
    991. if (null == Re) {
    992. for (Re = se(); Me > Ee; ) {
    993. Ae[Ee++] = 255 & t
    994. }
    995. for (Re.init(Ae),
    996. Ee = 0; Ee < Ae.length; ++Ee)
    997. Ae[Ee] = 0;
    998. Ee = 0
    999. }
    1000. return Re.next()
    1001. }
    1002. function re(t) {
    1003. var e;
    1004. for (e = 0; e < t.length; ++e)
    1005. t[e] = ne()
    1006. }
    1007. function oe() {}
    1008. function ae(t, e) {
    1009. return new b(t,e)
    1010. }
    1011. function ce(t, e) {
    1012. if (e < t.length + 11)
    1013. return console.error("Message too long for RSA"),
    1014. null;
    1015. for (var i = new Array, s = t.length - 1; s >= 0 && e > 0; ) {
    1016. var n = t.charCodeAt(s--);
    1017. 128 > n ? i[--e] = n : n > 127 && 2048 > n ? (i[--e] = 63 & n | 128,
    1018. i[--e] = n >> 6 | 192) : (i[--e] = 63 & n | 128,
    1019. i[--e] = n >> 6 & 63 | 128,
    1020. i[--e] = n >> 12 | 224)
    1021. }
    1022. i[--e] = 0;
    1023. for (var r = new oe, o = new Array; e > 2; ) {
    1024. for (o[0] = 0; 0 == o[0]; )
    1025. r.nextBytes(o);
    1026. i[--e] = o[0]
    1027. }
    1028. return i[--e] = 2,
    1029. i[--e] = 0,
    1030. new b(i)
    1031. }
    1032. function le() {
    1033. this.n = null,
    1034. this.e = 0,
    1035. this.d = null,
    1036. this.p = null,
    1037. this.q = null,
    1038. this.dmp1 = null,
    1039. this.dmq1 = null,
    1040. this.coeff = null
    1041. }
    1042. function ue(t, e) {
    1043. null != t && null != e && t.length > 0 && e.length > 0 ? (this.n = ae(t, 16),
    1044. this.e = parseInt(e, 16)) : console.error("Invalid RSA public key")
    1045. }
    1046. function de(t) {
    1047. return t.modPowInt(this.e, this.n)
    1048. }
    1049. function pe(t) {
    1050. var e = ce(t, this.n.bitLength() + 7 >> 3);
    1051. if (null == e)
    1052. return null;
    1053. var i = this.doPublic(e);
    1054. if (null == i)
    1055. return null;
    1056. var s = i.toString(16);
    1057. return 0 == (1 & s.length) ? s : "0" + s
    1058. }
    1059. function he(t, e) {
    1060. for (var i = t.toByteArray(), s = 0; s < i.length && 0 == i[s]; )
    1061. ++s;
    1062. if (i.length - s != e - 1 || 2 != i[s])
    1063. return null;
    1064. for (++s; 0 != i[s]; )
    1065. if (++s >= i.length)
    1066. return null;
    1067. for (var n = ""; ++s < i.length; ) {
    1068. var r = 255 & i[s];
    1069. 128 > r ? n += String.fromCharCode(r) : r > 191 && 224 > r ? (n += String.fromCharCode((31 & r) << 6 | 63 & i[s + 1]),
    1070. ++s) : (n += String.fromCharCode((15 & r) << 12 | (63 & i[s + 1]) << 6 | 63 & i[s + 2]),
    1071. s += 2)
    1072. }
    1073. return n
    1074. }
    1075. function fe(t, e, i) {
    1076. null != t && null != e && t.length > 0 && e.length > 0 ? (this.n = ae(t, 16),
    1077. this.e = parseInt(e, 16),
    1078. this.d = ae(i, 16)) : console.error("Invalid RSA private key")
    1079. }
    1080. function ge(t, e, i, s, n, r, o, a) {
    1081. null != t && null != e && t.length > 0 && e.length > 0 ? (this.n = ae(t, 16),
    1082. this.e = parseInt(e, 16),
    1083. this.d = ae(i, 16),
    1084. this.p = ae(s, 16),
    1085. this.q = ae(n, 16),
    1086. this.dmp1 = ae(r, 16),
    1087. this.dmq1 = ae(o, 16),
    1088. this.coeff = ae(a, 16)) : console.error("Invalid RSA private key")
    1089. }
    1090. function me(t, e) {
    1091. var i = new oe
    1092. , s = t >> 1;
    1093. this.e = parseInt(e, 16);
    1094. for (var n = new b(e,16); ; ) {
    1095. for (; this.p = new b(t - s,1,i),
    1096. 0 != this.p.subtract(b.ONE).gcd(n).compareTo(b.ONE) || !this.p.isProbablePrime(10); )
    1097. ;
    1098. for (; this.q = new b(s,1,i),
    1099. 0 != this.q.subtract(b.ONE).gcd(n).compareTo(b.ONE) || !this.q.isProbablePrime(10); )
    1100. ;
    1101. if (this.p.compareTo(this.q) <= 0) {
    1102. var r = this.p;
    1103. this.p = this.q,
    1104. this.q = r
    1105. }
    1106. var o = this.p.subtract(b.ONE)
    1107. , a = this.q.subtract(b.ONE)
    1108. , c = o.multiply(a);
    1109. if (0 == c.gcd(n).compareTo(b.ONE)) {
    1110. this.n = this.p.multiply(this.q),
    1111. this.d = n.modInverse(c),
    1112. this.dmp1 = this.d.mod(o),
    1113. this.dmq1 = this.d.mod(a),
    1114. this.coeff = this.q.modInverse(this.p);
    1115. break
    1116. }
    1117. }
    1118. }
    1119. function ve(t) {
    1120. if (null == this.p || null == this.q)
    1121. return t.modPow(this.d, this.n);
    1122. 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; )
    1123. e = e.add(this.p);
    1124. return e.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i)
    1125. }
    1126. function _e(t) {
    1127. var e = ae(t, 16)
    1128. , i = this.doPrivate(e);
    1129. return null == i ? null : he(i, this.n.bitLength() + 7 >> 3)
    1130. }
    1131. function be(t) {
    1132. var e, i, s = "";
    1133. for (e = 0; e + 3 <= t.length; e += 3)
    1134. i = parseInt(t.substring(e, e + 3), 16),
    1135. s += je.charAt(i >> 6) + je.charAt(63 & i);
    1136. for (e + 1 == t.length ? (i = parseInt(t.substring(e, e + 1), 16),
    1137. s += je.charAt(i << 2)) : e + 2 == t.length && (i = parseInt(t.substring(e, e + 2), 16),
    1138. s += je.charAt(i >> 2) + je.charAt((3 & i) << 4)); (3 & s.length) > 0; )
    1139. s += Le;
    1140. return s
    1141. }
    1142. function ye(t) {
    1143. var e, i, s = "", n = 0;
    1144. for (e = 0; e < t.length && t.charAt(e) != Le; ++e)
    1145. v = je.indexOf(t.charAt(e)),
    1146. v < 0 || (0 == n ? (s += c(v >> 2),
    1147. i = 3 & v,
    1148. n = 1) : 1 == n ? (s += c(i << 2 | v >> 4),
    1149. i = 15 & v,
    1150. n = 2) : 2 == n ? (s += c(i),
    1151. s += c(v >> 2),
    1152. i = 3 & v,
    1153. n = 3) : (s += c(i << 2 | v >> 4),
    1154. s += c(15 & v),
    1155. n = 0));
    1156. return 1 == n && (s += c(i << 2)),
    1157. s
    1158. }
    1159. try {
    1160. var we, ke, xe = false; xe && "Microsoft Internet Explorer" == navigator.appName ? (b.prototype.am = i,
    1161. we = 26) : xe && "Netscape" != navigator.appName ? (b.prototype.am = e,
    1162. we = 26) : (b.prototype.am = s,
    1163. we = 28),
    1164. b.prototype.DB = we,
    1165. b.prototype.DM = (1 << we) - 1,
    1166. b.prototype.DV = 1 << we;
    1167. } catch (e) {}
    1168. var De = 52;
    1169. b.prototype.FV = Math.pow(2, De),
    1170. b.prototype.F1 = De - we,
    1171. b.prototype.F2 = 2 * we - De;
    1172. var Se, Ce, Te = "0123456789abcdefghijklmnopqrstuvwxyz", Ie = new Array;
    1173. for (Se = "0".charCodeAt(0),
    1174. Ce = 0; 9 >= Ce; ++Ce)
    1175. Ie[Se++] = Ce;
    1176. for (Se = "a".charCodeAt(0),
    1177. Ce = 10; 36 > Ce; ++Ce)
    1178. Ie[Se++] = Ce;
    1179. for (Se = "A".charCodeAt(0),
    1180. Ce = 10; 36 > Ce; ++Ce)
    1181. Ie[Se++] = Ce;
    1182. $.prototype.convert = P,
    1183. $.prototype.revert = R,
    1184. $.prototype.reduce = A,
    1185. $.prototype.mulTo = E,
    1186. $.prototype.sqrTo = M,
    1187. O.prototype.convert = B,
    1188. O.prototype.revert = j,
    1189. O.prototype.reduce = L,
    1190. O.prototype.mulTo = K,
    1191. O.prototype.sqrTo = F,
    1192. b.prototype.copyTo = p,
    1193. b.prototype.fromInt = n,
    1194. b.prototype.fromString = h,
    1195. b.prototype.clamp = r,
    1196. b.prototype.dlShiftTo = g,
    1197. b.prototype.drShiftTo = _,
    1198. b.prototype.lShiftTo = k,
    1199. b.prototype.rShiftTo = x,
    1200. b.prototype.subTo = D,
    1201. b.prototype.multiplyTo = S,
    1202. b.prototype.squareTo = C,
    1203. b.prototype.divRemTo = T,
    1204. b.prototype.invDigit = N,
    1205. b.prototype.isEven = U,
    1206. b.prototype.exp = V,
    1207. b.prototype.toString = o,
    1208. b.prototype.negate = f,
    1209. b.prototype.abs = a,
    1210. b.prototype.compareTo = u,
    1211. b.prototype.bitLength = d,
    1212. b.prototype.mod = I,
    1213. b.prototype.modPowInt = z,
    1214. b.ZERO = m(0),
    1215. b.ONE = m(1),
    1216. Nt.prototype.convert = Ot,
    1217. Nt.prototype.revert = Ot,
    1218. Nt.prototype.mulTo = Bt,
    1219. Nt.prototype.sqrTo = jt,
    1220. Ut.prototype.convert = Vt,
    1221. Ut.prototype.revert = zt,
    1222. Ut.prototype.reduce = qt,
    1223. Ut.prototype.mulTo = Jt,
    1224. Ut.prototype.sqrTo = Ht;
    1225. var $e = [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, [][(![] + [])[!+[] + !![] + !![]] + ([] + {})[+!![]] + (!![] + [])[+!![]] + (!![] + [])[+[]]][([] + {})[!+[] + !![] + !![] + !![] + !![]] + ([] + {})[+!![]] + ([][[]] + [])[+!![]] + (![] + [])[!+[] + !![] + !![]] + (!![] + [])[+[]] + (!![] + [])[+!![]] + ([][[]] + [])[+[]] + ([] + {})[!+[] + !![] + !![] + !![] + !![]] + (!![] + [])[+[]] + ([] + {})[+!![]] + (!![] + [])[+!![]]]((!+[] + !![] + !![] + !![] + !![] + !![] + !![] + !![] + !![] + []) + (!+[] + !![] + !![] + !![] + !![] + !![] + !![] + !![] + !![] + []) + (!+[] + !![] + !![] + !![] + !![] + !![] + !![] + []))(+[])]
    1226. , Pe = (1 << 26) / $e[$e.length - 1];
    1227. b.prototype.chunkSize = Y,
    1228. b.prototype.toRadix = Z,
    1229. b.prototype.fromRadix = Q,
    1230. b.prototype.fromNumber = X,
    1231. b.prototype.bitwiseTo = nt,
    1232. b.prototype.changeBit = wt,
    1233. b.prototype.addTo = St,
    1234. b.prototype.dMultiply = Et,
    1235. b.prototype.dAddOffset = Mt,
    1236. b.prototype.multiplyLowerTo = Ft,
    1237. b.prototype.multiplyUpperTo = Kt,
    1238. b.prototype.modInt = Wt,
    1239. b.prototype.millerRabin = Xt,
    1240. b.prototype.clone = q,
    1241. b.prototype.intValue = H,
    1242. b.prototype.byteValue = J,
    1243. b.prototype.shortValue = G,
    1244. b.prototype.signum = W,
    1245. b.prototype.toByteArray = tt,
    1246. b.prototype.equals = et,
    1247. b.prototype.min = it,
    1248. b.prototype.max = st,
    1249. b.prototype.and = ot,
    1250. b.prototype.or = ct,
    1251. b.prototype.xor = ut,
    1252. b.prototype.andNot = pt,
    1253. b.prototype.not = ht,
    1254. b.prototype.shiftLeft = ft,
    1255. b.prototype.shiftRight = gt,
    1256. b.prototype.getLowestSetBit = vt,
    1257. b.prototype.bitCount = bt,
    1258. b.prototype.testBit = yt,
    1259. b.prototype.setBit = kt,
    1260. b.prototype.clearBit = xt,
    1261. b.prototype.flipBit = Dt,
    1262. b.prototype.add = Ct,
    1263. b.prototype.subtract = Tt,
    1264. b.prototype.multiply = It,
    1265. b.prototype.divide = Pt,
    1266. b.prototype.remainder = Rt,
    1267. b.prototype.divideAndRemainder = At,
    1268. b.prototype.modPow = Gt,
    1269. b.prototype.modInverse = Zt,
    1270. b.prototype.pow = Lt,
    1271. b.prototype.gcd = Yt,
    1272. b.prototype.isProbablePrime = Qt,
    1273. b.prototype.square = $t,
    1274. te.prototype.init = ee,
    1275. te.prototype.next = ie;
    1276. var Re, Ae, Ee, Me = 256;
    1277. if (null == Ae) {
    1278. Ae = new Array,
    1279. Ee = 0;
    1280. var Ne;
    1281. var Be = function(t) {
    1282. if (this.count = this.count || 0,
    1283. this.count >= 256 || Ee >= Me)
    1284. try {
    1285. var e = t.x + t.y;
    1286. Ae[Ee++] = 255 & e,
    1287. this.count += 1
    1288. } catch (y) {}
    1289. };
    1290. window.addEventListener ? window.addEventListener("mousemove", Be, !1) : window.attachEvent && window.attachEvent("onmousemove", Be)
    1291. }
    1292. oe.prototype.nextBytes = re,
    1293. le.prototype.doPublic = de,
    1294. le.prototype.setPublic = ue,
    1295. le.prototype.encrypt = pe,
    1296. le.prototype.doPrivate = ve,
    1297. le.prototype.setPrivate = fe,
    1298. le.prototype.setPrivateEx = ge,
    1299. le.prototype.generate = me,
    1300. le.prototype.decrypt = _e,
    1301. function() {
    1302. var t = function(t, e, n) {
    1303. var r = new oe
    1304. , o = t >> 1;
    1305. this.e = parseInt(e, 16);
    1306. var a = new b(e,16)
    1307. , c = this
    1308. , l = function() {
    1309. var e = function() {
    1310. if (c.p.compareTo(c.q) <= 0) {
    1311. var t = c.p;
    1312. c.p = c.q,
    1313. c.q = t
    1314. }
    1315. var e = c.p.subtract(b.ONE)
    1316. , i = c.q.subtract(b.ONE)
    1317. , s = e.multiply(i);
    1318. 0 == s.gcd(a).compareTo(b.ONE) ? (c.n = c.p.multiply(c.q),
    1319. c.d = a.modInverse(s),
    1320. c.dmp1 = c.d.mod(e),
    1321. c.dmq1 = c.d.mod(i),
    1322. c.coeff = c.q.modInverse(c.p),
    1323. setTimeout(function() {
    1324. n()
    1325. }, 0)) : setTimeout(l, 0)
    1326. }
    1327. , i = function() {
    1328. c.q = y(),
    1329. c.q.fromNumberAsync(o, 1, r, function() {
    1330. c.q.subtract(b.ONE).gcda(a, function(t) {
    1331. 0 == t.compareTo(b.ONE) && c.q.isProbablePrime(10) ? setTimeout(e, 0) : setTimeout(i, 0)
    1332. })
    1333. })
    1334. }
    1335. , s = function() {
    1336. c.p = y(),
    1337. c.p.fromNumberAsync(t - o, 1, r, function() {
    1338. c.p.subtract(b.ONE).gcda(a, function(t) {
    1339. 0 == t.compareTo(b.ONE) && c.p.isProbablePrime(10) ? setTimeout(i, 0) : setTimeout(s, 0)
    1340. })
    1341. })
    1342. };
    1343. setTimeout(s, 0)
    1344. };
    1345. setTimeout(l, 0)
    1346. };
    1347. le.prototype.generateAsync = t;
    1348. var e = function(t, e) {
    1349. var i = this.s < 0 ? this.negate() : this.clone()
    1350. , s = t.s < 0 ? t.negate() : t.clone();
    1351. if (i.compareTo(s) < 0) {
    1352. var n = i;
    1353. i = s,
    1354. s = n
    1355. }
    1356. var r = i.getLowestSetBit()
    1357. , o = s.getLowestSetBit();
    1358. if (0 > o)
    1359. return void e(i);
    1360. o > r && (o = r),
    1361. o > 0 && (i.rShiftTo(o, i),
    1362. s.rShiftTo(o, s));
    1363. var a = function() {
    1364. (r = i.getLowestSetBit()) > 0 && i.rShiftTo(r, i),
    1365. (r = s.getLowestSetBit()) > 0 && s.rShiftTo(r, s),
    1366. i.compareTo(s) >= 0 ? (i.subTo(s, i),
    1367. i.rShiftTo(1, i)) : (s.subTo(i, s),
    1368. s.rShiftTo(1, s)),
    1369. i.signum() > 0 ? setTimeout(a, 0) : (o > 0 && s.lShiftTo(o, s),
    1370. setTimeout(function() {
    1371. e(s)
    1372. }, 0))
    1373. };
    1374. setTimeout(a, 10)
    1375. };
    1376. b.prototype.gcda = e;
    1377. var i = function(t, e, i, s) {
    1378. if ("number" == typeof e)
    1379. if (2 > t)
    1380. this.fromInt(1);
    1381. else {
    1382. this.fromNumber(t, i),
    1383. this.testBit(t - 1) || this.bitwiseTo(b.ONE.shiftLeft(t - 1), at, this),
    1384. this.isEven() && this.dAddOffset(1, 0);
    1385. var n = this
    1386. , r = function() {
    1387. n.dAddOffset(2, 0),
    1388. n.bitLength() > t && n.subTo(b.ONE.shiftLeft(t - 1), n),
    1389. n.isProbablePrime(e) ? setTimeout(function() {
    1390. s()
    1391. }, 0) : setTimeout(r, 0)
    1392. };
    1393. setTimeout(r, 0)
    1394. }
    1395. else {
    1396. var o = new Array
    1397. , a = 7 & t;
    1398. o.length = (t >> 3) + 1,
    1399. e.nextBytes(o),
    1400. a > 0 ? o[0] &= (1 << a) - 1 : o[0] = 0,
    1401. this.fromString(o, 256)
    1402. }
    1403. };
    1404. b.prototype.fromNumberAsync = i
    1405. }();
    1406. var je = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
    1407. , Le = "="
    1408. , Fe = Fe || {};
    1409. Fe.env = Fe.env || {};
    1410. var Ke = Fe
    1411. , Ue = Object.prototype
    1412. , Ve = "[object Function]"
    1413. , ze = ["toString", "valueOf"];
    1414. Fe.env.parseUA = function(t) {
    1415. var e, i = function(t) {
    1416. var e = 0;
    1417. return parseFloat(t.replace(/\./g, function() {
    1418. return 1 == e++ ? "" : "."
    1419. }))
    1420. }, s = navigator, n = {
    1421. ie: 0,
    1422. opera: 0,
    1423. gecko: 0,
    1424. webkit: 0,
    1425. chrome: 0,
    1426. mobile: null,
    1427. air: 0,
    1428. ipad: 0,
    1429. iphone: 0,
    1430. ipod: 0,
    1431. ios: null,
    1432. android: 0,
    1433. webos: 0,
    1434. caja: s && s.cajaVersion,
    1435. secure: !1,
    1436. os: null
    1437. };
    1438. try {
    1439. r = t || navigator && navigator.userAgent,
    1440. o = window && window,
    1441. a = o && o.href;
    1442. } catch (e) {}
    1443. return n.secure = a && 0 === a.toLowerCase().indexOf("https"),
    1444. r && (/windows|win32/i.test(r) ? n.os = "windows" : /macintosh/i.test(r) ? n.os = "macintosh" : /rhino/i.test(r) && (n.os = "rhino"),
    1445. /KHTML/.test(r) && (n.webkit = 1),
    1446. e = r.match(/AppleWebKit\/([^\s]*)/),
    1447. e && e[1] && (n.webkit = i(e[1]),
    1448. / Mobile\//.test(r) ? (n.mobile = "Apple",
    1449. e = r.match(/OS ([^\s]*)/),
    1450. e && e[1] && (e = i(e[1].replace("_", "."))),
    1451. n.ios = e,
    1452. n.ipad = n.ipod = n.iphone = 0,
    1453. e = r.match(/iPad|iPod|iPhone/),
    1454. e && e[0] && (n[e[0].toLowerCase()] = n.ios)) : (e = r.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/),
    1455. e && (n.mobile = e[0]),
    1456. /webOS/.test(r) && (n.mobile = "WebOS",
    1457. e = r.match(/webOS\/([^\s]*);/),
    1458. e && e[1] && (n.webos = i(e[1]))),
    1459. / Android/.test(r) && (n.mobile = "Android",
    1460. e = r.match(/Android ([^\s]*);/),
    1461. e && e[1] && (n.android = i(e[1])))),
    1462. e = r.match(/Chrome\/([^\s]*)/),
    1463. e && e[1] ? n.chrome = i(e[1]) : (e = r.match(/AdobeAIR\/([^\s]*)/),
    1464. e && (n.air = e[0]))),
    1465. n.webkit || (e = r.match(/Opera[\s\/]([^\s]*)/),
    1466. e && e[1] ? (n.opera = i(e[1]),
    1467. e = r.match(/Version\/([^\s]*)/),
    1468. e && e[1] && (n.opera = i(e[1])),
    1469. e = r.match(/Opera Mini[^;]*/),
    1470. e && (n.mobile = e[0])) : (e = r.match(/MSIE\s([^;]*)/),
    1471. e && e[1] ? n.ie = i(e[1]) : (e = r.match(/Gecko\/([^\s]*)/),
    1472. e && (n.gecko = 1,
    1473. e = r.match(/rv:([^\s\)]*)/),
    1474. e && e[1] && (n.gecko = i(e[1]))))))),
    1475. n
    1476. }
    1477. ,
    1478. Fe.env.ua = Fe.env.parseUA(),
    1479. Fe.isFunction = function(t) {
    1480. return "function" == typeof t || Ue.toString.apply(t) === Ve
    1481. }
    1482. ,
    1483. Fe._IEEnumFix = Fe.env.ua.ie ? function(t, e) {
    1484. var i, s, n;
    1485. for (i = 0; i < ze.length; i += 1)
    1486. s = ze[i],
    1487. n = e[s],
    1488. Ke.isFunction(n) && n != Ue[s] && (t[s] = n)
    1489. }
    1490. : function() {}
    1491. ,
    1492. Fe.extend = function(t, e, i) {
    1493. if (!e || !t)
    1494. throw new Error("extend failed, please check that all dependencies are included.");
    1495. var s, n = function() {};
    1496. if (n.prototype = e.prototype,
    1497. t.prototype = new n,
    1498. t.prototype.constructor = t,
    1499. t.superclass = e.prototype,
    1500. e.prototype.constructor == Ue.constructor && (e.prototype.constructor = e),
    1501. i) {
    1502. for (s in i)
    1503. Ke.hasOwnProperty(i, s) && (t.prototype[s] = i[s]);
    1504. Ke._IEEnumFix(t.prototype, i)
    1505. }
    1506. }
    1507. ,
    1508. "undefined" != typeof KJUR && KJUR || (KJUR = {}),
    1509. "undefined" != typeof KJUR.asn1 && KJUR.asn1 || (KJUR.asn1 = {}),
    1510. KJUR.asn1.ASN1Util = new function() {
    1511. this.integerToByteHex = function(t) {
    1512. var e = t.toString(16);
    1513. return e.length % 2 == 1 && (e = "0" + e),
    1514. e
    1515. }
    1516. ,
    1517. this.bigIntToMinTwosComplementsHex = function(t) {
    1518. var e = t.toString(16);
    1519. if ("-" != e.substr(0, 1))
    1520. e.length % 2 == 1 ? e = "0" + e : e.match(/^[0-7]/) || (e = "00" + e);
    1521. else {
    1522. var i = e.substr(1)
    1523. , s = i.length;
    1524. s % 2 == 1 ? s += 1 : e.match(/^[0-7]/) || (s += 2);
    1525. for (var n = "", r = 0; s > r; r++)
    1526. n += "f";
    1527. var o = new b(n,16)
    1528. , a = o.xor(t).add(b.ONE);
    1529. e = a.toString(16).replace(/^-/, "")
    1530. }
    1531. return e
    1532. }
    1533. ,
    1534. this.getPEMStringFromHex = function(t, e) {
    1535. var i = CryptoJS.enc.Hex.parse(t)
    1536. , s = CryptoJS.enc.Base64.stringify(i)
    1537. , n = s.replace(/(.{64})/g, "$1\r\n");
    1538. return n = n.replace(/\r\n$/, ""),
    1539. "-----BEGIN " + e + "-----\r\n" + n + "\r\n-----END " + e + "-----\r\n"
    1540. }
    1541. }
    1542. ,
    1543. KJUR.asn1.ASN1Object = function() {
    1544. var n = "";
    1545. this.getLengthHexFromValue = function() {
    1546. if ("undefined" == typeof this.hV || null == this.hV)
    1547. throw "this.hV is null or undefined.";
    1548. if (this.hV.length % 2 == 1)
    1549. throw "value hex must be even length: n=" + n.length + ",v=" + this.hV;
    1550. var t = this.hV.length / 2
    1551. , e = t.toString(16);
    1552. if (e.length % 2 == 1 && (e = "0" + e),
    1553. 128 > t)
    1554. return e;
    1555. var i = e.length / 2;
    1556. if (i > 15)
    1557. throw "ASN.1 length too long to represent by 8x: n = " + t.toString(16);
    1558. var s = 128 + i;
    1559. return s.toString(16) + e
    1560. }
    1561. ,
    1562. this.getEncodedHex = function() {
    1563. return (null == this.hTLV || this.isModified) && (this.hV = this.getFreshValueHex(),
    1564. this.hL = this.getLengthHexFromValue(),
    1565. this.hTLV = this.hT + this.hL + this.hV,
    1566. this.isModified = !1),
    1567. this.hTLV
    1568. }
    1569. ,
    1570. this.getValueHex = function() {
    1571. return this.getEncodedHex(),
    1572. this.hV
    1573. }
    1574. ,
    1575. this.getFreshValueHex = function() {
    1576. return ""
    1577. }
    1578. }
    1579. ,
    1580. KJUR.asn1.DERAbstractString = function(t) {
    1581. KJUR.asn1.DERAbstractString.superclass.constructor.call(this);
    1582. this.getString = function() {
    1583. return this.s
    1584. }
    1585. ,
    1586. this.setString = function(t) {
    1587. this.hTLV = null,
    1588. this.isModified = !0,
    1589. this.s = t,
    1590. this.hV = stohex(this.s)
    1591. }
    1592. ,
    1593. this.setStringHex = function(t) {
    1594. this.hTLV = null,
    1595. this.isModified = !0,
    1596. this.s = null,
    1597. this.hV = t
    1598. }
    1599. ,
    1600. this.getFreshValueHex = function() {
    1601. return this.hV
    1602. }
    1603. ,
    1604. "undefined" != typeof t && ("undefined" != typeof t.str ? this.setString(t.str) : "undefined" != typeof t.hex && this.setStringHex(t.hex))
    1605. }
    1606. ,
    1607. Fe.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object),
    1608. KJUR.asn1.DERAbstractTime = function(t) {
    1609. KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);
    1610. this.localDateToUTC = function(t) {
    1611. utc = t.getTime() + 6e4 * t.getTimezoneOffset();
    1612. var e = new Date(utc);
    1613. return e
    1614. }
    1615. ,
    1616. this.formatDate = function(t, e) {
    1617. var i = this.zeroPadding
    1618. , s = this.localDateToUTC(t)
    1619. , n = String(s.getFullYear());
    1620. "utc" == e && (n = n.substr(2, 2));
    1621. var r = i(String(s.getMonth() + 1), 2)
    1622. , o = i(String(s.getDate()), 2)
    1623. , a = i(String(s.getHours()), 2)
    1624. , c = i(String(s.getMinutes()), 2)
    1625. , l = i(String(s.getSeconds()), 2);
    1626. return n + r + o + a + c + l + "Z"
    1627. }
    1628. ,
    1629. this.zeroPadding = function(t, e) {
    1630. return t.length >= e ? t : new Array(e - t.length + 1).join("0") + t
    1631. }
    1632. ,
    1633. this.getString = function() {
    1634. return this.s
    1635. }
    1636. ,
    1637. this.setString = function(t) {
    1638. this.hTLV = null,
    1639. this.isModified = !0,
    1640. this.s = t,
    1641. this.hV = stohex(this.s)
    1642. }
    1643. ,
    1644. this.setByDateValue = function(t, e, i, s, n, r) {
    1645. var o = new Date(Date.UTC(t, e - 1, i, s, n, r, 0));
    1646. this.setByDate(o)
    1647. }
    1648. ,
    1649. this.getFreshValueHex = function() {
    1650. return this.hV
    1651. }
    1652. }
    1653. ,
    1654. Fe.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object),
    1655. KJUR.asn1.DERAbstractStructured = function(t) {
    1656. KJUR.asn1.DERAbstractString.superclass.constructor.call(this);
    1657. this.setByASN1ObjectArray = function(t) {
    1658. this.hTLV = null,
    1659. this.isModified = !0,
    1660. this.asn1Array = t
    1661. }
    1662. ,
    1663. this.appendASN1Object = function(t) {
    1664. this.hTLV = null,
    1665. this.isModified = !0,
    1666. this.asn1Array.push(t)
    1667. }
    1668. ,
    1669. this.asn1Array = new Array,
    1670. "undefined" != typeof t && "undefined" != typeof t.array && (this.asn1Array = t.array)
    1671. }
    1672. ,
    1673. Fe.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object),
    1674. KJUR.asn1.DERBoolean = function() {
    1675. KJUR.asn1.DERBoolean.superclass.constructor.call(this),
    1676. this.hT = "01",
    1677. this.hTLV = "0101ff"
    1678. }
    1679. ,
    1680. Fe.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object),
    1681. KJUR.asn1.DERInteger = function(t) {
    1682. KJUR.asn1.DERInteger.superclass.constructor.call(this),
    1683. this.hT = "02",
    1684. this.setByBigInteger = function(t) {
    1685. this.hTLV = null,
    1686. this.isModified = !0,
    1687. this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)
    1688. }
    1689. ,
    1690. this.setByInteger = function(t) {
    1691. var e = new b(String(t),10);
    1692. this.setByBigInteger(e)
    1693. }
    1694. ,
    1695. this.setValueHex = function(t) {
    1696. this.hV = t
    1697. }
    1698. ,
    1699. this.getFreshValueHex = function() {
    1700. return this.hV
    1701. }
    1702. ,
    1703. "undefined" != typeof t && ("undefined" != typeof t.bigint ? this.setByBigInteger(t.bigint) : "undefined" != typeof t["int"] ? this.setByInteger(t["int"]) : "undefined" != typeof t.hex && this.setValueHex(t.hex))
    1704. }
    1705. ,
    1706. Fe.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object),
    1707. KJUR.asn1.DERBitString = function(t) {
    1708. KJUR.asn1.DERBitString.superclass.constructor.call(this),
    1709. this.hT = "03",
    1710. this.setHexValueIncludingUnusedBits = function(t) {
    1711. this.hTLV = null,
    1712. this.isModified = !0,
    1713. this.hV = t
    1714. }
    1715. ,
    1716. this.setUnusedBitsAndHexValue = function(t, e) {
    1717. if (0 > t || t > 7)
    1718. throw "unused bits shall be from 0 to 7: u = " + t;
    1719. var i = "0" + t;
    1720. this.hTLV = null,
    1721. this.isModified = !0,
    1722. this.hV = i + e
    1723. }
    1724. ,
    1725. this.setByBinaryString = function(t) {
    1726. t = t.replace(/0+$/, "");
    1727. var e = 8 - t.length % 8;
    1728. 8 == e && (e = 0);
    1729. for (var i = 0; e >= i; i++)
    1730. t += "0";
    1731. for (var s = "", i = 0; i < t.length - 1; i += 8) {
    1732. var n = t.substr(i, 8)
    1733. , r = parseInt(n, 2).toString(16);
    1734. 1 == r.length && (r = "0" + r),
    1735. s += r
    1736. }
    1737. this.hTLV = null,
    1738. this.isModified = !0,
    1739. this.hV = "0" + e + s
    1740. }
    1741. ,
    1742. this.setByBooleanArray = function(t) {
    1743. for (var e = "", i = 0; i < t.length; i++)
    1744. e += 1 == t[i] ? "1" : "0";
    1745. this.setByBinaryString(e)
    1746. }
    1747. ,
    1748. this.newFalseArray = function(t) {
    1749. for (var e = new Array(t), i = 0; t > i; i++)
    1750. e[i] = !1;
    1751. return e
    1752. }
    1753. ,
    1754. this.getFreshValueHex = function() {
    1755. return this.hV
    1756. }
    1757. ,
    1758. "undefined" != typeof t && ("undefined" != typeof t.hex ? this.setHexValueIncludingUnusedBits(t.hex) : "undefined" != typeof t.bin ? this.setByBinaryString(t.bin) : "undefined" != typeof t.array && this.setByBooleanArray(t.array))
    1759. }
    1760. ,
    1761. Fe.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object),
    1762. KJUR.asn1.DEROctetString = function(t) {
    1763. KJUR.asn1.DEROctetString.superclass.constructor.call(this, t),
    1764. this.hT = "04"
    1765. }
    1766. ,
    1767. Fe.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString),
    1768. KJUR.asn1.DERNull = function() {
    1769. KJUR.asn1.DERNull.superclass.constructor.call(this),
    1770. this.hT = "05",
    1771. this.hTLV = "0500"
    1772. }
    1773. ,
    1774. Fe.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object),
    1775. KJUR.asn1.DERObjectIdentifier = function(t) {
    1776. var c = function(t) {
    1777. var e = t.toString(16);
    1778. return 1 == e.length && (e = "0" + e),
    1779. e
    1780. }
    1781. , r = function(t) {
    1782. var e = ""
    1783. , i = new b(t,10)
    1784. , s = i.toString(2)
    1785. , n = 7 - s.length % 7;
    1786. 7 == n && (n = 0);
    1787. for (var r = "", o = 0; n > o; o++)
    1788. r += "0";
    1789. s = r + s;
    1790. for (var o = 0; o < s.length - 1; o += 7) {
    1791. var a = s.substr(o, 7);
    1792. o != s.length - 7 && (a = "1" + a),
    1793. e += c(parseInt(a, 2))
    1794. }
    1795. return e
    1796. };
    1797. KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this),
    1798. this.hT = "06",
    1799. this.setValueHex = function(t) {
    1800. this.hTLV = null,
    1801. this.isModified = !0,
    1802. this.s = null,
    1803. this.hV = t
    1804. }
    1805. ,
    1806. this.setValueOidString = function(t) {
    1807. if (!t.match(/^[0-9.]+$/))
    1808. throw "malformed oid string: " + t;
    1809. var e = ""
    1810. , i = t.split(".")
    1811. , s = 40 * parseInt(i[0]) + parseInt(i[1]);
    1812. e += c(s),
    1813. i.splice(0, 2);
    1814. for (var n = 0; n < i.length; n++)
    1815. e += r(i[n]);
    1816. this.hTLV = null,
    1817. this.isModified = !0,
    1818. this.s = null,
    1819. this.hV = e
    1820. }
    1821. ,
    1822. this.setValueName = function(t) {
    1823. if ("undefined" == typeof KJUR.asn1.x509.OID.name2oidList[t])
    1824. throw "DERObjectIdentifier oidName undefined: " + t;
    1825. var e = KJUR.asn1.x509.OID.name2oidList[t];
    1826. this.setValueOidString(e)
    1827. }
    1828. ,
    1829. this.getFreshValueHex = function() {
    1830. return this.hV
    1831. }
    1832. ,
    1833. "undefined" != typeof t && ("undefined" != typeof t.oid ? this.setValueOidString(t.oid) : "undefined" != typeof t.hex ? this.setValueHex(t.hex) : "undefined" != typeof t.name && this.setValueName(t.name))
    1834. }
    1835. ,
    1836. Fe.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object),
    1837. KJUR.asn1.DERUTF8String = function(t) {
    1838. KJUR.asn1.DERUTF8String.superclass.constructor.call(this, t),
    1839. this.hT = "0c"
    1840. }
    1841. ,
    1842. Fe.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString),
    1843. KJUR.asn1.DERNumericString = function(t) {
    1844. KJUR.asn1.DERNumericString.superclass.constructor.call(this, t),
    1845. this.hT = "12"
    1846. }
    1847. ,
    1848. Fe.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString),
    1849. KJUR.asn1.DERPrintableString = function(t) {
    1850. KJUR.asn1.DERPrintableString.superclass.constructor.call(this, t),
    1851. this.hT = "13"
    1852. }
    1853. ,
    1854. Fe.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString),
    1855. KJUR.asn1.DERTeletexString = function(t) {
    1856. KJUR.asn1.DERTeletexString.superclass.constructor.call(this, t),
    1857. this.hT = "14"
    1858. }
    1859. ,
    1860. Fe.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString),
    1861. KJUR.asn1.DERIA5String = function(t) {
    1862. KJUR.asn1.DERIA5String.superclass.constructor.call(this, t),
    1863. this.hT = "16"
    1864. }
    1865. ,
    1866. Fe.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString),
    1867. KJUR.asn1.DERUTCTime = function(t) {
    1868. KJUR.asn1.DERUTCTime.superclass.constructor.call(this, t),
    1869. this.hT = "17",
    1870. this.setByDate = function(t) {
    1871. this.hTLV = null,
    1872. this.isModified = !0,
    1873. this.date = t,
    1874. this.s = this.formatDate(this.date, "utc"),
    1875. this.hV = stohex(this.s)
    1876. }
    1877. ,
    1878. "undefined" != typeof t && ("undefined" != typeof t.str ? this.setString(t.str) : "undefined" != typeof t.hex ? this.setStringHex(t.hex) : "undefined" != typeof t.date && this.setByDate(t.date))
    1879. }
    1880. ,
    1881. Fe.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime),
    1882. KJUR.asn1.DERGeneralizedTime = function(t) {
    1883. KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, t),
    1884. this.hT = "18",
    1885. this.setByDate = function(t) {
    1886. this.hTLV = null,
    1887. this.isModified = !0,
    1888. this.date = t,
    1889. this.s = this.formatDate(this.date, "gen"),
    1890. this.hV = stohex(this.s)
    1891. }
    1892. ,
    1893. "undefined" != typeof t && ("undefined" != typeof t.str ? this.setString(t.str) : "undefined" != typeof t.hex ? this.setStringHex(t.hex) : "undefined" != typeof t.date && this.setByDate(t.date))
    1894. }
    1895. ,
    1896. Fe.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime),
    1897. KJUR.asn1.DERSequence = function(t) {
    1898. KJUR.asn1.DERSequence.superclass.constructor.call(this, t),
    1899. this.hT = "30",
    1900. this.getFreshValueHex = function() {
    1901. for (var t = "", e = 0; e < this.asn1Array.length; e++) {
    1902. var i = this.asn1Array[e];
    1903. t += i.getEncodedHex()
    1904. }
    1905. return this.hV = t,
    1906. this.hV
    1907. }
    1908. }
    1909. ,
    1910. Fe.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured),
    1911. KJUR.asn1.DERSet = function(t) {
    1912. KJUR.asn1.DERSet.superclass.constructor.call(this, t),
    1913. this.hT = "31",
    1914. this.getFreshValueHex = function() {
    1915. for (var t = new Array, e = 0; e < this.asn1Array.length; e++) {
    1916. var i = this.asn1Array[e];
    1917. t.push(i.getEncodedHex())
    1918. }
    1919. return t.sort(),
    1920. this.hV = t.join(""),
    1921. this.hV
    1922. }
    1923. }
    1924. ,
    1925. Fe.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured),
    1926. KJUR.asn1.DERTaggedObject = function(t) {
    1927. KJUR.asn1.DERTaggedObject.superclass.constructor.call(this),
    1928. this.hT = "a0",
    1929. this.hV = "",
    1930. this.isExplicit = !0,
    1931. this.asn1Object = null,
    1932. this.setASN1Object = function(t, e, i) {
    1933. this.hT = e,
    1934. this.isExplicit = t,
    1935. this.asn1Object = i,
    1936. this.isExplicit ? (this.hV = this.asn1Object.getEncodedHex(),
    1937. this.hTLV = null,
    1938. this.isModified = !0) : (this.hV = null,
    1939. this.hTLV = i.getEncodedHex(),
    1940. this.hTLV = this.hTLV.replace(/^../, e),
    1941. this.isModified = !1)
    1942. }
    1943. ,
    1944. this.getFreshValueHex = function() {
    1945. return this.hV
    1946. }
    1947. ,
    1948. "undefined" != typeof t && ("undefined" != typeof t.tag && (this.hT = t.tag),
    1949. "undefined" != typeof t.explicit && (this.isExplicit = t.explicit),
    1950. "undefined" != typeof t.obj && (this.asn1Object = t.obj,
    1951. this.setASN1Object(this.isExplicit, this.hT, this.asn1Object)))
    1952. }
    1953. ,
    1954. Fe.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object),
    1955. function(c) {
    1956. "use strict";
    1957. var l, t = {};
    1958. t.decode = function(t) {
    1959. var e;
    1960. if (l === c) {
    1961. var i = "0123456789ABCDEF"
    1962. , s = " \f\n\r  \u2028\u2029";
    1963. for (l = [],
    1964. e = 0; 16 > e; ++e)
    1965. l[i.charAt(e)] = e;
    1966. for (i = i.toLowerCase(),
    1967. e = 10; 16 > e; ++e)
    1968. l[i.charAt(e)] = e;
    1969. for (e = 0; e < s.length; ++e)
    1970. l[s.charAt(e)] = -1
    1971. }
    1972. var n = []
    1973. , r = 0
    1974. , o = 0;
    1975. for (e = 0; e < t.length; ++e) {
    1976. var a = t.charAt(e);
    1977. if ("=" == a)
    1978. break;
    1979. if (a = l[a],
    1980. -1 != a) {
    1981. if (a === c)
    1982. throw "Illegal character at offset " + e;
    1983. r |= a,
    1984. ++o >= 2 ? (n[n.length] = r,
    1985. r = 0,
    1986. o = 0) : r <<= 4
    1987. }
    1988. }
    1989. if (o)
    1990. throw "Hex encoding incomplete: 4 bits missing";
    1991. return n
    1992. }
    1993. ,
    1994. window.Hex = t
    1995. }(),
    1996. function(c) {
    1997. "use strict";
    1998. var l, i = {};
    1999. i.decode = function(t) {
    2000. var e;
    2001. if (l === c) {
    2002. var i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
    2003. , s = "= \f\n\r  \u2028\u2029";
    2004. for (l = [],
    2005. e = 0; 64 > e; ++e)
    2006. l[i.charAt(e)] = e;
    2007. for (e = 0; e < s.length; ++e)
    2008. l[s.charAt(e)] = -1
    2009. }
    2010. var n = []
    2011. , r = 0
    2012. , o = 0;
    2013. for (e = 0; e < t.length; ++e) {
    2014. var a = t.charAt(e);
    2015. if ("=" == a)
    2016. break;
    2017. if (a = l[a],
    2018. -1 != a) {
    2019. if (a === c)
    2020. throw "Illegal character at offset " + e;
    2021. r |= a,
    2022. ++o >= 4 ? (n[n.length] = r >> 16,
    2023. n[n.length] = r >> 8 & 255,
    2024. n[n.length] = 255 & r,
    2025. r = 0,
    2026. o = 0) : r <<= 6
    2027. }
    2028. }
    2029. switch (o) {
    2030. case 1:
    2031. throw "Base64 encoding incomplete: at least 2 bits missing";
    2032. case 2:
    2033. n[n.length] = r >> 10;
    2034. break;
    2035. case 3:
    2036. n[n.length] = r >> 16,
    2037. n[n.length] = r >> 8 & 255
    2038. }
    2039. return n
    2040. }
    2041. ,
    2042. i.re = /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,
    2043. i.unarmor = function(t) {
    2044. var e = i.re.exec(t);
    2045. if (e)
    2046. if (e[1])
    2047. t = e[1];
    2048. else {
    2049. if (!e[2])
    2050. throw "RegExp out of sync";
    2051. t = e[2]
    2052. }
    2053. return i.decode(t)
    2054. }
    2055. ,
    2056. window.Base64 = i
    2057. }(),
    2058. function(o) {
    2059. "use strict";
    2060. function l(t, e) {
    2061. t instanceof l ? (this.enc = t.enc,
    2062. this.pos = t.pos) : (this.enc = t,
    2063. this.pos = e)
    2064. }
    2065. function u(t, e, i, s, n) {
    2066. this.stream = t,
    2067. this.header = e,
    2068. this.length = i,
    2069. this.tag = s,
    2070. this.sub = n
    2071. }
    2072. var r = 100
    2073. , a = "…"
    2074. , d = {
    2075. tag: function(t, e) {},
    2076. text: function(t) {}
    2077. };
    2078. l.prototype.get = function(t) {
    2079. if (t === o && (t = this.pos++),
    2080. t >= this.enc.length)
    2081. throw "Requesting byte offset " + t + " on a stream of length " + this.enc.length;
    2082. return this.enc[t]
    2083. }
    2084. ,
    2085. l.prototype.hexDigits = "0123456789ABCDEF",
    2086. l.prototype.hexByte = function(t) {
    2087. return this.hexDigits.charAt(t >> 4 & 15) + this.hexDigits.charAt(15 & t)
    2088. }
    2089. ,
    2090. l.prototype.hexDump = function(t, e, i) {
    2091. for (var s = "", n = t; e > n; ++n)
    2092. if (s += this.hexByte(this.get(n)),
    2093. i !== !0)
    2094. switch (15 & n) {
    2095. case 7:
    2096. s += " ";
    2097. break;
    2098. case 15:
    2099. s += "\n";
    2100. break;
    2101. default:
    2102. s += " "
    2103. }
    2104. return s
    2105. }
    2106. ,
    2107. l.prototype.parseStringISO = function(t, e) {
    2108. for (var i = "", s = t; e > s; ++s)
    2109. i += String.fromCharCode(this.get(s));
    2110. return i
    2111. }
    2112. ,
    2113. l.prototype.parseStringUTF = function(t, e) {
    2114. for (var i = "", s = t; e > s; ) {
    2115. var n = this.get(s++);
    2116. i += 128 > n ? String.fromCharCode(n) : n > 191 && 224 > n ? String.fromCharCode((31 & n) << 6 | 63 & this.get(s++)) : String.fromCharCode((15 & n) << 12 | (63 & this.get(s++)) << 6 | 63 & this.get(s++))
    2117. }
    2118. return i
    2119. }
    2120. ,
    2121. l.prototype.parseStringBMP = function(t, e) {
    2122. for (var i = "", s = t; e > s; s += 2) {
    2123. var n = this.get(s)
    2124. , r = this.get(s + 1);
    2125. i += String.fromCharCode((n << 8) + r)
    2126. }
    2127. return i
    2128. }
    2129. ,
    2130. l.prototype.reTime = /^((?:1[89]|2\d)?\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,
    2131. l.prototype.parseTime = function(t, e) {
    2132. var i = this.parseStringISO(t, e)
    2133. , s = this.reTime.exec(i);
    2134. return s ? (i = s[1] + "-" + s[2] + "-" + s[3] + " " + s[4],
    2135. s[5] && (i += ":" + s[5],
    2136. s[6] && (i += ":" + s[6],
    2137. s[7] && (i += "." + s[7]))),
    2138. s[8] && (i += " UTC",
    2139. "Z" != s[8] && (i += s[8],
    2140. s[9] && (i += ":" + s[9]))),
    2141. i) : "Unrecognized time: " + i
    2142. }
    2143. ,
    2144. l.prototype.parseInteger = function(t, e) {
    2145. var i = e - t;
    2146. if (i > 4) {
    2147. i <<= 3;
    2148. var s = this.get(t);
    2149. if (0 === s)
    2150. i -= 8;
    2151. else
    2152. for (; 128 > s; )
    2153. s <<= 1,
    2154. --i;
    2155. return "(" + i + " bit)"
    2156. }
    2157. for (var n = 0, r = t; e > r; ++r)
    2158. n = n << 8 | this.get(r);
    2159. return n
    2160. }
    2161. ,
    2162. l.prototype.parseBitString = function(t, e) {
    2163. var i = this.get(t)
    2164. , s = (e - t - 1 << 3) - i
    2165. , n = "(" + s + " bit)";
    2166. if (20 >= s) {
    2167. var r = i;
    2168. n += " ";
    2169. for (var o = e - 1; o > t; --o) {
    2170. for (var a = this.get(o), c = r; 8 > c; ++c)
    2171. n += a >> c & 1 ? "1" : "0";
    2172. r = 0
    2173. }
    2174. }
    2175. return n
    2176. }
    2177. ,
    2178. l.prototype.parseOctetString = function(t, e) {
    2179. var i = e - t
    2180. , s = "(" + i + " byte) ";
    2181. i > r && (e = t + r);
    2182. for (var n = t; e > n; ++n)
    2183. s += this.hexByte(this.get(n));
    2184. return i > r && (s += a),
    2185. s
    2186. }
    2187. ,
    2188. l.prototype.parseOID = function(t, e) {
    2189. for (var i = "", s = 0, n = 0, r = t; e > r; ++r) {
    2190. var o = this.get(r);
    2191. if (s = s << 7 | 127 & o,
    2192. n += 7,
    2193. !(128 & o)) {
    2194. if ("" === i) {
    2195. var a = 80 > s ? 40 > s ? 0 : 1 : 2;
    2196. i = a + "." + (s - 40 * a)
    2197. } else
    2198. i += "." + (n >= 31 ? "bigint" : s);
    2199. s = n = 0
    2200. }
    2201. }
    2202. return i
    2203. }
    2204. ,
    2205. u.prototype.typeName = function() {
    2206. if (this.tag === o)
    2207. return "unknown";
    2208. var t = this.tag >> 6
    2209. , e = (this.tag >> 5 & 1,
    2210. 31 & this.tag);
    2211. switch (t) {
    2212. case 0:
    2213. switch (e) {
    2214. case 0:
    2215. return "EOC";
    2216. case 1:
    2217. return "BOOLEAN";
    2218. case 2:
    2219. return "INTEGER";
    2220. case 3:
    2221. return "BIT_STRING";
    2222. case 4:
    2223. return "OCTET_STRING";
    2224. case 5:
    2225. return "NULL";
    2226. case 6:
    2227. return "OBJECT_IDENTIFIER";
    2228. case 7:
    2229. return "ObjectDescriptor";
    2230. case 8:
    2231. return "EXTERNAL";
    2232. case 9:
    2233. return "REAL";
    2234. case 10:
    2235. return "ENUMERATED";
    2236. case 11:
    2237. return "EMBEDDED_PDV";
    2238. case 12:
    2239. return "UTF8String";
    2240. case 16:
    2241. return "SEQUENCE";
    2242. case 17:
    2243. return "SET";
    2244. case 18:
    2245. return "NumericString";
    2246. case 19:
    2247. return "PrintableString";
    2248. case 20:
    2249. return "TeletexString";
    2250. case 21:
    2251. return "VideotexString";
    2252. case 22:
    2253. return "IA5String";
    2254. case 23:
    2255. return "UTCTime";
    2256. case 24:
    2257. return "GeneralizedTime";
    2258. case 25:
    2259. return "GraphicString";
    2260. case 26:
    2261. return "VisibleString";
    2262. case 27:
    2263. return "GeneralString";
    2264. case 28:
    2265. return "UniversalString";
    2266. case 30:
    2267. return "BMPString";
    2268. default:
    2269. return "Universal_" + e.toString(16)
    2270. }
    2271. case 1:
    2272. return "Application_" + e.toString(16);
    2273. case 2:
    2274. return "[" + e + "]";
    2275. case 3:
    2276. return "Private_" + e.toString(16)
    2277. }
    2278. }
    2279. ,
    2280. u.prototype.reSeemsASCII = /^[ -~]+$/,
    2281. u.prototype.content = function() {
    2282. if (this.tag === o)
    2283. return null;
    2284. var t = this.tag >> 6
    2285. , e = 31 & this.tag
    2286. , i = this.posContent()
    2287. , s = Math.abs(this.length);
    2288. if (0 !== t) {
    2289. if (null !== this.sub)
    2290. return "(" + this.sub.length + " elem)";
    2291. var n = this.stream.parseStringISO(i, i + Math.min(s, r));
    2292. return this.reSeemsASCII.test(n) ? n.substring(0, 2 * r) + (n.length > 2 * r ? a : "") : this.stream.parseOctetString(i, i + s)
    2293. }
    2294. switch (e) {
    2295. case 1:
    2296. return 0 === this.stream.get(i) ? "false" : "true";
    2297. case 2:
    2298. return this.stream.parseInteger(i, i + s);
    2299. case 3:
    2300. return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseBitString(i, i + s);
    2301. case 4:
    2302. return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(i, i + s);
    2303. case 6:
    2304. return this.stream.parseOID(i, i + s);
    2305. case 16:
    2306. case 17:
    2307. return "(" + this.sub.length + " elem)";
    2308. case 12:
    2309. return this.stream.parseStringUTF(i, i + s);
    2310. case 18:
    2311. case 19:
    2312. case 20:
    2313. case 21:
    2314. case 22:
    2315. case 26:
    2316. return this.stream.parseStringISO(i, i + s);
    2317. case 30:
    2318. return this.stream.parseStringBMP(i, i + s);
    2319. case 23:
    2320. case 24:
    2321. return this.stream.parseTime(i, i + s)
    2322. }
    2323. return null
    2324. }
    2325. ,
    2326. u.prototype.toString = function() {
    2327. return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (null === this.sub ? "null" : this.sub.length) + "]"
    2328. }
    2329. ,
    2330. u.prototype.print = function(t) {
    2331. if (t === o && (t = ""),
    2332. null !== this.sub) {
    2333. t += " ";
    2334. for (var e = 0, i = this.sub.length; i > e; ++e)
    2335. this.sub[e].print(t)
    2336. }
    2337. }
    2338. ,
    2339. u.prototype.toPrettyString = function(t) {
    2340. t === o && (t = "");
    2341. var e = t + this.typeName() + " @" + this.stream.pos;
    2342. if (this.length >= 0 && (e += "+"),
    2343. e += this.length,
    2344. 32 & this.tag ? e += " (constructed)" : 3 != this.tag && 4 != this.tag || null === this.sub || (e += " (encapsulates)"),
    2345. e += "\n",
    2346. null !== this.sub) {
    2347. t += " ";
    2348. for (var i = 0, s = this.sub.length; s > i; ++i)
    2349. e += this.sub[i].toPrettyString(t)
    2350. }
    2351. return e
    2352. }
    2353. ,
    2354. u.prototype.toDOM = function() {
    2355. var t = d.tag("div", "node");
    2356. t.asn1 = this;
    2357. var e = d.tag("div", "head")
    2358. , i = this.typeName().replace(/_/g, " ");
    2359. e.innerHTML = i;
    2360. var s = this.content();
    2361. if (null !== s) {
    2362. s = String(s).replace(/, "<");
    2363. var n = d.tag("span", "preview");
    2364. n.appendChild(d.text(s)),
    2365. e.appendChild(n)
    2366. }
    2367. t.appendChild(e),
    2368. this.node = t,
    2369. this.head = e;
    2370. var r = d.tag("div", "value");
    2371. if (i = "Offset: " + this.stream.pos + "
      "
      ,
    2372. i += "Length: " + this.header + "+",
    2373. i += this.length >= 0 ? this.length : -this.length + " (undefined)",
    2374. 32 & this.tag ? i += "
      (constructed)"
      : 3 != this.tag && 4 != this.tag || null === this.sub || (i += "
      (encapsulates)"
      ),
    2375. null !== s && (i += "
      Value:
      "
      + s + "",
    2376. "object" == typeof oids && 6 == this.tag)) {
    2377. var o = oids[s];
    2378. o && (o.d && (i += "
      "
      + o.d),
    2379. o.c && (i += "
      "
      + o.c),
    2380. o.w && (i += "
      (warning!)"
      ))
    2381. }
    2382. r.innerHTML = i,
    2383. t.appendChild(r);
    2384. var a = d.tag("div", "sub");
    2385. if (null !== this.sub)
    2386. for (var c = 0, l = this.sub.length; l > c; ++c)
    2387. a.appendChild(this.sub[c].toDOM());
    2388. return t.appendChild(a),
    2389. e.onclick = function() {
    2390. t.className = "node collapsed" == t.className ? "node" : "node collapsed"
    2391. }
    2392. ,
    2393. t
    2394. }
    2395. ,
    2396. u.prototype.posStart = function() {
    2397. return this.stream.pos
    2398. }
    2399. ,
    2400. u.prototype.posContent = function() {
    2401. return this.stream.pos + this.header
    2402. }
    2403. ,
    2404. u.prototype.posEnd = function() {
    2405. return this.stream.pos + this.header + Math.abs(this.length)
    2406. }
    2407. ,
    2408. u.prototype.fakeHover = function(t) {
    2409. this.node.className += " hover",
    2410. t && (this.head.className += " hover")
    2411. }
    2412. ,
    2413. u.prototype.fakeOut = function(t) {
    2414. var e = / ?hover/;
    2415. this.node.className = this.node.className.replace(e, ""),
    2416. t && (this.head.className = this.head.className.replace(e, ""))
    2417. }
    2418. ,
    2419. u.prototype.toHexDOM_sub = function(t, e, i, s, n) {
    2420. if (!(s >= n)) {
    2421. var r = d.tag("span", e);
    2422. r.appendChild(d.text(i.hexDump(s, n))),
    2423. t.appendChild(r)
    2424. }
    2425. }
    2426. ,
    2427. u.prototype.toHexDOM = function(e) {
    2428. var t = d.tag("span", "hex");
    2429. if (e === o && (e = t),
    2430. this.head.hexNode = t,
    2431. this.head.onmouseover = function() {
    2432. this.hexNode.className = "hexCurrent"
    2433. }
    2434. ,
    2435. this.head.onmouseout = function() {
    2436. this.hexNode.className = "hex"
    2437. }
    2438. ,
    2439. t.asn1 = this,
    2440. t.onmouseover = function() {
    2441. var t = !e.selected;
    2442. t && (e.selected = this.asn1,
    2443. this.className = "hexCurrent"),
    2444. this.asn1.fakeHover(t)
    2445. }
    2446. ,
    2447. t.onmouseout = function() {
    2448. var t = e.selected == this.asn1;
    2449. this.asn1.fakeOut(t),
    2450. t && (e.selected = null,
    2451. this.className = "hex")
    2452. }
    2453. ,
    2454. this.toHexDOM_sub(t, "tag", this.stream, this.posStart(), this.posStart() + 1),
    2455. this.toHexDOM_sub(t, this.length >= 0 ? "dlen" : "ulen", this.stream, this.posStart() + 1, this.posContent()),
    2456. null === this.sub)
    2457. t.appendChild(d.text(this.stream.hexDump(this.posContent(), this.posEnd())));
    2458. else if (this.sub.length > 0) {
    2459. var i = this.sub[0]
    2460. , s = this.sub[this.sub.length - 1];
    2461. this.toHexDOM_sub(t, "intro", this.stream, this.posContent(), i.posStart());
    2462. for (var n = 0, r = this.sub.length; r > n; ++n)
    2463. t.appendChild(this.sub[n].toHexDOM(e));
    2464. this.toHexDOM_sub(t, "outro", this.stream, s.posEnd(), this.posEnd())
    2465. }
    2466. return t
    2467. }
    2468. ,
    2469. u.prototype.toHexString = function(t) {
    2470. return this.stream.hexDump(this.posStart(), this.posEnd(), !0)
    2471. }
    2472. ,
    2473. u.decodeLength = function(t) {
    2474. var e = t.get()
    2475. , i = 127 & e;
    2476. if (i == e)
    2477. return i;
    2478. if (i > 3)
    2479. throw "Length over 24 bits not supported at position " + (t.pos - 1);
    2480. if (0 === i)
    2481. return -1;
    2482. e = 0;
    2483. for (var s = 0; i > s; ++s)
    2484. e = e << 8 | t.get();
    2485. return e
    2486. }
    2487. ,
    2488. u.hasContent = function(t, e, i) {
    2489. if (32 & t)
    2490. return !0;
    2491. if (3 > t || t > 4)
    2492. return !1;
    2493. var s = new l(i);
    2494. 3 == t && s.get();
    2495. var n = s.get();
    2496. if (n >> 6 & 1)
    2497. return !1;
    2498. try {
    2499. var r = u.decodeLength(s);
    2500. return s.pos - i.pos + r == e
    2501. } catch (p) {
    2502. return !1
    2503. }
    2504. }
    2505. ,
    2506. u.decode = function(t) {
    2507. t instanceof l || (t = new l(t,0));
    2508. var e = new l(t)
    2509. , i = t.get()
    2510. , s = u.decodeLength(t)
    2511. , n = t.pos - e.pos
    2512. , r = null;
    2513. if (u.hasContent(i, s, t)) {
    2514. var o = t.pos;
    2515. if (3 == i && t.get(),
    2516. r = [],
    2517. s >= 0) {
    2518. for (var a = o + s; t.pos < a; )
    2519. r[r.length] = u.decode(t);
    2520. if (t.pos != a)
    2521. throw "Content size is not correct for container starting at offset " + o
    2522. } else
    2523. try {
    2524. for (; ; ) {
    2525. var c = u.decode(t);
    2526. if (0 === c.tag)
    2527. break;
    2528. r[r.length] = c
    2529. }
    2530. s = o - t.pos
    2531. } catch (h) {
    2532. throw "Exception while decoding undefined length content: " + h
    2533. }
    2534. } else
    2535. t.pos += s;
    2536. return new u(e,n,s,i,r)
    2537. }
    2538. ,
    2539. u.test = function() {
    2540. for (var t = [{
    2541. value: [39],
    2542. expected: 39
    2543. }, {
    2544. value: [129, 201],
    2545. expected: 201
    2546. }, {
    2547. value: [131, 254, 220, 186],
    2548. expected: 16702650
    2549. }], e = 0, i = t.length; i > e; ++e) {
    2550. var s = new l(t[e].value,0)
    2551. , n = u.decodeLength(s);
    2552. }
    2553. }
    2554. ,
    2555. window.ASN1 = u
    2556. }(),
    2557. ASN1.prototype.getHexStringValue = function() {
    2558. var t = this.toHexString()
    2559. , e = 2 * this.header
    2560. , i = 2 * this.length;
    2561. return t.substr(e, i)
    2562. }
    2563. ,
    2564. le.prototype.parseKey = function(t) {
    2565. try {
    2566. var e = 0
    2567. , i = 0
    2568. , s = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/
    2569. , n = s.test(t) ? Hex.decode(t) : Base64.unarmor(t)
    2570. , r = ASN1.decode(n);
    2571. if (3 === r.sub.length && (r = r.sub[2].sub[0]),
    2572. 9 === r.sub.length) {
    2573. e = r.sub[1].getHexStringValue(),
    2574. this.n = ae(e, 16),
    2575. i = r.sub[2].getHexStringValue(),
    2576. this.e = parseInt(i, 16);
    2577. var o = r.sub[3].getHexStringValue();
    2578. this.d = ae(o, 16);
    2579. var a = r.sub[4].getHexStringValue();
    2580. this.p = ae(a, 16);
    2581. var c = r.sub[5].getHexStringValue();
    2582. this.q = ae(c, 16);
    2583. var l = r.sub[6].getHexStringValue();
    2584. this.dmp1 = ae(l, 16);
    2585. var u = r.sub[7].getHexStringValue();
    2586. this.dmq1 = ae(u, 16);
    2587. var d = r.sub[8].getHexStringValue();
    2588. this.coeff = ae(d, 16)
    2589. } else {
    2590. if (2 !== r.sub.length)
    2591. return !1;
    2592. var p = r.sub[1]
    2593. , h = p.sub[0];
    2594. e = h.sub[0].getHexStringValue(),
    2595. this.n = ae(e, 16),
    2596. i = h.sub[1].getHexStringValue(),
    2597. this.e = parseInt(i, 16)
    2598. }
    2599. return !0
    2600. } catch (f) {
    2601. return !1
    2602. }
    2603. }
    2604. ,
    2605. le.prototype.getPrivateBaseKey = function() {
    2606. var t = {
    2607. array: [new KJUR.asn1.DERInteger({
    2608. "int": 0
    2609. }), new KJUR.asn1.DERInteger({
    2610. bigint: this.n
    2611. }), new KJUR.asn1.DERInteger({
    2612. "int": this.e
    2613. }), new KJUR.asn1.DERInteger({
    2614. bigint: this.d
    2615. }), new KJUR.asn1.DERInteger({
    2616. bigint: this.p
    2617. }), new KJUR.asn1.DERInteger({
    2618. bigint: this.q
    2619. }), new KJUR.asn1.DERInteger({
    2620. bigint: this.dmp1
    2621. }), new KJUR.asn1.DERInteger({
    2622. bigint: this.dmq1
    2623. }), new KJUR.asn1.DERInteger({
    2624. bigint: this.coeff
    2625. })]
    2626. }
    2627. , e = new KJUR.asn1.DERSequence(t);
    2628. return e.getEncodedHex()
    2629. }
    2630. ,
    2631. le.prototype.getPrivateBaseKeyB64 = function() {
    2632. return be(this.getPrivateBaseKey())
    2633. }
    2634. ,
    2635. le.prototype.getPublicBaseKey = function() {
    2636. var t = {
    2637. array: [new KJUR.asn1.DERObjectIdentifier({
    2638. oid: "1.2.840.113549.1.1.1"
    2639. }), new KJUR.asn1.DERNull]
    2640. }
    2641. , e = new KJUR.asn1.DERSequence(t);
    2642. t = {
    2643. array: [new KJUR.asn1.DERInteger({
    2644. bigint: this.n
    2645. }), new KJUR.asn1.DERInteger({
    2646. "int": this.e
    2647. })]
    2648. };
    2649. var i = new KJUR.asn1.DERSequence(t);
    2650. t = {
    2651. hex: "00" + i.getEncodedHex()
    2652. };
    2653. var s = new KJUR.asn1.DERBitString(t);
    2654. t = {
    2655. array: [e, s]
    2656. };
    2657. var n = new KJUR.asn1.DERSequence(t);
    2658. return n.getEncodedHex()
    2659. }
    2660. ,
    2661. le.prototype.getPublicBaseKeyB64 = function() {
    2662. return be(this.getPublicBaseKey())
    2663. }
    2664. ,
    2665. le.prototype.wordwrap = function(t, e) {
    2666. if (e = e || 64,
    2667. !t)
    2668. return t;
    2669. var i = "(.{1," + e + "})( +|$\n?)|(.{1," + e + "})";
    2670. return t.match(RegExp(i, "g")).join("\n")
    2671. }
    2672. ,
    2673. le.prototype.getPrivateKey = function() {
    2674. var t = "-----BEGIN RSA PRIVATE KEY-----\n";
    2675. return t += this.wordwrap(this.getPrivateBaseKeyB64()) + "\n",
    2676. t += "-----END RSA PRIVATE KEY-----"
    2677. }
    2678. ,
    2679. le.prototype.getPublicKey = function() {
    2680. var t = "-----BEGIN PUBLIC KEY-----\n";
    2681. return t += this.wordwrap(this.getPublicBaseKeyB64()) + "\n",
    2682. t += "-----END PUBLIC KEY-----"
    2683. }
    2684. ,
    2685. le.prototype.hasPublicKeyProperty = function(t) {
    2686. return t = t || {},
    2687. t.hasOwnProperty("n") && t.hasOwnProperty("e")
    2688. }
    2689. ,
    2690. le.prototype.hasPrivateKeyProperty = function(t) {
    2691. return t = t || {},
    2692. t.hasOwnProperty("n") && t.hasOwnProperty("e") && t.hasOwnProperty("d") && t.hasOwnProperty("p") && t.hasOwnProperty("q") && t.hasOwnProperty("dmp1") && t.hasOwnProperty("dmq1") && t.hasOwnProperty("coeff")
    2693. }
    2694. ,
    2695. le.prototype.parsePropertiesFrom = function(t) {
    2696. this.n = t.n,
    2697. this.e = t.e,
    2698. t.hasOwnProperty("d") && (this.d = t.d,
    2699. this.p = t.p,
    2700. this.q = t.q,
    2701. this.dmp1 = t.dmp1,
    2702. this.dmq1 = t.dmq1,
    2703. this.coeff = t.coeff)
    2704. }
    2705. ;
    2706. var qe = function(t) {
    2707. le.call(this),
    2708. t && ("string" == typeof t ? this.parseKey(t) : (this.hasPrivateKeyProperty(t) || this.hasPublicKeyProperty(t)) && this.parsePropertiesFrom(t))
    2709. };
    2710. (qe.prototype = new le).constructor = qe;
    2711. var He = function(t) {
    2712. t = t || {},
    2713. this.default_key_size = parseInt(t.default_key_size) || 1024,
    2714. this.default_public_exponent = t.default_public_exponent || "010001",
    2715. this.log = t.log || !1,
    2716. this.key = null
    2717. };
    2718. He.prototype.setKey = function(t) {
    2719. this.log && this.key && console.warn("A key was already set, overriding existing."),
    2720. this.key = new qe(t)
    2721. }
    2722. ,
    2723. He.prototype.setPrivateKey = function(t) {
    2724. this.setKey(t)
    2725. }
    2726. ,
    2727. He.prototype.setPublicKey = function(t) {
    2728. this.setKey(t)
    2729. }
    2730. ,
    2731. He.prototype.decrypt = function(t) {
    2732. try {
    2733. return this.getKey().decrypt(ye(t))
    2734. } catch (b) {
    2735. return !1
    2736. }
    2737. }
    2738. ,
    2739. He.prototype.encrypt = function(t) {
    2740. try {
    2741. return be(this.getKey().encrypt(t))
    2742. } catch (b) {
    2743. return !1
    2744. }
    2745. }
    2746. ,
    2747. He.prototype.getKey = function(t) {
    2748. if (!this.key) {
    2749. if (this.key = new qe,
    2750. t && "[object Function]" === {}.toString.call(t))
    2751. return void this.key.generateAsync(this.default_key_size, this.default_public_exponent, t);
    2752. this.key.generate(this.default_key_size, this.default_public_exponent)
    2753. }
    2754. return this.key
    2755. }
    2756. ,
    2757. He.prototype.getPrivateKey = function() {
    2758. return this.getKey().getPrivateKey()
    2759. }
    2760. ,
    2761. He.prototype.getPrivateKeyB64 = function() {
    2762. return this.getKey().getPrivateBaseKeyB64()
    2763. }
    2764. ,
    2765. He.prototype.getPublicKey = function() {
    2766. return this.getKey().getPublicKey()
    2767. }
    2768. ,
    2769. He.prototype.getPublicKeyB64 = function() {
    2770. return this.getKey().getPublicBaseKeyB64()
    2771. }
    2772. ,
    2773. He.version = "2.3.1",
    2774. t.JSEncrypt = He
    2775. }
    2776. ) ? s.apply(e, n) : s) === undefined || (i.exports = r)
    2777. }
    2778. .call(e, i, e, t)) === undefined || (t.exports = r)
    2779. },
    2780. jsencrypt: function(t, e, r) {
    2781. var i;
    2782. (i = function(t, e, i) {
    2783. var s = r("encrypt");
    2784. function n() {
    2785. void 0 !== s && (this.jsencrypt = new s.JSEncrypt,
    2786. this.jsencrypt.setPublicKey("-----BEGIN PUBLIC KEY-----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDq04c6My441Gj0UFKgrqUhAUg+kQZeUeWSPlAU9fr4HBPDldAeqzx1UR99KJHuQh/zs1HOamE2dgX9z/2oXcJaqoRIA/FXysx+z2YlJkSk8XQLcQ8EBOkp//MZrixam7lCYpNOjadQBb2Ot0U/Ky+jF2p+Ie8gSZ7/u+Wnr5grywIDAQAB-----END PUBLIC KEY-----"))
    2787. }
    2788. n.prototype.encode = function(t, e) {
    2789. var i = e ? e + "|" + t : t;
    2790. return encodeURIComponent(this.jsencrypt.encrypt(i))
    2791. }
    2792. ,
    2793. i.exports = n
    2794. }
    2795. .call(e, r, e, t)) === undefined || (t.exports = i)
    2796. }
    2797. });
    2798. function z(pwd, time) {
    2799. var n = _n("jsencrypt");
    2800. var g = (new n);
    2801. var r = g.encode(pwd, time);
    2802. return r;
    2803. }
    2804. // timestamp = Date.parse(new Date());
    2805. // console.log(z(timestamp, 3))

    运行结果,成功加密获取 m 值,其值动态变化:

    若报错: ReferenceError: ASN1 is not defined ,说明缺了 ASN1,ASN1是一个 JS 解码器,可以解码任何有效的 Base64 编码或十六进制编码的 DER 或 BER 结构,一般浏览器会内置,大部分 js 调试器是没有的吗,可以在浏览器调试或者其他调试工具运行。

    python 代码

    sessionid 要改为自己的: 

    1. import re
    2. import time
    3. import subprocess
    4. from functools import partial
    5. subprocess.Popen = partial(subprocess.Popen, encoding="utf-8")
    6. import execjs
    7. import requests
    8. headers = {
    9. "user-agent": "yuanrenxue,project",
    10. "cookie": "sessionid = your sessionid "
    11. }
    12. timestamp = str(int(time.time() * 1000))
    13. def main():
    14. bonus = 0
    15. total = 0
    16. for page_num in range(1, 6):
    17. url = "https://match.yuanrenxue.com/api/match/6?page=%s" % page_num
    18. page = page_num
    19. with open('yrx6.js', 'r', encoding='utf-8') as f:
    20. m_content = f.read()
    21. m = execjs.compile(m_content).call('z', timestamp, page)
    22. q = '%d-%s|' % (page, timestamp)
    23. params = {
    24. "m": m,
    25. "q": q
    26. }
    27. response = requests.get(url, headers=headers, params=params)
    28. num_three_total = 0
    29. for i in range(10):
    30. value = response.json()['data'][i]
    31. num = re.findall(r"'value': (.*?)}", str(value))[0]
    32. num_three_total += int(num)
    33. total_price = num_three_total * 24
    34. bonus += total_price
    35. total += bonus
    36. print(total)
    37. if __name__ == '__main__':
    38. main()

  • 相关阅读:
    机器学习:争取被遗忘的权利
    Hive之DDL库操作
    java常见问题排查
    buuctf-[Zer0pts2020]Can you guess it?
    PolarDB 助力易仓打造跨境行业生态链协同的产业链 SaaS
    java CPU 或者内存 异常排查
    pytorch图像识别(基于识别验证码),读取本都数据集图片以及使用神经网络进行训练
    LeetCode0416.分割等和子集 Go语言AC笔记
    PLC滑动平均值滤波(SMART 200梯形图篇)
    Eureka服务注册中心
  • 原文地址:https://blog.csdn.net/Yy_Rose/article/details/126603095