You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 lines
101 KiB

1 year ago
  1. var CryptoJS=CryptoJS||function(a,b){var c,e,f,g,h,i,j,k,l,m,n,o,q;if(!c&&"undefined"!=typeof global&&global.crypto&&(c=global.crypto),!c&&"function"==typeof require)try{c=require("crypto")}catch(d){}return e=function(){if(c){if("function"==typeof c.getRandomValues)try{return c.getRandomValues(new Uint32Array(1))[0]}catch(a){}if("function"==typeof c.randomBytes)try{return c.randomBytes(4).readInt32LE()}catch(a){}}throw new Error("Native crypto module could not be used to get secure random number.")},f=Object.create||function(){function a(){}return function(b){var c;return a.prototype=b,c=new a,a.prototype=null,c}}(),g={},h=g.lib={},i=h.Base=function(){return{extend:function(a){var b=f(this);return a&&b.mixIn(a),b.hasOwnProperty("init")&&this.init!==b.init||(b.init=function(){b.$super.init.apply(this,arguments)}),b.init.prototype=b,b.$super=this,b},create:function(){var a=this.extend();return a.init.apply(a,arguments),a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),j=h.WordArray=i.extend({init:function(a,c){a=this.words=a||[],this.sigBytes=c!=b?c:4*a.length},toString:function(a){return(a||l).stringify(this)},concat:function(a){var f,g,b=this.words,c=a.words,d=this.sigBytes,e=a.sigBytes;if(this.clamp(),d%4)for(f=0;e>f;f++)g=255&c[f>>>2]>>>24-8*(f%4),b[d+f>>>2]|=g<<24-8*((d+f)%4);else for(f=0;e>f;f+=4)b[d+f>>>2]=c[f>>>2];return this.sigBytes+=e,this},clamp:function(){var b=this.words,c=this.sigBytes;b[c>>>2]&=4294967295<<32-8*(c%4),b.length=a.ceil(c/4)},clone:function(){var a=i.clone.call(this);return a.words=this.words.slice(0),a},random:function(a){var c,b=[];for(c=0;a>c;c+=4)b.push(e());return new j.init(b,a)}}),k=g.enc={},l=k.Hex={stringify:function(a){var e,f,b=a.words,c=a.sigBytes,d=[];for(e=0;c>e;e++)f=255&b[e>>>2]>>>24-8*(e%4),d.push((f>>>4).toString(16)),d.push((15&f).toString(16));return d.join("")},parse:function(a){var d,b=a.length,c=[];for(d=0;b>d;d+=2)c[d>>>3]|=parseInt(a.substr(d,2),16)<<24-4*(d%8);return new j.init(c,b/2)}},m=k.Latin1={stringify:function(a){var e,f,b=a.words,c=a.sigBytes,d=[];for(e=0;c>e;e++)f=255&b[e>>>2]>>>24-8*(e%4),d.push(String.fromCharCode(f));return d.join("")},parse:function(a){var d,b=a.length,c=[];for(d=0;b>d;d++)c[d>>>2]|=(255&a.charCodeAt(d))<<24-8*(d%4);return new j.init(c,b)}},n=k.Utf8={stringify:function(a){try{return decodeURIComponent(escape(m.stringify(a)))}catch(b){throw new Error("Malformed UTF-8 data")}},parse:function(a){return m.parse(unescape(encodeURIComponent(a)))}},o=h.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new j.init,this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=n.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes},_process:function(b){var c,k,l,m,d=this._data,e=d.words,f=d.sigBytes,g=this.blockSize,h=4*g,i=f/h;if(i=b?a.ceil(i):a.max((0|i)-this._minBufferSize,0),k=i*g,l=a.min(4*k,f),k){for(m=0;k>m;m+=g)this._doProcessBlock(e,m);c=e.splice(0,k),d.sigBytes-=l}return new j.init(c,l)},clone:function(){var a=i.clone.call(this);return a._data=this._data.clone(),a},_minBufferSize:0}),h.Hasher=o.extend({cfg:i.extend(),init:function(a){this.cfg=this.cfg.extend(a),this.reset()},reset:function(){o.reset.call(this),this._doReset()},update:function(a){return this._append(a),this._process(),this},finalize:function(a){a&&this._append(a);var b=this._doFinalize();return b},blockSize:16,_createHelper:function(a){return function(b,c){return new a.init(c).finalize(b)}},_createHmacHelper:function(a){return function(b,c){return new q.HMAC.init(a,c).finalize(b)}}}),q=g.algo={},g}(Math);!function(){function f(a,b,d){var g,h,i,j,e=[],f=0;for(g=0;b>g;g++)g%4&&(h=d[a.charCodeAt(g-1)]<<2*(g%4),i=d[a.charCodeAt(g)]>>>6-2*(g%4),j=h|i,e[f>>>2]|=j<<24-8*(f%4),f++);return c.create(e,f)}var a=CryptoJS,b=a.lib,c=b.WordArray,d=a.enc;d.Base64={stringify:function(a){var e,f,g,h,i,j,k,l,b=a.words,c=a.sigBytes,d=this._map;for(a.clamp(),e=[],f=0;c>f;f+=3)for(g=255&b[f>>>2]>>>24-8*(f%4),h=255&b[f+1
  2. },keySize:8}),a.AES=c._createHelper(p)}(),function(){function l(a,b){var c=(this._lBlock>>>a^this._rBlock)&b;this._rBlock^=c,this._lBlock^=c<<a}function m(a,b){var c=(this._rBlock>>>a^this._lBlock)&b;this._lBlock^=c,this._rBlock^=c<<a}var n,a=CryptoJS,b=a.lib,c=b.WordArray,d=b.BlockCipher,e=a.algo,f=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],g=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],h=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],i=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:
  3. },a.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},a.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},a.prototype.toByteArray=function(){var c,d,e,a=this.t,b=[];if(b[0]=this.s,c=this.DB-a*this.DB%8,e=0,a-->0)for(c<this.DB&&(d=this[a]>>c)!=(this.s&this.DM)>>c&&(b[e++]=d|this.s<<this.DB-c);a>=0;)8>c?(d=(this[a]&(1<<c)-1)<<8-c,d|=this[--a]>>(c+=this.DB-8)):(d=255&this[a]>>(c-=8),0>=c&&(c+=this.DB,--a)),0!=(128&d)&&(d|=-256),0==e&&(128&this.s)!=(128&d)&&++e,(e>0||d!=this.s)&&(b[e++]=d);return b},a.prototype.equals=function(a){return 0==this.compareTo(a)},a.prototype.min=function(a){return this.compareTo(a)<0?this:a},a.prototype.max=function(a){return this.compareTo(a)>0?this:a},a.prototype.and=function(a){var b=M();return this.bitwiseTo(a,d,b),b},a.prototype.or=function(a){var b=M();return this.bitwiseTo(a,e,b),b},a.prototype.xor=function(a){var b=M();return this.bitwiseTo(a,f,b),b},a.prototype.andNot=function(a){var b=M();return this.bitwiseTo(a,g,b),b},a.prototype.not=function(){var b,a=M();for(b=0;b<this.t;++b)a[b]=this.DM&~this[b];return a.t=this.t,a.s=~this.s,a},a.prototype.shiftLeft=function(a){var b=M();return 0>a?this.rShiftTo(-a,b):this.lShiftTo(a,b),b},a.prototype.shiftRight=function(a){var b=M();return 0>a?this.lShiftTo(-a,b):this.rShiftTo(a,b),b},a.prototype.getLowestSetBit=function(){for(var a=0;a<this.t;++a)if(0!=this[a])return a*this.DB+h(this[a]);return this.s<0?this.t*this.DB:-1},a.prototype.bitCount=function(){var c,a=0,b=this.s&this.DM;for(c=0;c<this.t;++c)a+=i(this[c]^b);return a},a.prototype.testBit=function(a){var b=Math.floor(a/this.DB);return b>=this.t?0!=this.s:0!=(this[b]&1<<a%this.DB)},a.prototype.setBit=function(a){return this.changeBit(a,e)},a.prototype.clearBit=function(a){return this.changeBit(a,g)},a.prototype.flipBit=function(a){return this.changeBit(a,f)},a.prototype.add=function(a){var b=M();return this.addTo(a,b),b},a.prototype.subtract=function(a){var b=M();return this.subTo(a,b),b},a.prototype.multiply=function(a){var b=M();return this.multiplyTo(a,b),b},a.prototype.divide=function(a){var b=M();return this.divRemTo(a,b,null),b},a.prototype.remainder=function(a){var b=M();return this.divRemTo(a,null,b),b},a.prototype.divideAndRemainder=function(a){var b=M(),c=M();return this.divRemTo(a,b,c),[b,c]},a.prototype.modPow=function(a,b){var d,f,g,h,i,j,k,l,m,n,o,p,c=a.bitLength(),e=W(1);if(0>=c)return e;if(d=18>c?1:48>c?3:144>c?4:768>c?5:6,f=8>c?new J(b):b.isEven()?new L(b):new K(b),g=[],h=3,i=d-1,j=(1<<d)-1,g[1]=f.convert(this),d>1)for(k=M(),f.sqrTo(g[1],k);j>=h;)g[h]=M(),f.mulTo(k,g[h-2],g[h]),h+=2;for(l=a.t-1,n=!0,o=M(),c=X(a[l])-1;l>=0;){for(c>=i?m=a[l]>>c-i&j:(m=(a[l]&(1<<c+1)-1)<<i-c,l>0&&(m|=a[l-1]>>this.DB+c-i)),h=d;0==(1&m);)m>>=1,--h;if((c-=h)<0&&(c+=this.DB,--l),n)g[m].copyTo(e),n=!1;else{for(;h>1;)f.sqrTo(e,o),f.sqrTo(o,e),h-=2;h>0?f.sqrTo(e,o):(p=e,e=o,o=p),f.mulTo(o,g[m],e)}for(;l>=0&&0==(a[l]&1<<c);)f.sqrTo(e,o),p=e,e=o,o=p,--c<0&&(c=this.DB-1,--l)}return f.revert(e)},a.prototype.modInverse=function(b){var d,e,f,g,h,i,c=b.isEven();if(this.isEven()&&c||0==b.signum())return a.ZERO;for(d=b.clone(),e=this.clone(),f=W(1),g=W(0),h=W(0),i=W(1);0!=d.signum();){for(;d.isEven();)d.rShiftTo(1,d),c?(f.isEven()&&g.isEven()||(f.addTo(this,f),g.subTo(b,g)),f.rShiftTo(1,f)):g.isEven()||g.subTo(b,g),g.rShiftTo(1,g);for(;e.isEven();)e.rShiftTo(1,e),c?(h.isEven()&&i.isEven()||(h.addTo(this,h),i.subTo(b,i)),h.rShiftTo(1,h)):i.isEven()||i.subTo(b,i),i.rShiftTo(1,i);d.compareTo(e)>=0?(d.subTo(e,d),c&&f.subTo(h,f),g.subTo(i,g)):(e.subTo(d,e),c&&h.subTo(f,h),i.subTo(g,i))}return 0!=e.compareTo(a.ONE)?a.ZERO:i.compareTo(b)>=0?i.subtract(b):i.signum()<0?(i.addTo(b,i),i.signum()<0?i.add(b):i):i},a.prototype.pow=function(a){return this.exp(a,new I)},a.prototype.gcd=function(a){var d,e,f,b=this.s<0?this.negate():this.clone(),c=a.s<0?a.negate():a.clone();if(b.compareTo(c)<0&&(d=b,b=c,c=d),e=b.getLowestSetBit(),f=c.getLowestSetBit(),0>f)return b;for(f>e&&(f=e),f>0&&(b.rShiftTo(f,b),c.rShiftTo(f,c));b.signum()>0;)(e=b.getLowestSetBit())>0&&b.rShiftTo
  4. },ob.lang.extend(pb.asn1.DERUTCTime,pb.asn1.DERAbstractTime),pb.asn1.DERGeneralizedTime=function(a){pb.asn1.DERGeneralizedTime.superclass.constructor.call(this,a),this.hT="18",this.withMillis=!1,this.setByDate=function(a){this.hTLV=null,this.isModified=!0,this.date=a,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},void 0!==a&&(void 0!==a.str?this.setString(a.str):"string"==typeof a&&a.match(/^[0-9]{14}Z$/)?this.setString(a):void 0!==a.hex?this.setStringHex(a.hex):void 0!==a.date&&this.setByDate(a.date),a.millis===!0&&(this.withMillis=!0))},ob.lang.extend(pb.asn1.DERGeneralizedTime,pb.asn1.DERAbstractTime),pb.asn1.DERSequence=function(a){pb.asn1.DERSequence.superclass.constructor.call(this,a),this.hT="30",this.getFreshValueHex=function(){var b,c,a="";for(b=0;b<this.asn1Array.length;b++)c=this.asn1Array[b],a+=c.getEncodedHex();return this.hV=a,this.hV}},ob.lang.extend(pb.asn1.DERSequence,pb.asn1.DERAbstractStructured),pb.asn1.DERSet=function(a){pb.asn1.DERSet.superclass.constructor.call(this,a),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){var b,c,a=new Array;for(b=0;b<this.asn1Array.length;b++)c=this.asn1Array[b],a.push(c.getEncodedHex());return 1==this.sortFlag&&a.sort(),this.hV=a.join(""),this.hV},"undefined"!=typeof a&&"undefined"!=typeof a.sortflag&&0==a.sortflag&&(this.sortFlag=!1)},ob.lang.extend(pb.asn1.DERSet,pb.asn1.DERAbstractStructured),pb.asn1.DERTaggedObject=function(a){pb.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(a,b,c){this.hT=b,this.isExplicit=a,this.asn1Object=c,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=c.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,b),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof a&&("undefined"!=typeof a["tag"]&&(this.hT=a["tag"]),"undefined"!=typeof a["explicit"]&&(this.isExplicit=a["explicit"]),"undefined"!=typeof a["obj"]&&(this.asn1Object=a["obj"],this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},ob.lang.extend(pb.asn1.DERTaggedObject,pb.asn1.ASN1Object),qb=function(a){function b(c){var d=a.call(this)||this;return c&&("string"==typeof c?d.parseKey(c):(b.hasPrivateKeyProperty(c)||b.hasPublicKeyProperty(c))&&d.parsePropertiesFrom(c)),d}return o(b,a),b.prototype.parseKey=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n;try{if(b=0,c=0,d=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/,e=d.test(a)?q.decode(a):s.unarmor(a),f=A.decode(e),3===f.sub.length&&(f=f.sub[2].sub[0]),9===f.sub.length)b=f.sub[1].getHexStringValue(),this.n=N(b,16),c=f.sub[2].getHexStringValue(),this.e=parseInt(c,16),g=f.sub[3].getHexStringValue(),this.d=N(g,16),h=f.sub[4].getHexStringValue(),this.p=N(h,16),i=f.sub[5].getHexStringValue(),this.q=N(i,16),j=f.sub[6].getHexStringValue(),this.dmp1=N(j,16),k=f.sub[7].getHexStringValue(),this.dmq1=N(k,16),l=f.sub[8].getHexStringValue(),this.coeff=N(l,16);else{if(2!==f.sub.length)return!1;m=f.sub[1],n=m.sub[0],b=n.sub[0].getHexStringValue(),this.n=N(b,16),c=n.sub[1].getHexStringValue(),this.e=parseInt(c,16)}return!0}catch(o){return!1}},b.prototype.getPrivateBaseKey=function(){var a={array:[new pb.asn1.DERInteger({"int":0}),new pb.asn1.DERInteger({bigint:this.n}),new pb.asn1.DERInteger({"int":this.e}),new pb.asn1.DERInteger({bigint:this.d}),new pb.asn1.DERInteger({bigint:this.p}),new pb.asn1.DERInteger({bigint:this.q}),new pb.asn1.DERInteger({bigint:this.dmp1}),new pb.asn1.DERInteger({bigint:this.dmq1}),new pb.asn1.DERInteger({bigint:this.coeff})]},b=new pb.asn1.DERSequence(a);return b.getEncodedHex()},b.prototype.getPrivateBaseKeyB64=function(){return l(this.getPrivateBaseKey())},b.prototype.getPublicBaseKey=function(){var a=new pb.asn1.DERSequence({array:[new pb.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new pb.a