[JavaScript] 纯文本查看 复制代码
window=this;navigator = {};//如果需要用到浏览器协议头,请在<加载代码> 按钮 右侧选择 navigator.js
var JSEncryptExports = {};
(function(N) {
function e(a, c, b) {
null != a && ("number" == typeof a ? this.fromNumber(a, c, b) : null == c && "string" != typeof a ? this.fromString(a, 256) : this.fromString(a, c))
}
function m() {
return new e(null)
}
function X(a, c, b, d, f, g) {
for (; 0 <= --g; ) {
var h = c * this[a++] + b[d] + f;
f = Math.floor(h / 67108864);
b[d++] = h & 67108863
}
return f
}
function Y(a, c, b, d, f, g) {
var h = c & 32767;
for (c >>= 15; 0 <= --g; ) {
var k = this[a] & 32767
, e = this[a++] >> 15
, r = c * k + e * h
, k = h * k + ((r & 32767) << 15) + b[d] + (f & 1073741823);
f = (k >>> 30) + (r >>> 15) + c * e + (f >>> 30);
b[d++] = k & 1073741823
}
return f
}
function Z(a, c, b, d, f, g) {
var h = c & 16383;
for (c >>= 14; 0 <= --g; ) {
var k = this[a] & 16383
, e = this[a++] >> 14
, r = c * k + e * h
, k = h * k + ((r & 16383) << 14) + b[d] + f;
f = (k >> 28) + (r >> 14) + c * e;
b[d++] = k & 268435455
}
return f
}
function S(a, c) {
var b = H[a.charCodeAt(c)];
return null == b ? -1 : b
}
function y(a) {
var c = m();
c.fromInt(a);
return c
}
function I(a) {
var c = 1, b;
0 != (b = a >>> 16) && (a = b,
c += 16);
0 != (b = a >> 8) && (a = b,
c += 8);
0 != (b = a >> 4) && (a = b,
c += 4);
0 != (b = a >> 2) && (a = b,
c += 2);
0 != a >> 1 && (c += 1);
return c
}
function C(a) {
this.m = a
}
function D(a) {
this.m = a;
this.mp = a.invDigit();
this.mpl = this.mp & 32767;
this.mph = this.mp >> 15;
this.um = (1 << a.DB - 15) - 1;
this.mt2 = 2 * a.t
}
function aa(a, c) {
return a & c
}
function J(a, c) {
return a | c
}
function T(a, c) {
return a ^ c
}
function U(a, c) {
return a & ~c
}
function F() {}
function V(a) {
return a
}
function E(a) {
this.r2 = m();
this.q3 = m();
e.ONE.dlShiftTo(2 * a.t, this.r2);
this.mu = this.r2.divide(a);
this.m = a
}
function O() {
this.j = this.i = 0;
this.S = []
}
function K() {}
function n(a, c) {
return new e(a,c)
}
function p() {
this.n = null;
this.e = 0;
this.coeff = this.dmq1 = this.dmp1 = this.q = this.p = this.d = null
}
function P(a) {
var c, b, d = "";
for (c = 0; c + 3 <= a.length; c += 3)
b = parseInt(a.substring(c, c + 3), 16),
d += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(b >> 6) + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(b & 63);
c + 1 == a.length ? (b = parseInt(a.substring(c, c + 1), 16),
d += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(b << 2)) : c + 2 == a.length && (b = parseInt(a.substring(c, c + 2), 16),
d += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(b >> 2) + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((b & 3) << 4));
for (; 0 < (d.length & 3); )
d += "=";
return d
}
function ba(a) {
var c = "", b, d = 0, f;
for (b = 0; b < a.length && "=" != a.charAt(b); ++b)
v = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(b)),
0 > v || (0 == d ? (c += "0123456789abcdefghijklmnopqrstuvwxyz".charAt(v >> 2),
f = v & 3,
d = 1) : 1 == d ? (c += "0123456789abcdefghijklmnopqrstuvwxyz".charAt(f << 2 | v >> 4),
f = v & 15,
d = 2) : 2 == d ? (c += "0123456789abcdefghijklmnopqrstuvwxyz".charAt(f),
c += "0123456789abcdefghijklmnopqrstuvwxyz".charAt(v >> 2),
f = v & 3,
d = 3) : (c += "0123456789abcdefghijklmnopqrstuvwxyz".charAt(f << 2 | v >> 4),
c += "0123456789abcdefghijklmnopqrstuvwxyz".charAt(v & 15),
d = 0));
1 == d && (c += "0123456789abcdefghijklmnopqrstuvwxyz".charAt(f << 2));
return c
}
var q;
"Microsoft Internet Explorer" == navigator.appName ? (e.prototype.am = Y,
q = 30) : "Netscape" != navigator.appName ? (e.prototype.am = X,
q = 26) : (e.prototype.am = Z,
q = 28);
e.prototype.DB = q;
e.prototype.DM = (1 << q) - 1;
e.prototype.DV = 1 << q;
e.prototype.FV = Math.pow(2, 52);
e.prototype.F1 = 52 - q;
e.prototype.F2 = 2 * q - 52;
var H = [], t;
q = 48;
for (t = 0; 9 >= t; ++t)
H[q++] = t;
q = 97;
for (t = 10; 36 > t; ++t)
H[q++] = t;
q = 65;
for (t = 10; 36 > t; ++t)
H[q++] = t;
C.prototype.convert = function(a) {
return 0 > a.s || 0 <= a.compareTo(this.m) ? a.mod(this.m) : a
}
;
C.prototype.revert = function(a) {
return a
}
;
C.prototype.reduce = function(a) {
a.divRemTo(this.m, null, a)
}
;
C.prototype.mulTo = function(a, c, b) {
a.multiplyTo(c, b);
this.reduce(b)
}
;
C.prototype.sqrTo = function(a, c) {
a.squareTo(c);
this.reduce(c)
}
;
D.prototype.convert = function(a) {
var c = m();
a.abs().dlShiftTo(this.m.t, c);
c.divRemTo(this.m, null, c);
0 > a.s && 0 < c.compareTo(e.ZERO) && this.m.subTo(c, c);
return c
}
;
D.prototype.revert = function(a) {
var c = m();
a.copyTo(c);
this.reduce(c);
return c
}
;
D.prototype.reduce = function(a) {
for (; a.t <= this.mt2; )
a[a.t++] = 0;
for (var c = 0; c < this.m.t; ++c) {
var b = a[c] & 32767
, d = b * this.mpl + ((b * this.mph + (a[c] >> 15) * this.mpl & this.um) << 15) & a.DM
, b = c + this.m.t;
for (a += this.m.am(0, d, a, c, 0, this.m.t); a >= a.DV; )
a -= a.DV,
a[++b]++
}
a.clamp();
a.drShiftTo(this.m.t, a);
0 <= a.compareTo(this.m) && a.subTo(this.m, a)
}
;
D.prototype.mulTo = function(a, c, b) {
a.multiplyTo(c, b);
this.reduce(b)
}
;
D.prototype.sqrTo = function(a, c) {
a.squareTo(c);
this.reduce(c)
}
;
e.prototype.copyTo = function(a) {
for (var c = this.t - 1; 0 <= c; --c)
a[c] = this[c];
a.t = this.t;
a.s = this.s
}
;
e.prototype.fromInt = function(a) {
this.t = 1;
this.s = 0 > a ? -1 : 0;
0 < a ? this[0] = a : -1 > a ? this[0] = a + this.DV : this.t = 0
}
;
e.prototype.fromString = function(a, c) {
var b;
if (16 == c)
b = 4;
else if (8 == c)
b = 3;
else if (256 == c)
b = 8;
else if (2 == c)
b = 1;
else if (32 == c)
b = 5;
else if (4 == c)
b = 2;
else {
this.fromRadix(a, c);
return
}
this.s = this.t = 0;
for (var d = a.length, f = !1, g = 0; 0 <= --d; ) {
var h = 8 == b ? a[d] & 255 : S(a, d);
0 > h ? "-" == a.charAt(d) && (f = !0) : (f = !1,
0 == g ? this[this.t++] = h : g + b > this.DB ? (this[this.t - 1] |= (h & (1 << this.DB - g) - 1) << g,
this[this.t++] = h >> this.DB - g) : this[this.t - 1] |= h << g,
g += b,
g >= this.DB && (g -= this.DB))
}
8 == b && 0 != (a[0] & 128) && (this.s = -1,
0 < g && (this[this.t - 1] |= (1 << this.DB - g) - 1 << g));
this.clamp();
f && e.ZERO.subTo(this, this)
}
;
e.prototype.clamp = function() {
for (var a = this.s & this.DM; 0 < this.t && this[this.t - 1] == a; )
--this.t
}
;
e.prototype.dlShiftTo = function(a, c) {
var b;
for (b = this.t - 1; 0 <= b; --b)
c[b + a] = this;
for (b = a - 1; 0 <= b; --b)
c = 0;
c.t = this.t + a;
c.s = this.s
}
;
e.prototype.drShiftTo = function(a, c) {
for (var b = a; b < this.t; ++b)
c[b - a] = this;
c.t = Math.max(this.t - a, 0);
c.s = this.s
}
;
e.prototype.lShiftTo = function(a, c) {
var b = a % this.DB, d = this.DB - b, f = (1 << d) - 1, g = Math.floor(a / this.DB), h = this.s << b & this.DM, k;
for (k = this.t - 1; 0 <= k; --k)
c[k + g + 1] = this[k] >> d | h,
h = (this[k] & f) << b;
for (k = g - 1; 0 <= k; --k)
c[k] = 0;
c[g] = h;
c.t = this.t + g + 1;
c.s = this.s;
c.clamp()
}
;
e.prototype.rShiftTo = function(a, c) {
c.s = this.s;
var b = Math.floor(a / this.DB);
if (b >= this.t)
c.t = 0;
else {
var d = a % this.DB
, f = this.DB - d
, g = (1 << d) - 1;
c[0] = this >> d;
for (var h = b + 1; h < this.t; ++h)
c[h - b - 1] |= (this[h] & g) << f,
c[h - b] = this[h] >> d;
0 < d && (c[this.t - b - 1] |= (this.s & g) << f);
c.t = this.t - b;
c.clamp()
}
}
;
e.prototype.subTo = function(a, c) {
for (var b = 0, d = 0, f = Math.min(a.t, this.t); b < f; )
d += this - a,
c[b++] = d & this.DM,
d >>= this.DB;
if (a.t < this.t) {
for (d -= a.s; b < this.t; )
d += this,
c[b++] = d & this.DM,
d >>= this.DB;
d += this.s
} else {
for (d += this.s; b < a.t; )
d -= a,
c[b++] = d & this.DM,
d >>= this.DB;
d -= a.s
}
c.s = 0 > d ? -1 : 0;
-1 > d ? c[b++] = this.DV + d : 0 < d && (c[b++] = d);
c.t = b;
c.clamp()
}
;
e.prototype.multiplyTo = function(a, c) {
var b = this.abs()
, d = a.abs()
, f = b.t;
for (c.t = f + d.t; 0 <= --f; )
c[f] = 0;
for (f = 0; f < d.t; ++f)
c[f + b.t] = b.am(0, d[f], c, f, 0, b.t);
c.s = 0;
c.clamp();
this.s != a.s && e.ZERO.subTo(c, c)
}
;
e.prototype.squareTo = function(a) {
for (var c = this.abs(), b = a.t = 2 * c.t; 0 <= --b; )
a = 0;
for (b = 0; b < c.t - 1; ++b) {
var d = c.am(b, c, a, 2 * b, 0, 1);
(a[b + c.t] += c.am(b + 1, 2 * c, a, 2 * b + 1, d, c.t - b - 1)) >= c.DV && (a[b + c.t] -= c.DV,
a[b + c.t + 1] = 1)
}
0 < a.t && (a[a.t - 1] += c.am(b, c, a, 2 * b, 0, 1));
a.s = 0;
a.clamp()
}
;
e.prototype.divRemTo = function(a, c, b) {
var d = a.abs();
if (!(0 >= d.t)) {
var f = this.abs();
if (f.t < d.t)
null != c && c.fromInt(0),
null != b && this.copyTo(b);
else {
null == b && (b = m());
var g = m()
, h = this.s;
a = a.s;
var k = this.DB - I(d[d.t - 1]);
0 < k ? (d.lShiftTo(k, g),
f.lShiftTo(k, b)) : (d.copyTo(g),
f.copyTo(b));
d = g.t;
f = g[d - 1];
if (0 != f) {
var B = f * (1 << this.F1) + (1 < d ? g[d - 2] >> this.F2 : 0)
, r = this.FV / B
, B = (1 << this.F1) / B
, l = 1 << this.F2
, u = b.t
, p = u - d
, z = null == c ? m() : c;
g.dlShiftTo(p, z);
0 <= b.compareTo(z) && (b[b.t++] = 1,
b.subTo(z, b));
e.ONE.dlShiftTo(d, z);
for (z.subTo(g, g); g.t < d; )
g[g.t++] = 0;
for (; 0 <= --p; ) {
var n = b[--u] == f ? this.DM : Math.floor(b * r + (b[u - 1] + l) * B);
if ((b += g.am(0, n, b, p, 0, d)) < n)
for (g.dlShiftTo(p, z),
b.subTo(z, b); b < --n; )
b.subTo(z, b)
}
null != c && (b.drShiftTo(d, c),
h != a && e.ZERO.subTo(c, c));
b.t = d;
b.clamp();
0 < k && b.rShiftTo(k, b);
0 > h && e.ZERO.subTo(b, b)
}
}
}
}
;
e.prototype.invDigit = function() {
if (1 > this.t)
return 0;
var a = this[0];
if (0 == (a & 1))
return 0;
var c = a & 3
, c = c * (2 - (a & 15) * c) & 15
, c = c * (2 - (a & 255) * c) & 255
, c = c * (2 - ((a & 65535) * c & 65535)) & 65535
, c = c * (2 - a * c % this.DV) % this.DV;
return 0 < c ? this.DV - c : -c
}
;
e.prototype.isEven = function() {
return 0 == (0 < this.t ? this[0] & 1 : this.s)
}
;
e.prototype.exp = function(a, c) {
if (4294967295 < a || 1 > a)
return e.ONE;
var b = m()
, d = m()
, f = c.convert(this)
, g = I(a) - 1;
for (f.copyTo(b); 0 <= --g; )
if (c.sqrTo(b, d),
0 < (a & 1 << g))
c.mulTo(d, f, b);
else
var h = b
, b = d
, d = h;
return c.revert(b)
}
;
e.prototype.toString = function(a) {
if (0 > this.s)
return "-" + this.negate().toString(a);
if (16 == a)
a = 4;
else if (8 == a)
a = 3;
else if (2 == a)
a = 1;
else if (32 == a)
a = 5;
else if (4 == a)
a = 2;
else
return this.toRadix(a);
var c = (1 << a) - 1, b, d = !1, f = "", g = this.t, h = this.DB - g * this.DB % a;
if (0 < g--)
for (h < this.DB && 0 < (b = this[g] >> h) && (d = !0,
f = "0123456789abcdefghijklmnopqrstuvwxyz".charAt(b)); 0 <= g; )
h < a ? (b = (this[g] & (1 << h) - 1) << a - h,
b |= this[--g] >> (h += this.DB - a)) : (b = this[g] >> (h -= a) & c,
0 >= h && (h += this.DB,
--g)),
0 < b && (d = !0),
d && (f += "0123456789abcdefghijklmnopqrstuvwxyz".charAt(b));
return d ? f : "0"
}
;
e.prototype.negate = function() {
var a = m();
e.ZERO.subTo(this, a);
return a
}
;
e.prototype.abs = function() {
return 0 > this.s ? this.negate() : this
}
;
e.prototype.compareTo = function(a) {
var c = this.s - a.s;
if (0 != c)
return c;
var b = this.t
, c = b - a.t;
if (0 != c)
return 0 > this.s ? -c : c;
for (; 0 <= --b; )
if (0 != (c = this - a))
return c;
return 0
}
;
e.prototype.bitLength = function() {
return 0 >= this.t ? 0 : this.DB * (this.t - 1) + I(this[this.t - 1] ^ this.s & this.DM)
}
;
e.prototype.mod = function(a) {
var c = m();
this.abs().divRemTo(a, null, c);
0 > this.s && 0 < c.compareTo(e.ZERO) && a.subTo(c, c);
return c
}
;
e.prototype.modPowInt = function(a, c) {
var b;
b = 256 > a || c.isEven() ? new C(c) : new D(c);
return this.exp(a, b)
}
;
e.ZERO = y(0);
e.ONE = y(1);
F.prototype.convert = V;
F.prototype.revert = V;
F.prototype.mulTo = function(a, c, b) {
a.multiplyTo(c, b)
}
;
F.prototype.sqrTo = function(a, c) {
a.squareTo(c)
}
;
E.prototype.convert = function(a) {
if (0 > a.s || a.t > 2 * this.m.t)
return a.mod(this.m);
if (0 > a.compareTo(this.m))
return a;
var c = m();
a.copyTo(c);
this.reduce(c);
return c
}
;
E.prototype.revert = function(a) {
return a
}
;
E.prototype.reduce = function(a) {
a.drShiftTo(this.m.t - 1, this.r2);
a.t > this.m.t + 1 && (a.t = this.m.t + 1,
a.clamp());
this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3);
for (this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); 0 > a.compareTo(this.r2); )
a.dAddOffset(1, this.m.t + 1);
for (a.subTo(this.r2, a); 0 <= a.compareTo(this.m); )
a.subTo(this.m, a)
}
;
E.prototype.mulTo = function(a, c, b) {
a.multiplyTo(c, b);
this.reduce(b)
}
;
E.prototype.sqrTo = function(a, c) {
a.squareTo(c);
this.reduce(c)
}
;
var w = [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]
, ca = 67108864 / w[w.length - 1];
e.prototype.chunkSize = function(a) {
return Math.floor(Math.LN2 * this.DB / Math.log(a))
}
;
e.prototype.toRadix = function(a) {
null == a && (a = 10);
if (0 == this.signum() || 2 > a || 36 < a)
return "0";
var c = this.chunkSize(a)
, c = Math.pow(a, c)
, b = y(c)
, d = m()
, f = m()
, g = "";
for (this.divRemTo(b, d, f); 0 < d.signum(); )
g = (c + f.intValue()).toString(a).substr(1) + g,
d.divRemTo(b, d, f);
return f.intValue().toString(a) + g
}
;
e.prototype.fromRadix = function(a, c) {
this.fromInt(0);
null == c && (c = 10);
for (var b = this.chunkSize(c), d = Math.pow(c, b), f = !1, g = 0, h = 0, k = 0; k < a.length; ++k) {
var B = S(a, k);
0 > B ? "-" == a.charAt(k) && 0 == this.signum() && (f = !0) : (h = c * h + B,
++g >= b && (this.dMultiply(d),
this.dAddOffset(h, 0),
h = g = 0))
}
0 < g && (this.dMultiply(Math.pow(c, g)),
this.dAddOffset(h, 0));
f && e.ZERO.subTo(this, this)
}
;
e.prototype.fromNumber = function(a, c, b) {
if ("number" == typeof c)
if (2 > a)
this.fromInt(1);
else
for (this.fromNumber(a, b),
this.testBit(a - 1) || this.bitwiseTo(e.ONE.shiftLeft(a - 1), J, this),
this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(c); )
this.dAddOffset(2, 0),
this.bitLength() > a && this.subTo(e.ONE.shiftLeft(a - 1), this);
else {
b = [];
var d = a & 7;
b.length = (a >> 3) + 1;
c.nextBytes(b);
b[0] = 0 < d ? b[0] & (1 << d) - 1 : 0;
this.fromString(b, 256)
}
}
;
e.prototype.bitwiseTo = function(a, c, b) {
var d, f, g = Math.min(a.t, this.t);
for (d = 0; d < g; ++d)
b[d] = c(this[d], a[d]);
if (a.t < this.t) {
f = a.s & this.DM;
for (d = g; d < this.t; ++d)
b[d] = c(this[d], f);
b.t = this.t
} else {
f = this.s & this.DM;
for (d = g; d < a.t; ++d)
b[d] = c(f, a[d]);
b.t = a.t
}
b.s = c(this.s, a.s);
b.clamp()
}
;
e.prototype.changeBit = function(a, c) {
var b = e.ONE.shiftLeft(a);
this.bitwiseTo(b, c, b);
return b
}
;
e.prototype.addTo = function(a, c) {
for (var b = 0, d = 0, f = Math.min(a.t, this.t); b < f; )
d += this + a,
c[b++] = d & this.DM,
d >>= this.DB;
if (a.t < this.t) {
for (d += a.s; b < this.t; )
d += this,
c[b++] = d & this.DM,
d >>= this.DB;
d += this.s
} else {
for (d += this.s; b < a.t; )
d += a,
c[b++] = d & this.DM,
d >>= this.DB;
d += a.s
}
c.s = 0 > d ? -1 : 0;
0 < d ? c[b++] = d : -1 > d && (c[b++] = this.DV + d);
c.t = b;
c.clamp()
}
;
e.prototype.dMultiply = function(a) {
this[this.t] = this.am(0, a - 1, this, 0, 0, this.t);
++this.t;
this.clamp()
}
;
e.prototype.dAddOffset = function(a, c) {
if (0 != a) {
for (; this.t <= c; )
this[this.t++] = 0;
for (this[c] += a; this[c] >= this.DV; )
this[c] -= this.DV,
++c >= this.t && (this[this.t++] = 0),
++this[c]
}
}
;
e.prototype.multiplyLowerTo = function(a, c, b) {
var d = Math.min(this.t + a.t, c);
b.s = 0;
for (b.t = d; 0 < d; )
b[--d] = 0;
var f;
for (f = b.t - this.t; d < f; ++d)
b[d + this.t] = this.am(0, a[d], b, d, 0, this.t);
for (f = Math.min(a.t, c); d < f; ++d)
this.am(0, a[d], b, d, 0, c - d);
b.clamp()
}
;
e.prototype.multiplyUpperTo = function(a, c, b) {
--c;
var d = b.t = this.t + a.t - c;
for (b.s = 0; 0 <= --d; )
b[d] = 0;
for (d = Math.max(c - this.t, 0); d < a.t; ++d)
b[this.t + d - c] = this.am(c - d, a[d], b, 0, 0, this.t + d - c);
b.clamp();
b.drShiftTo(1, b)
}
;
e.prototype.modInt = function(a) {
if (0 >= a)
return 0;
var c = this.DV % a
, b = 0 > this.s ? a - 1 : 0;
if (0 < this.t)
if (0 == c)
b = this[0] % a;
else
for (var d = this.t - 1; 0 <= d; --d)
b = (c * b + this[d]) % a;
return b
}
;
e.prototype.millerRabin = function(a) {
var c = this.subtract(e.ONE)
, b = c.getLowestSetBit();
if (0 >= b)
return !1;
var d = c.shiftRight(b);
a = a + 1 >> 1;
a > w.length && (a = w.length);
for (var f = m(), g = 0; g < a; ++g) {
f.fromInt(w[Math.floor(Math.random() * w.length)]);
var h = f.modPow(d, this);
if (0 != h.compareTo(e.ONE) && 0 != h.compareTo(c)) {
for (var k = 1; k++ < b && 0 != h.compareTo(c); )
if (h = h.modPowInt(2, this),
0 == h.compareTo(e.ONE))
return !1;
if (0 != h.compareTo(c))
return !1
}
}
return !0
}
;
e.prototype.clone = function() {
var a = m();
this.copyTo(a);
return a
}
;
e.prototype.intValue = function() {
if (0 > this.s) {
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 0 > this.s ? -1 : 0 >= this.t || 1 == this.t && 0 >= this[0] ? 0 : 1
}
;
e.prototype.toByteArray = function() {
var a = this.t
, c = [];
c[0] = this.s;
var b = this.DB - a * this.DB % 8, d, f = 0;
if (0 < a--)
for (b < this.DB && (d = this[a] >> b) != (this.s & this.DM) >> b && (c[f++] = d | this.s << this.DB - b); 0 <= a; )
if (8 > b ? (d = (this[a] & (1 << b) - 1) << 8 - b,
d |= this[--a] >> (b += this.DB - 8)) : (d = this[a] >> (b -= 8) & 255,
0 >= b && (b += this.DB,
--a)),
0 != (d & 128) && (d |= -256),
0 == f && (this.s & 128) != (d & 128) && ++f,
0 < f || d != this.s)
c[f++] = d;
return c
}
;
e.prototype.equals = function(a) {
return 0 == this.compareTo(a)
}
;
e.prototype.min = function(a) {
return 0 > this.compareTo(a) ? this : a
}
;
e.prototype.max = function(a) {
return 0 < this.compareTo(a) ? this : a
}
;
e.prototype.and = function(a) {
var c = m();
this.bitwiseTo(a, aa, c);
return c
}
;
e.prototype.or = function(a) {
var c = m();
this.bitwiseTo(a, J, c);
return c
}
;
e.prototype.xor = function(a) {
var c = m();
this.bitwiseTo(a, T, c);
return c
}
;
e.prototype.andNot = function(a) {
var c = m();
this.bitwiseTo(a, U, c);
return c
}
;
e.prototype.not = function() {
for (var a = m(), c = 0; c < this.t; ++c)
a[c] = this.DM & ~this[c];
a.t = this.t;
a.s = ~this.s;
return a
}
;
e.prototype.shiftLeft = function(a) {
var c = m();
0 > a ? this.rShiftTo(-a, c) : this.lShiftTo(a, c);
return c
}
;
e.prototype.shiftRight = function(a) {
var c = m();
0 > a ? this.lShiftTo(-a, c) : this.rShiftTo(a, c);
return c
}
;
e.prototype.getLowestSetBit = function() {
for (var a = 0; a < this.t; ++a)
if (0 != this[a]) {
var c = a * this.DB;
a = this[a];
if (0 == a)
a = -1;
else {
var b = 0;
0 == (a & 65535) && (a >>= 16,
b += 16);
0 == (a & 255) && (a >>= 8,
b += 8);
0 == (a & 15) && (a >>= 4,
b += 4);
0 == (a & 3) && (a >>= 2,
b += 2);
0 == (a & 1) && ++b;
a = b
}
return c + a
}
return 0 > this.s ? this.t * this.DB : -1
}
;
e.prototype.bitCount = function() {
for (var a = 0, c = this.s & this.DM, b = 0; b < this.t; ++b) {
for (var d = this ^ c, f = 0; 0 != d; )
d &= d - 1,
++f;
a += f
}
return a
}
;
e.prototype.testBit = function(a) {
var c = Math.floor(a / this.DB);
return c >= this.t ? 0 != this.s : 0 != (this[c] & 1 << a % this.DB)
}
;
e.prototype.setBit = function(a) {
return this.changeBit(a, J)
}
;
e.prototype.clearBit = function(a) {
return this.changeBit(a, U)
}
;
e.prototype.flipBit = function(a) {
return this.changeBit(a, T)
}
;
e.prototype.add = function(a) {
var c = m();
this.addTo(a, c);
return c
}
;
e.prototype.subtract = function(a) {
var c = m();
this.subTo(a, c);
return c
}
;
e.prototype.multiply = function(a) {
var c = m();
this.multiplyTo(a, c);
return c
}
;
e.prototype.divide = function(a) {
var c = m();
this.divRemTo(a, c, null);
return c
}
;
e.prototype.remainder = function(a) {
var c = m();
this.divRemTo(a, null, c);
return c
}
;
e.prototype.divideAndRemainder = function(a) {
var c = m()
, b = m();
this.divRemTo(a, c, b);
return [c, b]
}
;
e.prototype.modPow = function(a, c) {
var b = a.bitLength(), d, f = y(1), g;
if (0 >= b)
return f;
d = 18 > b ? 1 : 48 > b ? 3 : 144 > b ? 4 : 768 > b ? 5 : 6;
g = 8 > b ? new C(c) : c.isEven() ? new E(c) : new D(c);
var h = []
, k = 3
, e = d - 1
, r = (1 << d) - 1;
h[1] = g.convert(this);
if (1 < d)
for (b = m(),
g.sqrTo(h[1], b); k <= r; )
h[k] = m(),
g.mulTo(b, h[k - 2], h[k]),
k += 2;
for (var l = a.t - 1, u, p = !0, n = m(), b = I(a[l]) - 1; 0 <= l; ) {
b >= e ? u = a[l] >> b - e & r : (u = (a[l] & (1 << b + 1) - 1) << e - b,
0 < l && (u |= a[l - 1] >> this.DB + b - e));
for (k = d; 0 == (u & 1); )
u >>= 1,
--k;
0 > (b -= k) && (b += this.DB,
--l);
if (p)
h.copyTo(f),
p = !1;
else {
for (; 1 < k; )
g.sqrTo(f, n),
g.sqrTo(n, f),
k -= 2;
0 < k ? g.sqrTo(f, n) : (k = f,
f = n,
n = k);
g.mulTo(n, h, f)
}
for (; 0 <= l && 0 == (a[l] & 1 << b); )
g.sqrTo(f, n),
k = f,
f = n,
n = k,
0 > --b && (b = this.DB - 1,
--l)
}
return g.revert(f)
}
;
e.prototype.modInverse = function(a) {
var c = a.isEven();
if (this.isEven() && c || 0 == a.signum())
return e.ZERO;
for (var b = a.clone(), d = this.clone(), f = y(1), g = y(0), h = y(0), k = y(1); 0 != b.signum(); ) {
for (; b.isEven(); )
b.rShiftTo(1, b),
c ? (f.isEven() && g.isEven() || (f.addTo(this, f),
g.subTo(a, g)),
f.rShiftTo(1, f)) : g.isEven() || g.subTo(a, g),
g.rShiftTo(1, g);
for (; d.isEven(); )
d.rShiftTo(1, d),
c ? (h.isEven() && k.isEven() || (h.addTo(this, h),
k.subTo(a, k)),
h.rShiftTo(1, h)) : k.isEven() || k.subTo(a, k),
k.rShiftTo(1, k);
0 <= b.compareTo(d) ? (b.subTo(d, b),
c && f.subTo(h, f),
g.subTo(k, g)) : (d.subTo(b, d),
c && h.subTo(f, h),
k.subTo(g, k))
}
if (0 != d.compareTo(e.ONE))
return e.ZERO;
if (0 <= k.compareTo(a))
return k.subtract(a);
if (0 > k.signum())
k.addTo(a, k);
else
return k;
return 0 > k.signum() ? k.add(a) : k
}
;
e.prototype.pow = function(a) {
return this.exp(a, new F)
}
;
e.prototype.gcd = function(a) {
var c = 0 > this.s ? this.negate() : this.clone();
a = 0 > a.s ? a.negate() : a.clone();
if (0 > c.compareTo(a)) {
var b = c
, c = a;
a = b
}
var b = c.getLowestSetBit()
, d = a.getLowestSetBit();
if (0 > d)
return c;
b < d && (d = b);
0 < d && (c.rShiftTo(d, c),
a.rShiftTo(d, a));
for (; 0 < c.signum(); )
0 < (b = c.getLowestSetBit()) && c.rShiftTo(b, c),
0 < (b = a.getLowestSetBit()) && a.rShiftTo(b, a),
0 <= c.compareTo(a) ? (c.subTo(a, c),
c.rShiftTo(1, c)) : (a.subTo(c, a),
a.rShiftTo(1, a));
0 < d && a.lShiftTo(d, a);
return a
}
;
e.prototype.isProbablePrime = function(a) {
var c, b = this.abs();
if (1 == b.t && b[0] <= w[w.length - 1]) {
for (c = 0; c < w.length; ++c)
if (b[0] == w[c])
return !0;
return !1
}
if (b.isEven())
return !1;
for (c = 1; c < w.length; ) {
for (var d = w[c], f = c + 1; f < w.length && d < ca; )
d *= w[f++];
for (d = b.modInt(d); c < f; )
if (0 == d % w[c++])
return !1
}
return b.millerRabin(a)
}
;
e.prototype.square = function() {
var a = m();
this.squareTo(a);
return a
}
;
O.prototype.init = function(a) {
var c, b, d;
for (c = 0; 256 > c; ++c)
this.S[c] = c;
for (c = b = 0; 256 > c; ++c)
b = b + this.S[c] + a[c % a.length] & 255,
d = this.S[c],
this.S[c] = this.S,
this.S = d;
this.j = this.i = 0
}
;
O.prototype.next = function() {
var a;
this.i = this.i + 1 & 255;
this.j = this.j + this.S[this.i] & 255;
a = this.S[this.i];
this.S[this.i] = this.S[this.j];
this.S[this.j] = a;
return this.S[a + this.S[this.i] & 255]
}
;
var L, A, x;
if (null == A) {
A = [];
x = 0;
if (window.crypto && window.crypto.getRandomValues)
for (t = new Uint32Array(256),
window.crypto.getRandomValues(t),
q = 0; q < t.length; ++q)
A[x++] = t[q] & 255;
var M = function(a) {
this.count = this.count || 0;
if (256 <= this.count || 256 <= x)
window.removeEventListener ? window.removeEventListener("mousemove", M, !1) : window.detachEvent && window.detachEvent("onmousemove", M);
else
try {
var c = a.x + a.y;
A[x++] = c & 255;
this.count += 1
} catch (b) {}
};
window.addEventListener ? window.addEventListener("mousemove", M, !1) : window.attachEvent && window.attachEvent("onmousemove", M)
}
K.prototype.nextBytes = function(a) {
var c;
for (c = 0; c < a.length; ++c) {
var b = c, d;
if (null == L) {
for (L = new O; 256 > x; )
d = Math.floor(65536 * Math.random()),
A[x++] = d & 255;
L.init(A);
for (x = 0; x < A.length; ++x)
A[x] = 0;
x = 0
}
d = L.next();
a = d
}
}
;
p.prototype.doPublic = function(a) {
return a.modPowInt(this.e, this.n)
}
;
p.prototype.setPublic = function(a, c) {
null != a && null != c && 0 < a.length && 0 < c.length ? (this.n = n(a, 16),
this.e = parseInt(c, 16)) : console.error("Invalid RSA public key")
}
;
p.prototype.encrypt = function(a) {
var c;
c = this.n.bitLength() + 7 >> 3;
if (c < a.length + 11)
console.error("Message too long for RSA"),
c = null;
else {
for (var b = [], d = a.length - 1; 0 <= d && 0 < c; ) {
var f = a.charCodeAt(d--);
128 > f ? b[--c] = f : 127 < f && 2048 > f ? (b[--c] = f & 63 | 128,
b[--c] = f >> 6 | 192) : (b[--c] = f & 63 | 128,
b[--c] = f >> 6 & 63 | 128,
b[--c] = f >> 12 | 224)
}
b[--c] = 0;
a = new K;
for (d = []; 2 < c; ) {
for (d[0] = 0; 0 == d[0]; )
a.nextBytes(d);
b[--c] = d[0]
}
b[--c] = 2;
b[--c] = 0;
c = new e(b)
}
if (null == c)
return null;
c = this.doPublic(c);
if (null == c)
return null;
c = c.toString(16);
return 0 == (c.length & 1) ? c : "0" + c
}
;
p.prototype.doPrivate = function(a) {
if (null == this.p || null == this.q)
return a.modPow(this.d, this.n);
var c = a.mod(this.p).modPow(this.dmp1, this.p);
for (a = a.mod(this.q).modPow(this.dmq1, this.q); 0 > c.compareTo(a); )
c = c.add(this.p);
return c.subtract(a).multiply(this.coeff).mod(this.p).multiply(this.q).add(a)
}
;
p.prototype.setPrivate = function(a, c, b) {
null != a && null != c && 0 < a.length && 0 < c.length ? (this.n = n(a, 16),
this.e = parseInt(c, 16),
this.d = n(b, 16)) : console.error("Invalid RSA private key")
}
;
p.prototype.setPrivateEx = function(a, c, b, d, f, g, h, k) {
null != a && null != c && 0 < a.length && 0 < c.length ? (this.n = n(a, 16),
this.e = parseInt(c, 16),
this.d = n(b, 16),
this.p = n(d, 16),
this.q = n(f, 16),
this.dmp1 = n(g, 16),
this.dmq1 = n(h, 16),
this.coeff = n(k, 16)) : console.error("Invalid RSA private key")
}
;
p.prototype.generate = function(a, c) {
var b = new K
, d = a >> 1;
this.e = parseInt(c, 16);
for (var f = new e(c,16); ; ) {
for (; this.p = new e(a - d,1,b),
0 != this.p.subtract(e.ONE).gcd(f).compareTo(e.ONE) || !this.p.isProbablePrime(10); )
;
for (; this.q = new e(d,1,b),
0 != this.q.subtract(e.ONE).gcd(f).compareTo(e.ONE) || !this.q.isProbablePrime(10); )
;
if (0 >= this.p.compareTo(this.q)) {
var g = this.p;
this.p = this.q;
this.q = g
}
var g = this.p.subtract(e.ONE)
, h = this.q.subtract(e.ONE)
, k = g.multiply(h);
if (0 == k.gcd(f).compareTo(e.ONE)) {
this.n = this.p.multiply(this.q);
this.d = f.modInverse(k);
this.dmp1 = this.d.mod(g);
this.dmq1 = this.d.mod(h);
this.coeff = this.q.modInverse(this.p);
break
}
}
}
;
p.prototype.decrypt = function(a) {
a = n(a, 16);
a = this.doPrivate(a);
if (null == a)
return null;
a: {
var c = this.n.bitLength() + 7 >> 3;
a = a.toByteArray();
for (var b = 0; b < a.length && 0 == a; )
++b;
if (a.length - b != c - 1 || 2 != a)
a = null;
else {
for (++b; 0 != a; )
if (++b >= a.length) {
a = null;
break a
}
for (c = ""; ++b < a.length; ) {
var d = a & 255;
128 > d ? c += String.fromCharCode(d) : 191 < d && 224 > d ? (c += String.fromCharCode((d & 31) << 6 | a[b + 1] & 63),
++b) : (c += String.fromCharCode((d & 15) << 12 | (a[b + 1] & 63) << 6 | a[b + 2] & 63),
b += 2)
}
a = c
}
}
return a
}
;
(function() {
p.prototype.generateAsync = function(a, c, b) {
var d = new K
, f = a >> 1;
this.e = parseInt(c, 16);
var g = new e(c,16)
, h = this
, k = function() {
var c = function() {
if (0 >= h.p.compareTo(h.q)) {
var a = h.p;
h.p = h.q;
h.q = a
}
var a = h.p.subtract(e.ONE)
, c = h.q.subtract(e.ONE)
, d = a.multiply(c);
0 == d.gcd(g).compareTo(e.ONE) ? (h.n = h.p.multiply(h.q),
h.d = g.modInverse(d),
h.dmp1 = h.d.mod(a),
h.dmq1 = h.d.mod(c),
h.coeff = h.q.modInverse(h.p),
setTimeout(function() {
b()
}, 0)) : setTimeout(k, 0)
}
, l = function() {
h.q = m();
h.q.fromNumberAsync(f, 1, d, function() {
h.q.subtract(e.ONE).gcda(g, function(a) {
0 == a.compareTo(e.ONE) && h.q.isProbablePrime(10) ? setTimeout(c, 0) : setTimeout(l, 0)
})
})
}
, n = function() {
h.p = m();
h.p.fromNumberAsync(a - f, 1, d, function() {
h.p.subtract(e.ONE).gcda(g, function(a) {
0 == a.compareTo(e.ONE) && h.p.isProbablePrime(10) ? setTimeout(l, 0) : setTimeout(n, 0)
})
})
};
setTimeout(n, 0)
};
setTimeout(k, 0)
}
;
e.prototype.gcda = function(a, c) {
var b = 0 > this.s ? this.negate() : this.clone()
, d = 0 > a.s ? a.negate() : a.clone();
if (0 > b.compareTo(d))
var f = b
, b = d
, d = f;
var g = b.getLowestSetBit()
, h = d.getLowestSetBit();
if (0 > h)
c(b);
else {
g < h && (h = g);
0 < h && (b.rShiftTo(h, b),
d.rShiftTo(h, d));
var k = function() {
0 < (g = b.getLowestSetBit()) && b.rShiftTo(g, b);
0 < (g = d.getLowestSetBit()) && d.rShiftTo(g, d);
0 <= b.compareTo(d) ? (b.subTo(d, b),
b.rShiftTo(1, b)) : (d.subTo(b, d),
d.rShiftTo(1, d));
0 < b.signum() ? setTimeout(k, 0) : (0 < h && d.lShiftTo(h, d),
setTimeout(function() {
c(d)
}, 0))
};
setTimeout(k, 10)
}
}
;
e.prototype.fromNumberAsync = function(a, c, b, d) {
if ("number" == typeof c)
if (2 > a)
this.fromInt(1);
else {
this.fromNumber(a, b);
this.testBit(a - 1) || this.bitwiseTo(e.ONE.shiftLeft(a - 1), J, this);
this.isEven() && this.dAddOffset(1, 0);
var f = this
, g = function() {
f.dAddOffset(2, 0);
f.bitLength() > a && f.subTo(e.ONE.shiftLeft(a - 1), f);
f.isProbablePrime(c) ? setTimeout(function() {
d()
}, 0) : setTimeout(g, 0)
};
setTimeout(g, 0)
}
else {
b = [];
var h = a & 7;
b.length = (a >> 3) + 1;
c.nextBytes(b);
b[0] = 0 < h ? b[0] & (1 << h) - 1 : 0;
this.fromString(b, 256)
}
}
}
)();
var l = l || {};
l.env = l.env || {};
var Q = l
, R = Object.prototype
, W = ["toString", "valueOf"];
l.env.parseUA = function(a) {
var c = function(a) {
var c = 0;
return parseFloat(a.replace(/\./g, function() {
return 1 == c++ ? "" : "."
}))
}
, b = navigator
, b = {
ie: 0,
opera: 0,
gecko: 0,
webkit: 0,
chrome: 0,
mobile: null,
air: 0,
ipad: 0,
iphone: 0,
ipod: 0,
ios: null,
android: 0,
webos: 0,
caja: b && b.cajaVersion,
secure: !1,
os: null
};
a = a || navigator && navigator.userAgent;
var d = window && window.location
, d = d && d.href;
b.secure = d && 0 === d.toLowerCase().indexOf("https");
if (a) {
/windows|win32/i.test(a) ? b.os = "windows" : /macintosh/i.test(a) ? b.os = "macintosh" : /rhino/i.test(a) && (b.os = "rhino");
/KHTML/.test(a) && (b.webkit = 1);
if ((d = a.match(/AppleWebKit\/([^\s]*)/)) && d[1]) {
b.webkit = c(d[1]);
if (/ Mobile\//.test(a))
b.mobile = "Apple",
(d = a.match(/OS ([^\s]*)/)) && d[1] && (d = c(d[1].replace("_", "."))),
b.ios = d,
b.ipad = b.ipod = b.iphone = 0,
(d = a.match(/iPad|iPod|iPhone/)) && d[0] && (b[d[0].toLowerCase()] = b.ios);
else {
if (d = a.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/))
b.mobile = d[0];
/webOS/.test(a) && (b.mobile = "WebOS",
(d = a.match(/webOS\/([^\s]*);/)) && d[1] && (b.webos = c(d[1])));
/ Android/.test(a) && (b.mobile = "Android",
(d = a.match(/Android ([^\s]*);/)) && d[1] && (b.android = c(d[1])))
}
if ((d = a.match(/Chrome\/([^\s]*)/)) && d[1])
b.chrome = c(d[1]);
else if (d = a.match(/AdobeAIR\/([^\s]*)/))
b.air = d[0]
}
if (!b.webkit)
if ((d = a.match(/Opera[\s\/]([^\s]*)/)) && d[1]) {
if (b.opera = c(d[1]),
(d = a.match(/Version\/([^\s]*)/)) && d[1] && (b.opera = c(d[1])),
d = a.match(/Opera Mini[^;]*/))
b.mobile = d[0]
} else if ((d = a.match(/MSIE\s([^;]*)/)) && d[1])
b.ie = c(d[1]);
else if (d = a.match(/Gecko\/([^\s]*)/))
b.gecko = 1,
(d = a.match(/rv:([^\s\)]*)/)) && d[1] && (b.gecko = c(d[1]))
}
return b
}
;
l.env.ua = l.env.parseUA();
l.isFunction = function(a) {
return "function" === typeof a || "[object Function]" === R.toString.apply(a)
}
;
l._IEEnumFix = l.env.ua.ie ? function(a, c) {
var b, d, f;
for (b = 0; b < W.length; b += 1)
d = W,
f = c[d],
Q.isFunction(f) && f != R[d] && (a[d] = f)
}
: function() {}
;
l.extend = function(a, c, b) {
if (!c || !a)
throw Error("extend failed, please check that all dependencies are included.");
var d = function() {}, f;
d.prototype = c.prototype;
a.prototype = new d;
a.prototype.constructor = a;
a.superclass = c.prototype;
c.prototype.constructor == R.constructor && (c.prototype.constructor = c);
if (b) {
for (f in b)
Q.hasOwnProperty(b, f) && (a.prototype[f] = b[f]);
Q._IEEnumFix(a.prototype, b)
}
}
;
"undefined" != typeof KJUR && KJUR || (KJUR = {});
"undefined" != typeof KJUR.asn1 && KJUR.asn1 || (KJUR.asn1 = {});
KJUR.asn1.ASN1Util = new function() {
this.integerToByteHex = function(a) {
a = a.toString(16);
1 == a.length % 2 && (a = "0" + a);
return a
}
;
this.bigIntToMinTwosComplementsHex = function(a) {
var c = a.toString(16);
if ("-" != c.substr(0, 1))
1 == c.length % 2 ? c = "0" + c : c.match(/^[0-7]/) || (c = "00" + c);
else {
var b = c.substr(1).length;
1 == b % 2 ? b += 1 : c.match(/^[0-7]/) || (b += 2);
for (var c = "", d = 0; d < b; d++)
c += "f";
c = (new e(c,16)).xor(a).add(e.ONE).toString(16).replace(/^-/, "")
}
return c
}
;
this.getPEMStringFromHex = function(a, c) {
var b = CryptoJS.enc.Hex.parse(a)
, b = CryptoJS.enc.Base64.stringify(b).replace(/(.{64})/g, "$1\r\n")
, b = b.replace(/\r\n$/, "");
return "-----BEGIN " + c + "-----\r\n" + b + "\r\n-----END " + c + "-----\r\n"
}
}
;
KJUR.asn1.ASN1Object = function() {
this.getLengthHexFromValue = function() {
if ("undefined" == typeof this.hV || null == this.hV)
throw "this.hV is null or undefined.";
if (1 == this.hV.length % 2)
throw "value hex must be even length: n=0,v=" + this.hV;
var a = this.hV.length / 2
, c = a.toString(16);
1 == c.length % 2 && (c = "0" + c);
if (128 > a)
return c;
var b = c.length / 2;
if (15 < b)
throw "ASN.1 length too long to represent by 8x: n = " + a.toString(16);
return (128 + b).toString(16) + c
}
;
this.getEncodedHex = function() {
if (null == this.hTLV || this.isModified)
this.hV = this.getFreshValueHex(),
this.hL = this.getLengthHexFromValue(),
this.hTLV = this.hT + this.hL + this.hV,
this.isModified = !1;
return this.hTLV
}
;
this.getValueHex = function() {
this.getEncodedHex();
return this.hV
}
;
this.getFreshValueHex = function() {
return ""
}
}
;
KJUR.asn1.DERAbstractString = function(a) {
KJUR.asn1.DERAbstractString.superclass.constructor.call(this);
this.getString = function() {
return this.s
}
;
this.setString = function(a) {
this.hTLV = null;
this.isModified = !0;
this.s = a;
this.hV = stohex(this.s)
}
;
this.setStringHex = function(a) {
this.hTLV = null;
this.isModified = !0;
this.s = null;
this.hV = a
}
;
this.getFreshValueHex = function() {
return this.hV
}
;
"undefined" != typeof a && ("undefined" != typeof a.str ? this.setString(a.str) : "undefined" != typeof a.hex && this.setStringHex(a.hex))
}
;
l.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object);
KJUR.asn1.DERAbstractTime = function(a) {
KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);
this.localDateToUTC = function(a) {
utc = a.getTime() + 6E4 * a.getTimezoneOffset();
return new Date(utc)
}
;
this.formatDate = function(a, b) {
var d = this.zeroPadding
, f = this.localDateToUTC(a)
, g = String(f.getFullYear());
"utc" == b && (g = g.substr(2, 2));
var h = d(String(f.getMonth() + 1), 2)
, k = d(String(f.getDate()), 2)
, e = d(String(f.getHours()), 2)
, l = d(String(f.getMinutes()), 2)
, d = d(String(f.getSeconds()), 2);
return g + h + k + e + l + d + "Z"
}
;
this.zeroPadding = function(a, b) {
return a.length >= b ? a : Array(b - a.length + 1).join("0") + a
}
;
this.getString = function() {
return this.s
}
;
this.setString = function(a) {
this.hTLV = null;
this.isModified = !0;
this.s = a;
this.hV = stohex(this.s)
}
;
this.setByDateValue = function(a, b, d, f, g, h) {
a = new Date(Date.UTC(a, b - 1, d, f, g, h, 0));
this.setByDate(a)
}
;
this.getFreshValueHex = function() {
return this.hV
}
}
;
l.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object);
KJUR.asn1.DERAbstractStructured = function(a) {
KJUR.asn1.DERAbstractString.superclass.constructor.call(this);
this.setByASN1ObjectArray = function(a) {
this.hTLV = null;
this.isModified = !0;
this.asn1Array = a
}
;
this.appendASN1Object = function(a) {
this.hTLV = null;
this.isModified = !0;
this.asn1Array.push(a)
}
;
this.asn1Array = [];
"undefined" != typeof a && "undefined" != typeof a.array && (this.asn1Array = a.array)
}
;
l.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object);
KJUR.asn1.DERBoolean = function() {
KJUR.asn1.DERBoolean.superclass.constructor.call(this);
this.hT = "01";
this.hTLV = "0101ff"
}
;
l.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object);
KJUR.asn1.DERInteger = function(a) {
KJUR.asn1.DERInteger.superclass.constructor.call(this);
this.hT = "02";
this.setByBigInteger = function(a) {
this.hTLV = null;
this.isModified = !0;
this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(a)
}
;
this.setByInteger = function(a) {
a = new e(String(a),10);
this.setByBigInteger(a)
}
;
this.setValueHex = function(a) {
this.hV = a
}
;
this.getFreshValueHex = function() {
return this.hV
}
;
"undefined" != typeof a && ("undefined" != typeof a.bigint ? this.setByBigInteger(a.bigint) : "undefined" != typeof a["int"] ? this.setByInteger(a["int"]) : "undefined" != typeof a.hex && this.setValueHex(a.hex))
}
;
l.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object);
KJUR.asn1.DERBitString = function(a) {
KJUR.asn1.DERBitString.superclass.constructor.call(this);
this.hT = "03";
this.setHexValueIncludingUnusedBits = function(a) {
this.hTLV = null;
this.isModified = !0;
this.hV = a
}
;
this.setUnusedBitsAndHexValue = function(a, b) {
if (0 > a || 7 < a)
throw "unused bits shall be from 0 to 7: u = " + a;
this.hTLV = null;
this.isModified = !0;
this.hV = "0" + a + b
}
;
this.setByBinaryString = function(a) {
a = a.replace(/0+$/, "");
var b = 8 - a.length % 8;
8 == b && (b = 0);
for (var d = 0; d <= b; d++)
a += "0";
for (var f = "", d = 0; d < a.length - 1; d += 8) {
var g = a.substr(d, 8)
, g = parseInt(g, 2).toString(16);
1 == g.length && (g = "0" + g);
f += g
}
this.hTLV = null;
this.isModified = !0;
this.hV = "0" + b + f
}
;
this.setByBooleanArray = function(a) {
for (var b = "", d = 0; d < a.length; d++)
b = 1 == a[d] ? b + "1" : b + "0";
this.setByBinaryString(b)
}
;
this.newFalseArray = function(a) {
for (var b = Array(a), d = 0; d < a; d++)
b[d] = !1;
return b
}
;
this.getFreshValueHex = function() {
return this.hV
}
;
"undefined" != typeof a && ("undefined" != typeof a.hex ? this.setHexValueIncludingUnusedBits(a.hex) : "undefined" != typeof a.bin ? this.setByBinaryString(a.bin) : "undefined" != typeof a.array && this.setByBooleanArray(a.array))
}
;
l.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object);
KJUR.asn1.DEROctetString = function(a) {
KJUR.asn1.DEROctetString.superclass.constructor.call(this, a);
this.hT = "04"
}
;
l.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString);
KJUR.asn1.DERNull = function() {
KJUR.asn1.DERNull.superclass.constructor.call(this);
this.hT = "05";
this.hTLV = "0500"
}
;
l.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object);
KJUR.asn1.DERObjectIdentifier = function(a) {
var c = function(a) {
a = a.toString(16);
1 == a.length && (a = "0" + a);
return a
};
KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this);
this.hT = "06";
this.setValueHex = function(a) {
this.hTLV = null;
this.isModified = !0;
this.s = null;
this.hV = a
}
;
this.setValueOidString = function(a) {
if (!a.match(/^[0-9.]+$/))
throw "malformed oid string: " + a;
var d = "";
a = a.split(".");
var f = 40 * parseInt(a[0]) + parseInt(a[1])
, d = d + c(f);
a.splice(0, 2);
for (f = 0; f < a.length; f++) {
var g = ""
, h = (new e(a[f],10)).toString(2)
, k = 7 - h.length % 7;
7 == k && (k = 0);
for (var l = "", r = 0; r < k; r++)
l += "0";
h = l + h;
for (r = 0; r < h.length - 1; r += 7)
k = h.substr(r, 7),
r != h.length - 7 && (k = "1" + k),
g += c(parseInt(k, 2));
d += g
}
this.hTLV = null;
this.isModified = !0;
this.s = null;
this.hV = d
}
;
this.setValueName = function(a) {
if ("undefined" != typeof KJUR.asn1.x509.OID.name2oidList[a])
this.setValueOidString(KJUR.asn1.x509.OID.name2oidList[a]);
else
throw "DERObjectIdentifier oidName undefined: " + a;
}
;
this.getFreshValueHex = function() {
return this.hV
}
;
"undefined" != typeof a && ("undefined" != typeof a.oid ? this.setValueOidString(a.oid) : "undefined" != typeof a.hex ? this.setValueHex(a.hex) : "undefined" != typeof a.name && this.setValueName(a.name))
}
;
l.extend(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object);
KJUR.asn1.DERUTF8String = function(a) {
KJUR.asn1.DERUTF8String.superclass.constructor.call(this, a);
this.hT = "0c"
}
;
l.extend(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString);
KJUR.asn1.DERNumericString = function(a) {
KJUR.asn1.DERNumericString.superclass.constructor.call(this, a);
this.hT = "12"
}
;
l.extend(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString);
KJUR.asn1.DERPrintableString = function(a) {
KJUR.asn1.DERPrintableString.superclass.constructor.call(this, a);
this.hT = "13"
}
;
l.extend(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString);
KJUR.asn1.DERTeletexString = function(a) {
KJUR.asn1.DERTeletexString.superclass.constructor.call(this, a);
this.hT = "14"
}
;
l.extend(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString);
KJUR.asn1.DERIA5String = function(a) {
KJUR.asn1.DERIA5String.superclass.constructor.call(this, a);
this.hT = "16"
}
;
l.extend(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString);
KJUR.asn1.DERUTCTime = function(a) {
KJUR.asn1.DERUTCTime.superclass.constructor.call(this, a);
this.hT = "17";
this.setByDate = function(a) {
this.hTLV = null;
this.isModified = !0;
this.date = a;
this.s = this.formatDate(this.date, "utc");
this.hV = stohex(this.s)
}
;
"undefined" != typeof a && ("undefined" != typeof a.str ? this.setString(a.str) : "undefined" != typeof a.hex ? this.setStringHex(a.hex) : "undefined" != typeof a.date && this.setByDate(a.date))
}
;
l.extend(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime);
KJUR.asn1.DERGeneralizedTime = function(a) {
KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, a);
this.hT = "18";
this.setByDate = function(a) {
this.hTLV = null;
this.isModified = !0;
this.date = a;
this.s = this.formatDate(this.date, "gen");
this.hV = stohex(this.s)
}
;
"undefined" != typeof a && ("undefined" != typeof a.str ? this.setString(a.str) : "undefined" != typeof a.hex ? this.setStringHex(a.hex) : "undefined" != typeof a.date && this.setByDate(a.date))
}
;
l.extend(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime);
KJUR.asn1.DERSequence = function(a) {
KJUR.asn1.DERSequence.superclass.constructor.call(this, a);
this.hT = "30";
this.getFreshValueHex = function() {
for (var a = "", b = 0; b < this.asn1Array.length; b++)
a += this.asn1Array.getEncodedHex();
return this.hV = a
}
}
;
l.extend(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured);
KJUR.asn1.DERSet = function(a) {
KJUR.asn1.DERSet.superclass.constructor.call(this, a);
this.hT = "31";
this.getFreshValueHex = function() {
for (var a = [], b = 0; b < this.asn1Array.length; b++)
a.push(this.asn1Array.getEncodedHex());
a.sort();
return this.hV = a.join("")
}
}
;
l.extend(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured);
KJUR.asn1.DERTaggedObject = function(a) {
KJUR.asn1.DERTaggedObject.superclass.constructor.call(this);
this.hT = "a0";
this.hV = "";
this.isExplicit = !0;
this.asn1Object = null;
this.setASN1Object = function(a, b, d) {
this.hT = b;
this.isExplicit = a;
this.asn1Object = d;
this.isExplicit ? (this.hV = this.asn1Object.getEncodedHex(),
this.hTLV = null,
this.isModified = !0) : (this.hV = null,
this.hTLV = d.getEncodedHex(),
this.hTLV = this.hTLV.replace(/^../, b),
this.isModified = !1)
}
;
this.getFreshValueHex = function() {
return this.hV
}
;
"undefined" != typeof a && ("undefined" != typeof a.tag && (this.hT = a.tag),
"undefined" != typeof a.explicit && (this.isExplicit = a.explicit),
"undefined" != typeof a.obj && (this.asn1Object = a.obj,
this.setASN1Object(this.isExplicit, this.hT, this.asn1Object)))
}
;
l.extend(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object);
(function(a) {
a = {};
var c;
window.Hex = a
}
)();
(function(a) {
var c = {}, b;
c.decode = function(c) {
var f;
if (b === a) {
b = [];
for (f = 0; 64 > f; ++f)
b["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f)] = f;
for (f = 0; 9 > f; ++f)
b["= \f\n\r\t\u00a0\u2028\u2029".charAt(f)] = -1
}
var g = []
, h = 0
, k = 0;
for (f = 0; f < c.length; ++f) {
var e = c.charAt(f);
if ("=" == e)
break;
e = b[e];
if (-1 != e) {
if (e === a)
throw "Illegal character at offset " + f;
h |= e;
4 <= ++k ? (g[g.length] = h >> 16,
g[g.length] = h >> 8 & 255,
g[g.length] = h & 255,
k = h = 0) : h <<= 6
}
}
switch (k) {
case 1:
throw "Base64 encoding incomplete: at least 2 bits missing";
case 2:
g[g.length] = h >> 10;
break;
case 3:
g[g.length] = h >> 16,
g[g.length] = h >> 8 & 255
}
return g
}
;
c.re = /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/;
c.unarmor = function(a) {
var b = c.re.exec(a);
if (b)
if (b[1])
a = b[1];
else if (b[2])
a = b[2];
else
throw "RegExp out of sync";
return c.decode(a)
}
;
window.Base64 = c
}
)();
(function(a) {
function c(a, b) {
a instanceof c ? (this.enc = a.enc,
this.pos = a.pos) : (this.enc = a,
this.pos = b)
}
function b(a, c, b, d, e) {
this.stream = a;
this.header = c;
this.length = b;
this.tag = d;
this.sub = e
}
var d = {
tag: function(a, c) {
var b = document.createElement(a);
b.className = c;
return b
},
text: function(a) {
return document.createTextNode(a)
}
};
c.prototype.get = function(c) {
c === a && (c = this.pos++);
if (c >= this.enc.length)
throw "Requesting byte offset " + c + " on a stream of length " + this.enc.length;
return this.enc[c]
}
;
c.prototype.hexDigits = "0123456789ABCDEF";
c.prototype.hexByte = function(a) {
return this.hexDigits.charAt(a >> 4 & 15) + this.hexDigits.charAt(a & 15)
}
;
c.prototype.hexDump = function(a, c, b) {
for (var d = ""; a < c; ++a)
if (d += this.hexByte(this.get(a)),
!0 !== b)
switch (a & 15) {
case 7:
d += " ";
break;
case 15:
d += "\n";
break;
default:
d += " "
}
return d
}
;
c.prototype.parseStringISO = function(a, c) {
for (var b = "", d = a; d < c; ++d)
b += String.fromCharCode(this.get(d));
return b
}
;
c.prototype.parseStringUTF = function(a, c) {
for (var b = "", d = a; d < c; )
var e = this.get(d++)
, b = 128 > e ? b + String.fromCharCode(e) : 191 < e && 224 > e ? b + String.fromCharCode((e & 31) << 6 | this.get(d++) & 63) : b + String.fromCharCode((e & 15) << 12 | (this.get(d++) & 63) << 6 | this.get(d++) & 63);
return b
}
;
c.prototype.parseStringBMP = function(a, c) {
for (var b = "", d = a; d < c; d += 2)
var e = this.get(d)
, l = this.get(d + 1)
, b = b + String.fromCharCode((e << 8) + l);
return b
}
;
c.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)?)?$/;
c.prototype.parseTime = function(a, c) {
var b = this.parseStringISO(a, c)
, d = this.reTime.exec(b);
if (!d)
return "Unrecognized time: " + b;
b = d[1] + "-" + d[2] + "-" + d[3] + " " + d[4];
d[5] && (b += ":" + d[5],
d[6] && (b += ":" + d[6],
d[7] && (b += "." + d[7])));
d[8] && (b += " UTC",
"Z" != d[8] && (b += d[8],
d[9] && (b += ":" + d[9])));
return b
}
;
c.prototype.parseInteger = function(a, c) {
var b = c - a;
if (4 < b) {
var b = b << 3
, d = this.get(a);
if (0 === d)
b -= 8;
else
for (; 128 > d; )
d <<= 1,
--b;
return "(" + b + " bit)"
}
b = 0;
for (d = a; d < c; ++d)
b = b << 8 | this.get(d);
return b
}
;
c.prototype.parseBitString = function(a, c) {
var b = this.get(a)
, d = (c - a - 1 << 3) - b
, e = "(" + d + " bit)";
if (20 >= d)
for (var l = b, e = e + " ", b = c - 1; b > a; --b) {
for (d = this.get(b); 8 > l; ++l)
e += d >> l & 1 ? "1" : "0";
l = 0
}
return e
}
;
c.prototype.parseOctetString = function(a, b) {
var c = b - a
, d = "(" + c + " byte) ";
100 < c && (b = a + 100);
for (var e = a; e < b; ++e)
d += this.hexByte(this.get(e));
100 < c && (d += "\u2026");
return d
}
;
c.prototype.parseOID = function(a, b) {
for (var c = "", d = 0, e = 0, l = a; l < b; ++l) {
var m = this.get(l)
, d = d << 7 | m & 127
, e = e + 7;
m & 128 || ("" === c ? (c = 80 > d ? 40 > d ? 0 : 1 : 2,
c = c + "." + (d - 40 * c)) : c += "." + (31 <= e ? "bigint" : d),
d = e = 0)
}
return c
}
;
b.prototype.typeName = function() {
if (this.tag === a)
return "unknown";
var c = this.tag & 31;
switch (this.tag >> 6) {
case 0:
switch (c) {
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";
default:
return "Universal_" + c.toString(16)
}
case 1:
return "Application_" + c.toString(16);
case 2:
return "[" + c + "]";
case 3:
return "Private_" + c.toString(16)
}
}
;
b.prototype.reSeemsASCII = /^[ -~]+$/;
b.prototype.content = function() {
if (this.tag === a)
return null;
var c = this.tag >> 6
, b = this.tag & 31
, d = this.posContent()
, e = Math.abs(this.length);
if (0 !== c) {
if (null !== this.sub)
return "(" + this.sub.length + " elem)";
c = this.stream.parseStringISO(d, d + Math.min(e, 100));
return this.reSeemsASCII.test(c) ? c.substring(0, 200) + (200 < c.length ? "\u2026" : "") : this.stream.parseOctetString(d, d + e)
}
switch (b) {
case 1:
return 0 === this.stream.get(d) ? "false" : "true";
case 2:
return this.stream.parseInteger(d, d + e);
case 3:
return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseBitString(d, d + e);
case 4:
return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(d, d + e);
case 6:
return this.stream.parseOID(d, d + e);
case 16:
case 17:
return "(" + this.sub.length + " elem)";
case 12:
return this.stream.parseStringUTF(d, d + e);
case 18:
case 19:
case 20:
case 21:
case 22:
case 26:
return this.stream.parseStringISO(d, d + e);
case 30:
return this.stream.parseStringBMP(d, d + e);
case 23:
case 24:
return this.stream.parseTime(d, d + e)
}
return null
}
;
b.prototype.toString = function() {
return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (null === this.sub ? "null" : this.sub.length) + "]"
}
;
b.prototype.print = function(c) {
c === a && (c = "");
document.writeln(c + this);
if (null !== this.sub) {
c += " ";
for (var b = 0, d = this.sub.length; b < d; ++b)
this.sub.print(c)
}
}
;
b.prototype.toPrettyString = function(c) {
c === a && (c = "");
var b = c + this.typeName() + " @" + this.stream.pos;
0 <= this.length && (b += "+");
b += this.length;
this.tag & 32 ? b += " (constructed)" : 3 != this.tag && 4 != this.tag || null === this.sub || (b += " (encapsulates)");
b += "\n";
if (null !== this.sub) {
c += " ";
for (var d = 0, e = this.sub.length; d < e; ++d)
b += this.sub[d].toPrettyString(c)
}
return b
}
;
b.prototype.toDOM = function() {
var a = d.tag("div", "node");
a.asn1 = this;
var c = d.tag("div", "head")
, b = this.typeName().replace(/_/g, " ");
c.innerHTML = b;
var e = this.content();
null !== e && (e = String(e).replace(/</g, "<"),
b = d.tag("span", "preview"),
b.appendChild(d.text(e)),
c.appendChild(b));
a.appendChild(c);
this.node = a;
this.head = c;
var l = d.tag("div", "value")
, b = "Offset: " + this.stream.pos + "<br/>"
, b = b + ("Length: " + this.header + "+")
, b = 0 <= this.length ? b + this.length : b + (-this.length + " (undefined)");
this.tag & 32 ? b += "<br/>(constructed)" : 3 != this.tag && 4 != this.tag || null === this.sub || (b += "<br/>(encapsulates)");
null !== e && (b += "<br/>Value:<br/><b>" + e + "</b>",
"object" === typeof oids && 6 == this.tag && (e = oids[e])) && (e.d && (b += "<br/>" + e.d),
e.c && (b += "<br/>" + e.c),
e.w && (b += "<br/>(warning!)"));
l.innerHTML = b;
a.appendChild(l);
b = d.tag("div", "sub");
if (null !== this.sub)
for (e = 0,
l = this.sub.length; e < l; ++e)
b.appendChild(this.sub[e].toDOM());
a.appendChild(b);
c.onclick = function() {
a.className = "node collapsed" == a.className ? "node" : "node collapsed"
}
;
return a
}
;
b.prototype.posStart = function() {
return this.stream.pos
}
;
b.prototype.posContent = function() {
return this.stream.pos + this.header
}
;
b.prototype.posEnd = function() {
return this.stream.pos + this.header + Math.abs(this.length)
}
;
b.prototype.fakeHover = function(a) {
this.node.className += " hover";
a && (this.head.className += " hover")
}
;
b.prototype.fakeOut = function(a) {
var b = / ?hover/;
this.node.className = this.node.className.replace(b, "");
a && (this.head.className = this.head.className.replace(b, ""))
}
;
b.prototype.toHexDOM_sub = function(a, b, c, e, l) {
e >= l || (b = d.tag("span", b),
b.appendChild(d.text(c.hexDump(e, l))),
a.appendChild(b))
}
;
b.prototype.toHexDOM = function(b) {
var c = d.tag("span", "hex");
b === a && (b = c);
this.head.hexNode = c;
this.head.onmouseover = function() {
this.hexNode.className = "hexCurrent"
}
;
this.head.onmouseout = function() {
this.hexNode.className = "hex"
}
;
c.asn1 = this;
c.onmouseover = function() {
var a = !b.selected;
a && (b.selected = this.asn1,
this.className = "hexCurrent");
this.asn1.fakeHover(a)
}
;
c.onmouseout = function() {
var a = b.selected == this.asn1;
this.asn1.fakeOut(a);
a && (b.selected = null,
this.className = "hex")
}
;
this.toHexDOM_sub(c, "tag", this.stream, this.posStart(), this.posStart() + 1);
this.toHexDOM_sub(c, 0 <= this.length ? "dlen" : "ulen", this.stream, this.posStart() + 1, this.posContent());
if (null === this.sub)
c.appendChild(d.text(this.stream.hexDump(this.posContent(), this.posEnd())));
else if (0 < this.sub.length) {
var e = this.sub[0]
, k = this.sub[this.sub.length - 1];
this.toHexDOM_sub(c, "intro", this.stream, this.posContent(), e.posStart());
for (var e = 0, l = this.sub.length; e < l; ++e)
c.appendChild(this.sub[e].toHexDOM(b));
this.toHexDOM_sub(c, "outro", this.stream, k.posEnd(), this.posEnd())
}
return c
}
;
b.prototype.toHexString = function(a) {
return this.stream.hexDump(this.posStart(), this.posEnd(), !0)
}
;
b.decodeLength = function(a) {
var b = a.get()
, c = b & 127;
if (c == b)
return c;
if (3 < c)
throw "Length over 24 bits not supported at position " + (a.pos - 1);
if (0 === c)
return -1;
for (var d = b = 0; d < c; ++d)
b = b << 8 | a.get();
return b
}
;
b.hasContent = function(a, d, e) {
if (a & 32)
return !0;
if (3 > a || 4 < a)
return !1;
var k = new c(e);
3 == a && k.get();
if (k.get() >> 6 & 1)
return !1;
try {
var l = b.decodeLength(k);
return k.pos - e.pos + l == d
} catch (m) {
return !1
}
}
;
b.decode = function(a) {
a instanceof c || (a = new c(a,0));
var d = new c(a)
, e = a.get()
, k = b.decodeLength(a)
, l = a.pos - d.pos
, m = null;
if (b.hasContent(e, k, a)) {
var n = a.pos;
3 == e && a.get();
m = [];
if (0 <= k) {
for (var p = n + k; a.pos < p; )
m[m.length] = b.decode(a);
if (a.pos != p)
throw "Content size is not correct for container starting at offset " + n;
} else
try {
for (; ; ) {
p = b.decode(a);
if (0 === p.tag)
break;
m[m.length] = p
}
k = n - a.pos
} catch (q) {
throw "Exception while decoding undefined length content: " + q;
}
} else
a.pos += k;
return new b(d,l,k,e,m)
}
;
b.test = function() {
for (var a = [{
value: [39],
expected: 39
}, {
value: [129, 201],
expected: 201
}, {
value: [131, 254, 220, 186],
expected: 16702650
}], d = 0, e = a.length; d < e; ++d) {
var k = new c(a[d].value,0)
, k = b.decodeLength(k);
k != a[d].expected && document.write("In test[" + d + "] expected " + a[d].expected + " got " + k + "\n")
}
}
;
window.ASN1 = b
}
)();
ASN1.prototype.getHexStringValue = function() {
return this.toHexString().substr(2 * this.header, 2 * this.length)
}
;
p.prototype.parseKey = function(a) {
try {
var c = 0
, b = 0
, d = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(a) ? Hex.decode(a) : Base64.unarmor(a)
, e = ASN1.decode(d);
3 === e.sub.length && (e = e.sub[2].sub[0]);
if (9 === e.sub.length) {
c = e.sub[1].getHexStringValue();
this.n = n(c, 16);
b = e.sub[2].getHexStringValue();
this.e = parseInt(b, 16);
var g = e.sub[3].getHexStringValue();
this.d = n(g, 16);
var h = e.sub[4].getHexStringValue();
this.p = n(h, 16);
var k = e.sub[5].getHexStringValue();
this.q = n(k, 16);
var l = e.sub[6].getHexStringValue();
this.dmp1 = n(l, 16);
var m = e.sub[7].getHexStringValue();
this.dmq1 = n(m, 16);
var p = e.sub[8].getHexStringValue();
this.coeff = n(p, 16)
} else if (2 === e.sub.length) {
var q = e.sub[1].sub[0]
, c = q.sub[0].getHexStringValue();
this.n = n(c, 16);
b = q.sub[1].getHexStringValue();
this.e = parseInt(b, 16)
} else
return !1;
return !0
} catch (t) {
return !1
}
}
;
p.prototype.getPrivateBaseKey = function() {
var a = {
array: [new KJUR.asn1.DERInteger({
"int": 0
}), new KJUR.asn1.DERInteger({
bigint: this.n
}), new KJUR.asn1.DERInteger({
"int": this.e
}), new KJUR.asn1.DERInteger({
bigint: this.d
}), new KJUR.asn1.DERInteger({
bigint: this.p
}), new KJUR.asn1.DERInteger({
bigint: this.q
}), new KJUR.asn1.DERInteger({
bigint: this.dmp1
}), new KJUR.asn1.DERInteger({
bigint: this.dmq1
}), new KJUR.asn1.DERInteger({
bigint: this.coeff
})]
};
return (new KJUR.asn1.DERSequence(a)).getEncodedHex()
}
;
p.prototype.getPrivateBaseKeyB64 = function() {
return P(this.getPrivateBaseKey())
}
;
p.prototype.getPublicBaseKey = function() {
var a = {
array: [new KJUR.asn1.DERObjectIdentifier({
oid: "1.2.840.113549.1.1.1"
}), new KJUR.asn1.DERNull]
}
, c = new KJUR.asn1.DERSequence(a)
, a = {
array: [new KJUR.asn1.DERInteger({
bigint: this.n
}), new KJUR.asn1.DERInteger({
"int": this.e
})]
}
, a = {
hex: "00" + (new KJUR.asn1.DERSequence(a)).getEncodedHex()
}
, a = new KJUR.asn1.DERBitString(a)
, a = {
array: [c, a]
};
return (new KJUR.asn1.DERSequence(a)).getEncodedHex()
}
;
p.prototype.getPublicBaseKeyB64 = function() {
return P(this.getPublicBaseKey())
}
;
p.prototype.wordwrap = function(a, c) {
c = c || 64;
return a ? a.match(RegExp("(.{1," + c + "})( +|$\n?)|(.{1," + c + "})", "g")).join("\n") : a
}
;
p.prototype.getPrivateKey = function() {
var a;
a = "-----BEGIN RSA PRIVATE KEY-----\n" + (this.wordwrap(this.getPrivateBaseKeyB64()) + "\n");
return a + "-----END RSA PRIVATE KEY-----"
}
;
p.prototype.getPublicKey = function() {
var a;
a = "-----BEGIN PUBLIC KEY-----\n" + (this.wordwrap(this.getPublicBaseKeyB64()) + "\n");
return a + "-----END PUBLIC KEY-----"
}
;
p.prototype.hasPublicKeyProperty = function(a) {
a = a || {};
return a.hasOwnProperty("n") && a.hasOwnProperty("e")
}
;
p.prototype.hasPrivateKeyProperty = function(a) {
a = a || {};
return a.hasOwnProperty("n") && a.hasOwnProperty("e") && a.hasOwnProperty("d") && a.hasOwnProperty("p") && a.hasOwnProperty("q") && a.hasOwnProperty("dmp1") && a.hasOwnProperty("dmq1") && a.hasOwnProperty("coeff")
}
;
p.prototype.parsePropertiesFrom = function(a) {
this.n = a.n;
this.e = a.e;
a.hasOwnProperty("d") && (this.d = a.d,
this.p = a.p,
this.q = a.q,
this.dmp1 = a.dmp1,
this.dmq1 = a.dmq1,
this.coeff = a.coeff)
}
;
var G = function(a) {
p.call(this);
a && ("string" === typeof a ? this.parseKey(a) : (this.hasPrivateKeyProperty(a) || this.hasPublicKeyProperty(a)) && this.parsePropertiesFrom(a))
};
G.prototype = new p;
G.prototype.constructor = G;
l = function(a) {
a = a || {};
this.default_key_size = parseInt(a.default_key_size) || 1024;
this.default_public_exponent = a.default_public_exponent || "010001";
this.log = a.log || !1;
this.key = null
}
;
l.prototype.setKey = function(a) {
this.log && this.key && console.warn("A key was already set, overriding existing.");
this.key = new G(a)
}
;
l.prototype.setPrivateKey = function(a) {
this.setKey(a)
}
;
l.prototype.setPublicKey = function(a) {
this.setKey(a)
}
;
l.prototype.decrypt = function(a) {
try {
return this.getKey().decrypt(ba(a))
} catch (c) {
return !1
}
}
;
l.prototype.encrypt = function(a) {
try {
return P(this.getKey().encrypt(a))
} catch (c) {
return !1
}
}
;
l.prototype.getKey = function(a) {
if (!this.key) {
this.key = new G;
if (a && "[object Function]" === {}.toString.call(a)) {
this.key.generateAsync(this.default_key_size, this.default_public_exponent, a);
return
}
this.key.generate(this.default_key_size, this.default_public_exponent)
}
return this.key
}
;
l.prototype.getPrivateKey = function() {
return this.getKey().getPrivateKey()
}
;
l.prototype.getPrivateKeyB64 = function() {
return this.getKey().getPrivateBaseKeyB64()
}
;
l.prototype.getPublicKey = function() {
return this.getKey().getPublicKey()
}
;
l.prototype.getPublicKeyB64 = function() {
return this.getKey().getPublicBaseKeyB64()
}
;
l.version = "2.3.0";
N.JSEncrypt = l
}
)(JSEncryptExports);
(function(N, e) {
"object" === typeof exports && "undefined" !== typeof module ? module.exports = e : "function" === typeof define && define.amd ? define(e) : N.JSEncrypt = e
}
)(this, JSEncryptExports.JSEncrypt);
function get(test)
{
var casEncrypt = new JSEncrypt;
casEncrypt.setPublicKey('MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2r/a16R00/CocCwFiS2/EBQcKL6xEw4ixT0IJ7LmVN8h25e0i9hrnc1GM8wR430WbHQjVfWqqtoXuGdRKgV0QxnLH4vEw4IsTKIqQEiCdoO1jsCXY/4TNQtZelJYBbqrpjOB0DAH+qXVb2YINO/UHthCIka4Z1nVuphJd/UIi8wIDAQAB');
return casEncrypt.encrypt(test);
}