UNPKG

etoken-lib

Version:
1 lines 855 kB
"use strict";var _typeof2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_slicedToArray=function(){function e(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(i=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{!i&&s.return&&s.return()}finally{if(r)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),_typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(e){return void 0===e?"undefined":_typeof2(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":_typeof2(e)};!function(e){if("object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Web3=e()}}(function(){var define,module,exports;return function e(t,n,i){function r(a,s){if(!n[a]){if(!t[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){var n=t[a][1][e];return r(n||e)},l,l.exports,e,t,n,i)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<i.length;a++)r(i[a]);return r}({1:[function(e,t,n){t.exports={version:"1.0.0-beta.18",lerna:"2.0.0",packages:["packages/*"]}},{}],2:[function(e,t,n){var i=n;i.bignum=e("bn.js"),i.define=e("./asn1/api").define,i.base=e("./asn1/base"),i.constants=e("./asn1/constants"),i.decoders=e("./asn1/decoders"),i.encoders=e("./asn1/encoders")},{"./asn1/api":3,"./asn1/base":5,"./asn1/constants":9,"./asn1/decoders":11,"./asn1/encoders":14,"bn.js":"BN"}],3:[function(e,t,n){function i(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}var r=e("../asn1"),o=e("inherits");n.define=function(e,t){return new i(e,t)},i.prototype._createNamed=function(t){var n;try{n=e("vm").runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(e){n=function(e){this._initNamed(e)}}return o(n,t),n.prototype._initNamed=function(e){t.call(this,e)},new n(this)},i.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(r.decoders[e])),this.decoders[e]},i.prototype.decode=function(e,t,n){return this._getDecoder(t).decode(e,n)},i.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(r.encoders[e])),this.encoders[e]},i.prototype.encode=function(e,t,n){return this._getEncoder(t).encode(e,n)}},{"../asn1":2,inherits:100,vm:152}],4:[function(e,t,n){function i(e,t){a.call(this,t),s.isBuffer(e)?(this.base=e,this.offset=0,this.length=e.length):this.error("Input not Buffer")}function r(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof r||(e=new r(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=s.byteLength(e);else{if(!s.isBuffer(e))return t.error("Unsupported type: "+(void 0===e?"undefined":_typeof(e)));this.value=e,this.length=e.length}}var o=e("inherits"),a=e("../base").Reporter,s=e("buffer").Buffer;o(i,a),n.DecoderBuffer=i,i.prototype.save=function(){return{offset:this.offset,reporter:a.prototype.save.call(this)}},i.prototype.restore=function(e){var t=new i(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,a.prototype.restore.call(this,e.reporter),t},i.prototype.isEmpty=function(){return this.offset===this.length},i.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},i.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");var n=new i(this.base);return n._reporterState=this._reporterState,n.offset=this.offset,n.length=this.offset+e,this.offset+=e,n},i.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},n.EncoderBuffer=r,r.prototype.join=function(e,t){return e||(e=new s(this.length)),t||(t=0),0===this.length?e:(Array.isArray(this.value)?this.value.forEach(function(n){n.join(e,t),t+=n.length}):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):s.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length),e)}},{"../base":5,buffer:46,inherits:100}],5:[function(e,t,n){var i=n;i.Reporter=e("./reporter").Reporter,i.DecoderBuffer=e("./buffer").DecoderBuffer,i.EncoderBuffer=e("./buffer").EncoderBuffer,i.Node=e("./node")},{"./buffer":4,"./node":6,"./reporter":7}],6:[function(e,t,n){function i(e,t){var n={};this._baseState=n,n.enc=e,n.parent=t||null,n.children=null,n.tag=null,n.args=null,n.reverseArgs=null,n.choice=null,n.optional=!1,n.any=!1,n.obj=!1,n.use=null,n.useDecoder=null,n.key=null,n.default=null,n.explicit=null,n.implicit=null,n.contains=null,n.parent||(n.children=[],this._wrap())}var r=e("../base").Reporter,o=e("../base").EncoderBuffer,a=e("../base").DecoderBuffer,s=e("minimalistic-assert"),c=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],u=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(c),l=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];t.exports=i;var f=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];i.prototype.clone=function(){var e=this._baseState,t={};f.forEach(function(n){t[n]=e[n]});var n=new this.constructor(t.parent);return n._baseState=t,n},i.prototype._wrap=function(){var e=this._baseState;u.forEach(function(t){this[t]=function(){var n=new this.constructor(this);return e.children.push(n),n[t].apply(n,arguments)}},this)},i.prototype._init=function(e){var t=this._baseState;s(null===t.parent),e.call(this),t.children=t.children.filter(function(e){return e._baseState.parent===this},this),s.equal(t.children.length,1,"Root node can have only one child")},i.prototype._useArgs=function(e){var t=this._baseState,n=e.filter(function(e){return e instanceof this.constructor},this);e=e.filter(function(e){return!(e instanceof this.constructor)},this),0!==n.length&&(s(null===t.children),t.children=n,n.forEach(function(e){e._baseState.parent=this},this)),0!==e.length&&(s(null===t.args),t.args=e,t.reverseArgs=e.map(function(e){if("object"!==(void 0===e?"undefined":_typeof(e))||e.constructor!==Object)return e;var t={};return Object.keys(e).forEach(function(n){n==(0|n)&&(n|=0);var i=e[n];t[i]=n}),t}))},l.forEach(function(e){i.prototype[e]=function(){var t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}}),c.forEach(function(e){i.prototype[e]=function(){var t=this._baseState,n=Array.prototype.slice.call(arguments);return s(null===t.tag),t.tag=e,this._useArgs(n),this}}),i.prototype.use=function(e){s(e);var t=this._baseState;return s(null===t.use),t.use=e,this},i.prototype.optional=function(){return this._baseState.optional=!0,this},i.prototype.def=function(e){var t=this._baseState;return s(null===t.default),t.default=e,t.optional=!0,this},i.prototype.explicit=function(e){var t=this._baseState;return s(null===t.explicit&&null===t.implicit),t.explicit=e,this},i.prototype.implicit=function(e){var t=this._baseState;return s(null===t.explicit&&null===t.implicit),t.implicit=e,this},i.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},i.prototype.key=function(e){var t=this._baseState;return s(null===t.key),t.key=e,this},i.prototype.any=function(){return this._baseState.any=!0,this},i.prototype.choice=function(e){var t=this._baseState;return s(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map(function(t){return e[t]})),this},i.prototype.contains=function(e){var t=this._baseState;return s(null===t.use),t.contains=e,this},i.prototype._decode=function(e,t){var n=this._baseState;if(null===n.parent)return e.wrapResult(n.children[0]._decode(e,t));var i=n.default,r=!0,o=null;if(null!==n.key&&(o=e.enterKey(n.key)),n.optional){var s=null;if(null!==n.explicit?s=n.explicit:null!==n.implicit?s=n.implicit:null!==n.tag&&(s=n.tag),null!==s||n.any){if(r=this._peekTag(e,s,n.any),e.isError(r))return r}else{f=e.save();try{null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t),r=!0}catch(e){r=!1}e.restore(f)}}var c;if(n.obj&&r&&(c=e.enterObject()),r){if(null!==n.explicit){var u=this._decodeTag(e,n.explicit);if(e.isError(u))return u;e=u}var l=e.offset;if(null===n.use&&null===n.choice){if(n.any)var f=e.save();var h=this._decodeTag(e,null!==n.implicit?n.implicit:n.tag,n.any);if(e.isError(h))return h;n.any?i=e.raw(f):e=h}if(t&&t.track&&null!==n.tag&&t.track(e.path(),l,e.length,"tagged"),t&&t.track&&null!==n.tag&&t.track(e.path(),e.offset,e.length,"content"),i=n.any?i:null===n.choice?this._decodeGeneric(n.tag,e,t):this._decodeChoice(e,t),e.isError(i))return i;if(n.any||null!==n.choice||null===n.children||n.children.forEach(function(n){n._decode(e,t)}),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){var p=new a(i);i=this._getUse(n.contains,e._reporterState.obj)._decode(p,t)}}return n.obj&&r&&(i=e.leaveObject(c)),null===n.key||null===i&&!0!==r?null!==o&&e.exitKey(o):e.leaveKey(o,n.key,i),i},i.prototype._decodeGeneric=function(e,t,n){var i=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,i.args[0],n):/str$/.test(e)?this._decodeStr(t,e,n):"objid"===e&&i.args?this._decodeObjid(t,i.args[0],i.args[1],n):"objid"===e?this._decodeObjid(t,null,null,n):"gentime"===e||"utctime"===e?this._decodeTime(t,e,n):"null_"===e?this._decodeNull(t,n):"bool"===e?this._decodeBool(t,n):"objDesc"===e?this._decodeStr(t,e,n):"int"===e||"enum"===e?this._decodeInt(t,i.args&&i.args[0],n):null!==i.use?this._getUse(i.use,t._reporterState.obj)._decode(t,n):t.error("unknown tag: "+e)},i.prototype._getUse=function(e,t){var n=this._baseState;return n.useDecoder=this._use(e,t),s(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},i.prototype._decodeChoice=function(e,t){var n=this._baseState,i=null,r=!1;return Object.keys(n.choice).some(function(o){var a=e.save(),s=n.choice[o];try{var c=s._decode(e,t);if(e.isError(c))return!1;i={type:o,value:c},r=!0}catch(t){return e.restore(a),!1}return!0},this),r?i:e.error("Choice not matched")},i.prototype._createEncoderBuffer=function(e){return new o(e,this.reporter)},i.prototype._encode=function(e,t,n){var i=this._baseState;if(null===i.default||i.default!==e){var r=this._encodeValue(e,t,n);if(void 0!==r&&!this._skipDefault(r,t,n))return r}},i.prototype._encodeValue=function(e,t,n){var i=this._baseState;if(null===i.parent)return i.children[0]._encode(e,t||new r);c=null;if(this.reporter=t,i.optional&&void 0===e){if(null===i.default)return;e=i.default}var o=null,a=!1;if(i.any)c=this._createEncoderBuffer(e);else if(i.choice)c=this._encodeChoice(e,t);else if(i.contains)o=this._getUse(i.contains,n)._encode(e,t),a=!0;else if(i.children)o=i.children.map(function(n){if("null_"===n._baseState.tag)return n._encode(null,t,e);if(null===n._baseState.key)return t.error("Child should have a key");var i=t.enterKey(n._baseState.key);if("object"!==(void 0===e?"undefined":_typeof(e)))return t.error("Child expected, but input is not object");var r=n._encode(e[n._baseState.key],t,e);return t.leaveKey(i),r},this).filter(function(e){return e}),o=this._createEncoderBuffer(o);else if("seqof"===i.tag||"setof"===i.tag){if(!i.args||1!==i.args.length)return t.error("Too many args for : "+i.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");var s=this.clone();s._baseState.implicit=null,o=this._createEncoderBuffer(e.map(function(n){var i=this._baseState;return this._getUse(i.args[0],e)._encode(n,t)},s))}else null!==i.use?c=this._getUse(i.use,n)._encode(e,t):(o=this._encodePrimitive(i.tag,e),a=!0);var c;if(!i.any&&null===i.choice){var u=null!==i.implicit?i.implicit:i.tag,l=null===i.implicit?"universal":"context";null===u?null===i.use&&t.error("Tag could be ommited only for .use()"):null===i.use&&(c=this._encodeComposite(u,a,l,o))}return null!==i.explicit&&(c=this._encodeComposite(i.explicit,!1,"context",c)),c},i.prototype._encodeChoice=function(e,t){var n=this._baseState,i=n.choice[e.type];return i||s(!1,e.type+" not found in "+JSON.stringify(Object.keys(n.choice))),i._encode(e.value,t)},i.prototype._encodePrimitive=function(e,t){var n=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&n.args)return this._encodeObjid(t,n.reverseArgs[0],n.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,n.args&&n.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},i.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},i.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}},{"../base":5,"minimalistic-assert":104}],7:[function(e,t,n){function i(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function r(e,t){this.path=e,this.rethrow(t)}var o=e("inherits");n.Reporter=i,i.prototype.isError=function(e){return e instanceof r},i.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},i.prototype.restore=function(e){var t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},i.prototype.enterKey=function(e){return this._reporterState.path.push(e)},i.prototype.exitKey=function(e){var t=this._reporterState;t.path=t.path.slice(0,e-1)},i.prototype.leaveKey=function(e,t,n){var i=this._reporterState;this.exitKey(e),null!==i.obj&&(i.obj[t]=n)},i.prototype.path=function(){return this._reporterState.path.join("/")},i.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},i.prototype.leaveObject=function(e){var t=this._reporterState,n=t.obj;return t.obj=e,n},i.prototype.error=function(e){var t,n=this._reporterState,i=e instanceof r;if(t=i?e:new r(n.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),e.message||e,e.stack),!n.options.partial)throw t;return i||n.errors.push(t),t},i.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},o(r,Error),r.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,r),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},{inherits:100}],8:[function(e,t,n){var i=e("../constants");n.tagClass={0:"universal",1:"application",2:"context",3:"private"},n.tagClassByName=i._reverse(n.tagClass),n.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},n.tagByName=i._reverse(n.tag)},{"../constants":9}],9:[function(e,t,n){var i=n;i._reverse=function(e){var t={};return Object.keys(e).forEach(function(n){(0|n)==n&&(n|=0);var i=e[n];t[i]=n}),t},i.der=e("./der")},{"./der":8}],10:[function(e,t,n){function i(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new r,this.tree._init(e.body)}function r(e){u.Node.call(this,"der",e)}function o(e,t){var n=e.readUInt8(t);if(e.isError(n))return n;var i=f.tagClass[n>>6],r=0==(32&n);if(31==(31&n)){var o=n;for(n=0;128==(128&o);){if(o=e.readUInt8(t),e.isError(o))return o;n<<=7,n|=127&o}}else n&=31;return{cls:i,primitive:r,tag:n,tagStr:f.tag[n]}}function a(e,t,n){var i=e.readUInt8(n);if(e.isError(i))return i;if(!t&&128===i)return null;if(0==(128&i))return i;var r=127&i;if(r>4)return e.error("length octect is too long");i=0;for(var o=0;o<r;o++){i<<=8;var a=e.readUInt8(n);if(e.isError(a))return a;i|=a}return i}var s=e("inherits"),c=e("../../asn1"),u=c.base,l=c.bignum,f=c.constants.der;t.exports=i,i.prototype.decode=function(e,t){return e instanceof u.DecoderBuffer||(e=new u.DecoderBuffer(e,t)),this.tree._decode(e,t)},s(r,u.Node),r.prototype._peekTag=function(e,t,n){if(e.isEmpty())return!1;var i=e.save(),r=o(e,'Failed to peek tag: "'+t+'"');return e.isError(r)?r:(e.restore(i),r.tag===t||r.tagStr===t||r.tagStr+"of"===t||n)},r.prototype._decodeTag=function(e,t,n){var i=o(e,'Failed to decode tag of "'+t+'"');if(e.isError(i))return i;var r=a(e,i.primitive,'Failed to get length of "'+t+'"');if(e.isError(r))return r;if(!n&&i.tag!==t&&i.tagStr!==t&&i.tagStr+"of"!==t)return e.error('Failed to match tag: "'+t+'"');if(i.primitive||null!==r)return e.skip(r,'Failed to match body of: "'+t+'"');var s=e.save(),c=this._skipUntilEnd(e,'Failed to skip indefinite length body: "'+this.tag+'"');return e.isError(c)?c:(r=e.offset-s.offset,e.restore(s),e.skip(r,'Failed to match body of: "'+t+'"'))},r.prototype._skipUntilEnd=function(e,t){for(;;){var n=o(e,t);if(e.isError(n))return n;var i=a(e,n.primitive,t);if(e.isError(i))return i;var r;if(r=n.primitive||null!==i?e.skip(i):this._skipUntilEnd(e,t),e.isError(r))return r;if("end"===n.tagStr)break}},r.prototype._decodeList=function(e,t,n,i){for(var r=[];!e.isEmpty();){var o=this._peekTag(e,"end");if(e.isError(o))return o;var a=n.decode(e,"der",i);if(e.isError(a)&&o)break;r.push(a)}return r},r.prototype._decodeStr=function(e,t){if("bitstr"===t){var n=e.readUInt8();return e.isError(n)?n:{unused:n,data:e.raw()}}if("bmpstr"===t){var i=e.raw();if(i.length%2==1)return e.error("Decoding of string type: bmpstr length mismatch");for(var r="",o=0;o<i.length/2;o++)r+=String.fromCharCode(i.readUInt16BE(2*o));return r}if("numstr"===t){var a=e.raw().toString("ascii");return this._isNumstr(a)?a:e.error("Decoding of string type: numstr unsupported characters")}if("octstr"===t)return e.raw();if("objDesc"===t)return e.raw();if("printstr"===t){var s=e.raw().toString("ascii");return this._isPrintstr(s)?s:e.error("Decoding of string type: printstr unsupported characters")}return/str$/.test(t)?e.raw().toString():e.error("Decoding of string type: "+t+" unsupported")},r.prototype._decodeObjid=function(e,t,n){for(var i,r=[],o=0;!e.isEmpty();){var a=e.readUInt8();o<<=7,o|=127&a,0==(128&a)&&(r.push(o),o=0)}128&a&&r.push(o);var s=r[0]/40|0,c=r[0]%40;if(i=n?r:[s,c].concat(r.slice(1)),t){var u=t[i.join(" ")];void 0===u&&(u=t[i.join(".")]),void 0!==u&&(i=u)}return i},r.prototype._decodeTime=function(e,t){var n=e.raw().toString();if("gentime"===t)var i=0|n.slice(0,4),r=0|n.slice(4,6),o=0|n.slice(6,8),a=0|n.slice(8,10),s=0|n.slice(10,12),c=0|n.slice(12,14);else{if("utctime"!==t)return e.error("Decoding "+t+" time is not supported yet");var i=0|n.slice(0,2),r=0|n.slice(2,4),o=0|n.slice(4,6),a=0|n.slice(6,8),s=0|n.slice(8,10),c=0|n.slice(10,12);i=i<70?2e3+i:1900+i}return Date.UTC(i,r-1,o,a,s,c,0)},r.prototype._decodeNull=function(e){return null},r.prototype._decodeBool=function(e){var t=e.readUInt8();return e.isError(t)?t:0!==t},r.prototype._decodeInt=function(e,t){var n=e.raw(),i=new l(n);return t&&(i=t[i.toString(10)]||i),i},r.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getDecoder("der").tree}},{"../../asn1":2,inherits:100}],11:[function(e,t,n){var i=n;i.der=e("./der"),i.pem=e("./pem")},{"./der":10,"./pem":12}],12:[function(e,t,n){function i(e){a.call(this,e),this.enc="pem"}var r=e("inherits"),o=e("buffer").Buffer,a=e("./der");r(i,a),t.exports=i,i.prototype.decode=function(e,t){for(var n=e.toString().split(/[\r\n]+/g),i=t.label.toUpperCase(),r=/^-----(BEGIN|END) ([^-]+)-----$/,s=-1,c=-1,u=0;u<n.length;u++){var l=n[u].match(r);if(null!==l&&l[2]===i){if(-1!==s){if("END"!==l[1])break;c=u;break}if("BEGIN"!==l[1])break;s=u}}if(-1===s||-1===c)throw new Error("PEM section not found for: "+i);var f=n.slice(s+1,c).join("");f.replace(/[^a-z0-9\+\/=]+/gi,"");var h=new o(f,"base64");return a.prototype.decode.call(this,h,t)}},{"./der":10,buffer:46,inherits:100}],13:[function(e,t,n){function i(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new r,this.tree._init(e.body)}function r(e){l.Node.call(this,"der",e)}function o(e){return e<10?"0"+e:e}function a(e,t,n,i){var r;if("seqof"===e?e="seq":"setof"===e&&(e="set"),f.tagByName.hasOwnProperty(e))r=f.tagByName[e];else{if("number"!=typeof e||(0|e)!==e)return i.error("Unknown tag: "+e);r=e}return r>=31?i.error("Multi-octet tag encoding unsupported"):(t||(r|=32),r|=f.tagClassByName[n||"universal"]<<6)}var s=e("inherits"),c=e("buffer").Buffer,u=e("../../asn1"),l=u.base,f=u.constants.der;t.exports=i,i.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},s(r,l.Node),r.prototype._encodeComposite=function(e,t,n,i){var r=a(e,t,n,this.reporter);if(i.length<128)return(u=new c(2))[0]=r,u[1]=i.length,this._createEncoderBuffer([u,i]);for(var o=1,s=i.length;s>=256;s>>=8)o++;var u=new c(2+o);u[0]=r,u[1]=128|o;for(var s=1+o,l=i.length;l>0;s--,l>>=8)u[s]=255&l;return this._createEncoderBuffer([u,i])},r.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){for(var n=new c(2*e.length),i=0;i<e.length;i++)n.writeUInt16BE(e.charCodeAt(i),2*i);return this._createEncoderBuffer(n)}return"numstr"===t?this._isNumstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: numstr supports only digits and space"):"printstr"===t?this._isPrintstr(e)?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(t)?this._createEncoderBuffer(e):"objDesc"===t?this._createEncoderBuffer(e):this.reporter.error("Encoding of string type: "+t+" unsupported")},r.prototype._encodeObjid=function(e,t,n){if("string"==typeof e){if(!t)return this.reporter.error("string objid given, but no values map found");if(!t.hasOwnProperty(e))return this.reporter.error("objid not found in values map");e=t[e].split(/[\s\.]+/g);for(r=0;r<e.length;r++)e[r]|=0}else if(Array.isArray(e)){e=e.slice();for(r=0;r<e.length;r++)e[r]|=0}if(!Array.isArray(e))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(e));if(!n){if(e[1]>=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}for(var i=0,r=0;r<e.length;r++){s=e[r];for(i++;s>=128;s>>=7)i++}for(var o=new c(i),a=o.length-1,r=e.length-1;r>=0;r--){var s=e[r];for(o[a--]=127&s;(s>>=7)>0;)o[a--]=128|127&s}return this._createEncoderBuffer(o)},r.prototype._encodeTime=function(e,t){var n,i=new Date(e);return"gentime"===t?n=[o(i.getFullYear()),o(i.getUTCMonth()+1),o(i.getUTCDate()),o(i.getUTCHours()),o(i.getUTCMinutes()),o(i.getUTCSeconds()),"Z"].join(""):"utctime"===t?n=[o(i.getFullYear()%100),o(i.getUTCMonth()+1),o(i.getUTCDate()),o(i.getUTCHours()),o(i.getUTCMinutes()),o(i.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(n,"octstr")},r.prototype._encodeNull=function(){return this._createEncoderBuffer("")},r.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!c.isBuffer(e)){var n=e.toArray();!e.sign&&128&n[0]&&n.unshift(0),e=new c(n)}if(c.isBuffer(e)){r=e.length;0===e.length&&r++;var i=new c(r);return e.copy(i),0===e.length&&(i[0]=0),this._createEncoderBuffer(i)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);for(var r=1,o=e;o>=256;o>>=8)r++;for(o=(i=new Array(r)).length-1;o>=0;o--)i[o]=255&e,e>>=8;return 128&i[0]&&i.unshift(0),this._createEncoderBuffer(new c(i))},r.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},r.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},r.prototype._skipDefault=function(e,t,n){var i,r=this._baseState;if(null===r.default)return!1;var o=e.join();if(void 0===r.defaultBuffer&&(r.defaultBuffer=this._encodeValue(r.default,t,n).join()),o.length!==r.defaultBuffer.length)return!1;for(i=0;i<o.length;i++)if(o[i]!==r.defaultBuffer[i])return!1;return!0}},{"../../asn1":2,buffer:46,inherits:100}],14:[function(e,t,n){var i=n;i.der=e("./der"),i.pem=e("./pem")},{"./der":13,"./pem":15}],15:[function(e,t,n){function i(e){o.call(this,e),this.enc="pem"}var r=e("inherits"),o=e("./der");r(i,o),t.exports=i,i.prototype.encode=function(e,t){for(var n=o.prototype.encode.call(this,e).toString("base64"),i=["-----BEGIN "+t.label+"-----"],r=0;r<n.length;r+=64)i.push(n.slice(r,r+64));return i.push("-----END "+t.label+"-----"),i.join("\n")}},{"./der":13,inherits:100}],16:[function(e,t,n){function i(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function r(e){return a[e>>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}function o(e,t,n){for(var i,o=[],a=t;a<n;a+=3)i=(e[a]<<16)+(e[a+1]<<8)+e[a+2],o.push(r(i));return o.join("")}n.byteLength=function(e){return 3*e.length/4-i(e)},n.toByteArray=function(e){var t,n,r,o,a,u=e.length;o=i(e),a=new c(3*u/4-o),n=o>0?u-4:u;var l=0;for(t=0;t<n;t+=4)r=s[e.charCodeAt(t)]<<18|s[e.charCodeAt(t+1)]<<12|s[e.charCodeAt(t+2)]<<6|s[e.charCodeAt(t+3)],a[l++]=r>>16&255,a[l++]=r>>8&255,a[l++]=255&r;return 2===o?(r=s[e.charCodeAt(t)]<<2|s[e.charCodeAt(t+1)]>>4,a[l++]=255&r):1===o&&(r=s[e.charCodeAt(t)]<<10|s[e.charCodeAt(t+1)]<<4|s[e.charCodeAt(t+2)]>>2,a[l++]=r>>8&255,a[l++]=255&r),a},n.fromByteArray=function(e){for(var t,n=e.length,i=n%3,r="",s=[],c=0,u=n-i;c<u;c+=16383)s.push(o(e,c,c+16383>u?u:c+16383));return 1===i?(t=e[n-1],r+=a[t>>2],r+=a[t<<4&63],r+="=="):2===i&&(t=(e[n-2]<<8)+e[n-1],r+=a[t>>10],r+=a[t>>4&63],r+=a[t<<2&63],r+="="),s.push(r),s.join("")};for(var a=[],s=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",l=0,f=u.length;l<f;++l)a[l]=u[l],s[u.charCodeAt(l)]=l;s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63},{}],17:[function(e,t,n){function i(e){this.rand=e}var r;if(t.exports=function(e){return r||(r=new i(null)),r.generate(e)},t.exports.Rand=i,i.prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n<t.length;n++)t[n]=this.rand.getByte();return t},"object"===("undefined"==typeof self?"undefined":_typeof(self)))self.crypto&&self.crypto.getRandomValues?i.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?i.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:"object"===("undefined"==typeof window?"undefined":_typeof(window))&&(i.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var o=e("crypto");if("function"!=typeof o.randomBytes)throw new Error("Not supported");i.prototype._rand=function(e){return o.randomBytes(e)}}catch(e){}},{crypto:18}],18:[function(e,t,n){},{}],19:[function(e,t,n){(function(e){function t(e){var t;return e>s||e<0?(t=Math.abs(e)%s,e<0?s-t:t):e}function i(e){for(;0<e.length;e++)e[0]=0;return!1}function r(){this.SBOX=[],this.INV_SBOX=[],this.SUB_MIX=[[],[],[],[]],this.INV_SUB_MIX=[[],[],[],[]],this.init(),this.RCON=[0,1,2,4,8,16,32,64,128,27,54]}function o(e){for(var t=e.length/4,n=new Array(t),i=-1;++i<t;)n[i]=e.readUInt32BE(4*i);return n}function a(e){this._key=o(e),this._doReset()}var s=Math.pow(2,32);r.prototype.init=function(){var e,t,n,i,r,o,a,s,c,u;for(e=function(){var e,n;for(n=[],t=e=0;e<256;t=++e)t<128?n.push(t<<1):n.push(t<<1^283);return n}(),r=0,c=0,t=u=0;u<256;t=++u)n=(n=c^c<<1^c<<2^c<<3^c<<4)>>>8^255&n^99,this.SBOX[r]=n,this.INV_SBOX[n]=r,s=e[a=e[o=e[r]]],i=257*e[n]^16843008*n,this.SUB_MIX[0][r]=i<<24|i>>>8,this.SUB_MIX[1][r]=i<<16|i>>>16,this.SUB_MIX[2][r]=i<<8|i>>>24,this.SUB_MIX[3][r]=i,i=16843009*s^65537*a^257*o^16843008*r,this.INV_SUB_MIX[0][n]=i<<24|i>>>8,this.INV_SUB_MIX[1][n]=i<<16|i>>>16,this.INV_SUB_MIX[2][n]=i<<8|i>>>24,this.INV_SUB_MIX[3][n]=i,0===r?r=c=1:(r=o^e[e[e[s^o]]],c^=e[e[c]]);return!0};var c=new r;a.blockSize=16,a.prototype.blockSize=a.blockSize,a.keySize=32,a.prototype.keySize=a.keySize,a.prototype._doReset=function(){var e,t,n,i,r,o;for(t=(n=this._key).length,this._nRounds=t+6,r=4*(this._nRounds+1),this._keySchedule=[],i=0;i<r;i++)this._keySchedule[i]=i<t?n[i]:(o=this._keySchedule[i-1],i%t==0?(o=o<<8|o>>>24,o=c.SBOX[o>>>24]<<24|c.SBOX[o>>>16&255]<<16|c.SBOX[o>>>8&255]<<8|c.SBOX[255&o],o^=c.RCON[i/t|0]<<24):t>6&&i%t==4&&(o=c.SBOX[o>>>24]<<24|c.SBOX[o>>>16&255]<<16|c.SBOX[o>>>8&255]<<8|c.SBOX[255&o]),this._keySchedule[i-t]^o);for(this._invKeySchedule=[],e=0;e<r;e++)i=r-e,o=this._keySchedule[i-(e%4?0:4)],this._invKeySchedule[e]=e<4||i<=4?o:c.INV_SUB_MIX[0][c.SBOX[o>>>24]]^c.INV_SUB_MIX[1][c.SBOX[o>>>16&255]]^c.INV_SUB_MIX[2][c.SBOX[o>>>8&255]]^c.INV_SUB_MIX[3][c.SBOX[255&o]];return!0},a.prototype.encryptBlock=function(t){t=o(new e(t));var n=this._doCryptBlock(t,this._keySchedule,c.SUB_MIX,c.SBOX),i=new e(16);return i.writeUInt32BE(n[0],0),i.writeUInt32BE(n[1],4),i.writeUInt32BE(n[2],8),i.writeUInt32BE(n[3],12),i},a.prototype.decryptBlock=function(t){var n=[(t=o(new e(t)))[3],t[1]];t[1]=n[0],t[3]=n[1];var i=this._doCryptBlock(t,this._invKeySchedule,c.INV_SUB_MIX,c.INV_SBOX),r=new e(16);return r.writeUInt32BE(i[0],0),r.writeUInt32BE(i[3],4),r.writeUInt32BE(i[2],8),r.writeUInt32BE(i[1],12),r},a.prototype.scrub=function(){i(this._keySchedule),i(this._invKeySchedule),i(this._key)},a.prototype._doCryptBlock=function(e,n,i,r){var o,a,s,c,u,l,f,h,p;a=e[0]^n[0],s=e[1]^n[1],c=e[2]^n[2],u=e[3]^n[3],o=4;for(var d=1;d<this._nRounds;d++)l=i[0][a>>>24]^i[1][s>>>16&255]^i[2][c>>>8&255]^i[3][255&u]^n[o++],f=i[0][s>>>24]^i[1][c>>>16&255]^i[2][u>>>8&255]^i[3][255&a]^n[o++],h=i[0][c>>>24]^i[1][u>>>16&255]^i[2][a>>>8&255]^i[3][255&s]^n[o++],p=i[0][u>>>24]^i[1][a>>>16&255]^i[2][s>>>8&255]^i[3][255&c]^n[o++],a=l,s=f,c=h,u=p;return l=(r[a>>>24]<<24|r[s>>>16&255]<<16|r[c>>>8&255]<<8|r[255&u])^n[o++],f=(r[s>>>24]<<24|r[c>>>16&255]<<16|r[u>>>8&255]<<8|r[255&a])^n[o++],h=(r[c>>>24]<<24|r[u>>>16&255]<<16|r[a>>>8&255]<<8|r[255&s])^n[o++],p=(r[u>>>24]<<24|r[a>>>16&255]<<16|r[s>>>8&255]<<8|r[255&c])^n[o++],[t(l),t(f),t(h),t(p)]},n.AES=a}).call(this,e("buffer").Buffer)},{buffer:46}],20:[function(e,t,n){(function(n){function i(e,t,r,s){if(!(this instanceof i))return new i(e,t,r);a.call(this),this._finID=n.concat([r,new n([0,0,0,1])]),r=n.concat([r,new n([0,0,0,2])]),this._cipher=new o.AES(t),this._prev=new n(r.length),this._cache=new n(""),this._secCache=new n(""),this._decrypt=s,this._alen=0,this._len=0,r.copy(this._prev),this._mode=e;var u=new n(4);u.fill(0),this._ghash=new c(this._cipher.encryptBlock(u)),this._authTag=null,this._called=!1}function r(e,t){var n=0;e.length!==t.length&&n++;for(var i=Math.min(e.length,t.length),r=-1;++r<i;)n+=e[r]^t[r];return n}var o=e("./aes"),a=e("cipher-base"),s=e("inherits"),c=e("./ghash"),u=e("buffer-xor");s(i,a),t.exports=i,i.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&((t=new n(t)).fill(0),this._ghash.update(t))}this._called=!0;var i=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(i),this._len+=e.length,i},i.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=u(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt){if(r(e,this._authTag))throw new Error("Unsupported state or unable to authenticate data")}else this._authTag=e;this._cipher.scrub()},i.prototype.getAuthTag=function(){if(!this._decrypt&&n.isBuffer(this._authTag))return this._authTag;throw new Error("Attempting to get auth tag in unsupported state")},i.prototype.setAuthTag=function(e){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=e},i.prototype.setAAD=function(e){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(e),this._alen+=e.length}}).call(this,e("buffer").Buffer)},{"./aes":19,"./ghash":24,buffer:46,"buffer-xor":45,"cipher-base":47,inherits:100}],21:[function(e,t,n){var i=e("./encrypter");n.createCipher=n.Cipher=i.createCipher,n.createCipheriv=n.Cipheriv=i.createCipheriv;var r=e("./decrypter");n.createDecipher=n.Decipher=r.createDecipher,n.createDecipheriv=n.Decipheriv=r.createDecipheriv;var o=e("./modes");n.listCiphers=n.getCiphers=function(){return Object.keys(o)}},{"./decrypter":22,"./encrypter":23,"./modes":25}],22:[function(e,t,n){(function(t){function i(e,n,o){if(!(this instanceof i))return new i(e,n,o);c.call(this),this._cache=new r,this._last=void 0,this._cipher=new s.AES(n),this._prev=new t(o.length),o.copy(this._prev),this._mode=e,this._autopadding=!0}function r(){if(!(this instanceof r))return new r;this.cache=new t("")}function o(e){for(var t=e[15],n=-1;++n<t;)if(e[n+(16-t)]!==t)throw new Error("unable to decrypt data");if(16!==t)return e.slice(0,16-t)}function a(e,n,r){var o=l[e.toLowerCase()];if(!o)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=new t(r)),"string"==typeof n&&(n=new t(n)),n.length!==o.key/8)throw new TypeError("invalid key length "+n.length);if(r.length!==o.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===o.type?new f(d[o.mode],n,r,!0):"auth"===o.type?new h(d[o.mode],n,r,!0):new i(d[o.mode],n,r)}var s=e("./aes"),c=e("cipher-base"),u=e("inherits"),l=e("./modes"),f=e("./streamCipher"),h=e("./authCipher"),p=e("evp_bytestokey");u(i,c),i.prototype._update=function(e){this._cache.add(e);for(var n,i,r=[];n=this._cache.get(this._autopadding);)i=this._mode.decrypt(this,n),r.push(i);return t.concat(r)},i.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return o(this._mode.decrypt(this,e));if(e)throw new Error("data not multiple of block length")},i.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},r.prototype.add=function(e){this.cache=t.concat([this.cache,e])},r.prototype.get=function(e){var t;if(e){if(this.cache.length>16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},r.prototype.flush=function(){if(this.cache.length)return this.cache};var d={ECB:e("./modes/ecb"),CBC:e("./modes/cbc"),CFB:e("./modes/cfb"),CFB8:e("./modes/cfb8"),CFB1:e("./modes/cfb1"),OFB:e("./modes/ofb"),CTR:e("./modes/ctr"),GCM:e("./modes/ctr")};n.createDecipher=function(e,t){var n=l[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var i=p(t,!1,n.key,n.iv);return a(e,i.key,i.iv)},n.createDecipheriv=a}).call(this,e("buffer").Buffer)},{"./aes":19,"./authCipher":20,"./modes":25,"./modes/cbc":26,"./modes/cfb":27,"./modes/cfb1":28,"./modes/cfb8":29,"./modes/ctr":30,"./modes/ecb":31,"./modes/ofb":32,"./streamCipher":33,buffer:46,"cipher-base":47,evp_bytestokey:83,inherits:100}],23:[function(e,t,n){(function(t){function i(e,n,o){if(!(this instanceof i))return new i(e,n,o);s.call(this),this._cache=new r,this._cipher=new a.AES(n),this._prev=new t(o.length),o.copy(this._prev),this._mode=e,this._autopadding=!0}function r(){if(!(this instanceof r))return new r;this.cache=new t("")}function o(e,n,r){var o=u[e.toLowerCase()];if(!o)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=new t(r)),"string"==typeof n&&(n=new t(n)),n.length!==o.key/8)throw new TypeError("invalid key length "+n.length);if(r.length!==o.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===o.type?new f(p[o.mode],n,r):"auth"===o.type?new h(p[o.mode],n,r):new i(p[o.mode],n,r)}var a=e("./aes"),s=e("cipher-base"),c=e("inherits"),u=e("./modes"),l=e("evp_bytestokey"),f=e("./streamCipher"),h=e("./authCipher");c(i,s),i.prototype._update=function(e){this._cache.add(e);for(var n,i,r=[];n=this._cache.get();)i=this._mode.encrypt(this,n),r.push(i);return t.concat(r)},i.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if("10101010101010101010101010101010"!==e.toString("hex"))throw this._cipher.scrub(),new Error("data not multiple of block length")},i.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},r.prototype.add=function(e){this.cache=t.concat([this.cache,e])},r.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},r.prototype.flush=function(){for(var e=16-this.cache.length,n=new t(e),i=-1;++i<e;)n.writeUInt8(e,i);return t.concat([this.cache,n])};var p={ECB:e("./modes/ecb"),CBC:e("./modes/cbc"),CFB:e("./modes/cfb"),CFB8:e("./modes/cfb8"),CFB1:e("./modes/cfb1"),OFB:e("./modes/ofb"),CTR:e("./modes/ctr"),GCM:e("./modes/ctr")};n.createCipheriv=o,n.createCipher=function(e,t){var n=u[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");var i=l(t,!1,n.key,n.iv);return o(e,i.key,i.iv)}}).call(this,e("buffer").Buffer)},{"./aes":19,"./authCipher":20,"./modes":25,"./modes/cbc":26,"./modes/cfb":27,"./modes/cfb1":28,"./modes/cfb8":29,"./modes/ctr":30,"./modes/ecb":31,"./modes/ofb":32,"./streamCipher":33,buffer:46,"cipher-base":47,evp_bytestokey:83,inherits:100}],24:[function(e,t,n){(function(e){function n(t){this.h=t,this.state=new e(16),this.state.fill(0),this.cache=new e("")}function i(e){return[e.readUInt32BE(0),e.readUInt32BE(4),e.readUInt32BE(8),e.readUInt32BE(12)]}function r(t){t=t.map(o);var n=new e(16);return n.writeUInt32BE(t[0],0),n.writeUInt32BE(t[1],4),n.writeUInt32BE(t[2],8),n.writeUInt32BE(t[3],12),n}function o(e){var t;return e>c||e<0?(t=Math.abs(e)%c,e<0?c-t:t):e}function a(e,t){return[e[0]^t[0],e[1]^t[1],e[2]^t[2],e[3]^t[3]]}var s=new e(16);s.fill(0),t.exports=n,n.prototype.ghash=function(e){for(var t=-1;++t<e.length;)this.state[t]^=e[t];this._multiply()},n.prototype._multiply=function(){for(var e,t,n=i(this.h),o=[0,0,0,0],s=-1;++s<128;){for(0!=(this.state[~~(s/8)]&1<<7-s%8)&&(o=a(o,n)),t=0!=(1&n[3]),e=3;e>0;e--)n[e]=n[e]>>>1|(1&n[e-1])<<31;n[0]=n[0]>>>1,t&&(n[0]=n[0]^225<<24)}this.state=r(o)},n.prototype.update=function(t){this.cache=e.concat([this.cache,t]);for(var n;this.cache.length>=16;)n=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(n)},n.prototype.final=function(t,n){return this.cache.length&&this.ghash(e.concat([this.cache,s],16)),this.ghash(r([0,t,0,n])),this.state};var c=Math.pow(2,32)}).call(this,e("buffer").Buffer)},{buffer:46}],25:[function(e,t,n){n["aes-128-ecb"]={cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},n["aes-192-ecb"]={cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},n["aes-256-ecb"]={cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},n["aes-128-cbc"]={cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},n["aes-192-cbc"]={cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},n["aes-256-cbc"]={cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},n.aes128=n["aes-128-cbc"],n.aes192=n["aes-192-cbc"],n.aes256=n["aes-256-cbc"],n["aes-128-cfb"]={cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},n["aes-192-cfb"]={cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},n["aes-256-cfb"]={cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},n["aes-128-cfb8"]={cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},n["aes-192-cfb8"]={cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},n["aes-256-cfb8"]={cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},n["aes-128-cfb1"]={cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},n["aes-192-cfb1"]={cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},n["aes-256-cfb1"]={cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},n["aes-128-ofb"]={cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},n["aes-192-ofb"]={cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},n["aes-256-ofb"]={cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},n["aes-128-ctr"]={cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},n["aes-192-ctr"]={cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},n["aes-256-ctr"]={cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},n["aes-128-gcm"]={cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},n["aes-192-gcm"]={cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},n["aes-256-gcm"]={cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}},{}],26:[function(e,t,n){var i=e("buffer-xor");n.encrypt=function(e,t){var n=i(t,e._prev);return e._prev=e._cipher.encryptBlock(n),e._prev},n.decrypt=function(e,t){var n=e._prev;e._prev=t;var r=e._cipher.decryptBlock(t);return i(r,n)}},{"buffer-xor":45}],27:[function(e,t,n){(function(t){function i(e,n,i){var o=n.length,a=r(n,e._cache);return e._cache=e._cache.slice(o),e._prev=t.concat([e._prev,i?n:a]),a}var r=e("buffer-xor");n.encrypt=function(e,n,r){for(var o,a=new t("");n.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=new t("")),!(e._cache.length<=n.length)){a=t.concat([a,i(e,n,r)]);break}o=e._cache.length,a=t.concat([a,i(e,n.slice(0,o),r)]),n=n.slice(o)}return a}}).call(this,e("buffer").Buffer)},{buffer:46,"buffer-xor":45}],28:[function(e,t,n){(function(e){function t(e,t,n){for(var r,o,a,s=-1,c=0;++s<8;)r=e._cipher.encryptBlock(e._prev),o=t&1<<7-s?128:0,c+=(128&(a=r[0]^o))>>s%8,e._prev=i(e._prev,n?o:a);return c}function i(t,n){var i=t.length,r=-1,o=new e(t.length);for(t=e.concat([t,new e([n])]);++r<i;)o[r]=t[r]<<1|t[r+1]>>7;return o}n.encrypt=function(n,i,r){for(var o=i.length,a=new e(o),s=-1;++s<o;)a[s]=t(n,i[s],r);return a}}).call(this,e("buffer").Buffer)},{buffer:46}],29:[function(e,t,n){(function(e){function t(t,n,i){var r=t._cipher.encryptBlock(t._prev)[0]^n;return t._prev=e.concat([t._prev.slice(1),new e([i?n:r])]),r}n.encrypt=function(n,i,r){for(var o=i.length,a=new e(o),s=-1;++s<o;)a[s]=t(n,i[s],r);return a}}).call(this,e("buffer").Buffer)},{buffer:46}],30:[function(e,t,n){(function(t){function i(e){for(var t,n=e.length;n--;){if(255!==(t=e.readUInt8(n))){t++,e.writeUInt8(t,n);break}e.writeUInt8(0,n)}}function r(e){var t=e._cipher.encryptBlock(e._prev);return i(e._prev),t}var o=e("buffer-xor");n.encrypt=function(e,n){for(;e._cache.length<n.length;)e._cache=t.concat([e._cache,r(e)]);var i=e._cache.slice(0,n.length);return e._cache=e._cache.slice(n.length),o(n,i)}}).call(this,e("buffer").Buffer)},{buffer:46,"buffer-xor":45}],31:[function(e,t,n){n.encrypt=function(e,t){return e._cipher.encryptBlock(t)},n.decrypt=function(e,t){return e._cipher.decryptBlock(t)}},{}],32:[function(e,t,n){(function(t){function i(e){return e._prev=e._cipher.encryptBlock(e._prev),e._prev}var r=e("buffer-xor");n.encrypt=function(e,n){for(;e._cache.length<n.length;)e._cache=t.concat([e._cache,i(e)]);var o=e._cache.slice(0,n.length);return e._cache=e._cache.slice(n.length),r(n,o)}}).call(this,e("buffer").Buffer)},{buffer:46,"buffer-xor":45}],33:[function(e,t,n){(function(n){function i(e,t,a,s){if(!(this instanceof i))return new i(e,t,a);o.call(this),this._cipher=new r.AES(t),this._prev=new n(a.length),this._cache=new n(""),this._secCache=new n(""),this._decrypt=s,a.copy(this._prev),this._mode=e}var r=e("./aes"),o=e("cipher-base");e("inherits")(i,o),t.exports=i,i.prototype._update=function(e){return this._mode.encrypt(this,e,this._decrypt)},i.prototype._final=function(){this._cipher.scrub()}}).call(this,e("buffer").Buffer)},{"./aes":19,buffer:46,"cipher-base":47,inherits:100}],34:[function(e,t,n){function i(e,t,n){if(e=e.toLowerCase(),u[e])return a.createCipheriv(e,t,n);if(c[e])return new s({key:t,iv:n,mode:e});throw new TypeError("invalid suite type")}function r(e,t,n){if(e=e.toLowerCase(),u[e])return a.createDecipheriv(e,t,n);if(c[e])return new s({key:t,iv:n,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}var o=e("evp_bytestokey"),a=e("browserify-aes/browser"),s=e("browserify-des"),c=e("browserify-des/modes"),u=e("browserify-aes/modes");n.createCipher=n.Cipher=function(e,t){var n,r;if(e=e.toLowerCase(),u[e])n=u[e].key,r=u[e].iv;else{if(!c[e])throw new TypeError("invalid suite type");n=8*c[e].key,r=c[e].iv}var a=o(t,!1,n,r);return i(e,a.key,a.iv)},n.createCipheriv=n.Cipheriv=i,n.createDecipher=n.Decipher=function(e,t){var n,i;if(e=e.toLowerCase(),u[e])n=u[e].key,i=u[e].iv;else{if(!c[e])throw new TypeError("invalid suite type");n=8*c[e].key,i=c[e].iv}var a=o(t,!1,n,i);return r(e,a.key,a.iv)},n.createDecipheriv=n.Decipheriv=r,n.listCiphers=n.getCiphers=function(){return Object.keys(c).concat(a.getCiphers())}},{"browserify-aes/browser":21,"browserify-aes/modes":25,"browserify-des":35,"browserify-des/modes":36,evp_bytestokey:83}],35:[function(e,t,n){(function(n){function i(e){r.call(this);var t,i=e.mode.toLowerCase(),o=s[i];t=e.decrypt?"decrypt":"encrypt";var a=e.key;"des-ede"!==i&&"des-ede-cbc"!==i||(a=n.concat([a,a.slice(0,8)]));var c=e.iv;this._des=o.create({key:a,iv:c,type:t})}var r=e("cipher-base"),o=e("des.js"),a=e("inherits"),s={"des-ede3-cbc":o.CBC.instantiate(o.EDE),"des-ede3":o.EDE,"des-ede-cbc":o.CBC.instantiate(o.EDE),"des-ede":o.EDE,"des-cbc":o.CBC.instantiate(o.DES),"des-ecb":o.DES};s.des=s["des-cbc"],s.des3=s["des-ede3-cbc"],t.exports=i,a(i,r),i.prototype._update=function(e){return new n(this._des.update(e))},i.prototype._final=function(){return new n(this._des.final())}}).call(this,e("buffer").Buffer)},{buffer:46,"cipher-base":47,"des.js":56,inherits:100}],36:[function(e,t,n){n["des-ecb"]={key:8,iv:0},n["des-cbc"]=n.des={key:8,iv:8},n["des-ede3-cbc"]=n.des3={key:24,iv:8},n["des-ede3"]={key:24,iv:0},n["des-ede-cbc"]={key:16,iv:8},n["des-ede"]={key:16,iv:0}},{}],37:[function(e,t,n){(function(n){function i(e){var t=o(e);return{blinder:t.toRed(a.mont(e.modulus)).redPow(new a(e.publicExponent)).fromRed(),unblinder:t.invm(e.modulus)}}function r(e,t){var r=i(t),o=t.modulus.byteLength(),s=(a.mont(t.modulus),new a(e).mul(r.blinder).umod(t.modulus)),c=s.toRed(a.mont(t.prime1)),u=s.toRed(a.mont(t.prime2)),l=t.coefficient,f=t.prime1,h=t.prime2,p=c.redPow(t.exponent1),d=u.redPow(t.exponent2);p=p.fromRed(),d=d.fromRed();var m=p.isub(d).imul(l).umod(f);return m.imul(h),d.iadd(m),new n(d.imul(r.unblinder).umod(t.modulus).toArray(!1,o))}function o(e){for(var t=e.modulus.byteLength(),n=new a(s(t));n.cmp(e.modulus)>=0||!n.umod(e.prime1)||!n.umod(e.prime2);)n=new a(s(t));return n}var a=e("bn.js"),s=e("randombytes");t.exports=r,r.getr=o}).call(this,e("buffer").Buffer)},{"bn.js":"BN",buffer:46,randombytes:125}],38:[function(e,t,n){t.exports=e("./browser/algorithms.json")},{"./browser/algorithms.json":39}],39:[function(e,t,n){t.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},{}],40:[function(e,t,n){t.exports={"1.3.132.0.10":