某矿webpack逆向
免责声明:
本篇博文的初衷是分享自己学习逆向分析时的个人感悟,所涉及的内容仅供学习、交流,请勿将其用于非法用途!!!任何由此引发的法律纠纷均与作者本人无关,请自行负责!!!
推荐文章:
https://app.yinxiang.com/fx/970ae39c-9964-4aae-aa96-7e81fee4ef8f
WebPack
webpack是JavaScript应用程序的模块备份器,可以把开发中的所有资源(图片、js文件、css文件等)都看成模块,通过loader(加载器)和plugins(插件)对资源进行处理,备份成符合生产环境部署的前端资源。所有的资源都是通过JavaScript渲染出来的。
常见的形式
// 数组形式
!function(形参){加载器}([模块])
// 字典形式
!function(形参){加载器}({模块})
扣取代码
抓包发现每次请求都需要先请求一个public包,可以发现这个请求的内容是一个公钥。第二次的加密参数需要这个值。
需要的加密参数:param,cookie未加密,可以多抓几个包看一下
进行参数的搜索
我们进去之后发现这个参数比较多,但是我们需要的事请求公钥之后的那个加密的内容,所以我们可以直接搜索这个公钥的请求地址,这样可以快速帮助我们定位到需要的内容
打上断点进行调试
我们断点调试输出这个内容,为什么说我直接就输出r和这个s呢?这边我们直接看 s 是返回的,那么这个值肯定是需要传递的价值比较大,这个r 是在 t.setPublicKey®, 这个位置见名知意,setPublicKey 那么我们可以看一下。最终结束调试看一下请求参数。
可以知道就是这个位置进行了调用公钥,但是这个参数s是不是最终的结果呢?这个需要我们继续调试进行验证
这个加密是一个变化的值,我们进行值验证也无法进行,所以我们直接进行xhr断点调试然后向上找就行。
断到最后发送的位置,这个时候向上找看一下这个s是否是最终需要的参数,我们发现最终发的加密在p中,那么找到p的赋值位置。
执行了一个异步,我们发现p是通过e进行赋值的。e是一个参数。
一直找可以找到这个参数传递的位置是在这个地方
大个断点,然后重新调试,发现传递参数后面经过 这个位置
并且这个位置并不是执行的加密逻辑。
但是当释放上面断点的时候,发现第二次来到这个位置,输出的值就是加密后的内容。
向上跟栈,追到这个位置
单步调试进入这个参数中,这个内容是t生成的,那么这个时候我们直接断到t进行跟栈
调试发现,t生成的事通过这个位置进行生成的,可以知道最终需要的事在这边地方。
需要的事这个s的值
s = t.encryptLong(JSON.stringify(a)),
我们依次进行代码扣取,
t = d【“a”】
我们需要先找到d[“a”]的生成
可以看到d是一个模块,那么这个时候开始扣取代码,然后补一下就行。
扣去加载器,然后进行模块的填充。
那么现在就只需要扣取代码就行,中间有一个A[e].call 我们可以在上面进行输出,看一下缺少什么,这样的话会更加容易,直接在nodejs中输出这个异常就行。剩下的就是不断调试了
var scream;
var window = global;
(function (A) {
function e(e) {
for (var n, r, i = e[0], o = e[1], c = e[2], g = 0, C = []; g < i.length; g++)
r = i[g],
Object.prototype.hasOwnProperty.call(a, r) && a[r] && C.push(a[r][0]),
a[r] = 0;
for (n in o)
Object.prototype.hasOwnProperty.call(o, n) && (A[n] = o[n]);
l && l(e);
while (C.length)
C.shift()();
return s.push.apply(s, c || []),
t()
}
function t() {
for (var A, e = 0; e < s.length; e++) {
for (var t = s[e], n = !0, r = 1; r < t.length; r++) {
var i = t[r];
0 !== a[i] && (n = !1)
}
n && (s.splice(e--, 1),
A = o(o.s = t[0]))
}
return A
}
var n = {}
, r = {
index: 0
}
, a = {
index: 0
}
, s = [];
function i(A) {
return o.p + "js/" + ({}[A] || A) + ".js"
}
function o(e) {
if (n[e])
return n[e].exports;
var t = n[e] = {
i: e,
l: !1,
exports: {}
};
return A[e].call(t.exports, t, t.exports, o),
t.l = !0,
t.exports
}
o.e = function (A) {
var e = []
, t = {
"chunk-014f8c76": 1,
"chunk-022d1a1e": 1,
"chunk-08dfb5f4": 1,
"chunk-0e71e1ec": 1,
"chunk-1ea9c550": 1,
"chunk-27c6c980": 1,
"chunk-292fc281": 1,
"chunk-36ad665a": 1,
"chunk-37d3c79c": 1,
"chunk-3a8e87b2": 1,
"chunk-3ae95355": 1,
"chunk-564fa90c": 1,
"chunk-6038e544": 1,
"chunk-65aa7b64": 1,
"chunk-69a5ffe2": 1,
"chunk-6a6e0a4d": 1,
"chunk-6b845cb2": 1,
"chunk-6ced383c": 1,
"chunk-6dc29283": 1,
"chunk-6f9084b2": 1,
"chunk-72c3d136": 1,
"chunk-73322c15": 1,
"chunk-79490809": 1,
"chunk-79fda34d": 1,
"chunk-7ddeb4f7": 1,
"chunk-84f3bc8a": 1,
"chunk-87c5890c": 1,
"chunk-90be71c6": 1,
"chunk-b702925a": 1,
"chunk-b8947556": 1,
"chunk-be76fe62": 1,
"chunk-c6a7f81c": 1,
"chunk-d055d7ec": 1,
"chunk-fda268a2": 1
};
r[A] ? e.push(r[A]) : 0 !== r[A] && t[A] && e.push(r[A] = new Promise((function (e, t) {
for (var n = "css/" + ({}[A] || A) + ".css", a = o.p + n, s = document.getElementsByTagName("link"), i = 0; i < s.length; i++) {
var c = s[i]
, g = c.getAttribute("data-href") || c.getAttribute("href");
if ("stylesheet" === c.rel && (g === n || g === a))
return e()
}
var C = document.getElementsByTagName("style");
for (i = 0; i < C.length; i++) {
c = C[i],
g = c.getAttribute("data-href");
if (g === n || g === a)
return e()
}
var l = document.createElement("link");
l.rel = "stylesheet",
l.type = "text/css",
l.onload = e,
l.onerror = function (e) {
var n = e && e.target && e.target.src || a
, s = new Error("Loading CSS chunk " + A + " failed.\n(" + n + ")");
s.code = "CSS_CHUNK_LOAD_FAILED",
s.request = n,
delete r[A],
l.parentNode.removeChild(l),
t(s)
}
,
l.href = a;
var I = document.getElementsByTagName("head")[0];
I.appendChild(l)
}
)).then((function () {
r[A] = 0
}
)));
var n = a[A];
if (0 !== n)
if (n)
e.push(n[2]);
else {
var s = new Promise((function (e, t) {
n = a[A] = [e, t]
}
));
e.push(n[2] = s);
var c, g = document.createElement("script");
g.charset = "utf-8",
g.timeout = 120,
o.nc && g.setAttribute("nonce", o.nc),
g.src = i(A);
var C = new Error;
c = function (e) {
g.onerror = g.onload = null,
clearTimeout(l);
var t = a[A];
if (0 !== t) {
if (t) {
var n = e && ("load" === e.type ? "missing" : e.type)
, r = e && e.target && e.target.src;
C.message = "Loading chunk " + A + " failed.\n(" + n + ": " + r + ")",
C.name = "ChunkLoadError",
C.type = n,
C.request = r,
t[1](C)
}
a[A] = void 0
}
}
;
var l = setTimeout((function () {
c({
type: "timeout",
target: g
})
}
), 12e4);
g.onerror = g.onload = c,
document.head.appendChild(g)
}
return Promise.all(e)
}
,
o.m = A,
o.c = n,
o.d = function (A, e, t) {
o.o(A, e) || Object.defineProperty(A, e, {
enumerable: !0,
get: t
})
}
,
o.r = function (A) {
"undefined" !== typeof Symbol && Symbol.toStringTag && Object.defineProperty(A, Symbol.toStringTag, {
value: "Module"
}),
Object.defineProperty(A, "__esModule", {
value: !0
})
}
,
o.t = function (A, e) {
if (1 & e && (A = o(A)),
8 & e)
return A;
if (4 & e && "object" === typeof A && A && A.__esModule)
return A;
var t = Object.create(null);
if (o.r(t),
Object.defineProperty(t, "default", {
enumerable: !0,
value: A
}),
2 & e && "string" != typeof A)
for (var n in A)
o.d(t, n, function (e) {
return A[e]
}
.bind(null, n));
return t
}
,
o.n = function (A) {
var e = A && A.__esModule ? function () {
return A["default"]
}
: function () {
return A
}
;
return o.d(e, "a", e),
e
}
,
o.o = function (A, e) {
return Object.prototype.hasOwnProperty.call(A, e)
}
,
o.p = "/common/gikam/",
o.oe = function (A) {
throw console.error(A),
A
}
;
var c = window["webpackJsonp"] = window["webpackJsonp"] || []
, g = c.push.bind(c);
c.push = e,
c = c.slice();
for (var C = 0; C < c.length; C++)
e(c[C]);
var l = g;
s.push([4, "chunk-vendors"]),
t()
scream = o
}
)({
9816: function(e, t, n) {
"use strict";
var r = "0123456789abcdefghijklmnopqrstuvwxyz";
function o(e) {
return r.charAt(e)
}
function i(e, t) {
return e & t
}
function a(e, t) {
return e | t
}
function s(e, t) {
return e ^ t
}
function l(e, t) {
return e & ~t
}
function c(e) {
if (0 == e)
return -1;
var t = 0;
return 0 == (65535 & e) && (e >>= 16,
t += 16),
0 == (255 & e) && (e >>= 8,
t += 8),
0 == (15 & e) && (e >>= 4,
t += 4),
0 == (3 & e) && (e >>= 2,
t += 2),
0 == (1 & e) && ++t,
t
}
function u(e) {
var t = 0;
while (0 != e)
e &= e - 1,
++t;
return t
}
var d, h = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", f = "=";
function p(e) {
var t, n, r = "";
for (t = 0; t + 3 <= e.length; t += 3)
n = parseInt(e.substring(t, t + 3), 16),
r += h.charAt(n >> 6) + h.charAt(63 & n);
t + 1 == e.length ? (n = parseInt(e.substring(t, t + 1), 16),
r += h.charAt(n << 2)) : t + 2 == e.length && (n = parseInt(e.substring(t, t + 2), 16),
r += h.charAt(n >> 2) + h.charAt((3 & n) << 4));
while ((3 & r.length) > 0)
r += f;
return r
}
function m(e) {
var t, n = "", r = 0, i = 0;
for (t = 0; t < e.length; ++t) {
if (e.charAt(t) == f)
break;
var a = h.indexOf(e.charAt(t));
a < 0 || (0 == r ? (n += o(a >> 2),
i = 3 & a,
r = 1) : 1 == r ? (n += o(i << 2 | a >> 4),
i = 15 & a,
r = 2) : 2 == r ? (n += o(i),
n += o(a >> 2),
i = 3 & a,
r = 3) : (n += o(i << 2 | a >> 4),
n += o(15 & a),
r = 0))
}
return 1 == r && (n += o(i << 2)),
n
}
var v, g = {
decode: function(e) {
var t;
if (void 0 === d) {
var n = "0123456789ABCDEF"
, r = " \f\n\r\t \u2028\u2029";
for (d = {},
t = 0; t < 16; ++t)
d[n.charAt(t)] = t;
for (n = n.toLowerCase(),
t = 10; t < 16; ++t)
d[n.charAt(t)] = t;
for (t = 0; t < r.length; ++t)
d[r.charAt(t)] = -1
}
var o = []
, i = 0
, a = 0;
for (t = 0; t < e.length; ++t) {
var s = e.charAt(t);
if ("=" == s)
break;
if (s = d[s],
-1 != s) {
if (void 0 === s)
throw new Error("Illegal character at offset " + t);
i |= s,
++a >= 2 ? (o[o.length] = i,
i = 0,
a = 0) : i <<= 4
}
}
if (a)
throw new Error("Hex encoding incomplete: 4 bits missing");
return o
}
}, b = {
decode: function(e) {
var t;
if (void 0 === v) {
var n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
, r = "= \f\n\r\t \u2028\u2029";
for (v = Object.create(null),
t = 0; t < 64; ++t)
v[n.charAt(t)] = t;
for (v["-"] = 62,
v["_"] = 63,
t = 0; t < r.length; ++t)
v[r.charAt(t)] = -1
}
var o = []
, i = 0
, a = 0;
for (t = 0; t < e.length; ++t) {
var s = e.charAt(t);
if ("=" == s)
break;
if (s = v[s],
-1 != s) {
if (void 0 === s)
throw new Error("Illegal character at offset " + t);
i |= s,
++a >= 4 ? (o[o.length] = i >> 16,
o[o.length] = i >> 8 & 255,
o[o.length] = 255 & i,
i = 0,
a = 0) : i <<= 6
}
}
switch (a) {
case 1:
throw new Error("Base64 encoding incomplete: at least 2 bits missing");
case 2:
o[o.length] = i >> 10;
break;
case 3:
o[o.length] = i >> 16,
o[o.length] = i >> 8 & 255;
break
}
return o
},
re: /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,
unarmor: function(e) {
var t = b.re.exec(e);
if (t)
if (t[1])
e = t[1];
else {
if (!t[2])
throw new Error("RegExp out of sync");
e = t[2]
}
return b.decode(e)
}
}, y = 1e13, _ = function() {
function e(e) {
this.buf = [+e || 0]
}
return e.prototype.mulAdd = function(e, t) {
var n, r, o = this.buf, i = o.length;
for (n = 0; n < i; ++n)
r = o[n] * e + t,
r < y ? t = 0 : (t = 0 | r / y,
r -= t * y),
o[n] = r;
t > 0 && (o[n] = t)
}
,
e.prototype.sub = function(e) {
var t, n, r = this.buf, o = r.length;
for (t = 0; t < o; ++t)
n = r[t] - e,
n < 0 ? (n += y,
e = 1) : e = 0,
r[t] = n;
while (0 === r[r.length - 1])
r.pop()
}
,
e.prototype.toString = function(e) {
if (10 != (e || 10))
throw new Error("only base 10 is supported");
for (var t = this.buf, n = t[t.length - 1].toString(), r = t.length - 2; r >= 0; --r)
n += (y + t[r]).toString().substring(1);
return n
}
,
e.prototype.valueOf = function() {
for (var e = this.buf, t = 0, n = e.length - 1; n >= 0; --n)
t = t * y + e[n];
return t
}
,
e.prototype.simplify = function() {
var e = this.buf;
return 1 == e.length ? e[0] : this
}
,
e
}(), x = "…", w = /^(\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)?)?$/, C = /^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;
function S(e, t) {
return e.length > t && (e = e.substring(0, t) + x),
e
}
var j, k = function() {
function e(t, n) {
this.hexDigits = "0123456789ABCDEF",
t instanceof e ? (this.enc = t.enc,
this.pos = t.pos) : (this.enc = t,
this.pos = n)
}
return e.prototype.get = function(e) {
if (void 0 === e && (e = this.pos++),
e >= this.enc.length)
throw new Error("Requesting byte offset " + e + " on a stream of length " + this.enc.length);
return "string" === typeof this.enc ? this.enc.charCodeAt(e) : this.enc[e]
}
,
e.prototype.hexByte = function(e) {
return this.hexDigits.charAt(e >> 4 & 15) + this.hexDigits.charAt(15 & e)
}
,
e.prototype.hexDump = function(e, t, n) {
for (var r = "", o = e; o < t; ++o)
if (r += this.hexByte(this.get(o)),
!0 !== n)
switch (15 & o) {
case 7:
r += " ";
break;
case 15:
r += "\n";
break;
default:
r += " "
}
return r
}
,
e.prototype.isASCII = function(e, t) {
for (var n = e; n < t; ++n) {
var r = this.get(n);
if (r < 32 || r > 176)
return !1
}
return !0
}
,
e.prototype.parseStringISO = function(e, t) {
for (var n = "", r = e; r < t; ++r)
n += String.fromCharCode(this.get(r));
return n
}
,
e.prototype.parseStringUTF = function(e, t) {
for (var n = "", r = e; r < t; ) {
var o = this.get(r++);
n += o < 128 ? String.fromCharCode(o) : o > 191 && o < 224 ? String.fromCharCode((31 & o) << 6 | 63 & this.get(r++)) : String.fromCharCode((15 & o) << 12 | (63 & this.get(r++)) << 6 | 63 & this.get(r++))
}
return n
}
,
e.prototype.parseStringBMP = function(e, t) {
for (var n, r, o = "", i = e; i < t; )
n = this.get(i++),
r = this.get(i++),
o += String.fromCharCode(n << 8 | r);
return o
}
,
e.prototype.parseTime = function(e, t, n) {
var r = this.parseStringISO(e, t)
, o = (n ? w : C).exec(r);
return o ? (n && (o[1] = +o[1],
o[1] += +o[1] < 70 ? 2e3 : 1900),
r = o[1] + "-" + o[2] + "-" + o[3] + " " + o[4],
o[5] && (r += ":" + o[5],
o[6] && (r += ":" + o[6],
o[7] && (r += "." + o[7]))),
o[8] && (r += " UTC",
"Z" != o[8] && (r += o[8],
o[9] && (r += ":" + o[9]))),
r) : "Unrecognized time: " + r
}
,
e.prototype.parseInteger = function(e, t) {
var n, r = this.get(e), o = r > 127, i = o ? 255 : 0, a = "";
while (r == i && ++e < t)
r = this.get(e);
if (n = t - e,
0 === n)
return o ? -1 : 0;
if (n > 4) {
a = r,
n <<= 3;
while (0 == (128 & (+a ^ i)))
a = +a << 1,
--n;
a = "(" + n + " bit)\n"
}
o && (r -= 256);
for (var s = new _(r), l = e + 1; l < t; ++l)
s.mulAdd(256, this.get(l));
return a + s.toString()
}
,
e.prototype.parseBitString = function(e, t, n) {
for (var r = this.get(e), o = (t - e - 1 << 3) - r, i = "(" + o + " bit)\n", a = "", s = e + 1; s < t; ++s) {
for (var l = this.get(s), c = s == t - 1 ? r : 0, u = 7; u >= c; --u)
a += l >> u & 1 ? "1" : "0";
if (a.length > n)
return i + S(a, n)
}
return i + a
}
,
e.prototype.parseOctetString = function(e, t, n) {
if (this.isASCII(e, t))
return S(this.parseStringISO(e, t), n);
var r = t - e
, o = "(" + r + " byte)\n";
n /= 2,
r > n && (t = e + n);
for (var i = e; i < t; ++i)
o += this.hexByte(this.get(i));
return r > n && (o += x),
o
}
,
e.prototype.parseOID = function(e, t, n) {
for (var r = "", o = new _, i = 0, a = e; a < t; ++a) {
var s = this.get(a);
if (o.mulAdd(128, 127 & s),
i += 7,
!(128 & s)) {
if ("" === r)
if (o = o.simplify(),
o instanceof _)
o.sub(80),
r = "2." + o.toString();
else {
var l = o < 80 ? o < 40 ? 0 : 1 : 2;
r = l + "." + (o - 40 * l)
}
else
r += "." + o.toString();
if (r.length > n)
return S(r, n);
o = new _,
i = 0
}
}
return i > 0 && (r += ".incomplete"),
r
}
,
e
}(), O = function() {
function e(e, t, n, r, o) {
if (!(r instanceof M))
throw new Error("Invalid tag value.");
this.stream = e,
this.header = t,
this.length = n,
this.tag = r,
this.sub = o
}
return e.prototype.typeName = function() {
switch (this.tag.tagClass) {
case 0:
switch (this.tag.tagNumber) {
case 0:
return "EOC";
case 1:
return "BOOLEAN";
case 2:
return "INTEGER";
case 3:
return "BIT_STRING";
case 4:
return "OCTET_STRING";
case 5:
return "NULL";
case 6:
return "OBJECT_IDENTIFIER";
case 7:
return "ObjectDescriptor";
case 8:
return "EXTERNAL";
case 9:
return "REAL";
case 10:
return "ENUMERATED";
case 11:
return "EMBEDDED_PDV";
case 12:
return "UTF8String";
case 16:
return "SEQUENCE";
case 17:
return "SET";
case 18:
return "NumericString";
case 19:
return "PrintableString";
case 20:
return "TeletexString";
case 21:
return "VideotexString";
case 22:
return "IA5String";
case 23:
return "UTCTime";
case 24:
return "GeneralizedTime";
case 25:
return "GraphicString";
case 26:
return "VisibleString";
case 27:
return "GeneralString";
case 28:
return "UniversalString";
case 30:
return "BMPString"
}
return "Universal_" + this.tag.tagNumber.toString();
case 1:
return "Application_" + this.tag.tagNumber.toString();
case 2:
return "[" + this.tag.tagNumber.toString() + "]";
case 3:
return "Private_" + this.tag.tagNumber.toString()
}
}
,
e.prototype.content = function(e) {
if (void 0 === this.tag)
return null;
void 0 === e && (e = 1 / 0);
var t = this.posContent()
, n = Math.abs(this.length);
if (!this.tag.isUniversal())
return null !== this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(t, t + n, e);
switch (this.tag.tagNumber) {
case 1:
return 0 === this.stream.get(t) ? "false" : "true";
case 2:
return this.stream.parseInteger(t, t + n);
case 3:
return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseBitString(t, t + n, e);
case 4:
return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(t, t + n, e);
case 6:
return this.stream.parseOID(t, t + n, e);
case 16:
case 17:
return null !== this.sub ? "(" + this.sub.length + " elem)" : "(no elem)";
case 12:
return S(this.stream.parseStringUTF(t, t + n), e);
case 18:
case 19:
case 20:
case 21:
case 22:
case 26:
return S(this.stream.parseStringISO(t, t + n), e);
case 30:
return S(this.stream.parseStringBMP(t, t + n), e);
case 23:
case 24:
return this.stream.parseTime(t, t + n, 23 == this.tag.tagNumber)
}
return null
}
,
e.prototype.toString = function() {
return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (null === this.sub ? "null" : this.sub.length) + "]"
}
,
e.prototype.toPrettyString = function(e) {
void 0 === e && (e = "");
var t = e + this.typeName() + " @" + this.stream.pos;
if (this.length >= 0 && (t += "+"),
t += this.length,
this.tag.tagConstructed ? t += " (constructed)" : !this.tag.isUniversal() || 3 != this.tag.tagNumber && 4 != this.tag.tagNumber || null === this.sub || (t += " (encapsulates)"),
t += "\n",
null !== this.sub) {
e += " ";
for (var n = 0, r = this.sub.length; n < r; ++n)
t += this.sub[n].toPrettyString(e)
}
return t
}
,
e.prototype.posStart = function() {
return this.stream.pos
}
,
e.prototype.posContent = function() {
return this.stream.pos + this.header
}
,
e.prototype.posEnd = function() {
return this.stream.pos + this.header + Math.abs(this.length)
}
,
e.prototype.toHexString = function() {
return this.stream.hexDump(this.posStart(), this.posEnd(), !0)
}
,
e.decodeLength = function(e) {
var t = e.get()
, n = 127 & t;
if (n == t)
return n;
if (n > 6)
throw new Error("Length over 48 bits not supported at position " + (e.pos - 1));
if (0 === n)
return null;
t = 0;
for (var r = 0; r < n; ++r)
t = 256 * t + e.get();
return t
}
,
e.prototype.getHexStringValue = function() {
var e = this.toHexString()
, t = 2 * this.header
, n = 2 * this.length;
return e.substr(t, n)
}
,
e.decode = function(t) {
var n;
n = t instanceof k ? t : new k(t,0);
var r = new k(n)
, o = new M(n)
, i = e.decodeLength(n)
, a = n.pos
, s = a - r.pos
, l = null
, c = function() {
var t = [];
if (null !== i) {
var r = a + i;
while (n.pos < r)
t[t.length] = e.decode(n);
if (n.pos != r)
throw new Error("Content size is not correct for container starting at offset " + a)
} else
try {
for (; ; ) {
var o = e.decode(n);
if (o.tag.isEOC())
break;
t[t.length] = o
}
i = a - n.pos
} catch (s) {
throw new Error("Exception while decoding undefined length content: " + s)
}
return t
};
if (o.tagConstructed)
l = c();
else if (o.isUniversal() && (3 == o.tagNumber || 4 == o.tagNumber))
try {
if (3 == o.tagNumber && 0 != n.get())
throw new Error("BIT STRINGs with unused bits cannot encapsulate.");
l = c();
for (var u = 0; u < l.length; ++u)
if (l[u].tag.isEOC())
throw new Error("EOC is not supposed to be actual content.")
} catch (d) {
l = null
}
if (null === l) {
if (null === i)
throw new Error("We can't skip over an invalid tag with undefined length at offset " + a);
n.pos = a + Math.abs(i)
}
return new e(r,s,i,o,l)
}
,
e
}(), M = function() {
function e(e) {
var t = e.get();
if (this.tagClass = t >> 6,
this.tagConstructed = 0 !== (32 & t),
this.tagNumber = 31 & t,
31 == this.tagNumber) {
var n = new _;
do {
t = e.get(),
n.mulAdd(128, 127 & t)
} while (128 & t);
this.tagNumber = n.simplify()
}
}
return e.prototype.isUniversal = function() {
return 0 === this.tagClass
}
,
e.prototype.isEOC = function() {
return 0 === this.tagClass && 0 === this.tagNumber
}
,
e
}(), T = 0xdeadbeefcafe, P = 15715070 == (16777215 & T), L = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997], z = (1 << 26) / L[L.length - 1], D = function() {
function e(e, t, n) {
null != e && ("number" == typeof e ? this.fromNumber(e, t, n) : null == t && "string" != typeof e ? this.fromString(e, 256) : this.fromString(e, t))
}
return e.prototype.toString = function(e) {
if (this.s < 0)
return "-" + this.negate().toString(e);
var t;
if (16 == e)
t = 4;
else if (8 == e)
t = 3;
else if (2 == e)
t = 1;
else if (32 == e)
t = 5;
else {
if (4 != e)
return this.toRadix(e);
t = 2
}
var n, r = (1 << t) - 1, i = !1, a = "", s = this.t, l = this.DB - s * this.DB % t;
if (s-- > 0) {
l < this.DB && (n = this[s] >> l) > 0 && (i = !0,
a = o(n));
while (s >= 0)
l < t ? (n = (this[s] & (1 << l) - 1) << t - l,
n |= this[--s] >> (l += this.DB - t)) : (n = this[s] >> (l -= t) & r,
l <= 0 && (l += this.DB,
--s)),
n > 0 && (i = !0),
i && (a += o(n))
}
return i ? a : "0"
}
,
e.prototype.negate = function() {
var t = R();
return e.ZERO.subTo(this, t),
t
}
,
e.prototype.abs = function() {
return this.s < 0 ? this.negate() : this
}
,
e.prototype.compareTo = function(e) {
var t = this.s - e.s;
if (0 != t)
return t;
var n = this.t;
if (t = n - e.t,
0 != t)
return this.s < 0 ? -t : t;
while (--n >= 0)
if (0 != (t = this[n] - e[n]))
return t;
return 0
}
,
e.prototype.bitLength = function() {
return this.t <= 0 ? 0 : this.DB * (this.t - 1) + U(this[this.t - 1] ^ this.s & this.DM)
}
,
e.prototype.mod = function(t) {
var n = R();
return this.abs().divRemTo(t, null, n),
this.s < 0 && n.compareTo(e.ZERO) > 0 && t.subTo(n, n),
n
}
,
e.prototype.modPowInt = function(e, t) {
var n;
return n = e < 256 || t.isEven() ? new H(t) : new A(t),
this.exp(e, n)
}
,
e.prototype.clone = function() {
var e = R();
return this.copyTo(e),
e
}
,
e.prototype.intValue = function() {
if (this.s < 0) {
if (1 == this.t)
return this[0] - this.DV;
if (0 == this.t)
return -1
} else {
if (1 == this.t)
return this[0];
if (0 == this.t)
return 0
}
return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0]
}
,
e.prototype.byteValue = function() {
return 0 == this.t ? this.s : this[0] << 24 >> 24
}
,
e.prototype.shortValue = function() {
return 0 == this.t ? this.s : this[0] << 16 >> 16
}
,
e.prototype.signum = function() {
return this.s < 0 ? -1 : this.t <= 0 || 1 == this.t && this[0] <= 0 ? 0 : 1
}
,
e.prototype.toByteArray = function() {
var e = this.t
, t = [];
t[0] = this.s;
var n, r = this.DB - e * this.DB % 8, o = 0;
if (e-- > 0) {
r < this.DB && (n = this[e] >> r) != (this.s & this.DM) >> r && (t[o++] = n | this.s << this.DB - r);
while (e >= 0)
r < 8 ? (n = (this[e] & (1 << r) - 1) << 8 - r,
n |= this[--e] >> (r += this.DB - 8)) : (n = this[e] >> (r -= 8) & 255,
r <= 0 && (r += this.DB,
--e)),
0 != (128 & n) && (n |= -256),
0 == o && (128 & this.s) != (128 & n) && ++o,
(o > 0 || n != this.s) && (t[o++] = n)
}
return t
}
,
e.prototype.equals = function(e) {
return 0 == this.compareTo(e)
}
,
e.prototype.min = function(e) {
return this.compareTo(e) < 0 ? this : e
}
,
e.prototype.max = function(e) {
return this.compareTo(e) > 0 ? this : e
}
,
e.prototype.and = function(e) {
var t = R();
return this.bitwiseTo(e, i, t),
t
}
,
e.prototype.or = function(e) {
var t = R();
return this.bitwiseTo(e, a, t),
t
}
,
e.prototype.xor = function(e) {
var t = R();
return this.bitwiseTo(e, s, t),
t
}
,
e.prototype.andNot = function(e) {
var t = R();
return this.bitwiseTo(e, l, t),
t
}
,
e.prototype.not = function() {
for (var e = R(), t = 0; t < this.t; ++t)
e[t] = this.DM & ~this[t];
return e.t = this.t,
e.s = ~this.s,
e
}
,
e.prototype.shiftLeft = function(e) {
var t = R();
return e < 0 ? this.rShiftTo(-e, t) : this.lShiftTo(e, t),
t
}
,
e.prototype.shiftRight = function(e) {
var t = R();
return e < 0 ? this.lShiftTo(-e, t) : this.rShiftTo(e, t),
t
}
,
e.prototype.getLowestSetBit = function() {
for (var e = 0; e < this.t; ++e)
if (0 != this[e])
return e * this.DB + c(this[e]);
return this.s < 0 ? this.t * this.DB : -1
}
,
e.prototype.bitCount = function() {
for (var e = 0, t = this.s & this.DM, n = 0; n < this.t; ++n)
e += u(this[n] ^ t);
return e
}
,
e.prototype.testBit = function(e) {
var t = Math.floor(e / this.DB);
return t >= this.t ? 0 != this.s : 0 != (this[t] & 1 << e % this.DB)
}
,
e.prototype.setBit = function(e) {
return this.changeBit(e, a)
}
,
e.prototype.clearBit = function(e) {
return this.changeBit(e, l)
}
,
e.prototype.flipBit = function(e) {
return this.changeBit(e, s)
}
,
e.prototype.add = function(e) {
var t = R();
return this.addTo(e, t),
t
}
,
e.prototype.subtract = function(e) {
var t = R();
return this.subTo(e, t),
t
}
,
e.prototype.multiply = function(e) {
var t = R();
return this.multiplyTo(e, t),
t
}
,
e.prototype.divide = function(e) {
var t = R();
return this.divRemTo(e, t, null),
t
}
,
e.prototype.remainder = function(e) {
var t = R();
return this.divRemTo(e, null, t),
t
}
,
e.prototype.divideAndRemainder = function(e) {
var t = R()
, n = R();
return this.divRemTo(e, t, n),
[t, n]
}
,
e.prototype.modPow = function(e, t) {
var n, r, o = e.bitLength(), i = W(1);
if (o <= 0)
return i;
n = o < 18 ? 1 : o < 48 ? 3 : o < 144 ? 4 : o < 768 ? 5 : 6,
r = o < 8 ? new H(t) : t.isEven() ? new V(t) : new A(t);
var a = []
, s = 3
, l = n - 1
, c = (1 << n) - 1;
if (a[1] = r.convert(this),
n > 1) {
var u = R();
r.sqrTo(a[1], u);
while (s <= c)
a[s] = R(),
r.mulTo(u, a[s - 2], a[s]),
s += 2
}
var d, h, f = e.t - 1, p = !0, m = R();
o = U(e[f]) - 1;
while (f >= 0) {
o >= l ? d = e[f] >> o - l & c : (d = (e[f] & (1 << o + 1) - 1) << l - o,
f > 0 && (d |= e[f - 1] >> this.DB + o - l)),
s = n;
while (0 == (1 & d))
d >>= 1,
--s;
if ((o -= s) < 0 && (o += this.DB,
--f),
p)
a[d].copyTo(i),
p = !1;
else {
while (s > 1)
r.sqrTo(i, m),
r.sqrTo(m, i),
s -= 2;
s > 0 ? r.sqrTo(i, m) : (h = i,
i = m,
m = h),
r.mulTo(m, a[d], i)
}
while (f >= 0 && 0 == (e[f] & 1 << o))
r.sqrTo(i, m),
h = i,
i = m,
m = h,
--o < 0 && (o = this.DB - 1,
--f)
}
return r.revert(i)
}
,
e.prototype.modInverse = function(t) {
var n = t.isEven();
if (this.isEven() && n || 0 == t.signum())
return e.ZERO;
var r = t.clone()
, o = this.clone()
, i = W(1)
, a = W(0)
, s = W(0)
, l = W(1);
while (0 != r.signum()) {
while (r.isEven())
r.rShiftTo(1, r),
n ? (i.isEven() && a.isEven() || (i.addTo(this, i),
a.subTo(t, a)),
i.rShiftTo(1, i)) : a.isEven() || a.subTo(t, a),
a.rShiftTo(1, a);
while (o.isEven())
o.rShiftTo(1, o),
n ? (s.isEven() && l.isEven() || (s.addTo(this, s),
l.subTo(t, l)),
s.rShiftTo(1, s)) : l.isEven() || l.subTo(t, l),
l.rShiftTo(1, l);
r.compareTo(o) >= 0 ? (r.subTo(o, r),
n && i.subTo(s, i),
a.subTo(l, a)) : (o.subTo(r, o),
n && s.subTo(i, s),
l.subTo(a, l))
}
return 0 != o.compareTo(e.ONE) ? e.ZERO : l.compareTo(t) >= 0 ? l.subtract(t) : l.signum() < 0 ? (l.addTo(t, l),
l.signum() < 0 ? l.add(t) : l) : l
}
,
e.prototype.pow = function(e) {
return this.exp(e, new E)
}
,
e.prototype.gcd = function(e) {
var t = this.s < 0 ? this.negate() : this.clone()
, n = e.s < 0 ? e.negate() : e.clone();
if (t.compareTo(n) < 0) {
var r = t;
t = n,
n = r
}
var o = t.getLowestSetBit()
, i = n.getLowestSetBit();
if (i < 0)
return t;
o < i && (i = o),
i > 0 && (t.rShiftTo(i, t),
n.rShiftTo(i, n));
while (t.signum() > 0)
(o = t.getLowestSetBit()) > 0 && t.rShiftTo(o, t),
(o = n.getLowestSetBit()) > 0 && n.rShiftTo(o, n),
t.compareTo(n) >= 0 ? (t.subTo(n, t),
t.rShiftTo(1, t)) : (n.subTo(t, n),
n.rShiftTo(1, n));
return i > 0 && n.lShiftTo(i, n),
n
}
,
e.prototype.isProbablePrime = function(e) {
var t, n = this.abs();
if (1 == n.t && n[0] <= L[L.length - 1]) {
for (t = 0; t < L.length; ++t)
if (n[0] == L[t])
return !0;
return !1
}
if (n.isEven())
return !1;
t = 1;
while (t < L.length) {
var r = L[t]
, o = t + 1;
while (o < L.length && r < z)
r *= L[o++];
r = n.modInt(r);
while (t < o)
if (r % L[t++] == 0)
return !1
}
return n.millerRabin(e)
}
,
e.prototype.copyTo = function(e) {
for (var t = this.t - 1; t >= 0; --t)
e[t] = this[t];
e.t = this.t,
e.s = this.s
}
,
e.prototype.fromInt = function(e) {
this.t = 1,
this.s = e < 0 ? -1 : 0,
e > 0 ? this[0] = e : e < -1 ? this[0] = e + this.DV : this.t = 0
}
,
e.prototype.fromString = function(t, n) {
var r;
if (16 == n)
r = 4;
else if (8 == n)
r = 3;
else if (256 == n)
r = 8;
else if (2 == n)
r = 1;
else if (32 == n)
r = 5;
else {
if (4 != n)
return void this.fromRadix(t, n);
r = 2
}
this.t = 0,
this.s = 0;
var o = t.length
, i = !1
, a = 0;
while (--o >= 0) {
var s = 8 == r ? 255 & +t[o] : K(t, o);
s < 0 ? "-" == t.charAt(o) && (i = !0) : (i = !1,
0 == a ? this[this.t++] = s : a + r > this.DB ? (this[this.t - 1] |= (s & (1 << this.DB - a) - 1) << a,
this[this.t++] = s >> this.DB - a) : this[this.t - 1] |= s << a,
a += r,
a >= this.DB && (a -= this.DB))
}
8 == r && 0 != (128 & +t[0]) && (this.s = -1,
a > 0 && (this[this.t - 1] |= (1 << this.DB - a) - 1 << a)),
this.clamp(),
i && e.ZERO.subTo(this, this)
}
,
e.prototype.clamp = function() {
var e = this.s & this.DM;
while (this.t > 0 && this[this.t - 1] == e)
--this.t
}
,
e.prototype.dlShiftTo = function(e, t) {
var n;
for (n = this.t - 1; n >= 0; --n)
t[n + e] = this[n];
for (n = e - 1; n >= 0; --n)
t[n] = 0;
t.t = this.t + e,
t.s = this.s
}
,
e.prototype.drShiftTo = function(e, t) {
for (var n = e; n < this.t; ++n)
t[n - e] = this[n];
t.t = Math.max(this.t - e, 0),
t.s = this.s
}
,
e.prototype.lShiftTo = function(e, t) {
for (var n = e % this.DB, r = this.DB - n, o = (1 << r) - 1, i = Math.floor(e / this.DB), a = this.s << n & this.DM, s = this.t - 1; s >= 0; --s)
t[s + i + 1] = this[s] >> r | a,
a = (this[s] & o) << n;
for (s = i - 1; s >= 0; --s)
t[s] = 0;
t[i] = a,
t.t = this.t + i + 1,
t.s = this.s,
t.clamp()
}
,
e.prototype.rShiftTo = function(e, t) {
t.s = this.s;
var n = Math.floor(e / this.DB);
if (n >= this.t)
t.t = 0;
else {
var r = e % this.DB
, o = this.DB - r
, i = (1 << r) - 1;
t[0] = this[n] >> r;
for (var a = n + 1; a < this.t; ++a)
t[a - n - 1] |= (this[a] & i) << o,
t[a - n] = this[a] >> r;
r > 0 && (t[this.t - n - 1] |= (this.s & i) << o),
t.t = this.t - n,
t.clamp()
}
}
,
e.prototype.subTo = function(e, t) {
var n = 0
, r = 0
, o = Math.min(e.t, this.t);
while (n < o)
r += this[n] - e[n],
t[n++] = r & this.DM,
r >>= this.DB;
if (e.t < this.t) {
r -= e.s;
while (n < this.t)
r += this[n],
t[n++] = r & this.DM,
r >>= this.DB;
r += this.s
} else {
r += this.s;
while (n < e.t)
r -= e[n],
t[n++] = r & this.DM,
r >>= this.DB;
r -= e.s
}
t.s = r < 0 ? -1 : 0,
r < -1 ? t[n++] = this.DV + r : r > 0 && (t[n++] = r),
t.t = n,
t.clamp()
}
,
e.prototype.multiplyTo = function(t, n) {
var r = this.abs()
, o = t.abs()
, i = r.t;
n.t = i + o.t;
while (--i >= 0)
n[i] = 0;
for (i = 0; i < o.t; ++i)
n[i + r.t] = r.am(0, o[i], n, i, 0, r.t);
n.s = 0,
n.clamp(),
this.s != t.s && e.ZERO.subTo(n, n)
}
,
e.prototype.squareTo = function(e) {
var t = this.abs()
, n = e.t = 2 * t.t;
while (--n >= 0)
e[n] = 0;
for (n = 0; n < t.t - 1; ++n) {
var r = t.am(n, t[n], e, 2 * n, 0, 1);
(e[n + t.t] += t.am(n + 1, 2 * t[n], e, 2 * n + 1, r, t.t - n - 1)) >= t.DV && (e[n + t.t] -= t.DV,
e[n + t.t + 1] = 1)
}
e.t > 0 && (e[e.t - 1] += t.am(n, t[n], e, 2 * n, 0, 1)),
e.s = 0,
e.clamp()
}
,
e.prototype.divRemTo = function(t, n, r) {
var o = t.abs();
if (!(o.t <= 0)) {
var i = this.abs();
if (i.t < o.t)
return null != n && n.fromInt(0),
void (null != r && this.copyTo(r));
null == r && (r = R());
var a = R()
, s = this.s
, l = t.s
, c = this.DB - U(o[o.t - 1]);
c > 0 ? (o.lShiftTo(c, a),
i.lShiftTo(c, r)) : (o.copyTo(a),
i.copyTo(r));
var u = a.t
, d = a[u - 1];
if (0 != d) {
var h = d * (1 << this.F1) + (u > 1 ? a[u - 2] >> this.F2 : 0)
, f = this.FV / h
, p = (1 << this.F1) / h
, m = 1 << this.F2
, v = r.t
, g = v - u
, b = null == n ? R() : n;
a.dlShiftTo(g, b),
r.compareTo(b) >= 0 && (r[r.t++] = 1,
r.subTo(b, r)),
e.ONE.dlShiftTo(u, b),
b.subTo(a, a);
while (a.t < u)
a[a.t++] = 0;
while (--g >= 0) {
var y = r[--v] == d ? this.DM : Math.floor(r[v] * f + (r[v - 1] + m) * p);
if ((r[v] += a.am(0, y, r, g, 0, u)) < y) {
a.dlShiftTo(g, b),
r.subTo(b, r);
while (r[v] < --y)
r.subTo(b, r)
}
}
null != n && (r.drShiftTo(u, n),
s != l && e.ZERO.subTo(n, n)),
r.t = u,
r.clamp(),
c > 0 && r.rShiftTo(c, r),
s < 0 && e.ZERO.subTo(r, r)
}
}
}
,
e.prototype.invDigit = function() {
if (this.t < 1)
return 0;
var e = this[0];
if (0 == (1 & e))
return 0;
var t = 3 & e;
return t = t * (2 - (15 & e) * t) & 15,
t = t * (2 - (255 & e) * t) & 255,
t = t * (2 - ((65535 & e) * t & 65535)) & 65535,
t = t * (2 - e * t % this.DV) % this.DV,
t > 0 ? this.DV - t : -t
}
,
e.prototype.isEven = function() {
return 0 == (this.t > 0 ? 1 & this[0] : this.s)
}
,
e.prototype.exp = function(t, n) {
if (t > 4294967295 || t < 1)
return e.ONE;
var r = R()
, o = R()
, i = n.convert(this)
, a = U(t) - 1;
i.copyTo(r);
while (--a >= 0)
if (n.sqrTo(r, o),
(t & 1 << a) > 0)
n.mulTo(o, i, r);
else {
var s = r;
r = o,
o = s
}
return n.revert(r)
}
,
e.prototype.chunkSize = function(e) {
return Math.floor(Math.LN2 * this.DB / Math.log(e))
}
,
e.prototype.toRadix = function(e) {
if (null == e && (e = 10),
0 == this.signum() || e < 2 || e > 36)
return "0";
var t = this.chunkSize(e)
, n = Math.pow(e, t)
, r = W(n)
, o = R()
, i = R()
, a = "";
this.divRemTo(r, o, i);
while (o.signum() > 0)
a = (n + i.intValue()).toString(e).substr(1) + a,
o.divRemTo(r, o, i);
return i.intValue().toString(e) + a
}
,
e.prototype.fromRadix = function(t, n) {
this.fromInt(0),
null == n && (n = 10);
for (var r = this.chunkSize(n), o = Math.pow(n, r), i = !1, a = 0, s = 0, l = 0; l < t.length; ++l) {
var c = K(t, l);
c < 0 ? "-" == t.charAt(l) && 0 == this.signum() && (i = !0) : (s = n * s + c,
++a >= r && (this.dMultiply(o),
this.dAddOffset(s, 0),
a = 0,
s = 0))
}
a > 0 && (this.dMultiply(Math.pow(n, a)),
this.dAddOffset(s, 0)),
i && e.ZERO.subTo(this, this)
}
,
e.prototype.fromNumber = function(t, n, r) {
if ("number" == typeof n)
if (t < 2)
this.fromInt(1);
else {
this.fromNumber(t, r),
this.testBit(t - 1) || this.bitwiseTo(e.ONE.shiftLeft(t - 1), a, this),
this.isEven() && this.dAddOffset(1, 0);
while (!this.isProbablePrime(n))
this.dAddOffset(2, 0),
this.bitLength() > t && this.subTo(e.ONE.shiftLeft(t - 1), this)
}
else {
var o = []
, i = 7 & t;
o.length = 1 + (t >> 3),
n.nextBytes(o),
i > 0 ? o[0] &= (1 << i) - 1 : o[0] = 0,
this.fromString(o, 256)
}
}
,
e.prototype.bitwiseTo = function(e, t, n) {
var r, o, i = Math.min(e.t, this.t);
for (r = 0; r < i; ++r)
n[r] = t(this[r], e[r]);
if (e.t < this.t) {
for (o = e.s & this.DM,
r = i; r < this.t; ++r)
n[r] = t(this[r], o);
n.t = this.t
} else {
for (o = this.s & this.DM,
r = i; r < e.t; ++r)
n[r] = t(o, e[r]);
n.t = e.t
}
n.s = t(this.s, e.s),
n.clamp()
}
,
e.prototype.changeBit = function(t, n) {
var r = e.ONE.shiftLeft(t);
return this.bitwiseTo(r, n, r),
r
}
,
e.prototype.addTo = function(e, t) {
var n = 0
, r = 0
, o = Math.min(e.t, this.t);
while (n < o)
r += this[n] + e[n],
t[n++] = r & this.DM,
r >>= this.DB;
if (e.t < this.t) {
r += e.s;
while (n < this.t)
r += this[n],
t[n++] = r & this.DM,
r >>= this.DB;
r += this.s
} else {
r += this.s;
while (n < e.t)
r += e[n],
t[n++] = r & this.DM,
r >>= this.DB;
r += e.s
}
t.s = r < 0 ? -1 : 0,
r > 0 ? t[n++] = r : r < -1 && (t[n++] = this.DV + r),
t.t = n,
t.clamp()
}
,
e.prototype.dMultiply = function(e) {
this[this.t] = this.am(0, e - 1, this, 0, 0, this.t),
++this.t,
this.clamp()
}
,
e.prototype.dAddOffset = function(e, t) {
if (0 != e) {
while (this.t <= t)
this[this.t++] = 0;
this[t] += e;
while (this[t] >= this.DV)
this[t] -= this.DV,
++t >= this.t && (this[this.t++] = 0),
++this[t]
}
}
,
e.prototype.multiplyLowerTo = function(e, t, n) {
var r = Math.min(this.t + e.t, t);
n.s = 0,
n.t = r;
while (r > 0)
n[--r] = 0;
for (var o = n.t - this.t; r < o; ++r)
n[r + this.t] = this.am(0, e[r], n, r, 0, this.t);
for (o = Math.min(e.t, t); r < o; ++r)
this.am(0, e[r], n, r, 0, t - r);
n.clamp()
}
,
e.prototype.multiplyUpperTo = function(e, t, n) {
--t;
var r = n.t = this.t + e.t - t;
n.s = 0;
while (--r >= 0)
n[r] = 0;
for (r = Math.max(t - this.t, 0); r < e.t; ++r)
n[this.t + r - t] = this.am(t - r, e[r], n, 0, 0, this.t + r - t);
n.clamp(),
n.drShiftTo(1, n)
}
,
e.prototype.modInt = function(e) {
if (e <= 0)
return 0;
var t = this.DV % e
, n = this.s < 0 ? e - 1 : 0;
if (this.t > 0)
if (0 == t)
n = this[0] % e;
else
for (var r = this.t - 1; r >= 0; --r)
n = (t * n + this[r]) % e;
return n
}
,
e.prototype.millerRabin = function(t) {
var n = this.subtract(e.ONE)
, r = n.getLowestSetBit();
if (r <= 0)
return !1;
var o = n.shiftRight(r);
t = t + 1 >> 1,
t > L.length && (t = L.length);
for (var i = R(), a = 0; a < t; ++a) {
i.fromInt(L[Math.floor(Math.random() * L.length)]);
var s = i.modPow(o, this);
if (0 != s.compareTo(e.ONE) && 0 != s.compareTo(n)) {
var l = 1;
while (l++ < r && 0 != s.compareTo(n))
if (s = s.modPowInt(2, this),
0 == s.compareTo(e.ONE))
return !1;
if (0 != s.compareTo(n))
return !1
}
}
return !0
}
,
e.prototype.square = function() {
var e = R();
return this.squareTo(e),
e
}
,
e.prototype.gcda = function(e, t) {
var n = this.s < 0 ? this.negate() : this.clone()
, r = e.s < 0 ? e.negate() : e.clone();
if (n.compareTo(r) < 0) {
var o = n;
n = r,
r = o
}
var i = n.getLowestSetBit()
, a = r.getLowestSetBit();
if (a < 0)
t(n);
else {
i < a && (a = i),
a > 0 && (n.rShiftTo(a, n),
r.rShiftTo(a, r));
var s = function() {
(i = n.getLowestSetBit()) > 0 && n.rShiftTo(i, n),
(i = r.getLowestSetBit()) > 0 && r.rShiftTo(i, r),
n.compareTo(r) >= 0 ? (n.subTo(r, n),
n.rShiftTo(1, n)) : (r.subTo(n, r),
r.rShiftTo(1, r)),
n.signum() > 0 ? setTimeout(s, 0) : (a > 0 && r.lShiftTo(a, r),
setTimeout((function() {
t(r)
}
), 0))
};
setTimeout(s, 10)
}
}
,
e.prototype.fromNumberAsync = function(t, n, r, o) {
if ("number" == typeof n)
if (t < 2)
this.fromInt(1);
else {
this.fromNumber(t, r),
this.testBit(t - 1) || this.bitwiseTo(e.ONE.shiftLeft(t - 1), a, this),
this.isEven() && this.dAddOffset(1, 0);
var i = this
, s = function() {
i.dAddOffset(2, 0),
i.bitLength() > t && i.subTo(e.ONE.shiftLeft(t - 1), i),
i.isProbablePrime(n) ? setTimeout((function() {
o()
}
), 0) : setTimeout(s, 0)
};
setTimeout(s, 0)
}
else {
var l = []
, c = 7 & t;
l.length = 1 + (t >> 3),
n.nextBytes(l),
c > 0 ? l[0] &= (1 << c) - 1 : l[0] = 0,
this.fromString(l, 256)
}
}
,
e
}(), E = function() {
function e() {}
return e.prototype.convert = function(e) {
return e
}
,
e.prototype.revert = function(e) {
return e
}
,
e.prototype.mulTo = function(e, t, n) {
e.multiplyTo(t, n)
}
,
e.prototype.sqrTo = function(e, t) {
e.squareTo(t)
}
,
e
}(), H = function() {
function e(e) {
this.m = e
}
return e.prototype.convert = function(e) {
return e.s < 0 || e.compareTo(this.m) >= 0 ? e.mod(this.m) : e
}
,
e.prototype.revert = function(e) {
return e
}
,
e.prototype.reduce = function(e) {
e.divRemTo(this.m, null, e)
}
,
e.prototype.mulTo = function(e, t, n) {
e.multiplyTo(t, n),
this.reduce(n)
}
,
e.prototype.sqrTo = function(e, t) {
e.squareTo(t),
this.reduce(t)
}
,
e
}(), A = function() {
function e(e) {
this.m = e,
this.mp = e.invDigit(),
this.mpl = 32767 & this.mp,
this.mph = this.mp >> 15,
this.um = (1 << e.DB - 15) - 1,
this.mt2 = 2 * e.t
}
return e.prototype.convert = function(e) {
var t = R();
return e.abs().dlShiftTo(this.m.t, t),
t.divRemTo(this.m, null, t),
e.s < 0 && t.compareTo(D.ZERO) > 0 && this.m.subTo(t, t),
t
}
,
e.prototype.revert = function(e) {
var t = R();
return e.copyTo(t),
this.reduce(t),
t
}
,
e.prototype.reduce = function(e) {
while (e.t <= this.mt2)
e[e.t++] = 0;
for (var t = 0; t < this.m.t; ++t) {
var n = 32767 & e[t]
, r = n * this.mpl + ((n * this.mph + (e[t] >> 15) * this.mpl & this.um) << 15) & e.DM;
n = t + this.m.t,
e[n] += this.m.am(0, r, e, t, 0, this.m.t);
while (e[n] >= e.DV)
e[n] -= e.DV,
e[++n]++
}
e.clamp(),
e.drShiftTo(this.m.t, e),
e.compareTo(this.m) >= 0 && e.subTo(this.m, e)
}
,
e.prototype.mulTo = function(e, t, n) {
e.multiplyTo(t, n),
this.reduce(n)
}
,
e.prototype.sqrTo = function(e, t) {
e.squareTo(t),
this.reduce(t)
}
,
e
}(), V = function() {
function e(e) {
this.m = e,
this.r2 = R(),
this.q3 = R(),
D.ONE.dlShiftTo(2 * e.t, this.r2),
this.mu = this.r2.divide(e)
}
return e.prototype.convert = function(e) {
if (e.s < 0 || e.t > 2 * this.m.t)
return e.mod(this.m);
if (e.compareTo(this.m) < 0)
return e;
var t = R();
return e.copyTo(t),
this.reduce(t),
t
}
,
e.prototype.revert = function(e) {
return e
}
,
e.prototype.reduce = function(e) {
e.drShiftTo(this.m.t - 1, this.r2),
e.t > this.m.t + 1 && (e.t = this.m.t + 1,
e.clamp()),
this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3),
this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2);
while (e.compareTo(this.r2) < 0)
e.dAddOffset(1, this.m.t + 1);
e.subTo(this.r2, e);
while (e.compareTo(this.m) >= 0)
e.subTo(this.m, e)
}
,
e.prototype.mulTo = function(e, t, n) {
e.multiplyTo(t, n),
this.reduce(n)
}
,
e.prototype.sqrTo = function(e, t) {
e.squareTo(t),
this.reduce(t)
}
,
e
}();
function R() {
return new D(null)
}
function I(e, t) {
return new D(e,t)
}
var F = "undefined" !== typeof navigator;
F && P && "Microsoft Internet Explorer" == navigator.appName ? (D.prototype.am = function(e, t, n, r, o, i) {
var a = 32767 & t
, s = t >> 15;
while (--i >= 0) {
var l = 32767 & this[e]
, c = this[e++] >> 15
, u = s * l + c * a;
l = a * l + ((32767 & u) << 15) + n[r] + (1073741823 & o),
o = (l >>> 30) + (u >>> 15) + s * c + (o >>> 30),
n[r++] = 1073741823 & l
}
return o
}
,
j = 30) : F && P && "Netscape" != navigator.appName ? (D.prototype.am = function(e, t, n, r, o, i) {
while (--i >= 0) {
var a = t * this[e++] + n[r] + o;
o = Math.floor(a / 67108864),
n[r++] = 67108863 & a
}
return o
}
,
j = 26) : (D.prototype.am = function(e, t, n, r, o, i) {
var a = 16383 & t
, s = t >> 14;
while (--i >= 0) {
var l = 16383 & this[e]
, c = this[e++] >> 14
, u = s * l + c * a;
l = a * l + ((16383 & u) << 14) + n[r] + o,
o = (l >> 28) + (u >> 14) + s * c,
n[r++] = 268435455 & l
}
return o
}
,
j = 28),
D.prototype.DB = j,
D.prototype.DM = (1 << j) - 1,
D.prototype.DV = 1 << j;
var N = 52;
D.prototype.FV = Math.pow(2, N),
D.prototype.F1 = N - j,
D.prototype.F2 = 2 * j - N;
var Y, $, B = [];
for (Y = "0".charCodeAt(0),
$ = 0; $ <= 9; ++$)
B[Y++] = $;
for (Y = "a".charCodeAt(0),
$ = 10; $ < 36; ++$)
B[Y++] = $;
for (Y = "A".charCodeAt(0),
$ = 10; $ < 36; ++$)
B[Y++] = $;
function K(e, t) {
var n = B[e.charCodeAt(t)];
return null == n ? -1 : n
}
function W(e) {
var t = R();
return t.fromInt(e),
t
}
function U(e) {
var t, n = 1;
return 0 != (t = e >>> 16) && (e = t,
n += 16),
0 != (t = e >> 8) && (e = t,
n += 8),
0 != (t = e >> 4) && (e = t,
n += 4),
0 != (t = e >> 2) && (e = t,
n += 2),
0 != (t = e >> 1) && (e = t,
n += 1),
n
}
D.ZERO = W(0),
D.ONE = W(1);
var q = function() {
function e() {
this.i = 0,
this.j = 0,
this.S = []
}
return e.prototype.init = function(e) {
var t, n, r;
for (t = 0; t < 256; ++t)
this.S[t] = t;
for (n = 0,
t = 0; t < 256; ++t)
n = n + this.S[t] + e[t % e.length] & 255,
r = this.S[t],
this.S[t] = this.S[n],
this.S[n] = r;
this.i = 0,
this.j = 0
}
,
e.prototype.next = function() {
var e;
return this.i = this.i + 1 & 255,
this.j = this.j + this.S[this.i] & 255,
e = this.S[this.i],
this.S[this.i] = this.S[this.j],
this.S[this.j] = e,
this.S[e + this.S[this.i] & 255]
}
,
e
}();
function G() {
return new q
}
var X, J, Z = 256, Q = null;
if (null == Q) {
Q = [],
J = 0;
var ee = void 0;
if (window.crypto && window.crypto.getRandomValues) {
var te = new Uint32Array(256);
for (window.crypto.getRandomValues(te),
ee = 0; ee < te.length; ++ee)
Q[J++] = 255 & te[ee]
}
var ne = 0
, re = function(e) {
if (ne = ne || 0,
ne >= 256 || J >= Z)
window.removeEventListener ? window.removeEventListener("mousemove", re, !1) : window.detachEvent && window.detachEvent("onmousemove", re);
else
try {
var t = e.x + e.y;
Q[J++] = 255 & t,
ne += 1
} catch (n) {}
};
window.addEventListener ? window.addEventListener("mousemove", re, !1) : window.attachEvent && window.attachEvent("onmousemove", re)
}
function oe() {
if (null == X) {
X = G();
while (J < Z) {
var e = Math.floor(65536 * Math.random());
Q[J++] = 255 & e
}
for (X.init(Q),
J = 0; J < Q.length; ++J)
Q[J] = 0;
J = 0
}
return X.next()
}
var ie = function() {
function e() {}
return e.prototype.nextBytes = function(e) {
for (var t = 0; t < e.length; ++t)
e[t] = oe()
}
,
e
}();
function ae(e, t) {
if (t < e.length + 22)
return console.error("Message too long for RSA"),
null;
for (var n = t - e.length - 6, r = "", o = 0; o < n; o += 2)
r += "ff";
var i = "0001" + r + "00" + e;
return I(i, 16)
}
function se(e, t) {
if (t < e.length + 11)
return console.error("Message too long for RSA"),
null;
var n = []
, r = e.length - 1;
while (r >= 0 && t > 0) {
var o = e.charCodeAt(r--);
o < 128 ? n[--t] = o : o > 127 && o < 2048 ? (n[--t] = 63 & o | 128,
n[--t] = o >> 6 | 192) : (n[--t] = 63 & o | 128,
n[--t] = o >> 6 & 63 | 128,
n[--t] = o >> 12 | 224)
}
n[--t] = 0;
var i = new ie
, a = [];
while (t > 2) {
a[0] = 0;
while (0 == a[0])
i.nextBytes(a);
n[--t] = a[0]
}
return n[--t] = 2,
n[--t] = 0,
new D(n)
}
var le = function() {
function e() {
this.n = null,
this.e = 0,
this.d = null,
this.p = null,
this.q = null,
this.dmp1 = null,
this.dmq1 = null,
this.coeff = null
}
return e.prototype.doPublic = function(e) {
return e.modPowInt(this.e, this.n)
}
,
e.prototype.doPrivate = function(e) {
if (null == this.p || null == this.q)
return e.modPow(this.d, this.n);
var t = e.mod(this.p).modPow(this.dmp1, this.p)
, n = e.mod(this.q).modPow(this.dmq1, this.q);
while (t.compareTo(n) < 0)
t = t.add(this.p);
return t.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)
}
,
e.prototype.setPublic = function(e, t) {
null != e && null != t && e.length > 0 && t.length > 0 ? (this.n = I(e, 16),
this.e = parseInt(t, 16)) : console.error("Invalid RSA public key")
}
,
e.prototype.encrypt = function(e) {
var t = this.n.bitLength() + 7 >> 3
, n = se(e, t);
if (null == n)
return null;
var r = this.doPublic(n);
if (null == r)
return null;
for (var o = r.toString(16), i = o.length, a = 0; a < 2 * t - i; a++)
o = "0" + o;
return o
}
,
e.prototype.setPrivate = function(e, t, n) {
null != e && null != t && e.length > 0 && t.length > 0 ? (this.n = I(e, 16),
this.e = parseInt(t, 16),
this.d = I(n, 16)) : console.error("Invalid RSA private key")
}
,
e.prototype.setPrivateEx = function(e, t, n, r, o, i, a, s) {
null != e && null != t && e.length > 0 && t.length > 0 ? (this.n = I(e, 16),
this.e = parseInt(t, 16),
this.d = I(n, 16),
this.p = I(r, 16),
this.q = I(o, 16),
this.dmp1 = I(i, 16),
this.dmq1 = I(a, 16),
this.coeff = I(s, 16)) : console.error("Invalid RSA private key")
}
,
e.prototype.generate = function(e, t) {
var n = new ie
, r = e >> 1;
this.e = parseInt(t, 16);
for (var o = new D(t,16); ; ) {
for (; ; )
if (this.p = new D(e - r,1,n),
0 == this.p.subtract(D.ONE).gcd(o).compareTo(D.ONE) && this.p.isProbablePrime(10))
break;
for (; ; )
if (this.q = new D(r,1,n),
0 == this.q.subtract(D.ONE).gcd(o).compareTo(D.ONE) && this.q.isProbablePrime(10))
break;
if (this.p.compareTo(this.q) <= 0) {
var i = this.p;
this.p = this.q,
this.q = i
}
var a = this.p.subtract(D.ONE)
, s = this.q.subtract(D.ONE)
, l = a.multiply(s);
if (0 == l.gcd(o).compareTo(D.ONE)) {
this.n = this.p.multiply(this.q),
this.d = o.modInverse(l),
this.dmp1 = this.d.mod(a),
this.dmq1 = this.d.mod(s),
this.coeff = this.q.modInverse(this.p);
break
}
}
}
,
e.prototype.decrypt = function(e) {
var t = I(e, 16)
, n = this.doPrivate(t);
return null == n ? null : ce(n, this.n.bitLength() + 7 >> 3)
}
,
e.prototype.generateAsync = function(e, t, n) {
var r = new ie
, o = e >> 1;
this.e = parseInt(t, 16);
var i = new D(t,16)
, a = this
, s = function() {
var t = function() {
if (a.p.compareTo(a.q) <= 0) {
var e = a.p;
a.p = a.q,
a.q = e
}
var t = a.p.subtract(D.ONE)
, r = a.q.subtract(D.ONE)
, o = t.multiply(r);
0 == o.gcd(i).compareTo(D.ONE) ? (a.n = a.p.multiply(a.q),
a.d = i.modInverse(o),
a.dmp1 = a.d.mod(t),
a.dmq1 = a.d.mod(r),
a.coeff = a.q.modInverse(a.p),
setTimeout((function() {
n()
}
), 0)) : setTimeout(s, 0)
}
, l = function() {
a.q = R(),
a.q.fromNumberAsync(o, 1, r, (function() {
a.q.subtract(D.ONE).gcda(i, (function(e) {
0 == e.compareTo(D.ONE) && a.q.isProbablePrime(10) ? setTimeout(t, 0) : setTimeout(l, 0)
}
))
}
))
}
, c = function() {
a.p = R(),
a.p.fromNumberAsync(e - o, 1, r, (function() {
a.p.subtract(D.ONE).gcda(i, (function(e) {
0 == e.compareTo(D.ONE) && a.p.isProbablePrime(10) ? setTimeout(l, 0) : setTimeout(c, 0)
}
))
}
))
};
setTimeout(c, 0)
};
setTimeout(s, 0)
}
,
e.prototype.sign = function(e, t, n) {
var r = de(n)
, o = r + t(e).toString()
, i = ae(o, this.n.bitLength() / 4);
if (null == i)
return null;
var a = this.doPrivate(i);
if (null == a)
return null;
var s = a.toString(16);
return 0 == (1 & s.length) ? s : "0" + s
}
,
e.prototype.verify = function(e, t, n) {
var r = I(t, 16)
, o = this.doPublic(r);
if (null == o)
return null;
var i = o.toString(16).replace(/^1f+00/, "")
, a = he(i);
return a == n(e).toString()
}
,
e
}();
function ce(e, t) {
var n = e.toByteArray()
, r = 0;
while (r < n.length && 0 == n[r])
++r;
if (n.length - r != t - 1 || 2 != n[r])
return null;
++r;
while (0 != n[r])
if (++r >= n.length)
return null;
var o = "";
while (++r < n.length) {
var i = 255 & n[r];
i < 128 ? o += String.fromCharCode(i) : i > 191 && i < 224 ? (o += String.fromCharCode((31 & i) << 6 | 63 & n[r + 1]),
++r) : (o += String.fromCharCode((15 & i) << 12 | (63 & n[r + 1]) << 6 | 63 & n[r + 2]),
r += 2)
}
return o
}
var ue = {
md2: "3020300c06082a864886f70d020205000410",
md5: "3020300c06082a864886f70d020505000410",
sha1: "3021300906052b0e03021a05000414",
sha224: "302d300d06096086480165030402040500041c",
sha256: "3031300d060960864801650304020105000420",
sha384: "3041300d060960864801650304020205000430",
sha512: "3051300d060960864801650304020305000440",
ripemd160: "3021300906052b2403020105000414"
};
function de(e) {
return ue[e] || ""
}
function he(e) {
for (var t in ue)
if (ue.hasOwnProperty(t)) {
var n = ue[t]
, r = n.length;
if (e.substr(0, r) == n)
return e.substr(r)
}
return e
}
/*!
Copyright (c) 2011, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 2.9.0
*/
var fe = {};
fe.lang = {
extend: function(e, t, n) {
if (!t || !e)
throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");
var r = function() {};
if (r.prototype = t.prototype,
e.prototype = new r,
e.prototype.constructor = e,
e.superclass = t.prototype,
t.prototype.constructor == Object.prototype.constructor && (t.prototype.constructor = t),
n) {
var o;
for (o in n)
e.prototype[o] = n[o];
var i = function() {}
, a = ["toString", "valueOf"];
try {
/MSIE/.test(navigator.userAgent) && (i = function(e, t) {
for (o = 0; o < a.length; o += 1) {
var n = a[o]
, r = t[n];
"function" === typeof r && r != Object.prototype[n] && (e[n] = r)
}
}
)
} catch (s) {}
i(e.prototype, n)
}
}
};
/**
* @fileOverview
* @name asn1-1.0.js
* @author Kenji Urushima kenji.urushima@gmail.com
* @version asn1 1.0.13 (2017-Jun-02)
* @since jsrsasign 2.1
* @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
*/
var pe = {};
"undefined" != typeof pe.asn1 && pe.asn1 || (pe.asn1 = {}),
pe.asn1.ASN1Util = new function() {
this.integerToByteHex = function(e) {
var t = e.toString(16);
return t.length % 2 == 1 && (t = "0" + t),
t
}
,
this.bigIntToMinTwosComplementsHex = function(e) {
var t = e.toString(16);
if ("-" != t.substr(0, 1))
t.length % 2 == 1 ? t = "0" + t : t.match(/^[0-7]/) || (t = "00" + t);
else {
var n = t.substr(1)
, r = n.length;
r % 2 == 1 ? r += 1 : t.match(/^[0-7]/) || (r += 2);
for (var o = "", i = 0; i < r; i++)
o += "f";
var a = new D(o,16)
, s = a.xor(e).add(D.ONE);
t = s.toString(16).replace(/^-/, "")
}
return t
}
,
this.getPEMStringFromHex = function(e, t) {
return hextopem(e, t)
}
,
this.newObject = function(e) {
var t = pe
, n = t.asn1
, r = n.DERBoolean
, o = n.DERInteger
, i = n.DERBitString
, a = n.DEROctetString
, s = n.DERNull
, l = n.DERObjectIdentifier
, c = n.DEREnumerated
, u = n.DERUTF8String
, d = n.DERNumericString
, h = n.DERPrintableString
, f = n.DERTeletexString
, p = n.DERIA5String
, m = n.DERUTCTime
, v = n.DERGeneralizedTime
, g = n.DERSequence
, b = n.DERSet
, y = n.DERTaggedObject
, _ = n.ASN1Util.newObject
, x = Object.keys(e);
if (1 != x.length)
throw "key of param shall be only one.";
var w = x[0];
if (-1 == ":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":" + w + ":"))
throw "undefined key: " + w;
if ("bool" == w)
return new r(e[w]);
if ("int" == w)
return new o(e[w]);
if ("bitstr" == w)
return new i(e[w]);
if ("octstr" == w)
return new a(e[w]);
if ("null" == w)
return new s(e[w]);
if ("oid" == w)
return new l(e[w]);
if ("enum" == w)
return new c(e[w]);
if ("utf8str" == w)
return new u(e[w]);
if ("numstr" == w)
return new d(e[w]);
if ("prnstr" == w)
return new h(e[w]);
if ("telstr" == w)
return new f(e[w]);
if ("ia5str" == w)
return new p(e[w]);
if ("utctime" == w)
return new m(e[w]);
if ("gentime" == w)
return new v(e[w]);
if ("seq" == w) {
for (var C = e[w], S = [], j = 0; j < C.length; j++) {
var k = _(C[j]);
S.push(k)
}
return new g({
array: S
})
}
if ("set" == w) {
for (C = e[w],
S = [],
j = 0; j < C.length; j++) {
k = _(C[j]);
S.push(k)
}
return new b({
array: S
})
}
if ("tag" == w) {
var O = e[w];
if ("[object Array]" === Object.prototype.toString.call(O) && 3 == O.length) {
var M = _(O[2]);
return new y({
tag: O[0],
explicit: O[1],
obj: M
})
}
var T = {};
if (void 0 !== O.explicit && (T.explicit = O.explicit),
void 0 !== O.tag && (T.tag = O.tag),
void 0 === O.obj)
throw "obj shall be specified for 'tag'.";
return T.obj = _(O.obj),
new y(T)
}
}
,
this.jsonToASN1HEX = function(e) {
var t = this.newObject(e);
return t.getEncodedHex()
}
}
,
pe.asn1.ASN1Util.oidHexToInt = function(e) {
for (var t = "", n = parseInt(e.substr(0, 2), 16), r = Math.floor(n / 40), o = n % 40, i = (t = r + "." + o,
""), a = 2; a < e.length; a += 2) {
var s = parseInt(e.substr(a, 2), 16)
, l = ("00000000" + s.toString(2)).slice(-8);
if (i += l.substr(1, 7),
"0" == l.substr(0, 1)) {
var c = new D(i,2);
t = t + "." + c.toString(10),
i = ""
}
}
return t
}
,
pe.asn1.ASN1Util.oidIntToHex = function(e) {
var t = function(e) {
var t = e.toString(16);
return 1 == t.length && (t = "0" + t),
t
}
, n = function(e) {
var n = ""
, r = new D(e,10)
, o = r.toString(2)
, i = 7 - o.length % 7;
7 == i && (i = 0);
for (var a = "", s = 0; s < i; s++)
a += "0";
o = a + o;
for (s = 0; s < o.length - 1; s += 7) {
var l = o.substr(s, 7);
s != o.length - 7 && (l = "1" + l),
n += t(parseInt(l, 2))
}
return n
};
if (!e.match(/^[0-9.]+$/))
throw "malformed oid string: " + e;
var r = ""
, o = e.split(".")
, i = 40 * parseInt(o[0]) + parseInt(o[1]);
r += t(i),
o.splice(0, 2);
for (var a = 0; a < o.length; a++)
r += n(o[a]);
return r
}
,
pe.asn1.ASN1Object = function() {
var e = "";
this.getLengthHexFromValue = function() {
if ("undefined" == typeof this.hV || null == this.hV)
throw "this.hV is null or undefined.";
if (this.hV.length % 2 == 1)
throw "value hex must be even length: n=" + e.length + ",v=" + this.hV;
var t = this.hV.length / 2
, n = t.toString(16);
if (n.length % 2 == 1 && (n = "0" + n),
t < 128)
return n;
var r = n.length / 2;
if (r > 15)
throw "ASN.1 length too long to represent by 8x: n = " + t.toString(16);
var o = 128 + r;
return o.toString(16) + n
}
,
this.getEncodedHex = function() {
return (null == this.hTLV || this.isModified) && (this.hV = this.getFreshValueHex(),
this.hL = this.getLengthHexFromValue(),
this.hTLV = this.hT + this.hL + this.hV,
this.isModified = !1),
this.hTLV
}
,
this.getValueHex = function() {
return this.getEncodedHex(),
this.hV
}
,
this.getFreshValueHex = function() {
return ""
}
}
,
pe.asn1.DERAbstractString = function(e) {
pe.asn1.DERAbstractString.superclass.constructor.call(this);
this.getString = function() {
return this.s
}
,
this.setString = function(e) {
this.hTLV = null,
this.isModified = !0,
this.s = e,
this.hV = stohex(this.s)
}
,
this.setStringHex = function(e) {
this.hTLV = null,
this.isModified = !0,
this.s = null,
this.hV = e
}
,
this.getFreshValueHex = function() {
return this.hV
}
,
"undefined" != typeof e && ("string" == typeof e ? this.setString(e) : "undefined" != typeof e["str"] ? this.setString(e["str"]) : "undefined" != typeof e["hex"] && this.setStringHex(e["hex"]))
}
,
fe.lang.extend(pe.asn1.DERAbstractString, pe.asn1.ASN1Object),
pe.asn1.DERAbstractTime = function(e) {
pe.asn1.DERAbstractTime.superclass.constructor.call(this);
this.localDateToUTC = function(e) {
utc = e.getTime() + 6e4 * e.getTimezoneOffset();
var t = new Date(utc);
return t
}
,
this.formatDate = function(e, t, n) {
var r = this.zeroPadding
, o = this.localDateToUTC(e)
, i = String(o.getFullYear());
"utc" == t && (i = i.substr(2, 2));
var a = r(String(o.getMonth() + 1), 2)
, s = r(String(o.getDate()), 2)
, l = r(String(o.getHours()), 2)
, c = r(String(o.getMinutes()), 2)
, u = r(String(o.getSeconds()), 2)
, d = i + a + s + l + c + u;
if (!0 === n) {
var h = o.getMilliseconds();
if (0 != h) {
var f = r(String(h), 3);
f = f.replace(/[0]+$/, ""),
d = d + "." + f
}
}
return d + "Z"
}
,
this.zeroPadding = function(e, t) {
return e.length >= t ? e : new Array(t - e.length + 1).join("0") + e
}
,
this.getString = function() {
return this.s
}
,
this.setString = function(e) {
this.hTLV = null,
this.isModified = !0,
this.s = e,
this.hV = stohex(e)
}
,
this.setByDateValue = function(e, t, n, r, o, i) {
var a = new Date(Date.UTC(e, t - 1, n, r, o, i, 0));
this.setByDate(a)
}
,
this.getFreshValueHex = function() {
return this.hV
}
}
,
fe.lang.extend(pe.asn1.DERAbstractTime, pe.asn1.ASN1Object),
pe.asn1.DERAbstractStructured = function(e) {
pe.asn1.DERAbstractString.superclass.constructor.call(this);
this.setByASN1ObjectArray = function(e) {
this.hTLV = null,
this.isModified = !0,
this.asn1Array = e
}
,
this.appendASN1Object = function(e) {
this.hTLV = null,
this.isModified = !0,
this.asn1Array.push(e)
}
,
this.asn1Array = new Array,
"undefined" != typeof e && "undefined" != typeof e["array"] && (this.asn1Array = e["array"])
}
,
fe.lang.extend(pe.asn1.DERAbstractStructured, pe.asn1.ASN1Object),
pe.asn1.DERBoolean = function() {
pe.asn1.DERBoolean.superclass.constructor.call(this),
this.hT = "01",
this.hTLV = "0101ff"
}
,
fe.lang.extend(pe.asn1.DERBoolean, pe.asn1.ASN1Object),
pe.asn1.DERInteger = function(e) {
pe.asn1.DERInteger.superclass.constructor.call(this),
this.hT = "02",
this.setByBigInteger = function(e) {
this.hTLV = null,
this.isModified = !0,
this.hV = pe.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)
}
,
this.setByInteger = function(e) {
var t = new D(String(e),10);
this.setByBigInteger(t)
}
,
this.setValueHex = function(e) {
this.hV = e
}
,
this.getFreshValueHex = function() {
return this.hV
}
,
"undefined" != typeof e && ("undefined" != typeof e["bigint"] ? this.setByBigInteger(e["bigint"]) : "undefined" != typeof e["int"] ? this.setByInteger(e["int"]) : "number" == typeof e ? this.setByInteger(e) : "undefined" != typeof e["hex"] && this.setValueHex(e["hex"]))
}
,
fe.lang.extend(pe.asn1.DERInteger, pe.asn1.ASN1Object),
pe.asn1.DERBitString = function(e) {
if (void 0 !== e && "undefined" !== typeof e.obj) {
var t = pe.asn1.ASN1Util.newObject(e.obj);
e.hex = "00" + t.getEncodedHex()
}
pe.asn1.DERBitString.superclass.constructor.call(this),
this.hT = "03",
this.setHexValueIncludingUnusedBits = function(e) {
this.hTLV = null,
this.isModified = !0,
this.hV = e
}
,
this.setUnusedBitsAndHexValue = function(e, t) {
if (e < 0 || 7 < e)
throw "unused bits shall be from 0 to 7: u = " + e;
var n = "0" + e;
this.hTLV = null,
this.isModified = !0,
this.hV = n + t
}
,
this.setByBinaryString = function(e) {
e = e.replace(/0+$/, "");
var t = 8 - e.length % 8;
8 == t && (t = 0);
for (var n = 0; n <= t; n++)
e += "0";
var r = "";
for (n = 0; n < e.length - 1; n += 8) {
var o = e.substr(n, 8)
, i = parseInt(o, 2).toString(16);
1 == i.length && (i = "0" + i),
r += i
}
this.hTLV = null,
this.isModified = !0,
this.hV = "0" + t + r
}
,
this.setByBooleanArray = function(e) {
for (var t = "", n = 0; n < e.length; n++)
1 == e[n] ? t += "1" : t += "0";
this.setByBinaryString(t)
}
,
this.newFalseArray = function(e) {
for (var t = new Array(e), n = 0; n < e; n++)
t[n] = !1;
return t
}
,
this.getFreshValueHex = function() {
return this.hV
}
,
"undefined" != typeof e && ("string" == typeof e && e.toLowerCase().match(/^[0-9a-f]+$/) ? this.setHexValueIncludingUnusedBits(e) : "undefined" != typeof e["hex"] ? this.setHexValueIncludingUnusedBits(e["hex"]) : "undefined" != typeof e["bin"] ? this.setByBinaryString(e["bin"]) : "undefined" != typeof e["array"] && this.setByBooleanArray(e["array"]))
}
,
fe.lang.extend(pe.asn1.DERBitString, pe.asn1.ASN1Object),
pe.asn1.DEROctetString = function(e) {
if (void 0 !== e && "undefined" !== typeof e.obj) {
var t = pe.asn1.ASN1Util.newObject(e.obj);
e.hex = t.getEncodedHex()
}
pe.asn1.DEROctetString.superclass.constructor.call(this, e),
this.hT = "04"
}
,
fe.lang.extend(pe.asn1.DEROctetString, pe.asn1.DERAbstractString),
pe.asn1.DERNull = function() {
pe.asn1.DERNull.superclass.constructor.call(this),
this.hT = "05",
this.hTLV = "0500"
}
,
fe.lang.extend(pe.asn1.DERNull, pe.asn1.ASN1Object),
pe.asn1.DERObjectIdentifier = function(e) {
var t = function(e) {
var t = e.toString(16);
return 1 == t.length && (t = "0" + t),
t
}
, n = function(e) {
var n = ""
, r = new D(e,10)
, o = r.toString(2)
, i = 7 - o.length % 7;
7 == i && (i = 0);
for (var a = "", s = 0; s < i; s++)
a += "0";
o = a + o;
for (s = 0; s < o.length - 1; s += 7) {
var l = o.substr(s, 7);
s != o.length - 7 && (l = "1" + l),
n += t(parseInt(l, 2))
}
return n
};
pe.asn1.DERObjectIdentifier.superclass.constructor.call(this),
this.hT = "06",
this.setValueHex = function(e) {
this.hTLV = null,
this.isModified = !0,
this.s = null,
this.hV = e
}
,
this.setValueOidString = function(e) {
if (!e.match(/^[0-9.]+$/))
throw "malformed oid string: " + e;
var r = ""
, o = e.split(".")
, i = 40 * parseInt(o[0]) + parseInt(o[1]);
r += t(i),
o.splice(0, 2);
for (var a = 0; a < o.length; a++)
r += n(o[a]);
this.hTLV = null,
this.isModified = !0,
this.s = null,
this.hV = r
}
,
this.setValueName = function(e) {
var t = pe.asn1.x509.OID.name2oid(e);
if ("" === t)
throw "DERObjectIdentifier oidName undefined: " + e;
this.setValueOidString(t)
}
,
this.getFreshValueHex = function() {
return this.hV
}
,
void 0 !== e && ("string" === typeof e ? e.match(/^[0-2].[0-9.]+$/) ? this.setValueOidString(e) : this.setValueName(e) : void 0 !== e.oid ? this.setValueOidString(e.oid) : void 0 !== e.hex ? this.setValueHex(e.hex) : void 0 !== e.name && this.setValueName(e.name))
}
,
fe.lang.extend(pe.asn1.DERObjectIdentifier, pe.asn1.ASN1Object),
pe.asn1.DEREnumerated = function(e) {
pe.asn1.DEREnumerated.superclass.constructor.call(this),
this.hT = "0a",
this.setByBigInteger = function(e) {
this.hTLV = null,
this.isModified = !0,
this.hV = pe.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)
}
,
this.setByInteger = function(e) {
var t = new D(String(e),10);
this.setByBigInteger(t)
}
,
this.setValueHex = function(e) {
this.hV = e
}
,
this.getFreshValueHex = function() {
return this.hV
}
,
"undefined" != typeof e && ("undefined" != typeof e["int"] ? this.setByInteger(e["int"]) : "number" == typeof e ? this.setByInteger(e) : "undefined" != typeof e["hex"] && this.setValueHex(e["hex"]))
}
,
fe.lang.extend(pe.asn1.DEREnumerated, pe.asn1.ASN1Object),
pe.asn1.DERUTF8String = function(e) {
pe.asn1.DERUTF8String.superclass.constructor.call(this, e),
this.hT = "0c"
}
,
fe.lang.extend(pe.asn1.DERUTF8String, pe.asn1.DERAbstractString),
pe.asn1.DERNumericString = function(e) {
pe.asn1.DERNumericString.superclass.constructor.call(this, e),
this.hT = "12"
}
,
fe.lang.extend(pe.asn1.DERNumericString, pe.asn1.DERAbstractString),
pe.asn1.DERPrintableString = function(e) {
pe.asn1.DERPrintableString.superclass.constructor.call(this, e),
this.hT = "13"
}
,
fe.lang.extend(pe.asn1.DERPrintableString, pe.asn1.DERAbstractString),
pe.asn1.DERTeletexString = function(e) {
pe.asn1.DERTeletexString.superclass.constructor.call(this, e),
this.hT = "14"
}
,
fe.lang.extend(pe.asn1.DERTeletexString, pe.asn1.DERAbstractString),
pe.asn1.DERIA5String = function(e) {
pe.asn1.DERIA5String.superclass.constructor.call(this, e),
this.hT = "16"
}
,
fe.lang.extend(pe.asn1.DERIA5String, pe.asn1.DERAbstractString),
pe.asn1.DERUTCTime = function(e) {
pe.asn1.DERUTCTime.superclass.constructor.call(this, e),
this.hT = "17",
this.setByDate = function(e) {
this.hTLV = null,
this.isModified = !0,
this.date = e,
this.s = this.formatDate(this.date, "utc"),
this.hV = stohex(this.s)
}
,
this.getFreshValueHex = function() {
return "undefined" == typeof this.date && "undefined" == typeof this.s && (this.date = new Date,
this.s = this.formatDate(this.date, "utc"),
this.hV = stohex(this.s)),
this.hV
}
,
void 0 !== e && (void 0 !== e.str ? this.setString(e.str) : "string" == typeof e && e.match(/^[0-9]{12}Z$/) ? this.setString(e) : void 0 !== e.hex ? this.setStringHex(e.hex) : void 0 !== e.date && this.setByDate(e.date))
}
,
fe.lang.extend(pe.asn1.DERUTCTime, pe.asn1.DERAbstractTime),
pe.asn1.DERGeneralizedTime = function(e) {
pe.asn1.DERGeneralizedTime.superclass.constructor.call(this, e),
this.hT = "18",
this.withMillis = !1,
this.setByDate = function(e) {
this.hTLV = null,
this.isModified = !0,
this.date = e,
this.s = this.formatDate(this.date, "gen", this.withMillis),
this.hV = stohex(this.s)
}
,
this.getFreshValueHex = function() {
return void 0 === this.date && void 0 === this.s && (this.date = new Date,
this.s = this.formatDate(this.date, "gen", this.withMillis),
this.hV = stohex(this.s)),
this.hV
}
,
void 0 !== e && (void 0 !== e.str ? this.setString(e.str) : "string" == typeof e && e.match(/^[0-9]{14}Z$/) ? this.setString(e) : void 0 !== e.hex ? this.setStringHex(e.hex) : void 0 !== e.date && this.setByDate(e.date),
!0 === e.millis && (this.withMillis = !0))
}
,
fe.lang.extend(pe.asn1.DERGeneralizedTime, pe.asn1.DERAbstractTime),
pe.asn1.DERSequence = function(e) {
pe.asn1.DERSequence.superclass.constructor.call(this, e),
this.hT = "30",
this.getFreshValueHex = function() {
for (var e = "", t = 0; t < this.asn1Array.length; t++) {
var n = this.asn1Array[t];
e += n.getEncodedHex()
}
return this.hV = e,
this.hV
}
}
,
fe.lang.extend(pe.asn1.DERSequence, pe.asn1.DERAbstractStructured),
pe.asn1.DERSet = function(e) {
pe.asn1.DERSet.superclass.constructor.call(this, e),
this.hT = "31",
this.sortFlag = !0,
this.getFreshValueHex = function() {
for (var e = new Array, t = 0; t < this.asn1Array.length; t++) {
var n = this.asn1Array[t];
e.push(n.getEncodedHex())
}
return 1 == this.sortFlag && e.sort(),
this.hV = e.join(""),
this.hV
}
,
"undefined" != typeof e && "undefined" != typeof e.sortflag && 0 == e.sortflag && (this.sortFlag = !1)
}
,
fe.lang.extend(pe.asn1.DERSet, pe.asn1.DERAbstractStructured),
pe.asn1.DERTaggedObject = function(e) {
pe.asn1.DERTaggedObject.superclass.constructor.call(this),
this.hT = "a0",
this.hV = "",
this.isExplicit = !0,
this.asn1Object = null,
this.setASN1Object = function(e, t, n) {
this.hT = t,
this.isExplicit = e,
this.asn1Object = n,
this.isExplicit ? (this.hV = this.asn1Object.getEncodedHex(),
this.hTLV = null,
this.isModified = !0) : (this.hV = null,
this.hTLV = n.getEncodedHex(),
this.hTLV = this.hTLV.replace(/^../, t),
this.isModified = !1)
}
,
this.getFreshValueHex = function() {
return this.hV
}
,
"undefined" != typeof e && ("undefined" != typeof e["tag"] && (this.hT = e["tag"]),
"undefined" != typeof e["explicit"] && (this.isExplicit = e["explicit"]),
"undefined" != typeof e["obj"] && (this.asn1Object = e["obj"],
this.setASN1Object(this.isExplicit, this.hT, this.asn1Object)))
}
,
fe.lang.extend(pe.asn1.DERTaggedObject, pe.asn1.ASN1Object);
var me = function() {
var e = function(t, n) {
return e = Object.setPrototypeOf || {
__proto__: []
}instanceof Array && function(e, t) {
e.__proto__ = t
}
|| function(e, t) {
for (var n in t)
Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n])
}
,
e(t, n)
};
return function(t, n) {
if ("function" !== typeof n && null !== n)
throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
function r() {
this.constructor = t
}
e(t, n),
t.prototype = null === n ? Object.create(n) : (r.prototype = n.prototype,
new r)
}
}()
, ve = function(e) {
function t(n) {
var r = e.call(this) || this;
return n && ("string" === typeof n ? r.parseKey(n) : (t.hasPrivateKeyProperty(n) || t.hasPublicKeyProperty(n)) && r.parsePropertiesFrom(n)),
r
}
return me(t, e),
t.prototype.parseKey = function(e) {
try {
var t = 0
, n = 0
, r = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/
, o = r.test(e) ? g.decode(e) : b.unarmor(e)
, i = O.decode(o);
if (3 === i.sub.length && (i = i.sub[2].sub[0]),
9 === i.sub.length) {
t = i.sub[1].getHexStringValue(),
this.n = I(t, 16),
n = i.sub[2].getHexStringValue(),
this.e = parseInt(n, 16);
var a = i.sub[3].getHexStringValue();
this.d = I(a, 16);
var s = i.sub[4].getHexStringValue();
this.p = I(s, 16);
var l = i.sub[5].getHexStringValue();
this.q = I(l, 16);
var c = i.sub[6].getHexStringValue();
this.dmp1 = I(c, 16);
var u = i.sub[7].getHexStringValue();
this.dmq1 = I(u, 16);
var d = i.sub[8].getHexStringValue();
this.coeff = I(d, 16)
} else {
if (2 !== i.sub.length)
return !1;
var h = i.sub[1]
, f = h.sub[0];
t = f.sub[0].getHexStringValue(),
this.n = I(t, 16),
n = f.sub[1].getHexStringValue(),
this.e = parseInt(n, 16)
}
return !0
} catch (p) {
return !1
}
}
,
t.prototype.getPrivateBaseKey = function() {
var e = {
array: [new pe.asn1.DERInteger({
int: 0
}), new pe.asn1.DERInteger({
bigint: this.n
}), new pe.asn1.DERInteger({
int: this.e
}), new pe.asn1.DERInteger({
bigint: this.d
}), new pe.asn1.DERInteger({
bigint: this.p
}), new pe.asn1.DERInteger({
bigint: this.q
}), new pe.asn1.DERInteger({
bigint: this.dmp1
}), new pe.asn1.DERInteger({
bigint: this.dmq1
}), new pe.asn1.DERInteger({
bigint: this.coeff
})]
}
, t = new pe.asn1.DERSequence(e);
return t.getEncodedHex()
}
,
t.prototype.getPrivateBaseKeyB64 = function() {
return p(this.getPrivateBaseKey())
}
,
t.prototype.getPublicBaseKey = function() {
var e = new pe.asn1.DERSequence({
array: [new pe.asn1.DERObjectIdentifier({
oid: "1.2.840.113549.1.1.1"
}), new pe.asn1.DERNull]
})
, t = new pe.asn1.DERSequence({
array: [new pe.asn1.DERInteger({
bigint: this.n
}), new pe.asn1.DERInteger({
int: this.e
})]
})
, n = new pe.asn1.DERBitString({
hex: "00" + t.getEncodedHex()
})
, r = new pe.asn1.DERSequence({
array: [e, n]
});
return r.getEncodedHex()
}
,
t.prototype.getPublicBaseKeyB64 = function() {
return p(this.getPublicBaseKey())
}
,
t.wordwrap = function(e, t) {
if (t = t || 64,
!e)
return e;
var n = "(.{1," + t + "})( +|$\n?)|(.{1," + t + "})";
return e.match(RegExp(n, "g")).join("\n")
}
,
t.prototype.getPrivateKey = function() {
var e = "-----BEGIN RSA PRIVATE KEY-----\n";
return e += t.wordwrap(this.getPrivateBaseKeyB64()) + "\n",
e += "-----END RSA PRIVATE KEY-----",
e
}
,
t.prototype.getPublicKey = function() {
var e = "-----BEGIN PUBLIC KEY-----\n";
return e += t.wordwrap(this.getPublicBaseKeyB64()) + "\n",
e += "-----END PUBLIC KEY-----",
e
}
,
t.hasPublicKeyProperty = function(e) {
return e = e || {},
e.hasOwnProperty("n") && e.hasOwnProperty("e")
}
,
t.hasPrivateKeyProperty = function(e) {
return e = e || {},
e.hasOwnProperty("n") && e.hasOwnProperty("e") && e.hasOwnProperty("d") && e.hasOwnProperty("p") && e.hasOwnProperty("q") && e.hasOwnProperty("dmp1") && e.hasOwnProperty("dmq1") && e.hasOwnProperty("coeff")
}
,
t.prototype.parsePropertiesFrom = function(e) {
this.n = e.n,
this.e = e.e,
e.hasOwnProperty("d") && (this.d = e.d,
this.p = e.p,
this.q = e.q,
this.dmp1 = e.dmp1,
this.dmq1 = e.dmq1,
this.coeff = e.coeff)
}
,
t
}(le)
, ge = n("a524")
, be = function() {
function e(e) {
void 0 === e && (e = {}),
e = e || {},
this.default_key_size = e.default_key_size ? parseInt(e.default_key_size, 10) : 1024,
this.default_public_exponent = e.default_public_exponent || "010001",
this.log = e.log || !1,
this.key = null
}
return e.prototype.setKey = function(e) {
this.log && this.key && console.warn("A key was already set, overriding existing."),
this.key = new ve(e)
}
,
e.prototype.setPrivateKey = function(e) {
this.setKey(e)
}
,
e.prototype.setPublicKey = function(e) {
this.setKey(e)
}
,
e.prototype.decrypt = function(e) {
try {
return this.getKey().decrypt(m(e))
} catch (t) {
return !1
}
}
,
e.prototype.encrypt = function(e) {
try {
return p(this.getKey().encrypt(e))
} catch (t) {
return !1
}
}
,
e.prototype.sign = function(e, t, n) {
try {
return p(this.getKey().sign(e, t, n))
} catch (r) {
return !1
}
}
,
e.prototype.verify = function(e, t, n) {
try {
return this.getKey().verify(e, m(t), n)
} catch (r) {
return !1
}
}
,
e.prototype.getKey = function(e) {
if (!this.key) {
if (this.key = new ve,
e && "[object Function]" === {}.toString.call(e))
return void this.key.generateAsync(this.default_key_size, this.default_public_exponent, e);
this.key.generate(this.default_key_size, this.default_public_exponent)
}
return this.key
}
,
e.prototype.getPrivateKey = function() {
return this.getKey().getPrivateKey()
}
,
e.prototype.getPrivateKeyB64 = function() {
return this.getKey().getPrivateBaseKeyB64()
}
,
e.prototype.getPublicKey = function() {
return this.getKey().getPublicKey()
}
,
e.prototype.getPublicKeyB64 = function() {
return this.getKey().getPublicBaseKeyB64()
}
,
e.version = ge.version,
e
}();
t["a"] = be
},
a524: function(e) {
e.exports = JSON.parse('{"version":"3.2.1"}')
},
})
function w(A) {
var e, t, n = "", r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", a = "=";
for (e = 0; e + 3 <= A.length; e += 3)
t = parseInt(A.substring(e, e + 3), 16),
n += r.charAt(t >> 6) + r.charAt(63 & t);
e + 1 == A.length ? (t = parseInt(A.substring(e, e + 1), 16),
n += r.charAt(t << 2)) : e + 2 == A.length && (t = parseInt(A.substring(e, e + 2), 16),
n += r.charAt(t >> 2) + r.charAt((3 & t) << 4));
while ((3 & n.length) > 0)
n += a;
return n
}
d = scream("9816");
d["a"].prototype.encryptLong = function(A) {
var e = this.getKey()
, t = (e.n.bitLength() + 7 >> 3) - 11;
try {
var n = ""
, r = "";
if (A.length > t)
return n = A.match(/.{1,50}/g),
n.forEach((function(A) {
var t = e.encrypt(A);
r += t
}
)),
w(r);
var a = e.encrypt(A)
, s = w(a);
return s
} catch (i) {
return i
}
}
var t = new d["a"];
function m(A) {
for (var e = 1; e < arguments.length; e++) {
var t = null != arguments[e] ? arguments[e] : {};
e % 2 ? v(Object(t), !0).forEach((function(e) {
b(A, e, t[e])
}
)) : Object.getOwnPropertyDescriptors ? Object.defineProperties(A, Object.getOwnPropertyDescriptors(t)) : v(Object(t)).forEach((function(e) {
Object.defineProperty(A, e, Object.getOwnPropertyDescriptor(t, e))
}
))
}
return A
};
function v(A, e) {
var t = Object.keys(A);
if (Object.getOwnPropertySymbols) {
var n = Object.getOwnPropertySymbols(A);
e && (n = n.filter((function(e) {
return Object.getOwnPropertyDescriptor(A, e).enumerable
}
))),
t.push.apply(t, n)
}
return t
}
function b(A, e, t) {
return e in A ? Object.defineProperty(A, e, {
value: t,
enumerable: !0,
configurable: !0,
writable: !0
}) : A[e] = t,
A
}
var e = {"inviteMethod":"","businessClassfication":"","mc":"","lx":"ZBGG","dwmc":"","pageIndex":12}
function main(key){
t.setPublicKey(key)
const md5 = require('md5');
let a = m(m({}, e), {}, {
sign: md5(JSON.stringify(e)),
timeStamp: +new Date
})
let s = t.encryptLong(JSON.stringify(a))
return s;
}
console.log(main("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCofouaCJ5HevlQBBHS+CphXXlza4P/EP8kE0zsNbvpjqDWE2zGUmTWq4BH+qaBKecN5aLY3OpwNAXF+vHRW7gqhpuPz4LKwjrDRpcIE0fktHnmzwxdPTLSeOCrVFUDNupIgDx7fsjArhNy7vvGx345+In/IMscFdq+z/RdmDHXvQIDAQAB"))
原文地址:https://blog.csdn.net/screamn/article/details/140627892
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!