UNPKG

@luckxudong/nodeforge

Version:

JavaScript implementations of network transports, cryptography, ciphers, PKI, message digests, and various utilities.

1 lines 421 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.forge=t():e.forge=t()}(window,(function(){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=49)}([function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){(function(t){var i=r(0),n=r(52),a=e.exports=i.util=i.util||{};function s(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function o(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(a.isArrayBuffer(e)||a.isArrayBufferView(e))if("undefined"!=typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r<t.length;++r)this.putByte(t[r])}}else(e instanceof o||"object"==typeof e&&"string"==typeof e.data&&"number"==typeof e.read)&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}!function(){if("undefined"!=typeof process&&process.nextTick&&!process.browser)return a.nextTick=process.nextTick,void("function"==typeof setImmediate?a.setImmediate=setImmediate:a.setImmediate=a.nextTick);if("function"==typeof setImmediate)return a.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(a.nextTick=function(e){return setImmediate(e)});if(a.setImmediate=function(e){setTimeout(e,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var e="forge.setImmediate",t=[];a.setImmediate=function(r){t.push(r),1===t.length&&window.postMessage(e,"*")},window.addEventListener("message",(function(r){if(r.source===window&&r.data===e){r.stopPropagation();var i=t.slice();t.length=0,i.forEach((function(e){e()}))}}),!0)}if("undefined"!=typeof MutationObserver){var r=Date.now(),i=!0,n=document.createElement("div");t=[];new MutationObserver((function(){var e=t.slice();t.length=0,e.forEach((function(e){e()}))})).observe(n,{attributes:!0});var s=a.setImmediate;a.setImmediate=function(e){Date.now()-r>15?(r=Date.now(),s(e)):(t.push(e),1===t.length&&n.setAttribute("a",i=!i))}}a.nextTick=a.setImmediate}(),a.isNodejs="undefined"!=typeof process&&process.versions&&process.versions.node,a.globalScope=a.isNodejs?t:"undefined"==typeof self?window:self,a.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},a.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},a.isArrayBufferView=function(e){return e&&a.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},a.ByteBuffer=o,a.ByteStringBuffer=o;a.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},a.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},a.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},a.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},a.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},a.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},a.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(a.encodeUtf8(e))},a.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},a.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},a.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},a.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},a.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},a.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},a.ByteStringBuffer.prototype.putInt=function(e,t){s(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},a.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)},a.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())},a.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},a.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e},a.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e},a.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e},a.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e},a.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e},a.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e},a.ByteStringBuffer.prototype.getInt=function(e){s(e);var t=0;do{t=(t<<8)+this.data.charCodeAt(this.read++),e-=8}while(e>0);return t},a.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},a.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},a.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},a.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},a.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},a.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},a.ByteStringBuffer.prototype.copy=function(){var e=a.createBuffer(this.data);return e.read=this.read,e},a.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},a.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},a.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},a.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var r=this.data.charCodeAt(t);r<16&&(e+="0"),e+=r.toString(16)}return e},a.ByteStringBuffer.prototype.toString=function(){return a.decodeUtf8(this.bytes())},a.DataBuffer=function(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=a.isArrayBuffer(e),i=a.isArrayBufferView(e);if(r||i)return this.data=r?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),void(this.write="writeOffset"in t?t.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=e&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)},a.DataBuffer.prototype.length=function(){return this.write-this.read},a.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},a.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),i=new Uint8Array(this.length()+t);return i.set(r),this.data=new DataView(i.buffer),this},a.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},a.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this},a.DataBuffer.prototype.putBytes=function(e,t){if(a.isArrayBufferView(e)){var r=(i=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)).byteLength-i.byteOffset;return this.accommodate(r),new Uint8Array(this.data.buffer,this.write).set(i),this.write+=r,this}if(a.isArrayBuffer(e)){var i=new Uint8Array(e);return this.accommodate(i.byteLength),new Uint8Array(this.data.buffer).set(i,this.write),this.write+=i.byteLength,this}if(e instanceof a.DataBuffer||"object"==typeof e&&"number"==typeof e.read&&"number"==typeof e.write&&a.isArrayBufferView(e.data)){i=new Uint8Array(e.data.byteLength,e.read,e.length());return this.accommodate(i.byteLength),new Uint8Array(e.data.byteLength,this.write).set(i),this.write+=i.byteLength,this}if(e instanceof a.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary","string"==typeof e){var n;if("hex"===t)return this.accommodate(Math.ceil(e.length/2)),n=new Uint8Array(this.data.buffer,this.write),this.write+=a.binary.hex.decode(e,n,this.write),this;if("base64"===t)return this.accommodate(3*Math.ceil(e.length/4)),n=new Uint8Array(this.data.buffer,this.write),this.write+=a.binary.base64.decode(e,n,this.write),this;if("utf8"===t&&(e=a.encodeUtf8(e),t="binary"),"binary"===t||"raw"===t)return this.accommodate(e.length),n=new Uint8Array(this.data.buffer,this.write),this.write+=a.binary.raw.decode(n),this;if("utf16"===t)return this.accommodate(2*e.length),n=new Uint16Array(this.data.buffer,this.write),this.write+=a.text.utf16.encode(n),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)},a.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this},a.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")},a.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this},a.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},a.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},a.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},a.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},a.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},a.DataBuffer.prototype.putInt=function(e,t){s(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},a.DataBuffer.prototype.putSignedInt=function(e,t){return s(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)},a.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},a.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e},a.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e},a.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e},a.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e},a.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e},a.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e},a.DataBuffer.prototype.getInt=function(e){s(e);var t=0;do{t=(t<<8)+this.data.getInt8(this.read++),e-=8}while(e>0);return t},a.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t},a.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},a.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},a.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},a.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},a.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},a.DataBuffer.prototype.copy=function(){return new a.DataBuffer(this)},a.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},a.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},a.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},a.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var r=this.data.getUint8(t);r<16&&(e+="0"),e+=r.toString(16)}return e},a.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if("binary"===(e=e||"utf8")||"raw"===e)return a.binary.raw.encode(t);if("hex"===e)return a.binary.hex.encode(t);if("base64"===e)return a.binary.base64.encode(t);if("utf8"===e)return a.text.utf8.decode(t);if("utf16"===e)return a.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)},a.createBuffer=function(e,t){return t=t||"raw",void 0!==e&&"utf8"===t&&(e=a.encodeUtf8(e)),new a.ByteBuffer(e)},a.fillString=function(e,t){for(var r="";t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},a.xorBytes=function(e,t,r){for(var i="",n="",a="",s=0,o=0;r>0;--r,++s)n=e.charCodeAt(s)^t.charCodeAt(s),o>=10&&(i+=a,a="",o=0),a+=String.fromCharCode(n),++o;return i+=a},a.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r<e.length;r+=2)t+=String.fromCharCode(parseInt(e.substr(r,2),16));return t},a.bytesToHex=function(e){return a.createBuffer(e).toHex()},a.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],u="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";a.encode64=function(e,t){for(var r,i,n,a="",s="",o=0;o<e.length;)r=e.charCodeAt(o++),i=e.charCodeAt(o++),n=e.charCodeAt(o++),a+=c.charAt(r>>2),a+=c.charAt((3&r)<<4|i>>4),isNaN(i)?a+="==":(a+=c.charAt((15&i)<<2|n>>6),a+=isNaN(n)?"=":c.charAt(63&n)),t&&a.length>t&&(s+=a.substr(0,t)+"\r\n",a=a.substr(t));return s+=a},a.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,i,n,a="",s=0;s<e.length;)t=f[e.charCodeAt(s++)-43],r=f[e.charCodeAt(s++)-43],i=f[e.charCodeAt(s++)-43],n=f[e.charCodeAt(s++)-43],a+=String.fromCharCode(t<<2|r>>4),64!==i&&(a+=String.fromCharCode((15&r)<<4|i>>2),64!==n&&(a+=String.fromCharCode((3&i)<<6|n)));return a},a.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},a.decodeUtf8=function(e){return decodeURIComponent(escape(e))},a.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:n.encode,decode:n.decode}},a.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},a.binary.raw.decode=function(e,t,r){var i=t;i||(i=new Uint8Array(e.length));for(var n=r=r||0,a=0;a<e.length;++a)i[n++]=e.charCodeAt(a);return t?n-r:i},a.binary.hex.encode=a.bytesToHex,a.binary.hex.decode=function(e,t,r){var i=t;i||(i=new Uint8Array(Math.ceil(e.length/2)));var n=0,a=r=r||0;for(1&e.length&&(n=1,i[a++]=parseInt(e[0],16));n<e.length;n+=2)i[a++]=parseInt(e.substr(n,2),16);return t?a-r:i},a.binary.base64.encode=function(e,t){for(var r,i,n,a="",s="",o=0;o<e.byteLength;)r=e[o++],i=e[o++],n=e[o++],a+=c.charAt(r>>2),a+=c.charAt((3&r)<<4|i>>4),isNaN(i)?a+="==":(a+=c.charAt((15&i)<<2|n>>6),a+=isNaN(n)?"=":c.charAt(63&n)),t&&a.length>t&&(s+=a.substr(0,t)+"\r\n",a=a.substr(t));return s+=a},a.binary.base64.decode=function(e,t,r){var i,n,a,s,o=t;o||(o=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var c=0,u=r=r||0;c<e.length;)i=f[e.charCodeAt(c++)-43],n=f[e.charCodeAt(c++)-43],a=f[e.charCodeAt(c++)-43],s=f[e.charCodeAt(c++)-43],o[u++]=i<<2|n>>4,64!==a&&(o[u++]=(15&n)<<4|a>>2,64!==s&&(o[u++]=(3&a)<<6|s));return t?u-r:o.subarray(0,u)},a.binary.base58.encode=function(e,t){return a.binary.baseN.encode(e,u,t)},a.binary.base58.decode=function(e,t){return a.binary.baseN.decode(e,u,t)},a.text={utf8:{},utf16:{}},a.text.utf8.encode=function(e,t,r){e=a.encodeUtf8(e);var i=t;i||(i=new Uint8Array(e.length));for(var n=r=r||0,s=0;s<e.length;++s)i[n++]=e.charCodeAt(s);return t?n-r:i},a.text.utf8.decode=function(e){return a.decodeUtf8(String.fromCharCode.apply(null,e))},a.text.utf16.encode=function(e,t,r){var i=t;i||(i=new Uint8Array(2*e.length));for(var n=new Uint16Array(i.buffer),a=r=r||0,s=r,o=0;o<e.length;++o)n[s++]=e.charCodeAt(o),a+=2;return t?a-r:i},a.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))},a.deflate=function(e,t,r){if(t=a.decode64(e.deflate(a.encode64(t)).rval),r){var i=2;32&t.charCodeAt(1)&&(i=6),t=t.substring(i,t.length-4)}return t},a.inflate=function(e,t,r){var i=e.inflate(a.encode64(t)).rval;return null===i?null:a.decode64(i)};var d=function(e,t,r){if(!e)throw new Error("WebStorage not available.");var i;if(null===r?i=e.removeItem(t):(r=a.encode64(JSON.stringify(r)),i=e.setItem(t,r)),void 0!==i&&!0!==i.rval){var n=new Error(i.error.message);throw n.id=i.error.id,n.name=i.error.name,n}},h=function(e,t){if(!e)throw new Error("WebStorage not available.");var r=e.getItem(t);if(e.init)if(null===r.rval){if(r.error){var i=new Error(r.error.message);throw i.id=r.error.id,i.name=r.error.name,i}r=null}else r=r.rval;return null!==r&&(r=JSON.parse(a.decode64(r))),r},l=function(e,t,r,i){var n=h(e,t);null===n&&(n={}),n[r]=i,d(e,t,n)},p=function(e,t,r){var i=h(e,t);return null!==i&&(i=r in i?i[r]:null),i},y=function(e,t,r){var i=h(e,t);if(null!==i&&r in i){delete i[r];var n=!0;for(var a in i){n=!1;break}n&&(i=null),d(e,t,i)}},g=function(e,t){d(e,t,null)},m=function(e,t,r){var i,n=null;void 0===r&&(r=["web","flash"]);var a=!1,s=null;for(var o in r){i=r[o];try{if("flash"===i||"both"===i){if(null===t[0])throw new Error("Flash local storage not available.");n=e.apply(this,t),a="flash"===i}"web"!==i&&"both"!==i||(t[0]=localStorage,n=e.apply(this,t),a=!0)}catch(e){s=e}if(a)break}if(!a)throw s;return n};a.setItem=function(e,t,r,i,n){m(l,arguments,n)},a.getItem=function(e,t,r,i){return m(p,arguments,i)},a.removeItem=function(e,t,r,i){m(y,arguments,i)},a.clearItems=function(e,t,r){m(g,arguments,r)},a.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},a.format=function(e){for(var t,r,i=/%./g,n=0,a=[],s=0;t=i.exec(e);){(r=e.substring(s,i.lastIndex-2)).length>0&&a.push(r),s=i.lastIndex;var o=t[0][1];switch(o){case"s":case"o":n<arguments.length?a.push(arguments[1+n++]):a.push("<?>");break;case"%":a.push("%");break;default:a.push("<%"+o+"?>")}}return a.push(e.substring(s)),a.join("")},a.formatNumber=function(e,t,r,i){var n=e,a=isNaN(t=Math.abs(t))?2:t,s=void 0===r?",":r,o=void 0===i?".":i,c=n<0?"-":"",f=parseInt(n=Math.abs(+n||0).toFixed(a),10)+"",u=f.length>3?f.length%3:0;return c+(u?f.substr(0,u)+o:"")+f.substr(u).replace(/(\d{3})(?=\d)/g,"$1"+o)+(a?s+Math.abs(n-f).toFixed(a).slice(2):"")},a.formatSize=function(e){return e=e>=1073741824?a.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?a.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?a.formatNumber(e/1024,0)+" KiB":a.formatNumber(e,0)+" bytes"},a.bytesFromIP=function(e){return-1!==e.indexOf(".")?a.bytesFromIPv4(e):-1!==e.indexOf(":")?a.bytesFromIPv6(e):null},a.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=a.createBuffer(),r=0;r<e.length;++r){var i=parseInt(e[r],10);if(isNaN(i))return null;t.putByte(i)}return t.getBytes()},a.bytesFromIPv6=function(e){for(var t=0,r=2*(8-(e=e.split(":").filter((function(e){return 0===e.length&&++t,!0}))).length+t),i=a.createBuffer(),n=0;n<8;++n)if(e[n]&&0!==e[n].length){var s=a.hexToBytes(e[n]);s.length<2&&i.putByte(0),i.putBytes(s)}else i.fillWithByte(0,r),r=0;return i.getBytes()},a.bytesToIP=function(e){return 4===e.length?a.bytesToIPv4(e):16===e.length?a.bytesToIPv6(e):null},a.bytesToIPv4=function(e){if(4!==e.length)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")},a.bytesToIPv6=function(e){if(16!==e.length)return null;for(var t=[],r=[],i=0,n=0;n<e.length;n+=2){for(var s=a.bytesToHex(e[n]+e[n+1]);"0"===s[0]&&"0"!==s;)s=s.substr(1);if("0"===s){var o=r[r.length-1],c=t.length;o&&c===o.end+1?(o.end=c,o.end-o.start>r[i].end-r[i].start&&(i=r.length-1)):r.push({start:c,end:c})}t.push(s)}if(r.length>0){var f=r[i];f.end-f.start>0&&(t.splice(f.start,f.end-f.start+1,""),0===f.start&&t.unshift(""),7===f.end&&t.push(""))}return t.join(":")},a.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in a&&!e.update)return t(null,a.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return a.cores=navigator.hardwareConcurrency,t(null,a.cores);if("undefined"==typeof Worker)return a.cores=1,t(null,a.cores);if("undefined"==typeof Blob)return a.cores=2,t(null,a.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),r=t+4;Date.now()<r;);self.postMessage({st:t,et:r})}))}.toString(),")()"],{type:"application/javascript"}));!function e(i,n,s){if(0===n){var o=Math.floor(i.reduce((function(e,t){return e+t}),0)/i.length);return a.cores=Math.max(1,o),URL.revokeObjectURL(r),t(null,a.cores)}!function(e,t){for(var i=[],n=[],a=0;a<e;++a){var s=new Worker(r);s.addEventListener("message",(function(r){if(n.push(r.data),n.length===e){for(var a=0;a<e;++a)i[a].terminate();t(null,n)}})),i.push(s)}for(a=0;a<e;++a)i[a].postMessage(a)}(s,(function(t,r){i.push(function(e,t){for(var r=[],i=0;i<e;++i)for(var n=t[i],a=r[i]=[],s=0;s<e;++s)if(i!==s){var o=t[s];(n.st>o.st&&n.st<o.et||o.st>n.st&&o.st<n.et)&&a.push(s)}return r.reduce((function(e,t){return Math.max(e,t.length)}),0)}(s,r)),e(i,n-1,s)}))}([],5,16)}}).call(this,r(51))},function(e,t,r){var i=r(0);r(8),r(34),r(35),r(1),i.random&&i.random.getBytes?e.exports=i.random:function(t){var r={},n=new Array(4),a=i.util.createBuffer();function s(){var e=i.prng.create(r);return e.getBytes=function(t,r){return e.generate(t,r)},e.getBytesSync=function(t){return e.generate(t)},e}r.formatKey=function(e){var t=i.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),i.aes._expandKey(e,!1)},r.formatSeed=function(e){var t=i.util.createBuffer(e);return(e=new Array(4))[0]=t.getInt32(),e[1]=t.getInt32(),e[2]=t.getInt32(),e[3]=t.getInt32(),e},r.cipher=function(e,t){return i.aes._updateBlock(e,t,n,!1),a.putInt32(n[0]),a.putInt32(n[1]),a.putInt32(n[2]),a.putInt32(n[3]),a.getBytes()},r.increment=function(e){return++e[3],e},r.md=i.md.sha256;var o=s(),c=null,f=i.util.globalScope,u=f.crypto||f.msCrypto;if(u&&u.getRandomValues&&(c=function(e){return u.getRandomValues(e)}),i.options.usePureJavaScript||!i.util.isNodejs&&!c){if("undefined"==typeof window||window.document,o.collectInt(+new Date,32),"undefined"!=typeof navigator){var d="";for(var h in navigator)try{"string"==typeof navigator[h]&&(d+=navigator[h])}catch(e){}o.collect(d),d=null}t&&(t().mousemove((function(e){o.collectInt(e.clientX,16),o.collectInt(e.clientY,16)})),t().keypress((function(e){o.collectInt(e.charCode,8)})))}if(i.random)for(var h in o)i.random[h]=o[h];else i.random=o;i.random.createInstance=s,e.exports=i.random}("undefined"!=typeof jQuery?jQuery:null)},function(e,t,r){"use strict";var i=t,n=r(7),a=r(10),s=r(40);i.assert=a,i.toArray=s.toArray,i.zero2=s.zero2,i.toHex=s.toHex,i.encode=s.encode,i.getNAF=function(e,t,r){var i,n=new Array(Math.max(e.bitLength(),r)+1);for(i=0;i<n.length;i+=1)n[i]=0;var a=1<<t+1,s=e.clone();for(i=0;i<n.length;i++){var o,c=s.andln(a-1);s.isOdd()?(o=c>(a>>1)-1?(a>>1)-c:c,s.isubn(o)):o=0,n[i]=o,s.iushrn(1)}return n},i.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var i,n=0,a=0;e.cmpn(-n)>0||t.cmpn(-a)>0;){var s,o,c=e.andln(3)+n&3,f=t.andln(3)+a&3;3===c&&(c=-1),3===f&&(f=-1),s=0==(1&c)?0:3!==(i=e.andln(7)+n&7)&&5!==i||2!==f?c:-c,r[0].push(s),o=0==(1&f)?0:3!==(i=t.andln(7)+a&7)&&5!==i||2!==c?f:-f,r[1].push(o),2*n===s+1&&(n=1-n),2*a===o+1&&(a=1-a),e.iushrn(1),t.iushrn(1)}return r},i.cachedProperty=function(e,t,r){var i="_"+t;e.prototype[t]=function(){return void 0!==this[i]?this[i]:this[i]=r.call(this)}},i.parseBytes=function(e){return"string"==typeof e?i.toArray(e,"hex"):e},i.intFromLE=function(e){return new n(e,"hex","le")}},function(e,t,r){var i=r(0);r(1),r(9);var n=e.exports=i.asn1=i.asn1||{};function a(e,t,r){if(r>t){var i=new Error("Too few bytes to parse DER.");throw i.available=e.length(),i.remaining=t,i.requested=r,i}}n.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},n.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},n.create=function(e,t,r,a,s){if(i.util.isArray(a)){for(var o=[],c=0;c<a.length;++c)void 0!==a[c]&&o.push(a[c]);a=o}var f={tagClass:e,type:t,constructed:r,composed:r||i.util.isArray(a),value:a};return s&&"bitStringContents"in s&&(f.bitStringContents=s.bitStringContents,f.original=n.copy(f)),f},n.copy=function(e,t){var r;if(i.util.isArray(e)){r=[];for(var a=0;a<e.length;++a)r.push(n.copy(e[a],t));return r}return"string"==typeof e?e:(r={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:n.copy(e.value,t)},t&&!t.excludeBitStringContents&&(r.bitStringContents=e.bitStringContents),r)},n.equals=function(e,t,r){if(i.util.isArray(e)){if(!i.util.isArray(t))return!1;if(e.length!==t.length)return!1;for(var a=0;a<e.length;++a)if(!n.equals(e[a],t[a]))return!1;return!0}if(typeof e!=typeof t)return!1;if("string"==typeof e)return e===t;var s=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&n.equals(e.value,t.value);return r&&r.includeBitStringContents&&(s=s&&e.bitStringContents===t.bitStringContents),s},n.getBerValueLength=function(e){var t=e.getByte();if(128!==t)return 128&t?e.getInt((127&t)<<3):t};n.fromDer=function(e,t){void 0===t&&(t={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),"boolean"==typeof t&&(t={strict:t,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"parseAllBytes"in t||(t.parseAllBytes=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"string"==typeof e&&(e=i.util.createBuffer(e));var r=e.length(),s=function e(t,r,i,s){var o;a(t,r,2);var c=t.getByte();r--;var f=192&c,u=31&c;o=t.length();var d,h,l=function(e,t){var r=e.getByte();if(t--,128!==r){var i;if(128&r){var n=127&r;a(e,t,n),i=e.getInt(n<<3)}else i=r;if(i<0)throw new Error("Negative length: "+i);return i}}(t,r);if(r-=o-t.length(),void 0!==l&&l>r){if(s.strict){var p=new Error("Too few bytes to read ASN.1 value.");throw p.available=t.length(),p.remaining=r,p.requested=l,p}l=r}var y=32==(32&c);if(y)if(d=[],void 0===l)for(;;){if(a(t,r,2),t.bytes(2)===String.fromCharCode(0,0)){t.getBytes(2),r-=2;break}o=t.length(),d.push(e(t,r,i+1,s)),r-=o-t.length()}else for(;l>0;)o=t.length(),d.push(e(t,l,i+1,s)),r-=o-t.length(),l-=o-t.length();void 0===d&&f===n.Class.UNIVERSAL&&u===n.Type.BITSTRING&&(h=t.bytes(l));if(void 0===d&&s.decodeBitStrings&&f===n.Class.UNIVERSAL&&u===n.Type.BITSTRING&&l>1){var g=t.read,m=r,b=0;if(u===n.Type.BITSTRING&&(a(t,r,1),b=t.getByte(),r--),0===b)try{o=t.length();var v=e(t,r,i+1,{strict:!0,decodeBitStrings:!0}),C=o-t.length();r-=C,u==n.Type.BITSTRING&&C++;var E=v.tagClass;C!==l||E!==n.Class.UNIVERSAL&&E!==n.Class.CONTEXT_SPECIFIC||(d=[v])}catch(e){}void 0===d&&(t.read=g,r=m)}if(void 0===d){if(void 0===l){if(s.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");l=r}if(u===n.Type.BMPSTRING)for(d="";l>0;l-=2)a(t,r,2),d+=String.fromCharCode(t.getInt16()),r-=2;else d=t.getBytes(l),r-=l}var S=void 0===h?null:{bitStringContents:h};return n.create(f,u,y,d,S)}(e,e.length(),0,t);if(t.parseAllBytes&&0!==e.length()){var o=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw o.byteCount=r,o.remaining=e.length(),o}return s},n.toDer=function(e){var t=i.util.createBuffer(),r=e.tagClass|e.type,a=i.util.createBuffer(),s=!1;if("bitStringContents"in e&&(s=!0,e.original&&(s=n.equals(e,e.original))),s)a.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:a.putByte(0);for(var o=0;o<e.value.length;++o)void 0!==e.value[o]&&a.putBuffer(n.toDer(e.value[o]))}else if(e.type===n.Type.BMPSTRING)for(o=0;o<e.value.length;++o)a.putInt16(e.value.charCodeAt(o));else e.type===n.Type.INTEGER&&e.value.length>1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?a.putBytes(e.value.substr(1)):a.putBytes(e.value);if(t.putByte(r),a.length()<=127)t.putByte(127&a.length());else{var c=a.length(),f="";do{f+=String.fromCharCode(255&c),c>>>=8}while(c>0);t.putByte(128|f.length);for(o=f.length-1;o>=0;--o)t.putByte(f.charCodeAt(o))}return t.putBuffer(a),t},n.oidToDer=function(e){var t,r,n,a,s=e.split("."),o=i.util.createBuffer();o.putByte(40*parseInt(s[0],10)+parseInt(s[1],10));for(var c=2;c<s.length;++c){t=!0,r=[],n=parseInt(s[c],10);do{a=127&n,n>>>=7,t||(a|=128),r.push(a),t=!1}while(n>0);for(var f=r.length-1;f>=0;--f)o.putByte(r[f])}return o},n.derToOid=function(e){var t;"string"==typeof e&&(e=i.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)n<<=7,128&(r=e.getByte())?n+=127&r:(t+="."+(n+r),n=0);return t},n.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var i=parseInt(e.substr(2,2),10)-1,n=parseInt(e.substr(4,2),10),a=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),o=0;if(e.length>11){var c=e.charAt(10),f=10;"+"!==c&&"-"!==c&&(o=parseInt(e.substr(10,2),10),f+=2)}if(t.setUTCFullYear(r,i,n),t.setUTCHours(a,s,o,0),f&&("+"===(c=e.charAt(f))||"-"===c)){var u=60*parseInt(e.substr(f+1,2),10)+parseInt(e.substr(f+4,2),10);u*=6e4,"+"===c?t.setTime(+t-u):t.setTime(+t+u)}return t},n.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),i=parseInt(e.substr(4,2),10)-1,n=parseInt(e.substr(6,2),10),a=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),o=parseInt(e.substr(12,2),10),c=0,f=0,u=!1;"Z"===e.charAt(e.length-1)&&(u=!0);var d=e.length-5,h=e.charAt(d);"+"!==h&&"-"!==h||(f=60*parseInt(e.substr(d+1,2),10)+parseInt(e.substr(d+4,2),10),f*=6e4,"+"===h&&(f*=-1),u=!0);return"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),u?(t.setUTCFullYear(r,i,n),t.setUTCHours(a,s,o,c),t.setTime(+t+f)):(t.setFullYear(r,i,n),t.setHours(a,s,o,c)),t},n.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var i=0;i<r.length;++i)r[i].length<2&&(t+="0"),t+=r[i];return t+="Z"},n.dateToGeneralizedTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push(""+e.getUTCFullYear()),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var i=0;i<r.length;++i)r[i].length<2&&(t+="0"),t+=r[i];return t+="Z"},n.integerToDer=function(e){var t=i.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},n.derToInteger=function(e){"string"==typeof e&&(e=i.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},n.validate=function(e,t,r,a){var s=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)a&&(e.tagClass!==t.tagClass&&a.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&a.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(s=!0,t.value&&i.util.isArray(t.value))for(var o=0,c=0;s&&c<t.value.length;++c)s=t.value[c].optional||!1,e.value[o]&&((s=n.validate(e.value[o],t.value[c],r,a))?++o:t.value[c].optional&&(s=!0)),!s&&a&&a.push("["+t.name+'] Tag class "'+t.tagClass+'", type "'+t.type+'" expected value length "'+t.value.length+'", got "'+e.value.length+'"');if(s&&r)if(t.capture&&(r[t.capture]=e.value),t.captureAsn1&&(r[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(r[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e)if(e.bitStringContents.length<2)r[t.captureBitStringValue]="";else{if(0!==e.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");r[t.captureBitStringValue]=e.bitStringContents.slice(1)}}else a&&a.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');return s};var s=/[^\\u0000-\\u00ff]/;n.prettyPrint=function(e,t,r){var a="";r=r||2,(t=t||0)>0&&(a+="\n");for(var o="",c=0;c<t*r;++c)o+=" ";switch(a+=o+"Tag: ",e.tagClass){case n.Class.UNIVERSAL:a+="Universal:";break;case n.Class.APPLICATION:a+="Application:";break;case n.Class.CONTEXT_SPECIFIC:a+="Context-Specific:";break;case n.Class.PRIVATE:a+="Private:"}if(e.tagClass===n.Class.UNIVERSAL)switch(a+=e.type,e.type){case n.Type.NONE:a+=" (None)";break;case n.Type.BOOLEAN:a+=" (Boolean)";break;case n.Type.INTEGER:a+=" (Integer)";break;case n.Type.BITSTRING:a+=" (Bit string)";break;case n.Type.OCTETSTRING:a+=" (Octet string)";break;case n.Type.NULL:a+=" (Null)";break;case n.Type.OID:a+=" (Object Identifier)";break;case n.Type.ODESC:a+=" (Object Descriptor)";break;case n.Type.EXTERNAL:a+=" (External or Instance of)";break;case n.Type.REAL:a+=" (Real)";break;case n.Type.ENUMERATED:a+=" (Enumerated)";break;case n.Type.EMBEDDED:a+=" (Embedded PDV)";break;case n.Type.UTF8:a+=" (UTF8)";break;case n.Type.ROID:a+=" (Relative Object Identifier)";break;case n.Type.SEQUENCE:a+=" (Sequence)";break;case n.Type.SET:a+=" (Set)";break;case n.Type.PRINTABLESTRING:a+=" (Printable String)";break;case n.Type.IA5String:a+=" (IA5String (ASCII))";break;case n.Type.UTCTIME:a+=" (UTC time)";break;case n.Type.GENERALIZEDTIME:a+=" (Generalized time)";break;case n.Type.BMPSTRING:a+=" (BMP String)"}else a+=e.type;if(a+="\n",a+=o+"Constructed: "+e.constructed+"\n",e.composed){var f=0,u="";for(c=0;c<e.value.length;++c)void 0!==e.value[c]&&(f+=1,u+=n.prettyPrint(e.value[c],t+1,r),c+1<e.value.length&&(u+=","));a+=o+"Sub values: "+f+u}else{if(a+=o+"Value: ",e.type===n.Type.OID){var d=n.derToOid(e.value);a+=d,i.pki&&i.pki.oids&&d in i.pki.oids&&(a+=" ("+i.pki.oids[d]+") ")}if(e.type===n.Type.INTEGER)try{a+=n.derToInteger(e.value)}catch(t){a+="0x"+i.util.bytesToHex(e.value)}else if(e.type===n.Type.BITSTRING){if(e.value.length>1?a+="0x"+i.util.bytesToHex(e.value.slice(1)):a+="(none)",e.value.length>0){var h=e.value.charCodeAt(0);1==h?a+=" (1 unused bit shown)":h>1&&(a+=" ("+h+" unused bits shown)")}}else if(e.type===n.Type.OCTETSTRING)s.test(e.value)||(a+="("+e.value+") "),a+="0x"+i.util.bytesToHex(e.value);else if(e.type===n.Type.UTF8)try{a+=i.util.decodeUtf8(e.value)}catch(t){if("URI malformed"!==t.message)throw t;a+="0x"+i.util.bytesToHex(e.value)+" (malformed UTF8)"}else e.type===n.Type.PRINTABLESTRING||e.type===n.Type.IA5String?a+=e.value:s.test(e.value)?a+="0x"+i.util.bytesToHex(e.value):0===e.value.length?a+="[null]":a+=e.value}return a}},function(e,t,r){"use strict";var i=r(10),n=r(20);function a(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function s(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function o(e){return 1===e.length?"0"+e:e}function c(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=n,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n<e.length;n+=2)r.push(parseInt(e[n]+e[n+1],16))}else for(var i=0,n=0;n<e.length;n++){var s=e.charCodeAt(n);s<128?r[i++]=s:s<2048?(r[i++]=s>>6|192,r[i++]=63&s|128):a(e,n)?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++n)),r[i++]=s>>18|240,r[i++]=s>>12&63|128,r[i++]=s>>6&63|128,r[i++]=63&s|128):(r[i++]=s>>12|224,r[i++]=s>>6&63|128,r[i++]=63&s|128)}else for(n=0;n<e.length;n++)r[n]=0|e[n];return r},t.toHex=function(e){for(var t="",r=0;r<e.length;r++)t+=o(e[r].toString(16));return t},t.htonl=s,t.toHex32=function(e,t){for(var r="",i=0;i<e.length;i++){var n=e[i];"little"===t&&(n=s(n)),r+=c(n.toString(16))}return r},t.zero2=o,t.zero8=c,t.join32=function(e,t,r,n){var a=r-t;i(a%4==0);for(var s=new Array(a/4),o=0,c=t;o<s.length;o++,c+=4){var f;f="big"===n?e[c]<<24|e[c+1]<<16|e[c+2]<<8|e[c+3]:e[c+3]<<24|e[c+2]<<16|e[c+1]<<8|e[c],s[o]=f>>>0}return s},t.split32=function(e,t){for(var r=new Array(4*e.length),i=0,n=0;i<e.length;i++,n+=4){var a=e[i];"big"===t?(r[n]=a>>>24,r[n+1]=a>>>16&255,r[n+2]=a>>>8&255,r[n+3]=255&a):(r[n+3]=a>>>24,r[n+2]=a>>>16&255,r[n+1]=a>>>8&255,r[n]=255&a)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<<t|e>>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,i){return e+t+r+i>>>0},t.sum32_5=function(e,t,r,i,n){return e+t+r+i+n>>>0},t.sum64=function(e,t,r,i){var n=e[t],a=i+e[t+1]>>>0,s=(a<i?1:0)+r+n;e[t]=s>>>0,e[t+1]=a},t.sum64_hi=function(e,t,r,i){return(t+i>>>0<t?1:0)+e+r>>>0},t.sum64_lo=function(e,t,r,i){return t+i>>>0},t.sum64_4_hi=function(e,t,r,i,n,a,s,o){var c=0,f=t;return c+=(f=f+i>>>0)<t?1:0,c+=(f=f+a>>>0)<a?1:0,e+r+n+s+(c+=(f=f+o>>>0)<o?1:0)>>>0},t.sum64_4_lo=function(e,t,r,i,n,a,s,o){return t+i+a+o>>>0},t.sum64_5_hi=function(e,t,r,i,n,a,s,o,c,f){var u=0,d=t;return u+=(d=d+i>>>0)<t?1:0,u+=(d=d+a>>>0)<a?1:0,u+=(d=d+o>>>0)<o?1:0,e+r+n+s+c+(u+=(d=d+f>>>0)<f?1:0)>>>0},t.sum64_5_lo=function(e,t,r,i,n,a,s,o,c,f){return t+i+a+o+f>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},function(e,t,r){var i=r(0);e.exports=i.md=i.md||{},i.md.algorithms=i.md.algorithms||{}},function(e,t,r){(function(e){!function(e,t){"use strict";function i(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function a(e,t,r){if(a.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var s;"object"==typeof e?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;try{s="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(57).Buffer}catch(e){}function o(e,t){var r=e.charCodeAt(t);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function c(e,t,r){var i=o(e,r);return r-1>=t&&(i|=o(e,r-1)<<4),i}function f(e,t,r,i){for(var n=0,a=Math.min(e.length,r),s=t;s<a;s++){var o=e.charCodeAt(s)-48;n*=i,n+=o>=49?o-49+10:o>=17?o-17+10:o}return n}a.isBN=function(e){return e instanceof a||null!==e&&"object"==typeof e&&e.constructor.wordSize===a.wordSize&&Array.isArray(e.words)},a.max=function(e,t){return e.cmp(t)>0?e:t},a.min=function(e,t){return e.cmp(t)<0?e:t},a.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===t?this._parseHex(e,n,r):(this._parseBase(e,t,n),"le"===r&&this._initArray(this.toArray(),t,r)))},a.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(i(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},a.prototype._initArray=function(e,t,r){if(i("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var a,s,o=0;if("be"===r)for(n=e.length-1,a=0;n>=0;n-=3)s=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[a]|=s<<o&67108863,this.words[a+1]=s>>>26-o&67108863,(o+=24)>=26&&(o-=26,a++);else if("le"===r)for(n=0,a=0;n<e.length;n+=3)s=e[n]|e[n+1]<<8|e[n+2]<<16,this.words[a]|=s<<o&67108863,this.words[a+1]=s>>>26-o&67108863,(o+=24)>=26&&(o-=26,a++);return this.strip()},a.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var n,a=0,s=0;if("be"===r)for(i=e.length-1;i>=t;i-=2)n=c(e,t,i)<<a,this.words[s]|=67108863&n,a>=18?(a-=18,s+=1,this.words[s]|=n>>>26):a+=8;else for(i=(e.length-t)%2==0?t+1:t;i<e.length;i+=2)n=c(e,t,i)<<a,this.words[s]|=67108863&n,a>=18?(a-=18,s+=1,this.words[s]|=n>>>26):a+=8;this.strip()},a.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var a=e.length-r,s=a%i,o=Math.min(a,a-s)+r,c=0,u=r;u<o;u+=i)c=f(e,u,u+i,t),this.imuln(n),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==s){var d=1;for(c=f(e,u,e.length,t),u=0;u<s;u++)d*=t;this.imuln(d),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},a.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},a.prototype.clone=function(){var e=new a(null);return this.copy(e),e},a.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var u=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function l(e,t,r){r.negative=t.negative^e.negative;var i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],a=0|t.words[0],s=n*a,o=67108863&s,c=s/67108864|0;r.words[0]=o;for(var f=1;f<i;f++){for(var u=c>>>26,d=67108863&c,h=Math.min(f,t.length-1),l=Math.max(0,f-e.length+1);l<=h;l++){var p=f-l|0;u+=(s=(n=0|e.words[p])*(a=0|t.words[l])+d)/67108864|0,d=67108863&s}r.words[f]=0|d,c=0|u}return 0!==c?r.words[f]=0|c:r.length--,r.strip()}a.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,a=0,s=0;s<this.length;s++){var o=this.words[s],c=(16777215&(o<<n|a)).toString(16);a=o>>>24-n&16777215,(n+=2)>=26&&(n-=26,s--),r=0!==a||s!==this.length-1?u[6-c.length]+c+r:c+r}for(0!==a&&(r=a.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var f=d[e],l=h[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modn(l).toString(e);r=(p=p.idivn(l)).isZero()?y+r:u[f-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(e,t){return i(void 0!==s),this.toArrayLike(s,e,t)},a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},a.prototype.toArrayLike=function(e,t,r){var n=this.byteLength(),a=r||Math.max(1,n);i(n<=a,"byte array longer than desired length"),i(a>0,"Requested array length <= 0"),this.strip();var s,o,c="le"===t,f=new e(a),u=this.clone();if(c){for(o=0;!u.isZero();o++)s=u.andln(255),u.iushrn(8),f[o]=s;for(;o<a;o++)f[o]=0}else{for(o=0;o<a-n;o++)f[o]=0;for(o=0;!u.isZero();o++)s=u.andln(255),u.iushrn(8),f[a-o-1]=s}return f},Math.clz32?a.prototype._countBits=function(e){return 32-Math.clz32(e)}:a.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},a.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},a.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},a.prototype.ior=function(e){return i(0==(this.negative|e.negative)),this.iuor(e)},a.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this.strip()},a.prototype.iand=function(e){return i(0==(this.negative|e.negative)),this.iuand(e)},a.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this.strip()},a.prototype.ixor=function(e){return i(0==(this.negative|e.negative)),this.iuxor(e)},a.prototype.xor=function(e){return this.length