New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

asn1-ts

Package Overview
Dependencies
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asn1-ts - npm Package Compare versions

Comparing version 2.5.1 to 2.6.0

dist/codecs/ber/berDecodeBoolean.d.ts

79

dist/asn1.d.ts
import { ObjectIdentifier as OID } from "./types/objectidentifier";
import { ASN1Construction, ASN1TagClass } from "./values";
export declare abstract class ASN1Element {
protected recursionCount: number;
recursionCount: number;
protected static readonly nestingRecursionLimit: number;

@@ -11,27 +11,53 @@ name: string;

value: Uint8Array;
readonly length: number;
abstract boolean: boolean;
abstract integer: number;
abstract bitString: boolean[];
abstract octetString: Uint8Array;
abstract objectIdentifier: OID;
abstract objectDescriptor: string;
abstract real: number;
abstract enumerated: number;
abstract utf8String: string;
abstract relativeObjectIdentifier: number[];
abstract sequence: ASN1Element[];
abstract set: ASN1Element[];
abstract numericString: string;
abstract printableString: string;
abstract teletexString: Uint8Array;
abstract videotexString: Uint8Array;
abstract ia5String: string;
abstract utcTime: Date;
abstract generalizedTime: Date;
abstract graphicString: string;
abstract visibleString: string;
abstract generalString: string;
abstract universalString: string;
abstract bmpString: string;
get length(): number;
abstract fromBytes(bytes: Uint8Array): number;
abstract toBytes(): Uint8Array;
abstract set boolean(value: boolean);
abstract get boolean(): boolean;
abstract set integer(value: number);
abstract get integer(): number;
abstract set bitString(value: boolean[]);
abstract get bitString(): boolean[];
abstract set octetString(value: Uint8Array);
abstract get octetString(): Uint8Array;
abstract set objectIdentifier(value: OID);
abstract get objectIdentifier(): OID;
abstract set objectDescriptor(value: string);
abstract get objectDescriptor(): string;
abstract set real(value: number);
abstract get real(): number;
abstract set enumerated(value: number);
abstract get enumerated(): number;
abstract set utf8String(value: string);
abstract get utf8String(): string;
abstract set relativeObjectIdentifier(value: number[]);
abstract get relativeObjectIdentifier(): number[];
abstract set sequence(value: ASN1Element[]);
abstract get sequence(): ASN1Element[];
abstract set set(value: ASN1Element[]);
abstract get set(): ASN1Element[];
abstract set numericString(value: string);
abstract get numericString(): string;
abstract set printableString(value: string);
abstract get printableString(): string;
abstract set teletexString(value: Uint8Array);
abstract get teletexString(): Uint8Array;
abstract set videotexString(value: Uint8Array);
abstract get videotexString(): Uint8Array;
abstract set ia5String(value: string);
abstract get ia5String(): string;
abstract set utcTime(value: Date);
abstract get utcTime(): Date;
abstract set generalizedTime(value: Date);
abstract get generalizedTime(): Date;
abstract set graphicString(value: string);
abstract get graphicString(): string;
abstract set visibleString(value: string);
abstract get visibleString(): string;
abstract set generalString(value: string);
abstract get generalString(): string;
abstract set universalString(value: string);
abstract get universalString(): string;
abstract set bmpString(value: string);
abstract get bmpString(): string;
private validateSize;

@@ -60,3 +86,4 @@ private validateRange;

protected static decodeSignedBigEndianInteger(value: Uint8Array): number;
abstract deconstruct(dataType: string): Uint8Array;
}
//# sourceMappingURL=asn1.d.ts.map

@@ -0,1 +1,2 @@

import { ASN1Element } from "../asn1";
import { ASN1Construction, ASN1TagClass, LengthEncodingPreference } from "../values";

@@ -5,31 +6,52 @@ import { X690Element } from "../x690";

static lengthEncodingPreference: LengthEncodingPreference;
boolean: boolean;
bitString: boolean[];
octetString: Uint8Array;
objectDescriptor: string;
real: number;
utf8String: string;
sequence: BERElement[];
set: BERElement[];
numericString: string;
printableString: string;
teletexString: Uint8Array;
videotexString: Uint8Array;
ia5String: string;
utcTime: Date;
generalizedTime: Date;
graphicString: string;
visibleString: string;
generalString: string;
universalString: string;
bmpString: string;
set boolean(value: boolean);
get boolean(): boolean;
set bitString(value: boolean[]);
get bitString(): boolean[];
set octetString(value: Uint8Array);
get octetString(): Uint8Array;
set objectDescriptor(value: string);
get objectDescriptor(): string;
set real(value: number);
get real(): number;
set utf8String(value: string);
get utf8String(): string;
set sequence(value: ASN1Element[]);
get sequence(): ASN1Element[];
set set(value: ASN1Element[]);
get set(): ASN1Element[];
set numericString(value: string);
get numericString(): string;
set printableString(value: string);
get printableString(): string;
set teletexString(value: Uint8Array);
get teletexString(): Uint8Array;
set videotexString(value: Uint8Array);
get videotexString(): Uint8Array;
set ia5String(value: string);
get ia5String(): string;
set utcTime(value: Date);
get utcTime(): Date;
set generalizedTime(value: Date);
get generalizedTime(): Date;
set graphicString(value: string);
get graphicString(): string;
set visibleString(value: string);
get visibleString(): string;
set generalString(value: string);
get generalString(): string;
set universalString(value: string);
get universalString(): string;
set bmpString(value: string);
get bmpString(): string;
encode(value: any): void;
static fromSequence(sequence: (BERElement | null | undefined)[]): BERElement;
static fromSet(set: (BERElement | null | undefined)[]): BERElement;
inner: BERElement;
get inner(): BERElement;
set inner(value: BERElement);
constructor(tagClass?: ASN1TagClass, construction?: ASN1Construction, tagNumber?: number, value?: any);
fromBytes(bytes: Uint8Array): number;
toBytes(): Uint8Array;
private deconstruct;
deconstruct(dataType: string): Uint8Array;
}
//# sourceMappingURL=ber.d.ts.map

@@ -0,32 +1,55 @@

import { ASN1Element } from "../asn1";
import { ASN1Construction, ASN1TagClass } from "../values";
import { X690Element } from "../x690";
export declare class DERElement extends X690Element {
boolean: boolean;
bitString: boolean[];
octetString: Uint8Array;
objectDescriptor: string;
real: number;
utf8String: string;
sequence: DERElement[];
set: DERElement[];
numericString: string;
printableString: string;
teletexString: Uint8Array;
videotexString: Uint8Array;
ia5String: string;
utcTime: Date;
generalizedTime: Date;
graphicString: string;
visibleString: string;
generalString: string;
universalString: string;
bmpString: string;
set boolean(value: boolean);
get boolean(): boolean;
set bitString(value: boolean[]);
get bitString(): boolean[];
set octetString(value: Uint8Array);
get octetString(): Uint8Array;
set objectDescriptor(value: string);
get objectDescriptor(): string;
set real(value: number);
get real(): number;
set utf8String(value: string);
get utf8String(): string;
set sequence(value: ASN1Element[]);
get sequence(): ASN1Element[];
set set(value: ASN1Element[]);
get set(): ASN1Element[];
set numericString(value: string);
get numericString(): string;
set printableString(value: string);
get printableString(): string;
set teletexString(value: Uint8Array);
get teletexString(): Uint8Array;
set videotexString(value: Uint8Array);
get videotexString(): Uint8Array;
set ia5String(value: string);
get ia5String(): string;
set utcTime(value: Date);
get utcTime(): Date;
set generalizedTime(value: Date);
get generalizedTime(): Date;
set graphicString(value: string);
get graphicString(): string;
set visibleString(value: string);
get visibleString(): string;
set generalString(value: string);
get generalString(): string;
set universalString(value: string);
get universalString(): string;
set bmpString(value: string);
get bmpString(): string;
encode(value: any): void;
static fromSequence(sequence: (DERElement | null | undefined)[]): DERElement;
static fromSet(set: (DERElement | null | undefined)[]): DERElement;
inner: DERElement;
static fromSequence(sequence: (ASN1Element | null | undefined)[]): DERElement;
static fromSet(set: (ASN1Element | null | undefined)[]): DERElement;
get inner(): DERElement;
set inner(value: DERElement);
constructor(tagClass?: ASN1TagClass, construction?: ASN1Construction, tagNumber?: number, value?: any);
fromBytes(bytes: Uint8Array): number;
toBytes(): Uint8Array;
deconstruct(): Uint8Array;
}
//# sourceMappingURL=der.d.ts.map

@@ -747,4 +747,7 @@ "use strict";

}
deconstruct() {
return this.value.subarray(0);
}
}
exports.DERElement = DERElement;
//# sourceMappingURL=der.js.map

@@ -8,2 +8,2 @@ var der=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=5)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});class n extends Error{constructor(t){super(t),Object.setPrototypeOf(this,n.prototype)}}e.ASN1Error=n;e.ASN1NotImplementedError=class extends n{constructor(){super("Not yet implemented."),Object.setPrototypeOf(this,n.prototype)}};e.ASN1RecursionError=class extends n{constructor(){super("Recursion was too deep."),Object.setPrototypeOf(this,n.prototype)}};e.ASN1TruncationError=class extends n{constructor(t){super(t),Object.setPrototypeOf(this,n.prototype)}};e.ASN1OverflowError=class extends n{constructor(t){super(t),Object.setPrototypeOf(this,n.prototype)}};e.ASN1SizeError=class extends n{constructor(t){super(t),Object.setPrototypeOf(this,n.prototype)}};e.ASN1PaddingError=class extends n{constructor(t){super(t),Object.setPrototypeOf(this,n.prototype)}};e.ASN1UndefinedError=class extends n{constructor(t){super(t),Object.setPrototypeOf(this,n.prototype)}};e.ASN1CharactersError=class extends n{constructor(t){super(t),Object.setPrototypeOf(this,n.prototype)}};e.ASN1ConstructionError=class extends n{constructor(t){super(t),Object.setPrototypeOf(this,n.prototype)}}},function(t,e,r){"use strict";var n;Object.defineProperty(e,"__esModule",{value:!0}),e.MAX_UINT_32=4294967295,e.MIN_UINT_32=0,e.MAX_SINT_32=2147483647,e.MIN_SINT_32=-2147483648,function(t){t[t.universal=0]="universal",t[t.application=1]="application",t[t.context=2]="context",t[t.private=3]="private"}(n=e.ASN1TagClass||(e.ASN1TagClass={})),function(t){t[t.primitive=0]="primitive",t[t.constructed=1]="constructed"}(e.ASN1Construction||(e.ASN1Construction={})),function(t){t[t.definite=0]="definite",t[t.indefinite=1]="indefinite"}(e.LengthEncodingPreference||(e.LengthEncodingPreference={})),function(t){t[t.plusInfinity=64]="plusInfinity",t[t.minusInfinity=65]="minusInfinity",t[t.notANumber=66]="notANumber",t[t.minusZero=67]="minusZero"}(e.ASN1SpecialRealValue||(e.ASN1SpecialRealValue={})),function(t){t[t.base2=0]="base2",t[t.base8=16]="base8",t[t.base16=32]="base16"}(e.ASN1RealEncodingBase||(e.ASN1RealEncodingBase={})),function(t){t[t.scale0=0]="scale0",t[t.scale1=4]="scale1",t[t.scale2=8]="scale2",t[t.scale3=12]="scale3"}(e.ASN1RealEncodingScale||(e.ASN1RealEncodingScale={})),function(t){t[t.endOfContent=0]="endOfContent",t[t.boolean=1]="boolean",t[t.integer=2]="integer",t[t.bitString=3]="bitString",t[t.octetString=4]="octetString",t[t.nill=5]="nill",t[t.objectIdentifier=6]="objectIdentifier",t[t.objectDescriptor=7]="objectDescriptor",t[t.external=8]="external",t[t.realNumber=9]="realNumber",t[t.enumerated=10]="enumerated",t[t.embeddedPDV=11]="embeddedPDV",t[t.utf8String=12]="utf8String",t[t.relativeOID=13]="relativeOID",t[t.reserved14=14]="reserved14",t[t.reserved15=15]="reserved15",t[t.sequence=16]="sequence",t[t.set=17]="set",t[t.numericString=18]="numericString",t[t.printableString=19]="printableString",t[t.teletexString=20]="teletexString",t[t.videotexString=21]="videotexString",t[t.ia5String=22]="ia5String",t[t.utcTime=23]="utcTime",t[t.generalizedTime=24]="generalizedTime",t[t.graphicString=25]="graphicString",t[t.visibleString=26]="visibleString",t[t.generalString=27]="generalString",t[t.universalString=28]="universalString",t[t.characterString=29]="characterString",t[t.bmpString=30]="bmpString"}(e.ASN1UniversalType||(e.ASN1UniversalType={})),e.printableStringCharacters="etaoinsrhdlucmfywgpbvkxqjzETAOINSRHDLUCMFYWGPBVKXQJZ0123456789 '()+,-./:=?",e.utcTimeRegex=/^(\d{2})((?:1[0-2])|(?:0\d))((?:3[01])|(?:[0-2]\d))((?:2[0-3])|(?:[01]\d))([0-5]\d)([0-5]\d)?((?:(\+|-)((?:2[0-3])|(?:[01]\d))[0-5]\d)|Z)$/,e.generalizedTimeRegex=/^(\d{4})((?:1[0-2])|(?:0\d))((?:3[01])|(?:[0-2]\d))((?:2[0-3])|(?:[01]\d))([0-5]\d)?([0-5]\d)?(?:(?:\.|,)(\d+))?((?:(?:\+|-)((?:2[0-3])|(?:[01]\d))[0-5]\d)|Z)?$/,e.nr1Regex=/^ *(\+|-)?\d+$/u,e.nr2Regex=/^ *(\+|-)?(?:\d+(\.|,)\d*)|(?:\d*(\.|,)\d+)$/u,e.nr3Regex=/^ *(\+|-)?(?:\d+(\.|,)\d*)|(?:\d*(\.|,)\d+)(e|E)(\+|-)?\d+$/u,e.canonicalNR3Regex=/^ *-?(?:[1-9]\d*)?[1-9]\.E(?:\+0)|(?:-?[1-9]\d*)$/u,e.distinguishedNR3Regex=/^ *-?(?:[1-9]\d*)?[1-9]\.E(?:\+0)|(?:-?[1-9]\d*)$/u,e.CANONICAL_TAG_CLASS_ORDERING=[n.universal,n.application,n.private,n.context]},function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const i=n(r(0)),o=r(1);class s{constructor(){this.recursionCount=0,this.name="",this.tagClass=o.ASN1TagClass.universal,this.construction=o.ASN1Construction.primitive,this.tagNumber=0,this.value=new Uint8Array(0)}get length(){return this.value.length}validateSize(t,e,r,n,o){const s=void 0===o?1/0:o;if(r<n)throw new i.ASN1SizeError(`${t} encoded ${r} ${e} when the `+`minimum permissible is ${n} ${e}.`);if(r>s)throw new i.ASN1SizeError(`${t} encoded ${r} ${e} when the `+`maximum permissible is ${s} ${e}.`)}validateRange(t,e,r,n){const o=void 0===n?1/0:n;if(e<r)throw new i.ASN1OverflowError(`${t} was ${e} when the `+`minimum permissible is ${r}.`);if(e>o)throw new i.ASN1OverflowError(`${t} was ${e} when the `+`maximum permissible is ${o}.`)}sizeConstrainedBitString(t,e){const r=this.bitString;return this.validateSize(this.name||"BIT STRING","bits",r.length,t,e),r}sizeConstrainedOctetString(t,e){const r=this.octetString;return this.validateSize(this.name||"OCTET STRING","octets",r.length,t,e),r}sizeConstrainedObjectDescriptor(t,e){const r=this.objectDescriptor;return this.validateSize(this.name||"ObjectDescriptor","characters",r.length,t,e),r}sizeConstrainedUTF8String(t,e){const r=this.utf8String;return this.validateSize(this.name||"UTF8String","characters",r.length,t,e),r}sizeConstrainedSequenceOf(t,e){const r=this.sequence;return this.validateSize(this.name||"SEQUENCE OF","elements",r.length,t,e),r}sizeConstrainedSetOf(t,e){const r=this.set;return this.validateSize(this.name||"SET OF","elements",r.length,t,e),r}sizeConstrainedNumericString(t,e){const r=this.numericString;return this.validateSize(this.name||"NumericString","characters",r.length,t,e),r}sizeConstrainedPrintableString(t,e){const r=this.printableString;return this.validateSize(this.name||"PrintableString","characters",r.length,t,e),r}sizeConstrainedTeletexString(t,e){const r=this.teletexString;return this.validateSize(this.name||"TeletexString","characters",r.length,t,e),r}sizeConstrainedVideotexString(t,e){const r=this.videotexString;return this.validateSize(this.name||"VideotexString","characters",r.length,t,e),r}sizeConstrainedIA5String(t,e){const r=this.ia5String;return this.validateSize(this.name||"IA5String","characters",r.length,t,e),r}sizeConstrainedGraphicString(t,e){const r=this.graphicString;return this.validateSize(this.name||"GraphicString","characters",r.length,t,e),r}sizeConstrainedVisibleString(t,e){const r=this.visibleString;return this.validateSize(this.name||"VisibleString","characters",r.length,t,e),r}sizeConstrainedGeneralString(t,e){const r=this.generalString;return this.validateSize(this.name||"GeneralString","characters",r.length,t,e),r}sizeConstrainedUniversalString(t,e){const r=this.universalString;return this.validateSize(this.name||"UniversalString","characters",r.length,t,e),r}sizeConstrainedBMPString(t,e){const r=this.bmpString;return this.validateSize(this.name||"BMPString","characters",r.length,t,e),r}rangeConstrainedInteger(t,e){const r=this.integer;return this.validateRange(this.name||"INTEGER",r,t,e),r}rangeConstrainedReal(t,e){const r=this.real;return this.validateRange(this.name||"REAL",r,t,e),r}static validateDateTime(t,e,r,n,o,s,a){switch(r){case 0:case 2:case 4:case 6:case 7:case 9:case 11:if(n>31)throw new i.ASN1Error(`Day > 31 encountered in ${t} with 31-day month.`);break;case 3:case 5:case 8:case 10:if(n>30)throw new i.ASN1Error(`Day > 31 encountered in ${t} with 30-day month.`);break;case 1:if(e%4==0&&e%100!=0||e%400==0){if(n>29)throw new i.ASN1Error(`Day > 29 encountered in ${t} with month of February in leap year.`)}else if(n>28)throw new i.ASN1Error(`Day > 28 encountered in ${t} with month of February and non leap year.`);break;default:throw new i.ASN1Error(`Month greater than 12 encountered in ${t}.`)}if(o>23)throw new i.ASN1Error(`Hours > 23 encountered in ${t}.`);if(s>59)throw new i.ASN1Error(`Minutes > 60 encountered in ${t}.`);if(a>59)throw new i.ASN1Error(`Seconds > 60 encountered in ${t}.`)}static decodeUnsignedBigEndianInteger(t){if(0===t.length)return 0;if(t.length>4)throw new i.ASN1OverflowError("Number too long to decode.");const e=new Uint8Array(4);return e.set(t,4-t.length),new Uint32Array(e.reverse().buffer)[0]}static decodeSignedBigEndianInteger(t){if(0===t.length)return 0;if(t.length>4)throw new i.ASN1OverflowError("Number too long to decode.");const e=new Uint8Array(4);return t[0]>=128&&e.fill(255),e.set(t,4-t.length),new Int32Array(e.reverse().buffer)[0]}}e.ASN1Element=s,s.nestingRecursionLimit=5},function(t,e,r){"use strict";(function(t){

*/
var n=r(9),i=r(10),o=r(11);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return c(this,t,e,r)}function c(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=f(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(e,r),i=(t=a(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(u.isBuffer(e)){var r=0|g(e.length);return 0===(t=a(t,r)).length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?a(t,0):f(t,e);if("Buffer"===e.type&&o(e.data))return f(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,e){if(h(e),t=a(t,e<0?0:0|g(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function f(t,e){var r=e.length<0?0:0|g(e.length);t=a(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function g(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function d(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Y(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(t).length;default:if(n)return Y(t).length;e=(""+e).toLowerCase(),n=!0}}function p(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return O(this,e,r);case"utf8":case"utf-8":return T(this,e,r);case"ascii":return U(this,e,r);case"latin1":case"binary":return _(this,e,r);case"base64":return C(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function S(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function w(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=r;o<a;o++)if(c(t,o)===c(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var l=!0,f=0;f<u;f++)if(c(t,o+f)!==c(e,f)){l=!1;break}if(l)return o}return-1}function A(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function b(t,e,r,n){return k(Y(e,t.length-r),t,r,n)}function y(t,e,r,n){return k(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function N(t,e,r,n){return y(t,e,r,n)}function m(t,e,r,n){return k(G(e),t,r,n)}function E(t,e,r,n){return k(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function C(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function T(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,u,c=t[i],h=null,l=c>239?4:c>223?3:c>191?2:1;if(i+l<=r)switch(l){case 1:c<128&&(h=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(h=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,l=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=l}return function(t){var e=t.length;if(e<=R)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=R));return r}(n)}e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,r){return c(null,t,e,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,r){return function(t,e,r,n){return h(e),e<=0?a(t,e):void 0!==r?"string"==typeof n?a(t,e).fill(r,n):a(t,e).fill(r):a(t,e)}(null,t,e,r)},u.allocUnsafe=function(t){return l(null,t)},u.allocUnsafeSlow=function(t){return l(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var s=t[r];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},u.byteLength=d,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)S(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)S(this,e,e+3),S(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)S(this,e,e+7),S(this,e+1,e+6),S(this,e+2,e+5),S(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?T(this,0,t):p.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,r,n,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),c=this.slice(n,i),h=t.slice(e,r),l=0;l<a;++l)if(c[l]!==h[l]){o=c[l],s=h[l];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return w(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return w(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return A(this,t,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":return y(this,t,e,r);case"latin1":case"binary":return N(this,t,e,r);case"base64":return m(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var R=4096;function U(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function _(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function O(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=z(t[o]);return i}function I(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function B(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function x(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function D(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function M(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function $(t,e,r,n,o){return o||M(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function j(t,e,r,n,o){return o||M(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=u.prototype;else{var i=e-t;r=new u(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},u.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||B(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||B(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUInt8=function(t,e){return e||B(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||B(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||B(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||B(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||B(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||B(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||B(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||B(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||B(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||B(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||B(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||B(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||B(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||B(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||B(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||B(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||P(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||P(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):x(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):x(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):D(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);P(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);P(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):x(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):x(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):D(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return $(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return $(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return j(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return j(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=u.isBuffer(t)?t:Y(new u(t,n).toString()),a=s.length;for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var L=/[^+\/0-9A-Za-z-_]/g;function z(t){return t<16?"0"+t.toString(16):t.toString(16)}function Y(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function G(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(L,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function k(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(8))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.ObjectIdentifier=class{constructor(t){if(t.length<2)throw new Error("Cannot construct an OID with less than two nodes!");if(t.length>=1&&!(t[0]in[0,1,2]))throw new Error("OIDs first node must be 0, 1, or 2!");if(t[0]<2&&t[1]>39||2===t[0]&&t[1]>175)throw new Error("OID Node #2 cannot exceed 39 if node #1 is 0 or 1, and 175 "+`if node #1 is 2. Received these nodes: ${t}.`);t.forEach(t=>{if(t<0)throw new Error("OID node numbers cannot be negative!");if(t>Number.MAX_SAFE_INTEGER)throw new Error("OID number was too big!")}),this._nodes=t.slice(0)}get nodes(){return this._nodes.slice(0)}get dotDelimitedNotation(){return this._nodes.join(".")}toString(){return this.dotDelimitedNotation}}},function(t,e,r){t.exports=r(6)},function(t,e,r){"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),n(r(2)),n(r(7)),n(r(0)),n(r(4)),n(r(1))},function(t,e,r){"use strict";(function(t){var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(2),s=n(r(0)),a=r(1),u=r(12),c=i(r(13)),h=i(r(14)),l=r(4);class f extends u.X690Element{set boolean(t){this.value=new Uint8Array(1),this.value[0]=t?255:0}get boolean(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("BOOLEAN cannot be constructed.");if(1!==this.value.length)throw new s.ASN1SizeError("BOOLEAN not one byte");if(0!==this.value[0]&&255!==this.value[0])throw new s.ASN1Error("BOOLEAN must be encoded as 0xFF or 0x00.");return 0!==this.value[0]}set bitString(t){0===t.length&&(this.value=new Uint8Array(0));const e=[];e.length=(t.length>>>3)+(t.length%8?1:0)+1;for(let r=0;r<t.length;r++)!1!==t[r]&&(e[1+(r>>>3)]|=128>>>r%8);e[0]=8-t.length%8,8===e[0]&&(e[0]=0),this.value=new Uint8Array(e)}get bitString(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("BIT STRING cannot be constructed.");if(0===this.value.length)throw new s.ASN1Error("ASN.1 BIT STRING cannot be encoded on zero bytes!");if(1===this.value.length&&0!==this.value[0])throw new s.ASN1Error("ASN.1 BIT STRING encoded with deceptive first byte!");if(this.value[0]>7)throw new s.ASN1Error("First byte of an ASN.1 BIT STRING must be <= 7!");let t=[];for(let e=1;e<this.value.length;e++)t=t.concat([Boolean(128&this.value[e]),Boolean(64&this.value[e]),Boolean(32&this.value[e]),Boolean(16&this.value[e]),Boolean(8&this.value[e]),Boolean(4&this.value[e]),Boolean(2&this.value[e]),Boolean(1&this.value[e])]);return t.slice(t.length-this.value[0]).forEach(t=>{if(t)throw new s.ASN1Error("BIT STRING had a trailing set bit.")}),t.length-=this.value[0],t}set octetString(t){this.value=new Uint8Array(t)}get octetString(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("OCTET STRING cannot be constructed.");return new Uint8Array(this.value)}set objectDescriptor(t){this.graphicString=t}get objectDescriptor(){return this.graphicString}set real(t){0!==t?Number.isNaN(t)?this.value=new Uint8Array([a.ASN1SpecialRealValue.notANumber]):this.value=-0!==t?t!==1/0?t!==-1/0?h.default(String.fromCharCode(3)+t.toFixed(7)):new Uint8Array([a.ASN1SpecialRealValue.minusInfinity]):new Uint8Array([a.ASN1SpecialRealValue.plusInfinity]):new Uint8Array([a.ASN1SpecialRealValue.minusZero]):this.value=new Uint8Array(0)}get real(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("REAL cannot be constructed.");if(0===this.value.length)return 0;switch(192&this.value[0]){case 64:if(this.value[0]===a.ASN1SpecialRealValue.notANumber)return NaN;if(this.value[0]===a.ASN1SpecialRealValue.minusZero)return-0;if(this.value[0]===a.ASN1SpecialRealValue.plusInfinity)return 1/0;if(this.value[0]===a.ASN1SpecialRealValue.minusInfinity)return-1/0;throw new s.ASN1UndefinedError("Unrecognized special REAL value!");case 0:{const t=c.default(this.value.slice(1));switch(63&this.value[0]){case 1:case 2:throw new s.ASN1Error("DER prohibits NR1 and NR2 Base-10 REAL");case 3:if(!a.nr3Regex.test(t))throw new s.ASN1Error("Malformed NR3 Base-10 REAL");return parseFloat(t.replace(",","."));default:throw new s.ASN1UndefinedError("Undefined Base-10 REAL encoding.")}}case 128:case 192:{const t=64&this.value[0]?-1:1,e=(t=>{switch(this.value[0]&48){case a.ASN1RealEncodingBase.base2:return 2;case a.ASN1RealEncodingBase.base8:return 8;case a.ASN1RealEncodingBase.base16:return 16;default:throw new s.ASN1Error("Impossible REAL encoding base encountered.")}})(),r=(t=>{switch(this.value[0]&12){case a.ASN1RealEncodingScale.scale0:return 0;case a.ASN1RealEncodingScale.scale1:return 1;case a.ASN1RealEncodingScale.scale2:return 2;case a.ASN1RealEncodingScale.scale3:return 3;default:throw new s.ASN1Error("Impossible REAL encoding scale encountered.")}})();let n,i;switch(3&this.value[0]){case 0:if(this.value.length<3)throw new s.ASN1TruncationError("Binary-encoded REAL truncated.");n=o.ASN1Element.decodeSignedBigEndianInteger(this.value.subarray(1,2)),i=o.ASN1Element.decodeUnsignedBigEndianInteger(this.value.subarray(2));break;case 1:if(this.value.length<4)throw new s.ASN1TruncationError("Binary-encoded REAL truncated.");if(n=o.ASN1Element.decodeSignedBigEndianInteger(this.value.subarray(1,3)),i=o.ASN1Element.decodeUnsignedBigEndianInteger(this.value.subarray(3)),n<=127&&n>=-128)throw new s.ASN1Error("DER-encoded binary-encoded REAL could have encoded exponent on fewer octets.");break;case 2:case 3:throw new s.ASN1Error("DER-encoded binary REAL encoded in a way that would either overflow or encode on too many octets.");default:throw new s.ASN1Error("Impossible binary REAL exponent encoding encountered.")}if(0!==i&&!(i%2))throw new s.ASN1Error("DER-encoded REAL may not have an even non-zero mantissa.");return t*i*Math.pow(2,r)*Math.pow(e,n)}default:throw new s.ASN1Error("Impossible REAL format encountered.")}}set utf8String(t){this.value=h.default(t)}get utf8String(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("UTF8String cannot be constructed.");return c.default(this.value)}set sequence(t){const e=[];t.forEach(t=>{e.push(t.toBytes())});let r=0;e.forEach(t=>{r+=t.length});const n=new Uint8Array(r);let i=0;e.forEach(t=>{n.set(t,i),i+=t.length}),this.value=n,this.construction=a.ASN1Construction.constructed}get sequence(){if(this.construction!==a.ASN1Construction.constructed)throw new s.ASN1ConstructionError("SET or SEQUENCE cannot be primitively constructed.");const t=[];if(0===this.value.length)return[];let e=0;for(;e<this.value.length;){const r=new f;e+=r.fromBytes(this.value.slice(e)),t.push(r)}return t}set set(t){this.sequence=t}get set(){return this.sequence}set numericString(t){for(let e=0;e<t.length;e++){const r=t.charCodeAt(e);if(!(r>=48&&r<=57||32===r))throw new s.ASN1CharactersError("NumericString can only contain characters 0 - 9 and space.")}this.value=h.default(t)}get numericString(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("NumericString cannot be constructed.");const t=c.default(this.value);for(let e=0;e<t.length;e++){const r=t.charCodeAt(e);if(!(r>=48&&r<=57||32===r))throw new s.ASN1CharactersError("NumericString can only contain characters 0 - 9 and space.")}return t}set printableString(t){for(let e=0;e<t.length;e++)if(-1===a.printableStringCharacters.indexOf(t.charAt(e)))throw new s.ASN1CharactersError(`PrintableString can only contain these characters: ${a.printableStringCharacters}`);this.value=h.default(t)}get printableString(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("PrintableString cannot be constructed.");const t=c.default(this.value);for(let e=0;e<t.length;e++)if(-1===a.printableStringCharacters.indexOf(t.charAt(e)))throw new s.ASN1CharactersError(`PrintableString can only contain these characters: ${a.printableStringCharacters}`);return t}set teletexString(t){this.value=new Uint8Array(t)}get teletexString(){return this.octetString}set videotexString(t){this.value=new Uint8Array(t)}get videotexString(){return this.octetString}set ia5String(t){this.value=h.default(t)}get ia5String(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("IA5String cannot be constructed.");return c.default(this.value)}set utcTime(t){let e=t.getUTCFullYear().toString();const r=`${e=e.substring(e.length-2,e.length)}${t.getUTCMonth()<9?`0${t.getUTCMonth()+1}`:`${t.getUTCMonth()+1}`}${t.getUTCDate()<10?`0${t.getUTCDate()}`:`${t.getUTCDate()}`}${t.getUTCHours()<10?`0${t.getUTCHours()}`:`${t.getUTCHours()}`}${t.getUTCMinutes()<10?`0${t.getUTCMinutes()}`:`${t.getUTCMinutes()}`}${t.getUTCSeconds()<10?`0${t.getUTCSeconds()}`:`${t.getUTCSeconds()}`}Z`;this.value=h.default(r)}get utcTime(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("UTCTime cannot be constructed.");const t=c.default(this.value),e=a.utcTimeRegex.exec(t);if(null===e)throw new s.ASN1Error("Malformed UTCTime string.");const r=new Date;let n=Number(e[1]);n=n<70?2e3+n:1900+n;const i=Number(e[2])-1,o=Number(e[3]),u=Number(e[4]),h=Number(e[5]),l=Number(e[6]);return f.validateDateTime("UTCTime",n,i,o,u,h,l),r.setUTCFullYear(n),r.setUTCMonth(i),r.setUTCDate(o),r.setUTCHours(u),r.setUTCMinutes(h),r.setUTCSeconds(l),r}set generalizedTime(t){const e=`${t.getUTCFullYear().toString()}${t.getUTCMonth()<9?`0${t.getUTCMonth()+1}`:`${t.getUTCMonth()+1}`}${t.getUTCDate()<10?`0${t.getUTCDate()}`:`${t.getUTCDate()}`}${t.getUTCHours()<10?`0${t.getUTCHours()}`:`${t.getUTCHours()}`}${t.getUTCMinutes()<10?`0${t.getUTCMinutes()}`:`${t.getUTCMinutes()}`}${t.getUTCSeconds()<10?`0${t.getUTCSeconds()}`:`${t.getUTCSeconds()}`}Z`;this.value=h.default(e)}get generalizedTime(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("GeneralizedTime cannot be constructed.");const t=c.default(this.value),e=a.generalizedTimeRegex.exec(t);if(null===e)throw new s.ASN1Error("Malformed GeneralizedTime string.");const r=new Date,n=Number(e[1]),i=Number(e[2])-1,o=Number(e[3]),u=Number(e[4]),h=Number(e[5]),l=Number(e[6]);return f.validateDateTime("GeneralizedTime",n,i,o,u,h,l),r.setUTCFullYear(n),r.setUTCMonth(i),r.setUTCDate(o),r.setUTCHours(u),r.setUTCMinutes(h),r.setUTCSeconds(l),r}set graphicString(t){for(let e=0;e<t.length;e++){const r=t.charCodeAt(e);if(r<32||r>126)throw new s.ASN1CharactersError("GraphicString, VisibleString, or ObjectDescriptor can only contain characters between 0x20 and 0x7E.")}this.value=h.default(t)}get graphicString(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("GraphicString cannot be constructed.");const t=c.default(this.value);for(let e=0;e<t.length;e++){const r=t.charCodeAt(e);if(r<32||r>126)throw new s.ASN1CharactersError("GraphicString, VisibleString, or ObjectDescriptor can only contain characters between 0x20 and 0x7E."+` Buffer: ${this.value.join(":")}`)}return t}set visibleString(t){this.graphicString=t}get visibleString(){return this.graphicString}set generalString(t){for(let e=0;e<t.length;e++)if(t.charCodeAt(e)>127)throw new s.ASN1CharactersError("GeneralString can only contain ASCII characters.");this.value=h.default(t)}get generalString(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("GeneralString cannot be constructed.");const t=c.default(this.value);for(let e=0;e<t.length;e++)if(t.charCodeAt(e)>127)throw new s.ASN1CharactersError("GeneralString can only contain ASCII characters.");return t}set universalString(t){const e=new Uint8Array(t.length<<2);for(let r=0;r<t.length;r++)e[r<<2]=t.charCodeAt(r)>>>24,e[1+(r<<2)]=t.charCodeAt(r)>>>16,e[2+(r<<2)]=t.charCodeAt(r)>>>8,e[3+(r<<2)]=t.charCodeAt(r);this.value=e}get universalString(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("UniversalString cannot be constructed.");if(this.value.length%4)throw new s.ASN1Error("UniversalString encoded on non-mulitple of four bytes.");let t="";for(let e=0;e<this.value.length;e+=4)t+=String.fromCharCode((this.value[e+0]<<24)+(this.value[e+1]<<16)+(this.value[e+2]<<8)+(this.value[e+3]<<0));return t}set bmpString(t){const e=new Uint8Array(t.length<<1);for(let r=0,n=t.length;r<n;r++)e[r<<1]=t.charCodeAt(r)>>>8,e[1+(r<<1)]=t.charCodeAt(r);this.value=e}get bmpString(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("BMPString cannot be constructed.");if(this.value.length%2)throw new s.ASN1Error("BMPString encoded on non-mulitple of two bytes.");if("undefined"!=typeof TextEncoder)return new TextDecoder("utf-16be").decode(new Uint8Array(this.value));if(void 0!==t){const e=new Uint8Array(this.value.length);for(let t=0;t<this.value.length;t+=2)e[t]=this.value[t+1],e[t+1]=this.value[t];return t.from(e).toString("utf-16le")}throw new s.ASN1Error("Neither TextDecoder nor Buffer are defined to decode bytes into text.")}encode(t){switch(typeof t){case"undefined":this.value=new Uint8Array(0);break;case"boolean":this.tagNumber=a.ASN1UniversalType.boolean,this.boolean=t;break;case"number":Number.isInteger(t)?(this.tagNumber=a.ASN1UniversalType.integer,this.integer=t):(this.tagNumber=a.ASN1UniversalType.realNumber,this.real=t);break;case"string":this.tagNumber=a.ASN1UniversalType.utf8String,this.utf8String=t;break;case"object":if(t)if(t instanceof Uint8Array)this.tagNumber=a.ASN1UniversalType.octetString,this.octetString=t;else if(t instanceof o.ASN1Element)this.construction=a.ASN1Construction.constructed,this.sequence=[t];else if(t instanceof l.ObjectIdentifier)this.tagNumber=a.ASN1UniversalType.objectIdentifier,this.objectIdentifier=t;else if(Array.isArray(t))this.construction=a.ASN1Construction.constructed,this.tagNumber=a.ASN1UniversalType.sequence,this.sequence=t.map(t=>{const e=new f;return e.encode(t),e});else{if(!(t instanceof Date))throw new s.ASN1Error(`Cannot encode value of type ${t.constructor.name}.`);this.generalizedTime=t}else this.tagNumber=a.ASN1UniversalType.nill,this.value=new Uint8Array(0);break;default:throw new s.ASN1Error(`Cannot encode value of type ${typeof t}.`)}}static fromSequence(t){const e=new f(a.ASN1TagClass.universal,a.ASN1Construction.constructed,a.ASN1UniversalType.sequence);return e.sequence=t.filter(t=>Boolean(t)),e}static fromSet(t){const e=new f(a.ASN1TagClass.universal,a.ASN1Construction.constructed,a.ASN1UniversalType.set);return e.set=t.filter(t=>Boolean(t)),e}get inner(){if(this.construction!==a.ASN1Construction.constructed)throw new s.ASN1ConstructionError("An explicitly-encoded element cannot be encoded using primitive construction.");const t=new f,e=t.fromBytes(this.value);if(e!==this.value.length)throw new s.ASN1ConstructionError("An explicitly-encoding element contained more than one single encoded element. The tag number of the first decoded "+`element was ${t.tagNumber}, and it was encoded on `+`${e} bytes.`);return t}set inner(t){this.construction=a.ASN1Construction.constructed,this.value=t.toBytes()}constructor(t=a.ASN1TagClass.universal,e=a.ASN1Construction.primitive,r=a.ASN1UniversalType.endOfContent,n){super(),this.encode(n),this.tagClass=t,this.construction=e,this.tagNumber=r}fromBytes(t){if(t.length<2)throw new s.ASN1TruncationError("Tried to decode a DER element that is less than two bytes.");if(this.recursionCount+1>f.nestingRecursionLimit)throw new s.ASN1RecursionError;let e=0;switch(192&t[e]){case 0:this.tagClass=a.ASN1TagClass.universal;break;case 64:this.tagClass=a.ASN1TagClass.application;break;case 128:this.tagClass=a.ASN1TagClass.context;break;case 192:this.tagClass=a.ASN1TagClass.private;break;default:this.tagClass=a.ASN1TagClass.universal}if(this.construction=32&t[e]?a.ASN1Construction.constructed:a.ASN1Construction.primitive,this.tagNumber=31&t[e],e++,this.tagNumber>=31){if(128===t[e])throw new s.ASN1PaddingError("Leading padding byte on long tag number encoding.");this.tagNumber=0;const r=t.length-1>=4?4:t.length-1;for(;e<r&&128&t[e++];);if(128&t[e-1])throw r===t.length-1?new s.ASN1TruncationError("ASN.1 tag number appears to have been truncated."):new s.ASN1OverflowError("ASN.1 tag number too large.");for(let r=1;r<e;r++)this.tagNumber<<=7,this.tagNumber|=127&t[r];if(this.tagNumber<=31)throw new s.ASN1Error("ASN.1 tag number could have been encoded in short form.")}if(128==(128&t[e])){const r=127&t[e];if(127===r)throw new s.ASN1UndefinedError("Length byte with undefined meaning encountered.");if(r>4)throw new s.ASN1OverflowError("Element length too long to decode to an integer.");if(e+r>=t.length)throw new s.ASN1TruncationError("Element length bytes appear to have been truncated.");e++;const n=new Uint8Array(4);for(let i=r;i>0;i--)n[4-i]=t[e+r-i];let i=0;if(n.forEach(t=>{i<<=8,i+=t}),e+i<e)throw new s.ASN1OverflowError("ASN.1 element too large.");if((e+=r)+i>t.length)throw new s.ASN1TruncationError("ASN.1 element truncated.");if(i<=127&&i>=-128&&r>1||i<=32767&&i>=-32768&&r>2||i<=8388607&&i>=-8388608&&r>3)throw new s.ASN1PaddingError("DER-encoded long-form length encoded on more octets than necessary");return this.value=t.slice(e,e+i),e+i}{const r=127&t[e++];if(e+r>t.length)throw new s.ASN1TruncationError("ASN.1 element was truncated.");return this.value=t.slice(e,e+r),e+r}}toBytes(){let t=[0];if(t[0]|=this.tagClass<<6,t[0]|=this.construction<<5,this.tagNumber<31)t[0]|=this.tagNumber;else{t[0]|=31;let e=this.tagNumber;const r=[];for(;0!==e;)r.unshift(127&e),e>>>=7,r[0]|=128;r[r.length-1]&=127,t=t.concat(r)}let e=[0];if(this.value.length<127)e=[this.value.length];else{const t=this.value.length;e=[0,0,0,0];for(let r=0;r<4;r++)e[r]=t>>>(3-r<<3)&255;let r=0;for(let t=0;t<e.length-1;t++)0===e[t]&&r++;(e=e.slice(r)).unshift(128|e.length)}const r=new Uint8Array(t.length+e.length+this.value.length);return r.set(t,0),r.set(e,t.length),r.set(this.value,t.length+e.length),r}}e.DERElement=f}).call(this,r(3).Buffer)},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";e.byteLength=function(t){var e=c(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=c(t),s=n[0],a=n[1],u=new o(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),h=0,l=a>0?s-4:s;for(r=0;r<l;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],u[h++]=e>>16&255,u[h++]=e>>8&255,u[h++]=255&e;2===a&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,u[h++]=255&e);1===a&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,u[h++]=e>>8&255,u[h++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=0,a=r-i;s<a;s+=16383)o.push(h(t,s,s+16383>a?a:s+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)n[a]=s[a],i[s.charCodeAt(a)]=a;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function h(t,e,r){for(var i,o,s=[],a=e;a<r;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,c=u>>1,h=-7,l=r?i-1:0,f=r?-1:1,g=t[e+l];for(l+=f,o=g&(1<<-h)-1,g>>=-h,h+=a;h>0;o=256*o+t[e+l],l+=f,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[e+l],l+=f,h-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(g?-1:1);s+=Math.pow(2,n),o-=c}return(g?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,c=8*o-i-1,h=(1<<c)-1,l=h>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:o-1,d=n?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?f/u:f*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=h?(a=0,s=h):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+g]=255&a,g+=d,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;t[r+g]=255&s,g+=d,s/=256,c-=8);t[r+g-d]|=128*p}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const i=r(2),o=n(r(0)),s=r(4),a=r(1);class u extends i.ASN1Element{validateTag(t,e,r){return t.includes(this.tagClass)?e.includes(this.construction)?r.includes(this.tagNumber)?0:-3:-2:-1}set integer(t){if(t<a.MIN_SINT_32)throw new o.ASN1OverflowError(`Number ${t} too small to be converted.`);if(t>a.MAX_SINT_32)throw new o.ASN1OverflowError(`Number ${t} too big to be converted.`);return t<=127&&t>=-128?void(this.value=new Uint8Array([255&t])):t<=32767&&t>=-32768?void(this.value=new Uint8Array([t>>8&255,255&t])):t<=8388607&&t>=-8388608?void(this.value=new Uint8Array([t>>16&255,t>>8&255,255&t])):void(this.value=new Uint8Array([t>>24&255,t>>16&255,t>>8&255,255&t]))}get integer(){if(this.construction!==a.ASN1Construction.primitive)throw new o.ASN1ConstructionError("INTEGER cannot be constructed.");if(0===this.value.length)throw new o.ASN1SizeError("Number encoded on zero bytes!");if(this.value.length>4)throw new o.ASN1OverflowError("Number too long to decode.");if(this.value.length>2&&(255===this.value[0]&&this.value[1]>=128||0===this.value[0]&&this.value[1]<128))throw new o.ASN1PaddingError("Unnecessary padding bytes on INTEGER or ENUMERATED.");return i.ASN1Element.decodeSignedBigEndianInteger(this.value.subarray(0))}set objectIdentifier(t){const e=t.nodes,r=[40*e[0]+e[1]],n=u.encodeObjectIdentifierNodes(e.slice(2));this.value=new Uint8Array(r.concat(n))}get objectIdentifier(){if(this.construction!==a.ASN1Construction.primitive)throw new o.ASN1ConstructionError("OBJECT IDENTIFIER cannot be constructed.");if(0===this.value.length)throw new o.ASN1TruncationError("Encoded value was too short to be an OBJECT IDENTIFIER!");let t=[0,0];return this.value[0]>=80?(t[0]=2,t[1]=this.value[0]-80):this.value[0]>=40?(t[0]=1,t[1]=this.value[0]-40):(t[0]=0,t[1]=this.value[0]),1===this.value.length?new s.ObjectIdentifier(t):(t=t.concat(u.decodeObjectIdentifierNodes(this.value.slice(1))),new s.ObjectIdentifier(t))}set enumerated(t){this.integer=t}get enumerated(){return this.integer}set relativeObjectIdentifier(t){this.value=new Uint8Array(u.encodeObjectIdentifierNodes(t))}get relativeObjectIdentifier(){if(this.construction!==a.ASN1Construction.primitive)throw new o.ASN1ConstructionError("Relative OID cannot be constructed.");return u.decodeObjectIdentifierNodes(this.value.slice(0))}static decodeObjectIdentifierNodes(t){if(0===t.length)return[];const e=[];if(t.length>0&&128==(128&t[t.length-1]))throw new o.ASN1TruncationError("OID truncated");let r=0;t.forEach(t=>{128&t||r++}),e.length=r;let n=0,i=0;return t.forEach(t=>{if(0===i&&128===t)throw new o.ASN1PaddingError("OID had invalid padding byte.");if(e[n]>Number.MAX_SAFE_INTEGER>>>7)throw new o.ASN1OverflowError("OID node too big");e[n]<<=7,e[n]|=127&t,128&t?i++:(n++,i=0)}),e}static encodeObjectIdentifierNodes(t){let e=[];for(let r=0;r<t.length;r++){let n=t[r];if(n<128){e.push(n);continue}const i=[];for(;0!==n;){const t=[255&n,n>>>8&255,n>>>16&255,n>>>24&255];0==(128&t[0])&&(t[0]|=128),i.unshift(t[0]),n>>=7}i[i.length-1]&=127,e=e.concat(i)}return e}static isInCanonicalOrder(t){let e=null,r=null;return!!t.every(t=>!(null!==e&&t.tagClass!==e&&a.CANONICAL_TAG_CLASS_ORDERING.indexOf(t.tagClass)<=a.CANONICAL_TAG_CLASS_ORDERING.indexOf(e))&&(t.tagClass!==e&&(r=null),!(null!==r&&t.tagNumber<r)&&(e=t.tagClass,r=t.tagNumber,!0)))}static isUniquelyTagged(t){const e={};for(let r=0;r<t.length;r++){const n=`${t[r].tagClass}.${t[r].tagNumber}`;if(n in e)return!1;e[n]=null}return!0}}e.X690Element=u},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});const n=r(0);e.default=function(e,r="utf-8"){if("undefined"!=typeof TextEncoder)return new TextDecoder(r).decode(e.buffer);if(void 0!==t)return t.from(e).toString(r);throw new n.ASN1Error("Neither TextDecoder nor Buffer are defined to decode bytes into text.")}}).call(this,r(3).Buffer)},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});const n=r(0);e.default=function(e,r="utf-8"){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);if(void 0!==t)return t.from(e,r);throw new n.ASN1Error("Neither TextEncoder nor Buffer are defined to encode text into bytes.")}}).call(this,r(3).Buffer)}]);
var n=r(9),i=r(10),o=r(11);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return c(this,t,e,r)}function c(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=f(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(e,r),i=(t=a(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(u.isBuffer(e)){var r=0|g(e.length);return 0===(t=a(t,r)).length?t:(e.copy(t,0,0,r),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?a(t,0):f(t,e);if("Buffer"===e.type&&o(e.data))return f(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,e){if(h(e),t=a(t,e<0?0:0|g(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function f(t,e){var r=e.length<0?0:0|g(e.length);t=a(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function g(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function d(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Y(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(t).length;default:if(n)return Y(t).length;e=(""+e).toLowerCase(),n=!0}}function p(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return O(this,e,r);case"utf8":case"utf-8":return T(this,e,r);case"ascii":return U(this,e,r);case"latin1":case"binary":return _(this,e,r);case"base64":return C(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function S(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function w(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,i){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=r;o<a;o++)if(c(t,o)===c(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var l=!0,f=0;f<u;f++)if(c(t,o+f)!==c(e,f)){l=!1;break}if(l)return o}return-1}function A(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[r+s]=a}return s}function b(t,e,r,n){return k(Y(e,t.length-r),t,r,n)}function y(t,e,r,n){return k(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function N(t,e,r,n){return y(t,e,r,n)}function m(t,e,r,n){return k(G(e),t,r,n)}function E(t,e,r,n){return k(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function C(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function T(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,a,u,c=t[i],h=null,l=c>239?4:c>223?3:c>191?2:1;if(i+l<=r)switch(l){case 1:c<128&&(h=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(h=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,l=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=l}return function(t){var e=t.length;if(e<=R)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=R));return r}(n)}e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=s(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,r){return c(null,t,e,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,r){return function(t,e,r,n){return h(e),e<=0?a(t,e):void 0!==r?"string"==typeof n?a(t,e).fill(r,n):a(t,e).fill(r):a(t,e)}(null,t,e,r)},u.allocUnsafe=function(t){return l(null,t)},u.allocUnsafeSlow=function(t){return l(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var s=t[r];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},u.byteLength=d,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)S(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)S(this,e,e+3),S(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)S(this,e,e+7),S(this,e+1,e+6),S(this,e+2,e+5),S(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?T(this,0,t):p.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,r,n,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),a=Math.min(o,s),c=this.slice(n,i),h=t.slice(e,r),l=0;l<a;++l)if(c[l]!==h[l]){o=c[l],s=h[l];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return w(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return w(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return A(this,t,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":return y(this,t,e,r);case"latin1":case"binary":return N(this,t,e,r);case"base64":return m(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var R=4096;function U(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function _(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function O(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=z(t[o]);return i}function I(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function B(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function x(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function D(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function M(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function $(t,e,r,n,o){return o||M(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function j(t,e,r,n,o){return o||M(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=u.prototype;else{var i=e-t;r=new u(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},u.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||B(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||B(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUInt8=function(t,e){return e||B(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||B(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||B(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||B(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||B(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||B(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||B(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||B(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||B(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||B(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||B(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||B(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||B(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||B(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||B(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||B(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||P(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||P(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):x(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):x(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):D(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);P(this,t,e,r,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);P(this,t,e,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):x(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):x(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):D(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||P(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):D(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return $(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return $(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return j(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return j(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=u.isBuffer(t)?t:Y(new u(t,n).toString()),a=s.length;for(o=0;o<r-e;++o)this[o+e]=s[o%a]}return this};var L=/[^+\/0-9A-Za-z-_]/g;function z(t){return t<16?"0"+t.toString(16):t.toString(16)}function Y(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function G(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(L,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function k(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(8))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.ObjectIdentifier=class{constructor(t){if(t.length<2)throw new Error("Cannot construct an OID with less than two nodes!");if(t.length>=1&&!(t[0]in[0,1,2]))throw new Error("OIDs first node must be 0, 1, or 2!");if(t[0]<2&&t[1]>39||2===t[0]&&t[1]>175)throw new Error("OID Node #2 cannot exceed 39 if node #1 is 0 or 1, and 175 "+`if node #1 is 2. Received these nodes: ${t}.`);t.forEach(t=>{if(t<0)throw new Error("OID node numbers cannot be negative!");if(t>Number.MAX_SAFE_INTEGER)throw new Error("OID number was too big!")}),this._nodes=t.slice(0)}get nodes(){return this._nodes.slice(0)}get dotDelimitedNotation(){return this._nodes.join(".")}toString(){return this.dotDelimitedNotation}}},function(t,e,r){t.exports=r(6)},function(t,e,r){"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),n(r(2)),n(r(7)),n(r(0)),n(r(4)),n(r(1))},function(t,e,r){"use strict";(function(t){var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(2),s=n(r(0)),a=r(1),u=r(12),c=i(r(13)),h=i(r(14)),l=r(4);class f extends u.X690Element{set boolean(t){this.value=new Uint8Array(1),this.value[0]=t?255:0}get boolean(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("BOOLEAN cannot be constructed.");if(1!==this.value.length)throw new s.ASN1SizeError("BOOLEAN not one byte");if(0!==this.value[0]&&255!==this.value[0])throw new s.ASN1Error("BOOLEAN must be encoded as 0xFF or 0x00.");return 0!==this.value[0]}set bitString(t){0===t.length&&(this.value=new Uint8Array(0));const e=[];e.length=(t.length>>>3)+(t.length%8?1:0)+1;for(let r=0;r<t.length;r++)!1!==t[r]&&(e[1+(r>>>3)]|=128>>>r%8);e[0]=8-t.length%8,8===e[0]&&(e[0]=0),this.value=new Uint8Array(e)}get bitString(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("BIT STRING cannot be constructed.");if(0===this.value.length)throw new s.ASN1Error("ASN.1 BIT STRING cannot be encoded on zero bytes!");if(1===this.value.length&&0!==this.value[0])throw new s.ASN1Error("ASN.1 BIT STRING encoded with deceptive first byte!");if(this.value[0]>7)throw new s.ASN1Error("First byte of an ASN.1 BIT STRING must be <= 7!");let t=[];for(let e=1;e<this.value.length;e++)t=t.concat([Boolean(128&this.value[e]),Boolean(64&this.value[e]),Boolean(32&this.value[e]),Boolean(16&this.value[e]),Boolean(8&this.value[e]),Boolean(4&this.value[e]),Boolean(2&this.value[e]),Boolean(1&this.value[e])]);return t.slice(t.length-this.value[0]).forEach(t=>{if(t)throw new s.ASN1Error("BIT STRING had a trailing set bit.")}),t.length-=this.value[0],t}set octetString(t){this.value=new Uint8Array(t)}get octetString(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("OCTET STRING cannot be constructed.");return new Uint8Array(this.value)}set objectDescriptor(t){this.graphicString=t}get objectDescriptor(){return this.graphicString}set real(t){0!==t?Number.isNaN(t)?this.value=new Uint8Array([a.ASN1SpecialRealValue.notANumber]):this.value=-0!==t?t!==1/0?t!==-1/0?h.default(String.fromCharCode(3)+t.toFixed(7)):new Uint8Array([a.ASN1SpecialRealValue.minusInfinity]):new Uint8Array([a.ASN1SpecialRealValue.plusInfinity]):new Uint8Array([a.ASN1SpecialRealValue.minusZero]):this.value=new Uint8Array(0)}get real(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("REAL cannot be constructed.");if(0===this.value.length)return 0;switch(192&this.value[0]){case 64:if(this.value[0]===a.ASN1SpecialRealValue.notANumber)return NaN;if(this.value[0]===a.ASN1SpecialRealValue.minusZero)return-0;if(this.value[0]===a.ASN1SpecialRealValue.plusInfinity)return 1/0;if(this.value[0]===a.ASN1SpecialRealValue.minusInfinity)return-1/0;throw new s.ASN1UndefinedError("Unrecognized special REAL value!");case 0:{const t=c.default(this.value.slice(1));switch(63&this.value[0]){case 1:case 2:throw new s.ASN1Error("DER prohibits NR1 and NR2 Base-10 REAL");case 3:if(!a.nr3Regex.test(t))throw new s.ASN1Error("Malformed NR3 Base-10 REAL");return parseFloat(t.replace(",","."));default:throw new s.ASN1UndefinedError("Undefined Base-10 REAL encoding.")}}case 128:case 192:{const t=64&this.value[0]?-1:1,e=(t=>{switch(this.value[0]&48){case a.ASN1RealEncodingBase.base2:return 2;case a.ASN1RealEncodingBase.base8:return 8;case a.ASN1RealEncodingBase.base16:return 16;default:throw new s.ASN1Error("Impossible REAL encoding base encountered.")}})(),r=(t=>{switch(this.value[0]&12){case a.ASN1RealEncodingScale.scale0:return 0;case a.ASN1RealEncodingScale.scale1:return 1;case a.ASN1RealEncodingScale.scale2:return 2;case a.ASN1RealEncodingScale.scale3:return 3;default:throw new s.ASN1Error("Impossible REAL encoding scale encountered.")}})();let n,i;switch(3&this.value[0]){case 0:if(this.value.length<3)throw new s.ASN1TruncationError("Binary-encoded REAL truncated.");n=o.ASN1Element.decodeSignedBigEndianInteger(this.value.subarray(1,2)),i=o.ASN1Element.decodeUnsignedBigEndianInteger(this.value.subarray(2));break;case 1:if(this.value.length<4)throw new s.ASN1TruncationError("Binary-encoded REAL truncated.");if(n=o.ASN1Element.decodeSignedBigEndianInteger(this.value.subarray(1,3)),i=o.ASN1Element.decodeUnsignedBigEndianInteger(this.value.subarray(3)),n<=127&&n>=-128)throw new s.ASN1Error("DER-encoded binary-encoded REAL could have encoded exponent on fewer octets.");break;case 2:case 3:throw new s.ASN1Error("DER-encoded binary REAL encoded in a way that would either overflow or encode on too many octets.");default:throw new s.ASN1Error("Impossible binary REAL exponent encoding encountered.")}if(0!==i&&!(i%2))throw new s.ASN1Error("DER-encoded REAL may not have an even non-zero mantissa.");return t*i*Math.pow(2,r)*Math.pow(e,n)}default:throw new s.ASN1Error("Impossible REAL format encountered.")}}set utf8String(t){this.value=h.default(t)}get utf8String(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("UTF8String cannot be constructed.");return c.default(this.value)}set sequence(t){const e=[];t.forEach(t=>{e.push(t.toBytes())});let r=0;e.forEach(t=>{r+=t.length});const n=new Uint8Array(r);let i=0;e.forEach(t=>{n.set(t,i),i+=t.length}),this.value=n,this.construction=a.ASN1Construction.constructed}get sequence(){if(this.construction!==a.ASN1Construction.constructed)throw new s.ASN1ConstructionError("SET or SEQUENCE cannot be primitively constructed.");const t=[];if(0===this.value.length)return[];let e=0;for(;e<this.value.length;){const r=new f;e+=r.fromBytes(this.value.slice(e)),t.push(r)}return t}set set(t){this.sequence=t}get set(){return this.sequence}set numericString(t){for(let e=0;e<t.length;e++){const r=t.charCodeAt(e);if(!(r>=48&&r<=57||32===r))throw new s.ASN1CharactersError("NumericString can only contain characters 0 - 9 and space.")}this.value=h.default(t)}get numericString(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("NumericString cannot be constructed.");const t=c.default(this.value);for(let e=0;e<t.length;e++){const r=t.charCodeAt(e);if(!(r>=48&&r<=57||32===r))throw new s.ASN1CharactersError("NumericString can only contain characters 0 - 9 and space.")}return t}set printableString(t){for(let e=0;e<t.length;e++)if(-1===a.printableStringCharacters.indexOf(t.charAt(e)))throw new s.ASN1CharactersError(`PrintableString can only contain these characters: ${a.printableStringCharacters}`);this.value=h.default(t)}get printableString(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("PrintableString cannot be constructed.");const t=c.default(this.value);for(let e=0;e<t.length;e++)if(-1===a.printableStringCharacters.indexOf(t.charAt(e)))throw new s.ASN1CharactersError(`PrintableString can only contain these characters: ${a.printableStringCharacters}`);return t}set teletexString(t){this.value=new Uint8Array(t)}get teletexString(){return this.octetString}set videotexString(t){this.value=new Uint8Array(t)}get videotexString(){return this.octetString}set ia5String(t){this.value=h.default(t)}get ia5String(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("IA5String cannot be constructed.");return c.default(this.value)}set utcTime(t){let e=t.getUTCFullYear().toString();const r=`${e=e.substring(e.length-2,e.length)}${t.getUTCMonth()<9?`0${t.getUTCMonth()+1}`:`${t.getUTCMonth()+1}`}${t.getUTCDate()<10?`0${t.getUTCDate()}`:`${t.getUTCDate()}`}${t.getUTCHours()<10?`0${t.getUTCHours()}`:`${t.getUTCHours()}`}${t.getUTCMinutes()<10?`0${t.getUTCMinutes()}`:`${t.getUTCMinutes()}`}${t.getUTCSeconds()<10?`0${t.getUTCSeconds()}`:`${t.getUTCSeconds()}`}Z`;this.value=h.default(r)}get utcTime(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("UTCTime cannot be constructed.");const t=c.default(this.value),e=a.utcTimeRegex.exec(t);if(null===e)throw new s.ASN1Error("Malformed UTCTime string.");const r=new Date;let n=Number(e[1]);n=n<70?2e3+n:1900+n;const i=Number(e[2])-1,o=Number(e[3]),u=Number(e[4]),h=Number(e[5]),l=Number(e[6]);return f.validateDateTime("UTCTime",n,i,o,u,h,l),r.setUTCFullYear(n),r.setUTCMonth(i),r.setUTCDate(o),r.setUTCHours(u),r.setUTCMinutes(h),r.setUTCSeconds(l),r}set generalizedTime(t){const e=`${t.getUTCFullYear().toString()}${t.getUTCMonth()<9?`0${t.getUTCMonth()+1}`:`${t.getUTCMonth()+1}`}${t.getUTCDate()<10?`0${t.getUTCDate()}`:`${t.getUTCDate()}`}${t.getUTCHours()<10?`0${t.getUTCHours()}`:`${t.getUTCHours()}`}${t.getUTCMinutes()<10?`0${t.getUTCMinutes()}`:`${t.getUTCMinutes()}`}${t.getUTCSeconds()<10?`0${t.getUTCSeconds()}`:`${t.getUTCSeconds()}`}Z`;this.value=h.default(e)}get generalizedTime(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("GeneralizedTime cannot be constructed.");const t=c.default(this.value),e=a.generalizedTimeRegex.exec(t);if(null===e)throw new s.ASN1Error("Malformed GeneralizedTime string.");const r=new Date,n=Number(e[1]),i=Number(e[2])-1,o=Number(e[3]),u=Number(e[4]),h=Number(e[5]),l=Number(e[6]);return f.validateDateTime("GeneralizedTime",n,i,o,u,h,l),r.setUTCFullYear(n),r.setUTCMonth(i),r.setUTCDate(o),r.setUTCHours(u),r.setUTCMinutes(h),r.setUTCSeconds(l),r}set graphicString(t){for(let e=0;e<t.length;e++){const r=t.charCodeAt(e);if(r<32||r>126)throw new s.ASN1CharactersError("GraphicString, VisibleString, or ObjectDescriptor can only contain characters between 0x20 and 0x7E.")}this.value=h.default(t)}get graphicString(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("GraphicString cannot be constructed.");const t=c.default(this.value);for(let e=0;e<t.length;e++){const r=t.charCodeAt(e);if(r<32||r>126)throw new s.ASN1CharactersError("GraphicString, VisibleString, or ObjectDescriptor can only contain characters between 0x20 and 0x7E."+` Buffer: ${this.value.join(":")}`)}return t}set visibleString(t){this.graphicString=t}get visibleString(){return this.graphicString}set generalString(t){for(let e=0;e<t.length;e++)if(t.charCodeAt(e)>127)throw new s.ASN1CharactersError("GeneralString can only contain ASCII characters.");this.value=h.default(t)}get generalString(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("GeneralString cannot be constructed.");const t=c.default(this.value);for(let e=0;e<t.length;e++)if(t.charCodeAt(e)>127)throw new s.ASN1CharactersError("GeneralString can only contain ASCII characters.");return t}set universalString(t){const e=new Uint8Array(t.length<<2);for(let r=0;r<t.length;r++)e[r<<2]=t.charCodeAt(r)>>>24,e[1+(r<<2)]=t.charCodeAt(r)>>>16,e[2+(r<<2)]=t.charCodeAt(r)>>>8,e[3+(r<<2)]=t.charCodeAt(r);this.value=e}get universalString(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("UniversalString cannot be constructed.");if(this.value.length%4)throw new s.ASN1Error("UniversalString encoded on non-mulitple of four bytes.");let t="";for(let e=0;e<this.value.length;e+=4)t+=String.fromCharCode((this.value[e+0]<<24)+(this.value[e+1]<<16)+(this.value[e+2]<<8)+(this.value[e+3]<<0));return t}set bmpString(t){const e=new Uint8Array(t.length<<1);for(let r=0,n=t.length;r<n;r++)e[r<<1]=t.charCodeAt(r)>>>8,e[1+(r<<1)]=t.charCodeAt(r);this.value=e}get bmpString(){if(this.construction!==a.ASN1Construction.primitive)throw new s.ASN1ConstructionError("BMPString cannot be constructed.");if(this.value.length%2)throw new s.ASN1Error("BMPString encoded on non-mulitple of two bytes.");if("undefined"!=typeof TextEncoder)return new TextDecoder("utf-16be").decode(new Uint8Array(this.value));if(void 0!==t){const e=new Uint8Array(this.value.length);for(let t=0;t<this.value.length;t+=2)e[t]=this.value[t+1],e[t+1]=this.value[t];return t.from(e).toString("utf-16le")}throw new s.ASN1Error("Neither TextDecoder nor Buffer are defined to decode bytes into text.")}encode(t){switch(typeof t){case"undefined":this.value=new Uint8Array(0);break;case"boolean":this.tagNumber=a.ASN1UniversalType.boolean,this.boolean=t;break;case"number":Number.isInteger(t)?(this.tagNumber=a.ASN1UniversalType.integer,this.integer=t):(this.tagNumber=a.ASN1UniversalType.realNumber,this.real=t);break;case"string":this.tagNumber=a.ASN1UniversalType.utf8String,this.utf8String=t;break;case"object":if(t)if(t instanceof Uint8Array)this.tagNumber=a.ASN1UniversalType.octetString,this.octetString=t;else if(t instanceof o.ASN1Element)this.construction=a.ASN1Construction.constructed,this.sequence=[t];else if(t instanceof l.ObjectIdentifier)this.tagNumber=a.ASN1UniversalType.objectIdentifier,this.objectIdentifier=t;else if(Array.isArray(t))this.construction=a.ASN1Construction.constructed,this.tagNumber=a.ASN1UniversalType.sequence,this.sequence=t.map(t=>{const e=new f;return e.encode(t),e});else{if(!(t instanceof Date))throw new s.ASN1Error(`Cannot encode value of type ${t.constructor.name}.`);this.generalizedTime=t}else this.tagNumber=a.ASN1UniversalType.nill,this.value=new Uint8Array(0);break;default:throw new s.ASN1Error(`Cannot encode value of type ${typeof t}.`)}}static fromSequence(t){const e=new f(a.ASN1TagClass.universal,a.ASN1Construction.constructed,a.ASN1UniversalType.sequence);return e.sequence=t.filter(t=>Boolean(t)),e}static fromSet(t){const e=new f(a.ASN1TagClass.universal,a.ASN1Construction.constructed,a.ASN1UniversalType.set);return e.set=t.filter(t=>Boolean(t)),e}get inner(){if(this.construction!==a.ASN1Construction.constructed)throw new s.ASN1ConstructionError("An explicitly-encoded element cannot be encoded using primitive construction.");const t=new f,e=t.fromBytes(this.value);if(e!==this.value.length)throw new s.ASN1ConstructionError("An explicitly-encoding element contained more than one single encoded element. The tag number of the first decoded "+`element was ${t.tagNumber}, and it was encoded on `+`${e} bytes.`);return t}set inner(t){this.construction=a.ASN1Construction.constructed,this.value=t.toBytes()}constructor(t=a.ASN1TagClass.universal,e=a.ASN1Construction.primitive,r=a.ASN1UniversalType.endOfContent,n){super(),this.encode(n),this.tagClass=t,this.construction=e,this.tagNumber=r}fromBytes(t){if(t.length<2)throw new s.ASN1TruncationError("Tried to decode a DER element that is less than two bytes.");if(this.recursionCount+1>f.nestingRecursionLimit)throw new s.ASN1RecursionError;let e=0;switch(192&t[e]){case 0:this.tagClass=a.ASN1TagClass.universal;break;case 64:this.tagClass=a.ASN1TagClass.application;break;case 128:this.tagClass=a.ASN1TagClass.context;break;case 192:this.tagClass=a.ASN1TagClass.private;break;default:this.tagClass=a.ASN1TagClass.universal}if(this.construction=32&t[e]?a.ASN1Construction.constructed:a.ASN1Construction.primitive,this.tagNumber=31&t[e],e++,this.tagNumber>=31){if(128===t[e])throw new s.ASN1PaddingError("Leading padding byte on long tag number encoding.");this.tagNumber=0;const r=t.length-1>=4?4:t.length-1;for(;e<r&&128&t[e++];);if(128&t[e-1])throw r===t.length-1?new s.ASN1TruncationError("ASN.1 tag number appears to have been truncated."):new s.ASN1OverflowError("ASN.1 tag number too large.");for(let r=1;r<e;r++)this.tagNumber<<=7,this.tagNumber|=127&t[r];if(this.tagNumber<=31)throw new s.ASN1Error("ASN.1 tag number could have been encoded in short form.")}if(128==(128&t[e])){const r=127&t[e];if(127===r)throw new s.ASN1UndefinedError("Length byte with undefined meaning encountered.");if(r>4)throw new s.ASN1OverflowError("Element length too long to decode to an integer.");if(e+r>=t.length)throw new s.ASN1TruncationError("Element length bytes appear to have been truncated.");e++;const n=new Uint8Array(4);for(let i=r;i>0;i--)n[4-i]=t[e+r-i];let i=0;if(n.forEach(t=>{i<<=8,i+=t}),e+i<e)throw new s.ASN1OverflowError("ASN.1 element too large.");if((e+=r)+i>t.length)throw new s.ASN1TruncationError("ASN.1 element truncated.");if(i<=127&&i>=-128&&r>1||i<=32767&&i>=-32768&&r>2||i<=8388607&&i>=-8388608&&r>3)throw new s.ASN1PaddingError("DER-encoded long-form length encoded on more octets than necessary");return this.value=t.slice(e,e+i),e+i}{const r=127&t[e++];if(e+r>t.length)throw new s.ASN1TruncationError("ASN.1 element was truncated.");return this.value=t.slice(e,e+r),e+r}}toBytes(){let t=[0];if(t[0]|=this.tagClass<<6,t[0]|=this.construction<<5,this.tagNumber<31)t[0]|=this.tagNumber;else{t[0]|=31;let e=this.tagNumber;const r=[];for(;0!==e;)r.unshift(127&e),e>>>=7,r[0]|=128;r[r.length-1]&=127,t=t.concat(r)}let e=[0];if(this.value.length<127)e=[this.value.length];else{const t=this.value.length;e=[0,0,0,0];for(let r=0;r<4;r++)e[r]=t>>>(3-r<<3)&255;let r=0;for(let t=0;t<e.length-1;t++)0===e[t]&&r++;(e=e.slice(r)).unshift(128|e.length)}const r=new Uint8Array(t.length+e.length+this.value.length);return r.set(t,0),r.set(e,t.length),r.set(this.value,t.length+e.length),r}deconstruct(){return this.value.subarray(0)}}e.DERElement=f}).call(this,r(3).Buffer)},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";e.byteLength=function(t){var e=c(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=c(t),s=n[0],a=n[1],u=new o(function(t,e,r){return 3*(e+r)/4-r}(0,s,a)),h=0,l=a>0?s-4:s;for(r=0;r<l;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],u[h++]=e>>16&255,u[h++]=e>>8&255,u[h++]=255&e;2===a&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,u[h++]=255&e);1===a&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,u[h++]=e>>8&255,u[h++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=0,a=r-i;s<a;s+=16383)o.push(h(t,s,s+16383>a?a:s+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)n[a]=s[a],i[s.charCodeAt(a)]=a;function c(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function h(t,e,r){for(var i,o,s=[],a=e;a<r;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,c=u>>1,h=-7,l=r?i-1:0,f=r?-1:1,g=t[e+l];for(l+=f,o=g&(1<<-h)-1,g>>=-h,h+=a;h>0;o=256*o+t[e+l],l+=f,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[e+l],l+=f,h-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(g?-1:1);s+=Math.pow(2,n),o-=c}return(g?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,c=8*o-i-1,h=(1<<c)-1,l=h>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:o-1,d=n?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?f/u:f*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=h?(a=0,s=h):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+g]=255&a,g+=d,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;t[r+g]=255&s,g+=d,s/=256,c-=8);t[r+g-d]|=128*p}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e,r){"use strict";var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});const i=r(2),o=n(r(0)),s=r(4),a=r(1);class u extends i.ASN1Element{validateTag(t,e,r){return t.includes(this.tagClass)?e.includes(this.construction)?r.includes(this.tagNumber)?0:-3:-2:-1}set integer(t){if(t<a.MIN_SINT_32)throw new o.ASN1OverflowError(`Number ${t} too small to be converted.`);if(t>a.MAX_SINT_32)throw new o.ASN1OverflowError(`Number ${t} too big to be converted.`);return t<=127&&t>=-128?void(this.value=new Uint8Array([255&t])):t<=32767&&t>=-32768?void(this.value=new Uint8Array([t>>8&255,255&t])):t<=8388607&&t>=-8388608?void(this.value=new Uint8Array([t>>16&255,t>>8&255,255&t])):void(this.value=new Uint8Array([t>>24&255,t>>16&255,t>>8&255,255&t]))}get integer(){if(this.construction!==a.ASN1Construction.primitive)throw new o.ASN1ConstructionError("INTEGER cannot be constructed.");if(0===this.value.length)throw new o.ASN1SizeError("Number encoded on zero bytes!");if(this.value.length>4)throw new o.ASN1OverflowError("Number too long to decode.");if(this.value.length>2&&(255===this.value[0]&&this.value[1]>=128||0===this.value[0]&&this.value[1]<128))throw new o.ASN1PaddingError("Unnecessary padding bytes on INTEGER or ENUMERATED.");return i.ASN1Element.decodeSignedBigEndianInteger(this.value.subarray(0))}set objectIdentifier(t){const e=t.nodes,r=[40*e[0]+e[1]],n=u.encodeObjectIdentifierNodes(e.slice(2));this.value=new Uint8Array(r.concat(n))}get objectIdentifier(){if(this.construction!==a.ASN1Construction.primitive)throw new o.ASN1ConstructionError("OBJECT IDENTIFIER cannot be constructed.");if(0===this.value.length)throw new o.ASN1TruncationError("Encoded value was too short to be an OBJECT IDENTIFIER!");let t=[0,0];return this.value[0]>=80?(t[0]=2,t[1]=this.value[0]-80):this.value[0]>=40?(t[0]=1,t[1]=this.value[0]-40):(t[0]=0,t[1]=this.value[0]),1===this.value.length?new s.ObjectIdentifier(t):(t=t.concat(u.decodeObjectIdentifierNodes(this.value.slice(1))),new s.ObjectIdentifier(t))}set enumerated(t){this.integer=t}get enumerated(){return this.integer}set relativeObjectIdentifier(t){this.value=new Uint8Array(u.encodeObjectIdentifierNodes(t))}get relativeObjectIdentifier(){if(this.construction!==a.ASN1Construction.primitive)throw new o.ASN1ConstructionError("Relative OID cannot be constructed.");return u.decodeObjectIdentifierNodes(this.value.slice(0))}static decodeObjectIdentifierNodes(t){if(0===t.length)return[];const e=[];if(t.length>0&&128==(128&t[t.length-1]))throw new o.ASN1TruncationError("OID truncated");let r=0;t.forEach(t=>{128&t||r++}),e.length=r;let n=0,i=0;return t.forEach(t=>{if(0===i&&128===t)throw new o.ASN1PaddingError("OID had invalid padding byte.");if(e[n]>Number.MAX_SAFE_INTEGER>>>7)throw new o.ASN1OverflowError("OID node too big");e[n]<<=7,e[n]|=127&t,128&t?i++:(n++,i=0)}),e}static encodeObjectIdentifierNodes(t){let e=[];for(let r=0;r<t.length;r++){let n=t[r];if(n<128){e.push(n);continue}const i=[];for(;0!==n;){const t=[255&n,n>>>8&255,n>>>16&255,n>>>24&255];0==(128&t[0])&&(t[0]|=128),i.unshift(t[0]),n>>=7}i[i.length-1]&=127,e=e.concat(i)}return e}static isInCanonicalOrder(t){let e=null,r=null;return!!t.every(t=>!(null!==e&&t.tagClass!==e&&a.CANONICAL_TAG_CLASS_ORDERING.indexOf(t.tagClass)<=a.CANONICAL_TAG_CLASS_ORDERING.indexOf(e))&&(t.tagClass!==e&&(r=null),!(null!==r&&t.tagNumber<r)&&(e=t.tagClass,r=t.tagNumber,!0)))}static isUniquelyTagged(t){const e={};for(let r=0;r<t.length;r++){const n=`${t[r].tagClass}.${t[r].tagNumber}`;if(n in e)return!1;e[n]=null}return!0}}e.X690Element=u},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});const n=r(0);e.default=function(e,r="utf-8"){if("undefined"!=typeof TextEncoder)return new TextDecoder(r).decode(e.buffer);if(void 0!==t)return t.from(e).toString(r);throw new n.ASN1Error("Neither TextDecoder nor Buffer are defined to decode bytes into text.")}}).call(this,r(3).Buffer)},function(t,e,r){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});const n=r(0);e.default=function(e,r="utf-8"){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);if(void 0!==t)return t.from(e,r);throw new n.ASN1Error("Neither TextEncoder nor Buffer are defined to encode text into bytes.")}}).call(this,r(3).Buffer)}]);
export declare class ObjectIdentifier {
readonly _nodes: number[];
constructor(nodes: number[]);
readonly nodes: number[];
readonly dotDelimitedNotation: string;
get nodes(): number[];
get dotDelimitedNotation(): string;
toString(): string;
}
//# sourceMappingURL=objectidentifier.d.ts.map

@@ -6,6 +6,10 @@ import { ASN1Element } from "./asn1";

validateTag(permittedClasses: ASN1TagClass[], permittedConstruction: ASN1Construction[], permittedNumbers: number[]): number;
integer: number;
objectIdentifier: OID;
enumerated: number;
relativeObjectIdentifier: number[];
set integer(value: number);
get integer(): number;
set objectIdentifier(value: OID);
get objectIdentifier(): OID;
set enumerated(value: number);
get enumerated(): number;
set relativeObjectIdentifier(value: number[]);
get relativeObjectIdentifier(): number[];
protected static decodeObjectIdentifierNodes(value: Uint8Array): number[];

@@ -12,0 +16,0 @@ protected static encodeObjectIdentifierNodes(value: number[]): number[];

@@ -15,5 +15,5 @@ {

"devDependencies": {
"@babel/core": "^7.6.4",
"@babel/preset-env": "^7.6.3",
"@babel/preset-typescript": "^7.6.0",
"@babel/core": "^7.7.2",
"@babel/preset-env": "^7.7.1",
"@babel/preset-typescript": "^7.7.2",
"@types/node": "^12.11.1",

@@ -23,9 +23,9 @@ "@typescript-eslint/eslint-plugin": "^2.4.0",

"babel-jest": "^24.9.0",
"eslint": "^6.5.1",
"eslint": "^6.6.0",
"jest": "^24.9.0",
"jest-junit": "^7.0.0",
"ts-loader": "^6.2.0",
"typescript": "^3.6.4",
"ts-loader": "^6.2.1",
"typescript": "^3.7.2",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.8"
"webpack-cli": "^3.3.10"
},

@@ -61,3 +61,3 @@ "directories": {

"types": "./dist/index.d.ts",
"version": "2.5.1"
"version": "2.6.0"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc