@wix/cli-app 1.0.76 → 1.0.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wix/cli-app",
3
3
  "description": "CLI tool for Wix apps",
4
- "version": "1.0.76",
4
+ "version": "1.0.78",
5
5
  "author": "Amit Dahan",
6
6
  "dependencies": {
7
7
  "@vitejs/plugin-react-swc": "3.3.1",
@@ -9,7 +9,6 @@
9
9
  },
10
10
  "devDependencies": {
11
11
  "@types/lodash": "^4.14.194",
12
- "@vitejs/plugin-basic-ssl": "^1.0.1",
13
12
  "@wix/ambassador-ctp-app-cloud-deployer-service-v1-app-cloud-deployer": "^1.0.11",
14
13
  "@wix/ambassador-ctp-gradual-rollout-v1-app-config": "^1.0.32",
15
14
  "@wix/ambassador-devcenter-components-v1-component": "^1.0.244",
@@ -20,7 +19,6 @@
20
19
  "@wix/cli-auth": "0.0.0",
21
20
  "@wix/cli-core-definitions": "0.0.0",
22
21
  "@wix/cli-debug-log": "0.0.0",
23
- "@wix/cli-error-reporter": "0.0.0",
24
22
  "@wix/cli-errors": "0.0.0",
25
23
  "@wix/cli-fs": "0.0.0",
26
24
  "@wix/cli-http-client": "0.0.0",
@@ -116,5 +114,5 @@
116
114
  ]
117
115
  }
118
116
  },
119
- "falconPackageHash": "02b120c71e4d852ed393c833b32ffe6228309f86234a6f74cbb32d03"
117
+ "falconPackageHash": "ca533cb5df74fcd9747cc852aacb7b1b94b46b9a2c21c5482a2cbfe8"
120
118
  }
@@ -1,19 +0,0 @@
1
-
2
- import { createRequire as _createRequire } from 'node:module';
3
- const require = _createRequire(import.meta.url);
4
-
5
- import{h as Lt}from"./chunk-XPJ5XNVU.js";Lt();import Et from"crypto";var Sr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},K={options:{usePureJavaScript:!1}},xt={},Tr=xt,Dt={};xt.encode=function(e,t,r){if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');if(r!==void 0&&typeof r!="number")throw new TypeError('"maxline" must be a number.');var a="";if(!(e instanceof Uint8Array))a=Ir(e,t);else{var i=0,n=t.length,s=t.charAt(0),o=[0];for(i=0;i<e.length;++i){for(var f=0,u=e[i];f<o.length;++f)u+=o[f]<<8,o[f]=u%n,u=u/n|0;for(;u>0;)o.push(u%n),u=u/n|0}for(i=0;e[i]===0&&i<e.length-1;++i)a+=s;for(i=o.length-1;i>=0;--i)a+=t[o[i]]}if(r){var c=new RegExp(".{1,"+r+"}","g");a=a.match(c).join(`\r
6
- `)}return a};xt.decode=function(e,t){if(typeof e!="string")throw new TypeError('"input" must be a string.');if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');var r=Dt[t];if(!r){r=Dt[t]=[];for(var a=0;a<t.length;++a)r[t.charCodeAt(a)]=a}e=e.replace(/\s/g,"");for(var i=t.length,n=t.charAt(0),s=[0],a=0;a<e.length;a++){var o=r[e.charCodeAt(a)];if(o===void 0)return;for(var f=0,u=o;f<s.length;++f)u+=s[f]*i,s[f]=u&255,u>>=8;for(;u>0;)s.push(u&255),u>>=8}for(var c=0;e[c]===n&&c<e.length-1;++c)s.push(0);return typeof Buffer<"u"?Buffer.from(s.reverse()):new Uint8Array(s.reverse())};function Ir(e,t){var r=0,a=t.length,i=t.charAt(0),n=[0];for(r=0;r<e.length();++r){for(var s=0,o=e.at(r);s<n.length;++s)o+=n[s]<<8,n[s]=o%a,o=o/a|0;for(;o>0;)n.push(o%a),o=o/a|0}var f="";for(r=0;e.at(r)===0&&r<e.length()-1;++r)f+=i;for(r=n.length-1;r>=0;--r)f+=t[n[r]];return f}var _t=K,Pt=Tr,v=_t.util=_t.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){v.nextTick=process.nextTick,typeof setImmediate=="function"?v.setImmediate=setImmediate:v.setImmediate=v.nextTick;return}if(typeof setImmediate=="function"){v.setImmediate=function(){return setImmediate.apply(void 0,arguments)},v.nextTick=function(s){return setImmediate(s)};return}if(v.setImmediate=function(s){setTimeout(s,0)},typeof window<"u"&&typeof window.postMessage=="function"){let s=function(o){if(o.source===window&&o.data===e){o.stopPropagation();var f=t.slice();t.length=0,f.forEach(function(u){u()})}};var e="forge.setImmediate",t=[];v.setImmediate=function(o){t.push(o),t.length===1&&window.postMessage(e,"*")},window.addEventListener("message",s,!0)}if(typeof MutationObserver<"u"){var r=Date.now(),a=!0,i=document.createElement("div"),t=[];new MutationObserver(function(){var o=t.slice();t.length=0,o.forEach(function(f){f()})}).observe(i,{attributes:!0});var n=v.setImmediate;v.setImmediate=function(o){Date.now()-r>15?(r=Date.now(),n(o)):(t.push(o),t.length===1&&i.setAttribute("a",a=!a))}}v.nextTick=v.setImmediate})();v.isNodejs=typeof process<"u"&&process.versions&&process.versions.node;v.globalScope=function(){return v.isNodejs?Sr:typeof self>"u"?window:self}();v.isArray=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};v.isArrayBuffer=function(e){return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer};v.isArrayBufferView=function(e){return e&&v.isArrayBuffer(e.buffer)&&e.byteLength!==void 0};function He(e){if(!(e===8||e===16||e===24||e===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}v.ByteBuffer=St;function St(e){if(this.data="",this.read=0,typeof e=="string")this.data=e;else if(v.isArrayBuffer(e)||v.isArrayBufferView(e))if(typeof Buffer<"u"&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch{for(var r=0;r<t.length;++r)this.putByte(t[r])}}else(e instanceof St||typeof e=="object"&&typeof e.data=="string"&&typeof e.read=="number")&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}v.ByteStringBuffer=St;var Ar=4096;v.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>Ar&&(this.data.substr(0,1),this._constructedStringLength=0)};v.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};v.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};v.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))};v.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)t&1&&(r+=e),t>>>=1,t>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this};v.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this};v.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(v.encodeUtf8(e))};v.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))};v.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))};v.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(e&255))};v.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255))};v.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))};v.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))};v.ByteStringBuffer.prototype.putInt=function(e,t){He(t);var r="";do t-=8,r+=String.fromCharCode(e>>t&255);while(t>0);return this.putBytes(r)};v.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)};v.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())};v.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};v.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e};v.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};v.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};v.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e};v.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};v.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};v.ByteStringBuffer.prototype.getInt=function(e){He(e);var t=0;do t=(t<<8)+this.data.charCodeAt(this.read++),e-=8;while(e>0);return t};v.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t};v.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):e===0?t="":(t=this.read===0?this.data:this.data.slice(this.read),this.clear()),t};v.ByteStringBuffer.prototype.bytes=function(e){return typeof e>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+e)};v.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)};v.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};v.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};v.ByteStringBuffer.prototype.copy=function(){var e=v.createBuffer(this.data);return e.read=this.read,e};v.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this};v.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};v.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};v.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};v.ByteStringBuffer.prototype.toString=function(){return v.decodeUtf8(this.bytes())};function Br(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var r=v.isArrayBuffer(e),a=v.isArrayBufferView(e);if(r||a){r?this.data=new DataView(e):this.data=new DataView(e.buffer,e.byteOffset,e.byteLength),this.write="writeOffset"in t?t.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,e!=null&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}v.DataBuffer=Br;v.DataBuffer.prototype.length=function(){return this.write-this.read};v.DataBuffer.prototype.isEmpty=function(){return this.length()<=0};v.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),a=new Uint8Array(this.length()+t);return a.set(r),this.data=new DataView(a.buffer),this};v.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this};v.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r<t;++r)this.data.setUint8(e);return this};v.DataBuffer.prototype.putBytes=function(e,t){if(v.isArrayBufferView(e)){var r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a=r.byteLength-r.byteOffset;this.accommodate(a);var i=new Uint8Array(this.data.buffer,this.write);return i.set(r),this.write+=a,this}if(v.isArrayBuffer(e)){var r=new Uint8Array(e);this.accommodate(r.byteLength);var i=new Uint8Array(this.data.buffer);return i.set(r,this.write),this.write+=r.byteLength,this}if(e instanceof v.DataBuffer||typeof e=="object"&&typeof e.read=="number"&&typeof e.write=="number"&&v.isArrayBufferView(e.data)){var r=new Uint8Array(e.data.byteLength,e.read,e.length());this.accommodate(r.byteLength);var i=new Uint8Array(e.data.byteLength,this.write);return i.set(r),this.write+=r.byteLength,this}if(e instanceof v.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary",typeof e=="string"){var n;if(t==="hex")return this.accommodate(Math.ceil(e.length/2)),n=new Uint8Array(this.data.buffer,this.write),this.write+=v.binary.hex.decode(e,n,this.write),this;if(t==="base64")return this.accommodate(Math.ceil(e.length/4)*3),n=new Uint8Array(this.data.buffer,this.write),this.write+=v.binary.base64.decode(e,n,this.write),this;if(t==="utf8"&&(e=v.encodeUtf8(e),t="binary"),t==="binary"||t==="raw")return this.accommodate(e.length),n=new Uint8Array(this.data.buffer,this.write),this.write+=v.binary.raw.decode(n),this;if(t==="utf16")return this.accommodate(e.length*2),n=new Uint16Array(this.data.buffer,this.write),this.write+=v.text.utf16.encode(n),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)};v.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this};v.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")};v.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this};v.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};v.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this};v.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this};v.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};v.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this};v.DataBuffer.prototype.putInt=function(e,t){He(t),this.accommodate(t/8);do t-=8,this.data.setInt8(this.write++,e>>t&255);while(t>0);return this};v.DataBuffer.prototype.putSignedInt=function(e,t){return He(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)};v.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};v.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e};v.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e};v.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e};v.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e};v.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e};v.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e};v.DataBuffer.prototype.getInt=function(e){He(e);var t=0;do t=(t<<8)+this.data.getInt8(this.read++),e-=8;while(e>0);return t};v.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<<e-2;return t>=r&&(t-=r<<1),t};v.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):e===0?t="":(t=this.read===0?this.data:this.data.slice(this.read),this.clear()),t};v.DataBuffer.prototype.bytes=function(e){return typeof e>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+e)};v.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)};v.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this};v.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};v.DataBuffer.prototype.copy=function(){return new v.DataBuffer(this)};v.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};v.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};v.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this};v.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};v.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if(e=e||"utf8",e==="binary"||e==="raw")return v.binary.raw.encode(t);if(e==="hex")return v.binary.hex.encode(t);if(e==="base64")return v.binary.base64.encode(t);if(e==="utf8")return v.text.utf8.decode(t);if(e==="utf16")return v.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)};v.createBuffer=function(e,t){return t=t||"raw",e!==void 0&&t==="utf8"&&(e=v.encodeUtf8(e)),new v.ByteBuffer(e)};v.fillString=function(e,t){for(var r="";t>0;)t&1&&(r+=e),t>>>=1,t>0&&(e+=e);return r};v.xorBytes=function(e,t,r){for(var a="",i="",n="",s=0,o=0;r>0;--r,++s)i=e.charCodeAt(s)^t.charCodeAt(s),o>=10&&(a+=n,n="",o=0),n+=String.fromCharCode(i),++o;return a+=n,a};v.hexToBytes=function(e){var t="",r=0;for(e.length&!0&&(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};v.bytesToHex=function(e){return v.createBuffer(e).toHex()};v.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255)};var xe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Se=[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],Zt="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";v.encode64=function(e,t){for(var r="",a="",i,n,s,o=0;o<e.length;)i=e.charCodeAt(o++),n=e.charCodeAt(o++),s=e.charCodeAt(o++),r+=xe.charAt(i>>2),r+=xe.charAt((i&3)<<4|n>>4),isNaN(n)?r+="==":(r+=xe.charAt((n&15)<<2|s>>6),r+=isNaN(s)?"=":xe.charAt(s&63)),t&&r.length>t&&(a+=r.substr(0,t)+`\r
7
- `,r=r.substr(t));return a+=r,a};v.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t="",r,a,i,n,s=0;s<e.length;)r=Se[e.charCodeAt(s++)-43],a=Se[e.charCodeAt(s++)-43],i=Se[e.charCodeAt(s++)-43],n=Se[e.charCodeAt(s++)-43],t+=String.fromCharCode(r<<2|a>>4),i!==64&&(t+=String.fromCharCode((a&15)<<4|i>>2),n!==64&&(t+=String.fromCharCode((i&3)<<6|n)));return t};v.encodeUtf8=function(e){return unescape(encodeURIComponent(e))};v.decodeUtf8=function(e){return decodeURIComponent(escape(e))};v.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:Pt.encode,decode:Pt.decode}};v.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)};v.binary.raw.decode=function(e,t,r){var a=t;a||(a=new Uint8Array(e.length)),r=r||0;for(var i=r,n=0;n<e.length;++n)a[i++]=e.charCodeAt(n);return t?i-r:a};v.binary.hex.encode=v.bytesToHex;v.binary.hex.decode=function(e,t,r){var a=t;a||(a=new Uint8Array(Math.ceil(e.length/2))),r=r||0;var i=0,n=r;for(e.length&1&&(i=1,a[n++]=parseInt(e[0],16));i<e.length;i+=2)a[n++]=parseInt(e.substr(i,2),16);return t?n-r:a};v.binary.base64.encode=function(e,t){for(var r="",a="",i,n,s,o=0;o<e.byteLength;)i=e[o++],n=e[o++],s=e[o++],r+=xe.charAt(i>>2),r+=xe.charAt((i&3)<<4|n>>4),isNaN(n)?r+="==":(r+=xe.charAt((n&15)<<2|s>>6),r+=isNaN(s)?"=":xe.charAt(s&63)),t&&r.length>t&&(a+=r.substr(0,t)+`\r
8
- `,r=r.substr(t));return a+=r,a};v.binary.base64.decode=function(e,t,r){var a=t;a||(a=new Uint8Array(Math.ceil(e.length/4)*3)),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var i,n,s,o,f=0,u=r;f<e.length;)i=Se[e.charCodeAt(f++)-43],n=Se[e.charCodeAt(f++)-43],s=Se[e.charCodeAt(f++)-43],o=Se[e.charCodeAt(f++)-43],a[u++]=i<<2|n>>4,s!==64&&(a[u++]=(n&15)<<4|s>>2,o!==64&&(a[u++]=(s&3)<<6|o));return t?u-r:a.subarray(0,u)};v.binary.base58.encode=function(e,t){return v.binary.baseN.encode(e,Zt,t)};v.binary.base58.decode=function(e,t){return v.binary.baseN.decode(e,Zt,t)};v.text={utf8:{},utf16:{}};v.text.utf8.encode=function(e,t,r){e=v.encodeUtf8(e);var a=t;a||(a=new Uint8Array(e.length)),r=r||0;for(var i=r,n=0;n<e.length;++n)a[i++]=e.charCodeAt(n);return t?i-r:a};v.text.utf8.decode=function(e){return v.decodeUtf8(String.fromCharCode.apply(null,e))};v.text.utf16.encode=function(e,t,r){var a=t;a||(a=new Uint8Array(e.length*2));var i=new Uint16Array(a.buffer);r=r||0;for(var n=r,s=r,o=0;o<e.length;++o)i[s++]=e.charCodeAt(o),n+=2;return t?n-r:a};v.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))};v.deflate=function(e,t,r){if(t=v.decode64(e.deflate(v.encode64(t)).rval),r){var a=2,i=t.charCodeAt(1);i&32&&(a=6),t=t.substring(a,t.length-4)}return t};v.inflate=function(e,t,r){var a=e.inflate(v.encode64(t)).rval;return a===null?null:v.decode64(a)};var Tt=function(e,t,r){if(!e)throw new Error("WebStorage not available.");var a;if(r===null?a=e.removeItem(t):(r=v.encode64(JSON.stringify(r)),a=e.setItem(t,r)),typeof a<"u"&&a.rval!==!0){var i=new Error(a.error.message);throw i.id=a.error.id,i.name=a.error.name,i}},It=function(e,t){if(!e)throw new Error("WebStorage not available.");var r=e.getItem(t);if(e.init)if(r.rval===null){if(r.error){var a=new Error(r.error.message);throw a.id=r.error.id,a.name=r.error.name,a}r=null}else r=r.rval;return r!==null&&(r=JSON.parse(v.decode64(r))),r},br=function(e,t,r,a){var i=It(e,t);i===null&&(i={}),i[r]=a,Tt(e,t,i)},Nr=function(e,t,r){var a=It(e,t);return a!==null&&(a=r in a?a[r]:null),a},Rr=function(e,t,r){var a=It(e,t);if(a!==null&&r in a){delete a[r];var i=!0;for(var n in a){i=!1;break}i&&(a=null),Tt(e,t,a)}},wr=function(e,t){Tt(e,t,null)},at=function(e,t,r){var a=null;typeof r>"u"&&(r=["web","flash"]);var i,n=!1,s=null;for(var o in r){i=r[o];try{if(i==="flash"||i==="both"){if(t[0]===null)throw new Error("Flash local storage not available.");a=e.apply(this,t),n=i==="flash"}(i==="web"||i==="both")&&(t[0]=localStorage,a=e.apply(this,t),n=!0)}catch(f){s=f}if(n)break}if(!n)throw s;return a};v.setItem=function(e,t,r,a,i){at(br,arguments,i)};v.getItem=function(e,t,r,a){return at(Nr,arguments,a)};v.removeItem=function(e,t,r,a){at(Rr,arguments,a)};v.clearItems=function(e,t,r){at(wr,arguments,r)};v.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0};v.format=function(e){for(var t=/%./g,r,a,i=0,n=[],s=0;r=t.exec(e);){a=e.substring(s,t.lastIndex-2),a.length>0&&n.push(a),s=t.lastIndex;var o=r[0][1];switch(o){case"s":case"o":i<arguments.length?n.push(arguments[i+++1]):n.push("<?>");break;case"%":n.push("%");break;default:n.push("<%"+o+"?>")}}return n.push(e.substring(s)),n.join("")};v.formatNumber=function(e,t,r,a){var i=e,n=isNaN(t=Math.abs(t))?2:t,s=r===void 0?",":r,o=a===void 0?".":a,f=i<0?"-":"",u=parseInt(i=Math.abs(+i||0).toFixed(n),10)+"",c=u.length>3?u.length%3:0;return f+(c?u.substr(0,c)+o:"")+u.substr(c).replace(/(\d{3})(?=\d)/g,"$1"+o)+(n?s+Math.abs(i-u).toFixed(n).slice(2):"")};v.formatSize=function(e){return e>=1073741824?e=v.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?e=v.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?e=v.formatNumber(e/1024,0)+" KiB":e=v.formatNumber(e,0)+" bytes",e};v.bytesFromIP=function(e){return e.indexOf(".")!==-1?v.bytesFromIPv4(e):e.indexOf(":")!==-1?v.bytesFromIPv6(e):null};v.bytesFromIPv4=function(e){if(e=e.split("."),e.length!==4)return null;for(var t=v.createBuffer(),r=0;r<e.length;++r){var a=parseInt(e[r],10);if(isNaN(a))return null;t.putByte(a)}return t.getBytes()};v.bytesFromIPv6=function(e){var t=0;e=e.split(":").filter(function(s){return s.length===0&&++t,!0});for(var r=(8-e.length+t)*2,a=v.createBuffer(),i=0;i<8;++i){if(!e[i]||e[i].length===0){a.fillWithByte(0,r),r=0;continue}var n=v.hexToBytes(e[i]);n.length<2&&a.putByte(0),a.putBytes(n)}return a.getBytes()};v.bytesToIP=function(e){return e.length===4?v.bytesToIPv4(e):e.length===16?v.bytesToIPv6(e):null};v.bytesToIPv4=function(e){if(e.length!==4)return null;for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r));return t.join(".")};v.bytesToIPv6=function(e){if(e.length!==16)return null;for(var t=[],r=[],a=0,i=0;i<e.length;i+=2){for(var n=v.bytesToHex(e[i]+e[i+1]);n[0]==="0"&&n!=="0";)n=n.substr(1);if(n==="0"){var s=r[r.length-1],o=t.length;!s||o!==s.end+1?r.push({start:o,end:o}):(s.end=o,s.end-s.start>r[a].end-r[a].start&&(a=r.length-1))}t.push(n)}if(r.length>0){var f=r[a];f.end-f.start>0&&(t.splice(f.start,f.end-f.start+1,""),f.start===0&&t.unshift(""),f.end===7&&t.push(""))}return t.join(":")};v.estimateCores=function(e,t){if(typeof e=="function"&&(t=e,e={}),e=e||{},"cores"in v&&!e.update)return t(null,v.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return v.cores=navigator.hardwareConcurrency,t(null,v.cores);if(typeof Worker>"u")return v.cores=1,t(null,v.cores);if(typeof Blob>"u")return v.cores=2,t(null,v.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(s){var o=Date.now(),f=o+4;self.postMessage({st:o,et:f})})}.toString(),")()"],{type:"application/javascript"}));a([],5,16);function a(s,o,f){if(o===0){var u=Math.floor(s.reduce(function(c,h){return c+h},0)/s.length);return v.cores=Math.max(1,u),URL.revokeObjectURL(r),t(null,v.cores)}i(f,function(c,h){s.push(n(f,h)),a(s,o-1,f)})}function i(s,o){for(var f=[],u=[],c=0;c<s;++c){var h=new Worker(r);h.addEventListener("message",function(d){if(u.push(d.data),u.length===s){for(var C=0;C<s;++C)f[C].terminate();o(null,u)}}),f.push(h)}for(var c=0;c<s;++c)f[c].postMessage(c)}function n(s,o){for(var f=[],u=0;u<s;++u)for(var c=o[u],h=f[u]=[],d=0;d<s;++d)if(u!==d){var C=o[d];(c.st>C.st&&c.st<C.et||C.st>c.st&&C.st<c.et)&&h.push(d)}return f.reduce(function(y,E){return Math.max(y,E.length)},0)}};var ze=K;ze.pki=ze.pki||{};var ht=ze.pki.oids=ze.oids=ze.oids||{};function I(e,t){ht[e]=t,ht[t]=e}function z(e,t){ht[e]=t}I("1.2.840.113549.1.1.1","rsaEncryption");I("1.2.840.113549.1.1.4","md5WithRSAEncryption");I("1.2.840.113549.1.1.5","sha1WithRSAEncryption");I("1.2.840.113549.1.1.7","RSAES-OAEP");I("1.2.840.113549.1.1.8","mgf1");I("1.2.840.113549.1.1.9","pSpecified");I("1.2.840.113549.1.1.10","RSASSA-PSS");I("1.2.840.113549.1.1.11","sha256WithRSAEncryption");I("1.2.840.113549.1.1.12","sha384WithRSAEncryption");I("1.2.840.113549.1.1.13","sha512WithRSAEncryption");I("1.3.101.112","EdDSA25519");I("1.2.840.10040.4.3","dsa-with-sha1");I("1.3.14.3.2.7","desCBC");I("1.3.14.3.2.26","sha1");I("1.3.14.3.2.29","sha1WithRSASignature");I("2.16.840.1.101.3.4.2.1","sha256");I("2.16.840.1.101.3.4.2.2","sha384");I("2.16.840.1.101.3.4.2.3","sha512");I("2.16.840.1.101.3.4.2.4","sha224");I("2.16.840.1.101.3.4.2.5","sha512-224");I("2.16.840.1.101.3.4.2.6","sha512-256");I("1.2.840.113549.2.2","md2");I("1.2.840.113549.2.5","md5");I("1.2.840.113549.1.7.1","data");I("1.2.840.113549.1.7.2","signedData");I("1.2.840.113549.1.7.3","envelopedData");I("1.2.840.113549.1.7.4","signedAndEnvelopedData");I("1.2.840.113549.1.7.5","digestedData");I("1.2.840.113549.1.7.6","encryptedData");I("1.2.840.113549.1.9.1","emailAddress");I("1.2.840.113549.1.9.2","unstructuredName");I("1.2.840.113549.1.9.3","contentType");I("1.2.840.113549.1.9.4","messageDigest");I("1.2.840.113549.1.9.5","signingTime");I("1.2.840.113549.1.9.6","counterSignature");I("1.2.840.113549.1.9.7","challengePassword");I("1.2.840.113549.1.9.8","unstructuredAddress");I("1.2.840.113549.1.9.14","extensionRequest");I("1.2.840.113549.1.9.20","friendlyName");I("1.2.840.113549.1.9.21","localKeyId");I("1.2.840.113549.1.9.22.1","x509Certificate");I("1.2.840.113549.1.12.10.1.1","keyBag");I("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");I("1.2.840.113549.1.12.10.1.3","certBag");I("1.2.840.113549.1.12.10.1.4","crlBag");I("1.2.840.113549.1.12.10.1.5","secretBag");I("1.2.840.113549.1.12.10.1.6","safeContentsBag");I("1.2.840.113549.1.5.13","pkcs5PBES2");I("1.2.840.113549.1.5.12","pkcs5PBKDF2");I("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");I("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");I("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");I("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");I("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");I("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");I("1.2.840.113549.2.7","hmacWithSHA1");I("1.2.840.113549.2.8","hmacWithSHA224");I("1.2.840.113549.2.9","hmacWithSHA256");I("1.2.840.113549.2.10","hmacWithSHA384");I("1.2.840.113549.2.11","hmacWithSHA512");I("1.2.840.113549.3.7","des-EDE3-CBC");I("2.16.840.1.101.3.4.1.2","aes128-CBC");I("2.16.840.1.101.3.4.1.22","aes192-CBC");I("2.16.840.1.101.3.4.1.42","aes256-CBC");I("2.5.4.3","commonName");I("2.5.4.4","surname");I("2.5.4.5","serialNumber");I("2.5.4.6","countryName");I("2.5.4.7","localityName");I("2.5.4.8","stateOrProvinceName");I("2.5.4.9","streetAddress");I("2.5.4.10","organizationName");I("2.5.4.11","organizationalUnitName");I("2.5.4.12","title");I("2.5.4.13","description");I("2.5.4.15","businessCategory");I("2.5.4.17","postalCode");I("2.5.4.42","givenName");I("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");I("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");I("2.16.840.1.113730.1.1","nsCertType");I("2.16.840.1.113730.1.13","nsComment");z("2.5.29.1","authorityKeyIdentifier");z("2.5.29.2","keyAttributes");z("2.5.29.3","certificatePolicies");z("2.5.29.4","keyUsageRestriction");z("2.5.29.5","policyMapping");z("2.5.29.6","subtreesConstraint");z("2.5.29.7","subjectAltName");z("2.5.29.8","issuerAltName");z("2.5.29.9","subjectDirectoryAttributes");z("2.5.29.10","basicConstraints");z("2.5.29.11","nameConstraints");z("2.5.29.12","policyConstraints");z("2.5.29.13","basicConstraints");I("2.5.29.14","subjectKeyIdentifier");I("2.5.29.15","keyUsage");z("2.5.29.16","privateKeyUsagePeriod");I("2.5.29.17","subjectAltName");I("2.5.29.18","issuerAltName");I("2.5.29.19","basicConstraints");z("2.5.29.20","cRLNumber");z("2.5.29.21","cRLReason");z("2.5.29.22","expirationDate");z("2.5.29.23","instructionCode");z("2.5.29.24","invalidityDate");z("2.5.29.25","cRLDistributionPoints");z("2.5.29.26","issuingDistributionPoint");z("2.5.29.27","deltaCRLIndicator");z("2.5.29.28","issuingDistributionPoint");z("2.5.29.29","certificateIssuer");z("2.5.29.30","nameConstraints");I("2.5.29.31","cRLDistributionPoints");I("2.5.29.32","certificatePolicies");z("2.5.29.33","policyMappings");z("2.5.29.34","policyConstraints");I("2.5.29.35","authorityKeyIdentifier");z("2.5.29.36","policyConstraints");I("2.5.29.37","extKeyUsage");z("2.5.29.46","freshestCRL");z("2.5.29.54","inhibitAnyPolicy");I("1.3.6.1.4.1.11129.2.4.2","timestampList");I("1.3.6.1.5.5.7.1.1","authorityInfoAccess");I("1.3.6.1.5.5.7.3.1","serverAuth");I("1.3.6.1.5.5.7.3.2","clientAuth");I("1.3.6.1.5.5.7.3.3","codeSigning");I("1.3.6.1.5.5.7.3.4","emailProtection");I("1.3.6.1.5.5.7.3.8","timeStamping");var W=K,b=W.asn1=W.asn1||{};b.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};b.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};b.create=function(e,t,r,a,i){if(W.util.isArray(a)){for(var n=[],s=0;s<a.length;++s)a[s]!==void 0&&n.push(a[s]);a=n}var o={tagClass:e,type:t,constructed:r,composed:r||W.util.isArray(a),value:a};return i&&"bitStringContents"in i&&(o.bitStringContents=i.bitStringContents,o.original=b.copy(o)),o};b.copy=function(e,t){var r;if(W.util.isArray(e)){r=[];for(var a=0;a<e.length;++a)r.push(b.copy(e[a],t));return r}return typeof e=="string"?e:(r={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:b.copy(e.value,t)},t&&!t.excludeBitStringContents&&(r.bitStringContents=e.bitStringContents),r)};b.equals=function(e,t,r){if(W.util.isArray(e)){if(!W.util.isArray(t)||e.length!==t.length)return!1;for(var a=0;a<e.length;++a)if(!b.equals(e[a],t[a]))return!1;return!0}if(typeof e!=typeof t)return!1;if(typeof e=="string")return e===t;var i=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&b.equals(e.value,t.value);return r&&r.includeBitStringContents&&(i=i&&e.bitStringContents===t.bitStringContents),i};b.getBerValueLength=function(e){var t=e.getByte();if(t!==128){var r,a=t&128;return a?r=e.getInt((t&127)<<3):r=t,r}};function qe(e,t,r){if(r>t){var a=new Error("Too few bytes to parse DER.");throw a.available=e.length(),a.remaining=t,a.requested=r,a}}var Ur=function(e,t){var r=e.getByte();if(t--,r!==128){var a,i=r&128;if(!i)a=r;else{var n=r&127;qe(e,t,n),a=e.getInt(n<<3)}if(a<0)throw new Error("Negative length: "+a);return a}};b.fromDer=function(e,t){t===void 0&&(t={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof t=="boolean"&&(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),typeof e=="string"&&(e=W.util.createBuffer(e));var r=e.length(),a=Ye(e,e.length(),0,t);if(t.parseAllBytes&&e.length()!==0){var i=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw i.byteCount=r,i.remaining=e.length(),i}return a};function Ye(e,t,r,a){var i;qe(e,t,2);var n=e.getByte();t--;var s=n&192,o=n&31;i=e.length();var f=Ur(e,t);if(t-=i-e.length(),f!==void 0&&f>t){if(a.strict){var u=new Error("Too few bytes to read ASN.1 value.");throw u.available=e.length(),u.remaining=t,u.requested=f,u}f=t}var c,h,d=(n&32)===32;if(d)if(c=[],f===void 0)for(;;){if(qe(e,t,2),e.bytes(2)===String.fromCharCode(0,0)){e.getBytes(2),t-=2;break}i=e.length(),c.push(Ye(e,t,r+1,a)),t-=i-e.length()}else for(;f>0;)i=e.length(),c.push(Ye(e,f,r+1,a)),t-=i-e.length(),f-=i-e.length();if(c===void 0&&s===b.Class.UNIVERSAL&&o===b.Type.BITSTRING&&(h=e.bytes(f)),c===void 0&&a.decodeBitStrings&&s===b.Class.UNIVERSAL&&o===b.Type.BITSTRING&&f>1){var C=e.read,y=t,E=0;if(o===b.Type.BITSTRING&&(qe(e,t,1),E=e.getByte(),t--),E===0)try{i=e.length();var x={strict:!0,decodeBitStrings:!0},S=Ye(e,t,r+1,x),N=i-e.length();t-=N,o==b.Type.BITSTRING&&N++;var B=S.tagClass;N===f&&(B===b.Class.UNIVERSAL||B===b.Class.CONTEXT_SPECIFIC)&&(c=[S])}catch{}c===void 0&&(e.read=C,t=y)}if(c===void 0){if(f===void 0){if(a.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");f=t}if(o===b.Type.BMPSTRING)for(c="";f>0;f-=2)qe(e,t,2),c+=String.fromCharCode(e.getInt16()),t-=2;else c=e.getBytes(f),t-=f}var P=h===void 0?null:{bitStringContents:h};return b.create(s,o,d,c,P)}b.toDer=function(e){var t=W.util.createBuffer(),r=e.tagClass|e.type,a=W.util.createBuffer(),i=!1;if("bitStringContents"in e&&(i=!0,e.original&&(i=b.equals(e,e.original))),i)a.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:a.putByte(0);for(var n=0;n<e.value.length;++n)e.value[n]!==void 0&&a.putBuffer(b.toDer(e.value[n]))}else if(e.type===b.Type.BMPSTRING)for(var n=0;n<e.value.length;++n)a.putInt16(e.value.charCodeAt(n));else e.type===b.Type.INTEGER&&e.value.length>1&&(e.value.charCodeAt(0)===0&&!(e.value.charCodeAt(1)&128)||e.value.charCodeAt(0)===255&&(e.value.charCodeAt(1)&128)===128)?a.putBytes(e.value.substr(1)):a.putBytes(e.value);if(t.putByte(r),a.length()<=127)t.putByte(a.length()&127);else{var s=a.length(),o="";do o+=String.fromCharCode(s&255),s=s>>>8;while(s>0);t.putByte(o.length|128);for(var n=o.length-1;n>=0;--n)t.putByte(o.charCodeAt(n))}return t.putBuffer(a),t};b.oidToDer=function(e){var t=e.split("."),r=W.util.createBuffer();r.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var a,i,n,s,o=2;o<t.length;++o){a=!0,i=[],n=parseInt(t[o],10);do s=n&127,n=n>>>7,a||(s|=128),i.push(s),a=!1;while(n>0);for(var f=i.length-1;f>=0;--f)r.putByte(i[f])}return r};b.derToOid=function(e){var t;typeof e=="string"&&(e=W.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var a=0;e.length()>0;)r=e.getByte(),a=a<<7,r&128?a+=r&127:(t+="."+(a+r),a=0);return t};b.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var a=parseInt(e.substr(2,2),10)-1,i=parseInt(e.substr(4,2),10),n=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),o=0;if(e.length>11){var f=e.charAt(10),u=10;f!=="+"&&f!=="-"&&(o=parseInt(e.substr(10,2),10),u+=2)}if(t.setUTCFullYear(r,a,i),t.setUTCHours(n,s,o,0),u&&(f=e.charAt(u),f==="+"||f==="-")){var c=parseInt(e.substr(u+1,2),10),h=parseInt(e.substr(u+4,2),10),d=c*60+h;d*=6e4,f==="+"?t.setTime(+t-d):t.setTime(+t+d)}return t};b.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),a=parseInt(e.substr(4,2),10)-1,i=parseInt(e.substr(6,2),10),n=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),o=parseInt(e.substr(12,2),10),f=0,u=0,c=!1;e.charAt(e.length-1)==="Z"&&(c=!0);var h=e.length-5,d=e.charAt(h);if(d==="+"||d==="-"){var C=parseInt(e.substr(h+1,2),10),y=parseInt(e.substr(h+4,2),10);u=C*60+y,u*=6e4,d==="+"&&(u*=-1),c=!0}return e.charAt(14)==="."&&(f=parseFloat(e.substr(14),10)*1e3),c?(t.setUTCFullYear(r,a,i),t.setUTCHours(n,s,o,f),t.setTime(+t+u)):(t.setFullYear(r,a,i),t.setHours(n,s,o,f)),t};b.dateToUtcTime=function(e){if(typeof e=="string")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 a=0;a<r.length;++a)r[a].length<2&&(t+="0"),t+=r[a];return t+="Z",t};b.dateToGeneralizedTime=function(e){if(typeof e=="string")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 a=0;a<r.length;++a)r[a].length<2&&(t+="0"),t+=r[a];return t+="Z",t};b.integerToDer=function(e){var t=W.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};b.derToInteger=function(e){typeof e=="string"&&(e=W.util.createBuffer(e));var t=e.length()*8;if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)};b.validate=function(e,t,r,a){var i=!1;if((e.tagClass===t.tagClass||typeof t.tagClass>"u")&&(e.type===t.type||typeof t.type>"u"))if(e.constructed===t.constructed||typeof t.constructed>"u"){if(i=!0,t.value&&W.util.isArray(t.value))for(var n=0,s=0;i&&s<t.value.length;++s)i=t.value[s].optional||!1,e.value[n]&&(i=b.validate(e.value[n],t.value[s],r,a),i?++n:t.value[s].optional&&(i=!0)),!i&&a&&a.push("["+t.name+'] Tag class "'+t.tagClass+'", type "'+t.type+'" expected value length "'+t.value.length+'", got "'+e.value.length+'"');if(i&&r&&(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{var o=e.bitStringContents.charCodeAt(0);if(o!==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+'"');else 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+'"'));return i};var kt=/[^\\u0000-\\u00ff]/;b.prettyPrint=function(e,t,r){var a="";t=t||0,r=r||2,t>0&&(a+=`
9
- `);for(var i="",n=0;n<t*r;++n)i+=" ";switch(a+=i+"Tag: ",e.tagClass){case b.Class.UNIVERSAL:a+="Universal:";break;case b.Class.APPLICATION:a+="Application:";break;case b.Class.CONTEXT_SPECIFIC:a+="Context-Specific:";break;case b.Class.PRIVATE:a+="Private:";break}if(e.tagClass===b.Class.UNIVERSAL)switch(a+=e.type,e.type){case b.Type.NONE:a+=" (None)";break;case b.Type.BOOLEAN:a+=" (Boolean)";break;case b.Type.INTEGER:a+=" (Integer)";break;case b.Type.BITSTRING:a+=" (Bit string)";break;case b.Type.OCTETSTRING:a+=" (Octet string)";break;case b.Type.NULL:a+=" (Null)";break;case b.Type.OID:a+=" (Object Identifier)";break;case b.Type.ODESC:a+=" (Object Descriptor)";break;case b.Type.EXTERNAL:a+=" (External or Instance of)";break;case b.Type.REAL:a+=" (Real)";break;case b.Type.ENUMERATED:a+=" (Enumerated)";break;case b.Type.EMBEDDED:a+=" (Embedded PDV)";break;case b.Type.UTF8:a+=" (UTF8)";break;case b.Type.ROID:a+=" (Relative Object Identifier)";break;case b.Type.SEQUENCE:a+=" (Sequence)";break;case b.Type.SET:a+=" (Set)";break;case b.Type.PRINTABLESTRING:a+=" (Printable String)";break;case b.Type.IA5String:a+=" (IA5String (ASCII))";break;case b.Type.UTCTIME:a+=" (UTC time)";break;case b.Type.GENERALIZEDTIME:a+=" (Generalized time)";break;case b.Type.BMPSTRING:a+=" (BMP String)";break}else a+=e.type;if(a+=`
10
- `,a+=i+"Constructed: "+e.constructed+`
11
- `,e.composed){for(var s=0,o="",n=0;n<e.value.length;++n)e.value[n]!==void 0&&(s+=1,o+=b.prettyPrint(e.value[n],t+1,r),n+1<e.value.length&&(o+=","));a+=i+"Sub values: "+s+o}else{if(a+=i+"Value: ",e.type===b.Type.OID){var f=b.derToOid(e.value);a+=f,W.pki&&W.pki.oids&&f in W.pki.oids&&(a+=" ("+W.pki.oids[f]+") ")}if(e.type===b.Type.INTEGER)try{a+=b.derToInteger(e.value)}catch{a+="0x"+W.util.bytesToHex(e.value)}else if(e.type===b.Type.BITSTRING){if(e.value.length>1?a+="0x"+W.util.bytesToHex(e.value.slice(1)):a+="(none)",e.value.length>0){var u=e.value.charCodeAt(0);u==1?a+=" (1 unused bit shown)":u>1&&(a+=" ("+u+" unused bits shown)")}}else if(e.type===b.Type.OCTETSTRING)kt.test(e.value)||(a+="("+e.value+") "),a+="0x"+W.util.bytesToHex(e.value);else if(e.type===b.Type.UTF8)try{a+=W.util.decodeUtf8(e.value)}catch(c){if(c.message==="URI malformed")a+="0x"+W.util.bytesToHex(e.value)+" (malformed UTF8)";else throw c}else e.type===b.Type.PRINTABLESTRING||e.type===b.Type.IA5String?a+=e.value:kt.test(e.value)?a+="0x"+W.util.bytesToHex(e.value):e.value.length===0?a+="[null]":a+=e.value}return a};var $=K;$.cipher=$.cipher||{};$.cipher.algorithms=$.cipher.algorithms||{};$.cipher.createCipher=function(e,t){var r=e;if(typeof r=="string"&&(r=$.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+e);return new $.cipher.BlockCipher({algorithm:r,key:t,decrypt:!1})};$.cipher.createDecipher=function(e,t){var r=e;if(typeof r=="string"&&(r=$.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+e);return new $.cipher.BlockCipher({algorithm:r,key:t,decrypt:!0})};$.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),$.cipher.algorithms[e]=t};$.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in $.cipher.algorithms?$.cipher.algorithms[e]:null};var At=$.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};At.prototype.start=function(e){e=e||{};var t={};for(var r in e)t[r]=e[r];t.decrypt=this._decrypt,this._finish=!1,this._input=$.util.createBuffer(),this.output=e.output||$.util.createBuffer(),this.mode.start(t)};At.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};At.prototype.finish=function(e){e&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(r){return e(this.blockSize,r,!1)},this.mode.unpad=function(r){return e(this.blockSize,r,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,t))};var Z=K;Z.cipher=Z.cipher||{};var F=Z.cipher.modes=Z.cipher.modes||{};F.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};F.ecb.prototype.start=function(e){};F.ecb.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var a=0;a<this._ints;++a)this._inBlock[a]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var a=0;a<this._ints;++a)t.putInt32(this._outBlock[a])};F.ecb.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var a=0;a<this._ints;++a)this._inBlock[a]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var a=0;a<this._ints;++a)t.putInt32(this._outBlock[a])};F.ecb.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0};F.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),a=e.at(r-1);return a>this.blockSize<<2?!1:(e.truncate(a),!0)};F.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};F.cbc.prototype.start=function(e){if(e.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in e)this._iv=it(e.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")};F.cbc.prototype.encrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var a=0;a<this._ints;++a)this._inBlock[a]=this._prev[a]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var a=0;a<this._ints;++a)t.putInt32(this._outBlock[a]);this._prev=this._outBlock};F.cbc.prototype.decrypt=function(e,t,r){if(e.length()<this.blockSize&&!(r&&e.length()>0))return!0;for(var a=0;a<this._ints;++a)this._inBlock[a]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var a=0;a<this._ints;++a)t.putInt32(this._prev[a]^this._outBlock[a]);this._prev=this._inBlock.slice(0)};F.cbc.prototype.pad=function(e,t){var r=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(r,r),!0};F.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var r=e.length(),a=e.at(r-1);return a>this.blockSize<<2?!1:(e.truncate(a),!0)};F.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=Z.util.createBuffer(),this._partialBytes=0};F.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=it(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};F.cfb.prototype.encrypt=function(e,t,r){var a=e.length();if(a===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&a>=this.blockSize){for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32()^this._outBlock[i],t.putInt32(this._inBlock[i]);return}var n=(this.blockSize-a)%this.blockSize;n>0&&(n=this.blockSize-n),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(n>0)e.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),n>0&&!r)return t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=n,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0};F.cfb.prototype.decrypt=function(e,t,r){var a=e.length();if(a===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&a>=this.blockSize){for(var i=0;i<this._ints;++i)this._inBlock[i]=e.getInt32(),t.putInt32(this._inBlock[i]^this._outBlock[i]);return}var n=(this.blockSize-a)%this.blockSize;n>0&&(n=this.blockSize-n),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialBlock[i]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(n>0)e.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),n>0&&!r)return t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=n,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0};F.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Z.util.createBuffer(),this._partialBytes=0};F.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=it(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};F.ofb.prototype.encrypt=function(e,t,r){var a=e.length();if(e.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&a>=this.blockSize){for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];return}var n=(this.blockSize-a)%this.blockSize;n>0&&(n=this.blockSize-n),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(n>0)e.read-=this.blockSize;else for(var i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),n>0&&!r)return t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=n,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0};F.ofb.prototype.decrypt=F.ofb.prototype.encrypt;F.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Z.util.createBuffer(),this._partialBytes=0};F.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=it(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};F.ctr.prototype.encrypt=function(e,t,r){var a=e.length();if(a===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&a>=this.blockSize)for(var i=0;i<this._ints;++i)t.putInt32(e.getInt32()^this._outBlock[i]);else{var n=(this.blockSize-a)%this.blockSize;n>0&&(n=this.blockSize-n),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(n>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),n>0&&!r)return t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=n,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}nt(this._inBlock)};F.ctr.prototype.decrypt=F.ctr.prototype.encrypt;F.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=Z.util.createBuffer(),this._partialBytes=0,this._R=3774873600};F.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=Z.util.createBuffer(e.iv);this._cipherLength=0;var r;if("additionalData"in e?r=Z.util.createBuffer(e.additionalData):r=Z.util.createBuffer(),"tagLength"in e?this._tagLength=e.tagLength:this._tagLength=128,this._tag=null,e.decrypt&&(this._tag=Z.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var a=t.length();if(a===12)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(pt(a*8)))}this._inBlock=this._j0.slice(0),nt(this._inBlock),this._partialBytes=0,r=Z.util.createBuffer(r),this._aDataLength=pt(r.length()*8);var i=r.length()%this.blockSize;for(i&&r.fillWithByte(0,this.blockSize-i),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])};F.gcm.prototype.encrypt=function(e,t,r){var a=e.length();if(a===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&a>=this.blockSize){for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^=e.getInt32());this._cipherLength+=this.blockSize}else{var n=(this.blockSize-a)%this.blockSize;n>0&&(n=this.blockSize-n),this._partialOutput.clear();for(var i=0;i<this._ints;++i)this._partialOutput.putInt32(e.getInt32()^this._outBlock[i]);if(n<=0||r){if(r){var s=a%this.blockSize;this._cipherLength+=s,this._partialOutput.truncate(this.blockSize-s)}else this._cipherLength+=this.blockSize;for(var i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),n>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=n,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),nt(this._inBlock)};F.gcm.prototype.decrypt=function(e,t,r){var a=e.length();if(a<this.blockSize&&!(r&&a>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),nt(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i<this._ints;++i)t.putInt32(this._outBlock[i]^this._hashBlock[i]);a<this.blockSize?this._cipherLength+=a%this.blockSize:this._cipherLength+=this.blockSize};F.gcm.prototype.afterFinish=function(e,t){var r=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=Z.util.createBuffer();var a=this._aDataLength.concat(pt(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,a);var i=[];this.cipher.encrypt(this._j0,i);for(var n=0;n<this._ints;++n)this.tag.putInt32(this._s[n]^i[n]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r};F.gcm.prototype.multiply=function(e,t){for(var r=[0,0,0,0],a=t.slice(0),i=0;i<128;++i){var n=e[i/32|0]&1<<31-i%32;n&&(r[0]^=a[0],r[1]^=a[1],r[2]^=a[2],r[3]^=a[3]),this.pow(a,a)}return r};F.gcm.prototype.pow=function(e,t){for(var r=e[3]&1,a=3;a>0;--a)t[a]=e[a]>>>1|(e[a-1]&1)<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)};F.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var a=r/8|0,i=e[a]>>>(7-r%8)*4&15,n=this._m[r][i];t[0]^=n[0],t[1]^=n[1],t[2]^=n[2],t[3]^=n[3]}return t};F.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)};F.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,a=4*r,i=16*r,n=new Array(i),s=0;s<i;++s){var o=[0,0,0,0],f=s/a|0,u=(a-1-s%a)*t;o[f]=1<<t-1<<u,n[s]=this.generateSubHashTable(this.multiply(o,e),t)}return n};F.gcm.prototype.generateSubHashTable=function(e,t){var r=1<<t,a=r>>>1,i=new Array(r);i[a]=e.slice(0);for(var n=a>>>1;n>0;)this.pow(i[2*n],i[n]=[]),n>>=1;for(n=2;n<a;){for(var s=1;s<n;++s){var o=i[n],f=i[s];i[n+s]=[o[0]^f[0],o[1]^f[1],o[2]^f[2],o[3]^f[3]]}n*=2}for(i[0]=[0,0,0,0],n=a+1;n<r;++n){var u=i[n^a];i[n]=[e[0]^u[0],e[1]^u[1],e[2]^u[2],e[3]^u[3]]}return i};function it(e,t){if(typeof e=="string"&&(e=Z.util.createBuffer(e)),Z.util.isArray(e)&&e.length>4){var r=e;e=Z.util.createBuffer();for(var a=0;a<r.length;++a)e.putByte(r[a])}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!Z.util.isArray(e)){for(var i=[],n=t/4,a=0;a<n;++a)i.push(e.getInt32());e=i}return e}function nt(e){e[e.length-1]=e[e.length-1]+1&4294967295}function pt(e){return[e/4294967296|0,e&4294967295]}var H=K;H.aes=H.aes||{};H.aes.startEncrypting=function(e,t,r,a){var i=st({key:e,output:r,decrypt:!1,mode:a});return i.start(t),i};H.aes.createEncryptionCipher=function(e,t){return st({key:e,output:null,decrypt:!1,mode:t})};H.aes.startDecrypting=function(e,t,r,a){var i=st({key:e,output:r,decrypt:!0,mode:a});return i.start(t),i};H.aes.createDecryptionCipher=function(e,t){return st({key:e,output:null,decrypt:!0,mode:t})};H.aes.Algorithm=function(e,t){Bt||jt();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(a,i){return yt(r._w,a,i,!1)},decrypt:function(a,i){return yt(r._w,a,i,!0)}}}),r._init=!1};H.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t=e.key,r;if(typeof t=="string"&&(t.length===16||t.length===24||t.length===32))t=H.util.createBuffer(t);else if(H.util.isArray(t)&&(t.length===16||t.length===24||t.length===32)){r=t,t=H.util.createBuffer();for(var a=0;a<r.length;++a)t.putByte(r[a])}if(!H.util.isArray(t)){r=t,t=[];var i=r.length();if(i===16||i===24||i===32){i=i>>>2;for(var a=0;a<i;++a)t.push(r.getInt32())}}if(!H.util.isArray(t)||!(t.length===4||t.length===6||t.length===8))throw new Error("Invalid key parameter.");var n=this.mode.name,s=["CFB","OFB","CTR","GCM"].indexOf(n)!==-1;this._w=Jt(t,e.decrypt&&!s),this._init=!0}};H.aes._expandKey=function(e,t){return Bt||jt(),Jt(e,t)};H.aes._updateBlock=yt;Oe("AES-ECB",H.cipher.modes.ecb);Oe("AES-CBC",H.cipher.modes.cbc);Oe("AES-CFB",H.cipher.modes.cfb);Oe("AES-OFB",H.cipher.modes.ofb);Oe("AES-CTR",H.cipher.modes.ctr);Oe("AES-GCM",H.cipher.modes.gcm);function Oe(e,t){var r=function(){return new H.aes.Algorithm(e,t)};H.cipher.registerAlgorithm(e,r)}var Bt=!1,_e=4,ee,dt,$t,Re,ue;function jt(){Bt=!0,$t=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;ee=new Array(256),dt=new Array(256),Re=new Array(4),ue=new Array(4);for(var t=0;t<4;++t)Re[t]=new Array(256),ue[t]=new Array(256);for(var r=0,a=0,i,n,s,o,f,u,c,t=0;t<256;++t){o=a^a<<1^a<<2^a<<3^a<<4,o=o>>8^o&255^99,ee[r]=o,dt[o]=r,f=e[o],i=e[r],n=e[i],s=e[n],u=f<<24^o<<16^o<<8^(o^f),c=(i^n^s)<<24^(r^s)<<16^(r^n^s)<<8^(r^i^s);for(var h=0;h<4;++h)Re[h][r]=u,ue[h][o]=c,u=u<<24|u>>>8,c=c<<24|c>>>8;r===0?r=a=1:(r=i^e[e[e[i^s]]],a^=e[e[a]])}}function Jt(e,t){for(var r=e.slice(0),a,i=1,n=r.length,s=n+6+1,o=_e*s,f=n;f<o;++f)a=r[f-1],f%n===0?(a=ee[a>>>16&255]<<24^ee[a>>>8&255]<<16^ee[a&255]<<8^ee[a>>>24]^$t[i]<<24,i++):n>6&&f%n===4&&(a=ee[a>>>24]<<24^ee[a>>>16&255]<<16^ee[a>>>8&255]<<8^ee[a&255]),r[f]=r[f-n]^a;if(t){var u,c=ue[0],h=ue[1],d=ue[2],C=ue[3],y=r.slice(0);o=r.length;for(var f=0,E=o-_e;f<o;f+=_e,E-=_e)if(f===0||f===o-_e)y[f]=r[E],y[f+1]=r[E+3],y[f+2]=r[E+2],y[f+3]=r[E+1];else for(var x=0;x<_e;++x)u=r[E+x],y[f+(3&-x)]=c[ee[u>>>24]]^h[ee[u>>>16&255]]^d[ee[u>>>8&255]]^C[ee[u&255]];r=y}return r}function yt(e,t,r,a){var i=e.length/4-1,n,s,o,f,u;a?(n=ue[0],s=ue[1],o=ue[2],f=ue[3],u=dt):(n=Re[0],s=Re[1],o=Re[2],f=Re[3],u=ee);var c,h,d,C,y,E,x;c=t[0]^e[0],h=t[a?3:1]^e[1],d=t[2]^e[2],C=t[a?1:3]^e[3];for(var S=3,N=1;N<i;++N)y=n[c>>>24]^s[h>>>16&255]^o[d>>>8&255]^f[C&255]^e[++S],E=n[h>>>24]^s[d>>>16&255]^o[C>>>8&255]^f[c&255]^e[++S],x=n[d>>>24]^s[C>>>16&255]^o[c>>>8&255]^f[h&255]^e[++S],C=n[C>>>24]^s[c>>>16&255]^o[h>>>8&255]^f[d&255]^e[++S],c=y,h=E,d=x;r[0]=u[c>>>24]<<24^u[h>>>16&255]<<16^u[d>>>8&255]<<8^u[C&255]^e[++S],r[a?3:1]=u[h>>>24]<<24^u[d>>>16&255]<<16^u[C>>>8&255]<<8^u[c&255]^e[++S],r[2]=u[d>>>24]<<24^u[C>>>16&255]<<16^u[c>>>8&255]<<8^u[h&255]^e[++S],r[a?1:3]=u[C>>>24]<<24^u[c>>>16&255]<<16^u[h>>>8&255]<<8^u[d&255]^e[++S]}function st(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),r="AES-"+t,a;e.decrypt?a=H.cipher.createDecipher(r,e.key):a=H.cipher.createCipher(r,e.key);var i=a.start;return a.start=function(n,s){var o=null;s instanceof H.util.ByteBuffer&&(o=s,s={}),s=s||{},s.output=o,s.iv=n,i.call(a,s)},a}var X=K;X.des=X.des||{};X.des.startEncrypting=function(e,t,r,a){var i=ot({key:e,output:r,decrypt:!1,mode:a||(t===null?"ECB":"CBC")});return i.start(t),i};X.des.createEncryptionCipher=function(e,t){return ot({key:e,output:null,decrypt:!1,mode:t})};X.des.startDecrypting=function(e,t,r,a){var i=ot({key:e,output:r,decrypt:!0,mode:a||(t===null?"ECB":"CBC")});return i.start(t),i};X.des.createDecryptionCipher=function(e,t){return ot({key:e,output:null,decrypt:!0,mode:t})};X.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(a,i){return Vt(r._keys,a,i,!1)},decrypt:function(a,i){return Vt(r._keys,a,i,!0)}}}),r._init=!1};X.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=X.util.createBuffer(e.key);if(this.name.indexOf("3DES")===0&&t.length()!==24)throw new Error("Invalid Triple-DES key size: "+t.length()*8);this._keys=Kr(t),this._init=!0}};ye("DES-ECB",X.cipher.modes.ecb);ye("DES-CBC",X.cipher.modes.cbc);ye("DES-CFB",X.cipher.modes.cfb);ye("DES-OFB",X.cipher.modes.ofb);ye("DES-CTR",X.cipher.modes.ctr);ye("3DES-ECB",X.cipher.modes.ecb);ye("3DES-CBC",X.cipher.modes.cbc);ye("3DES-CFB",X.cipher.modes.cfb);ye("3DES-OFB",X.cipher.modes.ofb);ye("3DES-CTR",X.cipher.modes.ctr);function ye(e,t){var r=function(){return new X.des.Algorithm(e,t)};X.cipher.registerAlgorithm(e,r)}var Lr=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],Dr=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],_r=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],Pr=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],kr=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],Vr=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],Or=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],Fr=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function Kr(e){for(var t=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],r=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],a=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],n=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],s=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],o=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],f=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],u=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],c=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],h=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],d=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],C=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],E=e.length()>8?3:1,x=[],S=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],N=0,B,P=0;P<E;P++){var L=e.getInt32(),U=e.getInt32();B=(L>>>4^U)&252645135,U^=B,L^=B<<4,B=(U>>>-16^L)&65535,L^=B,U^=B<<-16,B=(L>>>2^U)&858993459,U^=B,L^=B<<2,B=(U>>>-16^L)&65535,L^=B,U^=B<<-16,B=(L>>>1^U)&1431655765,U^=B,L^=B<<1,B=(U>>>8^L)&16711935,L^=B,U^=B<<8,B=(L>>>1^U)&1431655765,U^=B,L^=B<<1,B=L<<8|U>>>20&240,L=U<<24|U<<8&16711680|U>>>8&65280|U>>>24&240,U=B;for(var j=0;j<S.length;++j){S[j]?(L=L<<2|L>>>26,U=U<<2|U>>>26):(L=L<<1|L>>>27,U=U<<1|U>>>27),L&=-15,U&=-15;var se=t[L>>>28]|r[L>>>24&15]|a[L>>>20&15]|i[L>>>16&15]|n[L>>>12&15]|s[L>>>8&15]|o[L>>>4&15],fe=f[U>>>28]|u[U>>>24&15]|c[U>>>20&15]|h[U>>>16&15]|d[U>>>12&15]|C[U>>>8&15]|y[U>>>4&15];B=(fe>>>16^se)&65535,x[N++]=se^B,x[N++]=fe^B<<16}}return x}function Vt(e,t,r,a){var i=e.length===32?3:9,n;i===3?n=a?[30,-2,-2]:[0,32,2]:n=a?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var s,o=t[0],f=t[1];s=(o>>>4^f)&252645135,f^=s,o^=s<<4,s=(o>>>16^f)&65535,f^=s,o^=s<<16,s=(f>>>2^o)&858993459,o^=s,f^=s<<2,s=(f>>>8^o)&16711935,o^=s,f^=s<<8,s=(o>>>1^f)&1431655765,f^=s,o^=s<<1,o=o<<1|o>>>31,f=f<<1|f>>>31;for(var u=0;u<i;u+=3){for(var c=n[u+1],h=n[u+2],d=n[u];d!=c;d+=h){var C=f^e[d],y=(f>>>4|f<<28)^e[d+1];s=o,o=f,f=s^(Dr[C>>>24&63]|Pr[C>>>16&63]|Vr[C>>>8&63]|Fr[C&63]|Lr[y>>>24&63]|_r[y>>>16&63]|kr[y>>>8&63]|Or[y&63])}s=o,o=f,f=s}o=o>>>1|o<<31,f=f>>>1|f<<31,s=(o>>>1^f)&1431655765,f^=s,o^=s<<1,s=(f>>>8^o)&16711935,o^=s,f^=s<<8,s=(f>>>2^o)&858993459,o^=s,f^=s<<2,s=(o>>>16^f)&65535,f^=s,o^=s<<16,s=(o>>>4^f)&252645135,f^=s,o^=s<<4,r[0]=o,r[1]=f}function ot(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),r="DES-"+t,a;e.decrypt?a=X.cipher.createDecipher(r,e.key):a=X.cipher.createCipher(r,e.key);var i=a.start;return a.start=function(n,s){var o=null;s instanceof X.util.ByteBuffer&&(o=s,s={}),s=s||{},s.output=o,s.iv=n,i.call(a,s)},a}var $e=K;$e.md=$e.md||{};$e.md.algorithms=$e.md.algorithms||{};var me=K,Mr=me.hmac=me.hmac||{};Mr.create=function(){var e=null,t=null,r=null,a=null,i={};return i.start=function(n,s){if(n!==null)if(typeof n=="string")if(n=n.toLowerCase(),n in me.md.algorithms)t=me.md.algorithms[n].create();else throw new Error('Unknown hash algorithm "'+n+'"');else t=n;if(s===null)s=e;else{if(typeof s=="string")s=me.util.createBuffer(s);else if(me.util.isArray(s)){var o=s;s=me.util.createBuffer();for(var f=0;f<o.length;++f)s.putByte(o[f])}var u=s.length();u>t.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),r=me.util.createBuffer(),a=me.util.createBuffer(),u=s.length();for(var f=0;f<u;++f){var o=s.at(f);r.putByte(54^o),a.putByte(92^o)}if(u<t.blockLength)for(var o=t.blockLength-u,f=0;f<o;++f)r.putByte(54),a.putByte(92);e=s,r=r.bytes(),a=a.bytes()}t.start(),t.update(r)},i.update=function(n){t.update(n)},i.getMac=function(){var n=t.digest().bytes();return t.start(),t.update(a),t.update(n),t.digest()},i.digest=i.getMac,i};var te=K,Gr=te.pkcs5=te.pkcs5||{},Ce;te.util.isNodejs&&!te.options.usePureJavaScript&&(Ce=Et);te.pbkdf2=Gr.pbkdf2=function(e,t,r,a,i,n){if(typeof i=="function"&&(n=i,i=null),te.util.isNodejs&&!te.options.usePureJavaScript&&Ce.pbkdf2&&(i===null||typeof i!="object")&&(Ce.pbkdf2Sync.length>4||!i||i==="sha1"))return typeof i!="string"&&(i="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),n?Ce.pbkdf2Sync.length===4?Ce.pbkdf2(e,t,r,a,function(B,P){if(B)return n(B);n(null,P.toString("binary"))}):Ce.pbkdf2(e,t,r,a,i,function(B,P){if(B)return n(B);n(null,P.toString("binary"))}):Ce.pbkdf2Sync.length===4?Ce.pbkdf2Sync(e,t,r,a).toString("binary"):Ce.pbkdf2Sync(e,t,r,a,i).toString("binary");if((typeof i>"u"||i===null)&&(i="sha1"),typeof i=="string"){if(!(i in te.md.algorithms))throw new Error("Unknown hash algorithm: "+i);i=te.md[i].create()}var s=i.digestLength;if(a>4294967295*s){var o=new Error("Derived key is too long.");if(n)return n(o);throw o}var f=Math.ceil(a/s),u=a-(f-1)*s,c=te.hmac.create();c.start(i,e);var h="",d,C,y;if(!n){for(var E=1;E<=f;++E){c.start(null,null),c.update(t),c.update(te.util.int32ToBytes(E)),d=y=c.digest().getBytes();for(var x=2;x<=r;++x)c.start(null,null),c.update(y),C=c.digest().getBytes(),d=te.util.xorBytes(d,C,s),y=C;h+=E<f?d:d.substr(0,u)}return h}var E=1,x;function S(){if(E>f)return n(null,h);c.start(null,null),c.update(t),c.update(te.util.int32ToBytes(E)),d=y=c.digest().getBytes(),x=2,N()}function N(){if(x<=r)return c.start(null,null),c.update(y),C=c.digest().getBytes(),d=te.util.xorBytes(d,C,s),y=C,++x,te.util.setImmediate(N);h+=E<f?d:d.substr(0,u),++E,S()}S()};var je=K,er=je.pem=je.pem||{};er.encode=function(e,t){t=t||{};var r="-----BEGIN "+e.type+`-----\r
12
- `,a;if(e.procType&&(a={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},r+=Xe(a)),e.contentDomain&&(a={name:"Content-Domain",values:[e.contentDomain]},r+=Xe(a)),e.dekInfo&&(a={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&a.values.push(e.dekInfo.parameters),r+=Xe(a)),e.headers)for(var i=0;i<e.headers.length;++i)r+=Xe(e.headers[i]);return e.procType&&(r+=`\r
13
- `),r+=je.util.encode64(e.body,t.maxline||64)+`\r
14
- `,r+="-----END "+e.type+`-----\r
15
- `,r};er.decode=function(e){for(var t=[],r=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,a=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,i=/\r?\n/,n;n=r.exec(e),!!n;){var s=n[1];s==="NEW CERTIFICATE REQUEST"&&(s="CERTIFICATE REQUEST");var o={type:s,procType:null,contentDomain:null,dekInfo:null,headers:[],body:je.util.decode64(n[3])};if(t.push(o),!!n[2]){for(var f=n[2].split(i),u=0;n&&u<f.length;){for(var c=f[u].replace(/\s+$/,""),h=u+1;h<f.length;++h){var d=f[h];if(!/\s/.test(d[0]))break;c+=d,u=h}if(n=c.match(a),n){for(var C={name:n[1],values:[]},y=n[2].split(","),E=0;E<y.length;++E)C.values.push(qr(y[E]));if(o.procType)if(!o.contentDomain&&C.name==="Content-Domain")o.contentDomain=y[0]||"";else if(!o.dekInfo&&C.name==="DEK-Info"){if(C.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');o.dekInfo={algorithm:y[0],parameters:y[1]||null}}else o.headers.push(C);else{if(C.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(C.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');o.procType={version:y[0],type:y[1]}}}++u}if(o.procType==="ENCRYPTED"&&!o.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(t.length===0)throw new Error("Invalid PEM formatted message.");return t};function Xe(e){for(var t=e.name+": ",r=[],a=function(f,u){return" "+u},i=0;i<e.values.length;++i)r.push(e.values[i].replace(/^(\S+\r\n)/,a));t+=r.join(",")+`\r
16
- `;for(var n=0,s=-1,i=0;i<t.length;++i,++n)if(n>65&&s!==-1){var o=t[s];o===","?(++s,t=t.substr(0,s)+`\r
17
- `+t.substr(s)):t=t.substr(0,s)+`\r
18
- `+o+t.substr(s+1),n=i-s-1,s=-1,++i}else(t[i]===" "||t[i]===" "||t[i]===",")&&(s=i);return t}function qr(e){return e.replace(/^\s+/,"")}var he=K,tr=he.sha256=he.sha256||{};he.md.sha256=he.md.algorithms.sha256=tr;tr.create=function(){rr||zr();var e=null,t=he.util.createBuffer(),r=new Array(64),a={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return a.start=function(){a.messageLength=0,a.fullMessageLength=a.messageLength64=[];for(var i=a.messageLengthSize/4,n=0;n<i;++n)a.fullMessageLength.push(0);return t=he.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},a},a.start(),a.update=function(i,n){n==="utf8"&&(i=he.util.encodeUtf8(i));var s=i.length;a.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var o=a.fullMessageLength.length-1;o>=0;--o)a.fullMessageLength[o]+=s[1],s[1]=s[0]+(a.fullMessageLength[o]/4294967296>>>0),a.fullMessageLength[o]=a.fullMessageLength[o]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(i),Ot(e,r,t),(t.read>2048||t.length()===0)&&t.compact(),a},a.digest=function(){var i=he.util.createBuffer();i.putBytes(t.bytes());var n=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,s=n&a.blockLength-1;i.putBytes(vt.substr(0,a.blockLength-s));for(var o,f,u=a.fullMessageLength[0]*8,c=0;c<a.fullMessageLength.length-1;++c)o=a.fullMessageLength[c+1]*8,f=o/4294967296>>>0,u+=f,i.putInt32(u>>>0),u=o>>>0;i.putInt32(u);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};Ot(h,r,i);var d=he.util.createBuffer();return d.putInt32(h.h0),d.putInt32(h.h1),d.putInt32(h.h2),d.putInt32(h.h3),d.putInt32(h.h4),d.putInt32(h.h5),d.putInt32(h.h6),d.putInt32(h.h7),d},a};var vt=null,rr=!1,ar=null;function zr(){vt=String.fromCharCode(128),vt+=he.util.fillString(String.fromCharCode(0),64),ar=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],rr=!0}function Ot(e,t,r){for(var a,i,n,s,o,f,u,c,h,d,C,y,E,x,S,N=r.length();N>=64;){for(u=0;u<16;++u)t[u]=r.getInt32();for(;u<64;++u)a=t[u-2],a=(a>>>17|a<<15)^(a>>>19|a<<13)^a>>>10,i=t[u-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,t[u]=a+t[u-7]+i+t[u-16]|0;for(c=e.h0,h=e.h1,d=e.h2,C=e.h3,y=e.h4,E=e.h5,x=e.h6,S=e.h7,u=0;u<64;++u)s=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),o=x^y&(E^x),n=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),f=c&h|d&(c^h),a=S+s+o+ar[u]+t[u],i=n+f,S=x,x=E,E=y,y=C+a>>>0,C=d,d=h,h=c,c=a+i>>>0;e.h0=e.h0+c|0,e.h1=e.h1+h|0,e.h2=e.h2+d|0,e.h3=e.h3+C|0,e.h4=e.h4+y|0,e.h5=e.h5+E|0,e.h6=e.h6+x|0,e.h7=e.h7+S|0,N-=64}}var ce=K,Ze=null;ce.util.isNodejs&&!ce.options.usePureJavaScript&&!process.versions["node-webkit"]&&(Ze=Et);var Qr=ce.prng=ce.prng||{};Qr.create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,a=new Array(32),i=0;i<32;++i)a[i]=r.create();t.pools=a,t.pool=0,t.generate=function(u,c){if(!c)return t.generateSync(u);var h=t.plugin.cipher,d=t.plugin.increment,C=t.plugin.formatKey,y=t.plugin.formatSeed,E=ce.util.createBuffer();t.key=null,x();function x(S){if(S)return c(S);if(E.length()>=u)return c(null,E.getBytes(u));if(t.generated>1048575&&(t.key=null),t.key===null)return ce.util.nextTick(function(){n(x)});var N=h(t.key,t.seed);t.generated+=N.length,E.putBytes(N),t.key=C(h(t.key,d(t.seed))),t.seed=y(h(t.key,t.seed)),ce.util.setImmediate(x)}},t.generateSync=function(u){var c=t.plugin.cipher,h=t.plugin.increment,d=t.plugin.formatKey,C=t.plugin.formatSeed;t.key=null;for(var y=ce.util.createBuffer();y.length()<u;){t.generated>1048575&&(t.key=null),t.key===null&&s();var E=c(t.key,t.seed);t.generated+=E.length,y.putBytes(E),t.key=d(c(t.key,h(t.seed))),t.seed=C(c(t.key,t.seed))}return y.getBytes(u)};function n(u){if(t.pools[0].messageLength>=32)return o(),u();var c=32-t.pools[0].messageLength<<5;t.seedFile(c,function(h,d){if(h)return u(h);t.collect(d),o(),u()})}function s(){if(t.pools[0].messageLength>=32)return o();var u=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(u)),o()}function o(){t.reseeds=t.reseeds===4294967295?0:t.reseeds+1;var u=t.plugin.md.create();u.update(t.keyBytes);for(var c=1,h=0;h<32;++h)t.reseeds%c===0&&(u.update(t.pools[h].digest().getBytes()),t.pools[h].start()),c=c<<1;t.keyBytes=u.digest().getBytes(),u.start(),u.update(t.keyBytes);var d=u.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(d),t.generated=0}function f(u){var c=null,h=ce.util.globalScope,d=h.crypto||h.msCrypto;d&&d.getRandomValues&&(c=function(L){return d.getRandomValues(L)});var C=ce.util.createBuffer();if(c)for(;C.length()<u;){var y=Math.max(1,Math.min(u-C.length(),65536)/4),E=new Uint32Array(Math.floor(y));try{c(E);for(var x=0;x<E.length;++x)C.putInt32(E[x])}catch(L){if(!(typeof QuotaExceededError<"u"&&L instanceof QuotaExceededError))throw L}}if(C.length()<u)for(var S,N,B,P=Math.floor(Math.random()*65536);C.length()<u;){N=16807*(P&65535),S=16807*(P>>16),N+=(S&32767)<<16,N+=S>>15,N=(N&2147483647)+(N>>31),P=N&4294967295;for(var x=0;x<3;++x)B=P>>>(x<<3),B^=Math.floor(Math.random()*256),C.putByte(B&255)}return C.getBytes(u)}return Ze?(t.seedFile=function(u,c){Ze.randomBytes(u,function(h,d){if(h)return c(h);c(null,d.toString())})},t.seedFileSync=function(u){return Ze.randomBytes(u).toString()}):(t.seedFile=function(u,c){try{c(null,f(u))}catch(h){c(h)}},t.seedFileSync=f),t.collect=function(u){for(var c=u.length,h=0;h<c;++h)t.pools[t.pool].update(u.substr(h,1)),t.pool=t.pool===31?0:t.pool+1},t.collectInt=function(u,c){for(var h="",d=0;d<c;d+=8)h+=String.fromCharCode(u>>d&255);t.collect(h)},t.registerWorker=function(u){if(u===self)t.seedFile=function(h,d){function C(y){var E=y.data;E.forge&&E.forge.prng&&(self.removeEventListener("message",C),d(E.forge.prng.err,E.forge.prng.bytes))}self.addEventListener("message",C),self.postMessage({forge:{prng:{needed:h}}})};else{var c=function(h){var d=h.data;d.forge&&d.forge.prng&&t.seedFile(d.forge.prng.needed,function(C,y){u.postMessage({forge:{prng:{err:C,bytes:y}}})})};u.addEventListener("message",c)}},t};var J=K;(function(){J.random&&J.random.getBytes||function(e){var t={},r=new Array(4),a=J.util.createBuffer();t.formatKey=function(h){var d=J.util.createBuffer(h);return h=new Array(4),h[0]=d.getInt32(),h[1]=d.getInt32(),h[2]=d.getInt32(),h[3]=d.getInt32(),J.aes._expandKey(h,!1)},t.formatSeed=function(h){var d=J.util.createBuffer(h);return h=new Array(4),h[0]=d.getInt32(),h[1]=d.getInt32(),h[2]=d.getInt32(),h[3]=d.getInt32(),h},t.cipher=function(h,d){return J.aes._updateBlock(h,d,r,!1),a.putInt32(r[0]),a.putInt32(r[1]),a.putInt32(r[2]),a.putInt32(r[3]),a.getBytes()},t.increment=function(h){return++h[3],h},t.md=J.md.sha256;function i(){var h=J.prng.create(t);return h.getBytes=function(d,C){return h.generate(d,C)},h.getBytesSync=function(d){return h.generate(d)},h}var n=i(),s=null,o=J.util.globalScope,f=o.crypto||o.msCrypto;if(f&&f.getRandomValues&&(s=function(h){return f.getRandomValues(h)}),!J.util.isNodejs&&!s){if(n.collectInt(+new Date,32),typeof navigator<"u"){var u="";for(var c in navigator)try{typeof navigator[c]=="string"&&(u+=navigator[c])}catch{}n.collect(u),u=null}e&&(e().mousemove(function(h){n.collectInt(h.clientX,16),n.collectInt(h.clientY,16)}),e().keypress(function(h){n.collectInt(h.charCode,8)}))}if(!J.random)J.random=n;else for(var c in n)J.random[c]=n[c];J.random.createInstance=i}(typeof jQuery<"u"?jQuery:null)})();var re=K,ct=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],Ft=[1,2,3,5],Hr=function(e,t){return e<<t&65535|(e&65535)>>16-t},Wr=function(e,t){return(e&65535)>>t|e<<16-t&65535};re.rc2=re.rc2||{};re.rc2.expandKey=function(e,t){typeof e=="string"&&(e=re.util.createBuffer(e)),t=t||128;var r=e,a=e.length(),i=t,n=Math.ceil(i/8),s=255>>(i&7),o;for(o=a;o<128;o++)r.putByte(ct[r.at(o-1)+r.at(o-a)&255]);for(r.setAt(128-n,ct[r.at(128-n)&s]),o=127-n;o>=0;o--)r.setAt(o,ct[r.at(o+1)^r.at(o+n)]);return r};var ir=function(e,t,r){var a=!1,i=null,n=null,s=null,o,f,u,c,h=[];for(e=re.rc2.expandKey(e,t),u=0;u<64;u++)h.push(e.getInt16Le());r?(o=function(y){for(u=0;u<4;u++)y[u]+=h[c]+(y[(u+3)%4]&y[(u+2)%4])+(~y[(u+3)%4]&y[(u+1)%4]),y[u]=Hr(y[u],Ft[u]),c++},f=function(y){for(u=0;u<4;u++)y[u]+=h[y[(u+3)%4]&63]}):(o=function(y){for(u=3;u>=0;u--)y[u]=Wr(y[u],Ft[u]),y[u]-=h[c]+(y[(u+3)%4]&y[(u+2)%4])+(~y[(u+3)%4]&y[(u+1)%4]),c--},f=function(y){for(u=3;u>=0;u--)y[u]-=h[y[(u+3)%4]&63]});var d=function(y){var E=[];for(u=0;u<4;u++){var x=i.getInt16Le();s!==null&&(r?x^=s.getInt16Le():s.putInt16Le(x)),E.push(x&65535)}c=r?0:63;for(var S=0;S<y.length;S++)for(var N=0;N<y[S][0];N++)y[S][1](E);for(u=0;u<4;u++)s!==null&&(r?s.putInt16Le(E[u]):E[u]^=s.getInt16Le()),n.putInt16Le(E[u])},C=null;return C={start:function(y,E){y&&typeof y=="string"&&(y=re.util.createBuffer(y)),a=!1,i=re.util.createBuffer(),n=E||new re.util.createBuffer,s=y,C.output=n},update:function(y){for(a||i.putBuffer(y);i.length()>=8;)d([[5,o],[1,f],[6,o],[1,f],[5,o]])},finish:function(y){var E=!0;if(r)if(y)E=y(8,i,!r);else{var x=i.length()===8?8:8-i.length();i.fillWithByte(x,x)}if(E&&(a=!0,C.update()),!r&&(E=i.length()===0,E))if(y)E=y(8,n,!r);else{var S=n.length(),N=n.at(S-1);N>S?E=!1:n.truncate(N)}return E}},C};re.rc2.startEncrypting=function(e,t,r){var a=re.rc2.createEncryptionCipher(e,128);return a.start(t,r),a};re.rc2.createEncryptionCipher=function(e,t){return ir(e,t,!0)};re.rc2.startDecrypting=function(e,t,r){var a=re.rc2.createDecryptionCipher(e,128);return a.start(t,r),a};re.rc2.createDecryptionCipher=function(e,t){return ir(e,t,!1)};var gt=K;gt.jsbn=gt.jsbn||{};var Ee;function T(e,t,r){this.data=[],e!=null&&(typeof e=="number"?this.fromNumber(e,t,r):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}gt.jsbn.BigInteger=T;function q(){return new T(null)}function Xr(e,t,r,a,i,n){for(;--n>=0;){var s=t*this.data[e++]+r.data[a]+i;i=Math.floor(s/67108864),r.data[a++]=s&67108863}return i}function Yr(e,t,r,a,i,n){for(var s=t&32767,o=t>>15;--n>=0;){var f=this.data[e]&32767,u=this.data[e++]>>15,c=o*f+u*s;f=s*f+((c&32767)<<15)+r.data[a]+(i&1073741823),i=(f>>>30)+(c>>>15)+o*u+(i>>>30),r.data[a++]=f&1073741823}return i}function Kt(e,t,r,a,i,n){for(var s=t&16383,o=t>>14;--n>=0;){var f=this.data[e]&16383,u=this.data[e++]>>14,c=o*f+u*s;f=s*f+((c&16383)<<14)+r.data[a]+i,i=(f>>28)+(c>>14)+o*u,r.data[a++]=f&268435455}return i}typeof navigator>"u"?(T.prototype.am=Kt,Ee=28):navigator.appName=="Microsoft Internet Explorer"?(T.prototype.am=Yr,Ee=30):navigator.appName!="Netscape"?(T.prototype.am=Xr,Ee=26):(T.prototype.am=Kt,Ee=28);T.prototype.DB=Ee;T.prototype.DM=(1<<Ee)-1;T.prototype.DV=1<<Ee;var bt=52;T.prototype.FV=Math.pow(2,bt);T.prototype.F1=bt-Ee;T.prototype.F2=2*Ee-bt;var Zr="0123456789abcdefghijklmnopqrstuvwxyz",ut=new Array,Fe,ae;Fe="0".charCodeAt(0);for(ae=0;ae<=9;++ae)ut[Fe++]=ae;Fe="a".charCodeAt(0);for(ae=10;ae<36;++ae)ut[Fe++]=ae;Fe="A".charCodeAt(0);for(ae=10;ae<36;++ae)ut[Fe++]=ae;function Mt(e){return Zr.charAt(e)}function nr(e,t){var r=ut[e.charCodeAt(t)];return r??-1}function $r(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function jr(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function Te(e){var t=q();return t.fromInt(e),t}function Jr(e,t){var r;if(t==16)r=4;else if(t==8)r=3;else if(t==256)r=8;else if(t==2)r=1;else if(t==32)r=5;else if(t==4)r=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var a=e.length,i=!1,n=0;--a>=0;){var s=r==8?e[a]&255:nr(e,a);if(s<0){e.charAt(a)=="-"&&(i=!0);continue}i=!1,n==0?this.data[this.t++]=s:n+r>this.DB?(this.data[this.t-1]|=(s&(1<<this.DB-n)-1)<<n,this.data[this.t++]=s>>this.DB-n):this.data[this.t-1]|=s<<n,n+=r,n>=this.DB&&(n-=this.DB)}r==8&&e[0]&128&&(this.s=-1,n>0&&(this.data[this.t-1]|=(1<<this.DB-n)-1<<n)),this.clamp(),i&&T.ZERO.subTo(this,this)}function ea(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t}function ta(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var r=(1<<t)-1,a,i=!1,n="",s=this.t,o=this.DB-s*this.DB%t;if(s-- >0)for(o<this.DB&&(a=this.data[s]>>o)>0&&(i=!0,n=Mt(a));s>=0;)o<t?(a=(this.data[s]&(1<<o)-1)<<t-o,a|=this.data[--s]>>(o+=this.DB-t)):(a=this.data[s]>>(o-=t)&r,o<=0&&(o+=this.DB,--s)),a>0&&(i=!0),i&&(n+=Mt(a));return i?n:"0"}function ra(){var e=q();return T.ZERO.subTo(this,e),e}function aa(){return this.s<0?this.negate():this}function ia(e){var t=this.s-e.s;if(t!=0)return t;var r=this.t;if(t=r-e.t,t!=0)return this.s<0?-t:t;for(;--r>=0;)if((t=this.data[r]-e.data[r])!=0)return t;return 0}function ft(e){var t=1,r;return(r=e>>>16)!=0&&(e=r,t+=16),(r=e>>8)!=0&&(e=r,t+=8),(r=e>>4)!=0&&(e=r,t+=4),(r=e>>2)!=0&&(e=r,t+=2),(r=e>>1)!=0&&(e=r,t+=1),t}function na(){return this.t<=0?0:this.DB*(this.t-1)+ft(this.data[this.t-1]^this.s&this.DM)}function sa(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s}function oa(e,t){for(var r=e;r<this.t;++r)t.data[r-e]=this.data[r];t.t=Math.max(this.t-e,0),t.s=this.s}function ua(e,t){var r=e%this.DB,a=this.DB-r,i=(1<<a)-1,n=Math.floor(e/this.DB),s=this.s<<r&this.DM,o;for(o=this.t-1;o>=0;--o)t.data[o+n+1]=this.data[o]>>a|s,s=(this.data[o]&i)<<r;for(o=n-1;o>=0;--o)t.data[o]=0;t.data[n]=s,t.t=this.t+n+1,t.s=this.s,t.clamp()}function fa(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t){t.t=0;return}var a=e%this.DB,i=this.DB-a,n=(1<<a)-1;t.data[0]=this.data[r]>>a;for(var s=r+1;s<this.t;++s)t.data[s-r-1]|=(this.data[s]&n)<<i,t.data[s-r]=this.data[s]>>a;a>0&&(t.data[this.t-r-1]|=(this.s&n)<<i),t.t=this.t-r,t.clamp()}function la(e,t){for(var r=0,a=0,i=Math.min(e.t,this.t);r<i;)a+=this.data[r]-e.data[r],t.data[r++]=a&this.DM,a>>=this.DB;if(e.t<this.t){for(a-=e.s;r<this.t;)a+=this.data[r],t.data[r++]=a&this.DM,a>>=this.DB;a+=this.s}else{for(a+=this.s;r<e.t;)a-=e.data[r],t.data[r++]=a&this.DM,a>>=this.DB;a-=e.s}t.s=a<0?-1:0,a<-1?t.data[r++]=this.DV+a:a>0&&(t.data[r++]=a),t.t=r,t.clamp()}function ca(e,t){var r=this.abs(),a=e.abs(),i=r.t;for(t.t=i+a.t;--i>=0;)t.data[i]=0;for(i=0;i<a.t;++i)t.data[i+r.t]=r.am(0,a.data[i],t,i,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&T.ZERO.subTo(t,t)}function ha(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e.data[r]=0;for(r=0;r<t.t-1;++r){var a=t.am(r,t.data[r],e,2*r,0,1);(e.data[r+t.t]+=t.am(r+1,2*t.data[r],e,2*r+1,a,t.t-r-1))>=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()}function pa(e,t,r){var a=e.abs();if(!(a.t<=0)){var i=this.abs();if(i.t<a.t){t?.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=q());var n=q(),s=this.s,o=e.s,f=this.DB-ft(a.data[a.t-1]);f>0?(a.lShiftTo(f,n),i.lShiftTo(f,r)):(a.copyTo(n),i.copyTo(r));var u=n.t,c=n.data[u-1];if(c!=0){var h=c*(1<<this.F1)+(u>1?n.data[u-2]>>this.F2:0),d=this.FV/h,C=(1<<this.F1)/h,y=1<<this.F2,E=r.t,x=E-u,S=t??q();for(n.dlShiftTo(x,S),r.compareTo(S)>=0&&(r.data[r.t++]=1,r.subTo(S,r)),T.ONE.dlShiftTo(u,S),S.subTo(n,n);n.t<u;)n.data[n.t++]=0;for(;--x>=0;){var N=r.data[--E]==c?this.DM:Math.floor(r.data[E]*d+(r.data[E-1]+y)*C);if((r.data[E]+=n.am(0,N,r,x,0,u))<N)for(n.dlShiftTo(x,S),r.subTo(S,r);r.data[E]<--N;)r.subTo(S,r)}t!=null&&(r.drShiftTo(u,t),s!=o&&T.ZERO.subTo(t,t)),r.t=u,r.clamp(),f>0&&r.rShiftTo(f,r),s<0&&T.ZERO.subTo(r,r)}}}function da(e){var t=q();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(T.ZERO)>0&&e.subTo(t,t),t}function Ue(e){this.m=e}function ya(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function va(e){return e}function ga(e){e.divRemTo(this.m,null,e)}function Ca(e,t,r){e.multiplyTo(t,r),this.reduce(r)}function ma(e,t){e.squareTo(t),this.reduce(t)}Ue.prototype.convert=ya;Ue.prototype.revert=va;Ue.prototype.reduce=ga;Ue.prototype.mulTo=Ca;Ue.prototype.sqrTo=ma;function Ea(){if(this.t<1)return 0;var e=this.data[0];if(!(e&1))return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function Le(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function xa(e){var t=q();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(T.ZERO)>0&&this.m.subTo(t,t),t}function Sa(e){var t=q();return e.copyTo(t),this.reduce(t),t}function Ta(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=e.data[t]&32767,a=r*this.mpl+((r*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,a,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function Ia(e,t){e.squareTo(t),this.reduce(t)}function Aa(e,t,r){e.multiplyTo(t,r),this.reduce(r)}Le.prototype.convert=xa;Le.prototype.revert=Sa;Le.prototype.reduce=Ta;Le.prototype.mulTo=Aa;Le.prototype.sqrTo=Ia;function Ba(){return(this.t>0?this.data[0]&1:this.s)==0}function ba(e,t){if(e>4294967295||e<1)return T.ONE;var r=q(),a=q(),i=t.convert(this),n=ft(e)-1;for(i.copyTo(r);--n>=0;)if(t.sqrTo(r,a),(e&1<<n)>0)t.mulTo(a,i,r);else{var s=r;r=a,a=s}return t.revert(r)}function Na(e,t){var r;return e<256||t.isEven()?r=new Ue(t):r=new Le(t),this.exp(e,r)}T.prototype.copyTo=$r;T.prototype.fromInt=jr;T.prototype.fromString=Jr;T.prototype.clamp=ea;T.prototype.dlShiftTo=sa;T.prototype.drShiftTo=oa;T.prototype.lShiftTo=ua;T.prototype.rShiftTo=fa;T.prototype.subTo=la;T.prototype.multiplyTo=ca;T.prototype.squareTo=ha;T.prototype.divRemTo=pa;T.prototype.invDigit=Ea;T.prototype.isEven=Ba;T.prototype.exp=ba;T.prototype.toString=ta;T.prototype.negate=ra;T.prototype.abs=aa;T.prototype.compareTo=ia;T.prototype.bitLength=na;T.prototype.mod=da;T.prototype.modPowInt=Na;T.ZERO=Te(0);T.ONE=Te(1);function Ra(){var e=q();return this.copyTo(e),e}function wa(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function Ua(){return this.t==0?this.s:this.data[0]<<24>>24}function La(){return this.t==0?this.s:this.data[0]<<16>>16}function Da(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function _a(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function Pa(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),a=Te(r),i=q(),n=q(),s="";for(this.divRemTo(a,i,n);i.signum()>0;)s=(r+n.intValue()).toString(e).substr(1)+s,i.divRemTo(a,i,n);return n.intValue().toString(e)+s}function ka(e,t){this.fromInt(0),t==null&&(t=10);for(var r=this.chunkSize(t),a=Math.pow(t,r),i=!1,n=0,s=0,o=0;o<e.length;++o){var f=nr(e,o);if(f<0){e.charAt(o)=="-"&&this.signum()==0&&(i=!0);continue}s=t*s+f,++n>=r&&(this.dMultiply(a),this.dAddOffset(s,0),n=0,s=0)}n>0&&(this.dMultiply(Math.pow(t,n)),this.dAddOffset(s,0)),i&&T.ZERO.subTo(this,this)}function Va(e,t,r){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(T.ONE.shiftLeft(e-1),Nt,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(T.ONE.shiftLeft(e-1),this);else{var a=new Array,i=e&7;a.length=(e>>3)+1,t.nextBytes(a),i>0?a[0]&=(1<<i)-1:a[0]=0,this.fromString(a,256)}}function Oa(){var e=this.t,t=new Array;t[0]=this.s;var r=this.DB-e*this.DB%8,a,i=0;if(e-- >0)for(r<this.DB&&(a=this.data[e]>>r)!=(this.s&this.DM)>>r&&(t[i++]=a|this.s<<this.DB-r);e>=0;)r<8?(a=(this.data[e]&(1<<r)-1)<<8-r,a|=this.data[--e]>>(r+=this.DB-8)):(a=this.data[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),a&128&&(a|=-256),i==0&&(this.s&128)!=(a&128)&&++i,(i>0||a!=this.s)&&(t[i++]=a);return t}function Fa(e){return this.compareTo(e)==0}function Ka(e){return this.compareTo(e)<0?this:e}function Ma(e){return this.compareTo(e)>0?this:e}function Ga(e,t,r){var a,i,n=Math.min(e.t,this.t);for(a=0;a<n;++a)r.data[a]=t(this.data[a],e.data[a]);if(e.t<this.t){for(i=e.s&this.DM,a=n;a<this.t;++a)r.data[a]=t(this.data[a],i);r.t=this.t}else{for(i=this.s&this.DM,a=n;a<e.t;++a)r.data[a]=t(i,e.data[a]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}function qa(e,t){return e&t}function za(e){var t=q();return this.bitwiseTo(e,qa,t),t}function Nt(e,t){return e|t}function Qa(e){var t=q();return this.bitwiseTo(e,Nt,t),t}function sr(e,t){return e^t}function Ha(e){var t=q();return this.bitwiseTo(e,sr,t),t}function or(e,t){return e&~t}function Wa(e){var t=q();return this.bitwiseTo(e,or,t),t}function Xa(){for(var e=q(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e}function Ya(e){var t=q();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function Za(e){var t=q();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function $a(e){if(e==0)return-1;var t=0;return e&65535||(e>>=16,t+=16),e&255||(e>>=8,t+=8),e&15||(e>>=4,t+=4),e&3||(e>>=2,t+=2),e&1||++t,t}function ja(){for(var e=0;e<this.t;++e)if(this.data[e]!=0)return e*this.DB+$a(this.data[e]);return this.s<0?this.t*this.DB:-1}function Ja(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function ei(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=Ja(this.data[r]^t);return e}function ti(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this.data[t]&1<<e%this.DB)!=0}function ri(e,t){var r=T.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}function ai(e){return this.changeBit(e,Nt)}function ii(e){return this.changeBit(e,or)}function ni(e){return this.changeBit(e,sr)}function si(e,t){for(var r=0,a=0,i=Math.min(e.t,this.t);r<i;)a+=this.data[r]+e.data[r],t.data[r++]=a&this.DM,a>>=this.DB;if(e.t<this.t){for(a+=e.s;r<this.t;)a+=this.data[r],t.data[r++]=a&this.DM,a>>=this.DB;a+=this.s}else{for(a+=this.s;r<e.t;)a+=e.data[r],t.data[r++]=a&this.DM,a>>=this.DB;a+=e.s}t.s=a<0?-1:0,a>0?t.data[r++]=a:a<-1&&(t.data[r++]=this.DV+a),t.t=r,t.clamp()}function oi(e){var t=q();return this.addTo(e,t),t}function ui(e){var t=q();return this.subTo(e,t),t}function fi(e){var t=q();return this.multiplyTo(e,t),t}function li(e){var t=q();return this.divRemTo(e,t,null),t}function ci(e){var t=q();return this.divRemTo(e,null,t),t}function hi(e){var t=q(),r=q();return this.divRemTo(e,t,r),new Array(t,r)}function pi(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function di(e,t){if(e!=0){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function We(){}function ur(e){return e}function yi(e,t,r){e.multiplyTo(t,r)}function vi(e,t){e.squareTo(t)}We.prototype.convert=ur;We.prototype.revert=ur;We.prototype.mulTo=yi;We.prototype.sqrTo=vi;function gi(e){return this.exp(e,new We)}function Ci(e,t,r){var a=Math.min(this.t+e.t,t);for(r.s=0,r.t=a;a>0;)r.data[--a]=0;var i;for(i=r.t-this.t;a<i;++a)r.data[a+this.t]=this.am(0,e.data[a],r,a,0,this.t);for(i=Math.min(e.t,t);a<i;++a)this.am(0,e.data[a],r,a,0,t-a);r.clamp()}function mi(e,t,r){--t;var a=r.t=this.t+e.t-t;for(r.s=0;--a>=0;)r.data[a]=0;for(a=Math.max(t-this.t,0);a<e.t;++a)r.data[this.t+a-t]=this.am(t-a,e.data[a],r,0,0,this.t+a-t);r.clamp(),r.drShiftTo(1,r)}function Ke(e){this.r2=q(),this.q3=q(),T.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function Ei(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=q();return e.copyTo(t),this.reduce(t),t}function xi(e){return e}function Si(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function Ti(e,t){e.squareTo(t),this.reduce(t)}function Ii(e,t,r){e.multiplyTo(t,r),this.reduce(r)}Ke.prototype.convert=Ei;Ke.prototype.revert=xi;Ke.prototype.reduce=Si;Ke.prototype.mulTo=Ii;Ke.prototype.sqrTo=Ti;function Ai(e,t){var r=e.bitLength(),a,i=Te(1),n;if(r<=0)return i;r<18?a=1:r<48?a=3:r<144?a=4:r<768?a=5:a=6,r<8?n=new Ue(t):t.isEven()?n=new Ke(t):n=new Le(t);var s=new Array,o=3,f=a-1,u=(1<<a)-1;if(s[1]=n.convert(this),a>1){var c=q();for(n.sqrTo(s[1],c);o<=u;)s[o]=q(),n.mulTo(c,s[o-2],s[o]),o+=2}var h=e.t-1,d,C=!0,y=q(),E;for(r=ft(e.data[h])-1;h>=0;){for(r>=f?d=e.data[h]>>r-f&u:(d=(e.data[h]&(1<<r+1)-1)<<f-r,h>0&&(d|=e.data[h-1]>>this.DB+r-f)),o=a;!(d&1);)d>>=1,--o;if((r-=o)<0&&(r+=this.DB,--h),C)s[d].copyTo(i),C=!1;else{for(;o>1;)n.sqrTo(i,y),n.sqrTo(y,i),o-=2;o>0?n.sqrTo(i,y):(E=i,i=y,y=E),n.mulTo(y,s[d],i)}for(;h>=0&&!(e.data[h]&1<<r);)n.sqrTo(i,y),E=i,i=y,y=E,--r<0&&(r=this.DB-1,--h)}return n.revert(i)}function Bi(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var a=t;t=r,r=a}var i=t.getLowestSetBit(),n=r.getLowestSetBit();if(n<0)return t;for(i<n&&(n=i),n>0&&(t.rShiftTo(n,t),r.rShiftTo(n,r));t.signum()>0;)(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return n>0&&r.lShiftTo(n,r),r}function bi(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(t==0)r=this.data[0]%e;else for(var a=this.t-1;a>=0;--a)r=(t*r+this.data[a])%e;return r}function Ni(e){var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return T.ZERO;for(var r=e.clone(),a=this.clone(),i=Te(1),n=Te(0),s=Te(0),o=Te(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),t?((!i.isEven()||!n.isEven())&&(i.addTo(this,i),n.subTo(e,n)),i.rShiftTo(1,i)):n.isEven()||n.subTo(e,n),n.rShiftTo(1,n);for(;a.isEven();)a.rShiftTo(1,a),t?((!s.isEven()||!o.isEven())&&(s.addTo(this,s),o.subTo(e,o)),s.rShiftTo(1,s)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);r.compareTo(a)>=0?(r.subTo(a,r),t&&i.subTo(s,i),n.subTo(o,n)):(a.subTo(r,a),t&&s.subTo(i,s),o.subTo(n,o))}if(a.compareTo(T.ONE)!=0)return T.ZERO;if(o.compareTo(e)>=0)return o.subtract(e);if(o.signum()<0)o.addTo(e,o);else return o;return o.signum()<0?o.add(e):o}var oe=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],Ri=(1<<26)/oe[oe.length-1];function wi(e){var t,r=this.abs();if(r.t==1&&r.data[0]<=oe[oe.length-1]){for(t=0;t<oe.length;++t)if(r.data[0]==oe[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<oe.length;){for(var a=oe[t],i=t+1;i<oe.length&&a<Ri;)a*=oe[i++];for(a=r.modInt(a);t<i;)if(a%oe[t++]==0)return!1}return r.millerRabin(e)}function Ui(e){var t=this.subtract(T.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var a=t.shiftRight(r),i=Li(),n,s=0;s<e;++s){do n=new T(this.bitLength(),i);while(n.compareTo(T.ONE)<=0||n.compareTo(t)>=0);var o=n.modPow(a,this);if(o.compareTo(T.ONE)!=0&&o.compareTo(t)!=0){for(var f=1;f++<r&&o.compareTo(t)!=0;)if(o=o.modPowInt(2,this),o.compareTo(T.ONE)==0)return!1;if(o.compareTo(t)!=0)return!1}}return!0}function Li(){return{nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(Math.random()*256)}}}T.prototype.chunkSize=Da;T.prototype.toRadix=Pa;T.prototype.fromRadix=ka;T.prototype.fromNumber=Va;T.prototype.bitwiseTo=Ga;T.prototype.changeBit=ri;T.prototype.addTo=si;T.prototype.dMultiply=pi;T.prototype.dAddOffset=di;T.prototype.multiplyLowerTo=Ci;T.prototype.multiplyUpperTo=mi;T.prototype.modInt=bi;T.prototype.millerRabin=Ui;T.prototype.clone=Ra;T.prototype.intValue=wa;T.prototype.byteValue=Ua;T.prototype.shortValue=La;T.prototype.signum=_a;T.prototype.toByteArray=Oa;T.prototype.equals=Fa;T.prototype.min=Ka;T.prototype.max=Ma;T.prototype.and=za;T.prototype.or=Qa;T.prototype.xor=Ha;T.prototype.andNot=Wa;T.prototype.not=Xa;T.prototype.shiftLeft=Ya;T.prototype.shiftRight=Za;T.prototype.getLowestSetBit=ja;T.prototype.bitCount=ei;T.prototype.testBit=ti;T.prototype.setBit=ai;T.prototype.clearBit=ii;T.prototype.flipBit=ni;T.prototype.add=oi;T.prototype.subtract=ui;T.prototype.multiply=fi;T.prototype.divide=li;T.prototype.remainder=ci;T.prototype.divideAndRemainder=hi;T.prototype.modPow=Ai;T.prototype.modInverse=Ni;T.prototype.pow=gi;T.prototype.gcd=Bi;T.prototype.isProbablePrime=wi;var pe=K,fr=pe.sha1=pe.sha1||{};pe.md.sha1=pe.md.algorithms.sha1=fr;fr.create=function(){lr||Di();var e=null,t=pe.util.createBuffer(),r=new Array(80),a={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return a.start=function(){a.messageLength=0,a.fullMessageLength=a.messageLength64=[];for(var i=a.messageLengthSize/4,n=0;n<i;++n)a.fullMessageLength.push(0);return t=pe.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},a},a.start(),a.update=function(i,n){n==="utf8"&&(i=pe.util.encodeUtf8(i));var s=i.length;a.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var o=a.fullMessageLength.length-1;o>=0;--o)a.fullMessageLength[o]+=s[1],s[1]=s[0]+(a.fullMessageLength[o]/4294967296>>>0),a.fullMessageLength[o]=a.fullMessageLength[o]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(i),Gt(e,r,t),(t.read>2048||t.length()===0)&&t.compact(),a},a.digest=function(){var i=pe.util.createBuffer();i.putBytes(t.bytes());var n=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,s=n&a.blockLength-1;i.putBytes(Ct.substr(0,a.blockLength-s));for(var o,f,u=a.fullMessageLength[0]*8,c=0;c<a.fullMessageLength.length-1;++c)o=a.fullMessageLength[c+1]*8,f=o/4294967296>>>0,u+=f,i.putInt32(u>>>0),u=o>>>0;i.putInt32(u);var h={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};Gt(h,r,i);var d=pe.util.createBuffer();return d.putInt32(h.h0),d.putInt32(h.h1),d.putInt32(h.h2),d.putInt32(h.h3),d.putInt32(h.h4),d},a};var Ct=null,lr=!1;function Di(){Ct=String.fromCharCode(128),Ct+=pe.util.fillString(String.fromCharCode(0),64),lr=!0}function Gt(e,t,r){for(var a,i,n,s,o,f,u,c,h=r.length();h>=64;){for(i=e.h0,n=e.h1,s=e.h2,o=e.h3,f=e.h4,c=0;c<16;++c)a=r.getInt32(),t[c]=a,u=o^n&(s^o),a=(i<<5|i>>>27)+u+f+1518500249+a,f=o,o=s,s=(n<<30|n>>>2)>>>0,n=i,i=a;for(;c<20;++c)a=t[c-3]^t[c-8]^t[c-14]^t[c-16],a=a<<1|a>>>31,t[c]=a,u=o^n&(s^o),a=(i<<5|i>>>27)+u+f+1518500249+a,f=o,o=s,s=(n<<30|n>>>2)>>>0,n=i,i=a;for(;c<32;++c)a=t[c-3]^t[c-8]^t[c-14]^t[c-16],a=a<<1|a>>>31,t[c]=a,u=n^s^o,a=(i<<5|i>>>27)+u+f+1859775393+a,f=o,o=s,s=(n<<30|n>>>2)>>>0,n=i,i=a;for(;c<40;++c)a=t[c-6]^t[c-16]^t[c-28]^t[c-32],a=a<<2|a>>>30,t[c]=a,u=n^s^o,a=(i<<5|i>>>27)+u+f+1859775393+a,f=o,o=s,s=(n<<30|n>>>2)>>>0,n=i,i=a;for(;c<60;++c)a=t[c-6]^t[c-16]^t[c-28]^t[c-32],a=a<<2|a>>>30,t[c]=a,u=n&s|o&(n^s),a=(i<<5|i>>>27)+u+f+2400959708+a,f=o,o=s,s=(n<<30|n>>>2)>>>0,n=i,i=a;for(;c<80;++c)a=t[c-6]^t[c-16]^t[c-28]^t[c-32],a=a<<2|a>>>30,t[c]=a,u=n^s^o,a=(i<<5|i>>>27)+u+f+3395469782+a,f=o,o=s,s=(n<<30|n>>>2)>>>0,n=i,i=a;e.h0=e.h0+i|0,e.h1=e.h1+n|0,e.h2=e.h2+s|0,e.h3=e.h3+o|0,e.h4=e.h4+f|0,h-=64}}var de=K,cr=de.pkcs1=de.pkcs1||{};cr.encode_rsa_oaep=function(e,t,r){var a,i,n,s;typeof r=="string"?(a=r,i=arguments[3]||void 0,n=arguments[4]||void 0):r&&(a=r.label||void 0,i=r.seed||void 0,n=r.md||void 0,r.mgf1&&r.mgf1.md&&(s=r.mgf1.md)),n?n.start():n=de.md.sha1.create(),s||(s=n);var o=Math.ceil(e.n.bitLength()/8),f=o-2*n.digestLength-2;if(t.length>f){var u=new Error("RSAES-OAEP input message length is too long.");throw u.length=t.length,u.maxLength=f,u}a||(a=""),n.update(a,"raw");for(var c=n.digest(),h="",d=f-t.length,C=0;C<d;C++)h+="\0";var y=c.getBytes()+h+""+t;if(!i)i=de.random.getBytes(n.digestLength);else if(i.length!==n.digestLength){var u=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw u.seedLength=i.length,u.digestLength=n.digestLength,u}var E=Je(i,o-n.digestLength-1,s),x=de.util.xorBytes(y,E,y.length),S=Je(x,n.digestLength,s),N=de.util.xorBytes(i,S,i.length);return"\0"+N+x};cr.decode_rsa_oaep=function(e,t,r){var a,i,n;typeof r=="string"?(a=r,i=arguments[3]||void 0):r&&(a=r.label||void 0,i=r.md||void 0,r.mgf1&&r.mgf1.md&&(n=r.mgf1.md));var s=Math.ceil(e.n.bitLength()/8);if(t.length!==s){var x=new Error("RSAES-OAEP encoded message length is invalid.");throw x.length=t.length,x.expectedLength=s,x}if(i===void 0?i=de.md.sha1.create():i.start(),n||(n=i),s<2*i.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");a||(a=""),i.update(a,"raw");for(var o=i.digest().getBytes(),f=t.charAt(0),u=t.substring(1,i.digestLength+1),c=t.substring(1+i.digestLength),h=Je(c,i.digestLength,n),d=de.util.xorBytes(u,h,u.length),C=Je(d,s-i.digestLength-1,n),y=de.util.xorBytes(c,C,c.length),E=y.substring(0,i.digestLength),x=f!=="\0",S=0;S<i.digestLength;++S)x|=o.charAt(S)!==E.charAt(S);for(var N=1,B=i.digestLength,P=i.digestLength;P<y.length;P++){var L=y.charCodeAt(P),U=L&1^1,j=N?65534:0;x|=L&j,N=N&U,B+=N}if(x||y.charCodeAt(B)!==1)throw new Error("Invalid RSAES-OAEP padding.");return y.substring(B+1)};function Je(e,t,r){r||(r=de.md.sha1.create());for(var a="",i=Math.ceil(t/r.digestLength),n=0;n<i;++n){var s=String.fromCharCode(n>>24&255,n>>16&255,n>>8&255,n&255);r.start(),r.update(e+s),a+=r.digest().getBytes()}return a.substring(0,t)}var Be=K;(function(){if(Be.prime)return;var e=Be.prime=Be.prime||{},t=Be.jsbn.BigInteger,r=[6,4,2,4,2,4,6,2],a=new t(null);a.fromInt(30);var i=function(h,d){return h|d};e.generateProbablePrime=function(h,d,C){typeof d=="function"&&(C=d,d={}),d=d||{};var y=d.algorithm||"PRIMEINC";typeof y=="string"&&(y={name:y}),y.options=y.options||{};var E=d.prng||Be.random,x={nextBytes:function(S){for(var N=E.getBytesSync(S.length),B=0;B<S.length;++B)S[B]=N.charCodeAt(B)}};if(y.name==="PRIMEINC")return n(h,x,y.options,C);throw new Error("Invalid prime generation algorithm: "+y.name)};function n(h,d,C,y){return"workers"in C?f(h,d,C,y):s(h,d,C,y)}function s(h,d,C,y){var E=u(h,d),x=0,S=c(E.bitLength());"millerRabinTests"in C&&(S=C.millerRabinTests);var N=10;"maxBlockTime"in C&&(N=C.maxBlockTime),o(E,h,d,x,S,N,y)}function o(h,d,C,y,E,x,S){var N=+new Date;do{if(h.bitLength()>d&&(h=u(d,C)),h.isProbablePrime(E))return S(null,h);h.dAddOffset(r[y++%8],0)}while(x<0||+new Date-N<x);Be.util.setImmediate(function(){o(h,d,C,y,E,x,S)})}function f(h,d,C,y){if(typeof Worker>"u")return s(h,d,C,y);var E=u(h,d),x=C.workers,S=C.workLoad||100,N=S*30/8,B=C.workerScript||"forge/prime.worker.js";if(x===-1)return Be.util.estimateCores(function(L,U){L&&(U=2),x=U-1,P()});P();function P(){x=Math.max(1,x);for(var L=[],U=0;U<x;++U)L[U]=new Worker(B);for(var U=0;U<x;++U)L[U].addEventListener("message",se);var j=!1;function se(fe){if(!j){var ve=fe.data;if(ve.found){for(var ge=0;ge<L.length;++ge)L[ge].terminate();return j=!0,y(null,new t(ve.prime,16))}E.bitLength()>h&&(E=u(h,d));var De=E.toString(16);fe.target.postMessage({hex:De,workLoad:S}),E.dAddOffset(N,0)}}}}function u(h,d){var C=new t(h,d),y=h-1;return C.testBit(y)||C.bitwiseTo(t.ONE.shiftLeft(y),i,C),C.dAddOffset(31-C.mod(a).byteValue(),0),C}function c(h){return h<=100?27:h<=150?18:h<=200?15:h<=250?12:h<=300?9:h<=350?8:h<=400?7:h<=500?6:h<=600?5:h<=800?4:h<=1250?3:2}})();var _=K;typeof M>"u"&&(M=_.jsbn.BigInteger);var M,mt=_.util.isNodejs?Et:null,g=_.asn1,ie=_.util;_.pki=_.pki||{};_.pki.rsa=_.rsa=_.rsa||{};var k=_.pki,_i=[6,4,2,4,2,4,6,2],Pi={name:"PrivateKeyInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},ki={name:"RSAPrivateKey",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},Vi={name:"RSAPublicKey",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:g.Class.UNIVERSAL,type:g.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},Oi=_.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:g.Class.UNIVERSAL,type:g.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},Fi={name:"DigestInfo",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:g.Class.UNIVERSAL,type:g.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:g.Class.UNIVERSAL,type:g.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:g.Class.UNIVERSAL,type:g.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:g.Class.UNIVERSAL,type:g.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},Ki=function(e){var t;if(e.algorithm in k.oids)t=k.oids[e.algorithm];else{var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}var a=g.oidToDer(t).getBytes(),i=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]),n=g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[]);n.value.push(g.create(g.Class.UNIVERSAL,g.Type.OID,!1,a)),n.value.push(g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,""));var s=g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,e.digest().getBytes());return i.value.push(n),i.value.push(s),g.toDer(i).getBytes()},hr=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);t.dP||(t.dP=t.d.mod(t.p.subtract(M.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(M.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));var a;do a=new M(_.util.bytesToHex(_.random.getBytes(t.n.bitLength()/8)),16);while(a.compareTo(t.n)>=0||!a.gcd(t.n).equals(M.ONE));e=e.multiply(a.modPow(t.e,t.n)).mod(t.n);for(var i=e.mod(t.p).modPow(t.dP,t.p),n=e.mod(t.q).modPow(t.dQ,t.q);i.compareTo(n)<0;)i=i.add(t.p);var s=i.subtract(n).multiply(t.qInv).mod(t.p).multiply(t.q).add(n);return s=s.multiply(a.modInverse(t.n)).mod(t.n),s};k.rsa.encrypt=function(e,t,r){var a=r,i,n=Math.ceil(t.n.bitLength()/8);r!==!1&&r!==!0?(a=r===2,i=pr(e,t,r)):(i=_.util.createBuffer(),i.putBytes(e));for(var s=new M(i.toHex(),16),o=hr(s,t,a),f=o.toString(16),u=_.util.createBuffer(),c=n-Math.ceil(f.length/2);c>0;)u.putByte(0),--c;return u.putBytes(_.util.hexToBytes(f)),u.getBytes()};k.rsa.decrypt=function(e,t,r,a){var i=Math.ceil(t.n.bitLength()/8);if(e.length!==i){var n=new Error("Encrypted message length is invalid.");throw n.length=e.length,n.expected=i,n}var s=new M(_.util.createBuffer(e).toHex(),16);if(s.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var o=hr(s,t,r),f=o.toString(16),u=_.util.createBuffer(),c=i-Math.ceil(f.length/2);c>0;)u.putByte(0),--c;return u.putBytes(_.util.hexToBytes(f)),a!==!1?et(u.getBytes(),t,r):u.getBytes()};k.rsa.createKeyPairGenerationState=function(e,t,r){typeof e=="string"&&(e=parseInt(e,10)),e=e||2048,r=r||{};var a=r.prng||_.random,i={nextBytes:function(o){for(var f=a.getBytesSync(o.length),u=0;u<o.length;++u)o[u]=f.charCodeAt(u)}},n=r.algorithm||"PRIMEINC",s;if(n==="PRIMEINC")s={algorithm:n,state:0,bits:e,rng:i,eInt:t||65537,e:new M(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},s.e.fromInt(s.eInt);else throw new Error("Invalid key generation algorithm: "+n);return s};k.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new M(null);r.fromInt(30);for(var a=0,i=function(h,d){return h|d},n=+new Date,s,o=0;e.keys===null&&(t<=0||o<t);){if(e.state===0){var f=e.p===null?e.pBits:e.qBits,u=f-1;e.pqState===0?(e.num=new M(f,e.rng),e.num.testBit(u)||e.num.bitwiseTo(M.ONE.shiftLeft(u),i,e.num),e.num.dAddOffset(31-e.num.mod(r).byteValue(),0),a=0,++e.pqState):e.pqState===1?e.num.bitLength()>f?e.pqState=0:e.num.isProbablePrime(Gi(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(_i[a++%8],0):e.pqState===2?e.pqState=e.num.subtract(M.ONE).gcd(e.e).compareTo(M.ONE)===0?3:0:e.pqState===3&&(e.pqState=0,e.p===null?e.p=e.num:e.q=e.num,e.p!==null&&e.q!==null&&++e.state,e.num=null)}else if(e.state===1)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(e.state===2)e.p1=e.p.subtract(M.ONE),e.q1=e.q.subtract(M.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(e.state===3)e.phi.gcd(e.e).compareTo(M.ONE)===0?++e.state:(e.p=null,e.q=null,e.state=0);else if(e.state===4)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(e.state===5){var c=e.e.modInverse(e.phi);e.keys={privateKey:k.rsa.setPrivateKey(e.n,e.e,c,e.p,e.q,c.mod(e.p1),c.mod(e.q1),e.q.modInverse(e.p)),publicKey:k.rsa.setPublicKey(e.n,e.e)}}s=+new Date,o+=s-n,n=s}return e.keys!==null};k.rsa.generateKeyPair=function(e,t,r,a){if(arguments.length===1?typeof e=="object"?(r=e,e=void 0):typeof e=="function"&&(a=e,e=void 0):arguments.length===2?typeof e=="number"?typeof t=="function"?(a=t,t=void 0):typeof t!="number"&&(r=t,t=void 0):(r=e,a=t,e=void 0,t=void 0):arguments.length===3&&(typeof t=="number"?typeof r=="function"&&(a=r,r=void 0):(a=r,r=t,t=void 0)),r=r||{},e===void 0&&(e=r.bits||2048),t===void 0&&(t=r.e||65537),!r.prng&&e>=256&&e<=16384&&(t===65537||t===3)){if(a){if(qt("generateKeyPair"))return mt.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(o,f,u){if(o)return a(o);a(null,{privateKey:k.privateKeyFromPem(u),publicKey:k.publicKeyFromPem(f)})});if(zt("generateKey")&&zt("exportKey"))return ie.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:Ht(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(o){return ie.globalScope.crypto.subtle.exportKey("pkcs8",o.privateKey)}).then(void 0,function(o){a(o)}).then(function(o){if(o){var f=k.privateKeyFromAsn1(g.fromDer(_.util.createBuffer(o)));a(null,{privateKey:f,publicKey:k.setRsaPublicKey(f.n,f.e)})}});if(Qt("generateKey")&&Qt("exportKey")){var i=ie.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:Ht(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);i.oncomplete=function(o){var f=o.target.result,u=ie.globalScope.msCrypto.subtle.exportKey("pkcs8",f.privateKey);u.oncomplete=function(c){var h=c.target.result,d=k.privateKeyFromAsn1(g.fromDer(_.util.createBuffer(h)));a(null,{privateKey:d,publicKey:k.setRsaPublicKey(d.n,d.e)})},u.onerror=function(c){a(c)}},i.onerror=function(o){a(o)};return}}else if(qt("generateKeyPairSync")){var n=mt.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:k.privateKeyFromPem(n.privateKey),publicKey:k.publicKeyFromPem(n.publicKey)}}}var s=k.rsa.createKeyPairGenerationState(e,t,r);if(!a)return k.rsa.stepKeyPairGenerationState(s,0),s.keys;Mi(s,r,a)};k.setRsaPublicKey=k.rsa.setPublicKey=function(e,t){var r={n:e,e:t};return r.encrypt=function(a,i,n){if(typeof i=="string"?i=i.toUpperCase():i===void 0&&(i="RSAES-PKCS1-V1_5"),i==="RSAES-PKCS1-V1_5")i={encode:function(o,f,u){return pr(o,f,2).getBytes()}};else if(i==="RSA-OAEP"||i==="RSAES-OAEP")i={encode:function(o,f){return _.pkcs1.encode_rsa_oaep(f,o,n)}};else if(["RAW","NONE","NULL",null].indexOf(i)!==-1)i={encode:function(o){return o}};else if(typeof i=="string")throw new Error('Unsupported encryption scheme: "'+i+'".');var s=i.encode(a,r,!0);return k.rsa.encrypt(s,r,!0)},r.verify=function(a,i,n,s){typeof n=="string"?n=n.toUpperCase():n===void 0&&(n="RSASSA-PKCS1-V1_5"),s===void 0&&(s={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in s||(s._parseAllDigestBytes=!0),n==="RSASSA-PKCS1-V1_5"?n={verify:function(f,u){u=et(u,r,!0);var c=g.fromDer(u,{parseAllBytes:s._parseAllDigestBytes}),h={},d=[];if(!g.validate(c,Fi,h,d)){var C=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw C.errors=d,C}var y=g.derToOid(h.algorithmIdentifier);if(!(y===_.oids.md2||y===_.oids.md5||y===_.oids.sha1||y===_.oids.sha224||y===_.oids.sha256||y===_.oids.sha384||y===_.oids.sha512||y===_.oids["sha512-224"]||y===_.oids["sha512-256"])){var C=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw C.oid=y,C}if((y===_.oids.md2||y===_.oids.md5)&&!("parameters"in h))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return f===h.digest}}:(n==="NONE"||n==="NULL"||n===null)&&(n={verify:function(f,u){return u=et(u,r,!0),f===u}});var o=k.rsa.decrypt(i,r,!0,!1);return n.verify(a,o,r.n.bitLength())},r};k.setRsaPrivateKey=k.rsa.setPrivateKey=function(e,t,r,a,i,n,s,o){var f={n:e,e:t,d:r,p:a,q:i,dP:n,dQ:s,qInv:o};return f.decrypt=function(u,c,h){typeof c=="string"?c=c.toUpperCase():c===void 0&&(c="RSAES-PKCS1-V1_5");var d=k.rsa.decrypt(u,f,!1,!1);if(c==="RSAES-PKCS1-V1_5")c={decode:et};else if(c==="RSA-OAEP"||c==="RSAES-OAEP")c={decode:function(C,y){return _.pkcs1.decode_rsa_oaep(y,C,h)}};else if(["RAW","NONE","NULL",null].indexOf(c)!==-1)c={decode:function(C){return C}};else throw new Error('Unsupported encryption scheme: "'+c+'".');return c.decode(d,f,!1)},f.sign=function(u,c){var h=!1;typeof c=="string"&&(c=c.toUpperCase()),c===void 0||c==="RSASSA-PKCS1-V1_5"?(c={encode:Ki},h=1):(c==="NONE"||c==="NULL"||c===null)&&(c={encode:function(){return u}},h=1);var d=c.encode(u,f.n.bitLength());return k.rsa.encrypt(d,f,h)},f};k.wrapRsaPrivateKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(0).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(k.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.OCTETSTRING,!1,g.toDer(e).getBytes())])};k.privateKeyFromAsn1=function(e){var t={},r=[];if(g.validate(e,Pi,t,r)&&(e=g.fromDer(_.util.createBuffer(t.privateKey))),t={},r=[],!g.validate(e,ki,t,r)){var a=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw a.errors=r,a}var i,n,s,o,f,u,c,h;return i=_.util.createBuffer(t.privateKeyModulus).toHex(),n=_.util.createBuffer(t.privateKeyPublicExponent).toHex(),s=_.util.createBuffer(t.privateKeyPrivateExponent).toHex(),o=_.util.createBuffer(t.privateKeyPrime1).toHex(),f=_.util.createBuffer(t.privateKeyPrime2).toHex(),u=_.util.createBuffer(t.privateKeyExponent1).toHex(),c=_.util.createBuffer(t.privateKeyExponent2).toHex(),h=_.util.createBuffer(t.privateKeyCoefficient).toHex(),k.setRsaPrivateKey(new M(i,16),new M(n,16),new M(s,16),new M(o,16),new M(f,16),new M(u,16),new M(c,16),new M(h,16))};k.privateKeyToAsn1=k.privateKeyToRSAPrivateKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,g.integerToDer(0).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,le(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,le(e.e)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,le(e.d)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,le(e.p)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,le(e.q)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,le(e.dP)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,le(e.dQ)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,le(e.qInv))])};k.publicKeyFromAsn1=function(e){var t={},r=[];if(g.validate(e,Oi,t,r)){var a=g.derToOid(t.publicKeyOid);if(a!==k.oids.rsaEncryption){var i=new Error("Cannot read public key. Unknown OID.");throw i.oid=a,i}e=t.rsaPublicKey}if(r=[],!g.validate(e,Vi,t,r)){var i=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw i.errors=r,i}var n=_.util.createBuffer(t.publicKeyModulus).toHex(),s=_.util.createBuffer(t.publicKeyExponent).toHex();return k.setRsaPublicKey(new M(n,16),new M(s,16))};k.publicKeyToAsn1=k.publicKeyToSubjectPublicKeyInfo=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.OID,!1,g.oidToDer(k.oids.rsaEncryption).getBytes()),g.create(g.Class.UNIVERSAL,g.Type.NULL,!1,"")]),g.create(g.Class.UNIVERSAL,g.Type.BITSTRING,!1,[k.publicKeyToRSAPublicKey(e)])])};k.publicKeyToRSAPublicKey=function(e){return g.create(g.Class.UNIVERSAL,g.Type.SEQUENCE,!0,[g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,le(e.n)),g.create(g.Class.UNIVERSAL,g.Type.INTEGER,!1,le(e.e))])};function pr(e,t,r){var a=_.util.createBuffer(),i=Math.ceil(t.n.bitLength()/8);if(e.length>i-11){var n=new Error("Message is too long for PKCS#1 v1.5 padding.");throw n.length=e.length,n.max=i-11,n}a.putByte(0),a.putByte(r);var s=i-3-e.length,o;if(r===0||r===1){o=r===0?0:255;for(var f=0;f<s;++f)a.putByte(o)}else for(;s>0;){for(var u=0,c=_.random.getBytes(s),f=0;f<s;++f)o=c.charCodeAt(f),o===0?++u:a.putByte(o);s=u}return a.putByte(0),a.putBytes(e),a}function et(e,t,r,a){var i=Math.ceil(t.n.bitLength()/8),n=_.util.createBuffer(e),s=n.getByte(),o=n.getByte();if(s!==0||r&&o!==0&&o!==1||!r&&o!=2||r&&o===0&&typeof a>"u")throw new Error("Encryption block is invalid.");var f=0;if(o===0){f=i-3-a;for(var u=0;u<f;++u)if(n.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(o===1)for(f=0;n.length()>1;){if(n.getByte()!==255){--n.read;break}++f}else if(o===2)for(f=0;n.length()>1;){if(n.getByte()===0){--n.read;break}++f}var c=n.getByte();if(c!==0||f!==i-3-n.length())throw new Error("Encryption block is invalid.");return n.getBytes()}function Mi(e,t,r){typeof t=="function"&&(r=t,t={}),t=t||{};var a={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};"prng"in t&&(a.prng=t.prng),i();function i(){n(e.pBits,function(o,f){if(o)return r(o);if(e.p=f,e.q!==null)return s(o,e.q);n(e.qBits,s)})}function n(o,f){_.prime.generateProbablePrime(o,a,f)}function s(o,f){if(o)return r(o);if(e.q=f,e.p.compareTo(e.q)<0){var u=e.p;e.p=e.q,e.q=u}if(e.p.subtract(M.ONE).gcd(e.e).compareTo(M.ONE)!==0){e.p=null,i();return}if(e.q.subtract(M.ONE).gcd(e.e).compareTo(M.ONE)!==0){e.q=null,n(e.qBits,s);return}if(e.p1=e.p.subtract(M.ONE),e.q1=e.q.subtract(M.ONE),e.phi=e.p1.multiply(e.q1),e.phi.gcd(e.e).compareTo(M.ONE)!==0){e.p=e.q=null,i();return}if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits){e.q=null,n(e.qBits,s);return}var c=e.e.modInverse(e.phi);e.keys={privateKey:k.rsa.setPrivateKey(e.n,e.e,c,e.p,e.q,c.mod(e.p1),c.mod(e.q1),e.q.modInverse(e.p)),publicKey:k.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}}function le(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=_.util.hexToBytes(t);return r.length>1&&(r.charCodeAt(0)===0&&!(r.charCodeAt(1)&128)||r.charCodeAt(0)===255&&(r.charCodeAt(1)&128)===128)?r.substr(1):r}function Gi(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function qt(e){return _.util.isNodejs&&typeof mt[e]=="function"}function zt(e){return typeof ie.globalScope<"u"&&typeof ie.globalScope.crypto=="object"&&typeof ie.globalScope.crypto.subtle=="object"&&typeof ie.globalScope.crypto.subtle[e]=="function"}function Qt(e){return typeof ie.globalScope<"u"&&typeof ie.globalScope.msCrypto=="object"&&typeof ie.globalScope.msCrypto.subtle=="object"&&typeof ie.globalScope.msCrypto.subtle[e]=="function"}function Ht(e){for(var t=_.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),a=0;a<t.length;++a)r[a]=t.charCodeAt(a);return r}var w=K;typeof Wt>"u"&&(Wt=w.jsbn.BigInteger);var Wt,m=w.asn1,V=w.pki=w.pki||{};V.pbe=w.pbe=w.pbe||{};var be=V.oids,qi={name:"EncryptedPrivateKeyInfo",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:m.Class.UNIVERSAL,type:m.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},zi={name:"PBES2Algorithms",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:m.Class.UNIVERSAL,type:m.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:m.Class.UNIVERSAL,type:m.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:m.Class.UNIVERSAL,type:m.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},Qi={name:"pkcs-12PbeParams",tagClass:m.Class.UNIVERSAL,type:m.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:m.Class.UNIVERSAL,type:m.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:m.Class.UNIVERSAL,type:m.Type.INTEGER,constructed:!1,capture:"iterations"}]};V.encryptPrivateKeyInfo=function(e,t,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var a=w.random.getBytesSync(r.saltSize),i=r.count,n=m.integerToDer(i),s,o,f;if(r.algorithm.indexOf("aes")===0||r.algorithm==="des"){var u,c,h;switch(r.algorithm){case"aes128":s=16,u=16,c=be["aes128-CBC"],h=w.aes.createEncryptionCipher;break;case"aes192":s=24,u=16,c=be["aes192-CBC"],h=w.aes.createEncryptionCipher;break;case"aes256":s=32,u=16,c=be["aes256-CBC"],h=w.aes.createEncryptionCipher;break;case"des":s=8,u=8,c=be.desCBC,h=w.des.createEncryptionCipher;break;default:var d=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw d.algorithm=r.algorithm,d}var C="hmacWith"+r.prfAlgorithm.toUpperCase(),y=yr(C),E=w.pkcs5.pbkdf2(t,a,i,s,y),x=w.random.getBytesSync(u),S=h(E);S.start(x),S.update(m.toDer(e)),S.finish(),f=S.output.getBytes();var N=Hi(a,n,s,C);o=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer(be.pkcs5PBES2).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer(be.pkcs5PBKDF2).getBytes()),N]),m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer(c).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,x)])])])}else if(r.algorithm==="3des"){s=24;var B=new w.util.ByteBuffer(a),E=V.pbe.generatePkcs12Key(t,B,1,i,s),x=V.pbe.generatePkcs12Key(t,B,2,i,s),S=w.des.createEncryptionCipher(E);S.start(x),S.update(m.toDer(e)),S.finish(),f=S.output.getBytes(),o=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer(be["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,a),m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,n.getBytes())])])}else{var d=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw d.algorithm=r.algorithm,d}var P=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[o,m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,f)]);return P};V.decryptPrivateKeyInfo=function(e,t){var r=null,a={},i=[];if(!m.validate(e,qi,a,i)){var n=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw n.errors=i,n}var s=m.derToOid(a.encryptionOid),o=V.pbe.getCipher(s,a.encryptionParams,t),f=w.util.createBuffer(a.encryptedData);return o.update(f),o.finish()&&(r=m.fromDer(o.output)),r};V.encryptedPrivateKeyToPem=function(e,t){var r={type:"ENCRYPTED PRIVATE KEY",body:m.toDer(e).getBytes()};return w.pem.encode(r,{maxline:t})};V.encryptedPrivateKeyFromPem=function(e){var t=w.pem.decode(e)[0];if(t.type!=="ENCRYPTED PRIVATE KEY"){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return m.fromDer(t.body)};V.encryptRsaPrivateKey=function(e,t,r){if(r=r||{},!r.legacy){var a=V.wrapRsaPrivateKey(V.privateKeyToAsn1(e));return a=V.encryptPrivateKeyInfo(a,t,r),V.encryptedPrivateKeyToPem(a)}var i,n,s,o;switch(r.algorithm){case"aes128":i="AES-128-CBC",s=16,n=w.random.getBytesSync(16),o=w.aes.createEncryptionCipher;break;case"aes192":i="AES-192-CBC",s=24,n=w.random.getBytesSync(16),o=w.aes.createEncryptionCipher;break;case"aes256":i="AES-256-CBC",s=32,n=w.random.getBytesSync(16),o=w.aes.createEncryptionCipher;break;case"3des":i="DES-EDE3-CBC",s=24,n=w.random.getBytesSync(8),o=w.des.createEncryptionCipher;break;case"des":i="DES-CBC",s=8,n=w.random.getBytesSync(8),o=w.des.createEncryptionCipher;break;default:var f=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw f.algorithm=r.algorithm,f}var u=w.pbe.opensslDeriveBytes(t,n.substr(0,8),s),c=o(u);c.start(n),c.update(m.toDer(V.privateKeyToAsn1(e))),c.finish();var h={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:i,parameters:w.util.bytesToHex(n).toUpperCase()},body:c.output.getBytes()};return w.pem.encode(h)};V.decryptRsaPrivateKey=function(e,t){var r=null,a=w.pem.decode(e)[0];if(a.type!=="ENCRYPTED PRIVATE KEY"&&a.type!=="PRIVATE KEY"&&a.type!=="RSA PRIVATE KEY"){var i=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw i.headerType=i,i}if(a.procType&&a.procType.type==="ENCRYPTED"){var n,s;switch(a.dekInfo.algorithm){case"DES-CBC":n=8,s=w.des.createDecryptionCipher;break;case"DES-EDE3-CBC":n=24,s=w.des.createDecryptionCipher;break;case"AES-128-CBC":n=16,s=w.aes.createDecryptionCipher;break;case"AES-192-CBC":n=24,s=w.aes.createDecryptionCipher;break;case"AES-256-CBC":n=32,s=w.aes.createDecryptionCipher;break;case"RC2-40-CBC":n=5,s=function(h){return w.rc2.createDecryptionCipher(h,40)};break;case"RC2-64-CBC":n=8,s=function(h){return w.rc2.createDecryptionCipher(h,64)};break;case"RC2-128-CBC":n=16,s=function(h){return w.rc2.createDecryptionCipher(h,128)};break;default:var i=new Error('Could not decrypt private key; unsupported encryption algorithm "'+a.dekInfo.algorithm+'".');throw i.algorithm=a.dekInfo.algorithm,i}var o=w.util.hexToBytes(a.dekInfo.parameters),f=w.pbe.opensslDeriveBytes(t,o.substr(0,8),n),u=s(f);if(u.start(o),u.update(w.util.createBuffer(a.body)),u.finish())r=u.output.getBytes();else return r}else r=a.body;return a.type==="ENCRYPTED PRIVATE KEY"?r=V.decryptPrivateKeyInfo(m.fromDer(r),t):r=m.fromDer(r),r!==null&&(r=V.privateKeyFromAsn1(r)),r};V.pbe.generatePkcs12Key=function(e,t,r,a,i,n){var s,o;if(typeof n>"u"||n===null){if(!("sha1"in w.md))throw new Error('"sha1" hash algorithm unavailable.');n=w.md.sha1.create()}var f=n.digestLength,u=n.blockLength,c=new w.util.ByteBuffer,h=new w.util.ByteBuffer;if(e!=null){for(o=0;o<e.length;o++)h.putInt16(e.charCodeAt(o));h.putInt16(0)}var d=h.length(),C=t.length(),y=new w.util.ByteBuffer;y.fillWithByte(r,u);var E=u*Math.ceil(C/u),x=new w.util.ByteBuffer;for(o=0;o<E;o++)x.putByte(t.at(o%C));var S=u*Math.ceil(d/u),N=new w.util.ByteBuffer;for(o=0;o<S;o++)N.putByte(h.at(o%d));var B=x;B.putBuffer(N);for(var P=Math.ceil(i/f),L=1;L<=P;L++){var U=new w.util.ByteBuffer;U.putBytes(y.bytes()),U.putBytes(B.bytes());for(var j=0;j<a;j++)n.start(),n.update(U.getBytes()),U=n.digest();var se=new w.util.ByteBuffer;for(o=0;o<u;o++)se.putByte(U.at(o%f));var fe=Math.ceil(C/u)+Math.ceil(d/u),ve=new w.util.ByteBuffer;for(s=0;s<fe;s++){var ge=new w.util.ByteBuffer(B.getBytes(u)),De=511;for(o=se.length()-1;o>=0;o--)De=De>>8,De+=se.at(o)+ge.at(o),ge.setAt(o,De&255);ve.putBuffer(ge)}B=ve,c.putBuffer(U)}return c.truncate(c.length()-i),c};V.pbe.getCipher=function(e,t,r){switch(e){case V.oids.pkcs5PBES2:return V.pbe.getCipherForPBES2(e,t,r);case V.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case V.oids["pbewithSHAAnd40BitRC2-CBC"]:return V.pbe.getCipherForPKCS12PBE(e,t,r);default:var a=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw a.oid=e,a.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],a}};V.pbe.getCipherForPBES2=function(e,t,r){var a={},i=[];if(!m.validate(t,zi,a,i)){var n=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw n.errors=i,n}if(e=m.derToOid(a.kdfOid),e!==V.oids.pkcs5PBKDF2){var n=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw n.oid=e,n.supportedOids=["pkcs5PBKDF2"],n}if(e=m.derToOid(a.encOid),e!==V.oids["aes128-CBC"]&&e!==V.oids["aes192-CBC"]&&e!==V.oids["aes256-CBC"]&&e!==V.oids["des-EDE3-CBC"]&&e!==V.oids.desCBC){var n=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw n.oid=e,n.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],n}var s=a.kdfSalt,o=w.util.createBuffer(a.kdfIterationCount);o=o.getInt(o.length()<<3);var f,u;switch(V.oids[e]){case"aes128-CBC":f=16,u=w.aes.createDecryptionCipher;break;case"aes192-CBC":f=24,u=w.aes.createDecryptionCipher;break;case"aes256-CBC":f=32,u=w.aes.createDecryptionCipher;break;case"des-EDE3-CBC":f=24,u=w.des.createDecryptionCipher;break;case"desCBC":f=8,u=w.des.createDecryptionCipher;break}var c=dr(a.prfOid),h=w.pkcs5.pbkdf2(r,s,o,f,c),d=a.encIv,C=u(h);return C.start(d),C};V.pbe.getCipherForPKCS12PBE=function(e,t,r){var a={},i=[];if(!m.validate(t,Qi,a,i)){var n=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw n.errors=i,n}var s=w.util.createBuffer(a.salt),o=w.util.createBuffer(a.iterations);o=o.getInt(o.length()<<3);var f,u,c;switch(e){case V.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:f=24,u=8,c=w.des.startDecrypting;break;case V.oids["pbewithSHAAnd40BitRC2-CBC"]:f=5,u=8,c=function(E,x){var S=w.rc2.createDecryptionCipher(E,40);return S.start(x,null),S};break;default:var n=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw n.oid=e,n}var h=dr(a.prfOid),d=V.pbe.generatePkcs12Key(r,s,1,o,f,h);h.start();var C=V.pbe.generatePkcs12Key(r,s,2,o,u,h);return c(d,C)};V.pbe.opensslDeriveBytes=function(e,t,r,a){if(typeof a>"u"||a===null){if(!("md5"in w.md))throw new Error('"md5" hash algorithm unavailable.');a=w.md.md5.create()}t===null&&(t="");for(var i=[Xt(a,e+t)],n=16,s=1;n<r;++s,n+=16)i.push(Xt(a,i[s-1]+e+t));return i.join("").substr(0,r)};function Xt(e,t){return e.start().update(t).digest().getBytes()}function dr(e){var t;if(!e)t="hmacWithSHA1";else if(t=V.oids[m.derToOid(e)],!t){var r=new Error("Unsupported PRF OID.");throw r.oid=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}return yr(t)}function yr(e){var t=w.md;switch(e){case"hmacWithSHA224":t=w.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=e,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function Hi(e,t,r,a){var i=m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OCTETSTRING,!1,e),m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,t.getBytes())]);return a!=="hmacWithSHA1"&&i.value.push(m.create(m.Class.UNIVERSAL,m.Type.INTEGER,!1,w.util.hexToBytes(r.toString(16))),m.create(m.Class.UNIVERSAL,m.Type.SEQUENCE,!0,[m.create(m.Class.UNIVERSAL,m.Type.OID,!1,m.oidToDer(V.oids[a]).getBytes()),m.create(m.Class.UNIVERSAL,m.Type.NULL,!1,"")])),i}var Pe=K,R=Pe.asn1,Me=Pe.pkcs7asn1=Pe.pkcs7asn1||{};Pe.pkcs7=Pe.pkcs7||{};Pe.pkcs7.asn1=Me;var vr={name:"ContentInfo",tagClass:R.Class.UNIVERSAL,type:R.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:R.Class.UNIVERSAL,type:R.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:R.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};Me.contentInfoValidator=vr;var gr={name:"EncryptedContentInfo",tagClass:R.Class.UNIVERSAL,type:R.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:R.Class.UNIVERSAL,type:R.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:R.Class.UNIVERSAL,type:R.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:R.Class.UNIVERSAL,type:R.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:R.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:R.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};Me.envelopedDataValidator={name:"EnvelopedData",tagClass:R.Class.UNIVERSAL,type:R.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:R.Class.UNIVERSAL,type:R.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:R.Class.UNIVERSAL,type:R.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(gr)};Me.encryptedDataValidator={name:"EncryptedData",tagClass:R.Class.UNIVERSAL,type:R.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:R.Class.UNIVERSAL,type:R.Type.INTEGER,constructed:!1,capture:"version"}].concat(gr)};var Wi={name:"SignerInfo",tagClass:R.Class.UNIVERSAL,type:R.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:R.Class.UNIVERSAL,type:R.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:R.Class.UNIVERSAL,type:R.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:R.Class.UNIVERSAL,type:R.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:R.Class.UNIVERSAL,type:R.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:R.Class.UNIVERSAL,type:R.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:R.Class.UNIVERSAL,type:R.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:R.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:R.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:R.Class.UNIVERSAL,type:R.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:R.Class.UNIVERSAL,type:R.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:R.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};Me.signedDataValidator={name:"SignedData",tagClass:R.Class.UNIVERSAL,type:R.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:R.Class.UNIVERSAL,type:R.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:R.Class.UNIVERSAL,type:R.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},vr,{name:"SignedData.Certificates",tagClass:R.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:R.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:R.Class.UNIVERSAL,type:R.Type.SET,capture:"signerInfos",optional:!0,value:[Wi]}]};Me.recipientInfoValidator={name:"RecipientInfo",tagClass:R.Class.UNIVERSAL,type:R.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:R.Class.UNIVERSAL,type:R.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:R.Class.UNIVERSAL,type:R.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:R.Class.UNIVERSAL,type:R.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:R.Class.UNIVERSAL,type:R.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:R.Class.UNIVERSAL,type:R.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:R.Class.UNIVERSAL,type:R.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:R.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:R.Class.UNIVERSAL,type:R.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]};var we=K;we.mgf=we.mgf||{};var Xi=we.mgf.mgf1=we.mgf1=we.mgf1||{};Xi.create=function(e){var t={generate:function(r,a){for(var i=new we.util.ByteBuffer,n=Math.ceil(a/e.digestLength),s=0;s<n;s++){var o=new we.util.ByteBuffer;o.putInt32(s),e.start(),e.update(r+o.getBytes()),i.putBuffer(e.digest())}return i.truncate(i.length()-a),i.getBytes()}};return t};var tt=K;tt.mgf=tt.mgf||{};tt.mgf.mgf1=tt.mgf1;var Ne=K,Yi=Ne.pss=Ne.pss||{};Yi.create=function(e){arguments.length===3&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t=e.md,r=e.mgf,a=t.digestLength,i=e.salt||null;typeof i=="string"&&(i=Ne.util.createBuffer(i));var n;if("saltLength"in e)n=e.saltLength;else if(i!==null)n=i.length();else throw new Error("Salt length not specified or specific salt not given.");if(i!==null&&i.length()!==n)throw new Error("Given salt length does not match length of given salt.");var s=e.prng||Ne.random,o={};return o.encode=function(f,u){var c,h=u-1,d=Math.ceil(h/8),C=f.digest().getBytes();if(d<a+n+2)throw new Error("Message is too long to encrypt.");var y;i===null?y=s.getBytesSync(n):y=i.bytes();var E=new Ne.util.ByteBuffer;E.fillWithByte(0,8),E.putBytes(C),E.putBytes(y),t.start(),t.update(E.getBytes());var x=t.digest().getBytes(),S=new Ne.util.ByteBuffer;S.fillWithByte(0,d-n-a-2),S.putByte(1),S.putBytes(y);var N=S.getBytes(),B=d-a-1,P=r.generate(x,B),L="";for(c=0;c<B;c++)L+=String.fromCharCode(N.charCodeAt(c)^P.charCodeAt(c));var U=65280>>8*d-h&255;return L=String.fromCharCode(L.charCodeAt(0)&~U)+L.substr(1),L+x+String.fromCharCode(188)},o.verify=function(f,u,c){var h,d=c-1,C=Math.ceil(d/8);if(u=u.substr(-C),C<a+n+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(u.charCodeAt(C-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var y=C-a-1,E=u.substr(0,y),x=u.substr(y,a),S=65280>>8*C-d&255;if(E.charCodeAt(0)&S)throw new Error("Bits beyond keysize not zero as expected.");var N=r.generate(x,y),B="";for(h=0;h<y;h++)B+=String.fromCharCode(E.charCodeAt(h)^N.charCodeAt(h));B=String.fromCharCode(B.charCodeAt(0)&~S)+B.substr(1);var P=C-a-n-2;for(h=0;h<P;h++)if(B.charCodeAt(h)!==0)throw new Error("Leftmost octets not zero as expected");if(B.charCodeAt(P)!==1)throw new Error("Inconsistent PSS signature, 0x01 marker not found");var L=B.substr(-n),U=new Ne.util.ByteBuffer;U.fillWithByte(0,8),U.putBytes(f),U.putBytes(L),t.start(),t.update(U.getBytes());var j=t.digest().getBytes();return x===j},o};var D=K,l=D.asn1,A=D.pki=D.pki||{},G=A.oids,Y={};Y.CN=G.commonName;Y.commonName="CN";Y.C=G.countryName;Y.countryName="C";Y.L=G.localityName;Y.localityName="L";Y.ST=G.stateOrProvinceName;Y.stateOrProvinceName="ST";Y.O=G.organizationName;Y.organizationName="O";Y.OU=G.organizationalUnitName;Y.organizationalUnitName="OU";Y.E=G.emailAddress;Y.emailAddress="E";var Cr=D.pki.rsa.publicKeyValidator,Zi={name:"Certificate",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:l.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:l.Class.UNIVERSAL,type:l.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:l.Class.UNIVERSAL,type:l.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:l.Class.UNIVERSAL,type:l.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:l.Class.UNIVERSAL,type:l.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},Cr,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:l.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:l.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:l.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:l.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},$i={name:"rsapss",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL,type:l.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:l.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL,type:l.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:l.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:l.Class.UNIVERSAL,type:l.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:l.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:l.Class.UNIVERSAL,type:l.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},ji={name:"CertificationRequestInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},Cr,{name:"CertificationRequestInfo.attributes",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:l.Class.UNIVERSAL,type:l.Type.SET,constructed:!0}]}]}]},Ji={name:"CertificationRequest",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[ji,{name:"CertificationRequest.signatureAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:l.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};A.RDNAttributesAsArray=function(e,t){for(var r=[],a,i,n,s=0;s<e.value.length;++s){a=e.value[s];for(var o=0;o<a.value.length;++o)n={},i=a.value[o],n.type=l.derToOid(i.value[0].value),n.value=i.value[1].value,n.valueTagClass=i.value[1].type,n.type in G&&(n.name=G[n.type],n.name in Y&&(n.shortName=Y[n.name])),t&&(t.update(n.type),t.update(n.value)),r.push(n)}return r};A.CRIAttributesAsArray=function(e){for(var t=[],r=0;r<e.length;++r)for(var a=e[r],i=l.derToOid(a.value[0].value),n=a.value[1].value,s=0;s<n.length;++s){var o={};if(o.type=i,o.value=n[s].value,o.valueTagClass=n[s].type,o.type in G&&(o.name=G[o.type],o.name in Y&&(o.shortName=Y[o.name])),o.type===G.extensionRequest){o.extensions=[];for(var f=0;f<o.value.length;++f)o.extensions.push(A.certificateExtensionFromAsn1(o.value[f]))}t.push(o)}return t};function Ie(e,t){typeof t=="string"&&(t={shortName:t});for(var r=null,a,i=0;r===null&&i<e.attributes.length;++i)a=e.attributes[i],(t.type&&t.type===a.type||t.name&&t.name===a.name||t.shortName&&t.shortName===a.shortName)&&(r=a);return r}var rt=function(e,t,r){var a={};if(e!==G["RSASSA-PSS"])return a;r&&(a={hash:{algorithmOid:G.sha1},mgf:{algorithmOid:G.mgf1,hash:{algorithmOid:G.sha1}},saltLength:20});var i={},n=[];if(!l.validate(t,$i,i,n)){var s=new Error("Cannot read RSASSA-PSS parameter block.");throw s.errors=n,s}return i.hashOid!==void 0&&(a.hash=a.hash||{},a.hash.algorithmOid=l.derToOid(i.hashOid)),i.maskGenOid!==void 0&&(a.mgf=a.mgf||{},a.mgf.algorithmOid=l.derToOid(i.maskGenOid),a.mgf.hash=a.mgf.hash||{},a.mgf.hash.algorithmOid=l.derToOid(i.maskGenHashOid)),i.saltLength!==void 0&&(a.saltLength=i.saltLength.charCodeAt(0)),a},lt=function(e){switch(G[e.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return D.md.sha1.create();case"md5WithRSAEncryption":return D.md.md5.create();case"sha256WithRSAEncryption":return D.md.sha256.create();case"sha384WithRSAEncryption":return D.md.sha384.create();case"sha512WithRSAEncryption":return D.md.sha512.create();case"RSASSA-PSS":return D.md.sha256.create();default:var t=new Error("Could not compute "+e.type+" digest. Unknown signature OID.");throw t.signatureOid=e.signatureOid,t}},mr=function(e){var t=e.certificate,r;switch(t.signatureOid){case G.sha1WithRSAEncryption:case G.sha1WithRSASignature:break;case G["RSASSA-PSS"]:var a,i;if(a=G[t.signatureParameters.mgf.hash.algorithmOid],a===void 0||D.md[a]===void 0){var n=new Error("Unsupported MGF hash function.");throw n.oid=t.signatureParameters.mgf.hash.algorithmOid,n.name=a,n}if(i=G[t.signatureParameters.mgf.algorithmOid],i===void 0||D.mgf[i]===void 0){var n=new Error("Unsupported MGF function.");throw n.oid=t.signatureParameters.mgf.algorithmOid,n.name=i,n}if(i=D.mgf[i].create(D.md[a].create()),a=G[t.signatureParameters.hash.algorithmOid],a===void 0||D.md[a]===void 0){var n=new Error("Unsupported RSASSA-PSS hash function.");throw n.oid=t.signatureParameters.hash.algorithmOid,n.name=a,n}r=D.pss.create(D.md[a].create(),i,t.signatureParameters.saltLength);break}return t.publicKey.verify(e.md.digest().getBytes(),e.signature,r)};A.certificateFromPem=function(e,t,r){var a=D.pem.decode(e)[0];if(a.type!=="CERTIFICATE"&&a.type!=="X509 CERTIFICATE"&&a.type!=="TRUSTED CERTIFICATE"){var i=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw i.headerType=a.type,i}if(a.procType&&a.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var n=l.fromDer(a.body,r);return A.certificateFromAsn1(n,t)};A.certificateToPem=function(e,t){var r={type:"CERTIFICATE",body:l.toDer(A.certificateToAsn1(e)).getBytes()};return D.pem.encode(r,{maxline:t})};A.publicKeyFromPem=function(e){var t=D.pem.decode(e)[0];if(t.type!=="PUBLIC KEY"&&t.type!=="RSA PUBLIC KEY"){var r=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw r.headerType=t.type,r}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var a=l.fromDer(t.body);return A.publicKeyFromAsn1(a)};A.publicKeyToPem=function(e,t){var r={type:"PUBLIC KEY",body:l.toDer(A.publicKeyToAsn1(e)).getBytes()};return D.pem.encode(r,{maxline:t})};A.publicKeyToRSAPublicKeyPem=function(e,t){var r={type:"RSA PUBLIC KEY",body:l.toDer(A.publicKeyToRSAPublicKey(e)).getBytes()};return D.pem.encode(r,{maxline:t})};A.getPublicKeyFingerprint=function(e,t){t=t||{};var r=t.md||D.md.sha1.create(),a=t.type||"RSAPublicKey",i;switch(a){case"RSAPublicKey":i=l.toDer(A.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":i=l.toDer(A.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}r.start(),r.update(i);var n=r.digest();if(t.encoding==="hex"){var s=n.toHex();return t.delimiter?s.match(/.{2}/g).join(t.delimiter):s}else{if(t.encoding==="binary")return n.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".')}return n};A.certificationRequestFromPem=function(e,t,r){var a=D.pem.decode(e)[0];if(a.type!=="CERTIFICATE REQUEST"){var i=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw i.headerType=a.type,i}if(a.procType&&a.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var n=l.fromDer(a.body,r);return A.certificationRequestFromAsn1(n,t)};A.certificationRequestToPem=function(e,t){var r={type:"CERTIFICATE REQUEST",body:l.toDer(A.certificationRequestToAsn1(e)).getBytes()};return D.pem.encode(r,{maxline:t})};A.createCertificate=function(){var e={};return e.version=2,e.serialNumber="00",e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return Ie(e.issuer,t)},e.issuer.addField=function(t){ne([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return Ie(e.subject,t)},e.subject.addField=function(t){ne([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,r){ne(t),e.subject.attributes=t,delete e.subject.uniqueId,r&&(e.subject.uniqueId=r),e.subject.hash=null},e.setIssuer=function(t,r){ne(t),e.issuer.attributes=t,delete e.issuer.uniqueId,r&&(e.issuer.uniqueId=r),e.issuer.hash=null},e.setExtensions=function(t){for(var r=0;r<t.length;++r)Er(t[r],{cert:e});e.extensions=t},e.getExtension=function(t){typeof t=="string"&&(t={name:t});for(var r=null,a,i=0;r===null&&i<e.extensions.length;++i)a=e.extensions[i],(t.id&&a.id===t.id||t.name&&a.name===t.name)&&(r=a);return r},e.sign=function(t,r){e.md=r||D.md.sha1.create();var a=G[e.md.algorithm+"WithRSAEncryption"];if(!a){var i=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw i.algorithm=e.md.algorithm,i}e.signatureOid=e.siginfo.algorithmOid=a,e.tbsCertificate=A.getTBSCertificate(e);var n=l.toDer(e.tbsCertificate);e.md.update(n.getBytes()),e.signature=t.sign(e.md)},e.verify=function(t){var r=!1;if(!e.issued(t)){var a=t.issuer,i=e.subject,n=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw n.expectedIssuer=i.attributes,n.actualIssuer=a.attributes,n}var s=t.md;if(s===null){s=lt({signatureOid:t.signatureOid,type:"certificate"});var o=t.tbsCertificate||A.getTBSCertificate(t),f=l.toDer(o);s.update(f.getBytes())}return s!==null&&(r=mr({certificate:e,md:s,signature:t.signature})),r},e.isIssuer=function(t){var r=!1,a=e.issuer,i=t.subject;if(a.hash&&i.hash)r=a.hash===i.hash;else if(a.attributes.length===i.attributes.length){r=!0;for(var n,s,o=0;r&&o<a.attributes.length;++o)n=a.attributes[o],s=i.attributes[o],(n.type!==s.type||n.value!==s.value)&&(r=!1)}return r},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return A.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=G.subjectKeyIdentifier,r=0;r<e.extensions.length;++r){var a=e.extensions[r];if(a.id===t){var i=e.generateSubjectKeyIdentifier().getBytes();return D.util.hexToBytes(a.subjectKeyIdentifier)===i}}return!1},e};A.certificateFromAsn1=function(e,t){var r={},a=[];if(!l.validate(e,Zi,r,a)){var i=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw i.errors=a,i}var n=l.derToOid(r.publicKeyOid);if(n!==A.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var s=A.createCertificate();s.version=r.certVersion?r.certVersion.charCodeAt(0):0;var o=D.util.createBuffer(r.certSerialNumber);s.serialNumber=o.toHex(),s.signatureOid=D.asn1.derToOid(r.certSignatureOid),s.signatureParameters=rt(s.signatureOid,r.certSignatureParams,!0),s.siginfo.algorithmOid=D.asn1.derToOid(r.certinfoSignatureOid),s.siginfo.parameters=rt(s.siginfo.algorithmOid,r.certinfoSignatureParams,!1),s.signature=r.certSignature;var f=[];if(r.certValidity1UTCTime!==void 0&&f.push(l.utcTimeToDate(r.certValidity1UTCTime)),r.certValidity2GeneralizedTime!==void 0&&f.push(l.generalizedTimeToDate(r.certValidity2GeneralizedTime)),r.certValidity3UTCTime!==void 0&&f.push(l.utcTimeToDate(r.certValidity3UTCTime)),r.certValidity4GeneralizedTime!==void 0&&f.push(l.generalizedTimeToDate(r.certValidity4GeneralizedTime)),f.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(f.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=f[0],s.validity.notAfter=f[1],s.tbsCertificate=r.tbsCertificate,t){s.md=lt({signatureOid:s.signatureOid,type:"certificate"});var u=l.toDer(s.tbsCertificate);s.md.update(u.getBytes())}var c=D.md.sha1.create(),h=l.toDer(r.certIssuer);c.update(h.getBytes()),s.issuer.getField=function(y){return Ie(s.issuer,y)},s.issuer.addField=function(y){ne([y]),s.issuer.attributes.push(y)},s.issuer.attributes=A.RDNAttributesAsArray(r.certIssuer),r.certIssuerUniqueId&&(s.issuer.uniqueId=r.certIssuerUniqueId),s.issuer.hash=c.digest().toHex();var d=D.md.sha1.create(),C=l.toDer(r.certSubject);return d.update(C.getBytes()),s.subject.getField=function(y){return Ie(s.subject,y)},s.subject.addField=function(y){ne([y]),s.subject.attributes.push(y)},s.subject.attributes=A.RDNAttributesAsArray(r.certSubject),r.certSubjectUniqueId&&(s.subject.uniqueId=r.certSubjectUniqueId),s.subject.hash=d.digest().toHex(),r.certExtensions?s.extensions=A.certificateExtensionsFromAsn1(r.certExtensions):s.extensions=[],s.publicKey=A.publicKeyFromAsn1(r.subjectPublicKeyInfo),s};A.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r<e.value.length;++r)for(var a=e.value[r],i=0;i<a.value.length;++i)t.push(A.certificateExtensionFromAsn1(a.value[i]));return t};A.certificateExtensionFromAsn1=function(e){var t={};if(t.id=l.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===l.Type.BOOLEAN?(t.critical=e.value[1].value.charCodeAt(0)!==0,t.value=e.value[2].value):t.value=e.value[1].value,t.id in G){if(t.name=G[t.id],t.name==="keyUsage"){var r=l.fromDer(t.value),a=0,i=0;r.value.length>1&&(a=r.value.charCodeAt(1),i=r.value.length>2?r.value.charCodeAt(2):0),t.digitalSignature=(a&128)===128,t.nonRepudiation=(a&64)===64,t.keyEncipherment=(a&32)===32,t.dataEncipherment=(a&16)===16,t.keyAgreement=(a&8)===8,t.keyCertSign=(a&4)===4,t.cRLSign=(a&2)===2,t.encipherOnly=(a&1)===1,t.decipherOnly=(i&128)===128}else if(t.name==="basicConstraints"){var r=l.fromDer(t.value);r.value.length>0&&r.value[0].type===l.Type.BOOLEAN?t.cA=r.value[0].value.charCodeAt(0)!==0:t.cA=!1;var n=null;r.value.length>0&&r.value[0].type===l.Type.INTEGER?n=r.value[0].value:r.value.length>1&&(n=r.value[1].value),n!==null&&(t.pathLenConstraint=l.derToInteger(n))}else if(t.name==="extKeyUsage")for(var r=l.fromDer(t.value),s=0;s<r.value.length;++s){var o=l.derToOid(r.value[s].value);o in G?t[G[o]]=!0:t[o]=!0}else if(t.name==="nsCertType"){var r=l.fromDer(t.value),a=0;r.value.length>1&&(a=r.value.charCodeAt(1)),t.client=(a&128)===128,t.server=(a&64)===64,t.email=(a&32)===32,t.objsign=(a&16)===16,t.reserved=(a&8)===8,t.sslCA=(a&4)===4,t.emailCA=(a&2)===2,t.objCA=(a&1)===1}else if(t.name==="subjectAltName"||t.name==="issuerAltName"){t.altNames=[];for(var f,r=l.fromDer(t.value),u=0;u<r.value.length;++u){f=r.value[u];var c={type:f.type,value:f.value};switch(t.altNames.push(c),f.type){case 1:case 2:case 6:break;case 7:c.ip=D.util.bytesToIP(f.value);break;case 8:c.oid=l.derToOid(f.value);break}}}else if(t.name==="subjectKeyIdentifier"){var r=l.fromDer(t.value);t.subjectKeyIdentifier=D.util.bytesToHex(r.value)}}return t};A.certificationRequestFromAsn1=function(e,t){var r={},a=[];if(!l.validate(e,Ji,r,a)){var i=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw i.errors=a,i}var n=l.derToOid(r.publicKeyOid);if(n!==A.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var s=A.createCertificationRequest();if(s.version=r.csrVersion?r.csrVersion.charCodeAt(0):0,s.signatureOid=D.asn1.derToOid(r.csrSignatureOid),s.signatureParameters=rt(s.signatureOid,r.csrSignatureParams,!0),s.siginfo.algorithmOid=D.asn1.derToOid(r.csrSignatureOid),s.siginfo.parameters=rt(s.siginfo.algorithmOid,r.csrSignatureParams,!1),s.signature=r.csrSignature,s.certificationRequestInfo=r.certificationRequestInfo,t){s.md=lt({signatureOid:s.signatureOid,type:"certification request"});var o=l.toDer(s.certificationRequestInfo);s.md.update(o.getBytes())}var f=D.md.sha1.create();return s.subject.getField=function(u){return Ie(s.subject,u)},s.subject.addField=function(u){ne([u]),s.subject.attributes.push(u)},s.subject.attributes=A.RDNAttributesAsArray(r.certificationRequestInfoSubject,f),s.subject.hash=f.digest().toHex(),s.publicKey=A.publicKeyFromAsn1(r.subjectPublicKeyInfo),s.getAttribute=function(u){return Ie(s,u)},s.addAttribute=function(u){ne([u]),s.attributes.push(u)},s.attributes=A.CRIAttributesAsArray(r.certificationRequestInfoAttributes||[]),s};A.createCertificationRequest=function(){var e={};return e.version=0,e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return Ie(e.subject,t)},e.subject.addField=function(t){ne([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return Ie(e,t)},e.addAttribute=function(t){ne([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){ne(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){ne(t),e.attributes=t},e.sign=function(t,r){e.md=r||D.md.sha1.create();var a=G[e.md.algorithm+"WithRSAEncryption"];if(!a){var i=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw i.algorithm=e.md.algorithm,i}e.signatureOid=e.siginfo.algorithmOid=a,e.certificationRequestInfo=A.getCertificationRequestInfo(e);var n=l.toDer(e.certificationRequestInfo);e.md.update(n.getBytes()),e.signature=t.sign(e.md)},e.verify=function(){var t=!1,r=e.md;if(r===null){r=lt({signatureOid:e.signatureOid,type:"certification request"});var a=e.certificationRequestInfo||A.getCertificationRequestInfo(e),i=l.toDer(a);r.update(i.getBytes())}return r!==null&&(t=mr({certificate:e,md:r,signature:e.signature})),t},e};function ke(e){for(var t=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),r,a,i=e.attributes,n=0;n<i.length;++n){r=i[n];var s=r.value,o=l.Type.PRINTABLESTRING;"valueTagClass"in r&&(o=r.valueTagClass,o===l.Type.UTF8&&(s=D.util.encodeUtf8(s))),a=l.create(l.Class.UNIVERSAL,l.Type.SET,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(r.type).getBytes()),l.create(l.Class.UNIVERSAL,o,!1,s)])]),t.value.push(a)}return t}function ne(e){for(var t,r=0;r<e.length;++r){if(t=e[r],typeof t.name>"u"&&(t.type&&t.type in A.oids?t.name=A.oids[t.type]:t.shortName&&t.shortName in Y&&(t.name=A.oids[Y[t.shortName]])),typeof t.type>"u")if(t.name&&t.name in A.oids)t.type=A.oids[t.name];else{var a=new Error("Attribute type not specified.");throw a.attribute=t,a}if(typeof t.shortName>"u"&&t.name&&t.name in Y&&(t.shortName=Y[t.name]),t.type===G.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=l.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var i=0;i<t.extensions.length;++i)t.value.push(A.certificateExtensionToAsn1(Er(t.extensions[i])))}if(typeof t.value>"u"){var a=new Error("Attribute value not specified.");throw a.attribute=t,a}}}function Er(e,t){if(t=t||{},typeof e.name>"u"&&e.id&&e.id in A.oids&&(e.name=A.oids[e.id]),typeof e.id>"u")if(e.name&&e.name in A.oids)e.id=A.oids[e.name];else{var r=new Error("Extension ID not specified.");throw r.extension=e,r}if(typeof e.value<"u")return e;if(e.name==="keyUsage"){var a=0,i=0,n=0;e.digitalSignature&&(i|=128,a=7),e.nonRepudiation&&(i|=64,a=6),e.keyEncipherment&&(i|=32,a=5),e.dataEncipherment&&(i|=16,a=4),e.keyAgreement&&(i|=8,a=3),e.keyCertSign&&(i|=4,a=2),e.cRLSign&&(i|=2,a=1),e.encipherOnly&&(i|=1,a=0),e.decipherOnly&&(n|=128,a=7);var s=String.fromCharCode(a);n!==0?s+=String.fromCharCode(i)+String.fromCharCode(n):i!==0&&(s+=String.fromCharCode(i)),e.value=l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,s)}else if(e.name==="basicConstraints")e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(l.create(l.Class.UNIVERSAL,l.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in e&&e.value.value.push(l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.pathLenConstraint).getBytes()));else if(e.name==="extKeyUsage"){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var o=e.value.value;for(var f in e)e[f]===!0&&(f in G?o.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(G[f]).getBytes())):f.indexOf(".")!==-1&&o.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(f).getBytes())))}else if(e.name==="nsCertType"){var a=0,i=0;e.client&&(i|=128,a=7),e.server&&(i|=64,a=6),e.email&&(i|=32,a=5),e.objsign&&(i|=16,a=4),e.reserved&&(i|=8,a=3),e.sslCA&&(i|=4,a=2),e.emailCA&&(i|=2,a=1),e.objCA&&(i|=1,a=0);var s=String.fromCharCode(a);i!==0&&(s+=String.fromCharCode(i)),e.value=l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,s)}else if(e.name==="subjectAltName"||e.name==="issuerAltName"){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var u,c=0;c<e.altNames.length;++c){u=e.altNames[c];var s=u.value;if(u.type===7&&u.ip){if(s=D.util.bytesFromIP(u.ip),s===null){var r=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw r.extension=e,r}}else u.type===8&&(u.oid?s=l.oidToDer(l.oidToDer(u.oid)):s=l.oidToDer(s));e.value.value.push(l.create(l.Class.CONTEXT_SPECIFIC,u.type,!1,s))}}else if(e.name==="nsComment"&&t.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)throw new Error('Invalid "nsComment" content.');e.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,e.comment)}else if(e.name==="subjectKeyIdentifier"&&t.cert){var h=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=h.toHex(),e.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,h.getBytes())}else if(e.name==="authorityKeyIdentifier"&&t.cert){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);var o=e.value.value;if(e.keyIdentifier){var d=e.keyIdentifier===!0?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;o.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,d))}if(e.authorityCertIssuer){var C=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[ke(e.authorityCertIssuer===!0?t.cert.issuer:e.authorityCertIssuer)])];o.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,C))}if(e.serialNumber){var y=D.util.hexToBytes(e.serialNumber===!0?t.cert.serialNumber:e.serialNumber);o.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,y))}}else if(e.name==="cRLDistributionPoints"){e.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var o=e.value.value,E=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),x=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]),u,c=0;c<e.altNames.length;++c){u=e.altNames[c];var s=u.value;if(u.type===7&&u.ip){if(s=D.util.bytesFromIP(u.ip),s===null){var r=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw r.extension=e,r}}else u.type===8&&(u.oid?s=l.oidToDer(l.oidToDer(u.oid)):s=l.oidToDer(s));x.value.push(l.create(l.Class.CONTEXT_SPECIFIC,u.type,!1,s))}E.value.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[x])),o.push(E)}if(typeof e.value>"u"){var r=new Error("Extension value not specified.");throw r.extension=e,r}return e}function Rt(e,t){switch(e){case G["RSASSA-PSS"]:var r=[];return t.hash.algorithmOid!==void 0&&r.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(t.hash.algorithmOid).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")])])),t.mgf.algorithmOid!==void 0&&r.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(t.mgf.algorithmOid).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(t.mgf.hash.algorithmOid).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")])])])),t.saltLength!==void 0&&r.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(t.saltLength).getBytes())])),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,r);default:return l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")}}function en(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]);if(e.attributes.length===0)return t;for(var r=e.attributes,a=0;a<r.length;++a){var i=r[a],n=i.value,s=l.Type.UTF8;"valueTagClass"in i&&(s=i.valueTagClass),s===l.Type.UTF8&&(n=D.util.encodeUtf8(n));var o=!1;"valueConstructed"in i&&(o=i.valueConstructed);var f=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(i.type).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SET,!0,[l.create(l.Class.UNIVERSAL,s,o,n)])]);t.value.push(f)}return t}var tn=new Date("1950-01-01T00:00:00Z"),rn=new Date("2050-01-01T00:00:00Z");function Yt(e){return e>=tn&&e<rn?l.create(l.Class.UNIVERSAL,l.Type.UTCTIME,!1,l.dateToUtcTime(e)):l.create(l.Class.UNIVERSAL,l.Type.GENERALIZEDTIME,!1,l.dateToGeneralizedTime(e))}A.getTBSCertificate=function(e){var t=Yt(e.validity.notBefore),r=Yt(e.validity.notAfter),a=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes())]),l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,D.util.hexToBytes(e.serialNumber)),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.siginfo.algorithmOid).getBytes()),Rt(e.siginfo.algorithmOid,e.siginfo.parameters)]),ke(e.issuer),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,r]),ke(e.subject),A.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&a.value.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,[l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.issuer.uniqueId)])),e.subject.uniqueId&&a.value.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!0,[l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.subject.uniqueId)])),e.extensions.length>0&&a.value.push(A.certificateExtensionsToAsn1(e.extensions)),a};A.getCertificationRequestInfo=function(e){var t=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(e.version).getBytes()),ke(e.subject),A.publicKeyToAsn1(e.publicKey),en(e)]);return t};A.distinguishedNameToAsn1=function(e){return ke(e)};A.certificateToAsn1=function(e){var t=e.tbsCertificate||A.getTBSCertificate(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),Rt(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])};A.certificateExtensionsToAsn1=function(e){var t=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),r=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(r);for(var a=0;a<e.length;++a)r.value.push(A.certificateExtensionToAsn1(e[a]));return t};A.certificateExtensionToAsn1=function(e){var t=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);t.value.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.id).getBytes())),e.critical&&t.value.push(l.create(l.Class.UNIVERSAL,l.Type.BOOLEAN,!1,String.fromCharCode(255)));var r=e.value;return typeof e.value!="string"&&(r=l.toDer(r).getBytes()),t.value.push(l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,r)),t};A.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||A.getCertificationRequestInfo(e);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[t,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e.signatureOid).getBytes()),Rt(e.signatureOid,e.signatureParameters)]),l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])};A.createCaStore=function(e){var t={certs:{}};t.getIssuer=function(s){var o=r(s.issuer);return o},t.addCertificate=function(s){if(typeof s=="string"&&(s=D.pki.certificateFromPem(s)),a(s.subject),!t.hasCertificate(s))if(s.subject.hash in t.certs){var o=t.certs[s.subject.hash];D.util.isArray(o)||(o=[o]),o.push(s),t.certs[s.subject.hash]=o}else t.certs[s.subject.hash]=s},t.hasCertificate=function(s){typeof s=="string"&&(s=D.pki.certificateFromPem(s));var o=r(s.subject);if(!o)return!1;D.util.isArray(o)||(o=[o]);for(var f=l.toDer(A.certificateToAsn1(s)).getBytes(),u=0;u<o.length;++u){var c=l.toDer(A.certificateToAsn1(o[u])).getBytes();if(f===c)return!0}return!1},t.listAllCertificates=function(){var s=[];for(var o in t.certs)if(t.certs.hasOwnProperty(o)){var f=t.certs[o];if(!D.util.isArray(f))s.push(f);else for(var u=0;u<f.length;++u)s.push(f[u])}return s},t.removeCertificate=function(s){var o;if(typeof s=="string"&&(s=D.pki.certificateFromPem(s)),a(s.subject),!t.hasCertificate(s))return null;var f=r(s.subject);if(!D.util.isArray(f))return o=t.certs[s.subject.hash],delete t.certs[s.subject.hash],o;for(var u=l.toDer(A.certificateToAsn1(s)).getBytes(),c=0;c<f.length;++c){var h=l.toDer(A.certificateToAsn1(f[c])).getBytes();u===h&&(o=f[c],f.splice(c,1))}return f.length===0&&delete t.certs[s.subject.hash],o};function r(s){return a(s),t.certs[s.hash]||null}function a(s){if(!s.hash){var o=D.md.sha1.create();s.attributes=A.RDNAttributesAsArray(ke(s),o),s.hash=o.digest().toHex()}}if(e)for(var i=0;i<e.length;++i){var n=e[i];t.addCertificate(n)}return t};A.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"};A.verifyCertificateChain=function(e,t,r){typeof r=="function"&&(r={verify:r}),r=r||{},t=t.slice(0);var a=t.slice(0),i=r.validityCheckDate;typeof i>"u"&&(i=new Date);var n=!0,s=null,o=0;do{var f=t.shift(),u=null,c=!1;if(i&&(i<f.validity.notBefore||i>f.validity.notAfter)&&(s={message:"Certificate is not valid yet or has expired.",error:A.certificateError.certificate_expired,notBefore:f.validity.notBefore,notAfter:f.validity.notAfter,now:i}),s===null){if(u=t[0]||e.getIssuer(f),u===null&&f.isIssuer(f)&&(c=!0,u=f),u){var h=u;D.util.isArray(h)||(h=[h]);for(var d=!1;!d&&h.length>0;){u=h.shift();try{d=u.verify(f)}catch{}}d||(s={message:"Certificate signature is invalid.",error:A.certificateError.bad_certificate})}s===null&&(!u||c)&&!e.hasCertificate(f)&&(s={message:"Certificate is not trusted.",error:A.certificateError.unknown_ca})}if(s===null&&u&&!f.isIssuer(u)&&(s={message:"Certificate issuer is invalid.",error:A.certificateError.bad_certificate}),s===null)for(var C={keyUsage:!0,basicConstraints:!0},y=0;s===null&&y<f.extensions.length;++y){var E=f.extensions[y];E.critical&&!(E.name in C)&&(s={message:"Certificate has an unsupported critical extension.",error:A.certificateError.unsupported_certificate})}if(s===null&&(!n||t.length===0&&(!u||c))){var x=f.getExtension("basicConstraints"),S=f.getExtension("keyUsage");if(S!==null&&(!S.keyCertSign||x===null)&&(s={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:A.certificateError.bad_certificate}),s===null&&x!==null&&!x.cA&&(s={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:A.certificateError.bad_certificate}),s===null&&S!==null&&"pathLenConstraint"in x){var N=o-1;N>x.pathLenConstraint&&(s={message:"Certificate basicConstraints pathLenConstraint violated.",error:A.certificateError.bad_certificate})}}var B=s===null?!0:s.error,P=r.verify?r.verify(B,o,a):B;if(P===!0)s=null;else throw B===!0&&(s={message:"The application rejected the certificate.",error:A.certificateError.bad_certificate}),(P||P===0)&&(typeof P=="object"&&!D.util.isArray(P)?(P.message&&(s.message=P.message),P.error&&(s.error=P.error)):typeof P=="string"&&(s.error=P)),s;n=!1,++o}while(t.length>0);return!0};var Q=K,p=Q.asn1,O=Q.pki,Qe=Q.pkcs12=Q.pkcs12||{},xr={name:"ContentInfo",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:p.Class.UNIVERSAL,type:p.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:p.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},an={name:"PFX",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,capture:"version"},xr,{name:"PFX.macData",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:p.Class.UNIVERSAL,type:p.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:p.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:p.Class.UNIVERSAL,type:p.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:p.Class.UNIVERSAL,type:p.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:p.Class.UNIVERSAL,type:p.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},nn={name:"SafeBag",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:p.Class.UNIVERSAL,type:p.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:p.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:p.Class.UNIVERSAL,type:p.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},sn={name:"Attribute",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:p.Class.UNIVERSAL,type:p.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:p.Class.UNIVERSAL,type:p.Type.SET,constructed:!0,capture:"values"}]},on={name:"CertBag",tagClass:p.Class.UNIVERSAL,type:p.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:p.Class.UNIVERSAL,type:p.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:p.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:p.Class.UNIVERSAL,type:p.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function Ge(e,t,r,a){for(var i=[],n=0;n<e.length;n++)for(var s=0;s<e[n].safeBags.length;s++){var o=e[n].safeBags[s];if(!(a!==void 0&&o.type!==a)){if(t===null){i.push(o);continue}o.attributes[t]!==void 0&&o.attributes[t].indexOf(r)>=0&&i.push(o)}}return i}Qe.pkcs12FromAsn1=function(e,t,r){typeof t=="string"?(r=t,t=!0):t===void 0&&(t=!0);var a={},i=[];if(!p.validate(e,an,a,i)){var n=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw n.errors=n,n}var s={version:a.version.charCodeAt(0),safeContents:[],getBags:function(x){var S={},N;return"localKeyId"in x?N=x.localKeyId:"localKeyIdHex"in x&&(N=Q.util.hexToBytes(x.localKeyIdHex)),N===void 0&&!("friendlyName"in x)&&"bagType"in x&&(S[x.bagType]=Ge(s.safeContents,null,null,x.bagType)),N!==void 0&&(S.localKeyId=Ge(s.safeContents,"localKeyId",N,x.bagType)),"friendlyName"in x&&(S.friendlyName=Ge(s.safeContents,"friendlyName",x.friendlyName,x.bagType)),S},getBagsByFriendlyName:function(x,S){return Ge(s.safeContents,"friendlyName",x,S)},getBagsByLocalKeyId:function(x,S){return Ge(s.safeContents,"localKeyId",x,S)}};if(a.version.charCodeAt(0)!==3){var n=new Error("PKCS#12 PFX of version other than 3 not supported.");throw n.version=a.version.charCodeAt(0),n}if(p.derToOid(a.contentType)!==O.oids.data){var n=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw n.oid=p.derToOid(a.contentType),n}var o=a.content.value[0];if(o.tagClass!==p.Class.UNIVERSAL||o.type!==p.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(o=wt(o),a.mac){var f=null,u=0,c=p.derToOid(a.macAlgorithm);switch(c){case O.oids.sha1:f=Q.md.sha1.create(),u=20;break;case O.oids.sha256:f=Q.md.sha256.create(),u=32;break;case O.oids.sha384:f=Q.md.sha384.create(),u=48;break;case O.oids.sha512:f=Q.md.sha512.create(),u=64;break;case O.oids.md5:f=Q.md.md5.create(),u=16;break}if(f===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+c);var h=new Q.util.ByteBuffer(a.macSalt),d="macIterations"in a?parseInt(Q.util.bytesToHex(a.macIterations),16):1,C=Qe.generateKey(r,h,3,d,u,f),y=Q.hmac.create();y.start(f,C),y.update(o.value);var E=y.getMac();if(E.getBytes()!==a.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return un(s,o.value,t,r),s};function wt(e){if(e.composed||e.constructed){for(var t=Q.util.createBuffer(),r=0;r<e.value.length;++r)t.putBytes(e.value[r].value);e.composed=e.constructed=!1,e.value=t.getBytes()}return e}function un(e,t,r,a){if(t=p.fromDer(t,r),t.tagClass!==p.Class.UNIVERSAL||t.type!==p.Type.SEQUENCE||t.constructed!==!0)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var i=0;i<t.value.length;i++){var n=t.value[i],s={},o=[];if(!p.validate(n,xr,s,o)){var f=new Error("Cannot read ContentInfo.");throw f.errors=o,f}var u={encrypted:!1},c=null,h=s.content.value[0];switch(p.derToOid(s.contentType)){case O.oids.data:if(h.tagClass!==p.Class.UNIVERSAL||h.type!==p.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");c=wt(h).value;break;case O.oids.encryptedData:c=fn(h,a),u.encrypted=!0;break;default:var f=new Error("Unsupported PKCS#12 contentType.");throw f.contentType=p.derToOid(s.contentType),f}u.safeBags=ln(c,r,a),e.safeContents.push(u)}}function fn(e,t){var r={},a=[];if(!p.validate(e,Q.pkcs7.asn1.encryptedDataValidator,r,a)){var i=new Error("Cannot read EncryptedContentInfo.");throw i.errors=a,i}var n=p.derToOid(r.contentType);if(n!==O.oids.data){var i=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw i.oid=n,i}n=p.derToOid(r.encAlgorithm);var s=O.pbe.getCipher(n,r.encParameter,t),o=wt(r.encryptedContentAsn1),f=Q.util.createBuffer(o.value);if(s.update(f),!s.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return s.output.getBytes()}function ln(e,t,r){if(!t&&e.length===0)return[];if(e=p.fromDer(e,t),e.tagClass!==p.Class.UNIVERSAL||e.type!==p.Type.SEQUENCE||e.constructed!==!0)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var a=[],i=0;i<e.value.length;i++){var n=e.value[i],s={},o=[];if(!p.validate(n,nn,s,o)){var f=new Error("Cannot read SafeBag.");throw f.errors=o,f}var u={type:p.derToOid(s.bagId),attributes:cn(s.bagAttributes)};a.push(u);var c,h,d=s.bagValue.value[0];switch(u.type){case O.oids.pkcs8ShroudedKeyBag:if(d=O.decryptPrivateKeyInfo(d,r),d===null)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case O.oids.keyBag:try{u.key=O.privateKeyFromAsn1(d)}catch{u.key=null,u.asn1=d}continue;case O.oids.certBag:c=on,h=function(){if(p.derToOid(s.certId)!==O.oids.x509Certificate){var y=new Error("Unsupported certificate type, only X.509 supported.");throw y.oid=p.derToOid(s.certId),y}var E=p.fromDer(s.cert,t);try{u.cert=O.certificateFromAsn1(E,!0)}catch{u.cert=null,u.asn1=E}};break;default:var f=new Error("Unsupported PKCS#12 SafeBag type.");throw f.oid=u.type,f}if(c!==void 0&&!p.validate(d,c,s,o)){var f=new Error("Cannot read PKCS#12 "+c.name);throw f.errors=o,f}h()}return a}function cn(e){var t={};if(e!==void 0)for(var r=0;r<e.length;++r){var a={},i=[];if(!p.validate(e[r],sn,a,i)){var n=new Error("Cannot read PKCS#12 BagAttribute.");throw n.errors=i,n}var s=p.derToOid(a.oid);if(O.oids[s]!==void 0){t[O.oids[s]]=[];for(var o=0;o<a.values.length;++o)t[O.oids[s]].push(a.values[o].value)}}return t}Qe.toPkcs12Asn1=function(e,t,r,a){a=a||{},a.saltSize=a.saltSize||8,a.count=a.count||2048,a.algorithm=a.algorithm||a.encAlgorithm||"aes128","useMac"in a||(a.useMac=!0),"localKeyId"in a||(a.localKeyId=null),"generateLocalKeyId"in a||(a.generateLocalKeyId=!0);var i=a.localKeyId,n;if(i!==null)i=Q.util.hexToBytes(i);else if(a.generateLocalKeyId)if(t){var s=Q.util.isArray(t)?t[0]:t;typeof s=="string"&&(s=O.certificateFromPem(s));var o=Q.md.sha1.create();o.update(p.toDer(O.certificateToAsn1(s)).getBytes()),i=o.digest().getBytes()}else i=Q.random.getBytes(20);var f=[];i!==null&&f.push(p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(O.oids.localKeyId).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.SET,!0,[p.create(p.Class.UNIVERSAL,p.Type.OCTETSTRING,!1,i)])])),"friendlyName"in a&&f.push(p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(O.oids.friendlyName).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.SET,!0,[p.create(p.Class.UNIVERSAL,p.Type.BMPSTRING,!1,a.friendlyName)])])),f.length>0&&(n=p.create(p.Class.UNIVERSAL,p.Type.SET,!0,f));var u=[],c=[];t!==null&&(Q.util.isArray(t)?c=t:c=[t]);for(var h=[],d=0;d<c.length;++d){t=c[d],typeof t=="string"&&(t=O.certificateFromPem(t));var C=d===0?n:void 0,y=O.certificateToAsn1(t),E=p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(O.oids.certBag).getBytes()),p.create(p.Class.CONTEXT_SPECIFIC,0,!0,[p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(O.oids.x509Certificate).getBytes()),p.create(p.Class.CONTEXT_SPECIFIC,0,!0,[p.create(p.Class.UNIVERSAL,p.Type.OCTETSTRING,!1,p.toDer(y).getBytes())])])]),C]);h.push(E)}if(h.length>0){var x=p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,h),S=p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(O.oids.data).getBytes()),p.create(p.Class.CONTEXT_SPECIFIC,0,!0,[p.create(p.Class.UNIVERSAL,p.Type.OCTETSTRING,!1,p.toDer(x).getBytes())])]);u.push(S)}var N=null;if(e!==null){var B=O.wrapRsaPrivateKey(O.privateKeyToAsn1(e));r===null?N=p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(O.oids.keyBag).getBytes()),p.create(p.Class.CONTEXT_SPECIFIC,0,!0,[B]),n]):N=p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(O.oids.pkcs8ShroudedKeyBag).getBytes()),p.create(p.Class.CONTEXT_SPECIFIC,0,!0,[O.encryptPrivateKeyInfo(B,r,a)]),n]);var P=p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[N]),L=p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(O.oids.data).getBytes()),p.create(p.Class.CONTEXT_SPECIFIC,0,!0,[p.create(p.Class.UNIVERSAL,p.Type.OCTETSTRING,!1,p.toDer(P).getBytes())])]);u.push(L)}var U=p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,u),j;if(a.useMac){var o=Q.md.sha1.create(),se=new Q.util.ByteBuffer(Q.random.getBytes(a.saltSize)),fe=a.count,e=Qe.generateKey(r,se,3,fe,20),ve=Q.hmac.create();ve.start(o,e),ve.update(p.toDer(U).getBytes());var ge=ve.getMac();j=p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(O.oids.sha1).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.NULL,!1,"")]),p.create(p.Class.UNIVERSAL,p.Type.OCTETSTRING,!1,ge.getBytes())]),p.create(p.Class.UNIVERSAL,p.Type.OCTETSTRING,!1,se.getBytes()),p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,p.integerToDer(fe).getBytes())])}return p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.INTEGER,!1,p.integerToDer(3).getBytes()),p.create(p.Class.UNIVERSAL,p.Type.SEQUENCE,!0,[p.create(p.Class.UNIVERSAL,p.Type.OID,!1,p.oidToDer(O.oids.data).getBytes()),p.create(p.Class.CONTEXT_SPECIFIC,0,!0,[p.create(p.Class.UNIVERSAL,p.Type.OCTETSTRING,!1,p.toDer(U).getBytes())])]),j])};Qe.generateKey=Q.pbe.generatePkcs12Key;var Ae=K,Ut=Ae.asn1,Ve=Ae.pki=Ae.pki||{};Ve.pemToDer=function(e){var t=Ae.pem.decode(e)[0];if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return Ae.util.createBuffer(t.body)};Ve.privateKeyFromPem=function(e){var t=Ae.pem.decode(e)[0];if(t.type!=="PRIVATE KEY"&&t.type!=="RSA PRIVATE KEY"){var r=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw r.headerType=t.type,r}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var a=Ut.fromDer(t.body);return Ve.privateKeyFromAsn1(a)};Ve.privateKeyToPem=function(e,t){var r={type:"RSA PRIVATE KEY",body:Ut.toDer(Ve.privateKeyToAsn1(e)).getBytes()};return Ae.pem.encode(r,{maxline:t})};Ve.privateKeyInfoToPem=function(e,t){var r={type:"PRIVATE KEY",body:Ut.toDer(e).getBytes()};return Ae.pem.encode(r,{maxline:t})};function hn(e){let t=parseInt(e[0],16);return t<8?e:(t-=8,t.toString()+e.substring(1))}function vn(){let r=[{name:"keyUsage",keyCertSign:!0,digitalSignature:!0,nonRepudiation:!0,keyEncipherment:!0,dataEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0,codeSigning:!0,timeStamping:!0},{name:"subjectAltName",altNames:[{type:2,value:"localhost"},{type:2,value:"localhost.localdomain"},{type:2,value:"lvh.me"},{type:2,value:"*.lvh.me"},{type:2,value:"[::1]"},{type:7,ip:"127.0.0.1"},{type:7,ip:"fe80::1"}]}],a=[{name:"commonName",value:"example.org"},{name:"countryName",value:"US"},{shortName:"ST",value:"Virginia"},{name:"localityName",value:"Blacksburg"},{name:"organizationName",value:"Test"},{shortName:"OU",value:"Test"}],i=K.pki.rsa.generateKeyPair(2048),n=K.pki.createCertificate();n.serialNumber=hn(K.util.bytesToHex(K.random.getBytesSync(9))),n.validity.notBefore=new Date,n.validity.notAfter=new Date,n.validity.notAfter.setDate(n.validity.notBefore.getDate()+30),n.setSubject(a),n.setIssuer(a),n.publicKey=i.publicKey,n.setExtensions(r);let s=K.md.sha256.create();n.sign(i.privateKey,s);let o=K.pki.privateKeyToPem(i.privateKey),f=K.pki.certificateToPem(n);return o+f}export{vn as createCertificate};
19
- //# sourceMappingURL=certificate-OSVGOZD2.js.map