atcheck/lsscanner/new_ubuntu/node_modules_win/asn1js/build/asn1.js.map

1 line
317 KiB
Plaintext
Executable File

{"version":3,"sources":["../src/asn1.js"],"names":["powers2","Uint8Array","digitsString","LocalBaseBlock","constructor","parameters","blockLength","error","warnings","valueBeforeDecode","slice","ArrayBuffer","blockName","toJSON","byteLength","HexBlock","BaseClass","LocalHexBlockMixin","isHexOnly","valueHex","fromBER","inputBuffer","inputOffset","inputLength","intBuffer","length","push","toBER","sizeOnly","object","ex","LocalIdentificationBlock","idBlock","tagClass","tagNumber","isConstructed","firstOctet","retBuf","retView","number","encodedBuf","encodedView","size","i","curView","tagClassMask","tagNumberMask","count","tagNumberBufferMaxLength","intTagNumberBuffer","tempBuffer","tempBufferView","set","LocalLengthBlock","isIndefiniteForm","lenBlock","longFormUsed","lengthBufferView","ValueBlock","TypeError","BaseBlock","valueBlockType","name","optional","primitiveSchema","valueBlock","resultOffset","idBlockBuf","valueBlockSizeBuf","lenBlockBuf","valueBlockBuf","indefBuf","indefView","LocalPrimitiveValueBlock","valueHexView","Primitive","LocalConstructedValueBlock","value","initialOffset","initialLength","checkLen","indefiniteLength","currentOffset","returnObject","LocalFromBER","offset","result","concat","EndOfContent","pop","valueBuf","Constructed","LocalEndOfContentValueBlock","paramaters","LocalBooleanValueBlock","view","utilDecodeTC","call","Boolean","Sequence","Set","Null","LocalOctetStringValueBlock","prototype","currentBlockName","OctetString","isEqual","octetString","JSON","stringify","LocalBitStringValueBlock","unusedBits","BitString","bitString","LocalIntegerValueBlock","valueDec","_value","_valueHex","_valueDec","fromDER","expectedLength","updatedValueHex","updatedView","toDER","toString","viewAdd","first","second","c","firstView","secondView","firstViewCopy","firstViewCopyLength","secondViewCopy","secondViewCopyLength","max","counter","power2","n","p","digits","newValue","viewSub","b","firstBit","bitNumber","currentByte","asn1View","flag","byteNumber","charAt","Integer","otherValue","convertToDER","integer","convertFromDER","Enumerated","LocalSidValueBlock","isFirstSid","tempValueHex","tempView","sidValue","LocalObjectIdentifierValueBlock","fromString","sidBlock","string","pos1","pos2","sid","indexOf","substr","plus","parsedSID","parseInt","isNaN","sidStr","sidArray","ObjectIdentifier","LocalUtf8StringValueBlock","Utf8String","fromBuffer","String","fromCharCode","apply","decodeURIComponent","escape","inputString","str","unescape","encodeURIComponent","strLen","charCodeAt","LocalRelativeSidValueBlock","LocalRelativeObjectIdentifierValueBlock","RelativeObjectIdentifier","LocalBmpStringValueBlock","BmpString","copyBuffer","valueView","temp","Uint16Array","strLength","codeBuf","codeView","dif","j","LocalUniversalStringValueBlock","UniversalString","Uint32Array","LocalSimpleStringValueBlock","LocalSimpleStringBlock","NumericString","PrintableString","TeletexString","VideotexString","IA5String","GraphicString","VisibleString","GeneralString","CharacterString","UTCTime","year","month","day","hour","minute","fromDate","valueDate","toBuffer","buffer","inputDate","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","toDate","Date","UTC","parser","parserArray","exec","outputArray","Array","join","GeneralizedTime","millisecond","getUTCMilliseconds","isUTC","timeString","dateTimeString","fractionPart","hourDifference","minuteDifference","Number","valueOf","Error","multiplier","differencePosition","differenceString","fractionPointPosition","fractionPartCheck","fractionResult","Math","floor","tempDate","getUTCDay","DATE","TimeOfDay","DateTime","Duration","TIME","Choice","Any","Repeated","local","RawData","data","incomingOffset","localChangeType","inputObject","newType","newObject","Object","baseBlock","newASN1Type","compareSchema","root","inputData","inputSchema","choiceResult","verified","_result","hasOwnProperty","encodedId","decodedOffset","schemaView","replace","admission","maxLength","_optional","arrayRoot","asn1","verifySchema","fromJSON","json"],"mappings":";;;;;;;;;;;AAkCA;;AAlCA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA;AAEA;AACA;AACA;AACA,MAAMA,OAAO,GAAG,CAAC,IAAIC,UAAJ,CAAe,CAAC,CAAD,CAAf,CAAD,CAAhB;AACA,MAAMC,YAAY,GAAG,YAArB,C,CACA;AACA;AACA;AACA;AACA;;AACA;;;;;;;;;;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N9M,IAAAA,MAAM,EAAE0M;AAFF,GAAP,CAlcD,CAscC;AACA,C,CACD;AACA;;AACA;;;;;;;;AAMO,SAASgB,YAAT,CAAsB3R,WAAtB,EAAmC6Q,WAAnC,EACP;AACC;AACA,MAAIA,WAAW,YAAYN,MAAxB,KAAoC,KAAvC,EACA;AACC,WAAO;AACNQ,MAAAA,QAAQ,EAAE,KADJ;AAEN9M,MAAAA,MAAM,EAAE;AAAE/E,QAAAA,KAAK,EAAE;AAAT;AAFF,KAAP;AAIA,GARF,CASC;AAEA;;;AACA,QAAMwS,IAAI,GAAG3R,OAAO,CAACC,WAAD,CAApB;;AACA,MAAG0R,IAAI,CAAC1N,MAAL,KAAiB,CAAC,CAArB,EACA;AACC,WAAO;AACN+M,MAAAA,QAAQ,EAAE,KADJ;AAEN9M,MAAAA,MAAM,EAAEyN,IAAI,CAACzN;AAFP,KAAP;AAIA,GAnBF,CAoBC;AAEA;;;AACA,SAAOyM,aAAa,CAACgB,IAAI,CAACzN,MAAN,EAAcyN,IAAI,CAACzN,MAAnB,EAA2B4M,WAA3B,CAApB,CAvBD,CAwBC;AACA,C,CACD;AACA;AACA;AACA;AACA;AACA;;AACA;;;;;;AAIO,SAASe,QAAT,CAAkBC,IAAlB,EACP,CAEC,CAHM,CAEN;AAED;AACA;AACA","sourcesContent":["/* eslint-disable indent */\r\n/*\r\n * Copyright (c) 2016-2018, Peculiar Ventures\r\n * All rights reserved.\r\n *\r\n * Author 2016-2018, Yury Strozhevsky <www.strozhevsky.com>.\r\n *\r\n * Redistribution and use in source and binary forms, with or without modification,\r\n * are permitted provided that the following conditions are met:\r\n *\r\n * 1. Redistributions of source code must retain the above copyright notice,\r\n * this list of conditions and the following disclaimer.\r\n *\r\n * 2. Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * 3. Neither the name of the copyright holder nor the names of its contributors\r\n * may be used to endorse or promote products derived from this software without\r\n * specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\r\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\r\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\r\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\r\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY\r\n * OF SUCH DAMAGE.\r\n *\r\n */\r\n//**************************************************************************************\r\nimport { getParametersValue, padNumber, isEqualBuffer, bufferToHexCodes, checkBufferParams, utilToBase, utilFromBase, utilEncodeTC, utilDecodeTC, utilConcatBuf, utilConcatView } from \"pvutils\";\r\n//**************************************************************************************\r\n//region Declaration of global variables\r\n//**************************************************************************************\r\nconst powers2 = [new Uint8Array([1])];\r\nconst digitsString = \"0123456789\";\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration for \"LocalBaseBlock\" class\r\n//**************************************************************************************\r\n/**\r\n * Class used as a base block for all remaining ASN.1 classes\r\n * @typedef LocalBaseBlock\r\n * @interface\r\n * @property {number} blockLength\r\n * @property {string} error\r\n * @property {Array.<string>} warnings\r\n * @property {ArrayBuffer} valueBeforeDecode\r\n */\r\nclass LocalBaseBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"LocalBaseBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {ArrayBuffer} [valueBeforeDecode]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\t/**\r\n\t\t * @type {number} blockLength\r\n\t\t */\r\n\t\tthis.blockLength = getParametersValue(parameters, \"blockLength\", 0);\r\n\t\t/**\r\n\t\t * @type {string} error\r\n\t\t */\r\n\t\tthis.error = getParametersValue(parameters, \"error\", \"\");\r\n\t\t/**\r\n\t\t * @type {Array.<string>} warnings\r\n\t\t */\r\n\t\tthis.warnings = getParametersValue(parameters, \"warnings\", []);\r\n\t\t//noinspection JSCheckFunctionSignatures\r\n\t\t/**\r\n\t\t * @type {ArrayBuffer} valueBeforeDecode\r\n\t\t */\r\n\t\tif(\"valueBeforeDecode\" in parameters)\r\n\t\t\tthis.valueBeforeDecode = parameters.valueBeforeDecode.slice(0);\r\n\t\telse\r\n\t\t\tthis.valueBeforeDecode = new ArrayBuffer(0);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"baseBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Convertion for the block to JSON object\r\n\t * @returns {{blockName: string, blockLength: number, error: string, warnings: Array.<string>, valueBeforeDecode: string}}\r\n\t */\r\n\ttoJSON()\r\n\t{\r\n\t\treturn {\r\n\t\t\tblockName: this.constructor.blockName(),\r\n\t\t\tblockLength: this.blockLength,\r\n\t\t\terror: this.error,\r\n\t\t\twarnings: this.warnings,\r\n\t\t\tvalueBeforeDecode: bufferToHexCodes(this.valueBeforeDecode, 0, this.valueBeforeDecode.byteLength)\r\n\t\t};\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Description for \"HexBlock\" class\r\n//**************************************************************************************\r\n/**\r\n * Class used as a base block for all remaining ASN.1 classes\r\n * @extends LocalBaseBlock\r\n * @typedef HexBlock\r\n * @property {number} blockLength\r\n * @property {string} error\r\n * @property {Array.<string>} warnings\r\n * @property {ArrayBuffer} valueBeforeDecode\r\n * @property {boolean} isHexOnly\r\n * @property {ArrayBuffer} valueHex\r\n */\r\n//noinspection JSUnusedLocalSymbols\r\nexport const HexBlock = BaseClass => class LocalHexBlockMixin extends BaseClass\r\n{\r\n\t//**********************************************************************************\r\n\t//noinspection JSUnusedGlobalSymbols\r\n\t/**\r\n\t * Constructor for \"HexBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {ArrayBuffer} [valueHex]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\t/**\r\n\t\t * @type {boolean}\r\n\t\t */\r\n\t\tthis.isHexOnly = getParametersValue(parameters, \"isHexOnly\", false);\r\n\t\t/**\r\n\t\t * @type {ArrayBuffer}\r\n\t\t */\r\n\t\tif(\"valueHex\" in parameters)\r\n\t\t\tthis.valueHex = parameters.valueHex.slice(0);\r\n\t\telse\r\n\t\t\tthis.valueHex = new ArrayBuffer(0);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"hexBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number} Offset after least decoded byte\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\t//region Basic check for parameters\r\n\t\t//noinspection JSCheckFunctionSignatures\r\n\t\tif(checkBufferParams(this, inputBuffer, inputOffset, inputLength) === false)\r\n\t\t\treturn (-1);\r\n\t\t//endregion\r\n\r\n\t\t//region Getting Uint8Array from ArrayBuffer\r\n\t\tconst intBuffer = new Uint8Array(inputBuffer, inputOffset, inputLength);\r\n\t\t//endregion\r\n\r\n\t\t//region Initial checks\r\n\t\tif(intBuffer.length === 0)\r\n\t\t{\r\n\t\t\tthis.warnings.push(\"Zero buffer length\");\r\n\t\t\treturn inputOffset;\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\t//region Copy input buffer to internal buffer\r\n\t\tthis.valueHex = inputBuffer.slice(inputOffset, inputOffset + inputLength);\r\n\t\t//endregion\r\n\r\n\t\tthis.blockLength = inputLength;\r\n\r\n\t\treturn (inputOffset + inputLength);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules)\r\n\t * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoBER(sizeOnly = false)\r\n\t{\r\n\t\tif(this.isHexOnly !== true)\r\n\t\t{\r\n\t\t\tthis.error = \"Flag \\\"isHexOnly\\\" is not set, abort\";\r\n\t\t\treturn new ArrayBuffer(0);\r\n\t\t}\r\n\r\n\t\tif(sizeOnly === true)\r\n\t\t\treturn new ArrayBuffer(this.valueHex.byteLength);\r\n\r\n\t\t//noinspection JSCheckFunctionSignatures\r\n\t\treturn this.valueHex.slice(0);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Convertion for the block to JSON object\r\n\t * @returns {Object}\r\n\t */\r\n\ttoJSON()\r\n\t{\r\n\t\tlet object = {};\r\n\t\t\r\n\t\t//region Seems at the moment (Sep 2016) there is no way how to check method is supported in \"super\" object\r\n\t\ttry\r\n\t\t{\r\n\t\t\tobject = super.toJSON();\r\n\t\t}\r\n\t\tcatch(ex){}\r\n\t\t//endregion\r\n\r\n\t\tobject.blockName = this.constructor.blockName();\r\n\t\tobject.isHexOnly = this.isHexOnly;\r\n\t\tobject.valueHex = bufferToHexCodes(this.valueHex, 0, this.valueHex.byteLength);\r\n\r\n\t\treturn object;\r\n\t}\r\n\t//**********************************************************************************\r\n};\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of identification block class\r\n//**************************************************************************************\r\nclass LocalIdentificationBlock extends HexBlock(LocalBaseBlock)\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"LocalBaseBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {Object} [idBlock]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper();\r\n\r\n\t\tif(\"idBlock\" in parameters)\r\n\t\t{\r\n\t\t\t//region Properties from hexBlock class\r\n\t\t\tthis.isHexOnly = getParametersValue(parameters.idBlock, \"isHexOnly\", false);\r\n\t\t\tthis.valueHex = getParametersValue(parameters.idBlock, \"valueHex\", new ArrayBuffer(0));\r\n\t\t\t//endregion\r\n\r\n\t\t\tthis.tagClass = getParametersValue(parameters.idBlock, \"tagClass\", (-1));\r\n\t\t\tthis.tagNumber = getParametersValue(parameters.idBlock, \"tagNumber\", (-1));\r\n\t\t\tthis.isConstructed = getParametersValue(parameters.idBlock, \"isConstructed\", false);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.tagClass = (-1);\r\n\t\t\tthis.tagNumber = (-1);\r\n\t\t\tthis.isConstructed = false;\r\n\t\t}\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"identificationBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules)\r\n\t * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoBER(sizeOnly = false)\r\n\t{\r\n\t\t//region Initial variables\r\n\t\tlet firstOctet = 0;\r\n\t\tlet retBuf;\r\n\t\tlet retView;\r\n\t\t//endregion\r\n\r\n\t\tswitch(this.tagClass)\r\n\t\t{\r\n\t\t\tcase 1:\r\n\t\t\t\tfirstOctet |= 0x00; // UNIVERSAL\r\n\t\t\t\tbreak;\r\n\t\t\tcase 2:\r\n\t\t\t\tfirstOctet |= 0x40; // APPLICATION\r\n\t\t\t\tbreak;\r\n\t\t\tcase 3:\r\n\t\t\t\tfirstOctet |= 0x80; // CONTEXT-SPECIFIC\r\n\t\t\t\tbreak;\r\n\t\t\tcase 4:\r\n\t\t\t\tfirstOctet |= 0xC0; // PRIVATE\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tthis.error = \"Unknown tag class\";\r\n\t\t\t\treturn (new ArrayBuffer(0));\r\n\t\t}\r\n\r\n\t\tif(this.isConstructed)\r\n\t\t\tfirstOctet |= 0x20;\r\n\r\n\t\tif((this.tagNumber < 31) && (!this.isHexOnly))\r\n\t\t{\r\n\t\t\tretBuf = new ArrayBuffer(1);\r\n\t\t\tretView = new Uint8Array(retBuf);\r\n\r\n\t\t\tif(!sizeOnly)\r\n\t\t\t{\r\n\t\t\t\tlet number = this.tagNumber;\r\n\t\t\t\tnumber &= 0x1F;\r\n\t\t\t\tfirstOctet |= number;\r\n\r\n\t\t\t\tretView[0] = firstOctet;\r\n\t\t\t}\r\n\r\n\t\t\treturn retBuf;\r\n\t\t}\r\n\r\n\t\tif(this.isHexOnly === false)\r\n\t\t{\r\n\t\t\tconst encodedBuf = utilToBase(this.tagNumber, 7);\r\n\t\t\tconst encodedView = new Uint8Array(encodedBuf);\r\n\t\t\tconst size = encodedBuf.byteLength;\r\n\r\n\t\t\tretBuf = new ArrayBuffer(size + 1);\r\n\t\t\tretView = new Uint8Array(retBuf);\r\n\t\t\tretView[0] = (firstOctet | 0x1F);\r\n\r\n\t\t\tif(!sizeOnly)\r\n\t\t\t{\r\n\t\t\t\tfor(let i = 0; i < (size - 1); i++)\r\n\t\t\t\t\tretView[i + 1] = encodedView[i] | 0x80;\r\n\r\n\t\t\t\tretView[size] = encodedView[size - 1];\r\n\t\t\t}\r\n\r\n\t\t\treturn retBuf;\r\n\t\t}\r\n\r\n\t\tretBuf = new ArrayBuffer(this.valueHex.byteLength + 1);\r\n\t\tretView = new Uint8Array(retBuf);\r\n\r\n\t\tretView[0] = (firstOctet | 0x1F);\r\n\r\n\t\tif(sizeOnly === false)\r\n\t\t{\r\n\t\t\tconst curView = new Uint8Array(this.valueHex);\r\n\r\n\t\t\tfor(let i = 0; i < (curView.length - 1); i++)\r\n\t\t\t\tretView[i + 1] = curView[i] | 0x80;\r\n\r\n\t\t\tretView[this.valueHex.byteLength] = curView[curView.length - 1];\r\n\t\t}\r\n\r\n\t\treturn retBuf;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number}\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\t//region Basic check for parameters\r\n\t\t//noinspection JSCheckFunctionSignatures\r\n\t\tif(checkBufferParams(this, inputBuffer, inputOffset, inputLength) === false)\r\n\t\t\treturn (-1);\r\n\t\t//endregion\r\n\r\n\t\t//region Getting Uint8Array from ArrayBuffer\r\n\t\tconst intBuffer = new Uint8Array(inputBuffer, inputOffset, inputLength);\r\n\t\t//endregion\r\n\r\n\t\t//region Initial checks\r\n\t\tif(intBuffer.length === 0)\r\n\t\t{\r\n\t\t\tthis.error = \"Zero buffer length\";\r\n\t\t\treturn (-1);\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\t//region Find tag class\r\n\t\tconst tagClassMask = intBuffer[0] & 0xC0;\r\n\r\n\t\tswitch(tagClassMask)\r\n\t\t{\r\n\t\t\tcase 0x00:\r\n\t\t\t\tthis.tagClass = (1); // UNIVERSAL\r\n\t\t\t\tbreak;\r\n\t\t\tcase 0x40:\r\n\t\t\t\tthis.tagClass = (2); // APPLICATION\r\n\t\t\t\tbreak;\r\n\t\t\tcase 0x80:\r\n\t\t\t\tthis.tagClass = (3); // CONTEXT-SPECIFIC\r\n\t\t\t\tbreak;\r\n\t\t\tcase 0xC0:\r\n\t\t\t\tthis.tagClass = (4); // PRIVATE\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tthis.error = \"Unknown tag class\";\r\n\t\t\t\treturn (-1);\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\t//region Find it's constructed or not\r\n\t\tthis.isConstructed = (intBuffer[0] & 0x20) === 0x20;\r\n\t\t//endregion\r\n\r\n\t\t//region Find tag number\r\n\t\tthis.isHexOnly = false;\r\n\r\n\t\tconst tagNumberMask = intBuffer[0] & 0x1F;\r\n\r\n\t\t//region Simple case (tag number < 31)\r\n\t\tif(tagNumberMask !== 0x1F)\r\n\t\t{\r\n\t\t\tthis.tagNumber = (tagNumberMask);\r\n\t\t\tthis.blockLength = 1;\r\n\t\t}\r\n\t\t//endregion\r\n\t\t//region Tag number bigger or equal to 31\r\n\t\telse\r\n\t\t{\r\n\t\t\tlet count = 1;\r\n\r\n\t\t\tthis.valueHex = new ArrayBuffer(255);\r\n\t\t\tlet tagNumberBufferMaxLength = 255;\r\n\t\t\tlet intTagNumberBuffer = new Uint8Array(this.valueHex);\r\n\r\n\t\t\t//noinspection JSBitwiseOperatorUsage\r\n\t\t\twhile(intBuffer[count] & 0x80)\r\n\t\t\t{\r\n\t\t\t\tintTagNumberBuffer[count - 1] = intBuffer[count] & 0x7F;\r\n\t\t\t\tcount++;\r\n\r\n\t\t\t\tif(count >= intBuffer.length)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.error = \"End of input reached before message was fully decoded\";\r\n\t\t\t\t\treturn (-1);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//region In case if tag number length is greater than 255 bytes (rare but possible case)\r\n\t\t\t\tif(count === tagNumberBufferMaxLength)\r\n\t\t\t\t{\r\n\t\t\t\t\ttagNumberBufferMaxLength += 255;\r\n\r\n\t\t\t\t\tconst tempBuffer = new ArrayBuffer(tagNumberBufferMaxLength);\r\n\t\t\t\t\tconst tempBufferView = new Uint8Array(tempBuffer);\r\n\r\n\t\t\t\t\tfor(let i = 0; i < intTagNumberBuffer.length; i++)\r\n\t\t\t\t\t\ttempBufferView[i] = intTagNumberBuffer[i];\r\n\r\n\t\t\t\t\tthis.valueHex = new ArrayBuffer(tagNumberBufferMaxLength);\r\n\t\t\t\t\tintTagNumberBuffer = new Uint8Array(this.valueHex);\r\n\t\t\t\t}\r\n\t\t\t\t//endregion\r\n\t\t\t}\r\n\r\n\t\t\tthis.blockLength = (count + 1);\r\n\t\t\tintTagNumberBuffer[count - 1] = intBuffer[count] & 0x7F; // Write last byte to buffer\r\n\r\n\t\t\t//region Cut buffer\r\n\t\t\tconst tempBuffer = new ArrayBuffer(count);\r\n\t\t\tconst tempBufferView = new Uint8Array(tempBuffer);\r\n\r\n\t\t\tfor(let i = 0; i < count; i++)\r\n\t\t\t\ttempBufferView[i] = intTagNumberBuffer[i];\r\n\r\n\t\t\tthis.valueHex = new ArrayBuffer(count);\r\n\t\t\tintTagNumberBuffer = new Uint8Array(this.valueHex);\r\n\t\t\tintTagNumberBuffer.set(tempBufferView);\r\n\t\t\t//endregion\r\n\r\n\t\t\t//region Try to convert long tag number to short form\r\n\t\t\tif(this.blockLength <= 9)\r\n\t\t\t\tthis.tagNumber = utilFromBase(intTagNumberBuffer, 7);\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tthis.isHexOnly = true;\r\n\t\t\t\tthis.warnings.push(\"Tag too long, represented as hex-coded\");\r\n\t\t\t}\r\n\t\t\t//endregion\r\n\t\t}\r\n\t\t//endregion\r\n\t\t//endregion\r\n\r\n\t\t//region Check if constructed encoding was using for primitive type\r\n\t\tif(((this.tagClass === 1)) &&\r\n\t\t\t(this.isConstructed))\r\n\t\t{\r\n\t\t\tswitch(this.tagNumber)\r\n\t\t\t{\r\n\t\t\t\tcase 1: // Boolean\r\n\t\t\t\tcase 2: // REAL\r\n\t\t\t\tcase 5: // Null\r\n\t\t\t\tcase 6: // OBJECT IDENTIFIER\r\n\t\t\t\tcase 9: // REAL\r\n\t\t\t\tcase 13: // RELATIVE OBJECT IDENTIFIER\r\n\t\t\t\tcase 14: // Time\r\n\t\t\t\tcase 23:\r\n\t\t\t\tcase 24:\r\n\t\t\t\tcase 31:\r\n\t\t\t\tcase 32:\r\n\t\t\t\tcase 33:\r\n\t\t\t\tcase 34:\r\n\t\t\t\t\tthis.error = \"Constructed encoding used for primitive type\";\r\n\t\t\t\t\treturn (-1);\r\n\t\t\t\tdefault:\r\n\t\t\t}\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\treturn (inputOffset + this.blockLength); // Return current offset in input buffer\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Convertion for the block to JSON object\r\n\t * @returns {{blockName: string,\r\n\t * tagClass: number,\r\n\t * tagNumber: number,\r\n\t * isConstructed: boolean,\r\n\t * isHexOnly: boolean,\r\n\t * valueHex: ArrayBuffer,\r\n\t * blockLength: number,\r\n\t * error: string, warnings: Array.<string>,\r\n\t * valueBeforeDecode: string}}\r\n\t */\r\n\ttoJSON()\r\n\t{\r\n\t\tlet object = {};\r\n\t\t\r\n\t\t//region Seems at the moment (Sep 2016) there is no way how to check method is supported in \"super\" object\r\n\t\ttry\r\n\t\t{\r\n\t\t\tobject = super.toJSON();\r\n\t\t}\r\n\t\tcatch(ex){}\r\n\t\t//endregion\r\n\r\n\t\tobject.blockName = this.constructor.blockName();\r\n\t\tobject.tagClass = this.tagClass;\r\n\t\tobject.tagNumber = this.tagNumber;\r\n\t\tobject.isConstructed = this.isConstructed;\r\n\r\n\t\treturn object;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of length block class\r\n//**************************************************************************************\r\nclass LocalLengthBlock extends LocalBaseBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"LocalLengthBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {Object} [lenBlock]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper();\r\n\r\n\t\tif(\"lenBlock\" in parameters)\r\n\t\t{\r\n\t\t\tthis.isIndefiniteForm = getParametersValue(parameters.lenBlock, \"isIndefiniteForm\", false);\r\n\t\t\tthis.longFormUsed = getParametersValue(parameters.lenBlock, \"longFormUsed\", false);\r\n\t\t\tthis.length = getParametersValue(parameters.lenBlock, \"length\", 0);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.isIndefiniteForm = false;\r\n\t\t\tthis.longFormUsed = false;\r\n\t\t\tthis.length = 0;\r\n\t\t}\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"lengthBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number}\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\t//region Basic check for parameters\r\n\t\t//noinspection JSCheckFunctionSignatures\r\n\t\tif(checkBufferParams(this, inputBuffer, inputOffset, inputLength) === false)\r\n\t\t\treturn (-1);\r\n\t\t//endregion\r\n\r\n\t\t//region Getting Uint8Array from ArrayBuffer\r\n\t\tconst intBuffer = new Uint8Array(inputBuffer, inputOffset, inputLength);\r\n\t\t//endregion\r\n\r\n\t\t//region Initial checks\r\n\t\tif(intBuffer.length === 0)\r\n\t\t{\r\n\t\t\tthis.error = \"Zero buffer length\";\r\n\t\t\treturn (-1);\r\n\t\t}\r\n\r\n\t\tif(intBuffer[0] === 0xFF)\r\n\t\t{\r\n\t\t\tthis.error = \"Length block 0xFF is reserved by standard\";\r\n\t\t\treturn (-1);\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\t//region Check for length form type\r\n\t\tthis.isIndefiniteForm = intBuffer[0] === 0x80;\r\n\t\t//endregion\r\n\r\n\t\t//region Stop working in case of indefinite length form\r\n\t\tif(this.isIndefiniteForm === true)\r\n\t\t{\r\n\t\t\tthis.blockLength = 1;\r\n\t\t\treturn (inputOffset + this.blockLength);\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\t//region Check is long form of length encoding using\r\n\t\tthis.longFormUsed = !!(intBuffer[0] & 0x80);\r\n\t\t//endregion\r\n\r\n\t\t//region Stop working in case of short form of length value\r\n\t\tif(this.longFormUsed === false)\r\n\t\t{\r\n\t\t\tthis.length = (intBuffer[0]);\r\n\t\t\tthis.blockLength = 1;\r\n\t\t\treturn (inputOffset + this.blockLength);\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\t//region Calculate length value in case of long form\r\n\t\tconst count = intBuffer[0] & 0x7F;\r\n\r\n\t\tif(count > 8) // Too big length value\r\n\t\t{\r\n\t\t\tthis.error = \"Too big integer\";\r\n\t\t\treturn (-1);\r\n\t\t}\r\n\r\n\t\tif((count + 1) > intBuffer.length)\r\n\t\t{\r\n\t\t\tthis.error = \"End of input reached before message was fully decoded\";\r\n\t\t\treturn (-1);\r\n\t\t}\r\n\r\n\t\tconst lengthBufferView = new Uint8Array(count);\r\n\r\n\t\tfor(let i = 0; i < count; i++)\r\n\t\t\tlengthBufferView[i] = intBuffer[i + 1];\r\n\r\n\t\tif(lengthBufferView[count - 1] === 0x00)\r\n\t\t\tthis.warnings.push(\"Needlessly long encoded length\");\r\n\r\n\t\tthis.length = utilFromBase(lengthBufferView, 8);\r\n\r\n\t\tif(this.longFormUsed && (this.length <= 127))\r\n\t\t\tthis.warnings.push(\"Unneccesary usage of long length form\");\r\n\r\n\t\tthis.blockLength = count + 1;\r\n\t\t//endregion\r\n\r\n\t\treturn (inputOffset + this.blockLength); // Return current offset in input buffer\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules)\r\n\t * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoBER(sizeOnly = false)\r\n\t{\r\n\t\t//region Initial variables\r\n\t\tlet retBuf;\r\n\t\tlet retView;\r\n\t\t//endregion\r\n\r\n\t\tif(this.length > 127)\r\n\t\t\tthis.longFormUsed = true;\r\n\r\n\t\tif(this.isIndefiniteForm)\r\n\t\t{\r\n\t\t\tretBuf = new ArrayBuffer(1);\r\n\r\n\t\t\tif(sizeOnly === false)\r\n\t\t\t{\r\n\t\t\t\tretView = new Uint8Array(retBuf);\r\n\t\t\t\tretView[0] = 0x80;\r\n\t\t\t}\r\n\r\n\t\t\treturn retBuf;\r\n\t\t}\r\n\r\n\t\tif(this.longFormUsed === true)\r\n\t\t{\r\n\t\t\tconst encodedBuf = utilToBase(this.length, 8);\r\n\r\n\t\t\tif(encodedBuf.byteLength > 127)\r\n\t\t\t{\r\n\t\t\t\tthis.error = \"Too big length\";\r\n\t\t\t\treturn (new ArrayBuffer(0));\r\n\t\t\t}\r\n\r\n\t\t\tretBuf = new ArrayBuffer(encodedBuf.byteLength + 1);\r\n\r\n\t\t\tif(sizeOnly === true)\r\n\t\t\t\treturn retBuf;\r\n\r\n\t\t\tconst encodedView = new Uint8Array(encodedBuf);\r\n\t\t\tretView = new Uint8Array(retBuf);\r\n\r\n\t\t\tretView[0] = encodedBuf.byteLength | 0x80;\r\n\r\n\t\t\tfor(let i = 0; i < encodedBuf.byteLength; i++)\r\n\t\t\t\tretView[i + 1] = encodedView[i];\r\n\r\n\t\t\treturn retBuf;\r\n\t\t}\r\n\r\n\t\tretBuf = new ArrayBuffer(1);\r\n\r\n\t\tif(sizeOnly === false)\r\n\t\t{\r\n\t\t\tretView = new Uint8Array(retBuf);\r\n\r\n\t\t\tretView[0] = this.length;\r\n\t\t}\r\n\r\n\t\treturn retBuf;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Convertion for the block to JSON object\r\n\t * @returns {{blockName, blockLength, error, warnings, valueBeforeDecode}|{blockName: string, blockLength: number, error: string, warnings: Array.<string>, valueBeforeDecode: string}}\r\n\t */\r\n\ttoJSON()\r\n\t{\r\n\t\tlet object = {};\r\n\t\t\r\n\t\t//region Seems at the moment (Sep 2016) there is no way how to check method is supported in \"super\" object\r\n\t\ttry\r\n\t\t{\r\n\t\t\tobject = super.toJSON();\r\n\t\t}\r\n\t\tcatch(ex){}\r\n\t\t//endregion\r\n\r\n\t\tobject.blockName = this.constructor.blockName();\r\n\t\tobject.isIndefiniteForm = this.isIndefiniteForm;\r\n\t\tobject.longFormUsed = this.longFormUsed;\r\n\t\tobject.length = this.length;\r\n\r\n\t\treturn object;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of value block class\r\n//**************************************************************************************\r\nexport class ValueBlock extends LocalBaseBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"ValueBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"valueBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t//noinspection JSUnusedLocalSymbols,JSUnusedLocalSymbols,JSUnusedLocalSymbols\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number}\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\t//region Throw an exception for a function which needs to be specified in extended classes\r\n\t\tthrow TypeError(\"User need to make a specific function in a class which extends \\\"ValueBlock\\\"\");\r\n\t\t//endregion\r\n\t}\r\n\t//**********************************************************************************\r\n\t//noinspection JSUnusedLocalSymbols\r\n\t/**\r\n\t * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules)\r\n\t * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoBER(sizeOnly = false)\r\n\t{\r\n\t\t//region Throw an exception for a function which needs to be specified in extended classes\r\n\t\tthrow TypeError(\"User need to make a specific function in a class which extends \\\"ValueBlock\\\"\");\r\n\t\t//endregion\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of basic ASN.1 block class\r\n//**************************************************************************************\r\nexport class BaseBlock extends LocalBaseBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"BaseBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {Object} [primitiveSchema]\r\n\t * @property {string} [name]\r\n\t * @property {boolean} [optional]\r\n\t * @param valueBlockType Type of value block\r\n\t */\r\n\tconstructor(parameters = {}, valueBlockType = ValueBlock)\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tif(\"name\" in parameters)\r\n\t\t\tthis.name = parameters.name;\r\n\t\tif(\"optional\" in parameters)\r\n\t\t\tthis.optional = parameters.optional;\r\n\t\tif(\"primitiveSchema\" in parameters)\r\n\t\t\tthis.primitiveSchema = parameters.primitiveSchema;\r\n\r\n\t\tthis.idBlock = new LocalIdentificationBlock(parameters);\r\n\t\tthis.lenBlock = new LocalLengthBlock(parameters);\r\n\t\tthis.valueBlock = new valueBlockType(parameters);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"BaseBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number}\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\tconst resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, (this.lenBlock.isIndefiniteForm === true) ? inputLength : this.lenBlock.length);\r\n\t\tif(resultOffset === (-1))\r\n\t\t{\r\n\t\t\tthis.error = this.valueBlock.error;\r\n\t\t\treturn resultOffset;\r\n\t\t}\r\n\r\n\t\tif(this.idBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.idBlock.blockLength;\r\n\r\n\t\tif(this.lenBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.lenBlock.blockLength;\r\n\r\n\t\tif(this.valueBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.valueBlock.blockLength;\r\n\r\n\t\treturn resultOffset;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules)\r\n\t * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoBER(sizeOnly = false)\r\n\t{\r\n\t\tlet retBuf;\r\n\r\n\t\tconst idBlockBuf = this.idBlock.toBER(sizeOnly);\r\n\t\tconst valueBlockSizeBuf = this.valueBlock.toBER(true);\r\n\r\n\t\tthis.lenBlock.length = valueBlockSizeBuf.byteLength;\r\n\t\tconst lenBlockBuf = this.lenBlock.toBER(sizeOnly);\r\n\r\n\t\tretBuf = utilConcatBuf(idBlockBuf, lenBlockBuf);\r\n\r\n\t\tlet valueBlockBuf;\r\n\r\n\t\tif(sizeOnly === false)\r\n\t\t\tvalueBlockBuf = this.valueBlock.toBER(sizeOnly);\r\n\t\telse\r\n\t\t\tvalueBlockBuf = new ArrayBuffer(this.lenBlock.length);\r\n\r\n\t\tretBuf = utilConcatBuf(retBuf, valueBlockBuf);\r\n\r\n\t\tif(this.lenBlock.isIndefiniteForm === true)\r\n\t\t{\r\n\t\t\tconst indefBuf = new ArrayBuffer(2);\r\n\r\n\t\t\tif(sizeOnly === false)\r\n\t\t\t{\r\n\t\t\t\tconst indefView = new Uint8Array(indefBuf);\r\n\r\n\t\t\t\tindefView[0] = 0x00;\r\n\t\t\t\tindefView[1] = 0x00;\r\n\t\t\t}\r\n\r\n\t\t\tretBuf = utilConcatBuf(retBuf, indefBuf);\r\n\t\t}\r\n\r\n\t\treturn retBuf;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Convertion for the block to JSON object\r\n\t * @returns {{blockName, blockLength, error, warnings, valueBeforeDecode}|{blockName: string, blockLength: number, error: string, warnings: Array.<string>, valueBeforeDecode: string}}\r\n\t */\r\n\ttoJSON()\r\n\t{\r\n\t\tlet object = {};\r\n\t\t\r\n\t\t//region Seems at the moment (Sep 2016) there is no way how to check method is supported in \"super\" object\r\n\t\ttry\r\n\t\t{\r\n\t\t\tobject = super.toJSON();\r\n\t\t}\r\n\t\tcatch(ex){}\r\n\t\t//endregion\r\n\r\n\t\tobject.idBlock = this.idBlock.toJSON();\r\n\t\tobject.lenBlock = this.lenBlock.toJSON();\r\n\t\tobject.valueBlock = this.valueBlock.toJSON();\r\n\r\n\t\tif(\"name\" in this)\r\n\t\t\tobject.name = this.name;\r\n\t\tif(\"optional\" in this)\r\n\t\t\tobject.optional = this.optional;\r\n\t\tif(\"primitiveSchema\" in this)\r\n\t\t\tobject.primitiveSchema = this.primitiveSchema.toJSON();\r\n\r\n\t\treturn object;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of basic block for all PRIMITIVE types\r\n//**************************************************************************************\r\nclass LocalPrimitiveValueBlock extends ValueBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"LocalPrimitiveValueBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {ArrayBuffer} [valueBeforeDecode]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\t//region Variables from \"hexBlock\" class\r\n\t\tif(\"valueHex\" in parameters)\r\n\t\t\tthis.valueHex = parameters.valueHex.slice(0);\r\n\t\telse\r\n\t\t\tthis.valueHex = new ArrayBuffer(0);\r\n\r\n\t\tthis.isHexOnly = getParametersValue(parameters, \"isHexOnly\", true);\r\n\t\t//endregion\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number}\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\t//region Basic check for parameters\r\n\t\t//noinspection JSCheckFunctionSignatures\r\n\t\tif(checkBufferParams(this, inputBuffer, inputOffset, inputLength) === false)\r\n\t\t\treturn (-1);\r\n\t\t//endregion\r\n\r\n\t\t//region Getting Uint8Array from ArrayBuffer\r\n\t\tconst intBuffer = new Uint8Array(inputBuffer, inputOffset, inputLength);\r\n\t\t//endregion\r\n\r\n\t\t//region Initial checks\r\n\t\tif(intBuffer.length === 0)\r\n\t\t{\r\n\t\t\tthis.warnings.push(\"Zero buffer length\");\r\n\t\t\treturn inputOffset;\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\t//region Copy input buffer into internal buffer\r\n\t\tthis.valueHex = new ArrayBuffer(intBuffer.length);\r\n\t\tconst valueHexView = new Uint8Array(this.valueHex);\r\n\r\n\t\tfor(let i = 0; i < intBuffer.length; i++)\r\n\t\t\tvalueHexView[i] = intBuffer[i];\r\n\t\t//endregion\r\n\r\n\t\tthis.blockLength = inputLength;\r\n\r\n\t\treturn (inputOffset + inputLength);\r\n\t}\r\n\t//**********************************************************************************\r\n\t//noinspection JSUnusedLocalSymbols\r\n\t/**\r\n\t * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules)\r\n\t * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoBER(sizeOnly = false)\r\n\t{\r\n\t\treturn this.valueHex.slice(0);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"PrimitiveValueBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Convertion for the block to JSON object\r\n\t * @returns {{blockName, blockLength, error, warnings, valueBeforeDecode}|{blockName: string, blockLength: number, error: string, warnings: Array.<string>, valueBeforeDecode: string}}\r\n\t */\r\n\ttoJSON()\r\n\t{\r\n\t\tlet object = {};\r\n\t\t\r\n\t\t//region Seems at the moment (Sep 2016) there is no way how to check method is supported in \"super\" object\r\n\t\ttry\r\n\t\t{\r\n\t\t\tobject = super.toJSON();\r\n\t\t}\r\n\t\tcatch(ex){}\r\n\t\t//endregion\r\n\r\n\t\tobject.valueHex = bufferToHexCodes(this.valueHex, 0, this.valueHex.byteLength);\r\n\t\tobject.isHexOnly = this.isHexOnly;\r\n\r\n\t\treturn object;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\nexport class Primitive extends BaseBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"Primitive\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {ArrayBuffer} [valueHex]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters, LocalPrimitiveValueBlock);\r\n\r\n\t\tthis.idBlock.isConstructed = false;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"PRIMITIVE\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of basic block for all CONSTRUCTED types\r\n//**************************************************************************************\r\nclass LocalConstructedValueBlock extends ValueBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"LocalConstructedValueBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.value = getParametersValue(parameters, \"value\", []);\r\n\t\tthis.isIndefiniteForm = getParametersValue(parameters, \"isIndefiniteForm\", false);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number}\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\t//region Store initial offset and length\r\n\t\tconst initialOffset = inputOffset;\r\n\t\tconst initialLength = inputLength;\r\n\t\t//endregion\r\n\r\n\t\t//region Basic check for parameters\r\n\t\t//noinspection JSCheckFunctionSignatures\r\n\t\tif(checkBufferParams(this, inputBuffer, inputOffset, inputLength) === false)\r\n\t\t\treturn (-1);\r\n\t\t//endregion\r\n\r\n\t\t//region Getting Uint8Array from ArrayBuffer\r\n\t\tconst intBuffer = new Uint8Array(inputBuffer, inputOffset, inputLength);\r\n\t\t//endregion\r\n\r\n\t\t//region Initial checks\r\n\t\tif(intBuffer.length === 0)\r\n\t\t{\r\n\t\t\tthis.warnings.push(\"Zero buffer length\");\r\n\t\t\treturn inputOffset;\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\t//region Aux function\r\n\t\tfunction checkLen(indefiniteLength, length)\r\n\t\t{\r\n\t\t\tif(indefiniteLength === true)\r\n\t\t\t\treturn 1;\r\n\r\n\t\t\treturn length;\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\tlet currentOffset = inputOffset;\r\n\r\n\t\twhile(checkLen(this.isIndefiniteForm, inputLength) > 0)\r\n\t\t{\r\n\t\t\tconst returnObject = LocalFromBER(inputBuffer, currentOffset, inputLength);\r\n\t\t\tif(returnObject.offset === (-1))\r\n\t\t\t{\r\n\t\t\t\tthis.error = returnObject.result.error;\r\n\t\t\t\tthis.warnings.concat(returnObject.result.warnings);\r\n\t\t\t\treturn (-1);\r\n\t\t\t}\r\n\r\n\t\t\tcurrentOffset = returnObject.offset;\r\n\r\n\t\t\tthis.blockLength += returnObject.result.blockLength;\r\n\t\t\tinputLength -= returnObject.result.blockLength;\r\n\r\n\t\t\tthis.value.push(returnObject.result);\r\n\r\n\t\t\tif((this.isIndefiniteForm === true) && (returnObject.result.constructor.blockName() === EndOfContent.blockName()))\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\tif(this.isIndefiniteForm === true)\r\n\t\t{\r\n\t\t\tif(this.value[this.value.length - 1].constructor.blockName() === EndOfContent.blockName())\r\n\t\t\t\tthis.value.pop();\r\n\t\t\telse\r\n\t\t\t\tthis.warnings.push(\"No EndOfContent block encoded\");\r\n\t\t}\r\n\r\n\t\t//region Copy \"inputBuffer\" to \"valueBeforeDecode\"\r\n\t\tthis.valueBeforeDecode = inputBuffer.slice(initialOffset, initialOffset + initialLength);\r\n\t\t//endregion\r\n\r\n\t\treturn currentOffset;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules)\r\n\t * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoBER(sizeOnly = false)\r\n\t{\r\n\t\tlet retBuf = new ArrayBuffer(0);\r\n\r\n\t\tfor(let i = 0; i < this.value.length; i++)\r\n\t\t{\r\n\t\t\tconst valueBuf = this.value[i].toBER(sizeOnly);\r\n\t\t\tretBuf = utilConcatBuf(retBuf, valueBuf);\r\n\t\t}\r\n\r\n\t\treturn retBuf;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"ConstructedValueBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Convertion for the block to JSON object\r\n\t * @returns {{blockName, blockLength, error, warnings, valueBeforeDecode}|{blockName: string, blockLength: number, error: string, warnings: Array.<string>, valueBeforeDecode: string}}\r\n\t */\r\n\ttoJSON()\r\n\t{\r\n\t\tlet object = {};\r\n\t\t\r\n\t\t//region Seems at the moment (Sep 2016) there is no way how to check method is supported in \"super\" object\r\n\t\ttry\r\n\t\t{\r\n\t\t\tobject = super.toJSON();\r\n\t\t}\r\n\t\tcatch(ex){}\r\n\t\t//endregion\r\n\r\n\t\tobject.isIndefiniteForm = this.isIndefiniteForm;\r\n\t\tobject.value = [];\r\n\t\tfor(let i = 0; i < this.value.length; i++)\r\n\t\t\tobject.value.push(this.value[i].toJSON());\r\n\r\n\t\treturn object;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\nexport class Constructed extends BaseBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"Constructed\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters, LocalConstructedValueBlock);\r\n\r\n\t\tthis.idBlock.isConstructed = true;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"CONSTRUCTED\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number}\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\tthis.valueBlock.isIndefiniteForm = this.lenBlock.isIndefiniteForm;\r\n\r\n\t\tconst resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, (this.lenBlock.isIndefiniteForm === true) ? inputLength : this.lenBlock.length);\r\n\t\tif(resultOffset === (-1))\r\n\t\t{\r\n\t\t\tthis.error = this.valueBlock.error;\r\n\t\t\treturn resultOffset;\r\n\t\t}\r\n\r\n\t\tif(this.idBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.idBlock.blockLength;\r\n\r\n\t\tif(this.lenBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.lenBlock.blockLength;\r\n\r\n\t\tif(this.valueBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.valueBlock.blockLength;\r\n\r\n\t\treturn resultOffset;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of ASN.1 EndOfContent type class\r\n//**************************************************************************************\r\nclass LocalEndOfContentValueBlock extends ValueBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"LocalEndOfContentValueBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\t}\r\n\t//**********************************************************************************\r\n\t//noinspection JSUnusedLocalSymbols,JSUnusedLocalSymbols\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number}\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\t//region There is no \"value block\" for EndOfContent type and we need to return the same offset\r\n\t\treturn inputOffset;\r\n\t\t//endregion\r\n\t}\r\n\t//**********************************************************************************\r\n\t//noinspection JSUnusedLocalSymbols\r\n\t/**\r\n\t * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules)\r\n\t * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoBER(sizeOnly = false)\r\n\t{\r\n\t\treturn new ArrayBuffer(0);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"EndOfContentValueBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\nexport class EndOfContent extends BaseBlock\r\n{\r\n\t//**********************************************************************************\r\n\tconstructor(paramaters = {})\r\n\t{\r\n\t\tsuper(paramaters, LocalEndOfContentValueBlock);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 0; // EndOfContent\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"EndOfContent\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of ASN.1 Boolean type class\r\n//**************************************************************************************\r\nclass LocalBooleanValueBlock extends ValueBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"LocalBooleanValueBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\t\t\r\n\t\tthis.value = getParametersValue(parameters, \"value\", false);\r\n\t\tthis.isHexOnly = getParametersValue(parameters, \"isHexOnly\", false);\r\n\t\t\r\n\t\tif(\"valueHex\" in parameters)\r\n\t\t\tthis.valueHex = parameters.valueHex.slice(0);\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.valueHex = new ArrayBuffer(1);\r\n\t\t\tif(this.value === true)\r\n\t\t\t{\r\n\t\t\t\tconst view = new Uint8Array(this.valueHex);\r\n\t\t\t\tview[0] = 0xFF;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number} Offset after least decoded byte\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\t//region Basic check for parameters\r\n\t\t//noinspection JSCheckFunctionSignatures\r\n\t\tif(checkBufferParams(this, inputBuffer, inputOffset, inputLength) === false)\r\n\t\t\treturn (-1);\r\n\t\t//endregion\r\n\r\n\t\t//region Getting Uint8Array from ArrayBuffer\r\n\t\tconst intBuffer = new Uint8Array(inputBuffer, inputOffset, inputLength);\r\n\t\t//endregion\r\n\r\n\t\tif(inputLength > 1)\r\n\t\t\tthis.warnings.push(\"Boolean value encoded in more then 1 octet\");\r\n\r\n\t\tthis.isHexOnly = true;\r\n\r\n\t\t//region Copy input buffer to internal array\r\n\t\tthis.valueHex = new ArrayBuffer(intBuffer.length);\r\n\t\tconst view = new Uint8Array(this.valueHex);\r\n\r\n\t\tfor(let i = 0; i < intBuffer.length; i++)\r\n\t\t\tview[i] = intBuffer[i];\r\n\t\t//endregion\r\n\t\t\r\n\t\tif(utilDecodeTC.call(this) !== 0 )\r\n\t\t\tthis.value = true;\r\n\t\telse\r\n\t\t\tthis.value = false;\r\n\r\n\t\tthis.blockLength = inputLength;\r\n\r\n\t\treturn (inputOffset + inputLength);\r\n\t}\r\n\t//**********************************************************************************\r\n\t//noinspection JSUnusedLocalSymbols\r\n\t/**\r\n\t * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules)\r\n\t * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoBER(sizeOnly = false)\r\n\t{\r\n\t\treturn this.valueHex;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"BooleanValueBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Convertion for the block to JSON object\r\n\t * @returns {{blockName, blockLength, error, warnings, valueBeforeDecode}|{blockName: string, blockLength: number, error: string, warnings: Array.<string>, valueBeforeDecode: string}}\r\n\t */\r\n\ttoJSON()\r\n\t{\r\n\t\tlet object = {};\r\n\t\t\r\n\t\t//region Seems at the moment (Sep 2016) there is no way how to check method is supported in \"super\" object\r\n\t\ttry\r\n\t\t{\r\n\t\t\tobject = super.toJSON();\r\n\t\t}\r\n\t\tcatch(ex){}\r\n\t\t//endregion\r\n\r\n\t\tobject.value = this.value;\r\n\t\tobject.isHexOnly = this.isHexOnly;\r\n\t\tobject.valueHex = bufferToHexCodes(this.valueHex, 0, this.valueHex.byteLength);\r\n\r\n\t\treturn object;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\nexport class Boolean extends BaseBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"Boolean\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters, LocalBooleanValueBlock);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 1; // Boolean\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"Boolean\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of ASN.1 Sequence and Set type classes\r\n//**************************************************************************************\r\nexport class Sequence extends Constructed\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"Sequence\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 16; // Sequence\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"Sequence\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\nexport class Set extends Constructed\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"Set\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 17; // Set\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"Set\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of ASN.1 Null type class\r\n//**************************************************************************************\r\nexport class Null extends BaseBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"Null\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters, LocalBaseBlock); // We will not have a call to \"Null value block\" because of specified \"fromBER\" and \"toBER\" functions\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 5; // Null\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"Null\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t//noinspection JSUnusedLocalSymbols\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number} Offset after least decoded byte\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\tif(this.lenBlock.length > 0)\r\n\t\t\tthis.warnings.push(\"Non-zero length of value block for Null type\");\r\n\r\n\t\tif(this.idBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.idBlock.blockLength;\r\n\r\n\t\tif(this.lenBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.lenBlock.blockLength;\r\n\t\t\r\n\t\tthis.blockLength += inputLength;\r\n\t\t\r\n\t\tif((inputOffset + inputLength) > inputBuffer.byteLength)\r\n\t\t{\r\n\t\t\tthis.error = \"End of input reached before message was fully decoded (inconsistent offset and length values)\";\r\n\t\t\treturn (-1);\r\n\t\t}\r\n\t\t\r\n\t\treturn (inputOffset + inputLength);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules)\r\n\t * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoBER(sizeOnly = false)\r\n\t{\r\n\t\tconst retBuf = new ArrayBuffer(2);\r\n\r\n\t\tif(sizeOnly === true)\r\n\t\t\treturn retBuf;\r\n\r\n\t\tconst retView = new Uint8Array(retBuf);\r\n\t\tretView[0] = 0x05;\r\n\t\tretView[1] = 0x00;\r\n\r\n\t\treturn retBuf;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of ASN.1 OctetString type class\r\n//**************************************************************************************\r\nclass LocalOctetStringValueBlock extends HexBlock(LocalConstructedValueBlock)\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"LocalOctetStringValueBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {ArrayBuffer} [valueHex]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.isConstructed = getParametersValue(parameters, \"isConstructed\", false);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number} Offset after least decoded byte\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\tlet resultOffset = 0;\r\n\r\n\t\tif(this.isConstructed === true)\r\n\t\t{\r\n\t\t\tthis.isHexOnly = false;\r\n\r\n\t\t\tresultOffset = LocalConstructedValueBlock.prototype.fromBER.call(this, inputBuffer, inputOffset, inputLength);\r\n\t\t\tif(resultOffset === (-1))\r\n\t\t\t\treturn resultOffset;\r\n\r\n\t\t\tfor(let i = 0; i < this.value.length; i++)\r\n\t\t\t{\r\n\t\t\t\tconst currentBlockName = this.value[i].constructor.blockName();\r\n\r\n\t\t\t\tif(currentBlockName === EndOfContent.blockName())\r\n\t\t\t\t{\r\n\t\t\t\t\tif(this.isIndefiniteForm === true)\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.error = \"EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only\";\r\n\t\t\t\t\t\treturn (-1);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(currentBlockName !== OctetString.blockName())\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.error = \"OCTET STRING may consists of OCTET STRINGs only\";\r\n\t\t\t\t\treturn (-1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.isHexOnly = true;\r\n\r\n\t\t\tresultOffset = super.fromBER(inputBuffer, inputOffset, inputLength);\r\n\t\t\tthis.blockLength = inputLength;\r\n\t\t}\r\n\r\n\t\treturn resultOffset;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules)\r\n\t * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoBER(sizeOnly = false)\r\n\t{\r\n\t\tif(this.isConstructed === true)\r\n\t\t\treturn LocalConstructedValueBlock.prototype.toBER.call(this, sizeOnly);\r\n\r\n\t\tlet retBuf = new ArrayBuffer(this.valueHex.byteLength);\r\n\r\n\t\tif(sizeOnly === true)\r\n\t\t\treturn retBuf;\r\n\r\n\t\tif(this.valueHex.byteLength === 0)\r\n\t\t\treturn retBuf;\r\n\r\n\t\tretBuf = this.valueHex.slice(0);\r\n\r\n\t\treturn retBuf;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"OctetStringValueBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n\ttoJSON()\r\n\t{\r\n\t\tlet object = {};\r\n\t\t\r\n\t\t//region Seems at the moment (Sep 2016) there is no way how to check method is supported in \"super\" object\r\n\t\ttry\r\n\t\t{\r\n\t\t\tobject = super.toJSON();\r\n\t\t}\r\n\t\tcatch(ex){}\r\n\t\t//endregion\r\n\r\n\t\tobject.isConstructed = this.isConstructed;\r\n\t\tobject.isHexOnly = this.isHexOnly;\r\n\t\tobject.valueHex = bufferToHexCodes(this.valueHex, 0, this.valueHex.byteLength);\r\n\r\n\t\treturn object;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\nexport class OctetString extends BaseBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"OctetString\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters, LocalOctetStringValueBlock);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 4; // OctetString\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number} Offset after least decoded byte\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\tthis.valueBlock.isConstructed = this.idBlock.isConstructed;\r\n\t\tthis.valueBlock.isIndefiniteForm = this.lenBlock.isIndefiniteForm;\r\n\r\n\t\t//region Ability to encode empty OCTET STRING\r\n\t\tif(inputLength === 0)\r\n\t\t{\r\n\t\t\tif(this.idBlock.error.length === 0)\r\n\t\t\t\tthis.blockLength += this.idBlock.blockLength;\r\n\r\n\t\t\tif(this.lenBlock.error.length === 0)\r\n\t\t\t\tthis.blockLength += this.lenBlock.blockLength;\r\n\r\n\t\t\treturn inputOffset;\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\treturn super.fromBER(inputBuffer, inputOffset, inputLength);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"OctetString\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t//noinspection JSUnusedGlobalSymbols\r\n\t/**\r\n\t * Checking that two OCTETSTRINGs are equal\r\n\t * @param {OctetString} octetString\r\n\t */\r\n\tisEqual(octetString)\r\n\t{\r\n\t\t//region Check input type\r\n\t\tif((octetString instanceof OctetString) === false)\r\n\t\t\treturn false;\r\n\t\t//endregion\r\n\r\n\t\t//region Compare two JSON strings\r\n\t\tif(JSON.stringify(this) !== JSON.stringify(octetString))\r\n\t\t\treturn false;\r\n\t\t//endregion\r\n\r\n\t\treturn true;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of ASN.1 BitString type class\r\n//**************************************************************************************\r\nclass LocalBitStringValueBlock extends HexBlock(LocalConstructedValueBlock)\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"LocalBitStringValueBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {ArrayBuffer} [valueHex]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.unusedBits = getParametersValue(parameters, \"unusedBits\", 0);\r\n\t\tthis.isConstructed = getParametersValue(parameters, \"isConstructed\", false);\r\n\t\tthis.blockLength = this.valueHex.byteLength;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number} Offset after least decoded byte\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\t//region Ability to decode zero-length BitString value\r\n\t\tif(inputLength === 0)\r\n\t\t\treturn inputOffset;\r\n\t\t//endregion\r\n\r\n\t\tlet resultOffset = (-1);\r\n\r\n\t\t//region If the BISTRING supposed to be a constructed value\r\n\t\tif(this.isConstructed === true)\r\n\t\t{\r\n\t\t\tresultOffset = LocalConstructedValueBlock.prototype.fromBER.call(this, inputBuffer, inputOffset, inputLength);\r\n\t\t\tif(resultOffset === (-1))\r\n\t\t\t\treturn resultOffset;\r\n\r\n\t\t\tfor(let i = 0; i < this.value.length; i++)\r\n\t\t\t{\r\n\t\t\t\tconst currentBlockName = this.value[i].constructor.blockName();\r\n\r\n\t\t\t\tif(currentBlockName === EndOfContent.blockName())\r\n\t\t\t\t{\r\n\t\t\t\t\tif(this.isIndefiniteForm === true)\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tthis.error = \"EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only\";\r\n\t\t\t\t\t\treturn (-1);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(currentBlockName !== BitString.blockName())\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.error = \"BIT STRING may consists of BIT STRINGs only\";\r\n\t\t\t\t\treturn (-1);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif((this.unusedBits > 0) && (this.value[i].valueBlock.unusedBits > 0))\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.error = \"Usign of \\\"unused bits\\\" inside constructive BIT STRING allowed for least one only\";\r\n\t\t\t\t\treturn (-1);\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.unusedBits = this.value[i].valueBlock.unusedBits;\r\n\t\t\t\tif(this.unusedBits > 7)\r\n\t\t\t\t{\r\n\t\t\t\t\tthis.error = \"Unused bits for BitString must be in range 0-7\";\r\n\t\t\t\t\treturn (-1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\treturn resultOffset;\r\n\t\t}\r\n\t\t//endregion\r\n\t\t//region If the BitString supposed to be a primitive value\r\n\t\t//region Basic check for parameters\r\n\t\t//noinspection JSCheckFunctionSignatures\r\n\t\tif(checkBufferParams(this, inputBuffer, inputOffset, inputLength) === false)\r\n\t\t\treturn (-1);\r\n\t\t//endregion\r\n\r\n\t\tconst intBuffer = new Uint8Array(inputBuffer, inputOffset, inputLength);\r\n\r\n\t\tthis.unusedBits = intBuffer[0];\r\n\t\t\r\n\t\tif(this.unusedBits > 7)\r\n\t\t{\r\n\t\t\tthis.error = \"Unused bits for BitString must be in range 0-7\";\r\n\t\t\treturn (-1);\r\n\t\t}\r\n\r\n\t\t//region Copy input buffer to internal buffer\r\n\t\tthis.valueHex = new ArrayBuffer(intBuffer.length - 1);\r\n\t\tconst view = new Uint8Array(this.valueHex);\r\n\t\tfor(let i = 0; i < (inputLength - 1); i++)\r\n\t\t\tview[i] = intBuffer[i + 1];\r\n\t\t//endregion\r\n\r\n\t\tthis.blockLength = intBuffer.length;\r\n\r\n\t\treturn (inputOffset + inputLength);\r\n\t\t//endregion\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules)\r\n\t * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoBER(sizeOnly = false)\r\n\t{\r\n\t\tif(this.isConstructed === true)\r\n\t\t\treturn LocalConstructedValueBlock.prototype.toBER.call(this, sizeOnly);\r\n\r\n\t\tif(sizeOnly === true)\r\n\t\t\treturn (new ArrayBuffer(this.valueHex.byteLength + 1));\r\n\r\n\t\tif(this.valueHex.byteLength === 0)\r\n\t\t\treturn (new ArrayBuffer(0));\r\n\r\n\t\tconst curView = new Uint8Array(this.valueHex);\r\n\r\n\t\tconst retBuf = new ArrayBuffer(this.valueHex.byteLength + 1);\r\n\t\tconst retView = new Uint8Array(retBuf);\r\n\r\n\t\tretView[0] = this.unusedBits;\r\n\r\n\t\tfor(let i = 0; i < this.valueHex.byteLength; i++)\r\n\t\t\tretView[i + 1] = curView[i];\r\n\r\n\t\treturn retBuf;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"BitStringValueBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Convertion for the block to JSON object\r\n\t * @returns {{blockName, blockLength, error, warnings, valueBeforeDecode}|{blockName: string, blockLength: number, error: string, warnings: Array.<string>, valueBeforeDecode: string}}\r\n\t */\r\n\ttoJSON()\r\n\t{\r\n\t\tlet object = {};\r\n\t\t\r\n\t\t//region Seems at the moment (Sep 2016) there is no way how to check method is supported in \"super\" object\r\n\t\ttry\r\n\t\t{\r\n\t\t\tobject = super.toJSON();\r\n\t\t}\r\n\t\tcatch(ex){}\r\n\t\t//endregion\r\n\r\n\t\tobject.unusedBits = this.unusedBits;\r\n\t\tobject.isConstructed = this.isConstructed;\r\n\t\tobject.isHexOnly = this.isHexOnly;\r\n\t\tobject.valueHex = bufferToHexCodes(this.valueHex, 0, this.valueHex.byteLength);\r\n\r\n\t\treturn object;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\nexport class BitString extends BaseBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"BitString\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters, LocalBitStringValueBlock);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 3; // BitString\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"BitString\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number} Offset after least decoded byte\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\t//region Ability to encode empty BitString\r\n\t\tif(inputLength === 0)\r\n\t\t\treturn inputOffset;\r\n\t\t//endregion\r\n\r\n\t\tthis.valueBlock.isConstructed = this.idBlock.isConstructed;\r\n\t\tthis.valueBlock.isIndefiniteForm = this.lenBlock.isIndefiniteForm;\r\n\r\n\t\treturn super.fromBER(inputBuffer, inputOffset, inputLength);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Checking that two BITSTRINGs are equal\r\n\t * @param {BitString} bitString\r\n\t */\r\n\tisEqual(bitString)\r\n\t{\r\n\t\t//region Check input type\r\n\t\tif((bitString instanceof BitString) === false)\r\n\t\t\treturn false;\r\n\t\t//endregion\r\n\r\n\t\t//region Compare two JSON strings\r\n\t\tif(JSON.stringify(this) !== JSON.stringify(bitString))\r\n\t\t\treturn false;\r\n\t\t//endregion\r\n\r\n\t\treturn true;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of ASN.1 Integer type class\r\n//**************************************************************************************\r\n/**\r\n * @extends ValueBlock\r\n */\r\nclass LocalIntegerValueBlock extends HexBlock(ValueBlock)\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"LocalIntegerValueBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {ArrayBuffer} [valueHex]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tif(\"value\" in parameters)\r\n\t\t\tthis.valueDec = parameters.value;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Setter for \"valueHex\"\r\n\t * @param {ArrayBuffer} _value\r\n\t */\r\n\tset valueHex(_value)\r\n\t{\r\n\t\tthis._valueHex = _value.slice(0);\r\n\r\n\t\tif(_value.byteLength >= 4)\r\n\t\t{\r\n\t\t\tthis.warnings.push(\"Too big Integer for decoding, hex only\");\r\n\t\t\tthis.isHexOnly = true;\r\n\t\t\tthis._valueDec = 0;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.isHexOnly = false;\r\n\r\n\t\t\tif(_value.byteLength > 0)\r\n\t\t\t\tthis._valueDec = utilDecodeTC.call(this);\r\n\t\t}\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Getter for \"valueHex\"\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\tget valueHex()\r\n\t{\r\n\t\treturn this._valueHex;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Getter for \"valueDec\"\r\n\t * @param {number} _value\r\n\t */\r\n\tset valueDec(_value)\r\n\t{\r\n\t\tthis._valueDec = _value;\r\n\r\n\t\tthis.isHexOnly = false;\r\n\t\tthis._valueHex = utilEncodeTC(_value);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Getter for \"valueDec\"\r\n\t * @returns {number}\r\n\t */\r\n\tget valueDec()\r\n\t{\r\n\t\treturn this._valueDec;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from DER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 DER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 DER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @param {number} [expectedLength=0] Expected length of converted \"valueHex\" buffer\r\n\t * @returns {number} Offset after least decoded byte\r\n\t */\r\n\tfromDER(inputBuffer, inputOffset, inputLength, expectedLength = 0)\r\n\t{\r\n\t\tconst offset = this.fromBER(inputBuffer, inputOffset, inputLength);\r\n\t\tif(offset === (-1))\r\n\t\t\treturn offset;\r\n\r\n\t\tconst view = new Uint8Array(this._valueHex);\r\n\r\n\t\tif((view[0] === 0x00) && ((view[1] & 0x80) !== 0))\r\n\t\t{\r\n\t\t\tconst updatedValueHex = new ArrayBuffer(this._valueHex.byteLength - 1);\r\n\t\t\tconst updatedView = new Uint8Array(updatedValueHex);\r\n\r\n\t\t\tupdatedView.set(new Uint8Array(this._valueHex, 1, this._valueHex.byteLength - 1));\r\n\r\n\t\t\tthis._valueHex = updatedValueHex.slice(0);\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tif(expectedLength !== 0)\r\n\t\t\t{\r\n\t\t\t\tif(this._valueHex.byteLength < expectedLength)\r\n\t\t\t\t{\r\n\t\t\t\t\tif((expectedLength - this._valueHex.byteLength) > 1)\r\n\t\t\t\t\t\texpectedLength = this._valueHex.byteLength + 1;\r\n\t\t\t\t\t\r\n\t\t\t\t\tconst updatedValueHex = new ArrayBuffer(expectedLength);\r\n\t\t\t\t\tconst updatedView = new Uint8Array(updatedValueHex);\r\n\r\n\t\t\t\t\tupdatedView.set(view, expectedLength - this._valueHex.byteLength);\r\n\r\n\t\t\t\t\tthis._valueHex = updatedValueHex.slice(0);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn offset;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Encoding of current ASN.1 block into ASN.1 encoded array (DER rules)\r\n\t * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoDER(sizeOnly = false)\r\n\t{\r\n\t\tconst view = new Uint8Array(this._valueHex);\r\n\r\n\t\tswitch(true)\r\n\t\t{\r\n\t\t\tcase ((view[0] & 0x80) !== 0):\r\n\t\t\t\t{\r\n\t\t\t\t\tconst updatedValueHex = new ArrayBuffer(this._valueHex.byteLength + 1);\r\n\t\t\t\t\tconst updatedView = new Uint8Array(updatedValueHex);\r\n\r\n\t\t\t\t\tupdatedView[0] = 0x00;\r\n\t\t\t\t\tupdatedView.set(view, 1);\r\n\r\n\t\t\t\t\tthis._valueHex = updatedValueHex.slice(0);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase ((view[0] === 0x00) && ((view[1] & 0x80) === 0)):\r\n\t\t\t\t{\r\n\t\t\t\t\tconst updatedValueHex = new ArrayBuffer(this._valueHex.byteLength - 1);\r\n\t\t\t\t\tconst updatedView = new Uint8Array(updatedValueHex);\r\n\r\n\t\t\t\t\tupdatedView.set(new Uint8Array(this._valueHex, 1, this._valueHex.byteLength - 1));\r\n\r\n\t\t\t\t\tthis._valueHex = updatedValueHex.slice(0);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t}\r\n\r\n\t\treturn this.toBER(sizeOnly);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number} Offset after least decoded byte\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\tconst resultOffset = super.fromBER(inputBuffer, inputOffset, inputLength);\r\n\t\tif(resultOffset === (-1))\r\n\t\t\treturn resultOffset;\r\n\r\n\t\tthis.blockLength = inputLength;\r\n\r\n\t\treturn (inputOffset + inputLength);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules)\r\n\t * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoBER(sizeOnly = false)\r\n\t{\r\n\t\t//noinspection JSCheckFunctionSignatures\r\n\t\treturn this.valueHex.slice(0);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"IntegerValueBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t//noinspection JSUnusedGlobalSymbols\r\n\t/**\r\n\t * Convertion for the block to JSON object\r\n\t * @returns {Object}\r\n\t */\r\n\ttoJSON()\r\n\t{\r\n\t\tlet object = {};\r\n\t\t\r\n\t\t//region Seems at the moment (Sep 2016) there is no way how to check method is supported in \"super\" object\r\n\t\ttry\r\n\t\t{\r\n\t\t\tobject = super.toJSON();\r\n\t\t}\r\n\t\tcatch(ex){}\r\n\t\t//endregion\r\n\r\n\t\tobject.valueDec = this.valueDec;\r\n\r\n\t\treturn object;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Convert current value to decimal string representation\r\n\t */\r\n\ttoString()\r\n\t{\r\n\t\t//region Aux functions\r\n\t\tfunction viewAdd(first, second)\r\n\t\t{\r\n\t\t\t//region Initial variables\r\n\t\t\tconst c = new Uint8Array([0]);\r\n\t\t\t\r\n\t\t\tlet firstView = new Uint8Array(first);\r\n\t\t\tlet secondView = new Uint8Array(second);\r\n\t\t\t\r\n\t\t\tlet firstViewCopy = firstView.slice(0);\r\n\t\t\tconst firstViewCopyLength = firstViewCopy.length - 1;\r\n\t\t\tlet secondViewCopy = secondView.slice(0);\r\n\t\t\tconst secondViewCopyLength = secondViewCopy.length - 1;\r\n\t\t\t\r\n\t\t\tlet value = 0;\r\n\t\t\t\r\n\t\t\tconst max = (secondViewCopyLength < firstViewCopyLength) ? firstViewCopyLength : secondViewCopyLength;\r\n\t\t\t\r\n\t\t\tlet counter = 0;\r\n\t\t\t//endregion\r\n\t\t\t\r\n\t\t\tfor(let i = max; i >= 0; i--, counter++)\r\n\t\t\t{\r\n\t\t\t\tswitch(true)\r\n\t\t\t\t{\r\n\t\t\t\t\tcase (counter < secondViewCopy.length):\r\n\t\t\t\t\t\tvalue = firstViewCopy[firstViewCopyLength - counter] + secondViewCopy[secondViewCopyLength - counter] + c[0];\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\tvalue = firstViewCopy[firstViewCopyLength - counter] + c[0];\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tc[0] = value / 10;\r\n\t\t\t\t\r\n\t\t\t\tswitch(true)\r\n\t\t\t\t{\r\n\t\t\t\t\tcase (counter >= firstViewCopy.length):\r\n\t\t\t\t\t\tfirstViewCopy = utilConcatView(new Uint8Array([value % 10]), firstViewCopy);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\tfirstViewCopy[firstViewCopyLength - counter] = value % 10;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(c[0] > 0)\r\n\t\t\t\tfirstViewCopy = utilConcatView(c, firstViewCopy);\r\n\t\t\t\r\n\t\t\treturn firstViewCopy.slice(0);\r\n\t\t}\r\n\t\t\r\n\t\tfunction power2(n)\r\n\t\t{\r\n\t\t\tif(n >= powers2.length)\r\n\t\t\t{\r\n\t\t\t\tfor(let p = powers2.length; p <= n; p++)\r\n\t\t\t\t{\r\n\t\t\t\t\tconst c = new Uint8Array([0]);\r\n\t\t\t\t\tlet digits = (powers2[p - 1]).slice(0);\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor(let i = (digits.length - 1); i >=0; i--)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tconst newValue = new Uint8Array([(digits[i] << 1) + c[0]]);\r\n\t\t\t\t\t\tc[0] = newValue[0] / 10;\r\n\t\t\t\t\t\tdigits[i] = newValue[0] % 10;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (c[0] > 0)\r\n\t\t\t\t\t\tdigits = utilConcatView(c, digits);\r\n\t\t\t\t\t\r\n\t\t\t\t\tpowers2.push(digits);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn powers2[n];\r\n\t\t}\r\n\t\t\r\n\t\tfunction viewSub(first, second)\r\n\t\t{\r\n\t\t\t//region Initial variables\r\n\t\t\tlet b = 0;\r\n\t\t\t\r\n\t\t\tlet firstView = new Uint8Array(first);\r\n\t\t\tlet secondView = new Uint8Array(second);\r\n\t\t\t\r\n\t\t\tlet firstViewCopy = firstView.slice(0);\r\n\t\t\tconst firstViewCopyLength = firstViewCopy.length - 1;\r\n\t\t\tlet secondViewCopy = secondView.slice(0);\r\n\t\t\tconst secondViewCopyLength = secondViewCopy.length - 1;\r\n\t\t\t\r\n\t\t\tlet value;\r\n\t\t\t\r\n\t\t\tlet counter = 0;\r\n\t\t\t//endregion\r\n\t\t\t\r\n\t\t\tfor(let i = secondViewCopyLength; i >= 0; i--, counter++)\r\n\t\t\t{\r\n\t\t\t\tvalue = firstViewCopy[firstViewCopyLength - counter] - secondViewCopy[secondViewCopyLength - counter] - b;\r\n\t\t\t\t\r\n\t\t\t\tswitch(true)\r\n\t\t\t\t{\r\n\t\t\t\t\tcase (value < 0):\r\n\t\t\t\t\t\tb = 1;\r\n\t\t\t\t\t\tfirstViewCopy[firstViewCopyLength - counter] = value + 10;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\tb = 0;\r\n\t\t\t\t\t\tfirstViewCopy[firstViewCopyLength - counter] = value;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(b > 0)\r\n\t\t\t{\r\n\t\t\t\tfor(let i = (firstViewCopyLength - secondViewCopyLength + 1); i >= 0; i--, counter++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvalue = firstViewCopy[firstViewCopyLength - counter] - b;\r\n\t\t\t\t\t\r\n\t\t\t\t\tif(value < 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tb = 1;\r\n\t\t\t\t\t\tfirstViewCopy[firstViewCopyLength - counter] = value + 10;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tb = 0;\r\n\t\t\t\t\t\tfirstViewCopy[firstViewCopyLength - counter] = value;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\treturn firstViewCopy.slice();\r\n\t\t}\r\n\t\t//endregion\r\n\t\t\r\n\t\t//region Initial variables\r\n\t\tconst firstBit = (this._valueHex.byteLength * 8) - 1;\r\n\t\t\r\n\t\tlet digits = new Uint8Array((this._valueHex.byteLength * 8) / 3);\r\n\t\tlet bitNumber = 0;\r\n\t\tlet currentByte;\r\n\t\t\r\n\t\tconst asn1View = new Uint8Array(this._valueHex);\r\n\t\t\r\n\t\tlet result = \"\";\r\n\t\t\r\n\t\tlet flag = false;\r\n\t\t//endregion\r\n\t\t\r\n\t\t//region Calculate number\r\n\t\tfor(let byteNumber = (this._valueHex.byteLength - 1); byteNumber >= 0; byteNumber--)\r\n\t\t{\r\n\t\t\tcurrentByte = asn1View[byteNumber];\r\n\t\t\t\r\n\t\t\tfor(let i = 0; i < 8; i++)\r\n\t\t\t{\r\n\t\t\t\tif((currentByte & 1) === 1)\r\n\t\t\t\t{\r\n\t\t\t\t\tswitch(bitNumber)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tcase firstBit:\r\n\t\t\t\t\t\t\tdigits = viewSub(power2(bitNumber), digits);\r\n\t\t\t\t\t\t\tresult = \"-\";\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\tdefault:\r\n\t\t\t\t\t\t\tdigits = viewAdd(digits, power2(bitNumber));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tbitNumber++;\r\n\t\t\t\tcurrentByte >>= 1;\r\n\t\t\t}\r\n\t\t}\r\n\t\t//endregion\r\n\t\t\r\n\t\t//region Print number\r\n\t\tfor(let i = 0; i < digits.length; i++)\r\n\t\t{\r\n\t\t\tif(digits[i])\r\n\t\t\t\tflag = true;\r\n\t\t\t\r\n\t\t\tif(flag)\r\n\t\t\t\tresult += digitsString.charAt(digits[i]);\r\n\t\t}\r\n\t\t\r\n\t\tif(flag === false)\r\n\t\t\tresult += digitsString.charAt(0);\r\n\t\t//endregion\r\n\t\t\r\n\t\treturn result;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\nexport class Integer extends BaseBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"Integer\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters, LocalIntegerValueBlock);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 2; // Integer\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"Integer\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t//noinspection JSUnusedGlobalSymbols\r\n\t/**\r\n\t * Compare two Integer object, or Integer and ArrayBuffer objects\r\n\t * @param {!Integer|ArrayBuffer} otherValue\r\n\t * @returns {boolean}\r\n\t */\r\n\tisEqual(otherValue)\r\n\t{\r\n\t\tif(otherValue instanceof Integer)\r\n\t\t{\r\n\t\t\tif(this.valueBlock.isHexOnly && otherValue.valueBlock.isHexOnly) // Compare two ArrayBuffers\r\n\t\t\t\treturn isEqualBuffer(this.valueBlock.valueHex, otherValue.valueBlock.valueHex);\r\n\r\n\t\t\tif(this.valueBlock.isHexOnly === otherValue.valueBlock.isHexOnly)\r\n\t\t\t\treturn (this.valueBlock.valueDec === otherValue.valueBlock.valueDec);\r\n\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t\r\n\t\tif(otherValue instanceof ArrayBuffer)\r\n\t\t\treturn isEqualBuffer(this.valueBlock.valueHex, otherValue);\r\n\r\n\t\treturn false;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Convert current Integer value from BER into DER format\r\n\t * @returns {Integer}\r\n\t */\r\n\tconvertToDER()\r\n\t{\r\n\t\tconst integer = new Integer({ valueHex: this.valueBlock.valueHex });\r\n\t\tinteger.valueBlock.toDER();\r\n\r\n\t\treturn integer;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Convert current Integer value from DER to BER format\r\n\t * @returns {Integer}\r\n\t */\r\n\tconvertFromDER()\r\n\t{\r\n\t\tconst expectedLength = (this.valueBlock.valueHex.byteLength % 2) ? (this.valueBlock.valueHex.byteLength + 1) : this.valueBlock.valueHex.byteLength;\r\n\t\tconst integer = new Integer({ valueHex: this.valueBlock.valueHex });\r\n\t\tinteger.valueBlock.fromDER(integer.valueBlock.valueHex, 0, integer.valueBlock.valueHex.byteLength, expectedLength);\r\n\t\t\r\n\t\treturn integer;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of ASN.1 Enumerated type class\r\n//**************************************************************************************\r\nexport class Enumerated extends Integer\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"Enumerated\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 10; // Enumerated\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"Enumerated\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of ASN.1 ObjectIdentifier type class\r\n//**************************************************************************************\r\nclass LocalSidValueBlock extends HexBlock(LocalBaseBlock)\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"LocalSidValueBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {number} [valueDec]\r\n\t * @property {boolean} [isFirstSid]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.valueDec = getParametersValue(parameters, \"valueDec\", -1);\r\n\t\tthis.isFirstSid = getParametersValue(parameters, \"isFirstSid\", false);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"sidBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number} Offset after least decoded byte\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\tif(inputLength === 0)\r\n\t\t\treturn inputOffset;\r\n\r\n\t\t//region Basic check for parameters\r\n\t\t//noinspection JSCheckFunctionSignatures\r\n\t\tif(checkBufferParams(this, inputBuffer, inputOffset, inputLength) === false)\r\n\t\t\treturn (-1);\r\n\t\t//endregion\r\n\r\n\t\tconst intBuffer = new Uint8Array(inputBuffer, inputOffset, inputLength);\r\n\r\n\t\tthis.valueHex = new ArrayBuffer(inputLength);\r\n\t\tlet view = new Uint8Array(this.valueHex);\r\n\r\n\t\tfor(let i = 0; i < inputLength; i++)\r\n\t\t{\r\n\t\t\tview[i] = intBuffer[i] & 0x7F;\r\n\r\n\t\t\tthis.blockLength++;\r\n\r\n\t\t\tif((intBuffer[i] & 0x80) === 0x00)\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\t//region Ajust size of valueHex buffer\r\n\t\tconst tempValueHex = new ArrayBuffer(this.blockLength);\r\n\t\tconst tempView = new Uint8Array(tempValueHex);\r\n\r\n\t\tfor(let i = 0; i < this.blockLength; i++)\r\n\t\t\ttempView[i] = view[i];\r\n\r\n\t\t//noinspection JSCheckFunctionSignatures\r\n\t\tthis.valueHex = tempValueHex.slice(0);\r\n\t\tview = new Uint8Array(this.valueHex);\r\n\t\t//endregion\r\n\r\n\t\tif((intBuffer[this.blockLength - 1] & 0x80) !== 0x00)\r\n\t\t{\r\n\t\t\tthis.error = \"End of input reached before message was fully decoded\";\r\n\t\t\treturn (-1);\r\n\t\t}\r\n\r\n\t\tif(view[0] === 0x00)\r\n\t\t\tthis.warnings.push(\"Needlessly long format of SID encoding\");\r\n\r\n\t\tif(this.blockLength <= 8)\r\n\t\t\tthis.valueDec = utilFromBase(view, 7);\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.isHexOnly = true;\r\n\t\t\tthis.warnings.push(\"Too big SID for decoding, hex only\");\r\n\t\t}\r\n\r\n\t\treturn (inputOffset + this.blockLength);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules)\r\n\t * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoBER(sizeOnly = false)\r\n\t{\r\n\t\t//region Initial variables\r\n\t\tlet retBuf;\r\n\t\tlet retView;\r\n\t\t//endregion\r\n\r\n\t\tif(this.isHexOnly)\r\n\t\t{\r\n\t\t\tif(sizeOnly === true)\r\n\t\t\t\treturn (new ArrayBuffer(this.valueHex.byteLength));\r\n\r\n\t\t\tconst curView = new Uint8Array(this.valueHex);\r\n\r\n\t\t\tretBuf = new ArrayBuffer(this.blockLength);\r\n\t\t\tretView = new Uint8Array(retBuf);\r\n\r\n\t\t\tfor(let i = 0; i < (this.blockLength - 1); i++)\r\n\t\t\t\tretView[i] = curView[i] | 0x80;\r\n\r\n\t\t\tretView[this.blockLength - 1] = curView[this.blockLength - 1];\r\n\r\n\t\t\treturn retBuf;\r\n\t\t}\r\n\r\n\t\tconst encodedBuf = utilToBase(this.valueDec, 7);\r\n\t\tif(encodedBuf.byteLength === 0)\r\n\t\t{\r\n\t\t\tthis.error = \"Error during encoding SID value\";\r\n\t\t\treturn (new ArrayBuffer(0));\r\n\t\t}\r\n\r\n\t\tretBuf = new ArrayBuffer(encodedBuf.byteLength);\r\n\r\n\t\tif(sizeOnly === false)\r\n\t\t{\r\n\t\t\tconst encodedView = new Uint8Array(encodedBuf);\r\n\t\t\tretView = new Uint8Array(retBuf);\r\n\r\n\t\t\tfor(let i = 0; i < (encodedBuf.byteLength - 1); i++)\r\n\t\t\t\tretView[i] = encodedView[i] | 0x80;\r\n\r\n\t\t\tretView[encodedBuf.byteLength - 1] = encodedView[encodedBuf.byteLength - 1];\r\n\t\t}\r\n\r\n\t\treturn retBuf;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Create string representation of current SID block\r\n\t * @returns {string}\r\n\t */\r\n\ttoString()\r\n\t{\r\n\t\tlet result = \"\";\r\n\r\n\t\tif(this.isHexOnly === true)\r\n\t\t\tresult = bufferToHexCodes(this.valueHex, 0, this.valueHex.byteLength);\r\n\t\telse\r\n\t\t{\r\n\t\t\tif(this.isFirstSid)\r\n\t\t\t{\r\n\t\t\t\tlet sidValue = this.valueDec;\r\n\r\n\t\t\t\tif(this.valueDec <= 39)\r\n\t\t\t\t\tresult = \"0.\";\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tif(this.valueDec <= 79)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tresult = \"1.\";\r\n\t\t\t\t\t\tsidValue -= 40;\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tresult = \"2.\";\r\n\t\t\t\t\t\tsidValue -= 80;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tresult += sidValue.toString();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t\tresult = this.valueDec.toString();\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t}\r\n\t//**********************************************************************************\r\n\t//noinspection JSUnusedGlobalSymbols\r\n\t/**\r\n\t * Convertion for the block to JSON object\r\n\t * @returns {Object}\r\n\t */\r\n\ttoJSON()\r\n\t{\r\n\t\tlet object = {};\r\n\t\t\r\n\t\t//region Seems at the moment (Sep 2016) there is no way how to check method is supported in \"super\" object\r\n\t\ttry\r\n\t\t{\r\n\t\t\tobject = super.toJSON();\r\n\t\t}\r\n\t\tcatch(ex){}\r\n\t\t//endregion\r\n\r\n\t\tobject.valueDec = this.valueDec;\r\n\t\tobject.isFirstSid = this.isFirstSid;\r\n\r\n\t\treturn object;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\nclass LocalObjectIdentifierValueBlock extends ValueBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"LocalObjectIdentifierValueBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {ArrayBuffer} [valueHex]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.fromString(getParametersValue(parameters, \"value\", \"\"));\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number} Offset after least decoded byte\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\tlet resultOffset = inputOffset;\r\n\r\n\t\twhile(inputLength > 0)\r\n\t\t{\r\n\t\t\tconst sidBlock = new LocalSidValueBlock();\r\n\t\t\tresultOffset = sidBlock.fromBER(inputBuffer, resultOffset, inputLength);\r\n\t\t\tif(resultOffset === (-1))\r\n\t\t\t{\r\n\t\t\t\tthis.blockLength = 0;\r\n\t\t\t\tthis.error = sidBlock.error;\r\n\t\t\t\treturn resultOffset;\r\n\t\t\t}\r\n\r\n\t\t\tif(this.value.length === 0)\r\n\t\t\t\tsidBlock.isFirstSid = true;\r\n\r\n\t\t\tthis.blockLength += sidBlock.blockLength;\r\n\t\t\tinputLength -= sidBlock.blockLength;\r\n\r\n\t\t\tthis.value.push(sidBlock);\r\n\t\t}\r\n\r\n\t\treturn resultOffset;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules)\r\n\t * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoBER(sizeOnly = false)\r\n\t{\r\n\t\tlet retBuf = new ArrayBuffer(0);\r\n\r\n\t\tfor(let i = 0; i < this.value.length; i++)\r\n\t\t{\r\n\t\t\tconst valueBuf = this.value[i].toBER(sizeOnly);\r\n\t\t\tif(valueBuf.byteLength === 0)\r\n\t\t\t{\r\n\t\t\t\tthis.error = this.value[i].error;\r\n\t\t\t\treturn (new ArrayBuffer(0));\r\n\t\t\t}\r\n\r\n\t\t\tretBuf = utilConcatBuf(retBuf, valueBuf);\r\n\t\t}\r\n\r\n\t\treturn retBuf;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Create \"LocalObjectIdentifierValueBlock\" class from string\r\n\t * @param {string} string Input string to convert from\r\n\t * @returns {boolean}\r\n\t */\r\n\tfromString(string)\r\n\t{\r\n\t\tthis.value = []; // Clear existing SID values\r\n\r\n\t\tlet pos1 = 0;\r\n\t\tlet pos2 = 0;\r\n\r\n\t\tlet sid = \"\";\r\n\r\n\t\tlet flag = false;\r\n\r\n\t\tdo\r\n\t\t{\r\n\t\t\tpos2 = string.indexOf(\".\", pos1);\r\n\t\t\tif(pos2 === (-1))\r\n\t\t\t\tsid = string.substr(pos1);\r\n\t\t\telse\r\n\t\t\t\tsid = string.substr(pos1, pos2 - pos1);\r\n\r\n\t\t\tpos1 = pos2 + 1;\r\n\r\n\t\t\tif(flag)\r\n\t\t\t{\r\n\t\t\t\tconst sidBlock = this.value[0];\r\n\r\n\t\t\t\tlet plus = 0;\r\n\r\n\t\t\t\tswitch(sidBlock.valueDec)\r\n\t\t\t\t{\r\n\t\t\t\t\tcase 0:\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 1:\r\n\t\t\t\t\t\tplus = 40;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 2:\r\n\t\t\t\t\t\tplus = 80;\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\tthis.value = []; // clear SID array\r\n\t\t\t\t\t\treturn false; // ???\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst parsedSID = parseInt(sid, 10);\r\n\t\t\t\tif(isNaN(parsedSID))\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\tsidBlock.valueDec = parsedSID + plus;\r\n\r\n\t\t\t\tflag = false;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tconst sidBlock = new LocalSidValueBlock();\r\n\t\t\t\tsidBlock.valueDec = parseInt(sid, 10);\r\n\t\t\t\tif(isNaN(sidBlock.valueDec))\r\n\t\t\t\t\treturn true;\r\n\r\n\t\t\t\tif(this.value.length === 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tsidBlock.isFirstSid = true;\r\n\t\t\t\t\tflag = true;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthis.value.push(sidBlock);\r\n\t\t\t}\r\n\t\t} while(pos2 !== (-1));\r\n\r\n\t\treturn true;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Converts \"LocalObjectIdentifierValueBlock\" class to string\r\n\t * @returns {string}\r\n\t */\r\n\ttoString()\r\n\t{\r\n\t\tlet result = \"\";\r\n\t\tlet isHexOnly = false;\r\n\r\n\t\tfor(let i = 0; i < this.value.length; i++)\r\n\t\t{\r\n\t\t\tisHexOnly = this.value[i].isHexOnly;\r\n\r\n\t\t\tlet sidStr = this.value[i].toString();\r\n\r\n\t\t\tif(i !== 0)\r\n\t\t\t\tresult = `${result}.`;\r\n\r\n\t\t\tif(isHexOnly)\r\n\t\t\t{\r\n\t\t\t\tsidStr = `{${sidStr}}`;\r\n\r\n\t\t\t\tif(this.value[i].isFirstSid)\r\n\t\t\t\t\tresult = `2.{${sidStr} - 80}`;\r\n\t\t\t\telse\r\n\t\t\t\t\tresult += sidStr;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t\tresult += sidStr;\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"ObjectIdentifierValueBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Convertion for the block to JSON object\r\n\t * @returns {Object}\r\n\t */\r\n\ttoJSON()\r\n\t{\r\n\t\tlet object = {};\r\n\t\t\r\n\t\t//region Seems at the moment (Sep 2016) there is no way how to check method is supported in \"super\" object\r\n\t\ttry\r\n\t\t{\r\n\t\t\tobject = super.toJSON();\r\n\t\t}\r\n\t\tcatch(ex){}\r\n\t\t//endregion\r\n\r\n\t\tobject.value = this.toString();\r\n\t\tobject.sidArray = [];\r\n\t\tfor(let i = 0; i < this.value.length; i++)\r\n\t\t\tobject.sidArray.push(this.value[i].toJSON());\r\n\r\n\t\treturn object;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends BaseBlock\r\n */\r\nexport class ObjectIdentifier extends BaseBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"ObjectIdentifier\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {ArrayBuffer} [valueHex]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters, LocalObjectIdentifierValueBlock);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 6; // OBJECT IDENTIFIER\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"ObjectIdentifier\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of all string's classes\r\n//**************************************************************************************\r\nclass LocalUtf8StringValueBlock extends HexBlock(LocalBaseBlock)\r\n{\r\n\t//**********************************************************************************\r\n\t//noinspection JSUnusedGlobalSymbols\r\n\t/**\r\n\t * Constructor for \"LocalUtf8StringValueBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.isHexOnly = true;\r\n\t\tthis.value = \"\"; // String representation of decoded ArrayBuffer\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"Utf8StringValueBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t//noinspection JSUnusedGlobalSymbols\r\n\t/**\r\n\t * Convertion for the block to JSON object\r\n\t * @returns {Object}\r\n\t */\r\n\ttoJSON()\r\n\t{\r\n\t\tlet object = {};\r\n\t\t\r\n\t\t//region Seems at the moment (Sep 2016) there is no way how to check method is supported in \"super\" object\r\n\t\ttry\r\n\t\t{\r\n\t\t\tobject = super.toJSON();\r\n\t\t}\r\n\t\tcatch(ex){}\r\n\t\t//endregion\r\n\r\n\t\tobject.value = this.value;\r\n\r\n\t\treturn object;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends BaseBlock\r\n */\r\nexport class Utf8String extends BaseBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"Utf8String\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {ArrayBuffer} [valueHex]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters, LocalUtf8StringValueBlock);\r\n\r\n\t\tif(\"value\" in parameters)\r\n\t\t\tthis.fromString(parameters.value);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 12; // Utf8String\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"Utf8String\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number} Offset after least decoded byte\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\tconst resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, (this.lenBlock.isIndefiniteForm === true) ? inputLength : this.lenBlock.length);\r\n\t\tif(resultOffset === (-1))\r\n\t\t{\r\n\t\t\tthis.error = this.valueBlock.error;\r\n\t\t\treturn resultOffset;\r\n\t\t}\r\n\r\n\t\tthis.fromBuffer(this.valueBlock.valueHex);\r\n\r\n\t\tif(this.idBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.idBlock.blockLength;\r\n\r\n\t\tif(this.lenBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.lenBlock.blockLength;\r\n\r\n\t\tif(this.valueBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.valueBlock.blockLength;\r\n\r\n\t\treturn resultOffset;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Function converting ArrayBuffer into ASN.1 internal string\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t */\r\n\tfromBuffer(inputBuffer)\r\n\t{\r\n\t\tthis.valueBlock.value = String.fromCharCode.apply(null, new Uint8Array(inputBuffer));\r\n\r\n\t\ttry\r\n\t\t{\r\n\t\t\t//noinspection JSDeprecatedSymbols\r\n\t\t\tthis.valueBlock.value = decodeURIComponent(escape(this.valueBlock.value));\r\n\t\t}\r\n\t\tcatch(ex)\r\n\t\t{\r\n\t\t\tthis.warnings.push(`Error during \"decodeURIComponent\": ${ex}, using raw string`);\r\n\t\t}\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Function converting JavaScript string into ASN.1 internal class\r\n\t * @param {!string} inputString ASN.1 BER encoded array\r\n\t */\r\n\tfromString(inputString)\r\n\t{\r\n\t\t//noinspection JSDeprecatedSymbols\r\n\t\tconst str = unescape(encodeURIComponent(inputString));\r\n\t\tconst strLen = str.length;\r\n\r\n\t\tthis.valueBlock.valueHex = new ArrayBuffer(strLen);\r\n\t\tconst view = new Uint8Array(this.valueBlock.valueHex);\r\n\r\n\t\tfor(let i = 0; i < strLen; i++)\r\n\t\t\tview[i] = str.charCodeAt(i);\r\n\r\n\t\tthis.valueBlock.value = inputString;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//region Declaration of ASN.1 RelativeObjectIdentifier type class\r\n//**************************************************************************************\r\nclass LocalRelativeSidValueBlock extends HexBlock(LocalBaseBlock)\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"LocalRelativeSidValueBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {number} [valueDec]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.valueDec = getParametersValue(parameters, \"valueDec\", -1);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"relativeSidBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number} Offset after least decoded byte\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\tif (inputLength === 0)\r\n\t\t\treturn inputOffset;\r\n\r\n\t\t//region Basic check for parameters\r\n\t\t//noinspection JSCheckFunctionSignatures\r\n\t\tif (checkBufferParams(this, inputBuffer, inputOffset, inputLength) === false)\r\n\t\t\treturn (-1);\r\n\t\t//endregion\r\n\r\n\t\tconst intBuffer = new Uint8Array(inputBuffer, inputOffset, inputLength);\r\n\r\n\t\tthis.valueHex = new ArrayBuffer(inputLength);\r\n\t\tlet view = new Uint8Array(this.valueHex);\r\n\r\n\t\tfor (let i = 0; i < inputLength; i++)\r\n\t\t{\r\n\t\t\tview[i] = intBuffer[i] & 0x7F;\r\n\r\n\t\t\tthis.blockLength++;\r\n\r\n\t\t\tif ((intBuffer[i] & 0x80) === 0x00)\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\r\n\t\t//region Ajust size of valueHex buffer\r\n\t\tconst tempValueHex = new ArrayBuffer(this.blockLength);\r\n\t\tconst tempView = new Uint8Array(tempValueHex);\r\n\r\n\t\tfor (let i = 0; i < this.blockLength; i++)\r\n\t\t\ttempView[i] = view[i];\r\n\r\n\t\t//noinspection JSCheckFunctionSignatures\r\n\t\tthis.valueHex = tempValueHex.slice(0);\r\n\t\tview = new Uint8Array(this.valueHex);\r\n\t\t//endregion\r\n\r\n\t\tif ((intBuffer[this.blockLength - 1] & 0x80) !== 0x00)\r\n\t\t{\r\n\t\t\tthis.error = \"End of input reached before message was fully decoded\";\r\n\t\t\treturn (-1);\r\n\t\t}\r\n\r\n\t\tif (view[0] === 0x00)\r\n\t\t\tthis.warnings.push(\"Needlessly long format of SID encoding\");\r\n\r\n\t\tif (this.blockLength <= 8)\r\n\t\t\tthis.valueDec = utilFromBase(view, 7);\r\n\t\telse\r\n\t\t{\r\n\t\t\tthis.isHexOnly = true;\r\n\t\t\tthis.warnings.push(\"Too big SID for decoding, hex only\");\r\n\t\t}\r\n\r\n\t\treturn (inputOffset + this.blockLength);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules)\r\n\t * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoBER(sizeOnly = false)\r\n\t{\r\n\t\t//region Initial variables\r\n\t\tlet retBuf;\r\n\t\tlet retView;\r\n\t\t//endregion\r\n\r\n\t\tif (this.isHexOnly)\r\n\t\t{\r\n\t\t\tif (sizeOnly === true)\r\n\t\t\t\treturn (new ArrayBuffer(this.valueHex.byteLength));\r\n\r\n\t\t\tconst curView = new Uint8Array(this.valueHex);\r\n\r\n\t\t\tretBuf = new ArrayBuffer(this.blockLength);\r\n\t\t\tretView = new Uint8Array(retBuf);\r\n\r\n\t\t\tfor (let i = 0; i < (this.blockLength - 1); i++)\r\n\t\t\t\tretView[i] = curView[i] | 0x80;\r\n\r\n\t\t\tretView[this.blockLength - 1] = curView[this.blockLength - 1];\r\n\r\n\t\t\treturn retBuf;\r\n\t\t}\r\n\r\n\t\tconst encodedBuf = utilToBase(this.valueDec, 7);\r\n\t\tif (encodedBuf.byteLength === 0)\r\n\t\t{\r\n\t\t\tthis.error = \"Error during encoding SID value\";\r\n\t\t\treturn (new ArrayBuffer(0));\r\n\t\t}\r\n\r\n\t\tretBuf = new ArrayBuffer(encodedBuf.byteLength);\r\n\r\n\t\tif (sizeOnly === false)\r\n\t\t{\r\n\t\t\tconst encodedView = new Uint8Array(encodedBuf);\r\n\t\t\tretView = new Uint8Array(retBuf);\r\n\r\n\t\t\tfor (let i = 0; i < (encodedBuf.byteLength - 1); i++)\r\n\t\t\t\tretView[i] = encodedView[i] | 0x80;\r\n\r\n\t\t\tretView[encodedBuf.byteLength - 1] = encodedView[encodedBuf.byteLength - 1];\r\n\t\t}\r\n\r\n\t\treturn retBuf;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Create string representation of current SID block\r\n\t * @returns {string}\r\n\t */\r\n\ttoString()\r\n\t{\r\n\t\tlet result = \"\";\r\n\r\n\t\tif (this.isHexOnly === true)\r\n\t\t\tresult = bufferToHexCodes(this.valueHex, 0, this.valueHex.byteLength);\r\n\t\telse {\r\n\t\t\tresult = this.valueDec.toString();\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t}\r\n\t//**********************************************************************************\r\n\t//noinspection JSUnusedGlobalSymbols\r\n\t/**\r\n\t * Convertion for the block to JSON object\r\n\t * @returns {Object}\r\n\t */\r\n\ttoJSON()\r\n\t{\r\n\t\tlet object = {};\r\n\r\n\t\t//region Seems at the moment (Sep 2016) there is no way how to check method is supported in \"super\" object\r\n\t\ttry {\r\n\t\t\tobject = super.toJSON();\r\n\t\t} catch (ex) {}\r\n\t\t//endregion\r\n\r\n\t\tobject.valueDec = this.valueDec;\r\n\r\n\t\treturn object;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\nclass LocalRelativeObjectIdentifierValueBlock extends ValueBlock {\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"LocalRelativeObjectIdentifierValueBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {ArrayBuffer} [valueHex]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.fromString(getParametersValue(parameters, \"value\", \"\"));\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number} Offset after least decoded byte\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\tlet resultOffset = inputOffset;\r\n\r\n\t\twhile (inputLength > 0)\r\n\t\t{\r\n\t\t\tconst sidBlock = new LocalRelativeSidValueBlock();\r\n\t\t\tresultOffset = sidBlock.fromBER(inputBuffer, resultOffset, inputLength);\r\n\t\t\tif (resultOffset === (-1))\r\n\t\t\t{\r\n\t\t\t\tthis.blockLength = 0;\r\n\t\t\t\tthis.error = sidBlock.error;\r\n\t\t\t\treturn resultOffset;\r\n\t\t\t}\r\n\r\n\t\t\tthis.blockLength += sidBlock.blockLength;\r\n\t\t\tinputLength -= sidBlock.blockLength;\r\n\r\n\t\t\tthis.value.push(sidBlock);\r\n\t\t}\r\n\r\n\t\treturn resultOffset;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules)\r\n\t * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoBER(sizeOnly = false)\r\n\t{\r\n\t\tlet retBuf = new ArrayBuffer(0);\r\n\r\n\t\tfor (let i = 0; i < this.value.length; i++)\r\n\t\t{\r\n\t\t\tconst valueBuf = this.value[i].toBER(sizeOnly);\r\n\t\t\tif (valueBuf.byteLength === 0)\r\n\t\t\t{\r\n\t\t\t\tthis.error = this.value[i].error;\r\n\t\t\t\treturn (new ArrayBuffer(0));\r\n\t\t\t}\r\n\r\n\t\t\tretBuf = utilConcatBuf(retBuf, valueBuf);\r\n\t\t}\r\n\r\n\t\treturn retBuf;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Create \"LocalRelativeObjectIdentifierValueBlock\" class from string\r\n\t * @param {string} string Input string to convert from\r\n\t * @returns {boolean}\r\n\t */\r\n\tfromString(string)\r\n\t{\r\n\t\tthis.value = []; // Clear existing SID values\r\n\r\n\t\tlet pos1 = 0;\r\n\t\tlet pos2 = 0;\r\n\r\n\t\tlet sid = \"\";\r\n\r\n\t\tdo\r\n\t\t{\r\n\t\t\tpos2 = string.indexOf(\".\", pos1);\r\n\t\t\tif (pos2 === (-1))\r\n\t\t\t\tsid = string.substr(pos1);\r\n\t\t\telse\r\n\t\t\t\tsid = string.substr(pos1, pos2 - pos1);\r\n\r\n\t\t\tpos1 = pos2 + 1;\r\n\r\n\t\t\tconst sidBlock = new LocalRelativeSidValueBlock();\r\n\t\t\tsidBlock.valueDec = parseInt(sid, 10);\r\n\t\t\tif (isNaN(sidBlock.valueDec))\r\n\t\t\t\treturn true;\r\n\r\n\t\t\tthis.value.push(sidBlock);\r\n\r\n\t\t} while (pos2 !== (-1));\r\n\r\n\t\treturn true;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Converts \"LocalRelativeObjectIdentifierValueBlock\" class to string\r\n\t * @returns {string}\r\n\t */\r\n\ttoString()\r\n\t{\r\n\t\tlet result = \"\";\r\n\t\tlet isHexOnly = false;\r\n\r\n\t\tfor (let i = 0; i < this.value.length; i++)\r\n\t\t{\r\n\t\t\tisHexOnly = this.value[i].isHexOnly;\r\n\r\n\t\t\tlet sidStr = this.value[i].toString();\r\n\r\n\t\t\tif (i !== 0)\r\n\t\t\t\tresult = `${result}.`;\r\n\r\n\t\t\tif (isHexOnly)\r\n\t\t\t{\r\n\t\t\t\tsidStr = `{${sidStr}}`;\r\n\t\t\t\tresult += sidStr;\r\n\t\t\t} else\r\n\t\t\t\tresult += sidStr;\r\n\t\t}\r\n\r\n\t\treturn result;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"RelativeObjectIdentifierValueBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Convertion for the block to JSON object\r\n\t * @returns {Object}\r\n\t */\r\n\ttoJSON()\r\n\t{\r\n\t\tlet object = {};\r\n\r\n\t\t//region Seems at the moment (Sep 2016) there is no way how to check method is supported in \"super\" object\r\n\t\ttry\r\n\t\t{\r\n\t\t\tobject = super.toJSON();\r\n\t\t} catch (ex) {}\r\n\t\t//endregion\r\n\r\n\t\tobject.value = this.toString();\r\n\t\tobject.sidArray = [];\r\n\t\tfor (let i = 0; i < this.value.length; i++)\r\n\t\t\tobject.sidArray.push(this.value[i].toJSON());\r\n\r\n\t\treturn object;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends BaseBlock\r\n */\r\nexport class RelativeObjectIdentifier extends BaseBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"RelativeObjectIdentifier\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {ArrayBuffer} [valueHex]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters, LocalRelativeObjectIdentifierValueBlock);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 13; // RELATIVE OBJECT IDENTIFIER\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"RelativeObjectIdentifier\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n/**\r\n * @extends LocalBaseBlock\r\n * @extends HexBlock\r\n */\r\nclass LocalBmpStringValueBlock extends HexBlock(LocalBaseBlock)\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"LocalBmpStringValueBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.isHexOnly = true;\r\n\t\tthis.value = \"\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"BmpStringValueBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t//noinspection JSUnusedGlobalSymbols\r\n\t/**\r\n\t * Convertion for the block to JSON object\r\n\t * @returns {Object}\r\n\t */\r\n\ttoJSON()\r\n\t{\r\n\t\tlet object = {};\r\n\t\t\r\n\t\t//region Seems at the moment (Sep 2016) there is no way how to check method is supported in \"super\" object\r\n\t\ttry\r\n\t\t{\r\n\t\t\tobject = super.toJSON();\r\n\t\t}\r\n\t\tcatch(ex){}\r\n\t\t//endregion\r\n\r\n\t\tobject.value = this.value;\r\n\r\n\t\treturn object;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends BaseBlock\r\n */\r\nexport class BmpString extends BaseBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"BmpString\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters, LocalBmpStringValueBlock);\r\n\r\n\t\tif(\"value\" in parameters)\r\n\t\t\tthis.fromString(parameters.value);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 30; // BmpString\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"BmpString\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number} Offset after least decoded byte\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\tconst resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, (this.lenBlock.isIndefiniteForm === true) ? inputLength : this.lenBlock.length);\r\n\t\tif(resultOffset === (-1))\r\n\t\t{\r\n\t\t\tthis.error = this.valueBlock.error;\r\n\t\t\treturn resultOffset;\r\n\t\t}\r\n\r\n\t\tthis.fromBuffer(this.valueBlock.valueHex);\r\n\r\n\t\tif(this.idBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.idBlock.blockLength;\r\n\r\n\t\tif(this.lenBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.lenBlock.blockLength;\r\n\r\n\t\tif(this.valueBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.valueBlock.blockLength;\r\n\r\n\t\treturn resultOffset;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Function converting ArrayBuffer into ASN.1 internal string\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t */\r\n\tfromBuffer(inputBuffer)\r\n\t{\r\n\t\t//noinspection JSCheckFunctionSignatures\r\n\t\tconst copyBuffer = inputBuffer.slice(0);\r\n\t\tconst valueView = new Uint8Array(copyBuffer);\r\n\r\n\t\tfor(let i = 0; i < valueView.length; i += 2)\r\n\t\t{\r\n\t\t\tconst temp = valueView[i];\r\n\r\n\t\t\tvalueView[i] = valueView[i + 1];\r\n\t\t\tvalueView[i + 1] = temp;\r\n\t\t}\r\n\r\n\t\tthis.valueBlock.value = String.fromCharCode.apply(null, new Uint16Array(copyBuffer));\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Function converting JavaScript string into ASN.1 internal class\r\n\t * @param {!string} inputString ASN.1 BER encoded array\r\n\t */\r\n\tfromString(inputString)\r\n\t{\r\n\t\tconst strLength = inputString.length;\r\n\r\n\t\tthis.valueBlock.valueHex = new ArrayBuffer(strLength * 2);\r\n\t\tconst valueHexView = new Uint8Array(this.valueBlock.valueHex);\r\n\r\n\t\tfor(let i = 0; i < strLength; i++)\r\n\t\t{\r\n\t\t\tconst codeBuf = utilToBase(inputString.charCodeAt(i), 8);\r\n\t\t\tconst codeView = new Uint8Array(codeBuf);\r\n\t\t\tif(codeView.length > 2)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tconst dif = 2 - codeView.length;\r\n\r\n\t\t\tfor(let j = (codeView.length - 1); j >= 0; j--)\r\n\t\t\t\tvalueHexView[i * 2 + j + dif] = codeView[j];\r\n\t\t}\r\n\r\n\t\tthis.valueBlock.value = inputString;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\nclass LocalUniversalStringValueBlock extends HexBlock(LocalBaseBlock)\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"LocalUniversalStringValueBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.isHexOnly = true;\r\n\t\tthis.value = \"\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"UniversalStringValueBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t//noinspection JSUnusedGlobalSymbols\r\n\t/**\r\n\t * Convertion for the block to JSON object\r\n\t * @returns {Object}\r\n\t */\r\n\ttoJSON()\r\n\t{\r\n\t\tlet object = {};\r\n\t\t\r\n\t\t//region Seems at the moment (Sep 2016) there is no way how to check method is supported in \"super\" object\r\n\t\ttry\r\n\t\t{\r\n\t\t\tobject = super.toJSON();\r\n\t\t}\r\n\t\tcatch(ex){}\r\n\t\t//endregion\r\n\r\n\t\tobject.value = this.value;\r\n\r\n\t\treturn object;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends BaseBlock\r\n */\r\nexport class UniversalString extends BaseBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"UniversalString\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters, LocalUniversalStringValueBlock);\r\n\r\n\t\tif(\"value\" in parameters)\r\n\t\t\tthis.fromString(parameters.value);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 28; // UniversalString\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"UniversalString\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number} Offset after least decoded byte\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\tconst resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, (this.lenBlock.isIndefiniteForm === true) ? inputLength : this.lenBlock.length);\r\n\t\tif(resultOffset === (-1))\r\n\t\t{\r\n\t\t\tthis.error = this.valueBlock.error;\r\n\t\t\treturn resultOffset;\r\n\t\t}\r\n\r\n\t\tthis.fromBuffer(this.valueBlock.valueHex);\r\n\r\n\t\tif(this.idBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.idBlock.blockLength;\r\n\r\n\t\tif(this.lenBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.lenBlock.blockLength;\r\n\r\n\t\tif(this.valueBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.valueBlock.blockLength;\r\n\r\n\t\treturn resultOffset;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Function converting ArrayBuffer into ASN.1 internal string\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t */\r\n\tfromBuffer(inputBuffer)\r\n\t{\r\n\t\t//noinspection JSCheckFunctionSignatures\r\n\t\tconst copyBuffer = inputBuffer.slice(0);\r\n\t\tconst valueView = new Uint8Array(copyBuffer);\r\n\r\n\t\tfor(let i = 0; i < valueView.length; i += 4)\r\n\t\t{\r\n\t\t\tvalueView[i] = valueView[i + 3];\r\n\t\t\tvalueView[i + 1] = valueView[i + 2];\r\n\t\t\tvalueView[i + 2] = 0x00;\r\n\t\t\tvalueView[i + 3] = 0x00;\r\n\t\t}\r\n\r\n\t\tthis.valueBlock.value = String.fromCharCode.apply(null, new Uint32Array(copyBuffer));\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Function converting JavaScript string into ASN.1 internal class\r\n\t * @param {!string} inputString ASN.1 BER encoded array\r\n\t */\r\n\tfromString(inputString)\r\n\t{\r\n\t\tconst strLength = inputString.length;\r\n\r\n\t\tthis.valueBlock.valueHex = new ArrayBuffer(strLength * 4);\r\n\t\tconst valueHexView = new Uint8Array(this.valueBlock.valueHex);\r\n\r\n\t\tfor(let i = 0; i < strLength; i++)\r\n\t\t{\r\n\t\t\tconst codeBuf = utilToBase(inputString.charCodeAt(i), 8);\r\n\t\t\tconst codeView = new Uint8Array(codeBuf);\r\n\t\t\tif(codeView.length > 4)\r\n\t\t\t\tcontinue;\r\n\r\n\t\t\tconst dif = 4 - codeView.length;\r\n\r\n\t\t\tfor(let j = (codeView.length - 1); j >= 0; j--)\r\n\t\t\t\tvalueHexView[i * 4 + j + dif] = codeView[j];\r\n\t\t}\r\n\r\n\t\tthis.valueBlock.value = inputString;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\nclass LocalSimpleStringValueBlock extends HexBlock(LocalBaseBlock)\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"LocalSimpleStringValueBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.value = \"\";\r\n\t\tthis.isHexOnly = true;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"SimpleStringValueBlock\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t//noinspection JSUnusedGlobalSymbols\r\n\t/**\r\n\t * Convertion for the block to JSON object\r\n\t * @returns {Object}\r\n\t */\r\n\ttoJSON()\r\n\t{\r\n\t\tlet object = {};\r\n\t\t\r\n\t\t//region Seems at the moment (Sep 2016) there is no way how to check method is supported in \"super\" object\r\n\t\ttry\r\n\t\t{\r\n\t\t\tobject = super.toJSON();\r\n\t\t}\r\n\t\tcatch(ex){}\r\n\t\t//endregion\r\n\r\n\t\tobject.value = this.value;\r\n\r\n\t\treturn object;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends BaseBlock\r\n */\r\nclass LocalSimpleStringBlock extends BaseBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"LocalSimpleStringBlock\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters, LocalSimpleStringValueBlock);\r\n\r\n\t\tif(\"value\" in parameters)\r\n\t\t\tthis.fromString(parameters.value);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"SIMPLESTRING\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number} Offset after least decoded byte\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\tconst resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, (this.lenBlock.isIndefiniteForm === true) ? inputLength : this.lenBlock.length);\r\n\t\tif(resultOffset === (-1))\r\n\t\t{\r\n\t\t\tthis.error = this.valueBlock.error;\r\n\t\t\treturn resultOffset;\r\n\t\t}\r\n\r\n\t\tthis.fromBuffer(this.valueBlock.valueHex);\r\n\r\n\t\tif(this.idBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.idBlock.blockLength;\r\n\r\n\t\tif(this.lenBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.lenBlock.blockLength;\r\n\r\n\t\tif(this.valueBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.valueBlock.blockLength;\r\n\r\n\t\treturn resultOffset;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Function converting ArrayBuffer into ASN.1 internal string\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t */\r\n\tfromBuffer(inputBuffer)\r\n\t{\r\n\t\tthis.valueBlock.value = String.fromCharCode.apply(null, new Uint8Array(inputBuffer));\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Function converting JavaScript string into ASN.1 internal class\r\n\t * @param {!string} inputString ASN.1 BER encoded array\r\n\t */\r\n\tfromString(inputString)\r\n\t{\r\n\t\tconst strLen = inputString.length;\r\n\r\n\t\tthis.valueBlock.valueHex = new ArrayBuffer(strLen);\r\n\t\tconst view = new Uint8Array(this.valueBlock.valueHex);\r\n\r\n\t\tfor(let i = 0; i < strLen; i++)\r\n\t\t\tview[i] = inputString.charCodeAt(i);\r\n\r\n\t\tthis.valueBlock.value = inputString;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends LocalSimpleStringBlock\r\n */\r\nexport class NumericString extends LocalSimpleStringBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"NumericString\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 18; // NumericString\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"NumericString\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends LocalSimpleStringBlock\r\n */\r\nexport class PrintableString extends LocalSimpleStringBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"PrintableString\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 19; // PrintableString\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"PrintableString\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends LocalSimpleStringBlock\r\n */\r\nexport class TeletexString extends LocalSimpleStringBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"TeletexString\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 20; // TeletexString\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"TeletexString\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends LocalSimpleStringBlock\r\n */\r\nexport class VideotexString extends LocalSimpleStringBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"VideotexString\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 21; // VideotexString\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"VideotexString\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends LocalSimpleStringBlock\r\n */\r\nexport class IA5String extends LocalSimpleStringBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"IA5String\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 22; // IA5String\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"IA5String\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends LocalSimpleStringBlock\r\n */\r\nexport class GraphicString extends LocalSimpleStringBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"GraphicString\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 25; // GraphicString\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"GraphicString\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends LocalSimpleStringBlock\r\n */\r\nexport class VisibleString extends LocalSimpleStringBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"VisibleString\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 26; // VisibleString\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"VisibleString\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends LocalSimpleStringBlock\r\n */\r\nexport class GeneralString extends LocalSimpleStringBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"GeneralString\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 27; // GeneralString\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"GeneralString\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends LocalSimpleStringBlock\r\n */\r\nexport class CharacterString extends LocalSimpleStringBlock\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"CharacterString\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 29; // CharacterString\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"CharacterString\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of all date and time classes\r\n//**************************************************************************************\r\n/**\r\n * @extends VisibleString\r\n */\r\nexport class UTCTime extends VisibleString\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"UTCTime\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {string} [value] String representatio of the date\r\n\t * @property {Date} [valueDate] JavaScript \"Date\" object\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.year = 0;\r\n\t\tthis.month = 0;\r\n\t\tthis.day = 0;\r\n\t\tthis.hour = 0;\r\n\t\tthis.minute = 0;\r\n\t\tthis.second = 0;\r\n\r\n\t\t//region Create UTCTime from ASN.1 UTC string value\r\n\t\tif(\"value\" in parameters)\r\n\t\t{\r\n\t\t\tthis.fromString(parameters.value);\r\n\r\n\t\t\tthis.valueBlock.valueHex = new ArrayBuffer(parameters.value.length);\r\n\t\t\tconst view = new Uint8Array(this.valueBlock.valueHex);\r\n\r\n\t\t\tfor(let i = 0; i < parameters.value.length; i++)\r\n\t\t\t\tview[i] = parameters.value.charCodeAt(i);\r\n\t\t}\r\n\t\t//endregion\r\n\t\t//region Create GeneralizedTime from JavaScript Date type\r\n\t\tif(\"valueDate\" in parameters)\r\n\t\t{\r\n\t\t\tthis.fromDate(parameters.valueDate);\r\n\t\t\tthis.valueBlock.valueHex = this.toBuffer();\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 23; // UTCTime\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number} Offset after least decoded byte\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\tconst resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, (this.lenBlock.isIndefiniteForm === true) ? inputLength : this.lenBlock.length);\r\n\t\tif(resultOffset === (-1))\r\n\t\t{\r\n\t\t\tthis.error = this.valueBlock.error;\r\n\t\t\treturn resultOffset;\r\n\t\t}\r\n\r\n\t\tthis.fromBuffer(this.valueBlock.valueHex);\r\n\r\n\t\tif(this.idBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.idBlock.blockLength;\r\n\r\n\t\tif(this.lenBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.lenBlock.blockLength;\r\n\r\n\t\tif(this.valueBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.valueBlock.blockLength;\r\n\r\n\t\treturn resultOffset;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Function converting ArrayBuffer into ASN.1 internal string\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t */\r\n\tfromBuffer(inputBuffer)\r\n\t{\r\n\t\tthis.fromString(String.fromCharCode.apply(null, new Uint8Array(inputBuffer)));\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Function converting ASN.1 internal string into ArrayBuffer\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoBuffer()\r\n\t{\r\n\t\tconst str = this.toString();\r\n\r\n\t\tconst buffer = new ArrayBuffer(str.length);\r\n\t\tconst view = new Uint8Array(buffer);\r\n\r\n\t\tfor(let i = 0; i < str.length; i++)\r\n\t\t\tview[i] = str.charCodeAt(i);\r\n\r\n\t\treturn buffer;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Function converting \"Date\" object into ASN.1 internal string\r\n\t * @param {!Date} inputDate JavaScript \"Date\" object\r\n\t */\r\n\tfromDate(inputDate)\r\n\t{\r\n\t\tthis.year = inputDate.getUTCFullYear();\r\n\t\tthis.month = inputDate.getUTCMonth() + 1;\r\n\t\tthis.day = inputDate.getUTCDate();\r\n\t\tthis.hour = inputDate.getUTCHours();\r\n\t\tthis.minute = inputDate.getUTCMinutes();\r\n\t\tthis.second = inputDate.getUTCSeconds();\r\n\t}\r\n\t//**********************************************************************************\r\n\t//noinspection JSUnusedGlobalSymbols\r\n\t/**\r\n\t * Function converting ASN.1 internal string into \"Date\" object\r\n\t * @returns {Date}\r\n\t */\r\n\ttoDate()\r\n\t{\r\n\t\treturn (new Date(Date.UTC(this.year, this.month - 1, this.day, this.hour, this.minute, this.second)));\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Function converting JavaScript string into ASN.1 internal class\r\n\t * @param {!string} inputString ASN.1 BER encoded array\r\n\t */\r\n\tfromString(inputString)\r\n\t{\r\n\t\t//region Parse input string\r\n\t\tconst parser = /(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})Z/ig;\r\n\t\tconst parserArray = parser.exec(inputString);\r\n\t\tif(parserArray === null)\r\n\t\t{\r\n\t\t\tthis.error = \"Wrong input string for convertion\";\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\t//region Store parsed values\r\n\t\tconst year = parseInt(parserArray[1], 10);\r\n\t\tif(year >= 50)\r\n\t\t\tthis.year = 1900 + year;\r\n\t\telse\r\n\t\t\tthis.year = 2000 + year;\r\n\r\n\t\tthis.month = parseInt(parserArray[2], 10);\r\n\t\tthis.day = parseInt(parserArray[3], 10);\r\n\t\tthis.hour = parseInt(parserArray[4], 10);\r\n\t\tthis.minute = parseInt(parserArray[5], 10);\r\n\t\tthis.second = parseInt(parserArray[6], 10);\r\n\t\t//endregion\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Function converting ASN.1 internal class into JavaScript string\r\n\t * @returns {string}\r\n\t */\r\n\ttoString()\r\n\t{\r\n\t\tconst outputArray = new Array(7);\r\n\r\n\t\toutputArray[0] = padNumber(((this.year < 2000) ? (this.year - 1900) : (this.year - 2000)), 2);\r\n\t\toutputArray[1] = padNumber(this.month, 2);\r\n\t\toutputArray[2] = padNumber(this.day, 2);\r\n\t\toutputArray[3] = padNumber(this.hour, 2);\r\n\t\toutputArray[4] = padNumber(this.minute, 2);\r\n\t\toutputArray[5] = padNumber(this.second, 2);\r\n\t\toutputArray[6] = \"Z\";\r\n\r\n\t\treturn outputArray.join(\"\");\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"UTCTime\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Convertion for the block to JSON object\r\n\t * @returns {Object}\r\n\t */\r\n\ttoJSON()\r\n\t{\r\n\t\tlet object = {};\r\n\t\t\r\n\t\t//region Seems at the moment (Sep 2016) there is no way how to check method is supported in \"super\" object\r\n\t\ttry\r\n\t\t{\r\n\t\t\tobject = super.toJSON();\r\n\t\t}\r\n\t\tcatch(ex){}\r\n\t\t//endregion\r\n\r\n\t\tobject.year = this.year;\r\n\t\tobject.month = this.month;\r\n\t\tobject.day = this.day;\r\n\t\tobject.hour = this.hour;\r\n\t\tobject.minute = this.minute;\r\n\t\tobject.second = this.second;\r\n\r\n\t\treturn object;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends VisibleString\r\n */\r\nexport class GeneralizedTime extends VisibleString\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"GeneralizedTime\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {string} [value] String representatio of the date\r\n\t * @property {Date} [valueDate] JavaScript \"Date\" object\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.year = 0;\r\n\t\tthis.month = 0;\r\n\t\tthis.day = 0;\r\n\t\tthis.hour = 0;\r\n\t\tthis.minute = 0;\r\n\t\tthis.second = 0;\r\n\t\tthis.millisecond = 0;\r\n\r\n\t\t//region Create UTCTime from ASN.1 UTC string value\r\n\t\tif(\"value\" in parameters)\r\n\t\t{\r\n\t\t\tthis.fromString(parameters.value);\r\n\r\n\t\t\tthis.valueBlock.valueHex = new ArrayBuffer(parameters.value.length);\r\n\t\t\tconst view = new Uint8Array(this.valueBlock.valueHex);\r\n\r\n\t\t\tfor(let i = 0; i < parameters.value.length; i++)\r\n\t\t\t\tview[i] = parameters.value.charCodeAt(i);\r\n\t\t}\r\n\t\t//endregion\r\n\t\t//region Create GeneralizedTime from JavaScript Date type\r\n\t\tif(\"valueDate\" in parameters)\r\n\t\t{\r\n\t\t\tthis.fromDate(parameters.valueDate);\r\n\t\t\tthis.valueBlock.valueHex = this.toBuffer();\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 24; // GeneralizedTime\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number} Offset after least decoded byte\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\tconst resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, (this.lenBlock.isIndefiniteForm === true) ? inputLength : this.lenBlock.length);\r\n\t\tif(resultOffset === (-1))\r\n\t\t{\r\n\t\t\tthis.error = this.valueBlock.error;\r\n\t\t\treturn resultOffset;\r\n\t\t}\r\n\r\n\t\tthis.fromBuffer(this.valueBlock.valueHex);\r\n\r\n\t\tif(this.idBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.idBlock.blockLength;\r\n\r\n\t\tif(this.lenBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.lenBlock.blockLength;\r\n\r\n\t\tif(this.valueBlock.error.length === 0)\r\n\t\t\tthis.blockLength += this.valueBlock.blockLength;\r\n\r\n\t\treturn resultOffset;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Function converting ArrayBuffer into ASN.1 internal string\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t */\r\n\tfromBuffer(inputBuffer)\r\n\t{\r\n\t\tthis.fromString(String.fromCharCode.apply(null, new Uint8Array(inputBuffer)));\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Function converting ASN.1 internal string into ArrayBuffer\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoBuffer()\r\n\t{\r\n\t\tconst str = this.toString();\r\n\r\n\t\tconst buffer = new ArrayBuffer(str.length);\r\n\t\tconst view = new Uint8Array(buffer);\r\n\r\n\t\tfor(let i = 0; i < str.length; i++)\r\n\t\t\tview[i] = str.charCodeAt(i);\r\n\r\n\t\treturn buffer;\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Function converting \"Date\" object into ASN.1 internal string\r\n\t * @param {!Date} inputDate JavaScript \"Date\" object\r\n\t */\r\n\tfromDate(inputDate)\r\n\t{\r\n\t\tthis.year = inputDate.getUTCFullYear();\r\n\t\tthis.month = inputDate.getUTCMonth() + 1;\r\n\t\tthis.day = inputDate.getUTCDate();\r\n\t\tthis.hour = inputDate.getUTCHours();\r\n\t\tthis.minute = inputDate.getUTCMinutes();\r\n\t\tthis.second = inputDate.getUTCSeconds();\r\n\t\tthis.millisecond = inputDate.getUTCMilliseconds();\r\n\t}\r\n\t//**********************************************************************************\r\n\t//noinspection JSUnusedGlobalSymbols\r\n\t/**\r\n\t * Function converting ASN.1 internal string into \"Date\" object\r\n\t * @returns {Date}\r\n\t */\r\n\ttoDate()\r\n\t{\r\n\t\treturn (new Date(Date.UTC(this.year, this.month - 1, this.day, this.hour, this.minute, this.second, this.millisecond)));\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Function converting JavaScript string into ASN.1 internal class\r\n\t * @param {!string} inputString ASN.1 BER encoded array\r\n\t */\r\n\tfromString(inputString)\r\n\t{\r\n\t\t//region Initial variables\r\n\t\tlet isUTC = false;\r\n\r\n\t\tlet timeString = \"\";\r\n\t\tlet dateTimeString = \"\";\r\n\t\tlet fractionPart = 0;\r\n\r\n\t\tlet parser;\r\n\r\n\t\tlet hourDifference = 0;\r\n\t\tlet minuteDifference = 0;\r\n\t\t//endregion\r\n\r\n\t\t//region Convert as UTC time\r\n\t\tif(inputString[inputString.length - 1] === \"Z\")\r\n\t\t{\r\n\t\t\ttimeString = inputString.substr(0, inputString.length - 1);\r\n\r\n\t\t\tisUTC = true;\r\n\t\t}\r\n\t\t//endregion\r\n\t\t//region Convert as local time\r\n\t\telse\r\n\t\t{\r\n\t\t\t//noinspection JSPrimitiveTypeWrapperUsage\r\n\t\t\tconst number = new Number(inputString[inputString.length - 1]);\r\n\r\n\t\t\tif(isNaN(number.valueOf()))\r\n\t\t\t\tthrow new Error(\"Wrong input string for convertion\");\r\n\r\n\t\t\ttimeString = inputString;\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\t//region Check that we do not have a \"+\" and \"-\" symbols inside UTC time\r\n\t\tif(isUTC)\r\n\t\t{\r\n\t\t\tif(timeString.indexOf(\"+\") !== (-1))\r\n\t\t\t\tthrow new Error(\"Wrong input string for convertion\");\r\n\r\n\t\t\tif(timeString.indexOf(\"-\") !== (-1))\r\n\t\t\t\tthrow new Error(\"Wrong input string for convertion\");\r\n\t\t}\r\n\t\t//endregion\r\n\t\t//region Get \"UTC time difference\" in case of local time\r\n\t\telse\r\n\t\t{\r\n\t\t\tlet multiplier = 1;\r\n\t\t\tlet differencePosition = timeString.indexOf(\"+\");\r\n\t\t\tlet differenceString = \"\";\r\n\r\n\t\t\tif(differencePosition === (-1))\r\n\t\t\t{\r\n\t\t\t\tdifferencePosition = timeString.indexOf(\"-\");\r\n\t\t\t\tmultiplier = (-1);\r\n\t\t\t}\r\n\r\n\t\t\tif(differencePosition !== (-1))\r\n\t\t\t{\r\n\t\t\t\tdifferenceString = timeString.substr(differencePosition + 1);\r\n\t\t\t\ttimeString = timeString.substr(0, differencePosition);\r\n\r\n\t\t\t\tif((differenceString.length !== 2) && (differenceString.length !== 4))\r\n\t\t\t\t\tthrow new Error(\"Wrong input string for convertion\");\r\n\r\n\t\t\t\t//noinspection JSPrimitiveTypeWrapperUsage\r\n\t\t\t\tlet number = new Number(differenceString.substr(0, 2));\r\n\r\n\t\t\t\tif(isNaN(number.valueOf()))\r\n\t\t\t\t\tthrow new Error(\"Wrong input string for convertion\");\r\n\r\n\t\t\t\thourDifference = multiplier * number;\r\n\r\n\t\t\t\tif(differenceString.length === 4)\r\n\t\t\t\t{\r\n\t\t\t\t\t//noinspection JSPrimitiveTypeWrapperUsage\r\n\t\t\t\t\tnumber = new Number(differenceString.substr(2, 2));\r\n\r\n\t\t\t\t\tif(isNaN(number.valueOf()))\r\n\t\t\t\t\t\tthrow new Error(\"Wrong input string for convertion\");\r\n\r\n\t\t\t\t\tminuteDifference = multiplier * number;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\t//region Get position of fraction point\r\n\t\tlet fractionPointPosition = timeString.indexOf(\".\"); // Check for \"full stop\" symbol\r\n\t\tif(fractionPointPosition === (-1))\r\n\t\t\tfractionPointPosition = timeString.indexOf(\",\"); // Check for \"comma\" symbol\r\n\t\t//endregion\r\n\r\n\t\t//region Get fraction part\r\n\t\tif(fractionPointPosition !== (-1))\r\n\t\t{\r\n\t\t\t//noinspection JSPrimitiveTypeWrapperUsage\r\n\t\t\tconst fractionPartCheck = new Number(`0${timeString.substr(fractionPointPosition)}`);\r\n\r\n\t\t\tif(isNaN(fractionPartCheck.valueOf()))\r\n\t\t\t\tthrow new Error(\"Wrong input string for convertion\");\r\n\r\n\t\t\tfractionPart = fractionPartCheck.valueOf();\r\n\r\n\t\t\tdateTimeString = timeString.substr(0, fractionPointPosition);\r\n\t\t}\r\n\t\telse\r\n\t\t\tdateTimeString = timeString;\r\n\t\t//endregion\r\n\r\n\t\t//region Parse internal date\r\n\t\tswitch(true)\r\n\t\t{\r\n\t\t\tcase (dateTimeString.length === 8): // \"YYYYMMDD\"\r\n\t\t\t\tparser = /(\\d{4})(\\d{2})(\\d{2})/ig;\r\n\t\t\t\tif(fractionPointPosition !== (-1))\r\n\t\t\t\t\tthrow new Error(\"Wrong input string for convertion\"); // Here we should not have a \"fraction point\"\r\n\t\t\t\tbreak;\r\n\t\t\tcase (dateTimeString.length === 10): // \"YYYYMMDDHH\"\r\n\t\t\t\tparser = /(\\d{4})(\\d{2})(\\d{2})(\\d{2})/ig;\r\n\r\n\t\t\t\tif(fractionPointPosition !== (-1))\r\n\t\t\t\t{\r\n\t\t\t\t\tlet fractionResult = 60 * fractionPart;\r\n\t\t\t\t\tthis.minute = Math.floor(fractionResult);\r\n\r\n\t\t\t\t\tfractionResult = 60 * (fractionResult - this.minute);\r\n\t\t\t\t\tthis.second = Math.floor(fractionResult);\r\n\r\n\t\t\t\t\tfractionResult = 1000 * (fractionResult - this.second);\r\n\t\t\t\t\tthis.millisecond = Math.floor(fractionResult);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase (dateTimeString.length === 12): // \"YYYYMMDDHHMM\"\r\n\t\t\t\tparser = /(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/ig;\r\n\r\n\t\t\t\tif(fractionPointPosition !== (-1))\r\n\t\t\t\t{\r\n\t\t\t\t\tlet fractionResult = 60 * fractionPart;\r\n\t\t\t\t\tthis.second = Math.floor(fractionResult);\r\n\r\n\t\t\t\t\tfractionResult = 1000 * (fractionResult - this.second);\r\n\t\t\t\t\tthis.millisecond = Math.floor(fractionResult);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase (dateTimeString.length === 14): // \"YYYYMMDDHHMMSS\"\r\n\t\t\t\tparser = /(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/ig;\r\n\r\n\t\t\t\tif(fractionPointPosition !== (-1))\r\n\t\t\t\t{\r\n\t\t\t\t\tconst fractionResult = 1000 * fractionPart;\r\n\t\t\t\t\tthis.millisecond = Math.floor(fractionResult);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tthrow new Error(\"Wrong input string for convertion\");\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\t//region Put parsed values at right places\r\n\t\tconst parserArray = parser.exec(dateTimeString);\r\n\t\tif(parserArray === null)\r\n\t\t\tthrow new Error(\"Wrong input string for convertion\");\r\n\r\n\t\tfor(let j = 1; j < parserArray.length; j++)\r\n\t\t{\r\n\t\t\tswitch(j)\r\n\t\t\t{\r\n\t\t\t\tcase 1:\r\n\t\t\t\t\tthis.year = parseInt(parserArray[j], 10);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 2:\r\n\t\t\t\t\tthis.month = parseInt(parserArray[j], 10);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 3:\r\n\t\t\t\t\tthis.day = parseInt(parserArray[j], 10);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 4:\r\n\t\t\t\t\tthis.hour = parseInt(parserArray[j], 10) + hourDifference;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 5:\r\n\t\t\t\t\tthis.minute = parseInt(parserArray[j], 10) + minuteDifference;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tcase 6:\r\n\t\t\t\t\tthis.second = parseInt(parserArray[j], 10);\r\n\t\t\t\t\tbreak;\r\n\t\t\t\tdefault:\r\n\t\t\t\t\tthrow new Error(\"Wrong input string for convertion\");\r\n\t\t\t}\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\t//region Get final date\r\n\t\tif(isUTC === false)\r\n\t\t{\r\n\t\t\tconst tempDate = new Date(this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);\r\n\r\n\t\t\tthis.year = tempDate.getUTCFullYear();\r\n\t\t\tthis.month = tempDate.getUTCMonth();\r\n\t\t\tthis.day = tempDate.getUTCDay();\r\n\t\t\tthis.hour = tempDate.getUTCHours();\r\n\t\t\tthis.minute = tempDate.getUTCMinutes();\r\n\t\t\tthis.second = tempDate.getUTCSeconds();\r\n\t\t\tthis.millisecond = tempDate.getUTCMilliseconds();\r\n\t\t}\r\n\t\t//endregion\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Function converting ASN.1 internal class into JavaScript string\r\n\t * @returns {string}\r\n\t */\r\n\ttoString()\r\n\t{\r\n\t\tconst outputArray = [];\r\n\r\n\t\toutputArray.push(padNumber(this.year, 4));\r\n\t\toutputArray.push(padNumber(this.month, 2));\r\n\t\toutputArray.push(padNumber(this.day, 2));\r\n\t\toutputArray.push(padNumber(this.hour, 2));\r\n\t\toutputArray.push(padNumber(this.minute, 2));\r\n\t\toutputArray.push(padNumber(this.second, 2));\r\n\t\tif(this.millisecond !== 0)\r\n\t\t{\r\n\t\t\toutputArray.push(\".\");\r\n\t\t\toutputArray.push(padNumber(this.millisecond, 3));\r\n\t\t}\r\n\t\toutputArray.push(\"Z\");\r\n\r\n\t\treturn outputArray.join(\"\");\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"GeneralizedTime\";\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Convertion for the block to JSON object\r\n\t * @returns {Object}\r\n\t */\r\n\ttoJSON()\r\n\t{\r\n\t\tlet object = {};\r\n\t\t\r\n\t\t//region Seems at the moment (Sep 2016) there is no way how to check method is supported in \"super\" object\r\n\t\ttry\r\n\t\t{\r\n\t\t\tobject = super.toJSON();\r\n\t\t}\r\n\t\tcatch(ex){}\r\n\t\t//endregion\r\n\r\n\t\tobject.year = this.year;\r\n\t\tobject.month = this.month;\r\n\t\tobject.day = this.day;\r\n\t\tobject.hour = this.hour;\r\n\t\tobject.minute = this.minute;\r\n\t\tobject.second = this.second;\r\n\t\tobject.millisecond = this.millisecond;\r\n\r\n\t\treturn object;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends Utf8String\r\n */\r\nexport class DATE extends Utf8String\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"DATE\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 31; // DATE\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"DATE\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends Utf8String\r\n */\r\nexport class TimeOfDay extends Utf8String\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"TimeOfDay\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 32; // TimeOfDay\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"TimeOfDay\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends Utf8String\r\n */\r\nexport class DateTime extends Utf8String\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"DateTime\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 33; // DateTime\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"DateTime\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends Utf8String\r\n */\r\nexport class Duration extends Utf8String\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"Duration\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 34; // Duration\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"Duration\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n/**\r\n * @extends Utf8String\r\n */\r\nexport class TIME extends Utf8String\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"Time\" class\r\n\t * @param {Object} [parameters={}]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tsuper(parameters);\r\n\r\n\t\tthis.idBlock.tagClass = 1; // UNIVERSAL\r\n\t\tthis.idBlock.tagNumber = 14; // Time\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Aux function, need to get a block name. Need to have it here for inhiritence\r\n\t * @returns {string}\r\n\t */\r\n\tstatic blockName()\r\n\t{\r\n\t\treturn \"TIME\";\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of special ASN.1 schema type Choice\r\n//**************************************************************************************\r\nexport class Choice\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"Choice\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {Array} [value] Array of ASN.1 types for make a choice from\r\n\t * @property {boolean} [optional]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tthis.value = getParametersValue(parameters, \"value\", []);\r\n\t\tthis.optional = getParametersValue(parameters, \"optional\", false);\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of special ASN.1 schema type Any\r\n//**************************************************************************************\r\nexport class Any\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"Any\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {string} [name]\r\n\t * @property {boolean} [optional]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tthis.name = getParametersValue(parameters, \"name\", \"\");\r\n\t\tthis.optional = getParametersValue(parameters, \"optional\", false);\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of special ASN.1 schema type Repeated\r\n//**************************************************************************************\r\nexport class Repeated\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"Repeated\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {string} [name]\r\n\t * @property {boolean} [optional]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tthis.name = getParametersValue(parameters, \"name\", \"\");\r\n\t\tthis.optional = getParametersValue(parameters, \"optional\", false);\r\n\t\tthis.value = getParametersValue(parameters, \"value\", new Any());\r\n\t\tthis.local = getParametersValue(parameters, \"local\", false); // Could local or global array to store elements\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Declaration of special ASN.1 schema type RawData\r\n//**************************************************************************************\r\n/**\r\n * @description Special class providing ability to have \"toBER/fromBER\" for raw ArrayBuffer\r\n */\r\nexport class RawData\r\n{\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Constructor for \"Repeated\" class\r\n\t * @param {Object} [parameters={}]\r\n\t * @property {string} [name]\r\n\t * @property {boolean} [optional]\r\n\t */\r\n\tconstructor(parameters = {})\r\n\t{\r\n\t\tthis.data = getParametersValue(parameters, \"data\", new ArrayBuffer(0));\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Base function for converting block from BER encoded array of bytes\r\n\t * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n\t * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n\t * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n\t * @returns {number} Offset after least decoded byte\r\n\t */\r\n\tfromBER(inputBuffer, inputOffset, inputLength)\r\n\t{\r\n\t\tthis.data = inputBuffer.slice(inputOffset, inputLength);\r\n\t\treturn (inputOffset + inputLength);\r\n\t}\r\n\t//**********************************************************************************\r\n\t/**\r\n\t * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules)\r\n\t * @param {boolean} [sizeOnly=false] Flag that we need only a size of encoding, not a real array of bytes\r\n\t * @returns {ArrayBuffer}\r\n\t */\r\n\ttoBER(sizeOnly = false)\r\n\t{\r\n\t\treturn this.data;\r\n\t}\r\n\t//**********************************************************************************\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Major ASN.1 BER decoding function\r\n//**************************************************************************************\r\n/**\r\n * Internal library function for decoding ASN.1 BER\r\n * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array\r\n * @param {!number} inputOffset Offset in ASN.1 BER encoded array where decoding should be started\r\n * @param {!number} inputLength Maximum length of array of bytes which can be using in this function\r\n * @returns {{offset: number, result: Object}}\r\n */\r\nfunction LocalFromBER(inputBuffer, inputOffset, inputLength)\r\n{\r\n\tconst incomingOffset = inputOffset; // Need to store initial offset since \"inputOffset\" is changing in the function\r\n\r\n\t//region Local function changing a type for ASN.1 classes\r\n\tfunction localChangeType(inputObject, newType)\r\n\t{\r\n\t\tif(inputObject instanceof newType)\r\n\t\t\treturn inputObject;\r\n\r\n\t\tconst newObject = new newType();\r\n\t\tnewObject.idBlock = inputObject.idBlock;\r\n\t\tnewObject.lenBlock = inputObject.lenBlock;\r\n\t\tnewObject.warnings = inputObject.warnings;\r\n\t\t//noinspection JSCheckFunctionSignatures\r\n\t\tnewObject.valueBeforeDecode = inputObject.valueBeforeDecode.slice(0);\r\n\r\n\t\treturn newObject;\r\n\t}\r\n\t//endregion\r\n\r\n\t//region Create a basic ASN.1 type since we need to return errors and warnings from the function\r\n\tlet returnObject = new BaseBlock({}, Object);\r\n\t//endregion\r\n\r\n\t//region Basic check for parameters\r\n\tconst baseBlock = new LocalBaseBlock();\r\n\tif(checkBufferParams(baseBlock, inputBuffer, inputOffset, inputLength) === false)\r\n\t{\r\n\t\treturnObject.error = baseBlock.error;\r\n\t\treturn {\r\n\t\t\toffset: (-1),\r\n\t\t\tresult: returnObject\r\n\t\t};\r\n\t}\r\n\t//endregion\r\n\r\n\t//region Getting Uint8Array from ArrayBuffer\r\n\tconst intBuffer = new Uint8Array(inputBuffer, inputOffset, inputLength);\r\n\t//endregion\r\n\r\n\t//region Initial checks\r\n\tif(intBuffer.length === 0)\r\n\t{\r\n\t\tthis.error = \"Zero buffer length\";\r\n\t\treturn {\r\n\t\t\toffset: (-1),\r\n\t\t\tresult: returnObject\r\n\t\t};\r\n\t}\r\n\t//endregion\r\n\r\n\t//region Decode indentifcation block of ASN.1 BER structure\r\n\tlet resultOffset = returnObject.idBlock.fromBER(inputBuffer, inputOffset, inputLength);\r\n\treturnObject.warnings.concat(returnObject.idBlock.warnings);\r\n\tif(resultOffset === (-1))\r\n\t{\r\n\t\treturnObject.error = returnObject.idBlock.error;\r\n\t\treturn {\r\n\t\t\toffset: (-1),\r\n\t\t\tresult: returnObject\r\n\t\t};\r\n\t}\r\n\r\n\tinputOffset = resultOffset;\r\n\tinputLength -= returnObject.idBlock.blockLength;\r\n\t//endregion\r\n\r\n\t//region Decode length block of ASN.1 BER structure\r\n\tresultOffset = returnObject.lenBlock.fromBER(inputBuffer, inputOffset, inputLength);\r\n\treturnObject.warnings.concat(returnObject.lenBlock.warnings);\r\n\tif(resultOffset === (-1))\r\n\t{\r\n\t\treturnObject.error = returnObject.lenBlock.error;\r\n\t\treturn {\r\n\t\t\toffset: (-1),\r\n\t\t\tresult: returnObject\r\n\t\t};\r\n\t}\r\n\r\n\tinputOffset = resultOffset;\r\n\tinputLength -= returnObject.lenBlock.blockLength;\r\n\t//endregion\r\n\r\n\t//region Check for usign indefinite length form in encoding for primitive types\r\n\tif((returnObject.idBlock.isConstructed === false) &&\r\n\t\t(returnObject.lenBlock.isIndefiniteForm === true))\r\n\t{\r\n\t\treturnObject.error = \"Indefinite length form used for primitive encoding form\";\r\n\t\treturn {\r\n\t\t\toffset: (-1),\r\n\t\t\tresult: returnObject\r\n\t\t};\r\n\t}\r\n\t//endregion\r\n\r\n\t//region Switch ASN.1 block type\r\n\tlet newASN1Type = BaseBlock;\r\n\r\n\tswitch(returnObject.idBlock.tagClass)\r\n\t{\r\n\t\t//region UNIVERSAL\r\n\t\tcase 1:\r\n\t\t\t//region Check for reserved tag numbers\r\n\t\t\tif((returnObject.idBlock.tagNumber >= 37) &&\r\n\t\t\t\t(returnObject.idBlock.isHexOnly === false))\r\n\t\t\t{\r\n\t\t\t\treturnObject.error = \"UNIVERSAL 37 and upper tags are reserved by ASN.1 standard\";\r\n\t\t\t\treturn {\r\n\t\t\t\t\toffset: (-1),\r\n\t\t\t\t\tresult: returnObject\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t\t//endregion\r\n\r\n\t\t\tswitch(returnObject.idBlock.tagNumber)\r\n\t\t\t{\r\n\t\t\t\t//region EndOfContent type\r\n\t\t\t\tcase 0:\r\n\t\t\t\t\t//region Check for EndOfContent type\r\n\t\t\t\t\tif((returnObject.idBlock.isConstructed === true) &&\r\n\t\t\t\t\t\t(returnObject.lenBlock.length > 0))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\treturnObject.error = \"Type [UNIVERSAL 0] is reserved\";\r\n\t\t\t\t\t\treturn {\r\n\t\t\t\t\t\t\toffset: (-1),\r\n\t\t\t\t\t\t\tresult: returnObject\r\n\t\t\t\t\t\t};\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//endregion\r\n\r\n\t\t\t\t\tnewASN1Type = EndOfContent;\r\n\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region Boolean type\r\n\t\t\t\tcase 1:\r\n\t\t\t\t\tnewASN1Type = Boolean;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region Integer type\r\n\t\t\t\tcase 2:\r\n\t\t\t\t\tnewASN1Type = Integer;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region BitString type\r\n\t\t\t\tcase 3:\r\n\t\t\t\t\tnewASN1Type = BitString;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region OctetString type\r\n\t\t\t\tcase 4:\r\n\t\t\t\t\tnewASN1Type = OctetString;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region Null type\r\n\t\t\t\tcase 5:\r\n\t\t\t\t\tnewASN1Type = Null;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region OBJECT IDENTIFIER type\r\n\t\t\t\tcase 6:\r\n\t\t\t\t\tnewASN1Type = ObjectIdentifier;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region Enumerated type\r\n\t\t\t\tcase 10:\r\n\t\t\t\t\tnewASN1Type = Enumerated;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region Utf8String type\r\n\t\t\t\tcase 12:\r\n\t\t\t\t\tnewASN1Type = Utf8String;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region Time type\r\n\t\t\t\t//region RELATIVE OBJECT IDENTIFIER type\r\n\t\t\t\tcase 13:\r\n\t\t\t\t\tnewASN1Type = RelativeObjectIdentifier;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\tcase 14:\r\n\t\t\t\t\tnewASN1Type = TIME;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region ASN.1 reserved type\r\n\t\t\t\tcase 15:\r\n\t\t\t\t\treturnObject.error = \"[UNIVERSAL 15] is reserved by ASN.1 standard\";\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\toffset: (-1),\r\n\t\t\t\t\t\tresult: returnObject\r\n\t\t\t\t\t};\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region Sequence type\r\n\t\t\t\tcase 16:\r\n\t\t\t\t\tnewASN1Type = Sequence;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region Set type\r\n\t\t\t\tcase 17:\r\n\t\t\t\t\tnewASN1Type = Set;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region NumericString type\r\n\t\t\t\tcase 18:\r\n\t\t\t\t\tnewASN1Type = NumericString;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region PrintableString type\r\n\t\t\t\tcase 19:\r\n\t\t\t\t\tnewASN1Type = PrintableString;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region TeletexString type\r\n\t\t\t\tcase 20:\r\n\t\t\t\t\tnewASN1Type = TeletexString;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region VideotexString type\r\n\t\t\t\tcase 21:\r\n\t\t\t\t\tnewASN1Type = VideotexString;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region IA5String type\r\n\t\t\t\tcase 22:\r\n\t\t\t\t\tnewASN1Type = IA5String;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region UTCTime type\r\n\t\t\t\tcase 23:\r\n\t\t\t\t\tnewASN1Type = UTCTime;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region GeneralizedTime type\r\n\t\t\t\tcase 24:\r\n\t\t\t\t\tnewASN1Type = GeneralizedTime;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region GraphicString type\r\n\t\t\t\tcase 25:\r\n\t\t\t\t\tnewASN1Type = GraphicString;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region VisibleString type\r\n\t\t\t\tcase 26:\r\n\t\t\t\t\tnewASN1Type = VisibleString;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region GeneralString type\r\n\t\t\t\tcase 27:\r\n\t\t\t\t\tnewASN1Type = GeneralString;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region UniversalString type\r\n\t\t\t\tcase 28:\r\n\t\t\t\t\tnewASN1Type = UniversalString;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region CharacterString type\r\n\t\t\t\tcase 29:\r\n\t\t\t\t\tnewASN1Type = CharacterString;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region BmpString type\r\n\t\t\t\tcase 30:\r\n\t\t\t\t\tnewASN1Type = BmpString;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region DATE type\r\n\t\t\t\tcase 31:\r\n\t\t\t\t\tnewASN1Type = DATE;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region TimeOfDay type\r\n\t\t\t\tcase 32:\r\n\t\t\t\t\tnewASN1Type = TimeOfDay;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region Date-Time type\r\n\t\t\t\tcase 33:\r\n\t\t\t\t\tnewASN1Type = DateTime;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region Duration type\r\n\t\t\t\tcase 34:\r\n\t\t\t\t\tnewASN1Type = Duration;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t//endregion\r\n\t\t\t\t//region default\r\n\t\t\t\tdefault:\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tlet newObject;\r\n\r\n\t\t\t\t\t\tif(returnObject.idBlock.isConstructed === true)\r\n\t\t\t\t\t\t\tnewObject = new Constructed();\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\tnewObject = new Primitive();\r\n\r\n\t\t\t\t\t\tnewObject.idBlock = returnObject.idBlock;\r\n\t\t\t\t\t\tnewObject.lenBlock = returnObject.lenBlock;\r\n\t\t\t\t\t\tnewObject.warnings = returnObject.warnings;\r\n\r\n\t\t\t\t\t\treturnObject = newObject;\r\n\r\n\t\t\t\t\t\tresultOffset = returnObject.fromBER(inputBuffer, inputOffset, inputLength);\r\n\t\t\t\t\t}\r\n\t\t\t\t//endregion\r\n\t\t\t}\r\n\t\t\tbreak;\r\n\t\t//endregion\r\n\t\t//region All other tag classes\r\n\t\tcase 2: // APPLICATION\r\n\t\tcase 3: // CONTEXT-SPECIFIC\r\n\t\tcase 4: // PRIVATE\r\n\t\tdefault:\r\n\t\t\t{\r\n\t\t\t\tif(returnObject.idBlock.isConstructed === true)\r\n\t\t\t\t\tnewASN1Type = Constructed;\r\n\t\t\t\telse\r\n\t\t\t\t\tnewASN1Type = Primitive;\r\n\t\t\t}\r\n\t\t//endregion\r\n\t}\r\n\t//endregion\r\n\r\n\t//region Change type and perform BER decoding\r\n\treturnObject = localChangeType(returnObject, newASN1Type);\r\n\tresultOffset = returnObject.fromBER(inputBuffer, inputOffset, (returnObject.lenBlock.isIndefiniteForm === true) ? inputLength : returnObject.lenBlock.length);\r\n\t//endregion\r\n\r\n\t//region Coping incoming buffer for entire ASN.1 block\r\n\treturnObject.valueBeforeDecode = inputBuffer.slice(incomingOffset, incomingOffset + returnObject.blockLength);\r\n\t//endregion\r\n\r\n\treturn {\r\n\t\toffset: resultOffset,\r\n\t\tresult: returnObject\r\n\t};\r\n}\r\n//**************************************************************************************\r\n/**\r\n * Major function for decoding ASN.1 BER array into internal library structuries\r\n * @param {!ArrayBuffer} inputBuffer ASN.1 BER encoded array of bytes\r\n */\r\nexport function fromBER(inputBuffer)\r\n{\r\n\tif(inputBuffer.byteLength === 0)\r\n\t{\r\n\t\tconst result = new BaseBlock({}, Object);\r\n\t\tresult.error = \"Input buffer has zero length\";\r\n\r\n\t\treturn {\r\n\t\t\toffset: (-1),\r\n\t\t\tresult\r\n\t\t};\r\n\t}\r\n\r\n\treturn LocalFromBER(inputBuffer, 0, inputBuffer.byteLength);\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Major scheme verification function\r\n//**************************************************************************************\r\n/**\r\n * Compare of two ASN.1 object trees\r\n * @param {!Object} root Root of input ASN.1 object tree\r\n * @param {!Object} inputData Input ASN.1 object tree\r\n * @param {!Object} inputSchema Input ASN.1 schema to compare with\r\n * @return {{verified: boolean}|{verified:boolean, result: Object}}\r\n */\r\nexport function compareSchema(root, inputData, inputSchema)\r\n{\r\n\t//region Special case for Choice schema element type\r\n\tif(inputSchema instanceof Choice)\r\n\t{\r\n\t\tconst choiceResult = false;\r\n\r\n\t\tfor(let j = 0; j < inputSchema.value.length; j++)\r\n\t\t{\r\n\t\t\tconst result = compareSchema(root, inputData, inputSchema.value[j]);\r\n\t\t\tif(result.verified === true)\r\n\t\t\t{\r\n\t\t\t\treturn {\r\n\t\t\t\t\tverified: true,\r\n\t\t\t\t\tresult: root\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif(choiceResult === false)\r\n\t\t{\r\n\t\t\tconst _result = {\r\n\t\t\t\tverified: false,\r\n\t\t\t\tresult: {\r\n\t\t\t\t\terror: \"Wrong values for Choice type\"\r\n\t\t\t\t}\r\n\t\t\t};\r\n\r\n\t\t\tif(inputSchema.hasOwnProperty(\"name\"))\r\n\t\t\t\t_result.name = inputSchema.name;\r\n\r\n\t\t\treturn _result;\r\n\t\t}\r\n\t}\r\n\t//endregion\r\n\r\n\t//region Special case for Any schema element type\r\n\tif(inputSchema instanceof Any)\r\n\t{\r\n\t\t//region Add named component of ASN.1 schema\r\n\t\tif(inputSchema.hasOwnProperty(\"name\"))\r\n\t\t\troot[inputSchema.name] = inputData;\r\n\t\t//endregion\r\n\r\n\t\treturn {\r\n\t\t\tverified: true,\r\n\t\t\tresult: root\r\n\t\t};\r\n\t}\r\n\t//endregion\r\n\r\n\t//region Initial check\r\n\tif((root instanceof Object) === false)\r\n\t{\r\n\t\treturn {\r\n\t\t\tverified: false,\r\n\t\t\tresult: { error: \"Wrong root object\" }\r\n\t\t};\r\n\t}\r\n\r\n\tif((inputData instanceof Object) === false)\r\n\t{\r\n\t\treturn {\r\n\t\t\tverified: false,\r\n\t\t\tresult: { error: \"Wrong ASN.1 data\" }\r\n\t\t};\r\n\t}\r\n\r\n\tif((inputSchema instanceof Object) === false)\r\n\t{\r\n\t\treturn {\r\n\t\t\tverified: false,\r\n\t\t\tresult: { error: \"Wrong ASN.1 schema\" }\r\n\t\t};\r\n\t}\r\n\r\n\tif((\"idBlock\" in inputSchema) === false)\r\n\t{\r\n\t\treturn {\r\n\t\t\tverified: false,\r\n\t\t\tresult: { error: \"Wrong ASN.1 schema\" }\r\n\t\t};\r\n\t}\r\n\t//endregion\r\n\r\n\t//region Comparing idBlock properties in ASN.1 data and ASN.1 schema\r\n\t//region Encode and decode ASN.1 schema idBlock\r\n\t/// <remarks>This encoding/decoding is neccessary because could be an errors in schema definition</remarks>\r\n\tif((\"fromBER\" in inputSchema.idBlock) === false)\r\n\t{\r\n\t\treturn {\r\n\t\t\tverified: false,\r\n\t\t\tresult: { error: \"Wrong ASN.1 schema\" }\r\n\t\t};\r\n\t}\r\n\r\n\tif((\"toBER\" in inputSchema.idBlock) === false)\r\n\t{\r\n\t\treturn {\r\n\t\t\tverified: false,\r\n\t\t\tresult: { error: \"Wrong ASN.1 schema\" }\r\n\t\t};\r\n\t}\r\n\r\n\tconst encodedId = inputSchema.idBlock.toBER(false);\r\n\tif(encodedId.byteLength === 0)\r\n\t{\r\n\t\treturn {\r\n\t\t\tverified: false,\r\n\t\t\tresult: { error: \"Error encoding idBlock for ASN.1 schema\" }\r\n\t\t};\r\n\t}\r\n\r\n\tconst decodedOffset = inputSchema.idBlock.fromBER(encodedId, 0, encodedId.byteLength);\r\n\tif(decodedOffset === (-1))\r\n\t{\r\n\t\treturn {\r\n\t\t\tverified: false,\r\n\t\t\tresult: { error: \"Error decoding idBlock for ASN.1 schema\" }\r\n\t\t};\r\n\t}\r\n\t//endregion\r\n\r\n\t//region tagClass\r\n\tif(inputSchema.idBlock.hasOwnProperty(\"tagClass\") === false)\r\n\t{\r\n\t\treturn {\r\n\t\t\tverified: false,\r\n\t\t\tresult: { error: \"Wrong ASN.1 schema\" }\r\n\t\t};\r\n\t}\r\n\r\n\tif(inputSchema.idBlock.tagClass !== inputData.idBlock.tagClass)\r\n\t{\r\n\t\treturn {\r\n\t\t\tverified: false,\r\n\t\t\tresult: root\r\n\t\t};\r\n\t}\r\n\t//endregion\r\n\t//region tagNumber\r\n\tif(inputSchema.idBlock.hasOwnProperty(\"tagNumber\") === false)\r\n\t{\r\n\t\treturn {\r\n\t\t\tverified: false,\r\n\t\t\tresult: { error: \"Wrong ASN.1 schema\" }\r\n\t\t};\r\n\t}\r\n\r\n\tif(inputSchema.idBlock.tagNumber !== inputData.idBlock.tagNumber)\r\n\t{\r\n\t\treturn {\r\n\t\t\tverified: false,\r\n\t\t\tresult: root\r\n\t\t};\r\n\t}\r\n\t//endregion\r\n\t//region isConstructed\r\n\tif(inputSchema.idBlock.hasOwnProperty(\"isConstructed\") === false)\r\n\t{\r\n\t\treturn {\r\n\t\t\tverified: false,\r\n\t\t\tresult: { error: \"Wrong ASN.1 schema\" }\r\n\t\t};\r\n\t}\r\n\r\n\tif(inputSchema.idBlock.isConstructed !== inputData.idBlock.isConstructed)\r\n\t{\r\n\t\treturn {\r\n\t\t\tverified: false,\r\n\t\t\tresult: root\r\n\t\t};\r\n\t}\r\n\t//endregion\r\n\t//region isHexOnly\r\n\tif((\"isHexOnly\" in inputSchema.idBlock) === false) // Since 'isHexOnly' is an inhirited property\r\n\t{\r\n\t\treturn {\r\n\t\t\tverified: false,\r\n\t\t\tresult: { error: \"Wrong ASN.1 schema\" }\r\n\t\t};\r\n\t}\r\n\r\n\tif(inputSchema.idBlock.isHexOnly !== inputData.idBlock.isHexOnly)\r\n\t{\r\n\t\treturn {\r\n\t\t\tverified: false,\r\n\t\t\tresult: root\r\n\t\t};\r\n\t}\r\n\t//endregion\r\n\t//region valueHex\r\n\tif(inputSchema.idBlock.isHexOnly === true)\r\n\t{\r\n\t\tif((\"valueHex\" in inputSchema.idBlock) === false) // Since 'valueHex' is an inhirited property\r\n\t\t{\r\n\t\t\treturn {\r\n\t\t\t\tverified: false,\r\n\t\t\t\tresult: { error: \"Wrong ASN.1 schema\" }\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tconst schemaView = new Uint8Array(inputSchema.idBlock.valueHex);\r\n\t\tconst asn1View = new Uint8Array(inputData.idBlock.valueHex);\r\n\r\n\t\tif(schemaView.length !== asn1View.length)\r\n\t\t{\r\n\t\t\treturn {\r\n\t\t\t\tverified: false,\r\n\t\t\t\tresult: root\r\n\t\t\t};\r\n\t\t}\r\n\r\n\t\tfor(let i = 0; i < schemaView.length; i++)\r\n\t\t{\r\n\t\t\tif(schemaView[i] !== asn1View[1])\r\n\t\t\t{\r\n\t\t\t\treturn {\r\n\t\t\t\t\tverified: false,\r\n\t\t\t\t\tresult: root\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\t//endregion\r\n\t//endregion\r\n\r\n\t//region Add named component of ASN.1 schema\r\n\tif(inputSchema.hasOwnProperty(\"name\"))\r\n\t{\r\n\t\tinputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, \"\");\r\n\t\tif(inputSchema.name !== \"\")\r\n\t\t\troot[inputSchema.name] = inputData;\r\n\t}\r\n\t//endregion\r\n\r\n\t//region Getting next ASN.1 block for comparition\r\n\tif(inputSchema.idBlock.isConstructed === true)\r\n\t{\r\n\t\tlet admission = 0;\r\n\t\tlet result = { verified: false };\r\n\r\n\t\tlet maxLength = inputSchema.valueBlock.value.length;\r\n\r\n\t\tif(maxLength > 0)\r\n\t\t{\r\n\t\t\tif(inputSchema.valueBlock.value[0] instanceof Repeated)\r\n\t\t\t\tmaxLength = inputData.valueBlock.value.length;\r\n\t\t}\r\n\r\n\t\t//region Special case when constructive value has no elements\r\n\t\tif(maxLength === 0)\r\n\t\t{\r\n\t\t\treturn {\r\n\t\t\t\tverified: true,\r\n\t\t\t\tresult: root\r\n\t\t\t};\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\t//region Special case when \"inputData\" has no values and \"inputSchema\" has all optional values\r\n\t\tif((inputData.valueBlock.value.length === 0) &&\r\n\t\t\t(inputSchema.valueBlock.value.length !== 0))\r\n\t\t{\r\n\t\t\tlet _optional = true;\r\n\r\n\t\t\tfor(let i = 0; i < inputSchema.valueBlock.value.length; i++)\r\n\t\t\t\t_optional = _optional && (inputSchema.valueBlock.value[i].optional || false);\r\n\r\n\t\t\tif(_optional === true)\r\n\t\t\t{\r\n\t\t\t\treturn {\r\n\t\t\t\t\tverified: true,\r\n\t\t\t\t\tresult: root\r\n\t\t\t\t};\r\n\t\t\t}\r\n\r\n\t\t\t//region Delete early added name of block\r\n\t\t\tif(inputSchema.hasOwnProperty(\"name\"))\r\n\t\t\t{\r\n\t\t\t\tinputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, \"\");\r\n\t\t\t\tif(inputSchema.name !== \"\")\r\n\t\t\t\t\tdelete root[inputSchema.name];\r\n\t\t\t}\r\n\t\t\t//endregion\r\n\r\n\t\t\troot.error = \"Inconsistent object length\";\r\n\r\n\t\t\treturn {\r\n\t\t\t\tverified: false,\r\n\t\t\t\tresult: root\r\n\t\t\t};\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\tfor(let i = 0; i < maxLength; i++)\r\n\t\t{\r\n\t\t\t//region Special case when there is an \"optional\" element of ASN.1 schema at the end\r\n\t\t\tif((i - admission) >= inputData.valueBlock.value.length)\r\n\t\t\t{\r\n\t\t\t\tif(inputSchema.valueBlock.value[i].optional === false)\r\n\t\t\t\t{\r\n\t\t\t\t\tconst _result = {\r\n\t\t\t\t\t\tverified: false,\r\n\t\t\t\t\t\tresult: root\r\n\t\t\t\t\t};\r\n\r\n\t\t\t\t\troot.error = \"Inconsistent length between ASN.1 data and schema\";\r\n\r\n\t\t\t\t\t//region Delete early added name of block\r\n\t\t\t\t\tif(inputSchema.hasOwnProperty(\"name\"))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tinputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, \"\");\r\n\t\t\t\t\t\tif(inputSchema.name !== \"\")\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tdelete root[inputSchema.name];\r\n\t\t\t\t\t\t\t_result.name = inputSchema.name;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//endregion\r\n\r\n\t\t\t\t\treturn _result;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t//endregion\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\t//region Special case for Repeated type of ASN.1 schema element\r\n\t\t\t\tif(inputSchema.valueBlock.value[0] instanceof Repeated)\r\n\t\t\t\t{\r\n\t\t\t\t\tresult = compareSchema(root, inputData.valueBlock.value[i], inputSchema.valueBlock.value[0].value);\r\n\t\t\t\t\tif(result.verified === false)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(inputSchema.valueBlock.value[0].optional === true)\r\n\t\t\t\t\t\t\tadmission++;\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t//region Delete early added name of block\r\n\t\t\t\t\t\t\tif(inputSchema.hasOwnProperty(\"name\"))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tinputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, \"\");\r\n\t\t\t\t\t\t\t\tif(inputSchema.name !== \"\")\r\n\t\t\t\t\t\t\t\t\tdelete root[inputSchema.name];\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t//endregion\r\n\r\n\t\t\t\t\t\t\treturn result;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif((\"name\" in inputSchema.valueBlock.value[0]) && (inputSchema.valueBlock.value[0].name.length > 0))\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tlet arrayRoot = {};\r\n\r\n\t\t\t\t\t\tif((\"local\" in inputSchema.valueBlock.value[0]) && (inputSchema.valueBlock.value[0].local === true))\r\n\t\t\t\t\t\t\tarrayRoot = inputData;\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\tarrayRoot = root;\r\n\r\n\t\t\t\t\t\tif(typeof arrayRoot[inputSchema.valueBlock.value[0].name] === \"undefined\")\r\n\t\t\t\t\t\t\tarrayRoot[inputSchema.valueBlock.value[0].name] = [];\r\n\r\n\t\t\t\t\t\tarrayRoot[inputSchema.valueBlock.value[0].name].push(inputData.valueBlock.value[i]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t//endregion\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tresult = compareSchema(root, inputData.valueBlock.value[i - admission], inputSchema.valueBlock.value[i]);\r\n\t\t\t\t\tif(result.verified === false)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif(inputSchema.valueBlock.value[i].optional === true)\r\n\t\t\t\t\t\t\tadmission++;\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t//region Delete early added name of block\r\n\t\t\t\t\t\t\tif(inputSchema.hasOwnProperty(\"name\"))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\tinputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, \"\");\r\n\t\t\t\t\t\t\t\tif(inputSchema.name !== \"\")\r\n\t\t\t\t\t\t\t\t\tdelete root[inputSchema.name];\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t//endregion\r\n\r\n\t\t\t\t\t\t\treturn result;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif(result.verified === false) // The situation may take place if last element is \"optional\" and verification failed\r\n\t\t{\r\n\t\t\tconst _result = {\r\n\t\t\t\tverified: false,\r\n\t\t\t\tresult: root\r\n\t\t\t};\r\n\r\n\t\t\t//region Delete early added name of block\r\n\t\t\tif(inputSchema.hasOwnProperty(\"name\"))\r\n\t\t\t{\r\n\t\t\t\tinputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, \"\");\r\n\t\t\t\tif(inputSchema.name !== \"\")\r\n\t\t\t\t{\r\n\t\t\t\t\tdelete root[inputSchema.name];\r\n\t\t\t\t\t_result.name = inputSchema.name;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t//endregion\r\n\r\n\t\t\treturn _result;\r\n\t\t}\r\n\r\n\t\treturn {\r\n\t\t\tverified: true,\r\n\t\t\tresult: root\r\n\t\t};\r\n\t}\r\n\t//endregion\r\n\t//region Ability to parse internal value for primitive-encoded value (value of OctetString, for example)\r\n\tif((\"primitiveSchema\" in inputSchema) &&\r\n\t\t(\"valueHex\" in inputData.valueBlock))\r\n\t{\r\n\t\t//region Decoding of raw ASN.1 data\r\n\t\tconst asn1 = fromBER(inputData.valueBlock.valueHex);\r\n\t\tif(asn1.offset === (-1))\r\n\t\t{\r\n\t\t\tconst _result = {\r\n\t\t\t\tverified: false,\r\n\t\t\t\tresult: asn1.result\r\n\t\t\t};\r\n\r\n\t\t\t//region Delete early added name of block\r\n\t\t\tif(inputSchema.hasOwnProperty(\"name\"))\r\n\t\t\t{\r\n\t\t\t\tinputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, \"\");\r\n\t\t\t\tif(inputSchema.name !== \"\")\r\n\t\t\t\t{\r\n\t\t\t\t\tdelete root[inputSchema.name];\r\n\t\t\t\t\t_result.name = inputSchema.name;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t//endregion\r\n\r\n\t\t\treturn _result;\r\n\t\t}\r\n\t\t//endregion\r\n\r\n\t\treturn compareSchema(root, asn1.result, inputSchema.primitiveSchema);\r\n\t}\r\n\r\n\treturn {\r\n\t\tverified: true,\r\n\t\tresult: root\r\n\t};\r\n\t//endregion\r\n}\r\n//**************************************************************************************\r\n//noinspection JSUnusedGlobalSymbols\r\n/**\r\n * ASN.1 schema verification for ArrayBuffer data\r\n * @param {!ArrayBuffer} inputBuffer Input BER-encoded ASN.1 data\r\n * @param {!Object} inputSchema Input ASN.1 schema to verify against to\r\n * @return {{verified: boolean}|{verified:boolean, result: Object}}\r\n */\r\nexport function verifySchema(inputBuffer, inputSchema)\r\n{\r\n\t//region Initial check\r\n\tif((inputSchema instanceof Object) === false)\r\n\t{\r\n\t\treturn {\r\n\t\t\tverified: false,\r\n\t\t\tresult: { error: \"Wrong ASN.1 schema type\" }\r\n\t\t};\r\n\t}\r\n\t//endregion\r\n\r\n\t//region Decoding of raw ASN.1 data\r\n\tconst asn1 = fromBER(inputBuffer);\r\n\tif(asn1.offset === (-1))\r\n\t{\r\n\t\treturn {\r\n\t\t\tverified: false,\r\n\t\t\tresult: asn1.result\r\n\t\t};\r\n\t}\r\n\t//endregion\r\n\r\n\t//region Compare ASN.1 struct with input schema\r\n\treturn compareSchema(asn1.result, asn1.result, inputSchema);\r\n\t//endregion\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n//region Major function converting JSON to ASN.1 objects\r\n//**************************************************************************************\r\n//noinspection JSUnusedGlobalSymbols\r\n/**\r\n * Converting from JSON to ASN.1 objects\r\n * @param {string|Object} json JSON string or object to convert to ASN.1 objects\r\n */\r\nexport function fromJSON(json)\r\n{\r\n\t// TODO Implement\r\n}\r\n//**************************************************************************************\r\n//endregion\r\n//**************************************************************************************\r\n"],"file":"asn1.js"}