UNPKG

ndn-js

Version:

A JavaScript client library for Named Data Networking

106 lines 581 kB
/* <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a> <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a> <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a> MIT <a href="https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/LICENSE">MIT License</a> <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a> <a href="http://kjur.github.io/jsrsasign/license/">MIT License</a> */ (function(ma,u){"object"===typeof exports?module.exports.printStackTrace=u():"function"===typeof define&&define.amd?define(u):ma.printStackTrace=u()})(this,function(){function ma(u){u=u||{guess:!0};var J=u.e||null,T=!!u.guess,U=u.mode||null;u=new ma.implementation;J=u.run(J,U);return T?u.guessAnonymousFunctions(J):J}ma.implementation=function(){};ma.implementation.prototype={run:function(u,J){u=u||this.createException();J=J||this.mode(u);return"other"===J?this.other(arguments.callee):this[J](u)}, createException:function(){try{this.undef()}catch(u){return u}},mode:function(u){return"undefined"!==typeof window&&-1<window.navigator.userAgent.indexOf("PhantomJS")?"phantomjs":u.arguments&&u.stack?"chrome":u.stack&&u.sourceURL?"safari":u.stack&&u.number?"ie":u.stack&&u.fileName?"firefox":u.message&&u["opera#sourceloc"]?!u.stacktrace||-1<u.message.indexOf("\n")&&u.message.split("\n").length>u.stacktrace.split("\n").length?"opera9":"opera10a":u.message&&u.stack&&u.stacktrace?0>u.stacktrace.indexOf("called from line")? "opera10b":"opera11":u.stack&&!u.fileName?"chrome":"other"},instrumentFunction:function(u,J,T){u=u||window;var U=u[J];u[J]=function(){T.call(this,ma().slice(4));return u[J]._instrumented.apply(this,arguments)};u[J]._instrumented=U},deinstrumentFunction:function(u,J){u[J].constructor===Function&&u[J]._instrumented&&u[J]._instrumented.constructor===Function&&(u[J]=u[J]._instrumented)},chrome:function(u){return(u.stack+"\n").replace(/^[\s\S]+?\s+at\s+/," at ").replace(/^\s+(at eval )?at\s+/gm,"").replace(/^([^\(]+?)([\n$])/gm, "{anonymous}() ($1)$2").replace(/^Object.<anonymous>\s*\(([^\)]+)\)/gm,"{anonymous}() ($1)").replace(/^(.+) \((.+)\)$/gm,"$1@$2").split("\n").slice(0,-1)},safari:function(u){return u.stack.replace(/\[native code\]\n/m,"").replace(/^(?=\w+Error\:).*$\n/m,"").replace(/^@/gm,"{anonymous}()@").split("\n")},ie:function(u){return u.stack.replace(/^\s*at\s+(.*)$/gm,"$1").replace(/^Anonymous function\s+/gm,"{anonymous}() ").replace(/^(.+)\s+\((.+)\)$/gm,"$1@$2").split("\n").slice(1)},firefox:function(u){return u.stack.replace(/(?:\n@:0)?\s+$/m, "").replace(/^(?:\((\S*)\))?@/gm,"{anonymous}($1)@").split("\n")},opera11:function(u){var J=/^.*line (\d+), column (\d+)(?: in (.+))? in (\S+):$/;u=u.stacktrace.split("\n");for(var T=[],U=0,X=u.length;U<X;U+=2){var K=J.exec(u[U]);if(K){var z=K[4]+":"+K[1]+":"+K[2],K=K[3]||"global code",K=K.replace(/<anonymous function: (\S+)>/,"$1").replace(/<anonymous function>/,"{anonymous}");T.push(K+"@"+z+" -- "+u[U+1].replace(/^\s+/,""))}}return T},opera10b:function(u){var J=/^(.*)@(.+):(\d+)$/;u=u.stacktrace.split("\n"); for(var T=[],U=0,X=u.length;U<X;U++){var K=J.exec(u[U]);K&&T.push((K[1]?K[1]+"()":"global code")+"@"+K[2]+":"+K[3])}return T},opera10a:function(u){var J=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;u=u.stacktrace.split("\n");for(var T=[],U=0,X=u.length;U<X;U+=2){var K=J.exec(u[U]);K&&T.push((K[3]||"{anonymous}")+"()@"+K[2]+":"+K[1]+" -- "+u[U+1].replace(/^\s+/,""))}return T},opera9:function(u){var J=/Line (\d+).*script (?:in )?(\S+)/i;u=u.message.split("\n");for(var T=[],U=2,X=u.length;U< X;U+=2){var K=J.exec(u[U]);K&&T.push("{anonymous}()@"+K[2]+":"+K[1]+" -- "+u[U+1].replace(/^\s+/,""))}return T},phantomjs:function(u){var J=/(\S+) \((\S+)\)/i;u=u.stack.split("\n");for(var T=[],U=1,X=u.length;U<X;U++){u[U]=u[U].replace(/^\s+at\s+/gm,"");var K=J.exec(u[U]);K?T.push(K[1]+"()@"+K[2]):T.push("{anonymous}()@"+u[U])}return T},other:function(u){for(var J=/function(?:\s+([\w$]+))?\s*\(/,T=[],U,X,K=Array.prototype.slice;u&&10>T.length;){U=J.test(u.toString())?RegExp.$1||"{anonymous}":"{anonymous}"; try{X=K.call(u.arguments||[])}catch(z){X=["Cannot access arguments: "+z]}T[T.length]=U+"("+this.stringifyArguments(X)+")";try{u=u.caller}catch(ma){T[T.length]="Cannot access caller: "+ma;break}}return T},stringifyArguments:function(u){for(var J=[],T=Array.prototype.slice,U=0;U<u.length;++U){var X=u[U];void 0===X?J[U]="undefined":null===X?J[U]="null":X.constructor&&(J[U]=X.constructor===Array?3>X.length?"["+this.stringifyArguments(X)+"]":"["+this.stringifyArguments(T.call(X,0,1))+"..."+this.stringifyArguments(T.call(X, -1))+"]":X.constructor===Object?"#object":X.constructor===Function?"#function":X.constructor===String?'"'+X+'"':X.constructor===Number?X:"?")}return J.join(",")},sourceCache:{},ajax:function(u){var J=this.createXMLHTTPObject();if(J)try{return J.open("GET",u,!1),J.send(null),J.responseText}catch(T){}return""},createXMLHTTPObject:function(){for(var u,J=[function(){return new XMLHttpRequest},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml3.XMLHTTP")}, function(){return new ActiveXObject("Microsoft.XMLHTTP")}],T=0;T<J.length;T++)try{return u=J[T](),this.createXMLHTTPObject=J[T],u}catch(U){}},isSameDomain:function(u){return"undefined"!==typeof location&&-1!==u.indexOf(location.hostname)},getSource:function(u){u in this.sourceCache||(this.sourceCache[u]=this.ajax(u).split("\n"));return this.sourceCache[u]},guessAnonymousFunctions:function(u){for(var J=0;J<u.length;++J){var T=/^(.*?)(?::(\d+))(?::(\d+))?(?: -- .+)?$/,U=u[J],X=/\{anonymous\}\(.*\)@(.*)/.exec(U); if(X){var K=T.exec(X[1]);K&&(T=K[1],X=K[2],K=K[3]||0,T&&this.isSameDomain(T)&&X&&(T=this.guessAnonymousFunction(T,X,K),u[J]=U.replace("{anonymous}",T)))}}return u},guessAnonymousFunction:function(u,J,T){var U;try{U=this.findFunctionName(this.getSource(u),J)}catch(X){U="getSource failed with url: "+u+", exception: "+X.toString()}return U},findFunctionName:function(u,J){for(var T=/function\s+([^(]*?)\s*\(([^)]*)\)/,U=/['"]?([$_A-Za-z][$_A-Za-z0-9]*)['"]?\s*[:=]\s*function\b/,X=/['"]?([$_A-Za-z][$_A-Za-z0-9]*)['"]?\s*[:=]\s*(?:eval|new Function)\b/, K="",z,ma=Math.min(J,20),sd,Jb=0;Jb<ma;++Jb)if(z=u[J-Jb-1],sd=z.indexOf("//"),0<=sd&&(z=z.substr(0,sd)),z)if(K=z+K,(z=U.exec(K))&&z[1]||(z=T.exec(K))&&z[1]||(z=X.exec(K))&&z[1])return z[1];return"(?)"}};return ma}); (function(ma){function u(e){var k="",g,d=0,q,p;for(g=0;g<e.length&&e.charAt(g)!=Gd;++g)p=Wb.indexOf(e.charAt(g)),0>p||(0==d?(k+=Xb.charAt(p>>2),q=p&3,d=1):1==d?(k+=Xb.charAt(q<<2|p>>4),q=p&15,d=2):2==d?(k+=Xb.charAt(q),k+=Xb.charAt(p>>2),q=p&3,d=3):(k+=Xb.charAt(q<<2|p>>4),k+=Xb.charAt(p&15),d=0));1==d&&(k+=Xb.charAt(q<<2));return k}function J(){this.j=this.i=0;this.S=[]}function T(){var e=(new Date).getTime();Cb[Pa++]^=e&255;Cb[Pa++]^=e>>8&255;Cb[Pa++]^=e>>16&255;Cb[Pa++]^=e>>24&255;Pa>=Hd&&(Pa-= Hd)}function U(){}function X(e,k){return new B(e,k)}function K(e,k,g){for(var d="",q=0;d.length<k;)d+=g(String.fromCharCode.apply(String,e.concat([(q&4278190080)>>24,(q&16711680)>>16,(q&65280)>>8,q&255]))),q+=1;return d}function z(){this.n=null;this.e=0;this.coeff=this.dmq1=this.dmp1=this.q=this.p=this.d=null}function Td(e,k,g){for(var d="",q=0;d.length<k;)d+=g(e+String.fromCharCode.apply(String,[(q&4278190080)>>24,(q&16711680)>>16,(q&65280)>>8,q&255])),q+=1;return d}function sd(e){var k=[],g=H.getStartPosOfV_AtObj(e, 0),d=H.getPosOfNextSibling_AtObj(e,g),q=H.getPosOfNextSibling_AtObj(e,d),p=H.getPosOfNextSibling_AtObj(e,q),a=H.getPosOfNextSibling_AtObj(e,p),b=H.getPosOfNextSibling_AtObj(e,a),c=H.getPosOfNextSibling_AtObj(e,b),f=H.getPosOfNextSibling_AtObj(e,c),h=H.getPosOfNextSibling_AtObj(e,f);k.push(g,d,q,p,a,b,c,f,h);g=H.getHexOfV_AtObj(e,k[0]);d=H.getHexOfV_AtObj(e,k[1]);q=H.getHexOfV_AtObj(e,k[2]);p=H.getHexOfV_AtObj(e,k[3]);a=H.getHexOfV_AtObj(e,k[4]);b=H.getHexOfV_AtObj(e,k[5]);c=H.getHexOfV_AtObj(e,k[6]); f=H.getHexOfV_AtObj(e,k[7]);e=H.getHexOfV_AtObj(e,k[8]);k=[];k.push(g,d,q,p,a,b,c,f,e);return k}function Jb(e,k){for(var g="",d=k/4-e.length,q=0;q<d;q++)g+="0";return g+e}function Ud(e,k){var g=O.crypto.Util.hashString(e,k);return this.signWithMessageHash(g,k)}function te(e){return Ud.call(this,e,"sha1")}function ue(e){return Ud.call(this,e,"sha256")}function ve(e,k,g){for(var d="",q=0;d.length<k;)d+=hextorstr(g(rstrtohex(e+String.fromCharCode.apply(String,[(q&4278190080)>>24,(q&16711680)>>16,(q& 65280)>>8,q&255])))),q+=1;return d}function we(e,k,g){e=rstrtohex(e);e=O.crypto.Util.hashHex(e,k);void 0===g&&(g=-1);return this.signWithMessageHashPSS(e,k,g)}function de(e){for(var k in O.crypto.Util.DIGESTINFOHEAD){var g=O.crypto.Util.DIGESTINFOHEAD[k],d=g.length;if(e.substring(0,d)==g)return[k,e.substring(d)]}return[]}function ud(e,k){var g=X(e,16);var d=this.n.toString(16),q=this.e.toString(16),p=new z;p.setPublic(d,q);g=p.doPublic(g).toString(16).replace(/^1f+00/,"");d=de(g);0==d.length?g=!1: (g=d[1],d=O.crypto.Util.hashString(k,d[0]),g=g==d);return g}function Id(e,k){k=k.replace(Vd,"");k=k.replace(/[ \n]+/g,"");var g=X(k,16);if(g.bitLength()>this.n.bitLength())return 0;var g=this.doPublic(g).toString(16).replace(/^1f+00/,""),d=de(g);if(0==d.length)return!1;g=d[1];d=O.crypto.Util.hashString(e,d[0]);return g==d}function ee(e,k,g,d){e=rstrtohex(e);e=O.crypto.Util.hashHex(e,g);void 0===d&&(d=-1);return this.verifyWithMessageHashPSS(e,k,g,d)}function ga(){this.hex=this.subjectPublicKeyRSA_hE= this.subjectPublicKeyRSA_hN=this.subjectPublicKeyRSA=null;this.getSerialNumberHex=function(){return H.getDecendantHexVByNthList(this.hex,0,[0,1])};this.getIssuerHex=function(){return H.getDecendantHexTLVByNthList(this.hex,0,[0,3])};this.getIssuerString=function(){return ga.hex2dn(H.getDecendantHexTLVByNthList(this.hex,0,[0,3]))};this.getSubjectHex=function(){return H.getDecendantHexTLVByNthList(this.hex,0,[0,5])};this.getSubjectString=function(){return ga.hex2dn(H.getDecendantHexTLVByNthList(this.hex, 0,[0,5]))};this.getNotBefore=function(){var e=H.getDecendantHexVByNthList(this.hex,0,[0,4,0]),e=e.replace(/(..)/g,"%$1");return e=decodeURIComponent(e)};this.getNotAfter=function(){var e=H.getDecendantHexVByNthList(this.hex,0,[0,4,1]),e=e.replace(/(..)/g,"%$1");return e=decodeURIComponent(e)};this.readCertPEM=function(e){e=ga.pemToHex(e);var k=ga.getPublicKeyHexArrayFromCertHex(e),g=new z;g.setPublic(k[0],k[1]);this.subjectPublicKeyRSA=g;this.subjectPublicKeyRSA_hN=k[0];this.subjectPublicKeyRSA_hE= k[1];this.hex=e};this.readCertPEMWithoutRSAInit=function(e){e=ga.pemToHex(e);var k=ga.getPublicKeyHexArrayFromCertHex(e);this.subjectPublicKeyRSA.setPublic(k[0],k[1]);this.subjectPublicKeyRSA_hN=k[0];this.subjectPublicKeyRSA_hE=k[1];this.hex=e}}function ia(){return new B(null)}function Nb(e,k,g,d,q,p){for(;0<=--p;){var a=k*this[e++]+g[d]+q;q=Math.floor(a/67108864);g[d++]=a&67108863}return q}function xe(e,k,g,d,q,p){var a=k&32767;for(k>>=15;0<=--p;){var b=this[e]&32767,c=this[e++]>>15,f=k*b+c*a,b= a*b+((f&32767)<<15)+g[d]+(q&1073741823);q=(b>>>30)+(f>>>15)+k*c+(q>>>30);g[d++]=b&1073741823}return q}function fe(e,k,g,d,q,p){var a=k&16383;for(k>>=14;0<=--p;){var b=this[e]&16383,c=this[e++]>>14,f=k*b+c*a,b=a*b+((f&16383)<<14)+g[d]+q;q=(b>>28)+(f>>14)+k*c;g[d++]=b&268435455}return q}function $c(e,k){var g=ye[e.charCodeAt(k)];return null==g?-1:g}function Kc(e){var k=ia();k.fromInt(e);return k}function Jd(e){var k=1,g;0!=(g=e>>>16)&&(e=g,k+=16);0!=(g=e>>8)&&(e=g,k+=8);0!=(g=e>>4)&&(e=g,k+=4);0!=(g= e>>2)&&(e=g,k+=2);0!=e>>1&&(k+=1);return k}function zc(e){this.m=e}function Qa(e){this.m=e;this.mp=e.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<e.DB-15)-1;this.mt2=2*e.t}function Me(e,k){return e&k}function Wd(e,k){return e|k}function Xd(e,k){return e^k}function ad(e,k){return e&~k}function bd(){}function Kd(e){return e}function Lc(e){this.r2=ia();this.q3=ia();B.ONE.dlShiftTo(2*e.t,this.r2);this.mu=this.r2.divide(e);this.m=e}function h(e,k,g){if(!(this instanceof h))return new h(e, k,g);var d=typeof e;if("base64"===k&&"string"===d)for(e=h.stringtrim(e);0!==e.length%4;)e+="=";var q;if("number"===d)q=h.coerce(e);else if("string"===d)q=h.byteLength(e,k);else if("object"===d)q=h.coerce(e.length);else throw Error("First argument needs to be a number, array or string.");var p;h._useTypedArrays?p=h._augment(new Uint8Array(q)):(p=this,p.length=q,p._isBuffer=!0);if(h._useTypedArrays&&"number"===typeof e.byteLength)p._set(e);else if(h.isArrayish(e))if(h.isBuffer(e))for(k=0;k<q;k++)p[k]= e.readUInt8(k);else for(k=0;k<q;k++)p[k]=(e[k]%256+256)%256;else if("string"===d)p.write(e,0,k);else if("number"===d&&!h._useTypedArrays&&!g)for(k=0;k<q;k++)p[k]=0;return p}function S(e){if(e)return e.__proto__=S.prototype,e}function ua(e){if(e)return e.__proto__=ua.prototype,e}function Ob(e){if(e)return e.__proto__=Ob.prototype,e}function x(e){if(e)return e.__proto__=x.prototype,e}function Mc(e){x.call(this,e)}function E(e){x.call(this,e)}function ec(e){if(e)return e.__proto__=ec.prototype,e}var a= a||{},r=a;r.printStackTrace=ma.printStackTrace;var Gb=function(){var e=!1;if("undefined"!==typeof crypto&&crypto&&crypto.subtle){var k={name:"RSASSA-PKCS1-v1_5",modulusLength:2048,hash:{name:"SHA-256"},publicExponent:new Uint8Array([1,0,1])},g;crypto.subtle.generateKey(k,!0,["sign","verify"]).then(function(d){g=d;return crypto.subtle.sign(k,d.privateKey,new Uint8Array([1,2,3,4,5]))}).then(function(d){return crypto.subtle.verify(k,g.publicKey,d,new Uint8Array([1,2,3,4,5]))}).then(function(d){return crypto.subtle.exportKey("pkcs8", g.privateKey)}).then(function(d){return crypto.subtle.importKey("pkcs8",d,k,!0,["sign"])}).then(function(d){return crypto.subtle.exportKey("spki",g.publicKey)}).then(function(d){return crypto.subtle.importKey("spki",d,k,!0,["verify"])}).then(function(d){d=new Uint8Array([1,2,3,4,5]);return crypto.subtle.digest({name:"SHA-256"},d.buffer)}).then(function(d){e=!0},function(d){console.log("DetectSubtleCrypto encountered error, not using crypto.subtle: ",d)})}return function(){return e}}();r.UseSubtleCrypto= Gb;var Yb=Yb||function(e,k){var g={},d=g.lib={},q=d.Base=function(){function d(){}return{extend:function(e){d.prototype=this;var g=new d;e&&g.mixIn(e);g.hasOwnProperty("init")||(g.init=function(){g.$super.init.apply(this,arguments)});g.init.prototype=g;g.$super=this;return g},create:function(){var d=this.extend();d.init.apply(d,arguments);return d},init:function(){},mixIn:function(d){for(var e in d)d.hasOwnProperty(e)&&(this[e]=d[e]);d.hasOwnProperty("toString")&&(this.toString=d.toString)},clone:function(){return this.init.prototype.extend(this)}}}(), p=d.WordArray=q.extend({init:function(d,e){d=this.words=d||[];this.sigBytes=e!=k?e:4*d.length},toString:function(d){return(d||b).stringify(this)},concat:function(d){var e=this.words,g=d.words,k=this.sigBytes;d=d.sigBytes;this.clamp();if(k%4)for(var q=0;q<d;q++)e[k+q>>>2]|=(g[q>>>2]>>>24-q%4*8&255)<<24-(k+q)%4*8;else for(q=0;q<d;q+=4)e[k+q>>>2]=g[q>>>2];this.sigBytes+=d;return this},clamp:function(){var d=this.words,g=this.sigBytes;d[g>>>2]&=4294967295<<32-g%4*8;d.length=e.ceil(g/4)},clone:function(){var d= q.clone.call(this);d.words=this.words.slice(0);return d},random:function(d){for(var g=[],k=0;k<d;k+=4)g.push(4294967296*e.random()|0);return new p.init(g,d)}}),a=g.enc={},b=a.Hex={stringify:function(d){var e=d.words;d=d.sigBytes;for(var g=[],k=0;k<d;k++){var q=e[k>>>2]>>>24-k%4*8&255;g.push((q>>>4).toString(16));g.push((q&15).toString(16))}return g.join("")},parse:function(d){for(var e=d.length,g=[],k=0;k<e;k+=2)g[k>>>3]|=parseInt(d.substr(k,2),16)<<24-k%8*4;return new p.init(g,e/2)}},c=a.Latin1= {stringify:function(d){var e=d.words;d=d.sigBytes;for(var g=[],k=0;k<d;k++)g.push(String.fromCharCode(e[k>>>2]>>>24-k%4*8&255));return g.join("")},parse:function(d){for(var e=d.length,g=[],k=0;k<e;k++)g[k>>>2]|=(d.charCodeAt(k)&255)<<24-k%4*8;return new p.init(g,e)}},f=a.Utf8={stringify:function(d){try{return decodeURIComponent(escape(c.stringify(d)))}catch(e){throw Error("Malformed UTF-8 data");}},parse:function(d){return c.parse(unescape(encodeURIComponent(d)))}},h=d.BufferedBlockAlgorithm=q.extend({reset:function(){this._data= new p.init;this._nDataBytes=0},_append:function(d){"string"==typeof d&&(d=f.parse(d));this._data.concat(d);this._nDataBytes+=d.sigBytes},_process:function(d){var g=this._data,k=g.words,q=g.sigBytes,a=this.blockSize,b=q/(4*a),b=d?e.ceil(b):e.max((b|0)-this._minBufferSize,0);d=b*a;q=e.min(4*d,q);if(d){for(var td=0;td<d;td+=a)this._doProcessBlock(k,td);td=k.splice(0,d);g.sigBytes-=q}return new p.init(td,q)},clone:function(){var d=q.clone.call(this);d._data=this._data.clone();return d},_minBufferSize:0}); d.Hasher=h.extend({cfg:q.extend(),init:function(d){this.cfg=this.cfg.extend(d);this.reset()},reset:function(){h.reset.call(this);this._doReset()},update:function(d){this._append(d);this._process();return this},finalize:function(d){d&&this._append(d);return this._doFinalize()},blockSize:16,_createHelper:function(d){return function(e,g){return(new d.init(g)).finalize(e)}},_createHmacHelper:function(d){return function(e,g){return(new l.HMAC.init(d,g)).finalize(e)}}});var l=g.algo={};return g}(Math); r.CryptoJS=Yb;var Ld=a.CryptoJS;(function(e){var k=Ld.lib,g=k.WordArray,d=k.Hasher,k=Ld.algo,q=[],p=[];(function(){function d(g){for(var k=e.sqrt(g),q=2;q<=k;q++)if(!(g%q))return!1;return!0}function g(d){return 4294967296*(d-(d|0))|0}for(var k=2,a=0;64>a;)d(k)&&(8>a&&(q[a]=g(e.pow(k,0.5))),p[a]=g(e.pow(k,1/3)),a++),k++})();var a=[],k=k.SHA256=d.extend({_doReset:function(){this._hash=new g.init(q.slice(0))},_doProcessBlock:function(d,e){for(var g=this._hash.words,k=g[0],q=g[1],b=g[2],c=g[3],f=g[4], h=g[5],l=g[6],n=g[7],m=0;64>m;m++){if(16>m)a[m]=d[e+m]|0;else{var s=a[m-15],r=a[m-2];a[m]=((s<<25|s>>>7)^(s<<14|s>>>18)^s>>>3)+a[m-7]+((r<<15|r>>>17)^(r<<13|r>>>19)^r>>>10)+a[m-16]}s=n+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&h^~f&l)+p[m]+a[m];r=((k<<30|k>>>2)^(k<<19|k>>>13)^(k<<10|k>>>22))+(k&q^k&b^q&b);n=l;l=h;h=f;f=c+s|0;c=b;b=q;q=k;k=s+r|0}g[0]=g[0]+k|0;g[1]=g[1]+q|0;g[2]=g[2]+b|0;g[3]=g[3]+c|0;g[4]=g[4]+f|0;g[5]=g[5]+h|0;g[6]=g[6]+l|0;g[7]=g[7]+n|0},_doFinalize:function(){var d=this._data, g=d.words,k=8*this._nDataBytes,q=8*d.sigBytes;g[q>>>5]|=128<<24-q%32;g[(q+64>>>9<<4)+14]=e.floor(k/4294967296);g[(q+64>>>9<<4)+15]=k;d.sigBytes=4*g.length;this._process();return this._hash},clone:function(){var e=d.clone.call(this);e._hash=this._hash.clone();return e}});Ld.SHA256=d._createHelper(k);Ld.HmacSHA256=d._createHmacHelper(k)})(Math);r.CryptoJS=Ld;(function(){var e=Yb,k=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,d){e=this._hasher=new e.init;"string"==typeof d&&(d=k.parse(d)); var q=e.blockSize,p=4*q;d.sigBytes>p&&(d=e.finalize(d));d.clamp();for(var a=this._oKey=d.clone(),b=this._iKey=d.clone(),c=a.words,f=b.words,h=0;h<q;h++)c[h]^=1549556828,f[h]^=909522486;a.sigBytes=b.sigBytes=p;this.reset()},reset:function(){var e=this._hasher;e.reset();e.update(this._iKey)},update:function(e){this._hasher.update(e);return this},finalize:function(e){var d=this._hasher;e=d.finalize(e);d.reset();return d.finalize(this._oKey.clone().concat(e))}})})();var Wb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Gd="=";r.b64tohex=u;r.b64toBA=function(e){e=u(e);var k,g=[];for(k=0;2*k<e.length;++k)g[k]=parseInt(e.substring(2*k,2*k+2),16);return g};r.hex2b64=function(e){var k,g,d="";for(k=0;k+3<=e.length;k+=3)g=parseInt(e.substring(k,k+3),16),d+=Wb.charAt(g>>6)+Wb.charAt(g&63);k+1==e.length?(g=parseInt(e.substring(k,k+1),16),d+=Wb.charAt(g<<2)):k+2==e.length&&(g=parseInt(e.substring(k,k+2),16),d+=Wb.charAt(g>>2)+Wb.charAt((g&3)<<4));if(Gd)for(;0<(d.length&3);)d+=Gd;return d};J.prototype.init=function(e){var k, g,d;for(k=0;256>k;++k)this.S[k]=k;for(k=g=0;256>k;++k)g=g+this.S[k]+e[k%e.length]&255,d=this.S[k],this.S[k]=this.S[g],this.S[g]=d;this.j=this.i=0};J.prototype.next=function(){var e;this.i=this.i+1&255;this.j=this.j+this.S[this.i]&255;e=this.S[this.i];this.S[this.i]=this.S[this.j];this.S[this.j]=e;return this.S[e+this.S[this.i]&255]};var Hd=256,Ac,Cb,Pa;if(null==Cb){Cb=[];Pa=0;var cd;if("Netscape"==navigator.appName&&"5">navigator.appVersion&&window.crypto){var Nc=window.crypto.random(32);for(cd=0;cd< Nc.length;++cd)Cb[Pa++]=Nc.charCodeAt(cd)&255}for(;Pa<Hd;)cd=Math.floor(65536*Math.random()),Cb[Pa++]=cd>>>8,Cb[Pa++]=cd&255;Pa=0;T()}U.prototype.nextBytes=function(e){var k;for(k=0;k<e.length;++k){var g=e,d=k,q;if(null==Ac){T();Ac=new J;Ac.init(Cb);for(Pa=0;Pa<Cb.length;++Pa)Cb[Pa]=0;Pa=0}q=Ac.next();g[d]=q}};var jc=a,Pb=20;z.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)};z.prototype.setPublic=function(e,k){this.isPublic=!0;"string"!==typeof e?(this.n=e,this.e=k):null!=e&&null!= k&&0<e.length&&0<k.length?(this.n=X(e,16),this.e=parseInt(k,16)):alert("Invalid RSA public key")};z.prototype.encrypt=function(e){var k;k=this.n.bitLength()+7>>3;if(k<e.length+11)alert("Message too long for RSA"),k=null;else{for(var g=[],d=e.length-1;0<=d&&0<k;){var q=e.charCodeAt(d--);128>q?g[--k]=q:127<q&&2048>q?(g[--k]=q&63|128,g[--k]=q>>6|192):(g[--k]=q&63|128,g[--k]=q>>6&63|128,g[--k]=q>>12|224)}g[--k]=0;e=new U;for(d=[];2<k;){for(d[0]=0;0==d[0];)e.nextBytes(d);g[--k]=d[0]}g[--k]=2;g[--k]=0; k=new B(g)}if(null==k)return null;k=this.doPublic(k);if(null==k)return null;k=k.toString(16);return 0==(k.length&1)?k:"0"+k};z.prototype.encryptOAEP=function(e,k){var g,d=this.n.bitLength()+7>>3;if(e.length+2*Pb+2>d)throw"Message too long for RSA";var q="";for(g=0;g<d-e.length-2*Pb-2;g+=1)q+="\x00";var p=rstr_sha1("")+q+"\u0001"+e,d=Array(Pb);(new U).nextBytes(d);var a=K(d,p.length,k||rstr_sha1),q=[];for(g=0;g<p.length;g+=1)q[g]=p.charCodeAt(g)^a.charCodeAt(g);p=K(q,d.length,rstr_sha1);a=[0];for(g= 0;g<d.length;g+=1)a[g+1]=d[g]^p.charCodeAt(g);g=new B(a.concat(q));if(null==g)return null;g=this.doPublic(g);if(null==g)return null;g=g.toString(16);return 0==(g.length&1)?g:"0"+g};z.prototype.type="RSA";r.RSAKey=z;var jc=a,B=jc.BigInteger?jc.BigInteger:jc,z=a.RSAKey,Pb=20;z.prototype.doPrivate=function(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);var k=e.mod(this.p).modPow(this.dmp1,this.p);for(e=e.mod(this.q).modPow(this.dmq1,this.q);0>k.compareTo(e);)k=k.add(this.p);return k.subtract(e).multiply(this.coeff).mod(this.p).multiply(this.q).add(e)}; z.prototype.setPrivate=function(e,k,g){this.isPrivate=!0;"string"!==typeof e?(this.n=e,this.e=k,this.d=g):null!=e&&null!=k&&0<e.length&&0<k.length?(this.n=X(e,16),this.e=parseInt(k,16),this.d=X(g,16)):alert("Invalid RSA private key")};z.prototype.setPrivateEx=function(e,k,g,d,q,p,a,b){this.isPrivate=!0;if(null==e)throw"RSASetPrivateEx N == null";if(null==k)throw"RSASetPrivateEx E == null";if(0==e.length)throw"RSASetPrivateEx N.length == 0";if(0==k.length)throw"RSASetPrivateEx E.length == 0";null!= e&&null!=k&&0<e.length&&0<k.length?(this.n=X(e,16),this.e=parseInt(k,16),this.d=X(g,16),this.p=X(d,16),this.q=X(q,16),this.dmp1=X(p,16),this.dmq1=X(a,16),this.coeff=X(b,16)):alert("Invalid RSA private key in RSASetPrivateEx")};z.prototype.generate=function(e,k){var g=new U,d=e>>1;this.e=parseInt(k,16);for(var q=new B(k,16);;){for(;this.p=new B(e-d,1,g),0!=this.p.subtract(B.ONE).gcd(q).compareTo(B.ONE)||!this.p.isProbablePrime(10););for(;this.q=new B(d,1,g),0!=this.q.subtract(B.ONE).gcd(q).compareTo(B.ONE)|| !this.q.isProbablePrime(10););if(0>=this.p.compareTo(this.q)){var p=this.p;this.p=this.q;this.q=p}var p=this.p.subtract(B.ONE),a=this.q.subtract(B.ONE),b=p.multiply(a);if(0==b.gcd(q).compareTo(B.ONE)){this.n=this.p.multiply(this.q);this.d=q.modInverse(b);this.dmp1=this.d.mod(p);this.dmq1=this.d.mod(a);this.coeff=this.q.modInverse(this.p);break}}this.isPrivate=!0};z.prototype.decrypt=function(e){e=X(e,16);e=this.doPrivate(e);if(null==e)return null;a:{var k=this.n.bitLength()+7>>3;e=e.toByteArray(); for(var g=0;g<e.length&&0==e[g];)++g;if(e.length-g!=k-1||2!=e[g])e=null;else{for(++g;0!=e[g];)if(++g>=e.length){e=null;break a}for(k="";++g<e.length;){var d=e[g]&255;128>d?k+=String.fromCharCode(d):191<d&&224>d?(k+=String.fromCharCode((d&31)<<6|e[g+1]&63),++g):(k+=String.fromCharCode((d&15)<<12|(e[g+1]&63)<<6|e[g+2]&63),g+=2)}e=k}}return e};z.prototype.decryptOAEP=function(e,k){var g=X(e,16),g=this.doPrivate(g);if(null==g)return null;for(var d=g,q=this.n.bitLength()+7>>3,d=d.toByteArray(),g=0;g<d.length;g+= 1)d[g]&=255;for(;d.length<q;)d.unshift(0);d=String.fromCharCode.apply(String,d);if(d.length<2*Pb+2)throw"Cipher too short";for(var p=d.substr(1,Pb),q=d.substr(Pb+1),a=Td(q,Pb,k||rstr_sha1),b=[],g=0;g<p.length;g+=1)b[g]=p.charCodeAt(g)^a.charCodeAt(g);p=Td(String.fromCharCode.apply(String,b),d.length-Pb,rstr_sha1);d=[];for(g=0;g<q.length;g+=1)d[g]=q.charCodeAt(g)^p.charCodeAt(g);d=String.fromCharCode.apply(String,d);if(d.substr(0,Pb)!==rstr_sha1(""))throw"Hash mismatch";d=d.substr(Pb);g=d.indexOf("\u0001"); if((-1!=g?d.substr(0,g).lastIndexOf("\x00"):-1)+1!=g)throw"Malformed data";return d.substr(g+1)};r.RSAKey=z;Yb=a.CryptoJS;jc=a;"undefined"!=typeof O&&O||(O={});"undefined"!=typeof O.crypto&&O.crypto||(O.crypto={});O.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410", md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"};this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa", SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa", SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"};this.CRYPTOJSMESSAGEDIGESTNAME={md5:"CryptoJS.algo.MD5",sha1:"CryptoJS.algo.SHA1",sha224:"CryptoJS.algo.SHA224",sha256:"CryptoJS.algo.SHA256",sha384:"CryptoJS.algo.SHA384",sha512:"CryptoJS.algo.SHA512",ripemd160:"CryptoJS.algo.RIPEMD160"};this.getDigestInfoHex=function(e,k){if("undefined"==typeof this.DIGESTINFOHEAD[k])throw"alg not supported in Util.DIGESTINFOHEAD: "+ k;return this.DIGESTINFOHEAD[k]+e};this.getPaddedDigestInfoHex=function(e,k,g){var d=this.getDigestInfoHex(e,k);e=g/4;if(d.length+22>e)throw"key is too short for SigAlg: keylen="+g+","+k;k="00"+d;g="";e=e-4-k.length;for(d=0;d<e;d+=2)g+="ff";return"0001"+g+k};this.hashString=function(e,k){return(new O.crypto.MessageDigest({alg:k})).digestString(e)};this.hashHex=function(e,k){return(new O.crypto.MessageDigest({alg:k})).digestHex(e)};this.sha1=function(e){return(new O.crypto.MessageDigest({alg:"sha1", prov:"cryptojs"})).digestString(e)};this.sha256=function(e){return(new O.crypto.MessageDigest({alg:"sha256",prov:"cryptojs"})).digestString(e)};this.sha256Hex=function(e){return(new O.crypto.MessageDigest({alg:"sha256",prov:"cryptojs"})).digestHex(e)};this.sha512=function(e){return(new O.crypto.MessageDigest({alg:"sha512",prov:"cryptojs"})).digestString(e)};this.sha512Hex=function(e){return(new O.crypto.MessageDigest({alg:"sha512",prov:"cryptojs"})).digestHex(e)};this.md5=function(e){return(new O.crypto.MessageDigest({alg:"md5", prov:"cryptojs"})).digestString(e)};this.ripemd160=function(e){return(new O.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"})).digestString(e)};this.getCryptoJSMDByName=function(e){}};O.crypto.MessageDigest=function(e){this.setAlgAndProvider=function(e,g){null!=e&&void 0===g&&(g=O.crypto.Util.DEFAULTPROVIDER[e]);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(e)&&"cryptojs"==g){try{this.md=eval(O.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[e]).create()}catch(d){throw"setAlgAndProvider hash alg set fail alg="+ e+"/"+d;}this.updateString=function(d){this.md.update(d)};this.updateHex=function(d){d=Yb.enc.Hex.parse(d);this.md.update(d)};this.digest=function(){return this.md.finalize().toString(Yb.enc.Hex)};this.digestString=function(d){this.updateString(d);return this.digest()};this.digestHex=function(d){this.updateHex(d);return this.digest()}}if(-1!=":sha256:".indexOf(e)&&"sjcl"==g){try{this.md=new sjcl.hash.sha256}catch(q){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+q;}this.updateString=function(d){this.md.update(d)}; this.updateHex=function(d){d=sjcl.codec.hex.toBits(d);this.md.update(d)};this.digest=function(){var d=this.md.finalize();return sjcl.codec.hex.fromBits(d)};this.digestString=function(d){this.updateString(d);return this.digest()};this.digestHex=function(d){this.updateHex(d);return this.digest()}}};this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName;};this.updateHex=function(e){throw"updateHex(hex) not supported for this alg/prov: "+ this.algName+"/"+this.provName;};this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName;};this.digestString=function(e){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName;};this.digestHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName;};void 0!==e&&void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=O.crypto.Util.DEFAULTPROVIDER[this.algName]), this.setAlgAndProvider(this.algName,this.provName))};O.crypto.Mac=function(e){this.setAlgAndProvider=function(e,g){e=e.toLowerCase();null==e&&(e="hmacsha1");e=e.toLowerCase();if("hmac"!=e.substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+e;void 0===g&&(g=O.crypto.Util.DEFAULTPROVIDER[e]);this.algProv=e+"/"+g;var d=e.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(d)&&"cryptojs"==g){try{var q=eval(O.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[d]);this.mac=Yb.algo.HMAC.create(q, this.pass)}catch(p){throw"setAlgAndProvider hash alg set fail hashAlg="+d+"/"+p;}this.updateString=function(d){this.mac.update(d)};this.updateHex=function(d){d=Yb.enc.Hex.parse(d);this.mac.update(d)};this.doFinal=function(){return this.mac.finalize().toString(Yb.enc.Hex)};this.doFinalString=function(d){this.updateString(d);return this.doFinal()};this.doFinalHex=function(d){this.updateHex(d);return this.doFinal()}}};this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+ this.algProv;};this.updateHex=function(e){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv;};this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv;};this.doFinalString=function(e){throw"digestString(str) not supported for this alg/prov: "+this.algProv;};this.doFinalHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv;};this.setPassword=function(e){if("string"==typeof e){var g=e;1!=e.length%2&&e.match(/^[0-9A-Fa-f]+$/)|| (g=rstrtohex(e))}else{if("object"!=typeof e)throw"KJUR.crypto.Mac unsupported password type: "+e;g=null;if(void 0!==e.hex){if(0!=e.hex.length%2||!e.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+e.hex;g=e.hex}void 0!==e.utf8&&(g=utf8tohex(e.utf8));void 0!==e.rstr&&(g=rstrtohex(e.rstr));void 0!==e.b64&&(g=u(e.b64));void 0!==e.b64u&&(g=b64utohex(e.b64u));if(null==g)throw"KJUR.crypto.Mac unsupported password type: "+e;}this.pass=Yb.enc.Hex.parse(g)};void 0!==e&&(void 0!==e.pass&&this.setPassword(e.pass), void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=O.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))};O.crypto.Signature=function(e){var k=null;this._setAlgNames=function(){this.algName.match(/^(.+)with(.+)$/)&&(this.mdAlgName=RegExp.$1.toLowerCase(),this.pubkeyAlgName=RegExp.$2.toLowerCase())};this._zeroPaddingOfSignature=function(d,e){for(var g="",k=e/4-d.length,a=0;a<k;a++)g+="0";return g+d};this.setAlgAndProvider=function(d,e){this._setAlgNames(); if("cryptojs/jsrsa"!=e)throw"provider not supported: "+e;if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new O.crypto.MessageDigest({alg:this.mdAlgName})}catch(g){throw"setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+g;}this.init=function(d,e){var g=null;try{g=void 0===e?KEYUTIL.getKey(d):KEYUTIL.getKey(d,e)}catch(k){throw"init failed:"+k;}if(!0===g.isPrivate)this.prvKey=g,this.state="SIGN";else if(!0===g.isPublic)this.pubKey=g,this.state= "VERIFY";else throw"init failed.:"+g;};this.initSign=function(d){"string"==typeof d.ecprvhex&&"string"==typeof d.eccurvename?(this.ecprvhex=d.ecprvhex,this.eccurvename=d.eccurvename):this.prvKey=d;this.state="SIGN"};this.initVerifyByPublicKey=function(d){"string"==typeof d.ecpubhex&&"string"==typeof d.eccurvename?(this.ecpubhex=d.ecpubhex,this.eccurvename=d.eccurvename):d instanceof O.crypto.ECDSA?this.pubKey=d:d instanceof z&&(this.pubKey=d);this.state="VERIFY"};this.initVerifyByCertificatePEM=function(d){var e= new ga;e.readCertPEM(d);this.pubKey=e.subjectPublicKeyRSA;this.state="VERIFY"};this.updateString=function(d){this.md.updateString(d)};this.updateHex=function(d){this.md.updateHex(d)};this.sign=function(){this.sHashHex=this.md.digest();if("undefined"!=typeof this.ecprvhex&&"undefined"!=typeof this.eccurvename)this.hSign=(new O.crypto.ECDSA({curve:this.eccurvename})).signHex(this.sHashHex,this.ecprvhex);else if(this.prvKey instanceof z&&"rsaandmgf1"==this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex, this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof z&&"rsa"==this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof O.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else if(this.prvKey instanceof O.crypto.DSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else throw"Signature: unsupported public key alg: "+this.pubkeyAlgName;return this.hSign};this.signString=function(d){this.updateString(d); return this.sign()};this.signHex=function(d){this.updateHex(d);return this.sign()};this.verify=function(d){this.sHashHex=this.md.digest();if("undefined"!=typeof this.ecpubhex&&"undefined"!=typeof this.eccurvename)return(new O.crypto.ECDSA({curve:this.eccurvename})).verifyHex(this.sHashHex,d,this.ecpubhex);if(this.pubKey instanceof z&&"rsaandmgf1"==this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,d,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof z&&"rsa"==this.pubkeyAlgName|| this.pubKey instanceof O.crypto.ECDSA||this.pubKey instanceof O.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,d);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName;}}};this.init=function(d,e){throw"init(key, pass) not supported for this alg:prov="+this.algProvName;};this.initVerifyByPublicKey=function(d){throw"initVerifyByPublicKey(rsaPubKeyy) not supported for this alg:prov="+this.algProvName;};this.initVerifyByCertificatePEM=function(d){throw"initVerifyByCertificatePEM(certPEM) not supported for this alg:prov="+ this.algProvName;};this.initSign=function(d){throw"initSign(prvKey) not supported for this alg:prov="+this.algProvName;};this.updateString=function(d){throw"updateString(str) not supported for this alg:prov="+this.algProvName;};this.updateHex=function(d){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName;};this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName;};this.signString=function(d){throw"digestString(str) not supported for this alg:prov="+ this.algProvName;};this.signHex=function(d){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName;};this.verify=function(d){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName;};this.initParams=e;if(void 0!==e&&(void 0!==e.alg&&(this.algName=e.alg,this.provName=void 0===e.prov?O.crypto.Util.DEFAULTPROVIDER[this.algName]:e.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==e.psssaltlen&& (this.pssSaltLen=e.psssaltlen),void 0!==e.prvkeypem)){if(void 0!==e.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{k=new z,k.readPrivateKeyFromPEMString(e.prvkeypem),this.initSign(k)}catch(g){throw"fatal error to load pem private key: "+g;}}};O.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1", "2b81040023":"secp521r1","2b81040022":"secp384r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}};r.KJUR=O;var H=a.ASN1HEX,u=a.b64tohex,z=a.RSAKey;z.prototype.readPrivateKeyFromPEMString=function(e){e=e.replace("-----BEGIN RSA PRIVATE KEY-----","");e=e.replace("-----END RSA PRIVATE KEY-----","");e=e.replace(/[ \n]+/g,"");e=u(e);e=sd(e);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])};z.prototype.readPrivateKeyFromASN1HexString= function(e){e=sd(e);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])};r.RSAKey=z;var jc=a,B=jc.BigInteger?jc.BigInteger:jc,z=a.RSAKey,Vd=RegExp("");Vd.compile("[^0-9a-f]","gi");z.prototype.signWithMessageHash=function(e,k){var g=O.crypto.Util.getPaddedDigestInfoHex(e,k,this.n.bitLength()),g=X(g,16),g=this.doPrivate(g).toString(16);return Jb(g,this.n.bitLength())};z.prototype.signString=Ud;z.prototype.signStringWithSHA1=te;z.prototype.signStringWithSHA256=ue;z.prototype.sign=Ud;z.prototype.signWithSHA1= te;z.prototype.signWithSHA256=ue;z.prototype.signWithMessageHashPSS=function(e,k,g){var d=hextorstr(e);e=d.length;var q=this.n.bitLength()-1,p=Math.ceil(q/8),a=function(d){return O.crypto.Util.hashHex(d,k)};if(-1===g||void 0===g)g=e;else if(-2===g)g=p-e-2;else if(-2>g)throw"invalid salt length";if(p<e+g+2)throw"data too long";var b="";0<g&&(b=Array(g),(new U).nextBytes(b),b=String.fromCharCode.apply(String,b));for(var c=hextorstr(a(rstrtohex("\x00\x00\x00\x00\x00\x00\x00\x00"+d+b))),f=[],d=0;d<p- g-e-2;d+=1)f[d]=0;g=String.fromCharCode.apply(String,f)+"\u0001"+b;a=ve(c,g.length,a);b=[];for(d=0;d<g.length;d+=1)b[d]=g.charCodeAt(d)^a.charCodeAt(d);b[0]&=~(65280>>8*p-q&255);for(d=0;d<e;d++)b.push(c.charCodeAt(d));b.push(188);return Jb(this.doPrivate(new B(b)).toString(16),this.n.bitLength())};z.prototype.signStringPSS=we;z.prototype.signPSS=we;z.SALT_LEN_HLEN=-1;z.SALT_LEN_MAX=-2;z.prototype.verifyWithMessageHash=function(e,k){k=k.replace(Vd,"");k=k.replace(/[ \n]+/g,"");var g=X(k,16);if(g.bitLength()> this.n.bitLength())return 0;g=this.doPublic(g).toString(16).replace(/^1f+00/,"");g=de(g);return 0==g.length?!1:g[1]==e};z.prototype.verifyString=Id;z.prototype.verifyHexSignatureForMessage=ud;z.prototype.verify=Id;z.prototype.verifyHexSignatureForByteArrayMessage=ud;z.prototype.verifyWithMessageHashPSS=function(e,k,g,d){var q=new B(k,16);if(q.bitLength()>this.n.bitLength())return!1;k=function(d){return O.crypto.Util.hashHex(d,g)};e=hextorstr(e);var p=e.length,a=this.n.bitLength()-1,b=Math.ceil(a/ 8);if(-1===d||void 0===d)d=p;else if(-2===d)d=b-p-2;else if(-2>d)throw"invalid salt length";if(b<p+d+2)throw"data too long";for(var c=this.doPublic(q).toByteArray(),q=0;q<c.length;q+=1)c[q]&=255;for(;c.length<b;)c.unshift(0);if(188!==c[b-1])throw"encoded message does not end in 0xbc";var c=String.fromCharCode.apply(String,c),f=c.substr(0,b-p-1),c=c.substr(f.length,p),h=65280>>8*b-a&255;if(0!==(f.charCodeAt(0)&h))throw"bits beyond keysize not zero";for(var l=ve(c,f.length,k),a=[],q=0;q<f.length;q+= 1)a[q]=f.charCodeAt(q)^l.charCodeAt(q);a[0]&=~h;p=b-p-d-2;for(q=0;q<p;q+=1)if(0!==a[q])throw"leftmost octets not zero";if(1!==a[p])throw"0x01 marker not found";return c===hextorstr(k(rstrtohex("\x00\x00\x00\x00\x00\x00\x00\x00"+e+String.fromCharCode.apply(String,a.slice(-d)))))};z.prototype.verifyStringPSS=ee;z.prototype.verifyPSS=ee;z.SALT_LEN_RECOVER=-2;r.RSAKey=z;"undefined"!=typeof O&&O||(O={});"undefined"!=typeof O.crypto&&O.crypto||(O.crypto={});O.crypto.ECDSA=function(e){var k=new U;this.type= "EC";this.getBigRandom=function(e){return(new B(e.bitLength(),k)).mod(e.subtract(B.ONE)).add(B.ONE)};this.setNamedCurve=function(e){this.ecparams=O.crypto.ECParameterDB.getByName(e);this.pubKeyHex=this.prvKeyHex=null;this.curveName=e};this.setPrivateKeyHex=function(e){this.isPrivate=!0;this.prvKeyHex=e};this.setPublicKeyHex=function(e){this.isPublic=!0;this.pubKeyHex=e};this.generateKeyPairHex=function(){var e=this.getBigRandom(this.ecparams.n),d=this.ecparams.G.multiply(e),k=d.getX().toBigInteger(), d=d.getY().toBigInteger(),p=this.ecparams.keylen/4,e=("0000000000"+e.toString(16)).slice(-p),k=("0000000000"+k.toString(16)).slice(-p),d=("0000000000"+d.toString(16)).slice(-p),k="04"+k+d;this.setPrivateKeyHex(e);this.setPublicKeyHex(k);return{ecprvhex:e,ecpubhex:k}};this.signWithMessageHash=function(e){return this.signHex(e,this.prvKeyHex)};this.signHex=function(e,d){var k=new B(d,16),p=this.ecparams.n,a=new B(e,16);do var b=this.getBigRandom(p),c=this.ecparams.G.multiply(b).getX().toBigInteger().mod(p); while(0>=c.compareTo(B.ZERO));k=b.modInverse(p).multiply(a.add(k.multiply(c))).mod(p);return O.crypto.ECDSA.biRSSigToASN1Sig(c,k)};this.sign=function(e,d){var k=this.ecparams.n,p=B.fromByteArrayUnsigned(e);do var a=this.getBigRandom(k),b=this.ecparams.G.multiply(a).getX().toBigInteger().mod(k);while(0>=b.compareTo(B.ZERO));k=a.modInverse(k).multiply(p.add(d.multiply(b))).mod(k);return this.serializeSig(b,k)};this.verifyWithMessageHash=function(e,d){return this.verifyHex(e,d,this.pubKeyHex)};this.verifyHex= function(e,d,k){var p;p=O.crypto.ECDSA.parseSigHex(d);d=p.r;p=p.s;k=ECPointFp.decodeFromHex(this.ecparams.curve,k);e=new B(e,16);return this.verifyRaw(e,d,p,k)};this.verify=function(e,d,k){var p;if(Bitcoin.Util.isArray(d))d=this.parseSig(d),p=d.r,d=d.s;else if("object"===typeof d&&d.r&&d.s)p=d.r,d=d.s;else throw"Invalid value for signature";if(!(k instanceof ECPointFp))if(Bitcoin.Util.isArray(k))k=ECPointFp.decodeFrom(this.ecparams.curve,k);else throw"Invalid format for pubkey value, must be byte array or ECPointFp"; e=B.fromByteArrayUnsigned(e);return this.verifyRaw(e,p,d,k)};this.verifyRaw=function(e,d,k,p){var a=this.ecparams.n,b=this.ecparams.G;if(0>d.compareTo(B.ONE)||0<=d.compareTo(a)||0>k.compareTo(B.ONE)||0<=k.compareTo(a))return!1;k=k.modInverse(a);e=e.multiply(k).mod(a);k=d.multiply(k).mod(a);return b.multiply(e).add(p.multiply(k)).getX().toBigInteger().mod(a).equals(d)};this.serializeSig=function(e,d){var k=e.toByteArraySigned(),p=d.toByteArraySigned(),a=[];a.push(2);a.push(k.length);a=a.concat(k); a.push(2);a.push(p.length);a=a.concat(p);a.unshift(a.length);a.unshift(48);return a};this.parseSig=function(e){var d;if(48!=e[0])throw Error("Signature not a valid DERSequence");d=2;if(2!=e[d])throw Error("First element in signature must be a DERInteger");var k=e.slice(d+2,d+2+e[d+1]);d+=2+e[d+1];if(2!=e[d])throw Error("Second element in signature must be a DERInteger");e=e.slice(d+2,d+2+e[d+1]);k=B.fromByteArrayUnsigned(k);e=B.fromByteArrayUnsigned(e);return{r:k,s:e}};this.parseSigCompact=function(e){if(65!== e.length)throw"Signature has the wrong length";var d=e[0]-27;if(0>d||7<d)throw"Invalid signature type";var k=this.ecparams.n,p=B.fromByteArrayUnsigned(e.slice(1,33)).mod(k);e=B.fromByteArrayUnsigned(e.slice(33,65)).mod(k);return{r:p,s:e,i:d}};void 0!==e&&void 0!==e.curve&&(this.curveName=e.curve);void 0===this.curveName&&(this.curveName="secp256r1");this.setNamedCurve(this.curveName);void 0!==e&&(void 0!==e.prv&&this.setPrivateKeyHex(e.prv),void 0!==e.pub&&this.setPublicKeyHex(e.pub))};O.crypto.ECDSA.parseSigHex= function(e){var k=O.crypto.ECDSA.parseSigHexInHexRS(e);e=new B(k.r,16);k=new B(k.s,16);return{r:e,s:k}};O.crypto.ECDSA.parseSigHexInHexRS=function(e){if("30"!=e.substr(0,2))throw"signature is not a ASN.1 sequence";var k=H.getPosArrayOfChildren_AtObj(e,0);if(2!=k.length)throw"number of signature ASN.1 sequence elements seem wrong";var g=k[0],k=k[1];if("02"!=e.substr(g,2))throw"1st item of sequene of signature is not ASN.1 integer";if("02"!=e.substr(k,2))throw"2nd item of sequene of signature is not ASN.1 integer"; g=H.getHexOfV_AtObj(e,g);e=H.getHexOfV_AtObj(e,k);return{r:g,s:e}};O.crypto.ECDSA.asn1SigToConcatSig=function(e){var k=O.crypto.ECDSA.parseSigHexInHexRS(e);e=k.r;k=k.s;"00"==e.substr(0,2)&&8==e.length/2*8%128&&(e=e.substr(2));"00"==k.substr(0,2)&&8==k.length/2*8%128&&(k=k.substr(2));if(0!=e.length/2*8%128)throw"unknown ECDSA sig r length error";if(0!=k.length/2*8%128)throw"unknown ECDSA sig s length error";return e+k};O.crypto.ECDSA.concatSigToASN1Sig=function(e){if(0!=e.length/2*8%128)throw"unknown ECDSA concatinated r-s sig length error"; var k=e.substr(0,e.length/2);e=e.substr(e.length/2);return O.crypto.ECDSA.hexRSSigToASN1Sig(k,e)};O.crypto.ECDSA.hexRSSigToASN1Sig=function(e,k){var g=new B(e,16),d=new B(k,16);return O.crypto.ECDSA.biRSSigToASN1Sig(g,d)};O.crypto.ECDSA.biRSSigToASN1Sig=function(e,k){var g=new O.asn1.DERInteger({bigint:e}),d=new O.asn1.DERInteger({bigint:k});return(new O.asn1.DERSequence({array:[g,d]})).getEncodedHex()};jc=a;H=new function(){this.getByteLengthOfL_AtObj=function(e,k){if("8"!=e.substring(k+2,k+3))return 1; var g=parseInt(e.substring(k+3,k+4));return 0==g?-1:0<g&&10>g?g+1:-2};this.getHexOfL_AtObj=function(e,k){var g=this.getByteLengthOfL_AtObj(e,k);return 1>g?"":e.substring(k+2,k+2+2*g)};this.getIntOfL_AtObj=function(e,k){var g=this.getHexOfL_AtObj(e,k);return""==g?-1:(8>parseInt(g.substring(0,1))?new B(g,16):new B(g.substring(2),16)).intValue()};this.getStartPosOfV_AtObj=function(e,k){var g=this.getByteLengthOfL_AtObj(e,k);return 0>g?g:k+2*(g+1)};this.getHexOfV_AtObj=function(e,k){var g=this.getStartPosOfV_AtObj(e, k),d=this.getIntOfL_AtObj(e,k);return e.substring(g,g+2*d)};this.getHexOfTLV_AtObj=function(e,k){var g=e.substr(k,2),d=this.getHexOfL_AtObj(e,k),q=this.getHexOfV_AtObj(e,k);return g+d+q};this.getPosOfNextSibling_AtObj=function(e,k){var g=this.getStartPosOfV_AtObj(e,k),d=this.getIntOfL_AtObj(e,k);return g+2*d};this.getPosArrayOfChildren_AtObj=function(e,k){var g=[],d=this.getStartPosOfV_AtObj(e,k);g.push(d);for(var q=this.getIntOfL_AtObj(e,k),p=d,a=0;;){p=this.getPosOfNextSibling_AtObj(e,p);if(null== p||p-d>=2*q)break;if(200<=a)break;g.push(p);a++}return g};this.getNthChildIndex_AtObj=function(e,k,g){return this.getPosArrayOfChildren_AtObj(e,k)[g]};this.getDecendantIndexByNthList=function(e,k,g){if(0==g.length)return k;var d=g.shift();k=this.getPosArrayOfChildren_AtObj(e,k);return this.getDecendantIndexByNthList(e,k[d],g)};this.getDecendantHexTLVByNthList=function(e,k,g){k=this.getDecendantIndexByNthList(e,k,g);return this.getHexOfTLV_AtObj(e,k)};this.getDecendantHexVByNthList=function(e,k,g){k= this.getDecendantIndexByNthList(e,k,g);return this.getHexOfV_AtObj(e,k)}};H.getVbyList=function(e,k,g,d){k=this.getDecendantIndexByNthList(e,k,g);if(void 0===k)throw"can't find nthList object";if(void 0!==d&&e.substr(k,2)!=d)throw"checking tag doesn't match: "+e.substr(k,2)+"!="+d;return this.getHexOfV_AtObj(e,k)};H.hextooidstr=function(e){var k=function(d,e){return d.length>=e?d:Array(e-d.length+1).join("0")+d},g=[],d=e.substr(0,2),d=parseInt(d,16);g[0]=new String(Math.floor(d/40));g[1]=new String(d% 40);var q=e.substr(2);e=[];for(d=0;d<q.length/2;d++)e.push(parseInt(q.substr(2*d,2),16));for(var q=[],p="",d=0;d<e.length;d++)e[d]&128?p+=k((e[d]&127).toString(2),7):(p+=k((e[d]&127).toString(2),7),q.push(new String(parseInt(p,2))),p="");k=g.join(".");0<q.length&&(k=k+"."+q.join("."));return k};H.dump=function(e,k,g,d){var q=function(d,e){return d.length<=2*e?d:d.substr(0,e)+"..(total "+d.length/2+"bytes).."+d.substr(d.length-e,e)};void 0===k&&(k={ommit_long_octet:32});void 0===g&&(g=0);void 0=== d&&(d="");var p=k.ommit_long_octet;if("01"==e.substr(g,2))return e=H.getHexOfV_AtObj(e,g),"00"==e?d+"BOOLEAN FALSE\n":d+"BOOLEAN TRUE\n";if("02"==e.substr(g,2))return e=H.getHexOfV_AtObj(e,g),d+"INTEGER "+q(e,p)+"\n";if("03"==e.substr(g,2))return e=H.getHexOfV_AtObj(e,g),d+"BITSTRING "+q(e,p)+"\n";if("04"==e.substr(g,2))return e=H.getHexOfV_AtObj(e,g),H.isASN1HEX(e)?q=d+"OCTETSTRING, encapsulates\n"+H.dump(e,k,0,d+" "):d+"OCTETSTRING "+q(e,p)+"\n";if("05"==e.substr(g,2))return d+"NULL\n";if("06"== e.substr(g,2)){e=H.getHexOfV_AtObj(e,g);var a=O.asn1.ASN1Util.oidHexToInt(e),p=O.asn1.x509.OID.oid2name(a);e=a.replace(/\./g," ");return""!=p?d+"ObjectIdentifier "+p+" ("+e+")\n":d+"ObjectIdentifier ("+e+")\n"}if("0c"==e.substr(g,2))return d+"UTF8String '"+hextoutf8(H.getHexOfV_AtObj(e,g))+"'\n";if("13"==e.substr(g,2))return d+"PrintableString '"+hextoutf8(H.getHexOfV_AtObj(e,g))+"'\n";if("14"==e.substr(g,2))return d+"TeletexString '"+hextoutf8(H.getHexOfV_AtObj(e,g))+"'\n";if("16"==e.substr(g,2))return d+ "IA5String '"+hextoutf8(H.getHexOfV_AtObj(e,g))+"'\n";if("17"==e.substr(g,2))return d+"UTCTime "+hextoutf8(H.getHexOfV_AtObj(e,g))+"\n";if("18"==e.substr(g,2))return d+"GeneralizedTime "+hextoutf8(H.getHexOfV_AtObj(e,g))+"\n";if("30"==e.substr(g,2)){if("3000"==e.substr(g,4))return d+"SEQUENCE {}\n";q=d+"SEQUENCE\n";g=H.getPosArrayOfChildren_AtObj(e,g);p=k;2!=g.length&&3!=g.length||"06"!=e.substr(g[0],2)||"04"!=e.substr(g[g.length-1],2)||(p=H.getHexOfV