代码部分
主文件:main.py
import re
import time
import execjs
import requests
from lxml import etree
from jsdata import jsData
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.61",
}
session = requests.Session()
def getPublicKeyAndKeysTime() -> tuple:
"""
获取加密的PublicKey以及验证的KeysTime
Returns
-------
tuple
(PublicKey,KeysTime)
"""
url = "https://www.yiban.cn/login?go=https%3A%2F%2Fwww.yiban.cn%2F"
req = session.get(url=url, headers=headers)
ex = "data-keys='(.*?)' data-keys-time='(.*?)'>"
return re.findall(ex, req.text, re.S)[0]
def encryptPassword(public_key: str, password: str) -> str:
"""
加密密码
Parameters
----------
public_key : str
用于加密的PublicKey
password : str
明文密码
Returns
-------
str
加密后的密码
"""
return execjs.compile(jsData()).call("my_encrypt", public_key, password)
def logInYiBan(account: str, encrypted_password: str, keys_time: str) -> str:
"""
登录易班获取token
Parameters
----------
account : str
账号
encrypted_password : str
加密后的密码
keys_time : str
公钥时间戳
Returns
-------
str
token
"""
url = "https://www.yiban.cn/login/doLoginAjax"
data = {
"account": account,
"password": encrypted_password,
"captcha": "",
"keysTime": keys_time,
}
req = session.post(url=url, headers=headers, data=data)
return req.headers["set-cookie"].split(";")[0].split("=")[1]
def logInYooc(token: str) -> int:
"""
跳转登录优课
Parameters
----------
token : str
易班登录后获得
Returns
-------
int
状态码,200即为成功
"""
url = f"https://www.yooc.me/yiban_account/sso?token={token}"
req = session.get(url, headers=headers)
return req.status_code
def getMyGroup() -> dict:
"""
获取我加入的课群
Returns
-------
dict
课群信息
"""
url = f"https://www.yooc.me/group/joined?_={str(time.time() * 1000).split('.')[0]}&page=1"
req = session.get(url, headers=headers)
return req.json()
def getLearnGroup() -> list:
"""
获取学习课群
Returns
-------
list
课群信息,仅获取了第一页
"""
url = "https://www.yooc.me/groups"
req = session.get(url, headers=headers)
ex = '(.*?)
(.*?)'
return re.findall(ex, req.text)
def getShareCourse() -> list:
"""
获取共享课程
Returns
-------
list
共享课程信息
"""
url = "https://www.yooc.me/shenhe/customized_course/school/list"
req = session.get(url, headers=headers)
tree = etree.HTML(req.text)
li_list = tree.xpath('//*[@id="school-list"]/li')
course_list = []
for li in li_list:
name = li.xpath("./div/h4/text()")[0]
course = li.xpath("./div/p[1]/text()")[0]
learns = li.xpath("./div/p[2]/text()")[0]
up = li.xpath("./div/p[3]/text()")[0]
url = "https://www.yooc.me" + li.xpath("./div/a/@href")[0]
course_list.append((name, course, learns, up, url))
return course_list
if __name__ == "__main__":
account = "" # 易班账号
password = "" # 易班密码
public_key, keys_time = getPublicKeyAndKeysTime()
# print(public_key, keys_time)
encrypted_password = encryptPassword(public_key=public_key, password=password)
# print(encrypted_password)
token = logInYiBan(
account=account,
encrypted_password=encrypted_password,
keys_time=keys_time,
)
# print(token)
status_code = logInYooc(token=token)
# print(status_code)
my_group_data = getMyGroup()
print("我加入的课群:\n", my_group_data)
learn_group_data = getLearnGroup()
print("学习课群:\n", learn_group_data)
course_data = getShareCourse()
print("共享课程:\n", course_data)
加密JS文件:jsdata.py
def jsData():
return r"""/*! JSEncrypt v2.3.1 | https://npmcdn.com/[email protected]/LICENSE.txt */
navigator = this;
window = this; !
function(t, e) {
"function" == typeof define && define.amd ? define(["exports"], e) : e("object" == typeof exports && "string" != typeof exports.nodeName ? module.exports: t)
} (this,
function(t) {
function e(t, e, i) {
null != t && ("number" == typeof t ? this.fromNumber(t, e, i) : null == e && "string" != typeof t ? this.fromString(t, 256) : this.fromString(t, e))
}
function i() {
return new e(null)
}
function r(t, e, i, r, s, n) {
for (; --n >= 0;) {
var o = e * this[t++] + i[r] + s;
s = Math.floor(o / 67108864),
i[r++] = 67108863 & o
}
return s
}
function s(t, e, i, r, s, n) {
for (var o = 32767 & e,
h = e >> 15; --n >= 0;) {
var a = 32767 & this[t],
u = this[t++] >> 15,
c = h * a + u * o;
a = o * a + ((32767 & c) >> 30) + (c >>> 15) + h * u + (s >>> 30),
i[r++] = 1073741823 & a
}
return s
}
function n(t, e, i, r, s, n) {
for (var o = 16383 & e,
h = e >> 14; --n >= 0;) {
var a = 16383 & this[t],
u = this[t++] >> 14,
c = h * a + u * o;
a = o * a + ((16383 & c) > 28) + (c >> 14) + h * u,
i[r++] = 268435455 & a
}
return s
}
function o(t) {
return Be.charAt(t)
}
function h(t, e) {
var i = Ke[t.charCodeAt(e)];
return null == i ? -1 : i
}
function a(t) {
for (var e = this.t - 1; e >= 0; --e) t[e] = this[e];
t.t = this.t,
t.s = this.s
}
function u(t) {
this.t = 1,
this.s = 0 > t ? -1 : 0,
t > 0 ? this[0] = t: -1 > t ? this[0] = t + this.DV: this.t = 0
}
function c(t) {
var e = i();
return e.fromInt(t),
e
}
function f(t, i) {
var r;
if (16 == i) r = 4;
else if (8 == i) r = 3;
else if (256 == i) r = 8;
else if (2 == i) r = 1;
else if (32 == i) r = 5;
else {
if (4 != i) return void this.fromRadix(t, i);
r = 2
}
this.t = 0,
this.s = 0;
for (var s = t.length,
n = !1,
o = 0; --s >= 0;) {
var a = 8 == r ? 255 & t
0 > a ? "-" == t.charAt(s) && (n = !0) : (n = !1, 0 == o ? this[this.t++] = a: o + r > this.DB ? (this[this.t - 1] |= (a & (1 > this.DB - o) : this[this.t - 1] |= a = this.DB && (o -= this.DB))
}
8 == r && 0 != (128 & t[0]) && (this.s = -1, o > 0 && (this[this.t - 1] |= (1 0 && this[this.t - 1] == t;)--this.t
}
function l(t) {
if (this.s 0) for (a > a) > 0 && (s = !0, n = o(i)); h >= 0;) e > a ? (i = (this[h] & (1 > (a += this.DB - e)) : (i = this[h] >> (a -= e) & r, 0 >= a && (a += this.DB, --h)),
i > 0 && (s = !0),
s && (n += o(i));
return s ? n: "0"
}
function d() {
var t = i();
return e.ZERO.subTo(this, t),
t
}
function g() {
return this.s = 0;) if (0 != (e = this - t)) return e;
return 0
}
function y(t) {
var e, i = 1;
return 0 != (e = t >>> 16) && (t = e, i += 16),
0 != (e = t >> 8) && (t = e, i += 8),
0 != (e = t >> 4) && (t = e, i += 4),
0 != (e = t >> 2) && (t = e, i += 2),
0 != (e = t >> 1) && (t = e, i += 1),
i
}
function b() {
return this.t = 0; --i) e[i + t] = this;
for (i = t - 1; i >= 0; --i) e = 0;
e.t = this.t + t,
e.s = this.s
}
function S(t, e) {
for (var i = t; i = 0; --i) e[i + o + 1] = this >> s | h,
h = (this & n) = 0; --i) e = 0;
e[o] = h,
e.t = this.t + o + 1,
e.s = this.s,
e.clamp()
}
function E(t, e) {
e.s = this.s;
var i = Math.floor(t / this.DB);
if (i >= this.t) return void(e.t = 0);
var r = t % this.DB,
s = this.DB - r,
n = (1 > r;
for (var o = i + 1; o > r;
r > 0 && (e[this.t - i - 1] |= (this.s & n) i;) r += this - t,
e[i++] = r & this.DM,
r >>= this.DB;
if (t.t >= this.DB;
r += this.s
} else {
for (r += this.s; i >= this.DB;
r -= t.s
}
e.s = 0 > r ? -1 : 0,
-1 > r ? e[i++] = this.DV + r: r > 0 && (e[i++] = r),
e.t = i,
e.clamp()
}
function w(t, i) {
var r = this.abs(),
s = t.abs(),
n = r.t;
for (i.t = n + s.t; --n >= 0;) i[n] = 0;
for (n = 0; n = 0;) t = 0;
for (i = 0; i = e.DV && (t[i + e.t] -= e.DV, t[i + e.t + 1] = 1)
}
t.t > 0 && (t[t.t - 1] += e.am(i, e, t, 2 * i, 0, 1)),
t.s = 0,
t.clamp()
}
function B(t, r, s) {
var n = t.abs();
if (! (n.t 0 ? (n.lShiftTo(c, h), o.lShiftTo(c, s)) : (n.copyTo(h), o.copyTo(s));
var f = h.t,
p = h[f - 1];
if (0 != p) {
var l = p * (1 1 ? h[f - 2] >> this.F2: 0),
d = this.FV / l,
g = (1 = 0 && (s[s.t++] = 1, s.subTo(T, s)), e.ONE.dlShiftTo(f, T), T.subTo(h, h); h.t = 0;) {
var S = s[--v] == p ? this.DM: Math.floor(s[v] * d + (s[v - 1] + m) * g);
if ((s[v] += h.am(0, S, s, b, 0, f)) 0 && s.rShiftTo(c, s),
0 > a && e.ZERO.subTo(s, s)
}
}
}
function K(t) {
var r = i();
return this.abs().divRemTo(t, null, r),
this.s 0 && t.subTo(r, r),
r
}
function A(t) {
this.m = t
}
function U(t) {
return t.s = 0 ? t.mod(this.m) : t
}
function O(t) {
return t
}
function V(t) {
t.divRemTo(this.m, null, t)
}
function N(t, e, i) {
t.multiplyTo(e, i),
this.reduce(i)
}
function J(t, e) {
t.squareTo(e),
this.reduce(e)
}
function I() {
if (this.t 0 ? this.DV - e: -e
}
function P(t) {
this.m = t,
this.mp = t.invDigit(),
this.mpl = 32767 & this.mp,
this.mph = this.mp >> 15,
this.um = (1 0 && this.m.subTo(r, r),
r
}
function L(t) {
var e = i();
return t.copyTo(e),
this.reduce(e),
e
}
function q(t) {
for (; t.t > 15) * this.mpl & this.um) = t.DV;) t -= t.DV,
t[++i]++
}
t.clamp(),
t.drShiftTo(this.m.t, t),
t.compareTo(this.m) >= 0 && t.subTo(this.m, t)
}
function C(t, e) {
t.squareTo(e),
this.reduce(e)
}
function H(t, e, i) {
t.multiplyTo(e, i),
this.reduce(i)
}
function j() {
return 0 == (this.t > 0 ? 1 & this[0] : this.s)
}
function k(t, r) {
if (t > 4294967295 || 1 > t) return e.ONE;
var s = i(),
n = i(),
o = r.convert(this),
h = y(t) - 1;
for (o.copyTo(s); --h >= 0;) if (r.sqrTo(s, n), (t & 1 0) r.mulTo(n, o, s);
else {
var a = s;
s = n,
n = a
}
return r.revert(s)
}
function F(t, e) {
var i;
return i = 256 > t || e.isEven() ? new A(e) : new P(e),
this.exp(t, i)
}
// Copyright (c) 2005-2009 Tom Wu
// All Rights Reserved.
// See "LICENSE" for details.
function _() {
var t = i();
return this.copyTo(t),
t
}
function z() {
if (this.s > 24
}
function G() {
return 0 == this.t ? this.s: this[0] > 16
}
function $(t) {
return Math.floor(Math.LN2 * this.DB / Math.log(t))
}
function Y() {
return this.s t || t > 36) return "0";
var e = this.chunkSize(t),
r = Math.pow(t, e),
s = c(r),
n = i(),
o = i(),
h = "";
for (this.divRemTo(s, n, o); n.signum() > 0;) h = (r + o.intValue()).toString(t).substr(1) + h,
n.divRemTo(s, n, o);
return o.intValue().toString(t) + h
}
function Q(t, i) {
this.fromInt(0),
null == i && (i = 10);
for (var r = this.chunkSize(i), s = Math.pow(i, r), n = !1, o = 0, a = 0, u = 0; u c ? "-" == t.charAt(u) && 0 == this.signum() && (n = !0) : (a = i * a + c, ++o >= r && (this.dMultiply(s), this.dAddOffset(a, 0), o = 0, a = 0))
}
o > 0 && (this.dMultiply(Math.pow(i, o)), this.dAddOffset(a, 0)),
n && e.ZERO.subTo(this, this)
}
function X(t, i, r) {
if ("number" == typeof i) if (2 > t) this.fromInt(1);
else for (this.fromNumber(t, r), this.testBit(t - 1) || this.bitwiseTo(e.ONE.shiftLeft(t - 1), ht, this), this.isEven() && this.dAddOffset(1, 0); ! this.isProbablePrime(i);) this.dAddOffset(2, 0),
this.bitLength() > t && this.subTo(e.ONE.shiftLeft(t - 1), this);
else {
var s = new Array,
n = 7 & t;
s.length = (t >> 3) + 1,
i.nextBytes(s),
n > 0 ? s[0] &= (1 0) for (r > r) != (this.s & this.DM) >> r && (e[s++] = i | this.s = 0;) 8 > r ? (i = (this[t] & (1 > (r += this.DB - 8)) : (i = this[t] >> (r -= 8) & 255, 0 >= r && (r += this.DB, --t)),
0 != (128 & i) && (i |= -256),
0 == s && (128 & this.s) != (128 & i) && ++s,
(s > 0 || i != this.s) && (e[s++] = i);
return e
}
function et(t) {
return 0 == this.compareTo(t)
}
function it(t) {
return this.compareTo(t) 0 ? this: t
}
function st(t, e, i) {
var r, s, n = Math.min(t.t, this.t);
for (r = 0; n > r; ++r) i[r] = e(this[r], t[r]);
if (t.t t ? this.rShiftTo( - t, e) : this.lShiftTo(t, e),
e
}
function gt(t) {
var e = i();
return 0 > t ? this.lShiftTo( - t, e) : this.rShiftTo(t, e),
e
}
function mt(t) {
if (0 == t) return - 1;
var e = 0;
return 0 == (65535 & t) && (t >>= 16, e += 16),
0 == (255 & t) && (t >>= 8, e += 8),
0 == (15 & t) && (t >>= 4, e += 4),
0 == (3 & t) && (t >>= 2, e += 2),
0 == (1 & t) && ++e,
e
}
function yt() {
for (var t = 0; t = this.t ? 0 != this.s: 0 != (this[e] & 1 i;) r += this + t,
e[i++] = r & this.DM,
r >>= this.DB;
if (t.t >= this.DB;
r += this.s
} else {
for (r += this.s; i >= this.DB;
r += t.s
}
e.s = 0 > r ? -1 : 0,
r > 0 ? e[i++] = r: -1 > r && (e[i++] = this.DV + r),
e.t = i,
e.clamp()
}
function xt(t) {
var e = i();
return this.addTo(t, e),
e
}
function Bt(t) {
var e = i();
return this.subTo(t, e),
e
}
function Kt(t) {
var e = i();
return this.multiplyTo(t, e),
e
}
function At() {
var t = i();
return this.squareTo(t),
t
}
function Ut(t) {
var e = i();
return this.divRemTo(t, e, null),
e
}
function Ot(t) {
var e = i();
return this.divRemTo(t, null, e),
e
}
function Vt(t) {
var e = i(),
r = i();
return this.divRemTo(t, e, r),
new Array(e, r)
}
function Nt(t) {
this[this.t] = this.am(0, t - 1, this, 0, 0, this.t),
++this.t,
this.clamp()
}
function Jt(t, e) {
if (0 != t) {
for (; this.t = this.DV;) this[e] -= this.DV,
++e >= this.t && (this[this.t++] = 0),
++this[e]
}
}
function It() {}
function Pt(t) {
return t
}
function Mt(t, e, i) {
t.multiplyTo(e, i)
}
function Lt(t, e) {
t.squareTo(e)
}
function qt(t) {
return this.exp(t, new It)
}
function Ct(t, e, i) {
var r = Math.min(this.t + t.t, e);
for (i.s = 0, i.t = r; r > 0;) i[--r] = 0;
var s;
for (s = i.t - this.t; s > r; ++r) i[r + this.t] = this.am(0, t[r], i, r, 0, this.t);
for (s = Math.min(t.t, e); s > r; ++r) this.am(0, t[r], i, r, 0, e - r);
i.clamp()
}
function Ht(t, e, i) {--e;
var r = i.t = this.t + t.t - e;
for (i.s = 0; --r >= 0;) i[r] = 0;
for (r = Math.max(e - this.t, 0); r 2 * this.m.t) return t.mod(this.m);
if (t.compareTo(this.m) this.m.t + 1 && (t.t = this.m.t + 1, t.clamp()), this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); t.compareTo(this.r2) = 0;) t.subTo(this.m, t)
}
function zt(t, e) {
t.squareTo(e),
this.reduce(e)
}
function Zt(t, e, i) {
t.multiplyTo(e, i),
this.reduce(i)
}
function Gt(t, e) {
var r, s, n = t.bitLength(),
o = c(1);
if (0 >= n) return o;
r = 18 > n ? 1 : 48 > n ? 3 : 144 > n ? 4 : 768 > n ? 5 : 6,
s = 8 > n ? new A(e) : e.isEven() ? new jt(e) : new P(e);
var h = new Array,
a = 3,
u = r - 1,
f = (1 1) {
var p = i();
for (s.sqrTo(h[1], p); f >= a;) h[a] = i(),
s.mulTo(p, h[a - 2], h[a]),
a += 2
}
var l, d, g = t.t - 1,
m = !0,
v = i();
for (n = y(t[g]) - 1; g >= 0;) {
for (n >= u ? l = t[g] >> n - u & f: (l = (t[g] & (1 0 && (l |= t[g - 1] >> this.DB + n - u)), a = r; 0 == (1 & l);) l >>= 1,
--a;
if ((n -= a) 1;) s.sqrTo(o, v),
s.sqrTo(v, o),
a -= 2;
a > 0 ? s.sqrTo(o, v) : (d = o, o = v, v = d),
s.mulTo(v, h[l], o)
}
for (; g >= 0 && 0 == (t[g] & 1 n) return e;
for (n > s && (n = s), n > 0 && (e.rShiftTo(n, e), i.rShiftTo(n, i)); e.signum() > 0;)(s = e.getLowestSetBit()) > 0 && e.rShiftTo(s, e),
(s = i.getLowestSetBit()) > 0 && i.rShiftTo(s, i),
e.compareTo(i) >= 0 ? (e.subTo(i, e), e.rShiftTo(1, e)) : (i.subTo(e, i), i.rShiftTo(1, i));
return n > 0 && i.lShiftTo(n, i),
i
}
function Yt(t) {
if (0 >= t) return 0;
var e = this.DV % t,
i = this.s 0) if (0 == e) i = this[0] % t;
else for (var r = this.t - 1; r >= 0; --r) i = (e * i + this[r]) % t;
return i
}
function Wt(t) {
var i = t.isEven();
if (this.isEven() && i || 0 == t.signum()) return e.ZERO;
for (var r = t.clone(), s = this.clone(), n = c(1), o = c(0), h = c(0), a = c(1); 0 != r.signum();) {
for (; r.isEven();) r.rShiftTo(1, r),
i ? (n.isEven() && o.isEven() || (n.addTo(this, n), o.subTo(t, o)), n.rShiftTo(1, n)) : o.isEven() || o.subTo(t, o),
o.rShiftTo(1, o);
for (; s.isEven();) s.rShiftTo(1, s),
i ? (h.isEven() && a.isEven() || (h.addTo(this, h), a.subTo(t, a)), h.rShiftTo(1, h)) : a.isEven() || a.subTo(t, a),
a.rShiftTo(1, a);
r.compareTo(s) >= 0 ? (r.subTo(s, r), i && n.subTo(h, n), o.subTo(a, o)) : (s.subTo(r, s), i && h.subTo(n, h), a.subTo(o, a))
}
return 0 != s.compareTo(e.ONE) ? e.ZERO: a.compareTo(t) >= 0 ? a.subtract(t) : a.signum() r;) r *= Ae[s++];
for (r = i.modInt(r); s > e;) if (r % Ae[e++] == 0) return ! 1
}
return i.millerRabin(t)
}
function Xt(t) {
var r = this.subtract(e.ONE),
s = r.getLowestSetBit();
if (0 >= s) return ! 1;
var n = r.shiftRight(s);
t = t + 1 >> 1,
t > Ae.length && (t = Ae.length);
for (var o = i(), h = 0; t > h; ++h) {
o.fromInt(Ae[Math.floor(Math.random() * Ae.length)]);
var a = o.modPow(n, this);
if (0 != a.compareTo(e.ONE) && 0 != a.compareTo(r)) {
for (var u = 1; u++ e; ++e) this.S[e] = e;
for (i = 0, e = 0; 256 > e; ++e) i = i + this.S[e] + t[e % t.length] & 255,
r = this.S[e],
this.S[e] = this.S,
this.S = r;
this.i = 0,
this.j = 0
}
function ie() {
var t;
return this.i = this.i + 1 & 255,
this.j = this.j + this.S[this.i] & 255,
t = this.S[this.i],
this.S[this.i] = this.S[this.j],
this.S[this.j] = t,
this.S[t + this.S[this.i] & 255]
}
function re() {
return new te
}
function se() {
if (null == Oe) {
for (Oe = re(); Je > Ne;) {
var t = Math.floor(65536 * Math.random());
Ve[Ne++] = 255 & t
}
for (Oe.init(Ve), Ne = 0; Ne = 0 && i > 0;) {
var n = t.charCodeAt(s--);
128 > n ? r[--i] = n: n > 127 && 2048 > n ? (r[--i] = 63 & n | 128, r[--i] = n >> 6 | 192) : (r[--i] = 63 & n | 128, r[--i] = n >> 6 & 63 | 128, r[--i] = n >> 12 | 224)
}
r[--i] = 0;
for (var o = new oe,
h = new Array; i > 2;) {
for (h[0] = 0; 0 == h[0];) o.nextBytes(h);
r[--i] = h[0]
}
return r[--i] = 2,
r[--i] = 0,
new e(r)
}
function ue() {
this.n = null,
this.e = 0,
this.d = null,
this.p = null,
this.q = null,
this.dmp1 = null,
this.dmq1 = null,
this.coeff = null
}
function ce(t, e) {
null != t && null != e && t.length > 0 && e.length > 0 ? (this.n = he(t, 16), this.e = parseInt(e, 16)) : console.error("Invalid RSA public key")
}
function fe(t) {
return t.modPowInt(this.e, this.n)
}
function pe(t) {
var e = ae(t, this.n.bitLength() + 7 >> 3);
if (null == e) return null;
var i = this.doPublic(e);
if (null == i) return null;
var r = i.toString(16);
return 0 == (1 & r.length) ? r: "0" + r
}
function le(t, e) {
for (var i = t.toByteArray(), r = 0; r = i.length) return null;
for (var s = ""; ++r n ? s += String.fromCharCode(n) : n > 191 && 224 > n ? (s += String.fromCharCode((31 & n) 0 && e.length > 0 ? (this.n = he(t, 16), this.e = parseInt(e, 16), this.d = he(i, 16)) : console.error("Invalid RSA private key")
}
function ge(t, e, i, r, s, n, o, h) {
null != t && null != e && t.length > 0 && e.length > 0 ? (this.n = he(t, 16), this.e = parseInt(e, 16), this.d = he(i, 16), this.p = he(r, 16), this.q = he(s, 16), this.dmp1 = he(n, 16), this.dmq1 = he(o, 16), this.coeff = he(h, 16)) : console.error("Invalid RSA private key")
}
function me(t, i) {
var r = new oe,
s = t >> 1;
this.e = parseInt(i, 16);
for (var n = new e(i, 16);;) {
for (; this.p = new e(t - s, 1, r), 0 != this.p.subtract(e.ONE).gcd(n).compareTo(e.ONE) || !this.p.isProbablePrime(10););
for (; this.q = new e(s, 1, r), 0 != this.q.subtract(e.ONE).gcd(n).compareTo(e.ONE) || !this.q.isProbablePrime(10););
if (this.p.compareTo(this.q) > 3)
}
function be(t) {
var e, i, r = "";
for (e = 0; e + 3 > 6) + Le.charAt(63 & i);
for (e + 1 == t.length ? (i = parseInt(t.substring(e, e + 1), 16), r += Le.charAt(i > 2) + Le.charAt((3 & i) 0;) r += qe;
return r
}
function Te(t) {
var e, i, r = "",
s = 0;
for (e = 0; e > 2), i = 3 & v, s = 1) : 1 == s ? (r += o(i > 4), i = 15 & v, s = 2) : 2 == s ? (r += o(i), r += o(v >> 2), i = 3 & v, s = 3) : (r += o(i > 4), r += o(15 & v), s = 0));
return 1 == s && (r += o(i = xe; ++xe) Ke[we++] = xe;
for (we = "a".charCodeAt(0), xe = 10; 36 > xe; ++xe) Ke[we++] = xe;
for (we = "A".charCodeAt(0), xe = 10; 36 > xe; ++xe) Ke[we++] = xe;
A.prototype.convert = U,
A.prototype.revert = O,
A.prototype.reduce = V,
A.prototype.mulTo = N,
A.prototype.sqrTo = J,
P.prototype.convert = M,
P.prototype.revert = L,
P.prototype.reduce = q,
P.prototype.mulTo = H,
P.prototype.sqrTo = C,
e.prototype.copyTo = a,
e.prototype.fromInt = u,
e.prototype.fromString = f,
e.prototype.clamp = p,
e.prototype.dlShiftTo = T,
e.prototype.drShiftTo = S,
e.prototype.lShiftTo = R,
e.prototype.rShiftTo = E,
e.prototype.subTo = D,
e.prototype.multiplyTo = w,
e.prototype.squareTo = x,
e.prototype.divRemTo = B,
e.prototype.invDigit = I,
e.prototype.isEven = j,
e.prototype.exp = k,
e.prototype.toString = l,
e.prototype.negate = d,
e.prototype.abs = g,
e.prototype.compareTo = m,
e.prototype.bitLength = b,
e.prototype.mod = K,
e.prototype.modPowInt = F,
e.ZERO = c(0),
e.ONE = c(1),
It.prototype.convert = Pt,
It.prototype.revert = Pt,
It.prototype.mulTo = Mt,
It.prototype.sqrTo = Lt,
jt.prototype.convert = kt,
jt.prototype.revert = Ft,
jt.prototype.reduce = _t,
jt.prototype.mulTo = Zt,
jt.prototype.sqrTo = zt;
var Ae = [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],
Ue = (1 = 256 || Ne >= Je) return void(window.removeEventListener ? window.removeEventListener("mousemove", Me, !1) : window.detachEvent && window.detachEvent("onmousemove", Me));
try {
var e = t.x + t.y;
Ve[Ne++] = 255 & e,
this.count += 1
} catch(i) {}
};
window.addEventListener ? window.addEventListener("mousemove", Me, !1) : window.attachEvent && window.attachEvent("onmousemove", Me)
}
oe.prototype.nextBytes = ne,
ue.prototype.doPublic = fe,
ue.prototype.setPublic = ce,
ue.prototype.encrypt = pe,
ue.prototype.doPrivate = ye,
ue.prototype.setPrivate = de,
ue.prototype.setPrivateEx = ge,
ue.prototype.generate = me,
ue.prototype.decrypt = ve,
// Copyright (c) 2011 Kevin M Burns Jr.
// All Rights Reserved.
// See "LICENSE" for details.
//
// Extension to jsbn which adds facilities for asynchronous RSA key generation
// Primarily created to avoid execution timeout on mobile devices
//
// http://www-cs-students.stanford.edu/~tjw/jsbn/
//
// ---
function() {
var t = function(t, r, s) {
var n = new oe,
o = t >> 1;
this.e = parseInt(r, 16);
var h = new e(r, 16),
a = this,
u = function() {
var r = function() {
if (a.p.compareTo(a.q) o) return void e(i);
o > n && (o = n),
o > 0 && (i.rShiftTo(o, i), r.rShiftTo(o, r));
var h = function() { (n = i.getLowestSetBit()) > 0 && i.rShiftTo(n, i),
(n = r.getLowestSetBit()) > 0 && r.rShiftTo(n, r),
i.compareTo(r) >= 0 ? (i.subTo(r, i), i.rShiftTo(1, i)) : (r.subTo(i, r), r.rShiftTo(1, r)),
i.signum() > 0 ? setTimeout(h, 0) : (o > 0 && r.lShiftTo(o, r), setTimeout(function() {
e(r)
},
0))
};
setTimeout(h, 10)
};
e.prototype.gcda = r;
var s = function(t, i, r, s) {
if ("number" == typeof i) if (2 > t) this.fromInt(1);
else {
this.fromNumber(t, r),
this.testBit(t - 1) || this.bitwiseTo(e.ONE.shiftLeft(t - 1), ht, this),
this.isEven() && this.dAddOffset(1, 0);
var n = this,
o = function() {
n.dAddOffset(2, 0),
n.bitLength() > t && n.subTo(e.ONE.shiftLeft(t - 1), n),
n.isProbablePrime(i) ? setTimeout(function() {
s()
},
0) : setTimeout(o, 0)
};
setTimeout(o, 0)
} else {
var h = new Array,
a = 7 & t;
h.length = (t >> 3) + 1,
i.nextBytes(h),
a > 0 ? h[0] &= (1 MIT License
*/
"undefined" != typeof KJUR && KJUR || (KJUR = {}),
"undefined" != typeof KJUR.asn1 && KJUR.asn1 || (KJUR.asn1 = {}),
KJUR.asn1.ASN1Util = new
function() {
this.integerToByteHex = function(t) {
var e = t.toString(16);
return e.length % 2 == 1 && (e = "0" + e),
e
},
this.bigIntToMinTwosComplementsHex = function(t) {
var i = t.toString(16);
if ("-" != i.substr(0, 1)) i.length % 2 == 1 ? i = "0" + i: i.match(/^[0-7]/) || (i = "00" + i);
else {
var r = i.substr(1),
s = r.length;
s % 2 == 1 ? s += 1 : i.match(/^[0-7]/) || (s += 2);
for (var n = "",
o = 0; s > o; o++) n += "f";
var h = new e(n, 16),
a = h.xor(t).add(e.ONE);
i = a.toString(16).replace(/^-/, "")
}
return i
},
this.getPEMStringFromHex = function(t, e) {
var i = CryptoJS.enc.Hex.parse(t),
r = CryptoJS.enc.Base64.stringify(i),
s = r.replace(/(.{64})/g, "$1\r\n");
return s = s.replace(/\r\n$/, ""),
"-----BEGIN " + e + "-----\r\n" + s + "\r\n-----END " + e + "-----\r\n"
}
},
KJUR.asn1.ASN1Object = function() {
var t = "";
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=" + t.length + ",v=" + this.hV;
var e = this.hV.length / 2,
i = e.toString(16);
if (i.length % 2 == 1 && (i = "0" + i), 128 > e) return i;
var r = i.length / 2;
if (r > 15) throw "ASN.1 length too long to represent by 8x: n = " + e.toString(16);
var s = 128 + r;
return s.toString(16) + i
},
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 ""
}
},
KJUR.asn1.DERAbstractString = function(t) {
KJUR.asn1.DERAbstractString.superclass.constructor.call(this);
this.getString = function() {
return this.s
},
this.setString = function(t) {
this.hTLV = null,
this.isModified = !0,
this.s = t,
this.hV = stohex(this.s)
},
this.setStringHex = function(t) {
this.hTLV = null,
this.isModified = !0,
this.s = null,
this.hV = t
},
this.getFreshValueHex = function() {
return this.hV
},
"undefined" != typeof t && ("undefined" != typeof t.str ? this.setString(t.str) : "undefined" != typeof t.hex && this.setStringHex(t.hex))
},
Ce.extend(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object),
KJUR.asn1.DERAbstractTime = function(t) {
KJUR.asn1.DERAbstractTime.superclass.constructor.call(this);
this.localDateToUTC = function(t) {
utc = t.getTime() + 6e4 * t.getTimezoneOffset();
var e = new Date(utc);
return e
},
this.formatDate = function(t, e) {
var i = this.zeroPadding,
r = this.localDateToUTC(t),
s = String(r.getFullYear());
"utc" == e && (s = s.substr(2, 2));
var n = i(String(r.getMonth() + 1), 2),
o = i(String(r.getDate()), 2),
h = i(String(r.getHours()), 2),
a = i(String(r.getMinutes()), 2),
u = i(String(r.getSeconds()), 2);
return s + n + o + h + a + u + "Z"
},
this.zeroPadding = function(t, e) {
return t.length >= e ? t: new Array(e - t.length + 1).join("0") + t
},
this.getString = function() {
return this.s
},
this.setString = function(t) {
this.hTLV = null,
this.isModified = !0,
this.s = t,
this.hV = stohex(this.s)
},
this.setByDateValue = function(t, e, i, r, s, n) {
var o = new Date(Date.UTC(t, e - 1, i, r, s, n, 0));
this.setByDate(o)
},
this.getFreshValueHex = function() {
return this.hV
}
},
Ce.extend(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object),
KJUR.asn1.DERAbstractStructured = function(t) {
KJUR.asn1.DERAbstractString.superclass.constructor.call(this);
this.setByASN1ObjectArray = function(t) {
this.hTLV = null,
this.isModified = !0,
this.asn1Array = t
},
this.appendASN1Object = function(t) {
this.hTLV = null,
this.isModified = !0,
this.asn1Array.push(t)
},
this.asn1Array = new Array,
"undefined" != typeof t && "undefined" != typeof t.array && (this.asn1Array = t.array)
},
Ce.extend(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object),
KJUR.asn1.DERBoolean = function() {
KJUR.asn1.DERBoolean.superclass.constructor.call(this),
this.hT = "01",
this.hTLV = "0101ff"
},
Ce.extend(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object),
KJUR.asn1.DERInteger = function(t) {
KJUR.asn1.DERInteger.superclass.constructor.call(this),
this.hT = "02",
this.setByBigInteger = function(t) {
this.hTLV = null,
this.isModified = !0,
this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)
},
this.setByInteger = function(t) {
var i = new e(String(t), 10);
this.setByBigInteger(i)
},
this.setValueHex = function(t) {
this.hV = t
},
this.getFreshValueHex = function() {
return this.hV
},
"undefined" != typeof t && ("undefined" != typeof t.bigint ? this.setByBigInteger(t.bigint) : "undefined" != typeof t["int"] ? this.setByInteger(t["int"]) : "undefined" != typeof t.hex && this.setValueHex(t.hex))
},
Ce.extend(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object),
KJUR.asn1.DERBitString = function(t) {
KJUR.asn1.DERBitString.superclass.constructor.call(this),
this.hT = "03",
this.setHexValueIncludingUnusedBits = function(t) {
this.hTLV = null,
this.isModified = !0,
this.hV = t
},
this.setUnusedBitsAndHexValue = function(t, e) {
if (0 > t || t > 7) throw "unused bits shall be from 0 to 7: u = " + t;
var i = "0" + t;
this.hTLV = null,
this.isModified = !0,
this.hV = i + e
},
this.setByBinaryString = function(t) {
t = t.replace(/0+$/, "");
var e = 8 - t.length % 8;
8 == e && (e = 0);
for (var i = 0; e >= i; i++) t += "0";
for (var r = "",
i = 0; i i; i++) e = !1;
return e
},
this.getFreshValueHex = function() {
return this.hV
},
"undefined" != typeof t && ("undefined" != typeof t.hex ? this.setHexValueIncludingUnusedBits(t.hex) : "undefined" != typeof t.bin ? this.setByBinaryString(t.bin) : "undefined" != typeof t.array && this.setByBooleanArray(t.array))
},
Ce.extend(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object),
KJUR.asn1.DEROctetString = function(t) {
KJUR.asn1.DEROctetString.superclass.constructor.call(this, t),
this.hT = "04"
},
Ce.extend(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString),
KJUR.asn1.DERNull = function() {
KJUR.asn1.DERNull.superclass.constructor.call(this),
this.hT = "05",
this.hTLV = "0500"
},
Ce.extend(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object),
KJUR.asn1.DERObjectIdentifier = function(t) {
var i = function(t) {
var e = t.toString(16);
return 1 == e.length && (e = "0" + e),
e
},
r = function(t) {
var r = "",
s = new e(t, 10),
n = s.toString(2),
o = 7 - n.length % 7;
7 == o && (o = 0);
for (var h = "",
a = 0; o > a; a++) h += "0";
n = h + n;
for (var a = 0; a
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
function(t) {
"use strict";
var e, i = {};
i.decode = function(i) {
var r;
if (e === t) {
var s = "0123456789ABCDEF",
n = " \f\n\r \u2028\u2029";
for (e = [], r = 0; 16 > r; ++r) e[s.charAt(r)] = r;
for (s = s.toLowerCase(), r = 10; 16 > r; ++r) e[s.charAt(r)] = r;
for (r = 0; r = 2 ? (o[o.length] = h, h = 0, a = 0) : h
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
function(t) {
"use strict";
var e, i = {};
i.decode = function(i) {
var r;
if (e === t) {
var s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
n = "= \f\n\r \u2028\u2029";
for (e = [], r = 0; 64 > r; ++r) e[s.charAt(r)] = r;
for (r = 0; r = 4 ? (o[o.length] = h >> 16, o[o.length] = h >> 8 & 255, o[o.length] = 255 & h, h = 0, a = 0) : h > 10;
break;
case 3:
o[o.length] = h >> 16,
o[o.length] = h >> 8 & 255
}
return o
},
i.re = /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,
i.unarmor = function(t) {
var e = i.re.exec(t);
if (e) if (e[1]) t = e[1];
else {
if (!e[2]) throw "RegExp out of sync";
t = e[2]
}
return i.decode(t)
},
window.Base64 = i
} (),
// Copyright (c) 2008-2013 Lapo Luchini
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
function(t) {
"use strict";
function e(t, i) {
t instanceof e ? (this.enc = t.enc, this.pos = t.pos) : (this.enc = t, this.pos = i)
}
function i(t, e, i, r, s) {
this.stream = t,
this.header = e,
this.length = i,
this.tag = r,
this.sub = s
}
var r = 100,
s = "…",
n = {
tag: function(t, e) {
var i = document.createElement(t);
return i.className = e,
i
},
text: function(t) {
return document.createTextNode(t)
}
};
e.prototype.get = function(e) {
if (e === t && (e = this.pos++), e >= this.enc.length) throw "Requesting byte offset " + e + " on a stream of length " + this.enc.length;
return this.enc[e]
},
e.prototype.hexDigits = "0123456789ABCDEF",
e.prototype.hexByte = function(t) {
return this.hexDigits.charAt(t >> 4 & 15) + this.hexDigits.charAt(15 & t)
},
e.prototype.hexDump = function(t, e, i) {
for (var r = "",
s = t; e > s; ++s) if (r += this.hexByte(this.get(s)), i !== !0) switch (15 & s) {
case 7:
r += " ";
break;
case 15:
r += "\n";
break;
default:
r += " "
}
return r
},
e.prototype.parseStringISO = function(t, e) {
for (var i = "",
r = t; e > r; ++r) i += String.fromCharCode(this.get(r));
return i
},
e.prototype.parseStringUTF = function(t, e) {
for (var i = "",
r = t; e > r;) {
var s = this.get(r++);
i += 128 > s ? String.fromCharCode(s) : s > 191 && 224 > s ? String.fromCharCode((31 & s) r; r += 2) {
var s = this.get(r),
n = this.get(r + 1);
i += String.fromCharCode((s 4) {
i r;) r n; ++n) s = s = r) {
var n = i;
s += " ";
for (var o = e - 1; o > t; --o) {
for (var h = this.get(o), a = n; 8 > a; ++a) s += h >> a & 1 ? "1": "0";
n = 0
}
}
return s
},
e.prototype.parseOctetString = function(t, e) {
var i = e - t,
n = "(" + i + " byte) ";
i > r && (e = t + r);
for (var o = t; e > o; ++o) n += this.hexByte(this.get(o));
return i > r && (n += s),
n
},
e.prototype.parseOID = function(t, e) {
for (var i = "",
r = 0,
s = 0,
n = t; e > n; ++n) {
var o = this.get(n);
if (r = r r ? 40 > r ? 0 : 1 : 2;
i = h + "." + (r - 40 * h)
} else i += "." + (s >= 31 ? "bigint": r);
r = s = 0
}
}
return i
},
i.prototype.typeName = function() {
if (this.tag === t) return "unknown";
var e = this.tag >> 6,
i = (this.tag >> 5 & 1, 31 & this.tag);
switch (e) {
case 0:
switch (i) {
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_" + i.toString(16)
}
case 1:
return "Application_" + i.toString(16);
case 2:
return "[" + i + "]";
case 3:
return "Private_" + i.toString(16)
}
},
i.prototype.reSeemsASCII = /^[ -~]+$/,
i.prototype.content = function() {
if (this.tag === t) return null;
var e = this.tag >> 6,
i = 31 & this.tag,
n = this.posContent(),
o = Math.abs(this.length);
if (0 !== e) {
if (null !== this.sub) return "(" + this.sub.length + " elem)";
var h = this.stream.parseStringISO(n, n + Math.min(o, r));
return this.reSeemsASCII.test(h) ? h.substring(0, 2 * r) + (h.length > 2 * r ? s: "") : this.stream.parseOctetString(n, n + o)
}
switch (i) {
case 1:
return 0 === this.stream.get(n) ? "false": "true";
case 2:
return this.stream.parseInteger(n, n + o);
case 3:
return this.sub ? "(" + this.sub.length + " elem)": this.stream.parseBitString(n, n + o);
case 4:
return this.sub ? "(" + this.sub.length + " elem)": this.stream.parseOctetString(n, n + o);
case 6:
return this.stream.parseOID(n, n + o);
case 16:
case 17:
return "(" + this.sub.length + " elem)";
case 12:
return this.stream.parseStringUTF(n, n + o);
case 18:
case 19:
case 20:
case 21:
case 22:
case 26:
return this.stream.parseStringISO(n, n + o);
case 30:
return this.stream.parseStringBMP(n, n + o);
case 23:
case 24:
return this.stream.parseTime(n, n + o)
}
return null
},
i.prototype.toString = function() {
return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (null === this.sub ? "null": this.sub.length) + "]"
},
i.prototype.print = function(e) {
if (e === t && (e = ""), document.writeln(e + this), null !== this.sub) {
e += " ";
for (var i = 0,
r = this.sub.length; r > i; ++i) this.sub.print(e)
}
},
i.prototype.toPrettyString = function(e) {
e === t && (e = "");
var i = e + this.typeName() + " @" + this.stream.pos;
if (this.length >= 0 && (i += "+"), i += this.length, 32 & this.tag ? i += " (constructed)": 3 != this.tag && 4 != this.tag || null === this.sub || (i += " (encapsulates)"), i += "\n", null !== this.sub) {
e += " ";
for (var r = 0,
s = this.sub.length; s > r; ++r) i += this.sub[r].toPrettyString(e)
}
return i
},
i.prototype.toDOM = function() {
var t = n.tag("div", "node");
t.asn1 = this;
var e = n.tag("div", "head"),
i = this.typeName().replace(/_/g, " ");
e.innerHTML = i;
var r = this.content();
if (null !== r) {
r = String(r).replace(/= 0 ? this.length: -this.length + " (undefined)", 32 & this.tag ? i += "
(constructed)": 3 != this.tag && 4 != this.tag || null === this.sub || (i += "
(encapsulates)"), null !== r && (i += "
Value:
" + r + "", "object" == typeof oids && 6 == this.tag)) {
var h = oids[r];
h && (h.d && (i += "
" + h.d), h.c && (i += "
" + h.c), h.w && (i += "
(warning!)"))
}
o.innerHTML = i,
t.appendChild(o);
var a = n.tag("div", "sub");
if (null !== this.sub) for (var u = 0,
c = this.sub.length; c > u; ++u) a.appendChild(this.sub.toDOM());
return t.appendChild(a),
e.onclick = function() {
t.className = "node collapsed" == t.className ? "node": "node collapsed"
},
t
},
i.prototype.posStart = function() {
return this.stream.pos
},
i.prototype.posContent = function() {
return this.stream.pos + this.header
},
i.prototype.posEnd = function() {
return this.stream.pos + this.header + Math.abs(this.length)
},
i.prototype.fakeHover = function(t) {
this.node.className += " hover",
t && (this.head.className += " hover")
},
i.prototype.fakeOut = function(t) {
var e = / ?hover/;
this.node.className = this.node.className.replace(e, ""),
t && (this.head.className = this.head.className.replace(e, ""))
},
i.prototype.toHexDOM_sub = function(t, e, i, r, s) {
if (! (r >= s)) {
var o = n.tag("span", e);
o.appendChild(n.text(i.hexDump(r, s))),
t.appendChild(o)
}
},
i.prototype.toHexDOM = function(e) {
var i = n.tag("span", "hex");
if (e === t && (e = i), this.head.hexNode = i, this.head.onmouseover = function() {
this.hexNode.className = "hexCurrent"
},
this.head.onmouseout = function() {
this.hexNode.className = "hex"
},
i.asn1 = this, i.onmouseover = function() {
var t = !e.selected;
t && (e.selected = this.asn1, this.className = "hexCurrent"),
this.asn1.fakeHover(t)
},
i.onmouseout = function() {
var t = e.selected == this.asn1;
this.asn1.fakeOut(t),
t && (e.selected = null, this.className = "hex")
},
this.toHexDOM_sub(i, "tag", this.stream, this.posStart(), this.posStart() + 1), this.toHexDOM_sub(i, this.length >= 0 ? "dlen": "ulen", this.stream, this.posStart() + 1, this.posContent()), null === this.sub) i.appendChild(n.text(this.stream.hexDump(this.posContent(), this.posEnd())));
else if (this.sub.length > 0) {
var r = this.sub[0],
s = this.sub[this.sub.length - 1];
this.toHexDOM_sub(i, "intro", this.stream, this.posContent(), r.posStart());
for (var o = 0,
h = this.sub.length; h > o; ++o) i.appendChild(this.sub[o].toHexDOM(e));
this.toHexDOM_sub(i, "outro", this.stream, s.posEnd(), this.posEnd())
}
return i
},
i.prototype.toHexString = function(t) {
return this.stream.hexDump(this.posStart(), this.posEnd(), !0)
},
i.decodeLength = function(t) {
var e = t.get(),
i = 127 & e;
if (i == e) return i;
if (i > 3) throw "Length over 24 bits not supported at position " + (t.pos - 1);
if (0 === i) return - 1;
e = 0;
for (var r = 0; i > r; ++r) e = e t || t > 4) return ! 1;
var n = new e(s);
3 == t && n.get();
var o = n.get();
if (o >> 6 & 1) return ! 1;
try {
var h = i.decodeLength(n);
return n.pos - s.pos + h == r
} catch(a) {
return ! 1
}
},
i.decode = function(t) {
t instanceof e || (t = new e(t, 0));
var r = new e(t),
s = t.get(),
n = i.decodeLength(t),
o = t.pos - r.pos,
h = null;
if (i.hasContent(s, n, t)) {
var a = t.pos;
if (3 == s && t.get(), h = [], n >= 0) {
for (var u = a + n; t.pos r; ++r) {
var n = new e(t[r].value, 0),
o = i.decodeLength(n);
o != t[r].expected && document.write("In test[" + r + "] expected " + t[r].expected + " got " + o + "\n")
}
},
window.ASN1 = i
} (),
ASN1.prototype.getHexStringValue = function() {
var t = this.toHexString(),
e = 2 * this.header,
i = 2 * this.length;
return t.substr(e, i)
},
ue.prototype.parseKey = function(t) {
try {
var e = 0,
i = 0,
r = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/,
s = r.test(t) ? Hex.decode(t) : Base64.unarmor(t),
n = ASN1.decode(s);
if (3 === n.sub.length && (n = n.sub[2].sub[0]), 9 === n.sub.length) {
e = n.sub[1].getHexStringValue(),
this.n = he(e, 16),
i = n.sub[2].getHexStringValue(),
this.e = parseInt(i, 16);
var o = n.sub[3].getHexStringValue();
this.d = he(o, 16);
var h = n.sub[4].getHexStringValue();
this.p = he(h, 16);
var a = n.sub[5].getHexStringValue();
this.q = he(a, 16);
var u = n.sub[6].getHexStringValue();
this.dmp1 = he(u, 16);
var c = n.sub[7].getHexStringValue();
this.dmq1 = he(c, 16);
var f = n.sub[8].getHexStringValue();
this.coeff = he(f, 16)
} else {
if (2 !== n.sub.length) return ! 1;
var p = n.sub[1],
l = p.sub[0];
e = l.sub[0].getHexStringValue(),
this.n = he(e, 16),
i = l.sub[1].getHexStringValue(),
this.e = parseInt(i, 16)
}
return ! 0
} catch(d) {
return ! 1
}
},
ue.prototype.getPrivateBaseKey = function() {
var t = {
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
})]
},
e = new KJUR.asn1.DERSequence(t);
return e.getEncodedHex()
},
ue.prototype.getPrivateBaseKeyB64 = function() {
return be(this.getPrivateBaseKey())
},
ue.prototype.getPublicBaseKey = function() {
var t = {
array: [new KJUR.asn1.DERObjectIdentifier({
oid: "1.2.840.113549.1.1.1"
}), new KJUR.asn1.DERNull]
},
e = new KJUR.asn1.DERSequence(t);
t = {
array: [new KJUR.asn1.DERInteger({
bigint: this.n
}), new KJUR.asn1.DERInteger({
"int": this.e
})]
};
var i = new KJUR.asn1.DERSequence(t);
t = {
hex: "00" + i.getEncodedHex()
};
var r = new KJUR.asn1.DERBitString(t);
t = {
array: [e, r]
};
var s = new KJUR.asn1.DERSequence(t);
return s.getEncodedHex()
},
ue.prototype.getPublicBaseKeyB64 = function() {
return be(this.getPublicBaseKey())
},
ue.prototype.wordwrap = function(t, e) {
if (e = e || 64, !t) return t;
var i = "(.{1," + e + "})( +|$\n?)|(.{1," + e + "})";
return t.match(RegExp(i, "g")).join("\n")
},
ue.prototype.getPrivateKey = function() {
var t = "-----BEGIN RSA PRIVATE KEY-----\n";
return t += this.wordwrap(this.getPrivateBaseKeyB64()) + "\n",
t += "-----END RSA PRIVATE KEY-----"
},
ue.prototype.getPublicKey = function() {
var t = "-----BEGIN PUBLIC KEY-----\n";
return t += this.wordwrap(this.getPublicBaseKeyB64()) + "\n",
t += "-----END PUBLIC KEY-----"
},
ue.prototype.hasPublicKeyProperty = function(t) {
return t = t || {},
t.hasOwnProperty("n") && t.hasOwnProperty("e")
},
ue.prototype.hasPrivateKeyProperty = function(t) {
return t = t || {},
t.hasOwnProperty("n") && t.hasOwnProperty("e") && t.hasOwnProperty("d") && t.hasOwnProperty("p") && t.hasOwnProperty("q") && t.hasOwnProperty("dmp1") && t.hasOwnProperty("dmq1") && t.hasOwnProperty("coeff")
},
ue.prototype.parsePropertiesFrom = function(t) {
this.n = t.n,
this.e = t.e,
t.hasOwnProperty("d") && (this.d = t.d, this.p = t.p, this.q = t.q, this.dmp1 = t.dmp1, this.dmq1 = t.dmq1, this.coeff = t.coeff)
};
var _e = function(t) {
ue.call(this),
t && ("string" == typeof t ? this.parseKey(t) : (this.hasPrivateKeyProperty(t) || this.hasPublicKeyProperty(t)) && this.parsePropertiesFrom(t))
};
_e.prototype = new ue,
_e.prototype.constructor = _e;
var ze = function(t) {
t = t || {},
this.default_key_size = parseInt(t.default_key_size) || 1024,
this.default_public_exponent = t.default_public_exponent || "010001",
this.log = t.log || !1,
this.key = null
};
ze.prototype.setKey = function(t) {
this.log && this.key && console.warn("A key was already set, overriding existing."),
this.key = new _e(t)
},
ze.prototype.setPrivateKey = function(t) {
this.setKey(t)
},
ze.prototype.setPublicKey = function(t) {
this.setKey(t)
},
ze.prototype.decrypt = function(t) {
try {
return this.getKey().decrypt(Te(t))
} catch(e) {
return ! 1
}
},
ze.prototype.encrypt = function(t) {
try {
return be(this.getKey().encrypt(t))
} catch(e) {
return ! 1
}
},
ze.prototype.getKey = function(t) {
if (!this.key) {
if (this.key = new _e, t && "[object Function]" === {}.toString.call(t)) return void this.key.generateAsync(this.default_key_size, this.default_public_exponent, t);
this.key.generate(this.default_key_size, this.default_public_exponent)
}
return this.key
},
ze.prototype.getPrivateKey = function() {
return this.getKey().getPrivateKey()
},
ze.prototype.getPrivateKeyB64 = function() {
return this.getKey().getPrivateBaseKeyB64()
},
ze.prototype.getPublicKey = function() {
return this.getKey().getPublicKey()
},
ze.prototype.getPublicKeyB64 = function() {
return this.getKey().getPublicBaseKeyB64()
},
ze.version = "2.3.1",
JSEncrypt = ze
});
function my_encrypt(public_key,password) {
var encrypt = new JSEncrypt();
encrypt.setPublicKey(public_key);
var my_eccrypt_password = encrypt.encrypt(password);
return my_eccrypt_password
}"""