7 lines
58 KiB
JavaScript
7 lines
58 KiB
JavaScript
// 来自 https://github.com/Yuheng0101/X/blob/main/Utils/
|
|
// prettier-ignore
|
|
function loadJSEncrypt(){var RSA={};return function(exports){function BigInteger(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 nbi(){return new BigInteger(null)}function am1(t,e,i,n,r,s){for(;0<=--s;){var o=e*this[t++]+i[n]+r;r=Math.floor(o/67108864),i[n++]=67108863&o}return r}function am2(t,e,i,n,r,s){for(var o=32767&e,h=e>>15;0<=--s;){var a=32767&this[t],u=this[t++]>>15,p=h*a+u*o;r=((a=o*a+((32767&p)<<15)+i[n]+(1073741823&r))>>>30)+(p>>>15)+h*u+(r>>>30),i[n++]=1073741823&a}return r}function am3(t,e,i,n,r,s){for(var o=16383&e,h=e>>14;0<=--s;){var a=16383&this[t],u=this[t++]>>14,p=h*a+u*o;r=((a=o*a+((16383&p)<<14)+i[n]+r)>>28)+(p>>14)+h*u,i[n++]=268435455&a}return r}function int2char(t){return BI_RM.charAt(t)}function intAt(t,e){return e=BI_RC[t.charCodeAt(e)],null==e?-1:e}function bnpCopyTo(t){for(var e=this.t-1;0<=e;--e)t[e]=this[e];t.t=this.t,t.s=this.s}function bnpFromInt(t){this.t=1,this.s=t<0?-1:0,0<t?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0}function nbv(t){var e=nbi();return e.fromInt(t),e}function bnpFromString(t,e){var i;if(16==e)i=4;else if(8==e)i=3;else if(256==e)i=8;else if(2==e)i=1;else if(32==e)i=5;else{if(4!=e)return void this.fromRadix(t,e);i=2}this.t=0,this.s=0;for(var n=t.length,r=!1,s=0;0<=--n;){var o=8==i?255&t[n]:intAt(t,n);o<0?"-"==t.charAt(n)&&(r=!0):(r=!1,0==s?this[this.t++]=o:s+i>this.DB?(this[this.t-1]|=(o&(1<<this.DB-s)-1)<<s,this[this.t++]=o>>this.DB-s):this[this.t-1]|=o<<s,(s+=i)>=this.DB&&(s-=this.DB))}8==i&&0!=(128&t[0])&&(this.s=-1,0<s&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),r&&BigInteger.ZERO.subTo(this,this)}function bnpClamp(){for(var t=this.s&this.DM;0<this.t&&this[this.t-1]==t;)--this.t}function bnToString(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var i,n=(1<<e)-1,r=!1,s="",o=this.t,h=this.DB-o*this.DB%e;if(0<o--)for(h<this.DB&&0<(i=this[o]>>h)&&(r=!0,s=int2char(i));0<=o;)h<e?(i=(this[o]&(1<<h)-1)<<e-h,i|=this[--o]>>(h+=this.DB-e)):(i=this[o]>>(h-=e)&n,h<=0&&(h+=this.DB,--o)),0<i&&(r=!0),r&&(s+=int2char(i));return r?s:"0"}function bnNegate(){var t=nbi();return BigInteger.ZERO.subTo(this,t),t}function bnAbs(){return this.s<0?this.negate():this}function bnCompareTo(t){var e=this.s-t.s;if(0!=e)return e;var i=this.t;if(0!=(e=i-t.t))return this.s<0?-e:e;for(;0<=--i;)if(0!=(e=this[i]-t[i]))return e;return 0}function nbits(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 bnBitLength(){return this.t<=0?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)}function bnpDLShiftTo(t,e){for(var i=this.t-1;0<=i;--i)e[i+t]=this[i];for(i=t-1;0<=i;--i)e[i]=0;e.t=this.t+t,e.s=this.s}function bnpDRShiftTo(t,e){for(var i=t;i<this.t;++i)e[i-t]=this[i];e.t=Math.max(this.t-t,0),e.s=this.s}function bnpLShiftTo(t,e){for(var i=t%this.DB,n=this.DB-i,r=(1<<n)-1,s=Math.floor(t/this.DB),o=this.s<<i&this.DM,h=this.t-1;0<=h;--h)e[h+s+1]=this[h]>>n|o,o=(this[h]&r)<<i;for(h=s-1;0<=h;--h)e[h]=0;e[s]=o,e.t=this.t+s+1,e.s=this.s,e.clamp()}function bnpRShiftTo(t,e){e.s=this.s;var i=Math.floor(t/this.DB);if(i>=this.t)e.t=0;else{var n=t%this.DB,r=this.DB-n,s=(1<<n)-1;e[0]=this[i]>>n;for(var o=i+1;o<this.t;++o)e[o-i-1]|=(this[o]&s)<<r,e[o-i]=this[o]>>n;0<n&&(e[this.t-i-1]|=(this.s&s)<<r),e.t=this.t-i,e.clamp()}}function bnpSubTo(t,e){for(var i=0,n=0,r=Math.min(t.t,this.t);i<r;)n+=this[i]-t[i],e[i++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;i<this.t;)n+=this[i],e[i++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;i<t.t;)n-=t[i],e[i++]=n&this.DM,n>>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[i++]=this.DV+n:0<n&&(e[i++]=n),e.t=i,e.clamp()}function bnpMultiplyTo(t,e){var i=this.abs(),n=t.abs(),r=i.t;for(e.t=r+n.t;0<=--r;)e[r]=0;for(r=0;r<n.t;++r)e[r+i.t]=i.am(0,n[r],e,r,0,i.t);e.s=0,e.clamp(),this.s!=t.s&&BigInteger.ZERO.subTo(e,e)}function bnpSquareTo(t){for(var e=this.abs(),i=t.t=2*e.t;0<=--i;)t[i]=0;for(i=0;i<e.t-1;++i){var n=e.am(i,e[i],t,2*i,0,1);(t[i+e.t]+=e.am(i+1,2*e[i],t,2*i+1,n,e.t-i-1))>=e.DV&&(t[i+e.t]-=e.DV,t[i+e.t+1]=1)}0<t.t&&(t[t.t-1]+=e.am(i,e[i],t,2*i,0,1)),t.s=0,t.clamp()}function bnpDivRemTo(t,e,i){var n=t.abs();if(!(n.t<=0)){var r=this.abs();if(r.t<n.t)return null!=e&&e.fromInt(0),void(null!=i&&this.copyTo(i));null==i&&(i=nbi());var s=nbi(),o=this.s,h=t.s;t=this.DB-nbits(n[n.t-1]);0<t?(n.lShiftTo(t,s),r.lShiftTo(t,i)):(n.copyTo(s),r.copyTo(i));var a=s.t,u=s[a-1];if(0!=u){r=u*(1<<this.F1)+(1<a?s[a-2]>>this.F2:0);var p=this.FV/r,c=(1<<this.F1)/r,g=1<<this.F2,l=i.t,f=l-a,d=null==e?nbi():e;for(s.dlShiftTo(f,d),0<=i.compareTo(d)&&(i[i.t++]=1,i.subTo(d,i)),BigInteger.ONE.dlShiftTo(a,d),d.subTo(s,s);s.t<a;)s[s.t++]=0;for(;0<=--f;){var b=i[--l]==u?this.DM:Math.floor(i[l]*p+(i[l-1]+g)*c);if((i[l]+=s.am(0,b,i,f,0,a))<b)for(s.dlShiftTo(f,d),i.subTo(d,i);i[l]<--b;)i.subTo(d,i)}null!=e&&(i.drShiftTo(a,e),o!=h&&BigInteger.ZERO.subTo(e,e)),i.t=a,i.clamp(),0<t&&i.rShiftTo(t,i),o<0&&BigInteger.ZERO.subTo(i,i)}}}function bnMod(t){var e=nbi();return this.abs().divRemTo(t,null,e),this.s<0&&0<e.compareTo(BigInteger.ZERO)&&t.subTo(e,e),e}function Classic(t){this.m=t}function cConvert(t){return t.s<0||0<=t.compareTo(this.m)?t.mod(this.m):t}function cRevert(t){return t}function cReduce(t){t.divRemTo(this.m,null,t)}function cMulTo(t,e,i){t.multiplyTo(e,i),this.reduce(i)}function cSqrTo(t,e){t.squareTo(e),this.reduce(e)}function bnpInvDigit(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return 0<(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)?this.DV-e:-e}function Montgomery(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function montConvert(t){var e=nbi();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&0<e.compareTo(BigInteger.ZERO)&&this.m.subTo(e,e),e}function montRevert(t){var e=nbi();return t.copyTo(e),this.reduce(e),e}function montReduce(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var i=32767&t[e],n=i*this.mpl+((i*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[i=e+this.m.t]+=this.m.am(0,n,t,e,0,this.m.t);t[i]>=t.DV;)t[i]-=t.DV,t[++i]++}t.clamp(),t.drShiftTo(this.m.t,t),0<=t.compareTo(this.m)&&t.subTo(this.m,t)}function montSqrTo(t,e){t.squareTo(e),this.reduce(e)}function montMulTo(t,e,i){t.multiplyTo(e,i),this.reduce(i)}function bnpIsEven(){return 0==(0<this.t?1&this[0]:this.s)}function bnpExp(t,e){if(4294967295<t||t<1)return BigInteger.ONE;var i,n=nbi(),r=nbi(),s=e.convert(this),o=nbits(t)-1;for(s.copyTo(n);0<=--o;)e.sqrTo(n,r),0<(t&1<<o)?e.mulTo(r,s,n):(i=n,n=r,r=i);return e.revert(n)}function bnModPowInt(t,e){return e=new(t<256||e.isEven()?Classic:Montgomery)(e),this.exp(t,e)}function bnClone(){var t=nbi();return this.copyTo(t),t}function bnIntValue(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function bnByteValue(){return 0==this.t?this.s:this[0]<<24>>24}function bnShortValue(){return 0==this.t?this.s:this[0]<<16>>16}function bnpChunkSize(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function bnSigNum(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function bnpToRadix(t){if(null==t&&(t=10),0==this.signum()||t<2||36<t)return"0";var e=this.chunkSize(t),i=Math.pow(t,e),n=nbv(i),r=nbi(),s=nbi(),o="";for(this.divRemTo(n,r,s);0<r.signum();)o=(i+s.intValue()).toString(t).substr(1)+o,r.divRemTo(n,r,s);return s.intValue().toString(t)+o}function bnpFromRadix(t,e){this.fromInt(0),null==e&&(e=10);for(var i=this.chunkSize(e),n=Math.pow(e,i),r=!1,s=0,o=0,h=0;h<t.length;++h){var a=intAt(t,h);a<0?"-"==t.charAt(h)&&0==this.signum()&&(r=!0):(o=e*o+a,++s>=i&&(this.dMultiply(n),this.dAddOffset(o,0),o=s=0))}0<s&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(o,0)),r&&BigInteger.ZERO.subTo(this,this)}function bnpFromNumber(t,e,i){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(BigInteger.ONE.shiftLeft(t-1),op_or,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(BigInteger.ONE.shiftLeft(t-1),this);else{var n=new Array;i=7&t;n.length=1+(t>>3),e.nextBytes(n),0<i?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}}function bnToByteArray(){var t=this.t,e=new Array;e[0]=this.s;var i,n=this.DB-t*this.DB%8,r=0;if(0<t--)for(n<this.DB&&(i=this[t]>>n)!=(this.s&this.DM)>>n&&(e[r++]=i|this.s<<this.DB-n);0<=t;)n<8?(i=(this[t]&(1<<n)-1)<<8-n,i|=this[--t]>>(n+=this.DB-8)):(i=this[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),0!=(128&i)&&(i|=-256),0==r&&(128&this.s)!=(128&i)&&++r,(0<r||i!=this.s)&&(e[r++]=i);return e}function bnEquals(t){return 0==this.compareTo(t)}function bnMin(t){return this.compareTo(t)<0?this:t}function bnMax(t){return 0<this.compareTo(t)?this:t}function bnpBitwiseTo(t,e,i){for(var n,r=Math.min(t.t,this.t),s=0;s<r;++s)i[s]=e(this[s],t[s]);if(t.t<this.t){for(n=t.s&this.DM,s=r;s<this.t;++s)i[s]=e(this[s],n);i.t=this.t}else{for(n=this.s&this.DM,s=r;s<t.t;++s)i[s]=e(n,t[s]);i.t=t.t}i.s=e(this.s,t.s),i.clamp()}function op_and(t,e){return t&e}function bnAnd(t){var e=nbi();return this.bitwiseTo(t,op_and,e),e}function op_or(t,e){return t|e}function bnOr(t){var e=nbi();return this.bitwiseTo(t,op_or,e),e}function op_xor(t,e){return t^e}function bnXor(t){var e=nbi();return this.bitwiseTo(t,op_xor,e),e}function op_andnot(t,e){return t&~e}function bnAndNot(t){var e=nbi();return this.bitwiseTo(t,op_andnot,e),e}function bnNot(){for(var t=nbi(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t}function bnShiftLeft(t){var e=nbi();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}function bnShiftRight(t){var e=nbi();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}function lbit(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 bnGetLowestSetBit(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+lbit(this[t]);return this.s<0?this.t*this.DB:-1}function cbit(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function bnBitCount(){for(var t=0,e=this.s&this.DM,i=0;i<this.t;++i)t+=cbit(this[i]^e);return t}function bnTestBit(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)}function bnpChangeBit(t,e){return t=BigInteger.ONE.shiftLeft(t),this.bitwiseTo(t,e,t),t}function bnSetBit(t){return this.changeBit(t,op_or)}function bnClearBit(t){return this.changeBit(t,op_andnot)}function bnFlipBit(t){return this.changeBit(t,op_xor)}function bnpAddTo(t,e){for(var i=0,n=0,r=Math.min(t.t,this.t);i<r;)n+=this[i]+t[i],e[i++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n+=t.s;i<this.t;)n+=this[i],e[i++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;i<t.t;)n+=t[i],e[i++]=n&this.DM,n>>=this.DB;n+=t.s}e.s=n<0?-1:0,0<n?e[i++]=n:n<-1&&(e[i++]=this.DV+n),e.t=i,e.clamp()}function bnAdd(t){var e=nbi();return this.addTo(t,e),e}function bnSubtract(t){var e=nbi();return this.subTo(t,e),e}function bnMultiply(t){var e=nbi();return this.multiplyTo(t,e),e}function bnSquare(){var t=nbi();return this.squareTo(t),t}function bnDivide(t){var e=nbi();return this.divRemTo(t,e,null),e}function bnRemainder(t){var e=nbi();return this.divRemTo(t,null,e),e}function bnDivideAndRemainder(t){var e=nbi(),i=nbi();return this.divRemTo(t,e,i),new Array(e,i)}function bnpDMultiply(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function bnpDAddOffset(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}function NullExp(){}function nNop(t){return t}function nMulTo(t,e,i){t.multiplyTo(e,i)}function nSqrTo(t,e){t.squareTo(e)}function bnPow(t){return this.exp(t,new NullExp)}function bnpMultiplyLowerTo(t,e,i){var n,r=Math.min(this.t+t.t,e);for(i.s=0,i.t=r;0<r;)i[--r]=0;for(n=i.t-this.t;r<n;++r)i[r+this.t]=this.am(0,t[r],i,r,0,this.t);for(n=Math.min(t.t,e);r<n;++r)this.am(0,t[r],i,r,0,e-r);i.clamp()}function bnpMultiplyUpperTo(t,e,i){--e;var n=i.t=this.t+t.t-e;for(i.s=0;0<=--n;)i[n]=0;for(n=Math.max(e-this.t,0);n<t.t;++n)i[this.t+n-e]=this.am(e-n,t[n],i,0,0,this.t+n-e);i.clamp(),i.drShiftTo(1,i)}function Barrett(t){this.r2=nbi(),this.q3=nbi(),BigInteger.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function barrettConvert(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=nbi();return t.copyTo(e),this.reduce(e),e}function barrettRevert(t){return t}function barrettReduce(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);0<=t.compareTo(this.m);)t.subTo(this.m,t)}function barrettSqrTo(t,e){t.squareTo(e),this.reduce(e)}function barrettMulTo(t,e,i){t.multiplyTo(e,i),this.reduce(i)}function bnModPow(t,e){var i,n,r=t.bitLength(),s=nbv(1);if(r<=0)return s;i=r<18?1:r<48?3:r<144?4:r<768?5:6,n=new(r<8?Classic:e.isEven()?Barrett:Montgomery)(e);var o=new Array,h=3,a=i-1,u=(1<<i)-1;if(o[1]=n.convert(this),1<i){var p=nbi();for(n.sqrTo(o[1],p);h<=u;)o[h]=nbi(),n.mulTo(p,o[h-2],o[h]),h+=2}var c,g,l=t.t-1,f=!0,d=nbi();for(r=nbits(t[l])-1;0<=l;){for(a<=r?c=t[l]>>r-a&u:(c=(t[l]&(1<<r+1)-1)<<a-r,0<l&&(c|=t[l-1]>>this.DB+r-a)),h=i;0==(1&c);)c>>=1,--h;if((r-=h)<0&&(r+=this.DB,--l),f)o[c].copyTo(s),f=!1;else{for(;1<h;)n.sqrTo(s,d),n.sqrTo(d,s),h-=2;0<h?n.sqrTo(s,d):(g=s,s=d,d=g),n.mulTo(d,o[c],s)}for(;0<=l&&0==(t[l]&1<<r);)n.sqrTo(s,d),g=s,s=d,d=g,--r<0&&(r=this.DB-1,--l)}return n.revert(s)}function bnGCD(t){var e=this.s<0?this.negate():this.clone(),i=t.s<0?t.negate():t.clone();e.compareTo(i)<0&&(r=e,e=i,i=r);var n=e.getLowestSetBit(),r=i.getLowestSetBit();if(r<0)return e;for(n<r&&(r=n),0<r&&(e.rShiftTo(r,e),i.rShiftTo(r,i));0<e.signum();)0<(n=e.getLowestSetBit())&&e.rShiftTo(n,e),0<(n=i.getLowestSetBit())&&i.rShiftTo(n,i),0<=e.compareTo(i)?(e.subTo(i,e),e.rShiftTo(1,e)):(i.subTo(e,i),i.rShiftTo(1,i));return 0<r&&i.lShiftTo(r,i),i}function bnpModInt(t){if(t<=0)return 0;var e=this.DV%t,i=this.s<0?t-1:0;if(0<this.t)if(0==e)i=this[0]%t;else for(var n=this.t-1;0<=n;--n)i=(e*i+this[n])%t;return i}function bnModInverse(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return BigInteger.ZERO;for(var i=t.clone(),n=this.clone(),r=nbv(1),s=nbv(0),o=nbv(0),h=nbv(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),e?(r.isEven()&&s.isEven()||(r.addTo(this,r),s.subTo(t,s)),r.rShiftTo(1,r)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),e?(o.isEven()&&h.isEven()||(o.addTo(this,o),h.subTo(t,h)),o.rShiftTo(1,o)):h.isEven()||h.subTo(t,h),h.rShiftTo(1,h);0<=i.compareTo(n)?(i.subTo(n,i),e&&r.subTo(o,r),s.subTo(h,s)):(n.subTo(i,n),e&&o.subTo(r,o),h.subTo(s,h))}return 0!=n.compareTo(BigInteger.ONE)?BigInteger.ZERO:0<=h.compareTo(t)?h.subtract(t):h.signum()<0?(h.addTo(t,h),h.signum()<0?h.add(t):h):h}function bnIsProbablePrime(t){var e,i=this.abs();if(1==i.t&&i[0]<=lowprimes[lowprimes.length-1]){for(e=0;e<lowprimes.length;++e)if(i[0]==lowprimes[e])return!0;return!1}if(i.isEven())return!1;for(e=1;e<lowprimes.length;){for(var n=lowprimes[e],r=e+1;r<lowprimes.length&&n<lplim;)n*=lowprimes[r++];for(n=i.modInt(n);e<r;)if(n%lowprimes[e++]==0)return!1}return i.millerRabin(t)}function bnpMillerRabin(t){var e=this.subtract(BigInteger.ONE),i=e.getLowestSetBit();if(i<=0)return!1;var n=e.shiftRight(i);(t=t+1>>1)>lowprimes.length&&(t=lowprimes.length);for(var r=nbi(),s=0;s<t;++s){r.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]);var o=r.modPow(n,this);if(0!=o.compareTo(BigInteger.ONE)&&0!=o.compareTo(e)){for(var h=1;h++<i&&0!=o.compareTo(e);)if(0==(o=o.modPowInt(2,this)).compareTo(BigInteger.ONE))return!1;if(0!=o.compareTo(e))return!1}}return!0}function Arcfour(){this.i=0,this.j=0,this.S=new Array}function ARC4init(t){for(var e,i,n=0;n<256;++n)this.S[n]=n;for(n=e=0;n<256;++n)e=e+this.S[n]+t[n%t.length]&255,i=this.S[n],this.S[n]=this.S[e],this.S[e]=i;this.i=0,this.j=0}function ARC4next(){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 prng_newstate(){return new Arcfour}function rng_get_byte(){if(null==rng_state){for(rng_state=prng_newstate();rng_pptr<rng_psize;){var t=Math.floor(65536*Math.random());rng_pool[rng_pptr++]=255&t}for(rng_state.init(rng_pool),rng_pptr=0;rng_pptr<rng_pool.length;++rng_pptr)rng_pool[rng_pptr]=0;rng_pptr=0}return rng_state.next()}function rng_get_bytes(t){for(var e=0;e<t.length;++e)t[e]=rng_get_byte()}function SecureRandom(){}function parseBigInt(t,e){return new BigInteger(t,e)}function linebrk(t,e){for(var i="",n=0;n+e<t.length;)i+=t.substring(n,n+e)+"\n",n+=e;return i+t.substring(n,t.length)}function byte2Hex(t){return t<16?(t.toString(16),1):t.toString(16)}function pkcs1pad2(t,e,i){if(e<t.length+11)return console.error("Message too long for RSA"),null;for(var n=new Array,r=t.length-1;0<=r&&0<e;){var s=t.charCodeAt(r--);s<128?n[--e]=s:127<s&&s<2048?(n[--e]=63&s|128,n[--e]=s>>6|192):(n[--e]=63&s|128,n[--e]=s>>6&63|128,n[--e]=s>>12|224)}if(n[--e]=0,2==i)for(var o=new SecureRandom,h=new Array;2<e;){for(h[0]=0;0==h[0];)o.nextBytes(h);n[--e]=h[0]}else if(0==i)n[--e]=0;else for(;2<e;)n[--e]=255;return n[--e]=i,n[--e]=0,new BigInteger(n)}function RSAKey(){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 RSASetPublic(t,e){null!=t&&null!=e&&0<t.length&&0<e.length?(this.n=parseBigInt(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")}function RSADoPublic(t){return t.modPowInt(this.e,this.n)}function RSAPublicEncrypt(t,e){return e=pkcs1pad2(t,this.n.bitLength()+7>>3,e),null==e?null:(e=this.doPublic(e),null==e?null:(e=e.toString(16),0==(1&e.length)?e:"0"+e))}function RSAPrivateEncrypt(t,e){return e=pkcs1pad2(t,this.n.bitLength()+7>>3,e),null==e?null:(e=this.doPrivate(e),null==e?null:(e=e.toString(16),0==(1&e.length)?e:"0"+e))}function pkcs1unpad2(t,e,i){var n=t.toByteArray(),r=0;if(0==i)r=-1;else{for(;r<n.length&&0==n[r];)++r;if(n.length-r!=e-1||n[r]!=i)return null;for(++r;0!=n[r];)if(++r>=n.length)return null}for(var s="";++r<n.length;){var o=255&n[r];o<128?s+=String.fromCharCode(o):191<o&&o<224?(s+=String.fromCharCode((31&o)<<6|63&n[r+1]),++r):(s+=String.fromCharCode((15&o)<<12|(63&n[r+1])<<6|63&n[r+2]),r+=2)}return s}function RSASetPrivate(t,e,i){null!=t&&null!=e&&0<t.length&&0<e.length?(this.n=parseBigInt(t,16),this.e=parseInt(e,16),this.d=parseBigInt(i,16)):console.error("Invalid RSA private key")}function RSASetPrivateEx(t,e,i,n,r,s,o,h){null!=t&&null!=e&&0<t.length&&0<e.length?(this.n=parseBigInt(t,16),this.e=parseInt(e,16),this.d=parseBigInt(i,16),this.p=parseBigInt(n,16),this.q=parseBigInt(r,16),this.dmp1=parseBigInt(s,16),this.dmq1=parseBigInt(o,16),this.coeff=parseBigInt(h,16)):console.error("Invalid RSA private key")}function RSAGenerate(t,e){var i=new SecureRandom,n=t>>1;this.e=parseInt(e,16);for(var r=new BigInteger(e,16);;){for(;this.p=new BigInteger(t-n,1,i),0!=this.p.subtract(BigInteger.ONE).gcd(r).compareTo(BigInteger.ONE)||!this.p.isProbablePrime(10););for(;this.q=new BigInteger(n,1,i),0!=this.q.subtract(BigInteger.ONE).gcd(r).compareTo(BigInteger.ONE)||!this.q.isProbablePrime(10););this.p.compareTo(this.q)<=0&&(h=this.p,this.p=this.q,this.q=h);var s=this.p.subtract(BigInteger.ONE),o=this.q.subtract(BigInteger.ONE),h=s.multiply(o);if(0==h.gcd(r).compareTo(BigInteger.ONE)){this.n=this.p.multiply(this.q),this.d=r.modInverse(h),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(o),this.coeff=this.q.modInverse(this.p);break}}}function RSADoPrivate(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),i=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(i)<0;)e=e.add(this.p);return e.subtract(i).multiply(this.coeff).mod(this.p).multiply(this.q).add(i)}function RSAPrivateDecrypt(t,e){return t=parseBigInt(t,16),t=this.doPrivate(t),null==t?null:pkcs1unpad2(t,this.n.bitLength()+7>>3,e)}function RSAPublicDecrypt(t,e){return t=parseBigInt(t,16),t=this.doPublic(t),null==t?null:pkcs1unpad2(t,this.n.bitLength()+7>>3,e)}function hex2b64(t){for(var e,i="",n=0;n+3<=t.length;n+=3)e=parseInt(t.substring(n,n+3),16),i+=b64map.charAt(e>>6)+b64map.charAt(63&e);for(n+1==t.length?(e=parseInt(t.substring(n,n+1),16),i+=b64map.charAt(e<<2)):n+2==t.length&&(e=parseInt(t.substring(n,n+2),16),i+=b64map.charAt(e>>2)+b64map.charAt((3&e)<<4));0<(3&i.length);)i+=b64pad;return i}function b64tohex(t){for(var e,i="",n=0,r=0;r<t.length&&t.charAt(r)!=b64pad;++r)v=b64map.indexOf(t.charAt(r)),v<0||(n=0==n?(i+=int2char(v>>2),e=3&v,1):1==n?(i+=int2char(e<<2|v>>4),e=15&v,2):2==n?(i+=int2char(e),i+=int2char(v>>2),e=3&v,3):(i+=int2char(e<<2|v>>4),i+=int2char(15&v),0));return 1==n&&(i+=int2char(e<<2)),i}function b64toBA(t){for(var e=b64tohex(t),i=new Array,n=0;2*n<e.length;++n)i[n]=parseInt(e.substring(2*n,2*n+2),16);return i}var window={},navigator={},dbits;Array.prototype.forEach||(Array.prototype.forEach=function(t,e){var i,n;if(null==this)throw new TypeError(" this is null or not defined");var r,s=Object(this),o=s.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(1<arguments.length&&(i=e),n=0;n<o;)n in s&&(r=s[n],t.call(i,r,n,s)),n++});var canary=0xdeadbeefcafe,j_lm=15715070==(16777215&canary);dbits=j_lm&&"Microsoft Internet Explorer"==navigator.appName?(BigInteger.prototype.am=am2,30):j_lm&&"Netscape"!=navigator.appName?(BigInteger.prototype.am=am1,26):(BigInteger.prototype.am=am3,28),BigInteger.prototype.DB=dbits,BigInteger.prototype.DM=(1<<dbits)-1,BigInteger.prototype.DV=1<<dbits;var BI_FP=52;BigInteger.prototype.FV=Math.pow(2,BI_FP),BigInteger.prototype.F1=BI_FP-dbits,BigInteger.prototype.F2=2*dbits-BI_FP;for(var BI_RM="0123456789abcdefghijklmnopqrstuvwxyz",BI_RC=new Array,rr,vv,rr="0".charCodeAt(0),vv=0;vv<=9;++vv)BI_RC[rr++]=vv;for(rr="a".charCodeAt(0),vv=10;vv<36;++vv)BI_RC[rr++]=vv;for(rr="A".charCodeAt(0),vv=10;vv<36;++vv)BI_RC[rr++]=vv;Classic.prototype.convert=cConvert,Classic.prototype.revert=cRevert,Classic.prototype.reduce=cReduce,Classic.prototype.mulTo=cMulTo,Classic.prototype.sqrTo=cSqrTo,Montgomery.prototype.convert=montConvert,Montgomery.prototype.revert=montRevert,Montgomery.prototype.reduce=montReduce,Montgomery.prototype.mulTo=montMulTo,Montgomery.prototype.sqrTo=montSqrTo,BigInteger.prototype.copyTo=bnpCopyTo,BigInteger.prototype.fromInt=bnpFromInt,BigInteger.prototype.fromString=bnpFromString,BigInteger.prototype.clamp=bnpClamp,BigInteger.prototype.dlShiftTo=bnpDLShiftTo,BigInteger.prototype.drShiftTo=bnpDRShiftTo,BigInteger.prototype.lShiftTo=bnpLShiftTo,BigInteger.prototype.rShiftTo=bnpRShiftTo,BigInteger.prototype.subTo=bnpSubTo,BigInteger.prototype.multiplyTo=bnpMultiplyTo,BigInteger.prototype.squareTo=bnpSquareTo,BigInteger.prototype.divRemTo=bnpDivRemTo,BigInteger.prototype.invDigit=bnpInvDigit,BigInteger.prototype.isEven=bnpIsEven,BigInteger.prototype.exp=bnpExp,BigInteger.prototype.toString=bnToString,BigInteger.prototype.negate=bnNegate,BigInteger.prototype.abs=bnAbs,BigInteger.prototype.compareTo=bnCompareTo,BigInteger.prototype.bitLength=bnBitLength,BigInteger.prototype.mod=bnMod,BigInteger.prototype.modPowInt=bnModPowInt,BigInteger.ZERO=nbv(0),BigInteger.ONE=nbv(1),NullExp.prototype.convert=nNop,NullExp.prototype.revert=nNop,NullExp.prototype.mulTo=nMulTo,NullExp.prototype.sqrTo=nSqrTo,Barrett.prototype.convert=barrettConvert,Barrett.prototype.revert=barrettRevert,Barrett.prototype.reduce=barrettReduce,Barrett.prototype.mulTo=barrettMulTo,Barrett.prototype.sqrTo=barrettSqrTo;var lowprimes=[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],lplim=(1<<26)/lowprimes[lowprimes.length-1];BigInteger.prototype.chunkSize=bnpChunkSize,BigInteger.prototype.toRadix=bnpToRadix,BigInteger.prototype.fromRadix=bnpFromRadix,BigInteger.prototype.fromNumber=bnpFromNumber,BigInteger.prototype.bitwiseTo=bnpBitwiseTo,BigInteger.prototype.changeBit=bnpChangeBit,BigInteger.prototype.addTo=bnpAddTo,BigInteger.prototype.dMultiply=bnpDMultiply,BigInteger.prototype.dAddOffset=bnpDAddOffset,BigInteger.prototype.multiplyLowerTo=bnpMultiplyLowerTo,BigInteger.prototype.multiplyUpperTo=bnpMultiplyUpperTo,BigInteger.prototype.modInt=bnpModInt,BigInteger.prototype.millerRabin=bnpMillerRabin,BigInteger.prototype.clone=bnClone,BigInteger.prototype.intValue=bnIntValue,BigInteger.prototype.byteValue=bnByteValue,BigInteger.prototype.shortValue=bnShortValue,BigInteger.prototype.signum=bnSigNum,BigInteger.prototype.toByteArray=bnToByteArray,BigInteger.prototype.equals=bnEquals,BigInteger.prototype.min=bnMin,BigInteger.prototype.max=bnMax,BigInteger.prototype.and=bnAnd,BigInteger.prototype.or=bnOr,BigInteger.prototype.xor=bnXor,BigInteger.prototype.andNot=bnAndNot,BigInteger.prototype.not=bnNot,BigInteger.prototype.shiftLeft=bnShiftLeft,BigInteger.prototype.shiftRight=bnShiftRight,BigInteger.prototype.getLowestSetBit=bnGetLowestSetBit,BigInteger.prototype.bitCount=bnBitCount,BigInteger.prototype.testBit=bnTestBit,BigInteger.prototype.setBit=bnSetBit,BigInteger.prototype.clearBit=bnClearBit,BigInteger.prototype.flipBit=bnFlipBit,BigInteger.prototype.add=bnAdd,BigInteger.prototype.subtract=bnSubtract,BigInteger.prototype.multiply=bnMultiply,BigInteger.prototype.divide=bnDivide,BigInteger.prototype.remainder=bnRemainder,BigInteger.prototype.divideAndRemainder=bnDivideAndRemainder,BigInteger.prototype.modPow=bnModPow,BigInteger.prototype.modInverse=bnModInverse,BigInteger.prototype.pow=bnPow,BigInteger.prototype.gcd=bnGCD,BigInteger.prototype.isProbablePrime=bnIsProbablePrime,BigInteger.prototype.square=bnSquare,Arcfour.prototype.init=ARC4init,Arcfour.prototype.next=ARC4next;var rng_psize=256,rng_state,rng_pool,rng_pptr;if(null==rng_pool){var t,rng_pool=new Array,rng_pptr=0;if(window.crypto&&window.crypto.getRandomValues){var z=new Uint32Array(256);for(window.crypto.getRandomValues(z),t=0;t<z.length;++t)rng_pool[rng_pptr++]=255&z[t]}var onMouseMoveListener=function(t){if(this.count=this.count||0,256<=this.count||rng_psize<=rng_pptr)window.removeEventListener?window.removeEventListener("mousemove",onMouseMoveListener,!1):window.detachEvent&&window.detachEvent("onmousemove",onMouseMoveListener);else try{var e=t.x+t.y;rng_pool[rng_pptr++]=255&e,this.count+=1}catch(t){}};window.addEventListener?window.addEventListener("mousemove",onMouseMoveListener,!1):window.attachEvent&&window.attachEvent("onmousemove",onMouseMoveListener)}SecureRandom.prototype.nextBytes=rng_get_bytes,RSAKey.prototype.doPublic=RSADoPublic,RSAKey.prototype.setPublic=RSASetPublic,RSAKey.prototype.encrypt_public=RSAPublicEncrypt,RSAKey.prototype.encrypt_private=RSAPrivateEncrypt,RSAKey.prototype.doPrivate=RSADoPrivate,RSAKey.prototype.setPrivate=RSASetPrivate,RSAKey.prototype.setPrivateEx=RSASetPrivateEx,RSAKey.prototype.generate=RSAGenerate,RSAKey.prototype.decrypt_private=RSAPrivateDecrypt,RSAKey.prototype.decrypt_public=RSAPublicDecrypt,RSAKey.prototype.generateAsync=function(t,e,i){var n=new SecureRandom,r=t>>1;this.e=parseInt(e,16);var s=new BigInteger(e,16),o=this,h=function(){function e(){o.p.compareTo(o.q)<=0&&(n=o.p,o.p=o.q,o.q=n);var t=o.p.subtract(BigInteger.ONE),e=o.q.subtract(BigInteger.ONE),n=t.multiply(e);0==n.gcd(s).compareTo(BigInteger.ONE)?(o.n=o.p.multiply(o.q),o.d=s.modInverse(n),o.dmp1=o.d.mod(t),o.dmq1=o.d.mod(e),o.coeff=o.q.modInverse(o.p),setTimeout(function(){i()},0)):setTimeout(h,0)}var a=function(){o.q=nbi(),o.q.fromNumberAsync(r,1,n,function(){o.q.subtract(BigInteger.ONE).gcda(s,function(t){0==t.compareTo(BigInteger.ONE)&&o.q.isProbablePrime(10)?setTimeout(e,0):setTimeout(a,0)})})},u=function(){o.p=nbi(),o.p.fromNumberAsync(t-r,1,n,function(){o.p.subtract(BigInteger.ONE).gcda(s,function(t){0==t.compareTo(BigInteger.ONE)&&o.p.isProbablePrime(10)?setTimeout(a,0):setTimeout(u,0)})})};setTimeout(u,0)};setTimeout(h,0)},BigInteger.prototype.gcda=function(t,e){var i=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();i.compareTo(n)<0&&(t=i,i=n,n=t);var r,s=i.getLowestSetBit(),o=n.getLowestSetBit();o<0?e(i):(s<o&&(o=s),0<o&&(i.rShiftTo(o,i),n.rShiftTo(o,n)),r=function(){0<(s=i.getLowestSetBit())&&i.rShiftTo(s,i),0<(s=n.getLowestSetBit())&&n.rShiftTo(s,n),0<=i.compareTo(n)?(i.subTo(n,i),i.rShiftTo(1,i)):(n.subTo(i,n),n.rShiftTo(1,n)),0<i.signum()?setTimeout(r,0):(0<o&&n.lShiftTo(o,n),setTimeout(function(){e(n)},0))},setTimeout(r,10))},BigInteger.prototype.fromNumberAsync=function(t,e,i,n){var r,s,o;"number"==typeof e?t<2?this.fromInt(1):(this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(BigInteger.ONE.shiftLeft(t-1),op_or,this),this.isEven()&&this.dAddOffset(1,0),r=this,s=function(){r.dAddOffset(2,0),r.bitLength()>t&&r.subTo(BigInteger.ONE.shiftLeft(t-1),r),r.isProbablePrime(e)?setTimeout(function(){n()},0):setTimeout(s,0)},setTimeout(s,0)):(o=new Array,i=7&t,o.length=1+(t>>3),e.nextBytes(o),0<i?o[0]&=(1<<i)-1:o[0]=0,this.fromString(o,256))};var b64map="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b64pad="=",JSX=JSX||{};JSX.env=JSX.env||{};var L=JSX,OP=Object.prototype,FUNCTION_TOSTRING="[object Function]",ADD=["toString","valueOf"];JSX.env.parseUA=function(t){function e(t){var e=0;return parseFloat(t.replace(/\./g,function(){return 1==e++?"":"."}))}var i={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:navigator&&navigator.cajaVersion,secure:!1,os:null},n=t||navigator&&navigator.userAgent;t=window&&window.location,t=t&&t.href;return i.secure=t&&0===t.toLowerCase().indexOf("https"),n&&(/windows|win32/i.test(n)?i.os="windows":/macintosh/i.test(n)?i.os="macintosh":/rhino/i.test(n)&&(i.os="rhino"),/KHTML/.test(n)&&(i.webkit=1),(t=n.match(/AppleWebKit\/([^\s]*)/))&&t[1]&&(i.webkit=e(t[1]),/ Mobile\//.test(n)?(i.mobile="Apple",(t=n.match(/OS ([^\s]*)/))&&t[1]&&(t=e(t[1].replace("_","."))),i.ios=t,i.ipad=i.ipod=i.iphone=0,(t=n.match(/iPad|iPod|iPhone/))&&t[0]&&(i[t[0].toLowerCase()]=i.ios)):((t=n.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/))&&(i.mobile=t[0]),/webOS/.test(n)&&(i.mobile="WebOS",(t=n.match(/webOS\/([^\s]*);/))&&t[1]&&(i.webos=e(t[1]))),/ Android/.test(n)&&(i.mobile="Android",(t=n.match(/Android ([^\s]*);/))&&t[1]&&(i.android=e(t[1])))),(t=n.match(/Chrome\/([^\s]*)/))&&t[1]?i.chrome=e(t[1]):(t=n.match(/AdobeAIR\/([^\s]*)/))&&(i.air=t[0])),i.webkit||((t=n.match(/Opera[\s\/]([^\s]*)/))&&t[1]?(i.opera=e(t[1]),(t=n.match(/Version\/([^\s]*)/))&&t[1]&&(i.opera=e(t[1])),(t=n.match(/Opera Mini[^;]*/))&&(i.mobile=t[0])):(t=n.match(/MSIE\s([^;]*)/))&&t[1]?i.ie=e(t[1]):(t=n.match(/Gecko\/([^\s]*)/))&&(i.gecko=1,(t=n.match(/rv:([^\s\)]*)/))&&t[1]&&(i.gecko=e(t[1]))))),i},JSX.env.ua=JSX.env.parseUA(),JSX.isFunction=function(t){return"function"==typeof t||OP.toString.apply(t)===FUNCTION_TOSTRING},JSX._IEEnumFix=JSX.env.ua.ie?function(t,e){for(var i,n,r=0;r<ADD.length;r+=1)n=e[i=ADD[r]],L.isFunction(n)&&n!=OP[i]&&(t[i]=n)}:function(){},
|
|
JSX.extend=function(t,e,i){function n(){}if(!e||!t)throw new Error("extend failed, please check that all dependencies are included.");if(n.prototype=e.prototype,t.prototype=new n,(t.prototype.constructor=t).superclass=e.prototype,e.prototype.constructor==OP.constructor&&(e.prototype.constructor=e),i){for(var r in i)L.hasOwnProperty(i,r)&&(t.prototype[r]=i[r]);L._IEEnumFix(t.prototype,i)}},"undefined"!=typeof KJUR&&KJUR||(KJUR={}),void 0!==KJUR.asn1&&KJUR.asn1||(KJUR.asn1={}),KJUR.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){return t=t.toString(16),t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(t){if("-"!=(r=t.toString(16)).substr(0,1))r.length%2==1?r="0"+r:r.match(/^[0-7]/)||(r="00"+r);else{var e=r.substr(1).length;e%2==1?e+=1:r.match(/^[0-7]/)||(e+=2);for(var i="",n=0;n<e;n++)i+="f";var r=new BigInteger(i,16).xor(t).add(BigInteger.ONE).toString(16).replace(/^-/,"")}return r},this.getPEMStringFromHex=function(t,e){return t=CryptoJS.enc.Hex.parse(t),"-----BEGIN "+e+"-----\r\n"+CryptoJS.enc.Base64.stringify(t).replace(/(.{64})/g,"$1\r\n").replace(/\r\n$/,"")+"\r\n-----END "+e+"-----\r\n"}},KJUR.asn1.ASN1Object=function(){this.getLengthHexFromValue=function(){if(void 0===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="+"".length+",v="+this.hV;var t=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e="0"+e),t<128)return e;var i=e.length/2;if(15<i)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);return(128+i).toString(16)+e},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},void 0!==t&&(void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},JSX.extend(KJUR.asn1.DERAbstractString,KJUR.asn1.ASN1Object),KJUR.asn1.DERAbstractTime=function(t){KJUR.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){return utc=t.getTime()+6e4*t.getTimezoneOffset(),new Date(utc)},this.formatDate=function(t,e){var i=this.zeroPadding,n=this.localDateToUTC(t);t=String(n.getFullYear());return"utc"==e&&(t=t.substr(2,2)),t+i(String(n.getMonth()+1),2)+i(String(n.getDate()),2)+i(String(n.getHours()),2)+i(String(n.getMinutes()),2)+i(String(n.getSeconds()),2)+"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,n,r,s){s=new Date(Date.UTC(t,e-1,i,n,r,s,0)),this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},JSX.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,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},JSX.extend(KJUR.asn1.DERAbstractStructured,KJUR.asn1.ASN1Object),KJUR.asn1.DERBoolean=function(){KJUR.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},JSX.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){t=new BigInteger(String(t),10),this.setByBigInteger(t)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):void 0!==t.hex&&this.setValueHex(t.hex))},JSX.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(t<0||7<t)throw"unused bits shall be from 0 to 7: u = "+t;t="0"+t,this.hTLV=null,this.isModified=!0,this.hV=t+e},this.setByBinaryString=function(t){var e=8-(t=t.replace(/0+$/,"")).length%8;8==e&&(e=0);for(var i=0;i<=e;i++)t+="0";var n="";for(i=0;i<t.length-1;i+=8){var r=t.substr(i,8);r=parseInt(r,2).toString(16);1==r.length&&(r="0"+r),n+=r}this.hTLV=null,this.isModified=!0,this.hV="0"+e+n},this.setByBooleanArray=function(t){for(var e="",i=0;i<t.length;i++)1==t[i]?e+="1":e+="0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),i=0;i<t;i++)e[i]=!1;return e},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.hex?this.setHexValueIncludingUnusedBits(t.hex):void 0!==t.bin?this.setByBinaryString(t.bin):void 0!==t.array&&this.setByBooleanArray(t.array))},JSX.extend(KJUR.asn1.DERBitString,KJUR.asn1.ASN1Object),KJUR.asn1.DEROctetString=function(t){KJUR.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},JSX.extend(KJUR.asn1.DEROctetString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERNull=function(){KJUR.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},JSX.extend(KJUR.asn1.DERNull,KJUR.asn1.ASN1Object),KJUR.asn1.DERObjectIdentifier=function(t){function e(t){return 1==(t=t.toString(16)).length&&(t="0"+t),t}KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var i="",n=t.split(".");t=40*parseInt(n[0])+parseInt(n[1]);i+=e(t),n.splice(0,2);for(var r=0;r<n.length;r++)i+=function(t){var i="",n=new BigInteger(t,10).toString(2),r=7-n.length%7;7==r&&(r=0);for(var s="",o=0;o<r;o++)s+="0";for(n=s+n,o=0;o<n.length-1;o+=7){var h=n.substr(o,7);o!=n.length-7&&(h="1"+h),i+=e(parseInt(h,2))}return i}(n[r]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=i},this.setValueName=function(t){if(void 0===KJUR.asn1.x509.OID.name2oidList[t])throw"DERObjectIdentifier oidName undefined: "+t;t=KJUR.asn1.x509.OID.name2oidList[t],this.setValueOidString(t)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.oid?this.setValueOidString(t.oid):void 0!==t.hex?this.setValueHex(t.hex):void 0!==t.name&&this.setValueName(t.name))},JSX.extend(KJUR.asn1.DERObjectIdentifier,KJUR.asn1.ASN1Object),KJUR.asn1.DERUTF8String=function(t){KJUR.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},JSX.extend(KJUR.asn1.DERUTF8String,KJUR.asn1.DERAbstractString),KJUR.asn1.DERNumericString=function(t){KJUR.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},JSX.extend(KJUR.asn1.DERNumericString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERPrintableString=function(t){KJUR.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},JSX.extend(KJUR.asn1.DERPrintableString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERTeletexString=function(t){KJUR.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},JSX.extend(KJUR.asn1.DERTeletexString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERIA5String=function(t){KJUR.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},JSX.extend(KJUR.asn1.DERIA5String,KJUR.asn1.DERAbstractString),KJUR.asn1.DERUTCTime=function(t){KJUR.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},void 0!==t&&(void 0!==t.str?this.setString(t.str):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date))},JSX.extend(KJUR.asn1.DERUTCTime,KJUR.asn1.DERAbstractTime),KJUR.asn1.DERGeneralizedTime=function(t){KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen"),this.hV=stohex(this.s)},void 0!==t&&(void 0!==t.str?this.setString(t.str):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date))},JSX.extend(KJUR.asn1.DERGeneralizedTime,KJUR.asn1.DERAbstractTime),KJUR.asn1.DERSequence=function(t){KJUR.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++)t+=this.asn1Array[e].getEncodedHex();return this.hV=t,this.hV}},JSX.extend(KJUR.asn1.DERSequence,KJUR.asn1.DERAbstractStructured),KJUR.asn1.DERSet=function(t){KJUR.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var i=this.asn1Array[e];t.push(i.getEncodedHex())}return t.sort(),this.hV=t.join(""),this.hV}},JSX.extend(KJUR.asn1.DERSet,KJUR.asn1.DERAbstractStructured),KJUR.asn1.DERTaggedObject=function(t){KJUR.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,i){this.hT=e,this.isExplicit=t,this.asn1Object=i,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=i.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.tag&&(this.hT=t.tag),void 0!==t.explicit&&(this.isExplicit=t.explicit),void 0!==t.obj&&(this.asn1Object=t.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},JSX.extend(KJUR.asn1.DERTaggedObject,KJUR.asn1.ASN1Object),function(){"use strict";var t,e={decode:function(e){if(void 0===t){var i="0123456789ABCDEF",n=" \f\n\r\t?\u2028\u2029";for(t=[],h=0;h<16;++h)t[i.charAt(h)]=h;for(i=i.toLowerCase(),h=10;h<16;++h)t[i.charAt(h)]=h;for(h=0;h<n.length;++h)t[n.charAt(h)]=-1}for(var r=[],s=0,o=0,h=0;h<e.length;++h){var a=e.charAt(h);if("="==a)break;if(-1!=(a=t[a])){if(void 0===a)throw"Illegal character at offset "+h;s|=a,2<=++o?(r[r.length]=s,o=s=0):s<<=4}}if(o)throw"Hex encoding incomplete: 4 bits missing";return r}};window.Hex=e}(),function(){"use strict";var t,e={decode:function(e){if(void 0===t){var i="= \f\n\r\t?\u2028\u2029";for(t=[],o=0;o<64;++o)t["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(o)]=o;for(o=0;o<i.length;++o)t[i.charAt(o)]=-1}for(var n=[],r=0,s=0,o=0;o<e.length;++o){var h=e.charAt(o);if("="==h)break;if(-1!=(h=t[h])){if(void 0===h)throw"Illegal character at offset "+o;r|=h,4<=++s?(n[n.length]=r>>16,n[n.length]=r>>8&255,n[n.length]=255&r,s=r=0):r<<=6}}switch(s){case 1:throw"Base64 encoding incomplete: at least 2 bits missing";case 2:n[n.length]=r>>10;break;case 3:n[n.length]=r>>16,n[n.length]=r>>8&255}return n},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(t){var i=e.re.exec(t);if(i)if(i[1])t=i[1];else{if(!i[2])throw"RegExp out of sync";t=i[2]}return e.decode(t)}};window.Base64=e}(),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,n,r){this.stream=t,this.header=e,this.length=i,this.tag=n,this.sub=r}var n=function(t,e){return t=document.createElement(t),t.className=e,t},r=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 n="",r=t;r<e;++r)if(n+=this.hexByte(this.get(r)),!0!==i)switch(15&r){case 7:n+=" ";break;case 15:n+="\n";break;default:n+=" "}return n},e.prototype.parseStringISO=function(t,e){for(var i="",n=t;n<e;++n)i+=String.fromCharCode(this.get(n));return i},e.prototype.parseStringUTF=function(t,e){for(var i="",n=t;n<e;){var r=this.get(n++);i+=r<128?String.fromCharCode(r):191<r&&r<224?String.fromCharCode((31&r)<<6|63&this.get(n++)):String.fromCharCode((15&r)<<12|(63&this.get(n++))<<6|63&this.get(n++))}return i},e.prototype.parseStringBMP=function(t,e){for(var i="",n=t;n<e;n+=2){var r=this.get(n),s=this.get(n+1);i+=String.fromCharCode((r<<8)+s)}return i},e.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)?)?$/,e.prototype.parseTime=function(t,e){return t=this.parseStringISO(t,e),e=this.reTime.exec(t),e?(t=e[1]+"-"+e[2]+"-"+e[3]+" "+e[4],e[5]&&(t+=":"+e[5],e[6]&&(t+=":"+e[6],e[7]&&(t+="."+e[7]))),e[8]&&(t+=" UTC","Z"!=e[8]&&(t+=e[8],e[9]&&(t+=":"+e[9]))),t):"Unrecognized time: "+t},e.prototype.parseInteger=function(t,e){var i=e-t;if(4<i){i<<=3;var n=this.get(t);if(0===n)i-=8;else for(;n<128;)n<<=1,--i;return"("+i+" bit)"}for(var r=0,s=t;s<e;++s)r=r<<8|this.get(s);return r},e.prototype.parseBitString=function(t,e){var i=this.get(t),n=(e-t-1<<3)-i,r="("+n+" bit)";if(n<=20){var s=i;r+=" ";for(var o=e-1;t<o;--o){for(var h=this.get(o),a=s;a<8;++a)r+=h>>a&1?"1":"0";s=0}}return r},e.prototype.parseOctetString=function(t,e){var i=e-t,n="("+i+" byte) ";100<i&&(e=t+100);for(var r=t;r<e;++r)n+=this.hexByte(this.get(r));return 100<i&&(n+="…"),n},e.prototype.parseOID=function(t,e){for(var i="",n=0,r=0,s=t;s<e;++s){var o=this.get(s);n=n<<7|127&o;r+=7,128&o||(""===i?i=(o=n<80?n<40?0:1:2)+"."+(n-40*o):i+="."+(31<=r?"bigint":n),n=r=0)}return i},i.prototype.typeName=function(){if(this.tag===t)return"unknown";var e=this.tag>>6,i=(this.tag,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(),r=Math.abs(this.length);if(0!=e)return null!==this.sub?"("+this.sub.length+" elem)":(e=this.stream.parseStringISO(n,n+Math.min(r,100)),this.reSeemsASCII.test(e)?e.substring(0,200)+(200<e.length?"…":""):this.stream.parseOctetString(n,n+r));switch(i){case 1:return 0===this.stream.get(n)?"false":"true";case 2:return this.stream.parseInteger(n,n+r);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(n,n+r);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(n,n+r);case 6:return this.stream.parseOID(n,n+r);case 16:case 17:return"("+this.sub.length+" elem)";case 12:return this.stream.parseStringUTF(n,n+r);case 18:case 19:case 20:case 21:case 22:case 26:return this.stream.parseStringISO(n,n+r);case 30:return this.stream.parseStringBMP(n,n+r);case 23:case 24:return this.stream.parseTime(n,n+r)}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,n=this.sub.length;i<n;++i)this.sub[i].print(e)}},i.prototype.toPrettyString=function(e){e===t&&(e="");var i=e+this.typeName()+" @"+this.stream.pos;if(0<=this.length&&(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 n=0,r=this.sub.length;n<r;++n)i+=this.sub[n].toPrettyString(e)}return i},i.prototype.toDOM=function(){var t=n("div","node");t.asn1=this;var e=n("div","head"),i=this.typeName().replace(/_/g," ");e.innerHTML=i;var s=this.content();null!==s&&(s=String(s).replace(/</g,"<"),(o=n("span","preview")).appendChild(r(s)),e.appendChild(o)),t.appendChild(e),this.node=t,this.head=e;var o=n("div","value");i="Offset: "+this.stream.pos+"<br/>";i+="Length: "+this.header+"+",0<=this.length?i+=this.length:i+=-this.length+" (undefined)",32&this.tag?i+="<br/>(constructed)":3!=this.tag&&4!=this.tag||null===this.sub||(i+="<br/>(encapsulates)"),null!==s&&(i+="<br/>Value:<br/><b>"+s+"</b>","object"!=typeof oids||6!=this.tag||(s=oids[s])&&(s.d&&(i+="<br/>"+s.d),s.c&&(i+="<br/>"+s.c),s.w&&(i+="<br/>(warning!)"))),o.innerHTML=i,t.appendChild(o);var h=n("div","sub");if(null!==this.sub)for(var a=0,u=this.sub.length;a<u;++a)h.appendChild(this.sub[a].toDOM());return t.appendChild(h),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,s,o){o<=s||((e=n("span",e)).appendChild(r(i.hexDump(s,o))),t.appendChild(e))},i.prototype.toHexDOM=function(e){var i=n("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,0<=this.length?"dlen":"ulen",this.stream,this.posStart()+1,this.posContent()),null===this.sub)i.appendChild(r(this.stream.hexDump(this.posContent(),this.posEnd())));else if(0<this.sub.length){var s=this.sub[0],o=this.sub[this.sub.length-1];this.toHexDOM_sub(i,"intro",this.stream,this.posContent(),s.posStart());for(var h=0,a=this.sub.length;h<a;++h)i.appendChild(this.sub[h].toHexDOM(e));this.toHexDOM_sub(i,"outro",this.stream,o.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(3<i)throw"Length over 24 bits not supported at position "+(t.pos-1);if(0==i)return-1;for(var n=e=0;n<i;++n)e=e<<8|t.get();return e},i.hasContent=function(t,n,r){if(32&t)return!0;if(t<3||4<t)return!1;var s=new e(r);if(3==t&&s.get(),s.get()>>6&1)return!1;try{var o=i.decodeLength(s);return s.pos-r.pos+o==n}catch(t){return!1}},i.decode=function(t){t instanceof e||(t=new e(t,0));var n=new e(t),r=t.get(),s=i.decodeLength(t),o=t.pos-n.pos,h=null;if(i.hasContent(r,s,t)){var a=t.pos;if(3==r&&t.get(),h=[],0<=s){for(var u=a+s;t.pos<u;)h[h.length]=i.decode(t);if(t.pos!=u)throw"Content size is not correct for container starting at offset "+a}else try{for(;;){var p=i.decode(t);if(0===p.tag)break;h[h.length]=p}s=a-t.pos}catch(t){throw"Exception while decoding undefined length content: "+t}}else t.pos+=s;return new i(n,o,s,r,h)},i.test=function(){for(var t=[{value:[39],expected:39},{value:[129,201],expected:201},{value:[131,254,220,186],expected:16702650}],n=0,r=t.length;n<r;++n){var s=new e(t[n].value,0);s=i.decodeLength(s);s!=t[n].expected&&document.write("In test["+n+"] expected "+t[n].expected+" got "+s+"\n")}},window.ASN1=i}(),window.ASN1.prototype.getHexStringValue=function(){var t=this.toHexString(),e=2*this.header,i=2*this.length;return t.substr(e,i)},RSAKey.prototype.parseKey=function(t){try{var e=0,i=0,n=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(t)?Hex.decode(t):window.Base64.unarmor(t),r=window.ASN1.decode(n);if(3===r.sub.length&&(r=r.sub[2].sub[0]),9===r.sub.length)e=r.sub[1].getHexStringValue(),this.n=parseBigInt(e,16),i=r.sub[2].getHexStringValue(),this.e=parseInt(i,16),n=r.sub[3].getHexStringValue(),this.d=parseBigInt(n,16),n=r.sub[4].getHexStringValue(),this.p=parseBigInt(n,16),n=r.sub[5].getHexStringValue(),this.q=parseBigInt(n,16),n=r.sub[6].getHexStringValue(),this.dmp1=parseBigInt(n,16),n=r.sub[7].getHexStringValue(),this.dmq1=parseBigInt(n,16),n=r.sub[8].getHexStringValue(),this.coeff=parseBigInt(n,16);else{if(2!==r.sub.length)return!1;r=r.sub[1].sub[0],e=r.sub[0].getHexStringValue(),this.n=parseBigInt(e,16),i=r.sub[1].getHexStringValue(),this.e=parseInt(i,16)}return!0}catch(t){return!1}},RSAKey.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})]};return new KJUR.asn1.DERSequence(t).getEncodedHex()},RSAKey.prototype.getPrivateBaseKeyB64=function(){return hex2b64(this.getPrivateBaseKey())},RSAKey.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})]};return t={hex:"00"+new KJUR.asn1.DERSequence(t).getEncodedHex()},t={array:[e,new KJUR.asn1.DERBitString(t)]},new KJUR.asn1.DERSequence(t).getEncodedHex()},RSAKey.prototype.getPublicBaseKeyB64=function(){return hex2b64(this.getPublicBaseKey())},RSAKey.prototype.wordwrap=function(t,e){return t?(e="(.{1,"+(e=e||64)+"})( +|$\n?)|(.{1,"+e+"})",t.match(RegExp(e,"g")).join("\n")):t},RSAKey.prototype.getPrivateKey=function(){var t="-----BEGIN RSA PRIVATE KEY-----\n";return t+=this.wordwrap(this.getPrivateBaseKeyB64())+"\n",t+"-----END RSA PRIVATE KEY-----"},RSAKey.prototype.getPublicKey=function(){var t="-----BEGIN PUBLIC KEY-----\n";return t+=this.wordwrap(this.getPublicBaseKeyB64())+"\n",t+"-----END PUBLIC KEY-----"},RSAKey.prototype.hasPublicKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")},RSAKey.prototype.hasPrivateKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")&&t.hasOwnProperty("d")&&t.hasOwnProperty("p")&&t.hasOwnProperty("q")&&t.hasOwnProperty("dmp1")&&t.hasOwnProperty("dmq1")&&t.hasOwnProperty("coeff")},RSAKey.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 JSEncryptRSAKey=function(t){RSAKey.call(this),t&&("string"==typeof t?this.parseKey(t):(this.hasPrivateKeyProperty(t)||this.hasPublicKeyProperty(t))&&this.parsePropertiesFrom(t))};JSEncryptRSAKey.prototype=new RSAKey,JSEncryptRSAKey.prototype.constructor=JSEncryptRSAKey;var JSEncrypt=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};JSEncrypt.prototype.setKey=function(t){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new JSEncryptRSAKey(t)},JSEncrypt.prototype.setPrivateKey=function(t){this.setKey(t)},JSEncrypt.prototype.setPublicKey=function(t){this.setKey(t)},JSEncrypt.prototype.private_decrypt=function(t){try{return this.getKey().decrypt_private(b64tohex(t))}catch(t){return!1}},JSEncrypt.prototype.public_decrypt=function(t){try{return this.getKey().decrypt_public(b64tohex(t))}catch(t){return!1}},JSEncrypt.prototype.public_encrypt=function(t){try{return hex2b64(this.getKey().encrypt_public(t))}catch(t){return!1}},JSEncrypt.prototype.private_encrypt=function(t){try{return hex2b64(this.getKey().encrypt_private(t))}catch(t){return!1}},JSEncrypt.prototype.setPublic=RSASetPublic,JSEncrypt.prototype.getKey=function(t){if(!this.key){if(this.key=new JSEncryptRSAKey,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},JSEncrypt.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},JSEncrypt.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},JSEncrypt.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},JSEncrypt.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},JSEncrypt.prototype.setPrivate=RSASetPrivate,JSEncrypt.prototype.setPrivateEx=RSASetPrivateEx,JSEncrypt.prototype.public_encryptLong=function(string,padding,output){var k=this.getKey(),maxLength=(k.n.bitLength()+7>>3)-11;try{var lt="",ct="";if(string.length>maxLength)return lt=string.match(eval("/.{1,"+maxLength+"}/g")),lt.forEach(function(t){t=k.encrypt_public(t,padding),ct+=t}),output?hex2b64(ct):ct;var t=k.encrypt_public(string,padding),y=output?hex2b64(t):t;return y}catch(t){return!1}},JSEncrypt.prototype.private_decryptLong=function(string,padding,output){var k=this.getKey(),maxLength=(k.n.bitLength()+7>>3)-11,MAX_DECRYPT_BLOCK=parseInt((k.n.bitLength()+1)/4);try{var ct="";if(string=output?b64tohex(string):string,string.length>maxLength){var lt=string.match(eval("/.{1,"+MAX_DECRYPT_BLOCK+"}/g"));return lt.forEach(function(t){t=k.decrypt_private(t,padding),ct+=t}),ct}var y=k.decrypt_private(string,padding);return y}catch(t){return!1}},JSEncrypt.prototype.private_encryptLong=function(string,padding,output){var k=this.getKey(),maxLength=(k.n.bitLength()+7>>3)-11;try{var lt="",ct="";if(string.length>maxLength)return lt=string.match(eval("/.{1,"+maxLength+"}/g")),lt.forEach(function(t){t=k.encrypt_private(t,padding),ct+=t}),output?hex2b64(ct):ct;var t=k.encrypt_private(string,padding),y=output?hex2b64(t):t;return y}catch(t){return!1}},JSEncrypt.prototype.public_decryptLong=function(string,padding,output){var k=this.getKey(),maxLength=(k.n.bitLength()+7>>3)-11,MAX_DECRYPT_BLOCK=parseInt((k.n.bitLength()+1)/4);try{var ct="";if(string=output?b64tohex(string):string,string.length>maxLength){var lt=string.match(eval("/.{1,"+MAX_DECRYPT_BLOCK+"}/g"));return lt.forEach(function(t){t=k.decrypt_public(t,padding),ct+=t}),ct}var y=k.decrypt_public(string,padding);return y}catch(t){return!1}},JSEncrypt.version="2.3.0",exports.JSEncrypt=JSEncrypt}(RSA),RSA}
|
|
|
|
|