asn1-ts 7.0.2 → 7.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/node/ConstructedElementSpecification.d.ts +11 -11
- package/dist/node/ConstructedElementSpecification.js +2 -2
- package/dist/node/asn1.d.ts +155 -155
- package/dist/node/asn1.js +438 -438
- package/dist/node/classes/ABSTRACT-SYNTAX.d.ts +14 -14
- package/dist/node/classes/ABSTRACT-SYNTAX.js +2 -2
- package/dist/node/classes/TYPE-IDENTIFIER.d.ts +13 -13
- package/dist/node/classes/TYPE-IDENTIFIER.js +2 -2
- package/dist/node/classes/index.d.ts +2 -2
- package/dist/node/classes/index.js +2 -2
- package/dist/node/codecs/ber/decoders/decodeBitString.d.ts +2 -2
- package/dist/node/codecs/ber/decoders/decodeBitString.js +32 -32
- package/dist/node/codecs/ber/decoders/decodeBoolean.d.ts +2 -2
- package/dist/node/codecs/ber/decoders/decodeBoolean.js +11 -11
- package/dist/node/codecs/ber/decoders/decodeDuration.d.ts +2 -2
- package/dist/node/codecs/ber/decoders/decodeDuration.js +68 -68
- package/dist/node/codecs/ber/decoders/decodeGeneralizedTime.d.ts +2 -2
- package/dist/node/codecs/ber/decoders/decodeGeneralizedTime.js +30 -30
- package/dist/node/codecs/ber/decoders/decodeReal.d.ts +2 -2
- package/dist/node/codecs/ber/decoders/decodeReal.js +112 -112
- package/dist/node/codecs/ber/decoders/decodeSequence.d.ts +3 -3
- package/dist/node/codecs/ber/decoders/decodeSequence.js +18 -18
- package/dist/node/codecs/ber/decoders/decodeUTCTime.d.ts +2 -2
- package/dist/node/codecs/ber/decoders/decodeUTCTime.js +31 -31
- package/dist/node/codecs/ber/encoders/encodeGeneralString.d.ts +2 -2
- package/dist/node/codecs/ber/encoders/encodeGeneralString.js +17 -17
- package/dist/node/codecs/ber/encoders/encodeGeneralString.js.map +1 -1
- package/dist/node/codecs/ber/encoders/encodeGraphicString.d.ts +2 -2
- package/dist/node/codecs/ber/encoders/encodeGraphicString.js +17 -17
- package/dist/node/codecs/ber/encoders/encodeGraphicString.js.map +1 -1
- package/dist/node/codecs/ber/encoders/encodeNumericString.d.ts +2 -2
- package/dist/node/codecs/ber/encoders/encodeNumericString.js +17 -17
- package/dist/node/codecs/ber/encoders/encodeNumericString.js.map +1 -1
- package/dist/node/codecs/ber/encoders/encodeObjectDescriptor.d.ts +2 -2
- package/dist/node/codecs/ber/encoders/encodeObjectDescriptor.js +17 -17
- package/dist/node/codecs/ber/encoders/encodeObjectDescriptor.js.map +1 -1
- package/dist/node/codecs/ber/encoders/encodePrintableString.d.ts +2 -2
- package/dist/node/codecs/ber/encoders/encodePrintableString.js +18 -18
- package/dist/node/codecs/ber/encoders/encodePrintableString.js.map +1 -1
- package/dist/node/codecs/ber/encoders/encodeVisibleString.d.ts +2 -2
- package/dist/node/codecs/ber/encoders/encodeVisibleString.js +17 -17
- package/dist/node/codecs/ber/encoders/encodeVisibleString.js.map +1 -1
- package/dist/node/codecs/ber.d.ts +66 -66
- package/dist/node/codecs/ber.d.ts.map +1 -1
- package/dist/node/codecs/ber.js +593 -602
- package/dist/node/codecs/ber.js.map +1 -1
- package/dist/node/codecs/cer/decoders/decodeSequence.d.ts +3 -3
- package/dist/node/codecs/cer/decoders/decodeSequence.js +18 -18
- package/dist/node/codecs/cer.d.ts +67 -67
- package/dist/node/codecs/cer.d.ts.map +1 -1
- package/dist/node/codecs/cer.js +608 -617
- package/dist/node/codecs/cer.js.map +1 -1
- package/dist/node/codecs/coer/decoders/decodeBoolean.d.ts +2 -2
- package/dist/node/codecs/coer/decoders/decodeBoolean.js +14 -14
- package/dist/node/codecs/der/decoders/decodeBitString.d.ts +2 -2
- package/dist/node/codecs/der/decoders/decodeBitString.js +36 -36
- package/dist/node/codecs/der/decoders/decodeBoolean.d.ts +2 -2
- package/dist/node/codecs/der/decoders/decodeBoolean.js +14 -14
- package/dist/node/codecs/der/decoders/decodeDuration.d.ts +2 -2
- package/dist/node/codecs/der/decoders/decodeDuration.js +71 -71
- package/dist/node/codecs/der/decoders/decodeGeneralizedTime.d.ts +2 -2
- package/dist/node/codecs/der/decoders/decodeGeneralizedTime.js +30 -30
- package/dist/node/codecs/der/decoders/decodeReal.d.ts +2 -2
- package/dist/node/codecs/der/decoders/decodeReal.js +99 -99
- package/dist/node/codecs/der/decoders/decodeSequence.d.ts +3 -3
- package/dist/node/codecs/der/decoders/decodeSequence.js +18 -18
- package/dist/node/codecs/der/decoders/decodeUTCTime.d.ts +2 -2
- package/dist/node/codecs/der/decoders/decodeUTCTime.js +31 -31
- package/dist/node/codecs/der.d.ts +65 -65
- package/dist/node/codecs/der.js +561 -561
- package/dist/node/codecs/der.js.map +1 -1
- package/dist/node/codecs/oer/decoders/decodeBoolean.d.ts +2 -2
- package/dist/node/codecs/oer/decoders/decodeBoolean.js +11 -11
- package/dist/node/codecs/x690/decoders/decodeCharacterString.d.ts +2 -2
- package/dist/node/codecs/x690/decoders/decodeCharacterString.js +33 -33
- package/dist/node/codecs/x690/decoders/decodeDate.d.ts +2 -2
- package/dist/node/codecs/x690/decoders/decodeDate.js +14 -14
- package/dist/node/codecs/x690/decoders/decodeDateTime.d.ts +2 -2
- package/dist/node/codecs/x690/decoders/decodeDateTime.js +17 -17
- package/dist/node/codecs/x690/decoders/decodeEmbeddedPDV.d.ts +2 -2
- package/dist/node/codecs/x690/decoders/decodeEmbeddedPDV.js +33 -33
- package/dist/node/codecs/x690/decoders/decodeExternal.d.ts +2 -2
- package/dist/node/codecs/x690/decoders/decodeExternal.js +71 -71
- package/dist/node/codecs/x690/decoders/decodeGeneralString.d.ts +2 -2
- package/dist/node/codecs/x690/decoders/decodeGeneralString.js +16 -16
- package/dist/node/codecs/x690/decoders/decodeGeneralString.js.map +1 -1
- package/dist/node/codecs/x690/decoders/decodeGraphicString.d.ts +2 -2
- package/dist/node/codecs/x690/decoders/decodeGraphicString.js +16 -16
- package/dist/node/codecs/x690/decoders/decodeGraphicString.js.map +1 -1
- package/dist/node/codecs/x690/decoders/decodeInteger.d.ts +2 -2
- package/dist/node/codecs/x690/decoders/decodeInteger.js +17 -17
- package/dist/node/codecs/x690/decoders/decodeNumericString.d.ts +2 -2
- package/dist/node/codecs/x690/decoders/decodeNumericString.js +16 -16
- package/dist/node/codecs/x690/decoders/decodeNumericString.js.map +1 -1
- package/dist/node/codecs/x690/decoders/decodeOIDIRI.d.ts +2 -2
- package/dist/node/codecs/x690/decoders/decodeOIDIRI.js +8 -8
- package/dist/node/codecs/x690/decoders/decodeObjectDescriptor.d.ts +2 -2
- package/dist/node/codecs/x690/decoders/decodeObjectDescriptor.js +16 -16
- package/dist/node/codecs/x690/decoders/decodeObjectDescriptor.js.map +1 -1
- package/dist/node/codecs/x690/decoders/decodeObjectIdentifier.d.ts +2 -2
- package/dist/node/codecs/x690/decoders/decodeObjectIdentifier.d.ts.map +1 -1
- package/dist/node/codecs/x690/decoders/decodeObjectIdentifier.js +43 -44
- package/dist/node/codecs/x690/decoders/decodeObjectIdentifier.js.map +1 -1
- package/dist/node/codecs/x690/decoders/decodePrintableString.d.ts +2 -2
- package/dist/node/codecs/x690/decoders/decodePrintableString.js +17 -17
- package/dist/node/codecs/x690/decoders/decodePrintableString.js.map +1 -1
- package/dist/node/codecs/x690/decoders/decodeRelativeOIDIRI.d.ts +2 -2
- package/dist/node/codecs/x690/decoders/decodeRelativeOIDIRI.js +8 -8
- package/dist/node/codecs/x690/decoders/decodeRelativeObjectIdentifier.d.ts +2 -2
- package/dist/node/codecs/x690/decoders/decodeRelativeObjectIdentifier.d.ts.map +1 -1
- package/dist/node/codecs/x690/decoders/decodeRelativeObjectIdentifier.js +25 -26
- package/dist/node/codecs/x690/decoders/decodeRelativeObjectIdentifier.js.map +1 -1
- package/dist/node/codecs/x690/decoders/decodeTime.d.ts +2 -2
- package/dist/node/codecs/x690/decoders/decodeTime.js +8 -8
- package/dist/node/codecs/x690/decoders/decodeTimeOfDay.d.ts +2 -2
- package/dist/node/codecs/x690/decoders/decodeTimeOfDay.js +18 -18
- package/dist/node/codecs/x690/decoders/decodeVisibleString.d.ts +2 -2
- package/dist/node/codecs/x690/decoders/decodeVisibleString.js +16 -16
- package/dist/node/codecs/x690/decoders/decodeVisibleString.js.map +1 -1
- package/dist/node/codecs/x690/encoders/encodeBitString.d.ts +2 -2
- package/dist/node/codecs/x690/encoders/encodeBitString.js +17 -17
- package/dist/node/codecs/x690/encoders/encodeBoolean.d.ts +2 -2
- package/dist/node/codecs/x690/encoders/encodeBoolean.js +6 -6
- package/dist/node/codecs/x690/encoders/encodeCharacterString.d.ts +2 -2
- package/dist/node/codecs/x690/encoders/encodeCharacterString.js +13 -13
- package/dist/node/codecs/x690/encoders/encodeDate.d.ts +2 -2
- package/dist/node/codecs/x690/encoders/encodeDate.js +15 -15
- package/dist/node/codecs/x690/encoders/encodeDateTime.d.ts +2 -2
- package/dist/node/codecs/x690/encoders/encodeDateTime.js +18 -18
- package/dist/node/codecs/x690/encoders/encodeDuration.d.ts +2 -2
- package/dist/node/codecs/x690/encoders/encodeDuration.js +77 -77
- package/dist/node/codecs/x690/encoders/encodeEmbeddedPDV.d.ts +2 -2
- package/dist/node/codecs/x690/encoders/encodeEmbeddedPDV.js +13 -13
- package/dist/node/codecs/x690/encoders/encodeExternal.d.ts +2 -2
- package/dist/node/codecs/x690/encoders/encodeExternal.js +40 -40
- package/dist/node/codecs/x690/encoders/encodeGeneralizedTime.d.ts +2 -2
- package/dist/node/codecs/x690/encoders/encodeGeneralizedTime.js +15 -15
- package/dist/node/codecs/x690/encoders/encodeGeneralizedTime.js.map +1 -1
- package/dist/node/codecs/x690/encoders/encodeInteger.d.ts +2 -2
- package/dist/node/codecs/x690/encoders/encodeInteger.js +7 -7
- package/dist/node/codecs/x690/encoders/encodeOIDIRI.d.ts +2 -2
- package/dist/node/codecs/x690/encoders/encodeOIDIRI.js +8 -8
- package/dist/node/codecs/x690/encoders/encodeObjectIdentifier.d.ts +2 -2
- package/dist/node/codecs/x690/encoders/encodeObjectIdentifier.d.ts.map +1 -1
- package/dist/node/codecs/x690/encoders/encodeObjectIdentifier.js +16 -17
- package/dist/node/codecs/x690/encoders/encodeObjectIdentifier.js.map +1 -1
- package/dist/node/codecs/x690/encoders/encodeReal.d.ts +2 -2
- package/dist/node/codecs/x690/encoders/encodeReal.js +8 -8
- package/dist/node/codecs/x690/encoders/encodeRelativeOIDIRI.d.ts +2 -2
- package/dist/node/codecs/x690/encoders/encodeRelativeOIDIRI.js +8 -8
- package/dist/node/codecs/x690/encoders/encodeRelativeObjectIdentifier.d.ts +2 -2
- package/dist/node/codecs/x690/encoders/encodeRelativeObjectIdentifier.d.ts.map +1 -1
- package/dist/node/codecs/x690/encoders/encodeRelativeObjectIdentifier.js +12 -13
- package/dist/node/codecs/x690/encoders/encodeRelativeObjectIdentifier.js.map +1 -1
- package/dist/node/codecs/x690/encoders/encodeSequence.d.ts +3 -3
- package/dist/node/codecs/x690/encoders/encodeSequence.d.ts.map +1 -1
- package/dist/node/codecs/x690/encoders/encodeSequence.js +6 -8
- package/dist/node/codecs/x690/encoders/encodeSequence.js.map +1 -1
- package/dist/node/codecs/x690/encoders/encodeTime.d.ts +2 -2
- package/dist/node/codecs/x690/encoders/encodeTime.js +8 -8
- package/dist/node/codecs/x690/encoders/encodeTimeOfDay.d.ts +2 -2
- package/dist/node/codecs/x690/encoders/encodeTimeOfDay.js +8 -8
- package/dist/node/codecs/x690/encoders/encodeUTCTime.d.ts +2 -2
- package/dist/node/codecs/x690/encoders/encodeUTCTime.js +16 -16
- package/dist/node/codecs/x690/encoders/encodeUTCTime.js.map +1 -1
- package/dist/node/codecs/x696/encoders/encodeBoolean.d.ts +2 -2
- package/dist/node/codecs/x696/encoders/encodeBoolean.js +6 -6
- package/dist/node/errors.d.ts +47 -47
- package/dist/node/errors.js +89 -89
- package/dist/node/errors.js.map +1 -1
- package/dist/node/functional.d.ts +148 -148
- package/dist/node/functional.d.ts.map +1 -1
- package/dist/node/functional.js +880 -886
- package/dist/node/functional.js.map +1 -1
- package/dist/node/index.d.ts +16 -17
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +26 -28
- package/dist/node/index.js.map +1 -1
- package/dist/node/interfaces/Byteable.d.ts +4 -4
- package/dist/node/interfaces/Byteable.js +2 -2
- package/dist/node/interfaces/CharacterValidationFunction.d.ts +3 -3
- package/dist/node/interfaces/CharacterValidationFunction.js +2 -2
- package/dist/node/interfaces/Debyteable.d.ts +3 -3
- package/dist/node/interfaces/Debyteable.js +2 -2
- package/dist/node/interfaces/Deelementable.d.ts +4 -4
- package/dist/node/interfaces/Deelementable.js +2 -2
- package/dist/node/interfaces/Destringable.d.ts +3 -3
- package/dist/node/interfaces/Destringable.js +2 -2
- package/dist/node/interfaces/Elementable.d.ts +4 -4
- package/dist/node/interfaces/Elementable.js +2 -2
- package/dist/node/interfaces/Enbyteable.d.ts +3 -3
- package/dist/node/interfaces/Enbyteable.js +2 -2
- package/dist/node/interfaces/Enelementable.d.ts +4 -4
- package/dist/node/interfaces/Enelementable.js +2 -2
- package/dist/node/interfaces/Enstringable.d.ts +3 -3
- package/dist/node/interfaces/Enstringable.js +2 -2
- package/dist/node/interfaces/Identified.d.ts +4 -4
- package/dist/node/interfaces/Identified.js +2 -2
- package/dist/node/interfaces/Long.d.ts +3 -3
- package/dist/node/interfaces/Long.js +2 -2
- package/dist/node/interfaces/Named.d.ts +3 -3
- package/dist/node/interfaces/Named.js +2 -2
- package/dist/node/interfaces/Stringable.d.ts +4 -4
- package/dist/node/interfaces/Stringable.js +2 -2
- package/dist/node/interfaces/index.d.ts +12 -12
- package/dist/node/interfaces/index.js +2 -2
- package/dist/node/macros.d.ts +59 -59
- package/dist/node/macros.js +21 -21
- package/dist/node/types/CharacterString.d.ts +8 -8
- package/dist/node/types/CharacterString.js +21 -21
- package/dist/node/types/EmbeddedPDV.d.ts +8 -8
- package/dist/node/types/EmbeddedPDV.js +21 -21
- package/dist/node/types/External.d.ts +11 -11
- package/dist/node/types/External.js +58 -58
- package/dist/node/types/ObjectIdentifier.d.ts +12 -12
- package/dist/node/types/ObjectIdentifier.js +70 -70
- package/dist/node/types/ObjectIdentifier.js.map +1 -1
- package/dist/node/types/TypeIdentifier.d.ts +7 -7
- package/dist/node/types/TypeIdentifier.js +9 -9
- package/dist/node/types/index.d.ts +18 -18
- package/dist/node/types/index.js +42 -42
- package/dist/node/types/time/DATE-ENCODING.d.ts +7 -7
- package/dist/node/types/time/DATE-ENCODING.js +14 -14
- package/dist/node/types/time/DURATION-EQUIVALENT.d.ts +20 -20
- package/dist/node/types/time/DURATION-EQUIVALENT.js +89 -89
- package/dist/node/types/time/DURATION-INTERVAL-ENCODING.d.ts +18 -18
- package/dist/node/types/time/DURATION-INTERVAL-ENCODING.js +46 -46
- package/dist/node/types/time/HOURS-DIFF-ENCODING.d.ts +6 -6
- package/dist/node/types/time/HOURS-DIFF-ENCODING.js +13 -13
- package/dist/node/types/time/HOURS-ENCODING.d.ts +5 -5
- package/dist/node/types/time/HOURS-ENCODING.js +11 -11
- package/dist/node/types/time/HOURS-MINUTES-DIFF-ENCODING.d.ts +7 -7
- package/dist/node/types/time/HOURS-MINUTES-DIFF-ENCODING.js +15 -15
- package/dist/node/types/time/HOURS-MINUTES-ENCODING.d.ts +6 -6
- package/dist/node/types/time/HOURS-MINUTES-ENCODING.js +13 -13
- package/dist/node/types/time/TIME-OF-DAY-DIFF-ENCODING.d.ts +8 -8
- package/dist/node/types/time/TIME-OF-DAY-DIFF-ENCODING.js +17 -17
- package/dist/node/types/time/TIME-OF-DAY-ENCODING.d.ts +7 -7
- package/dist/node/types/time/TIME-OF-DAY-ENCODING.js +15 -15
- package/dist/node/types/time/TIME-OF-DAY-FRACTION-DIFF-ENCODING.d.ts +9 -9
- package/dist/node/types/time/TIME-OF-DAY-FRACTION-DIFF-ENCODING.js +19 -19
- package/dist/node/types/time/TIME-OF-DAY-FRACTION-ENCODING.d.ts +8 -8
- package/dist/node/types/time/TIME-OF-DAY-FRACTION-ENCODING.js +17 -17
- package/dist/node/types/time/YEAR-ENCODING.d.ts +5 -5
- package/dist/node/types/time/YEAR-ENCODING.js +8 -8
- package/dist/node/types/time/YEAR-MONTH-ENCODING.d.ts +6 -6
- package/dist/node/types/time/YEAR-MONTH-ENCODING.js +12 -12
- package/dist/node/utils/base128Length.d.ts +1 -1
- package/dist/node/utils/base128Length.js +6 -6
- package/dist/node/utils/base256Length.d.ts +1 -1
- package/dist/node/utils/base256Length.js +6 -6
- package/dist/node/utils/bigint.d.ts +4 -4
- package/dist/node/utils/bigint.js +125 -125
- package/dist/node/utils/compareSetOfElementsCanonically.d.ts +2 -2
- package/dist/node/utils/compareSetOfElementsCanonically.js +16 -16
- package/dist/node/utils/convertBytesToText.d.ts +1 -1
- package/dist/node/utils/convertBytesToText.js +13 -13
- package/dist/node/utils/convertTextToBytes.d.ts +1 -1
- package/dist/node/utils/convertTextToBytes.js +13 -13
- package/dist/node/utils/decodeBase128.d.ts +1 -1
- package/dist/node/utils/decodeBase128.js +23 -23
- package/dist/node/utils/decodeIEEE754DoublePrecisionFloat.d.ts +1 -1
- package/dist/node/utils/decodeIEEE754DoublePrecisionFloat.js +6 -6
- package/dist/node/utils/decodeIEEE754SinglePrecisionFloat.d.ts +1 -1
- package/dist/node/utils/decodeIEEE754SinglePrecisionFloat.js +6 -6
- package/dist/node/utils/decodeSignedBigEndianInteger.d.ts +1 -1
- package/dist/node/utils/decodeSignedBigEndianInteger.js +19 -19
- package/dist/node/utils/decodeSignedBigEndianInteger.js.map +1 -1
- package/dist/node/utils/decodeUnsignedBigEndianInteger.d.ts +1 -1
- package/dist/node/utils/decodeUnsignedBigEndianInteger.js +16 -16
- package/dist/node/utils/decodeUnsignedBigEndianInteger.js.map +1 -1
- package/dist/node/utils/decodeX690RealNumber.d.ts +1 -1
- package/dist/node/utils/decodeX690RealNumber.js +112 -112
- package/dist/node/utils/dissectFloat.d.ts +5 -5
- package/dist/node/utils/dissectFloat.js +16 -16
- package/dist/node/utils/encodeBase128.d.ts +1 -1
- package/dist/node/utils/encodeBase128.js +26 -26
- package/dist/node/utils/encodeIEEE754DoublePrecisionFloat.d.ts +1 -1
- package/dist/node/utils/encodeIEEE754DoublePrecisionFloat.js +6 -6
- package/dist/node/utils/encodeIEEE754SinglePrecisionFloat.d.ts +1 -1
- package/dist/node/utils/encodeIEEE754SinglePrecisionFloat.js +6 -6
- package/dist/node/utils/encodeSignedBigEndianInteger.d.ts +1 -1
- package/dist/node/utils/encodeSignedBigEndianInteger.js +40 -40
- package/dist/node/utils/encodeUnsignedBigEndianInteger.d.ts +1 -1
- package/dist/node/utils/encodeUnsignedBigEndianInteger.js +25 -25
- package/dist/node/utils/encodeX690Base10RealNumber.d.ts +1 -1
- package/dist/node/utils/encodeX690Base10RealNumber.js +25 -25
- package/dist/node/utils/encodeX690BinaryRealNumber.d.ts +1 -1
- package/dist/node/utils/encodeX690BinaryRealNumber.js +47 -47
- package/dist/node/utils/getBitFromBase128.d.ts +1 -1
- package/dist/node/utils/getBitFromBase128.js +7 -7
- package/dist/node/utils/getBitFromBase256.d.ts +1 -1
- package/dist/node/utils/getBitFromBase256.js +6 -6
- package/dist/node/utils/index.d.ts +25 -25
- package/dist/node/utils/index.js +56 -56
- package/dist/node/utils/isInCanonicalOrder.d.ts +2 -2
- package/dist/node/utils/isInCanonicalOrder.js +22 -22
- package/dist/node/utils/isUniquelyTagged.d.ts +2 -2
- package/dist/node/utils/isUniquelyTagged.js +14 -14
- package/dist/node/utils/packBits.d.ts +2 -2
- package/dist/node/utils/packBits.js +15 -15
- package/dist/node/utils/setBitInBase128.d.ts +1 -1
- package/dist/node/utils/setBitInBase128.js +12 -12
- package/dist/node/utils/setBitInBase256.d.ts +1 -1
- package/dist/node/utils/setBitInBase256.js +12 -12
- package/dist/node/utils/sortCanonically.d.ts +2 -2
- package/dist/node/utils/sortCanonically.js +18 -18
- package/dist/node/utils/splitBytesByContinuationBit.d.ts +1 -1
- package/dist/node/utils/splitBytesByContinuationBit.js +13 -13
- package/dist/node/utils/splitOctetsCanonically.d.ts +1 -1
- package/dist/node/utils/splitOctetsCanonically.js +8 -8
- package/dist/node/utils/trimLeadingPaddingBytes.d.ts +1 -1
- package/dist/node/utils/trimLeadingPaddingBytes.js +18 -18
- package/dist/node/utils/unpackBits.d.ts +2 -2
- package/dist/node/utils/unpackBits.js +15 -15
- package/dist/node/validators/datetimeComponentValidator.d.ts +2 -2
- package/dist/node/validators/datetimeComponentValidator.js +18 -18
- package/dist/node/validators/index.d.ts +6 -6
- package/dist/node/validators/index.js +18 -18
- package/dist/node/validators/isGeneralCharacter.d.ts +1 -1
- package/dist/node/validators/isGeneralCharacter.js +6 -6
- package/dist/node/validators/isGraphicCharacter.d.ts +1 -1
- package/dist/node/validators/isGraphicCharacter.js +6 -6
- package/dist/node/validators/isNumericCharacter.d.ts +1 -1
- package/dist/node/validators/isNumericCharacter.js +6 -6
- package/dist/node/validators/isObjectDescriptorCharacter.d.ts +1 -1
- package/dist/node/validators/isObjectDescriptorCharacter.js +8 -8
- package/dist/node/validators/isPrintableCharacter.d.ts +1 -1
- package/dist/node/validators/isPrintableCharacter.js +12 -12
- package/dist/node/validators/isVisibleCharacter.d.ts +1 -1
- package/dist/node/validators/isVisibleCharacter.js +8 -8
- package/dist/node/validators/validateConstruction.d.ts +3 -3
- package/dist/node/validators/validateConstruction.js +41 -41
- package/dist/node/validators/validateDate.d.ts +1 -1
- package/dist/node/validators/validateDate.js +44 -44
- package/dist/node/validators/validateDateTime.d.ts +1 -1
- package/dist/node/validators/validateDateTime.js +10 -10
- package/dist/node/validators/validateTime.d.ts +1 -1
- package/dist/node/validators/validateTime.js +16 -16
- package/dist/node/values.d.ts +88 -88
- package/dist/node/values.js +110 -110
- package/dist/node/x690.d.ts +24 -24
- package/dist/node/x690.js +99 -99
- package/package.json +1 -1
- package/dist/node/utils/concatenateBytes.d.ts +0 -2
- package/dist/node/utils/concatenateBytes.d.ts.map +0 -1
- package/dist/node/utils/concatenateBytes.js +0 -19
- package/dist/node/utils/concatenateBytes.js.map +0 -1
package/dist/node/codecs/der.js
CHANGED
|
@@ -1,562 +1,562 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const asn1_1 = (0, tslib_1.__importDefault)(require("../asn1"));
|
|
5
|
-
const errors = (0, tslib_1.__importStar)(require("../errors"));
|
|
6
|
-
const values_1 = require("../values");
|
|
7
|
-
const convertBytesToText_1 = (0, tslib_1.__importDefault)(require("../utils/convertBytesToText"));
|
|
8
|
-
const convertTextToBytes_1 = (0, tslib_1.__importDefault)(require("../utils/convertTextToBytes"));
|
|
9
|
-
const sortCanonically_1 = (0, tslib_1.__importDefault)(require("../utils/sortCanonically"));
|
|
10
|
-
const ObjectIdentifier_1 = (0, tslib_1.__importDefault)(require("../types/ObjectIdentifier"));
|
|
11
|
-
const encodeBoolean_1 = (0, tslib_1.__importDefault)(require("./x690/encoders/encodeBoolean"));
|
|
12
|
-
const decodeBoolean_1 = (0, tslib_1.__importDefault)(require("./der/decoders/decodeBoolean"));
|
|
13
|
-
const encodeBitString_1 = (0, tslib_1.__importDefault)(require("./x690/encoders/encodeBitString"));
|
|
14
|
-
const decodeBitString_1 = (0, tslib_1.__importDefault)(require("./der/decoders/decodeBitString"));
|
|
15
|
-
const encodeReal_1 = (0, tslib_1.__importDefault)(require("./x690/encoders/encodeReal"));
|
|
16
|
-
const decodeReal_1 = (0, tslib_1.__importDefault)(require("./der/decoders/decodeReal"));
|
|
17
|
-
const encodeSequence_1 = (0, tslib_1.__importDefault)(require("./x690/encoders/encodeSequence"));
|
|
18
|
-
const decodeSequence_1 = (0, tslib_1.__importDefault)(require("./der/decoders/decodeSequence"));
|
|
19
|
-
const encodeUTCTime_1 = (0, tslib_1.__importDefault)(require("./x690/encoders/encodeUTCTime"));
|
|
20
|
-
const decodeUTCTime_1 = (0, tslib_1.__importDefault)(require("./der/decoders/decodeUTCTime"));
|
|
21
|
-
const encodeGeneralizedTime_1 = (0, tslib_1.__importDefault)(require("./x690/encoders/encodeGeneralizedTime"));
|
|
22
|
-
const decodeGeneralizedTime_1 = (0, tslib_1.__importDefault)(require("./der/decoders/decodeGeneralizedTime"));
|
|
23
|
-
const encodeExternal_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/encoders/encodeExternal"));
|
|
24
|
-
const encodeEmbeddedPDV_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/encoders/encodeEmbeddedPDV"));
|
|
25
|
-
const encodeCharacterString_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/encoders/encodeCharacterString"));
|
|
26
|
-
const decodeExternal_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/decoders/decodeExternal"));
|
|
27
|
-
const decodeEmbeddedPDV_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/decoders/decodeEmbeddedPDV"));
|
|
28
|
-
const decodeCharacterString_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/decoders/decodeCharacterString"));
|
|
29
|
-
const encodeGraphicString_1 = (0, tslib_1.__importDefault)(require("../codecs/ber/encoders/encodeGraphicString"));
|
|
30
|
-
const encodeNumericString_1 = (0, tslib_1.__importDefault)(require("../codecs/ber/encoders/encodeNumericString"));
|
|
31
|
-
const encodeObjectDescriptor_1 = (0, tslib_1.__importDefault)(require("../codecs/ber/encoders/encodeObjectDescriptor"));
|
|
32
|
-
const encodePrintableString_1 = (0, tslib_1.__importDefault)(require("../codecs/ber/encoders/encodePrintableString"));
|
|
33
|
-
const encodeVisibleString_1 = (0, tslib_1.__importDefault)(require("../codecs/ber/encoders/encodeVisibleString"));
|
|
34
|
-
const encodeGeneralString_1 = (0, tslib_1.__importDefault)(require("../codecs/ber/encoders/encodeGeneralString"));
|
|
35
|
-
const decodeGraphicString_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/decoders/decodeGraphicString"));
|
|
36
|
-
const decodeNumericString_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/decoders/decodeNumericString"));
|
|
37
|
-
const decodeObjectDescriptor_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/decoders/decodeObjectDescriptor"));
|
|
38
|
-
const decodePrintableString_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/decoders/decodePrintableString"));
|
|
39
|
-
const decodeVisibleString_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/decoders/decodeVisibleString"));
|
|
40
|
-
const decodeGeneralString_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/decoders/decodeGeneralString"));
|
|
41
|
-
const encodeDuration_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/encoders/encodeDuration"));
|
|
42
|
-
const decodeDuration_1 = (0, tslib_1.__importDefault)(require("../codecs/der/decoders/decodeDuration"));
|
|
43
|
-
const x690_1 = (0, tslib_1.__importDefault)(require("../x690"));
|
|
44
|
-
class DERElement extends x690_1.default {
|
|
45
|
-
set boolean(value) {
|
|
46
|
-
this.value = (0, encodeBoolean_1.default)(value);
|
|
47
|
-
}
|
|
48
|
-
get boolean() {
|
|
49
|
-
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
50
|
-
throw new errors.ASN1ConstructionError("BOOLEAN cannot be constructed.", this);
|
|
51
|
-
}
|
|
52
|
-
return (0, decodeBoolean_1.default)(this.value);
|
|
53
|
-
}
|
|
54
|
-
set bitString(value) {
|
|
55
|
-
this.value = (0, encodeBitString_1.default)(value);
|
|
56
|
-
}
|
|
57
|
-
get bitString() {
|
|
58
|
-
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
59
|
-
throw new errors.ASN1ConstructionError("BIT STRING cannot be constructed.", this);
|
|
60
|
-
}
|
|
61
|
-
return (0, decodeBitString_1.default)(this.value);
|
|
62
|
-
}
|
|
63
|
-
set octetString(value) {
|
|
64
|
-
this.value = new Uint8Array(value);
|
|
65
|
-
}
|
|
66
|
-
get octetString() {
|
|
67
|
-
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
68
|
-
throw new errors.ASN1ConstructionError("OCTET STRING cannot be constructed.", this);
|
|
69
|
-
}
|
|
70
|
-
return new Uint8Array(this.value);
|
|
71
|
-
}
|
|
72
|
-
set objectDescriptor(value) {
|
|
73
|
-
this.value = (0, encodeObjectDescriptor_1.default)(value);
|
|
74
|
-
}
|
|
75
|
-
get objectDescriptor() {
|
|
76
|
-
return (0, decodeObjectDescriptor_1.default)(this.value);
|
|
77
|
-
}
|
|
78
|
-
set external(value) {
|
|
79
|
-
this.value = (0, encodeExternal_1.default)(value);
|
|
80
|
-
this.construction = values_1.ASN1Construction.constructed;
|
|
81
|
-
}
|
|
82
|
-
get external() {
|
|
83
|
-
if (this.construction !== values_1.ASN1Construction.constructed) {
|
|
84
|
-
throw new errors.ASN1ConstructionError("EXTERNAL cannot be primitively-constructed.", this);
|
|
85
|
-
}
|
|
86
|
-
return (0, decodeExternal_1.default)(this.value);
|
|
87
|
-
}
|
|
88
|
-
set real(value) {
|
|
89
|
-
this.value = (0, encodeReal_1.default)(value);
|
|
90
|
-
}
|
|
91
|
-
get real() {
|
|
92
|
-
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
93
|
-
throw new errors.ASN1ConstructionError("REAL cannot be constructed.", this);
|
|
94
|
-
}
|
|
95
|
-
return (0, decodeReal_1.default)(this.value);
|
|
96
|
-
}
|
|
97
|
-
set embeddedPDV(value) {
|
|
98
|
-
this.value = (0, encodeEmbeddedPDV_1.default)(value);
|
|
99
|
-
this.construction = values_1.ASN1Construction.constructed;
|
|
100
|
-
}
|
|
101
|
-
get embeddedPDV() {
|
|
102
|
-
if (this.construction !== values_1.ASN1Construction.constructed) {
|
|
103
|
-
throw new errors.ASN1ConstructionError("EMBEDDED PDV cannot be primitively-constructed.", this);
|
|
104
|
-
}
|
|
105
|
-
return (0, decodeEmbeddedPDV_1.default)(this.value);
|
|
106
|
-
}
|
|
107
|
-
set utf8String(value) {
|
|
108
|
-
this.value = (0, convertTextToBytes_1.default)(value);
|
|
109
|
-
}
|
|
110
|
-
get utf8String() {
|
|
111
|
-
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
112
|
-
throw new errors.ASN1ConstructionError("UTF8String cannot be constructed.", this);
|
|
113
|
-
}
|
|
114
|
-
return (0, convertBytesToText_1.default)(this.value);
|
|
115
|
-
}
|
|
116
|
-
set sequence(value) {
|
|
117
|
-
this.value = (0, encodeSequence_1.default)(value);
|
|
118
|
-
this.construction = values_1.ASN1Construction.constructed;
|
|
119
|
-
}
|
|
120
|
-
get sequence() {
|
|
121
|
-
if (this.construction !== values_1.ASN1Construction.constructed) {
|
|
122
|
-
throw new errors.ASN1ConstructionError("SET or SEQUENCE cannot be primitively constructed.", this);
|
|
123
|
-
}
|
|
124
|
-
return (0, decodeSequence_1.default)(this.value);
|
|
125
|
-
}
|
|
126
|
-
set set(value) {
|
|
127
|
-
(0, sortCanonically_1.default)(value);
|
|
128
|
-
this.sequence = value;
|
|
129
|
-
}
|
|
130
|
-
get set() {
|
|
131
|
-
return this.sequence;
|
|
132
|
-
}
|
|
133
|
-
set numericString(value) {
|
|
134
|
-
this.value = (0, encodeNumericString_1.default)(value);
|
|
135
|
-
}
|
|
136
|
-
get numericString() {
|
|
137
|
-
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
138
|
-
throw new errors.ASN1ConstructionError("NumericString cannot be constructed.", this);
|
|
139
|
-
}
|
|
140
|
-
return (0, decodeNumericString_1.default)(this.value);
|
|
141
|
-
}
|
|
142
|
-
set printableString(value) {
|
|
143
|
-
this.value = (0, encodePrintableString_1.default)(value);
|
|
144
|
-
}
|
|
145
|
-
get printableString() {
|
|
146
|
-
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
147
|
-
throw new errors.ASN1ConstructionError("PrintableString cannot be constructed.", this);
|
|
148
|
-
}
|
|
149
|
-
return (0, decodePrintableString_1.default)(this.value);
|
|
150
|
-
}
|
|
151
|
-
set teletexString(value) {
|
|
152
|
-
this.value = new Uint8Array(value);
|
|
153
|
-
}
|
|
154
|
-
get teletexString() {
|
|
155
|
-
return this.octetString;
|
|
156
|
-
}
|
|
157
|
-
set videotexString(value) {
|
|
158
|
-
this.value = new Uint8Array(value);
|
|
159
|
-
}
|
|
160
|
-
get videotexString() {
|
|
161
|
-
return this.octetString;
|
|
162
|
-
}
|
|
163
|
-
set ia5String(value) {
|
|
164
|
-
this.value = (0, convertTextToBytes_1.default)(value);
|
|
165
|
-
}
|
|
166
|
-
get ia5String() {
|
|
167
|
-
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
168
|
-
throw new errors.ASN1ConstructionError("IA5String cannot be constructed.", this);
|
|
169
|
-
}
|
|
170
|
-
return (0, convertBytesToText_1.default)(this.value);
|
|
171
|
-
}
|
|
172
|
-
set utcTime(value) {
|
|
173
|
-
this.value = (0, encodeUTCTime_1.default)(value);
|
|
174
|
-
}
|
|
175
|
-
get utcTime() {
|
|
176
|
-
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
177
|
-
throw new errors.ASN1ConstructionError("UTCTime cannot be constructed.", this);
|
|
178
|
-
}
|
|
179
|
-
return (0, decodeUTCTime_1.default)(this.value);
|
|
180
|
-
}
|
|
181
|
-
set generalizedTime(value) {
|
|
182
|
-
this.value = (0, encodeGeneralizedTime_1.default)(value);
|
|
183
|
-
}
|
|
184
|
-
get generalizedTime() {
|
|
185
|
-
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
186
|
-
throw new errors.ASN1ConstructionError("GeneralizedTime cannot be constructed.", this);
|
|
187
|
-
}
|
|
188
|
-
return (0, decodeGeneralizedTime_1.default)(this.value);
|
|
189
|
-
}
|
|
190
|
-
set graphicString(value) {
|
|
191
|
-
this.value = (0, encodeGraphicString_1.default)(value);
|
|
192
|
-
}
|
|
193
|
-
get graphicString() {
|
|
194
|
-
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
195
|
-
throw new errors.ASN1ConstructionError("GraphicString cannot be constructed.", this);
|
|
196
|
-
}
|
|
197
|
-
return (0, decodeGraphicString_1.default)(this.value);
|
|
198
|
-
}
|
|
199
|
-
set visibleString(value) {
|
|
200
|
-
this.value = (0, encodeVisibleString_1.default)(value);
|
|
201
|
-
}
|
|
202
|
-
get visibleString() {
|
|
203
|
-
return (0, decodeVisibleString_1.default)(this.value);
|
|
204
|
-
}
|
|
205
|
-
set generalString(value) {
|
|
206
|
-
this.value = (0, encodeGeneralString_1.default)(value);
|
|
207
|
-
}
|
|
208
|
-
get generalString() {
|
|
209
|
-
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
210
|
-
throw new errors.ASN1ConstructionError("GeneralString cannot be constructed.", this);
|
|
211
|
-
}
|
|
212
|
-
return (0, decodeGeneralString_1.default)(this.value);
|
|
213
|
-
}
|
|
214
|
-
set characterString(value) {
|
|
215
|
-
this.value = (0, encodeCharacterString_1.default)(value);
|
|
216
|
-
this.construction = values_1.ASN1Construction.constructed;
|
|
217
|
-
}
|
|
218
|
-
get characterString() {
|
|
219
|
-
if (this.construction !== values_1.ASN1Construction.constructed) {
|
|
220
|
-
throw new errors.ASN1ConstructionError("CHARACTER STRING cannot be primitively-constructed.", this);
|
|
221
|
-
}
|
|
222
|
-
return (0, decodeCharacterString_1.default)(this.value);
|
|
223
|
-
}
|
|
224
|
-
set universalString(value) {
|
|
225
|
-
const buf = new Uint8Array(value.length << 2);
|
|
226
|
-
for (let i = 0; i < value.length; i++) {
|
|
227
|
-
buf[(i << 2)] = value.charCodeAt(i) >>> 24;
|
|
228
|
-
buf[(i << 2) + 1] = value.charCodeAt(i) >>> 16;
|
|
229
|
-
buf[(i << 2) + 2] = value.charCodeAt(i) >>> 8;
|
|
230
|
-
buf[(i << 2) + 3] = value.charCodeAt(i);
|
|
231
|
-
}
|
|
232
|
-
this.value = buf;
|
|
233
|
-
}
|
|
234
|
-
get universalString() {
|
|
235
|
-
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
236
|
-
throw new errors.ASN1ConstructionError("UniversalString cannot be constructed.", this);
|
|
237
|
-
}
|
|
238
|
-
if (this.value.length % 4) {
|
|
239
|
-
throw new errors.ASN1Error("UniversalString encoded on non-mulitple of four bytes.", this);
|
|
240
|
-
}
|
|
241
|
-
let ret = "";
|
|
242
|
-
for (let i = 0; i < this.value.length; i += 4) {
|
|
243
|
-
ret += String.fromCharCode((this.value[i + 0] << 24)
|
|
244
|
-
+ (this.value[i + 1] << 16)
|
|
245
|
-
+ (this.value[i + 2] << 8)
|
|
246
|
-
+ (this.value[i + 3] << 0));
|
|
247
|
-
}
|
|
248
|
-
return ret;
|
|
249
|
-
}
|
|
250
|
-
set bmpString(value) {
|
|
251
|
-
const buf = new Uint8Array(value.length << 1);
|
|
252
|
-
for (let i = 0, strLen = value.length; i < strLen; i++) {
|
|
253
|
-
buf[(i << 1)] = value.charCodeAt(i) >>> 8;
|
|
254
|
-
buf[(i << 1) + 1] = value.charCodeAt(i);
|
|
255
|
-
}
|
|
256
|
-
this.value = buf;
|
|
257
|
-
}
|
|
258
|
-
get bmpString() {
|
|
259
|
-
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
260
|
-
throw new errors.ASN1ConstructionError("BMPString cannot be constructed.", this);
|
|
261
|
-
}
|
|
262
|
-
if (this.value.length % 2)
|
|
263
|
-
throw new errors.ASN1Error("BMPString encoded on non-mulitple of two bytes.", this);
|
|
264
|
-
if (typeof TextEncoder !== "undefined") {
|
|
265
|
-
return (new TextDecoder("utf-16be")).decode(new Uint8Array(this.value));
|
|
266
|
-
}
|
|
267
|
-
else if (typeof Buffer !== "undefined") {
|
|
268
|
-
const swappedEndianness = new Uint8Array(this.value.length);
|
|
269
|
-
for (let i = 0; i < this.value.length; i += 2) {
|
|
270
|
-
swappedEndianness[i] = this.value[i + 1];
|
|
271
|
-
swappedEndianness[i + 1] = this.value[i];
|
|
272
|
-
}
|
|
273
|
-
return (Buffer.from(swappedEndianness)).toString("utf16le");
|
|
274
|
-
}
|
|
275
|
-
else {
|
|
276
|
-
throw new errors.ASN1Error("Neither TextDecoder nor Buffer are defined to decode bytes into text.", this);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
set duration(value) {
|
|
280
|
-
this.value = (0, encodeDuration_1.default)(value);
|
|
281
|
-
}
|
|
282
|
-
get duration() {
|
|
283
|
-
return (0, decodeDuration_1.default)(this.value);
|
|
284
|
-
}
|
|
285
|
-
encode(value) {
|
|
286
|
-
switch (typeof value) {
|
|
287
|
-
case ("undefined"): {
|
|
288
|
-
this.value = new Uint8Array(0);
|
|
289
|
-
break;
|
|
290
|
-
}
|
|
291
|
-
case ("boolean"): {
|
|
292
|
-
this.tagNumber = values_1.ASN1UniversalType.boolean;
|
|
293
|
-
this.boolean = value;
|
|
294
|
-
break;
|
|
295
|
-
}
|
|
296
|
-
case ("number"): {
|
|
297
|
-
if (Number.isInteger(value)) {
|
|
298
|
-
this.tagNumber = values_1.ASN1UniversalType.integer;
|
|
299
|
-
this.integer = value;
|
|
300
|
-
}
|
|
301
|
-
else {
|
|
302
|
-
this.tagNumber = values_1.ASN1UniversalType.realNumber;
|
|
303
|
-
this.real = value;
|
|
304
|
-
}
|
|
305
|
-
break;
|
|
306
|
-
}
|
|
307
|
-
case ("string"): {
|
|
308
|
-
this.tagNumber = values_1.ASN1UniversalType.utf8String;
|
|
309
|
-
this.utf8String = value;
|
|
310
|
-
break;
|
|
311
|
-
}
|
|
312
|
-
case ("object"): {
|
|
313
|
-
if (!value) {
|
|
314
|
-
this.tagNumber = values_1.ASN1UniversalType.nill;
|
|
315
|
-
this.value = new Uint8Array(0);
|
|
316
|
-
}
|
|
317
|
-
else if (value instanceof Uint8Array) {
|
|
318
|
-
this.tagNumber = values_1.ASN1UniversalType.octetString;
|
|
319
|
-
this.octetString = value;
|
|
320
|
-
}
|
|
321
|
-
else if (value instanceof Uint8ClampedArray) {
|
|
322
|
-
this.tagNumber = values_1.ASN1UniversalType.bitString;
|
|
323
|
-
this.bitString = value;
|
|
324
|
-
}
|
|
325
|
-
else if (value instanceof asn1_1.default) {
|
|
326
|
-
this.construction = values_1.ASN1Construction.constructed;
|
|
327
|
-
this.sequence = [value];
|
|
328
|
-
}
|
|
329
|
-
else if (value instanceof Set) {
|
|
330
|
-
this.construction = values_1.ASN1Construction.constructed;
|
|
331
|
-
this.set = Array.from(value).map((v) => {
|
|
332
|
-
if (typeof v === "object" && v instanceof asn1_1.default) {
|
|
333
|
-
return v;
|
|
334
|
-
}
|
|
335
|
-
else {
|
|
336
|
-
const e = new DERElement();
|
|
337
|
-
e.encode(v);
|
|
338
|
-
return e;
|
|
339
|
-
}
|
|
340
|
-
});
|
|
341
|
-
}
|
|
342
|
-
else if ((value instanceof ObjectIdentifier_1.default) || (value.constructor?.name === "ObjectIdentifier")) {
|
|
343
|
-
this.tagNumber = values_1.ASN1UniversalType.objectIdentifier;
|
|
344
|
-
this.objectIdentifier = value;
|
|
345
|
-
}
|
|
346
|
-
else if (Array.isArray(value)) {
|
|
347
|
-
this.construction = values_1.ASN1Construction.constructed;
|
|
348
|
-
this.tagNumber = values_1.ASN1UniversalType.sequence;
|
|
349
|
-
this.sequence = value.map((sub) => {
|
|
350
|
-
const ret = new DERElement();
|
|
351
|
-
ret.encode(sub);
|
|
352
|
-
return ret;
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
else if (value instanceof Date) {
|
|
356
|
-
this.generalizedTime = value;
|
|
357
|
-
}
|
|
358
|
-
else {
|
|
359
|
-
throw new errors.ASN1Error(`Cannot encode value of type ${value.constructor.name}.`, this);
|
|
360
|
-
}
|
|
361
|
-
break;
|
|
362
|
-
}
|
|
363
|
-
default: {
|
|
364
|
-
throw new errors.ASN1Error(`Cannot encode value of type ${typeof value}.`, this);
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
static fromSequence(sequence) {
|
|
369
|
-
const ret = new DERElement(values_1.ASN1TagClass.universal, values_1.ASN1Construction.constructed, values_1.ASN1UniversalType.sequence);
|
|
370
|
-
ret.sequence = sequence.filter((element) => Boolean(element));
|
|
371
|
-
return ret;
|
|
372
|
-
}
|
|
373
|
-
static fromSet(set) {
|
|
374
|
-
const ret = new DERElement(values_1.ASN1TagClass.universal, values_1.ASN1Construction.constructed, values_1.ASN1UniversalType.set);
|
|
375
|
-
ret.set = set.filter((element) => Boolean(element));
|
|
376
|
-
return ret;
|
|
377
|
-
}
|
|
378
|
-
get inner() {
|
|
379
|
-
if (this.construction !== values_1.ASN1Construction.constructed) {
|
|
380
|
-
throw new errors.ASN1ConstructionError("An explicitly-encoded element cannot be encoded using "
|
|
381
|
-
+ "primitive construction.", this);
|
|
382
|
-
}
|
|
383
|
-
const ret = new DERElement();
|
|
384
|
-
const readBytes = ret.fromBytes(this.value);
|
|
385
|
-
if (readBytes !== this.value.length) {
|
|
386
|
-
throw new errors.ASN1ConstructionError("An explicitly-encoding element contained more than one single "
|
|
387
|
-
+ "encoded element. The tag number of the first decoded "
|
|
388
|
-
+ `element was ${ret.tagNumber}, and it was encoded on `
|
|
389
|
-
+ `${readBytes} bytes.`, this);
|
|
390
|
-
}
|
|
391
|
-
return ret;
|
|
392
|
-
}
|
|
393
|
-
set inner(value) {
|
|
394
|
-
this.construction = values_1.ASN1Construction.constructed;
|
|
395
|
-
this.value = value.toBytes();
|
|
396
|
-
}
|
|
397
|
-
constructor(tagClass = values_1.ASN1TagClass.universal, construction = values_1.ASN1Construction.primitive, tagNumber = values_1.ASN1UniversalType.endOfContent, value = undefined) {
|
|
398
|
-
super();
|
|
399
|
-
this.encode(value);
|
|
400
|
-
this.tagClass = tagClass;
|
|
401
|
-
this.construction = construction;
|
|
402
|
-
this.tagNumber = tagNumber;
|
|
403
|
-
}
|
|
404
|
-
fromBytes(bytes) {
|
|
405
|
-
if (bytes.length < 2) {
|
|
406
|
-
throw new errors.ASN1TruncationError("Tried to decode a DER element that is less than two bytes.", this);
|
|
407
|
-
}
|
|
408
|
-
if ((this.recursionCount + 1) > DERElement.nestingRecursionLimit) {
|
|
409
|
-
throw new errors.ASN1RecursionError();
|
|
410
|
-
}
|
|
411
|
-
let cursor = 0;
|
|
412
|
-
switch (bytes[cursor] & 0b11000000) {
|
|
413
|
-
case (0b00000000):
|
|
414
|
-
this.tagClass = values_1.ASN1TagClass.universal;
|
|
415
|
-
break;
|
|
416
|
-
case (0b01000000):
|
|
417
|
-
this.tagClass = values_1.ASN1TagClass.application;
|
|
418
|
-
break;
|
|
419
|
-
case (0b10000000):
|
|
420
|
-
this.tagClass = values_1.ASN1TagClass.context;
|
|
421
|
-
break;
|
|
422
|
-
case (0b11000000):
|
|
423
|
-
this.tagClass = values_1.ASN1TagClass.private;
|
|
424
|
-
break;
|
|
425
|
-
default: this.tagClass = values_1.ASN1TagClass.universal;
|
|
426
|
-
}
|
|
427
|
-
this.construction = ((bytes[cursor] & 0b00100000)
|
|
428
|
-
? values_1.ASN1Construction.constructed : values_1.ASN1Construction.primitive);
|
|
429
|
-
this.tagNumber = (bytes[cursor] & 0b00011111);
|
|
430
|
-
cursor++;
|
|
431
|
-
if (this.tagNumber >= 31) {
|
|
432
|
-
if (bytes[cursor] === 0b10000000) {
|
|
433
|
-
throw new errors.ASN1PaddingError("Leading padding byte on long tag number encoding.", this);
|
|
434
|
-
}
|
|
435
|
-
this.tagNumber = 0;
|
|
436
|
-
const limit = (((bytes.length - 1) >= 4) ? 4 : (bytes.length - 1));
|
|
437
|
-
while (cursor < limit) {
|
|
438
|
-
if (!(bytes[cursor++] & 0b10000000))
|
|
439
|
-
break;
|
|
440
|
-
}
|
|
441
|
-
if (bytes[cursor - 1] & 0b10000000) {
|
|
442
|
-
if (limit === (bytes.length - 1)) {
|
|
443
|
-
throw new errors.ASN1TruncationError("ASN.1 tag number appears to have been truncated.", this);
|
|
444
|
-
}
|
|
445
|
-
else {
|
|
446
|
-
throw new errors.ASN1OverflowError("ASN.1 tag number too large.", this);
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
for (let i = 1; i < cursor; i++) {
|
|
450
|
-
this.tagNumber <<= 7;
|
|
451
|
-
this.tagNumber |= (bytes[i] & 0x7F);
|
|
452
|
-
}
|
|
453
|
-
if (this.tagNumber <= 31) {
|
|
454
|
-
throw new errors.ASN1Error("ASN.1 tag number could have been encoded in short form.", this);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
if ((bytes[cursor] & 0b10000000) === 0b10000000) {
|
|
458
|
-
const numberOfLengthOctets = (bytes[cursor] & 0x7F);
|
|
459
|
-
if (numberOfLengthOctets === 0b01111111) {
|
|
460
|
-
throw new errors.ASN1UndefinedError("Length byte with undefined meaning encountered.", this);
|
|
461
|
-
}
|
|
462
|
-
if (numberOfLengthOctets > 4) {
|
|
463
|
-
throw new errors.ASN1OverflowError("Element length too long to decode to an integer.", this);
|
|
464
|
-
}
|
|
465
|
-
if (cursor + numberOfLengthOctets >= bytes.length) {
|
|
466
|
-
throw new errors.ASN1TruncationError("Element length bytes appear to have been truncated.", this);
|
|
467
|
-
}
|
|
468
|
-
cursor++;
|
|
469
|
-
const lengthNumberOctets = new Uint8Array(4);
|
|
470
|
-
for (let i = numberOfLengthOctets; i > 0; i--) {
|
|
471
|
-
lengthNumberOctets[(4 - i)] = bytes[(cursor + numberOfLengthOctets - i)];
|
|
472
|
-
}
|
|
473
|
-
let length = 0;
|
|
474
|
-
|
|
475
|
-
length <<= 8;
|
|
476
|
-
length += octet;
|
|
477
|
-
}
|
|
478
|
-
if ((cursor + length) < cursor) {
|
|
479
|
-
throw new errors.ASN1OverflowError("ASN.1 element too large.", this);
|
|
480
|
-
}
|
|
481
|
-
cursor += (numberOfLengthOctets);
|
|
482
|
-
if ((cursor + length) > bytes.length) {
|
|
483
|
-
throw new errors.ASN1TruncationError("ASN.1 element truncated.", this);
|
|
484
|
-
}
|
|
485
|
-
if (((length <= 127 && length >= -128) && numberOfLengthOctets > 1)
|
|
486
|
-
|| ((length <= 32767 && length >= -32768) && numberOfLengthOctets > 2)
|
|
487
|
-
|| ((length <= 8388607 && length >= -8388608) && numberOfLengthOctets > 3)) {
|
|
488
|
-
throw new errors.ASN1PaddingError("DER-encoded long-form length encoded on more octets than necessary", this);
|
|
489
|
-
}
|
|
490
|
-
this.value = bytes.slice(cursor, (cursor + length));
|
|
491
|
-
return (cursor + length);
|
|
492
|
-
}
|
|
493
|
-
else {
|
|
494
|
-
const length = (bytes[cursor++] & 0x7F);
|
|
495
|
-
if ((cursor + length) > bytes.length) {
|
|
496
|
-
throw new errors.ASN1TruncationError("ASN.1 element was truncated.", this);
|
|
497
|
-
}
|
|
498
|
-
this.value = bytes.slice(cursor, (cursor + length));
|
|
499
|
-
return (cursor + length);
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
toBytes() {
|
|
503
|
-
let tagBytes = [0x00];
|
|
504
|
-
tagBytes[0] |= (this.tagClass << 6);
|
|
505
|
-
tagBytes[0] |= (this.construction << 5);
|
|
506
|
-
if (this.tagNumber < 31) {
|
|
507
|
-
tagBytes[0] |= this.tagNumber;
|
|
508
|
-
}
|
|
509
|
-
else {
|
|
510
|
-
tagBytes[0] |= 0b00011111;
|
|
511
|
-
let number = this.tagNumber;
|
|
512
|
-
const encodedNumber = [];
|
|
513
|
-
while (number !== 0) {
|
|
514
|
-
encodedNumber.unshift(number & 0x7F);
|
|
515
|
-
number >>>= 7;
|
|
516
|
-
encodedNumber[0] |= 0b10000000;
|
|
517
|
-
}
|
|
518
|
-
encodedNumber[encodedNumber.length - 1] &= 0b01111111;
|
|
519
|
-
tagBytes = tagBytes.concat(encodedNumber);
|
|
520
|
-
}
|
|
521
|
-
let lengthOctets = [0x00];
|
|
522
|
-
if (this.value.length < 127) {
|
|
523
|
-
lengthOctets[0] = this.value.length;
|
|
524
|
-
}
|
|
525
|
-
else {
|
|
526
|
-
const length = this.value.length;
|
|
527
|
-
lengthOctets = [0, 0, 0, 0];
|
|
528
|
-
for (let i = 0; i < 4; i++) {
|
|
529
|
-
lengthOctets[i] = ((length >>> ((3 - i) << 3)) & 0xFF);
|
|
530
|
-
}
|
|
531
|
-
let startOfNonPadding = 0;
|
|
532
|
-
for (let i = 0; i < (lengthOctets.length - 1); i++) {
|
|
533
|
-
if (lengthOctets[i] === 0x00)
|
|
534
|
-
startOfNonPadding++;
|
|
535
|
-
}
|
|
536
|
-
lengthOctets = lengthOctets.slice(startOfNonPadding);
|
|
537
|
-
lengthOctets.unshift(0b10000000 | lengthOctets.length);
|
|
538
|
-
}
|
|
539
|
-
const ret = new Uint8Array(tagBytes.length
|
|
540
|
-
+ lengthOctets.length
|
|
541
|
-
+ this.value.length);
|
|
542
|
-
ret.set(tagBytes, 0);
|
|
543
|
-
ret.set(lengthOctets, tagBytes.length);
|
|
544
|
-
ret.set(this.value, (tagBytes.length + lengthOctets.length));
|
|
545
|
-
return ret;
|
|
546
|
-
}
|
|
547
|
-
deconstruct() {
|
|
548
|
-
return this.value.subarray(0);
|
|
549
|
-
}
|
|
550
|
-
get components() {
|
|
551
|
-
const encodedElements = [];
|
|
552
|
-
let i = 0;
|
|
553
|
-
while (i < this.value.length) {
|
|
554
|
-
const next = new DERElement();
|
|
555
|
-
i += next.fromBytes(this.value.slice(i));
|
|
556
|
-
encodedElements.push(next);
|
|
557
|
-
}
|
|
558
|
-
return encodedElements;
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
exports.default = DERElement;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const asn1_1 = (0, tslib_1.__importDefault)(require("../asn1"));
|
|
5
|
+
const errors = (0, tslib_1.__importStar)(require("../errors"));
|
|
6
|
+
const values_1 = require("../values");
|
|
7
|
+
const convertBytesToText_1 = (0, tslib_1.__importDefault)(require("../utils/convertBytesToText"));
|
|
8
|
+
const convertTextToBytes_1 = (0, tslib_1.__importDefault)(require("../utils/convertTextToBytes"));
|
|
9
|
+
const sortCanonically_1 = (0, tslib_1.__importDefault)(require("../utils/sortCanonically"));
|
|
10
|
+
const ObjectIdentifier_1 = (0, tslib_1.__importDefault)(require("../types/ObjectIdentifier"));
|
|
11
|
+
const encodeBoolean_1 = (0, tslib_1.__importDefault)(require("./x690/encoders/encodeBoolean"));
|
|
12
|
+
const decodeBoolean_1 = (0, tslib_1.__importDefault)(require("./der/decoders/decodeBoolean"));
|
|
13
|
+
const encodeBitString_1 = (0, tslib_1.__importDefault)(require("./x690/encoders/encodeBitString"));
|
|
14
|
+
const decodeBitString_1 = (0, tslib_1.__importDefault)(require("./der/decoders/decodeBitString"));
|
|
15
|
+
const encodeReal_1 = (0, tslib_1.__importDefault)(require("./x690/encoders/encodeReal"));
|
|
16
|
+
const decodeReal_1 = (0, tslib_1.__importDefault)(require("./der/decoders/decodeReal"));
|
|
17
|
+
const encodeSequence_1 = (0, tslib_1.__importDefault)(require("./x690/encoders/encodeSequence"));
|
|
18
|
+
const decodeSequence_1 = (0, tslib_1.__importDefault)(require("./der/decoders/decodeSequence"));
|
|
19
|
+
const encodeUTCTime_1 = (0, tslib_1.__importDefault)(require("./x690/encoders/encodeUTCTime"));
|
|
20
|
+
const decodeUTCTime_1 = (0, tslib_1.__importDefault)(require("./der/decoders/decodeUTCTime"));
|
|
21
|
+
const encodeGeneralizedTime_1 = (0, tslib_1.__importDefault)(require("./x690/encoders/encodeGeneralizedTime"));
|
|
22
|
+
const decodeGeneralizedTime_1 = (0, tslib_1.__importDefault)(require("./der/decoders/decodeGeneralizedTime"));
|
|
23
|
+
const encodeExternal_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/encoders/encodeExternal"));
|
|
24
|
+
const encodeEmbeddedPDV_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/encoders/encodeEmbeddedPDV"));
|
|
25
|
+
const encodeCharacterString_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/encoders/encodeCharacterString"));
|
|
26
|
+
const decodeExternal_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/decoders/decodeExternal"));
|
|
27
|
+
const decodeEmbeddedPDV_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/decoders/decodeEmbeddedPDV"));
|
|
28
|
+
const decodeCharacterString_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/decoders/decodeCharacterString"));
|
|
29
|
+
const encodeGraphicString_1 = (0, tslib_1.__importDefault)(require("../codecs/ber/encoders/encodeGraphicString"));
|
|
30
|
+
const encodeNumericString_1 = (0, tslib_1.__importDefault)(require("../codecs/ber/encoders/encodeNumericString"));
|
|
31
|
+
const encodeObjectDescriptor_1 = (0, tslib_1.__importDefault)(require("../codecs/ber/encoders/encodeObjectDescriptor"));
|
|
32
|
+
const encodePrintableString_1 = (0, tslib_1.__importDefault)(require("../codecs/ber/encoders/encodePrintableString"));
|
|
33
|
+
const encodeVisibleString_1 = (0, tslib_1.__importDefault)(require("../codecs/ber/encoders/encodeVisibleString"));
|
|
34
|
+
const encodeGeneralString_1 = (0, tslib_1.__importDefault)(require("../codecs/ber/encoders/encodeGeneralString"));
|
|
35
|
+
const decodeGraphicString_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/decoders/decodeGraphicString"));
|
|
36
|
+
const decodeNumericString_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/decoders/decodeNumericString"));
|
|
37
|
+
const decodeObjectDescriptor_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/decoders/decodeObjectDescriptor"));
|
|
38
|
+
const decodePrintableString_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/decoders/decodePrintableString"));
|
|
39
|
+
const decodeVisibleString_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/decoders/decodeVisibleString"));
|
|
40
|
+
const decodeGeneralString_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/decoders/decodeGeneralString"));
|
|
41
|
+
const encodeDuration_1 = (0, tslib_1.__importDefault)(require("../codecs/x690/encoders/encodeDuration"));
|
|
42
|
+
const decodeDuration_1 = (0, tslib_1.__importDefault)(require("../codecs/der/decoders/decodeDuration"));
|
|
43
|
+
const x690_1 = (0, tslib_1.__importDefault)(require("../x690"));
|
|
44
|
+
class DERElement extends x690_1.default {
|
|
45
|
+
set boolean(value) {
|
|
46
|
+
this.value = (0, encodeBoolean_1.default)(value);
|
|
47
|
+
}
|
|
48
|
+
get boolean() {
|
|
49
|
+
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
50
|
+
throw new errors.ASN1ConstructionError("BOOLEAN cannot be constructed.", this);
|
|
51
|
+
}
|
|
52
|
+
return (0, decodeBoolean_1.default)(this.value);
|
|
53
|
+
}
|
|
54
|
+
set bitString(value) {
|
|
55
|
+
this.value = (0, encodeBitString_1.default)(value);
|
|
56
|
+
}
|
|
57
|
+
get bitString() {
|
|
58
|
+
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
59
|
+
throw new errors.ASN1ConstructionError("BIT STRING cannot be constructed.", this);
|
|
60
|
+
}
|
|
61
|
+
return (0, decodeBitString_1.default)(this.value);
|
|
62
|
+
}
|
|
63
|
+
set octetString(value) {
|
|
64
|
+
this.value = new Uint8Array(value);
|
|
65
|
+
}
|
|
66
|
+
get octetString() {
|
|
67
|
+
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
68
|
+
throw new errors.ASN1ConstructionError("OCTET STRING cannot be constructed.", this);
|
|
69
|
+
}
|
|
70
|
+
return new Uint8Array(this.value);
|
|
71
|
+
}
|
|
72
|
+
set objectDescriptor(value) {
|
|
73
|
+
this.value = (0, encodeObjectDescriptor_1.default)(value);
|
|
74
|
+
}
|
|
75
|
+
get objectDescriptor() {
|
|
76
|
+
return (0, decodeObjectDescriptor_1.default)(this.value);
|
|
77
|
+
}
|
|
78
|
+
set external(value) {
|
|
79
|
+
this.value = (0, encodeExternal_1.default)(value);
|
|
80
|
+
this.construction = values_1.ASN1Construction.constructed;
|
|
81
|
+
}
|
|
82
|
+
get external() {
|
|
83
|
+
if (this.construction !== values_1.ASN1Construction.constructed) {
|
|
84
|
+
throw new errors.ASN1ConstructionError("EXTERNAL cannot be primitively-constructed.", this);
|
|
85
|
+
}
|
|
86
|
+
return (0, decodeExternal_1.default)(this.value);
|
|
87
|
+
}
|
|
88
|
+
set real(value) {
|
|
89
|
+
this.value = (0, encodeReal_1.default)(value);
|
|
90
|
+
}
|
|
91
|
+
get real() {
|
|
92
|
+
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
93
|
+
throw new errors.ASN1ConstructionError("REAL cannot be constructed.", this);
|
|
94
|
+
}
|
|
95
|
+
return (0, decodeReal_1.default)(this.value);
|
|
96
|
+
}
|
|
97
|
+
set embeddedPDV(value) {
|
|
98
|
+
this.value = (0, encodeEmbeddedPDV_1.default)(value);
|
|
99
|
+
this.construction = values_1.ASN1Construction.constructed;
|
|
100
|
+
}
|
|
101
|
+
get embeddedPDV() {
|
|
102
|
+
if (this.construction !== values_1.ASN1Construction.constructed) {
|
|
103
|
+
throw new errors.ASN1ConstructionError("EMBEDDED PDV cannot be primitively-constructed.", this);
|
|
104
|
+
}
|
|
105
|
+
return (0, decodeEmbeddedPDV_1.default)(this.value);
|
|
106
|
+
}
|
|
107
|
+
set utf8String(value) {
|
|
108
|
+
this.value = (0, convertTextToBytes_1.default)(value);
|
|
109
|
+
}
|
|
110
|
+
get utf8String() {
|
|
111
|
+
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
112
|
+
throw new errors.ASN1ConstructionError("UTF8String cannot be constructed.", this);
|
|
113
|
+
}
|
|
114
|
+
return (0, convertBytesToText_1.default)(this.value);
|
|
115
|
+
}
|
|
116
|
+
set sequence(value) {
|
|
117
|
+
this.value = (0, encodeSequence_1.default)(value);
|
|
118
|
+
this.construction = values_1.ASN1Construction.constructed;
|
|
119
|
+
}
|
|
120
|
+
get sequence() {
|
|
121
|
+
if (this.construction !== values_1.ASN1Construction.constructed) {
|
|
122
|
+
throw new errors.ASN1ConstructionError("SET or SEQUENCE cannot be primitively constructed.", this);
|
|
123
|
+
}
|
|
124
|
+
return (0, decodeSequence_1.default)(this.value);
|
|
125
|
+
}
|
|
126
|
+
set set(value) {
|
|
127
|
+
(0, sortCanonically_1.default)(value);
|
|
128
|
+
this.sequence = value;
|
|
129
|
+
}
|
|
130
|
+
get set() {
|
|
131
|
+
return this.sequence;
|
|
132
|
+
}
|
|
133
|
+
set numericString(value) {
|
|
134
|
+
this.value = (0, encodeNumericString_1.default)(value);
|
|
135
|
+
}
|
|
136
|
+
get numericString() {
|
|
137
|
+
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
138
|
+
throw new errors.ASN1ConstructionError("NumericString cannot be constructed.", this);
|
|
139
|
+
}
|
|
140
|
+
return (0, decodeNumericString_1.default)(this.value);
|
|
141
|
+
}
|
|
142
|
+
set printableString(value) {
|
|
143
|
+
this.value = (0, encodePrintableString_1.default)(value);
|
|
144
|
+
}
|
|
145
|
+
get printableString() {
|
|
146
|
+
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
147
|
+
throw new errors.ASN1ConstructionError("PrintableString cannot be constructed.", this);
|
|
148
|
+
}
|
|
149
|
+
return (0, decodePrintableString_1.default)(this.value);
|
|
150
|
+
}
|
|
151
|
+
set teletexString(value) {
|
|
152
|
+
this.value = new Uint8Array(value);
|
|
153
|
+
}
|
|
154
|
+
get teletexString() {
|
|
155
|
+
return this.octetString;
|
|
156
|
+
}
|
|
157
|
+
set videotexString(value) {
|
|
158
|
+
this.value = new Uint8Array(value);
|
|
159
|
+
}
|
|
160
|
+
get videotexString() {
|
|
161
|
+
return this.octetString;
|
|
162
|
+
}
|
|
163
|
+
set ia5String(value) {
|
|
164
|
+
this.value = (0, convertTextToBytes_1.default)(value);
|
|
165
|
+
}
|
|
166
|
+
get ia5String() {
|
|
167
|
+
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
168
|
+
throw new errors.ASN1ConstructionError("IA5String cannot be constructed.", this);
|
|
169
|
+
}
|
|
170
|
+
return (0, convertBytesToText_1.default)(this.value);
|
|
171
|
+
}
|
|
172
|
+
set utcTime(value) {
|
|
173
|
+
this.value = (0, encodeUTCTime_1.default)(value);
|
|
174
|
+
}
|
|
175
|
+
get utcTime() {
|
|
176
|
+
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
177
|
+
throw new errors.ASN1ConstructionError("UTCTime cannot be constructed.", this);
|
|
178
|
+
}
|
|
179
|
+
return (0, decodeUTCTime_1.default)(this.value);
|
|
180
|
+
}
|
|
181
|
+
set generalizedTime(value) {
|
|
182
|
+
this.value = (0, encodeGeneralizedTime_1.default)(value);
|
|
183
|
+
}
|
|
184
|
+
get generalizedTime() {
|
|
185
|
+
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
186
|
+
throw new errors.ASN1ConstructionError("GeneralizedTime cannot be constructed.", this);
|
|
187
|
+
}
|
|
188
|
+
return (0, decodeGeneralizedTime_1.default)(this.value);
|
|
189
|
+
}
|
|
190
|
+
set graphicString(value) {
|
|
191
|
+
this.value = (0, encodeGraphicString_1.default)(value);
|
|
192
|
+
}
|
|
193
|
+
get graphicString() {
|
|
194
|
+
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
195
|
+
throw new errors.ASN1ConstructionError("GraphicString cannot be constructed.", this);
|
|
196
|
+
}
|
|
197
|
+
return (0, decodeGraphicString_1.default)(this.value);
|
|
198
|
+
}
|
|
199
|
+
set visibleString(value) {
|
|
200
|
+
this.value = (0, encodeVisibleString_1.default)(value);
|
|
201
|
+
}
|
|
202
|
+
get visibleString() {
|
|
203
|
+
return (0, decodeVisibleString_1.default)(this.value);
|
|
204
|
+
}
|
|
205
|
+
set generalString(value) {
|
|
206
|
+
this.value = (0, encodeGeneralString_1.default)(value);
|
|
207
|
+
}
|
|
208
|
+
get generalString() {
|
|
209
|
+
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
210
|
+
throw new errors.ASN1ConstructionError("GeneralString cannot be constructed.", this);
|
|
211
|
+
}
|
|
212
|
+
return (0, decodeGeneralString_1.default)(this.value);
|
|
213
|
+
}
|
|
214
|
+
set characterString(value) {
|
|
215
|
+
this.value = (0, encodeCharacterString_1.default)(value);
|
|
216
|
+
this.construction = values_1.ASN1Construction.constructed;
|
|
217
|
+
}
|
|
218
|
+
get characterString() {
|
|
219
|
+
if (this.construction !== values_1.ASN1Construction.constructed) {
|
|
220
|
+
throw new errors.ASN1ConstructionError("CHARACTER STRING cannot be primitively-constructed.", this);
|
|
221
|
+
}
|
|
222
|
+
return (0, decodeCharacterString_1.default)(this.value);
|
|
223
|
+
}
|
|
224
|
+
set universalString(value) {
|
|
225
|
+
const buf = new Uint8Array(value.length << 2);
|
|
226
|
+
for (let i = 0; i < value.length; i++) {
|
|
227
|
+
buf[(i << 2)] = value.charCodeAt(i) >>> 24;
|
|
228
|
+
buf[(i << 2) + 1] = value.charCodeAt(i) >>> 16;
|
|
229
|
+
buf[(i << 2) + 2] = value.charCodeAt(i) >>> 8;
|
|
230
|
+
buf[(i << 2) + 3] = value.charCodeAt(i);
|
|
231
|
+
}
|
|
232
|
+
this.value = buf;
|
|
233
|
+
}
|
|
234
|
+
get universalString() {
|
|
235
|
+
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
236
|
+
throw new errors.ASN1ConstructionError("UniversalString cannot be constructed.", this);
|
|
237
|
+
}
|
|
238
|
+
if (this.value.length % 4) {
|
|
239
|
+
throw new errors.ASN1Error("UniversalString encoded on non-mulitple of four bytes.", this);
|
|
240
|
+
}
|
|
241
|
+
let ret = "";
|
|
242
|
+
for (let i = 0; i < this.value.length; i += 4) {
|
|
243
|
+
ret += String.fromCharCode((this.value[i + 0] << 24)
|
|
244
|
+
+ (this.value[i + 1] << 16)
|
|
245
|
+
+ (this.value[i + 2] << 8)
|
|
246
|
+
+ (this.value[i + 3] << 0));
|
|
247
|
+
}
|
|
248
|
+
return ret;
|
|
249
|
+
}
|
|
250
|
+
set bmpString(value) {
|
|
251
|
+
const buf = new Uint8Array(value.length << 1);
|
|
252
|
+
for (let i = 0, strLen = value.length; i < strLen; i++) {
|
|
253
|
+
buf[(i << 1)] = value.charCodeAt(i) >>> 8;
|
|
254
|
+
buf[(i << 1) + 1] = value.charCodeAt(i);
|
|
255
|
+
}
|
|
256
|
+
this.value = buf;
|
|
257
|
+
}
|
|
258
|
+
get bmpString() {
|
|
259
|
+
if (this.construction !== values_1.ASN1Construction.primitive) {
|
|
260
|
+
throw new errors.ASN1ConstructionError("BMPString cannot be constructed.", this);
|
|
261
|
+
}
|
|
262
|
+
if (this.value.length % 2)
|
|
263
|
+
throw new errors.ASN1Error("BMPString encoded on non-mulitple of two bytes.", this);
|
|
264
|
+
if (typeof TextEncoder !== "undefined") {
|
|
265
|
+
return (new TextDecoder("utf-16be")).decode(new Uint8Array(this.value));
|
|
266
|
+
}
|
|
267
|
+
else if (typeof Buffer !== "undefined") {
|
|
268
|
+
const swappedEndianness = new Uint8Array(this.value.length);
|
|
269
|
+
for (let i = 0; i < this.value.length; i += 2) {
|
|
270
|
+
swappedEndianness[i] = this.value[i + 1];
|
|
271
|
+
swappedEndianness[i + 1] = this.value[i];
|
|
272
|
+
}
|
|
273
|
+
return (Buffer.from(swappedEndianness)).toString("utf16le");
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
throw new errors.ASN1Error("Neither TextDecoder nor Buffer are defined to decode bytes into text.", this);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
set duration(value) {
|
|
280
|
+
this.value = (0, encodeDuration_1.default)(value);
|
|
281
|
+
}
|
|
282
|
+
get duration() {
|
|
283
|
+
return (0, decodeDuration_1.default)(this.value);
|
|
284
|
+
}
|
|
285
|
+
encode(value) {
|
|
286
|
+
switch (typeof value) {
|
|
287
|
+
case ("undefined"): {
|
|
288
|
+
this.value = new Uint8Array(0);
|
|
289
|
+
break;
|
|
290
|
+
}
|
|
291
|
+
case ("boolean"): {
|
|
292
|
+
this.tagNumber = values_1.ASN1UniversalType.boolean;
|
|
293
|
+
this.boolean = value;
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
case ("number"): {
|
|
297
|
+
if (Number.isInteger(value)) {
|
|
298
|
+
this.tagNumber = values_1.ASN1UniversalType.integer;
|
|
299
|
+
this.integer = value;
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
this.tagNumber = values_1.ASN1UniversalType.realNumber;
|
|
303
|
+
this.real = value;
|
|
304
|
+
}
|
|
305
|
+
break;
|
|
306
|
+
}
|
|
307
|
+
case ("string"): {
|
|
308
|
+
this.tagNumber = values_1.ASN1UniversalType.utf8String;
|
|
309
|
+
this.utf8String = value;
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
case ("object"): {
|
|
313
|
+
if (!value) {
|
|
314
|
+
this.tagNumber = values_1.ASN1UniversalType.nill;
|
|
315
|
+
this.value = new Uint8Array(0);
|
|
316
|
+
}
|
|
317
|
+
else if (value instanceof Uint8Array) {
|
|
318
|
+
this.tagNumber = values_1.ASN1UniversalType.octetString;
|
|
319
|
+
this.octetString = value;
|
|
320
|
+
}
|
|
321
|
+
else if (value instanceof Uint8ClampedArray) {
|
|
322
|
+
this.tagNumber = values_1.ASN1UniversalType.bitString;
|
|
323
|
+
this.bitString = value;
|
|
324
|
+
}
|
|
325
|
+
else if (value instanceof asn1_1.default) {
|
|
326
|
+
this.construction = values_1.ASN1Construction.constructed;
|
|
327
|
+
this.sequence = [value];
|
|
328
|
+
}
|
|
329
|
+
else if (value instanceof Set) {
|
|
330
|
+
this.construction = values_1.ASN1Construction.constructed;
|
|
331
|
+
this.set = Array.from(value).map((v) => {
|
|
332
|
+
if (typeof v === "object" && v instanceof asn1_1.default) {
|
|
333
|
+
return v;
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
const e = new DERElement();
|
|
337
|
+
e.encode(v);
|
|
338
|
+
return e;
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
else if ((value instanceof ObjectIdentifier_1.default) || (value.constructor?.name === "ObjectIdentifier")) {
|
|
343
|
+
this.tagNumber = values_1.ASN1UniversalType.objectIdentifier;
|
|
344
|
+
this.objectIdentifier = value;
|
|
345
|
+
}
|
|
346
|
+
else if (Array.isArray(value)) {
|
|
347
|
+
this.construction = values_1.ASN1Construction.constructed;
|
|
348
|
+
this.tagNumber = values_1.ASN1UniversalType.sequence;
|
|
349
|
+
this.sequence = value.map((sub) => {
|
|
350
|
+
const ret = new DERElement();
|
|
351
|
+
ret.encode(sub);
|
|
352
|
+
return ret;
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
else if (value instanceof Date) {
|
|
356
|
+
this.generalizedTime = value;
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
throw new errors.ASN1Error(`Cannot encode value of type ${value.constructor.name}.`, this);
|
|
360
|
+
}
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
default: {
|
|
364
|
+
throw new errors.ASN1Error(`Cannot encode value of type ${typeof value}.`, this);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
static fromSequence(sequence) {
|
|
369
|
+
const ret = new DERElement(values_1.ASN1TagClass.universal, values_1.ASN1Construction.constructed, values_1.ASN1UniversalType.sequence);
|
|
370
|
+
ret.sequence = sequence.filter((element) => Boolean(element));
|
|
371
|
+
return ret;
|
|
372
|
+
}
|
|
373
|
+
static fromSet(set) {
|
|
374
|
+
const ret = new DERElement(values_1.ASN1TagClass.universal, values_1.ASN1Construction.constructed, values_1.ASN1UniversalType.set);
|
|
375
|
+
ret.set = set.filter((element) => Boolean(element));
|
|
376
|
+
return ret;
|
|
377
|
+
}
|
|
378
|
+
get inner() {
|
|
379
|
+
if (this.construction !== values_1.ASN1Construction.constructed) {
|
|
380
|
+
throw new errors.ASN1ConstructionError("An explicitly-encoded element cannot be encoded using "
|
|
381
|
+
+ "primitive construction.", this);
|
|
382
|
+
}
|
|
383
|
+
const ret = new DERElement();
|
|
384
|
+
const readBytes = ret.fromBytes(this.value);
|
|
385
|
+
if (readBytes !== this.value.length) {
|
|
386
|
+
throw new errors.ASN1ConstructionError("An explicitly-encoding element contained more than one single "
|
|
387
|
+
+ "encoded element. The tag number of the first decoded "
|
|
388
|
+
+ `element was ${ret.tagNumber}, and it was encoded on `
|
|
389
|
+
+ `${readBytes} bytes.`, this);
|
|
390
|
+
}
|
|
391
|
+
return ret;
|
|
392
|
+
}
|
|
393
|
+
set inner(value) {
|
|
394
|
+
this.construction = values_1.ASN1Construction.constructed;
|
|
395
|
+
this.value = value.toBytes();
|
|
396
|
+
}
|
|
397
|
+
constructor(tagClass = values_1.ASN1TagClass.universal, construction = values_1.ASN1Construction.primitive, tagNumber = values_1.ASN1UniversalType.endOfContent, value = undefined) {
|
|
398
|
+
super();
|
|
399
|
+
this.encode(value);
|
|
400
|
+
this.tagClass = tagClass;
|
|
401
|
+
this.construction = construction;
|
|
402
|
+
this.tagNumber = tagNumber;
|
|
403
|
+
}
|
|
404
|
+
fromBytes(bytes) {
|
|
405
|
+
if (bytes.length < 2) {
|
|
406
|
+
throw new errors.ASN1TruncationError("Tried to decode a DER element that is less than two bytes.", this);
|
|
407
|
+
}
|
|
408
|
+
if ((this.recursionCount + 1) > DERElement.nestingRecursionLimit) {
|
|
409
|
+
throw new errors.ASN1RecursionError();
|
|
410
|
+
}
|
|
411
|
+
let cursor = 0;
|
|
412
|
+
switch (bytes[cursor] & 0b11000000) {
|
|
413
|
+
case (0b00000000):
|
|
414
|
+
this.tagClass = values_1.ASN1TagClass.universal;
|
|
415
|
+
break;
|
|
416
|
+
case (0b01000000):
|
|
417
|
+
this.tagClass = values_1.ASN1TagClass.application;
|
|
418
|
+
break;
|
|
419
|
+
case (0b10000000):
|
|
420
|
+
this.tagClass = values_1.ASN1TagClass.context;
|
|
421
|
+
break;
|
|
422
|
+
case (0b11000000):
|
|
423
|
+
this.tagClass = values_1.ASN1TagClass.private;
|
|
424
|
+
break;
|
|
425
|
+
default: this.tagClass = values_1.ASN1TagClass.universal;
|
|
426
|
+
}
|
|
427
|
+
this.construction = ((bytes[cursor] & 0b00100000)
|
|
428
|
+
? values_1.ASN1Construction.constructed : values_1.ASN1Construction.primitive);
|
|
429
|
+
this.tagNumber = (bytes[cursor] & 0b00011111);
|
|
430
|
+
cursor++;
|
|
431
|
+
if (this.tagNumber >= 31) {
|
|
432
|
+
if (bytes[cursor] === 0b10000000) {
|
|
433
|
+
throw new errors.ASN1PaddingError("Leading padding byte on long tag number encoding.", this);
|
|
434
|
+
}
|
|
435
|
+
this.tagNumber = 0;
|
|
436
|
+
const limit = (((bytes.length - 1) >= 4) ? 4 : (bytes.length - 1));
|
|
437
|
+
while (cursor < limit) {
|
|
438
|
+
if (!(bytes[cursor++] & 0b10000000))
|
|
439
|
+
break;
|
|
440
|
+
}
|
|
441
|
+
if (bytes[cursor - 1] & 0b10000000) {
|
|
442
|
+
if (limit === (bytes.length - 1)) {
|
|
443
|
+
throw new errors.ASN1TruncationError("ASN.1 tag number appears to have been truncated.", this);
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
throw new errors.ASN1OverflowError("ASN.1 tag number too large.", this);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
for (let i = 1; i < cursor; i++) {
|
|
450
|
+
this.tagNumber <<= 7;
|
|
451
|
+
this.tagNumber |= (bytes[i] & 0x7F);
|
|
452
|
+
}
|
|
453
|
+
if (this.tagNumber <= 31) {
|
|
454
|
+
throw new errors.ASN1Error("ASN.1 tag number could have been encoded in short form.", this);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
if ((bytes[cursor] & 0b10000000) === 0b10000000) {
|
|
458
|
+
const numberOfLengthOctets = (bytes[cursor] & 0x7F);
|
|
459
|
+
if (numberOfLengthOctets === 0b01111111) {
|
|
460
|
+
throw new errors.ASN1UndefinedError("Length byte with undefined meaning encountered.", this);
|
|
461
|
+
}
|
|
462
|
+
if (numberOfLengthOctets > 4) {
|
|
463
|
+
throw new errors.ASN1OverflowError("Element length too long to decode to an integer.", this);
|
|
464
|
+
}
|
|
465
|
+
if (cursor + numberOfLengthOctets >= bytes.length) {
|
|
466
|
+
throw new errors.ASN1TruncationError("Element length bytes appear to have been truncated.", this);
|
|
467
|
+
}
|
|
468
|
+
cursor++;
|
|
469
|
+
const lengthNumberOctets = new Uint8Array(4);
|
|
470
|
+
for (let i = numberOfLengthOctets; i > 0; i--) {
|
|
471
|
+
lengthNumberOctets[(4 - i)] = bytes[(cursor + numberOfLengthOctets - i)];
|
|
472
|
+
}
|
|
473
|
+
let length = 0;
|
|
474
|
+
for (const octet of lengthNumberOctets) {
|
|
475
|
+
length <<= 8;
|
|
476
|
+
length += octet;
|
|
477
|
+
}
|
|
478
|
+
if ((cursor + length) < cursor) {
|
|
479
|
+
throw new errors.ASN1OverflowError("ASN.1 element too large.", this);
|
|
480
|
+
}
|
|
481
|
+
cursor += (numberOfLengthOctets);
|
|
482
|
+
if ((cursor + length) > bytes.length) {
|
|
483
|
+
throw new errors.ASN1TruncationError("ASN.1 element truncated.", this);
|
|
484
|
+
}
|
|
485
|
+
if (((length <= 127 && length >= -128) && numberOfLengthOctets > 1)
|
|
486
|
+
|| ((length <= 32767 && length >= -32768) && numberOfLengthOctets > 2)
|
|
487
|
+
|| ((length <= 8388607 && length >= -8388608) && numberOfLengthOctets > 3)) {
|
|
488
|
+
throw new errors.ASN1PaddingError("DER-encoded long-form length encoded on more octets than necessary", this);
|
|
489
|
+
}
|
|
490
|
+
this.value = bytes.slice(cursor, (cursor + length));
|
|
491
|
+
return (cursor + length);
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
const length = (bytes[cursor++] & 0x7F);
|
|
495
|
+
if ((cursor + length) > bytes.length) {
|
|
496
|
+
throw new errors.ASN1TruncationError("ASN.1 element was truncated.", this);
|
|
497
|
+
}
|
|
498
|
+
this.value = bytes.slice(cursor, (cursor + length));
|
|
499
|
+
return (cursor + length);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
toBytes() {
|
|
503
|
+
let tagBytes = [0x00];
|
|
504
|
+
tagBytes[0] |= (this.tagClass << 6);
|
|
505
|
+
tagBytes[0] |= (this.construction << 5);
|
|
506
|
+
if (this.tagNumber < 31) {
|
|
507
|
+
tagBytes[0] |= this.tagNumber;
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
tagBytes[0] |= 0b00011111;
|
|
511
|
+
let number = this.tagNumber;
|
|
512
|
+
const encodedNumber = [];
|
|
513
|
+
while (number !== 0) {
|
|
514
|
+
encodedNumber.unshift(number & 0x7F);
|
|
515
|
+
number >>>= 7;
|
|
516
|
+
encodedNumber[0] |= 0b10000000;
|
|
517
|
+
}
|
|
518
|
+
encodedNumber[encodedNumber.length - 1] &= 0b01111111;
|
|
519
|
+
tagBytes = tagBytes.concat(encodedNumber);
|
|
520
|
+
}
|
|
521
|
+
let lengthOctets = [0x00];
|
|
522
|
+
if (this.value.length < 127) {
|
|
523
|
+
lengthOctets[0] = this.value.length;
|
|
524
|
+
}
|
|
525
|
+
else {
|
|
526
|
+
const length = this.value.length;
|
|
527
|
+
lengthOctets = [0, 0, 0, 0];
|
|
528
|
+
for (let i = 0; i < 4; i++) {
|
|
529
|
+
lengthOctets[i] = ((length >>> ((3 - i) << 3)) & 0xFF);
|
|
530
|
+
}
|
|
531
|
+
let startOfNonPadding = 0;
|
|
532
|
+
for (let i = 0; i < (lengthOctets.length - 1); i++) {
|
|
533
|
+
if (lengthOctets[i] === 0x00)
|
|
534
|
+
startOfNonPadding++;
|
|
535
|
+
}
|
|
536
|
+
lengthOctets = lengthOctets.slice(startOfNonPadding);
|
|
537
|
+
lengthOctets.unshift(0b10000000 | lengthOctets.length);
|
|
538
|
+
}
|
|
539
|
+
const ret = new Uint8Array(tagBytes.length
|
|
540
|
+
+ lengthOctets.length
|
|
541
|
+
+ this.value.length);
|
|
542
|
+
ret.set(tagBytes, 0);
|
|
543
|
+
ret.set(lengthOctets, tagBytes.length);
|
|
544
|
+
ret.set(this.value, (tagBytes.length + lengthOctets.length));
|
|
545
|
+
return ret;
|
|
546
|
+
}
|
|
547
|
+
deconstruct() {
|
|
548
|
+
return this.value.subarray(0);
|
|
549
|
+
}
|
|
550
|
+
get components() {
|
|
551
|
+
const encodedElements = [];
|
|
552
|
+
let i = 0;
|
|
553
|
+
while (i < this.value.length) {
|
|
554
|
+
const next = new DERElement();
|
|
555
|
+
i += next.fromBytes(this.value.slice(i));
|
|
556
|
+
encodedElements.push(next);
|
|
557
|
+
}
|
|
558
|
+
return encodedElements;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
exports.default = DERElement;
|
|
562
562
|
//# sourceMappingURL=der.js.map
|