From e70f108675e365811a38a7af29f8491bfabfb179 Mon Sep 17 00:00:00 2001 From: Artem Vasilev Date: Sun, 14 Feb 2021 00:15:27 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=BE=D0=B7=D0=B2=D1=80=D0=B0=D1=82=20?= =?UTF-8?q?=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA=20=D1=81=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=B4=D0=BE=D0=BC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/crypto-pro.d.ts | 7 - dist/crypto-pro.js | 5113 ----------------- dist/crypto-pro.js.map | 1 - dist/crypto-pro.min.js | 9 - dist/crypto-pro.min.js.map | 1 - examples/angular/browserslist | 23 +- lib/crypto-pro.d.ts | 5 - lib/crypto-pro.js | 4705 --------------- lib/crypto-pro.js.map | 1 - package-lock.json | 2 +- package.json | 30 +- src/{crypto-pro.ts => crypto-pro-custom.ts} | 0 .../_extractMeaningfulErrorMessage.test.ts | 14 +- src/helpers/_extractMeaningfulErrorMessage.ts | 4 +- tsconfig.json | 2 +- 15 files changed, 43 insertions(+), 9874 deletions(-) delete mode 100644 dist/crypto-pro.d.ts delete mode 100644 dist/crypto-pro.js delete mode 100644 dist/crypto-pro.js.map delete mode 100644 dist/crypto-pro.min.js delete mode 100644 dist/crypto-pro.min.js.map delete mode 100644 lib/crypto-pro.d.ts delete mode 100644 lib/crypto-pro.js delete mode 100644 lib/crypto-pro.js.map rename src/{crypto-pro.ts => crypto-pro-custom.ts} (100%) mode change 100755 => 100644 diff --git a/dist/crypto-pro.d.ts b/dist/crypto-pro.d.ts deleted file mode 100644 index 9152d26..0000000 --- a/dist/crypto-pro.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -// Type definitions for crypto-pro 2.2.0 -// Project: crypto-pro -// Definitions by: Vitalii Goma https://github.com/vgoma - -export as namespace cryptoPro; - -export * from './api'; diff --git a/dist/crypto-pro.js b/dist/crypto-pro.js deleted file mode 100644 index f4c854f..0000000 --- a/dist/crypto-pro.js +++ /dev/null @@ -1,5113 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define("cryptoPro", [], factory); - else if(typeof exports === 'object') - exports["cryptoPro"] = factory(); - else - root["cryptoPro"] = factory(); -})(window, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./crypto-pro.ts"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "../node_modules/base64-js/index.js": -/*!******************************************!*\ - !*** ../node_modules/base64-js/index.js ***! - \******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.byteLength = byteLength -exports.toByteArray = toByteArray -exports.fromByteArray = fromByteArray - -var lookup = [] -var revLookup = [] -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array - -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' -for (var i = 0, len = code.length; i < len; ++i) { - lookup[i] = code[i] - revLookup[code.charCodeAt(i)] = i -} - -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62 -revLookup['_'.charCodeAt(0)] = 63 - -function getLens (b64) { - var len = b64.length - - if (len % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4') - } - - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('=') - if (validLen === -1) validLen = len - - var placeHoldersLen = validLen === len - ? 0 - : 4 - (validLen % 4) - - return [validLen, placeHoldersLen] -} - -// base64 is 4/3 + up to two characters of the original data -function byteLength (b64) { - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function _byteLength (b64, validLen, placeHoldersLen) { - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function toByteArray (b64) { - var tmp - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) - - var curByte = 0 - - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 - ? validLen - 4 - : validLen - - var i - for (i = 0; i < len; i += 4) { - tmp = - (revLookup[b64.charCodeAt(i)] << 18) | - (revLookup[b64.charCodeAt(i + 1)] << 12) | - (revLookup[b64.charCodeAt(i + 2)] << 6) | - revLookup[b64.charCodeAt(i + 3)] - arr[curByte++] = (tmp >> 16) & 0xFF - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 2) { - tmp = - (revLookup[b64.charCodeAt(i)] << 2) | - (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 1) { - tmp = - (revLookup[b64.charCodeAt(i)] << 10) | - (revLookup[b64.charCodeAt(i + 1)] << 4) | - (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - return arr -} - -function tripletToBase64 (num) { - return lookup[num >> 18 & 0x3F] + - lookup[num >> 12 & 0x3F] + - lookup[num >> 6 & 0x3F] + - lookup[num & 0x3F] -} - -function encodeChunk (uint8, start, end) { - var tmp - var output = [] - for (var i = start; i < end; i += 3) { - tmp = - ((uint8[i] << 16) & 0xFF0000) + - ((uint8[i + 1] << 8) & 0xFF00) + - (uint8[i + 2] & 0xFF) - output.push(tripletToBase64(tmp)) - } - return output.join('') -} - -function fromByteArray (uint8) { - var tmp - var len = uint8.length - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - var parts = [] - var maxChunkLength = 16383 // must be multiple of 3 - - // go through the array every three bytes, we'll deal with trailing stuff later - for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { - parts.push(encodeChunk( - uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) - )) - } - - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - parts.push( - lookup[tmp >> 2] + - lookup[(tmp << 4) & 0x3F] + - '==' - ) - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1] - parts.push( - lookup[tmp >> 10] + - lookup[(tmp >> 4) & 0x3F] + - lookup[(tmp << 2) & 0x3F] + - '=' - ) - } - - return parts.join('') -} - - -/***/ }), - -/***/ "../node_modules/buffer/index.js": -/*!***************************************!*\ - !*** ../node_modules/buffer/index.js ***! - \***************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(global) {/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/* eslint-disable no-proto */ - - - -var base64 = __webpack_require__(/*! base64-js */ "../node_modules/base64-js/index.js") -var ieee754 = __webpack_require__(/*! ieee754 */ "../node_modules/ieee754/index.js") -var isArray = __webpack_require__(/*! isarray */ "../node_modules/isarray/index.js") - -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 - -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Use Object implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * Due to various browser bugs, sometimes the Object implementation will be used even - * when the browser supports typed arrays. - * - * Note: - * - * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, - * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. - * - * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. - * - * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of - * incorrect length in some situations. - - * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they - * get the Object implementation, which is slower but behaves correctly. - */ -Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined - ? global.TYPED_ARRAY_SUPPORT - : typedArraySupport() - -/* - * Export kMaxLength after typed array support is determined. - */ -exports.kMaxLength = kMaxLength() - -function typedArraySupport () { - try { - var arr = new Uint8Array(1) - arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }} - return arr.foo() === 42 && // typed array instances can be augmented - typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` - arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` - } catch (e) { - return false - } -} - -function kMaxLength () { - return Buffer.TYPED_ARRAY_SUPPORT - ? 0x7fffffff - : 0x3fffffff -} - -function createBuffer (that, length) { - if (kMaxLength() < length) { - throw new RangeError('Invalid typed array length') - } - if (Buffer.TYPED_ARRAY_SUPPORT) { - // Return an augmented `Uint8Array` instance, for best performance - that = new Uint8Array(length) - that.__proto__ = Buffer.prototype - } else { - // Fallback: Return an object instance of the Buffer class - if (that === null) { - that = new Buffer(length) - } - that.length = length - } - - return that -} - -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ - -function Buffer (arg, encodingOrOffset, length) { - if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { - return new Buffer(arg, encodingOrOffset, length) - } - - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') { - throw new Error( - 'If encoding is specified then the first argument must be a string' - ) - } - return allocUnsafe(this, arg) - } - return from(this, arg, encodingOrOffset, length) -} - -Buffer.poolSize = 8192 // not used by this implementation - -// TODO: Legacy, not needed anymore. Remove in next major version. -Buffer._augment = function (arr) { - arr.__proto__ = Buffer.prototype - return arr -} - -function from (that, value, encodingOrOffset, length) { - if (typeof value === 'number') { - throw new TypeError('"value" argument must not be a number') - } - - if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { - return fromArrayBuffer(that, value, encodingOrOffset, length) - } - - if (typeof value === 'string') { - return fromString(that, value, encodingOrOffset) - } - - return fromObject(that, value) -} - -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ -Buffer.from = function (value, encodingOrOffset, length) { - return from(null, value, encodingOrOffset, length) -} - -if (Buffer.TYPED_ARRAY_SUPPORT) { - Buffer.prototype.__proto__ = Uint8Array.prototype - Buffer.__proto__ = Uint8Array - if (typeof Symbol !== 'undefined' && Symbol.species && - Buffer[Symbol.species] === Buffer) { - // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 - Object.defineProperty(Buffer, Symbol.species, { - value: null, - configurable: true - }) - } -} - -function assertSize (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be a number') - } else if (size < 0) { - throw new RangeError('"size" argument must not be negative') - } -} - -function alloc (that, size, fill, encoding) { - assertSize(size) - if (size <= 0) { - return createBuffer(that, size) - } - if (fill !== undefined) { - // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpretted as a start offset. - return typeof encoding === 'string' - ? createBuffer(that, size).fill(fill, encoding) - : createBuffer(that, size).fill(fill) - } - return createBuffer(that, size) -} - -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ -Buffer.alloc = function (size, fill, encoding) { - return alloc(null, size, fill, encoding) -} - -function allocUnsafe (that, size) { - assertSize(size) - that = createBuffer(that, size < 0 ? 0 : checked(size) | 0) - if (!Buffer.TYPED_ARRAY_SUPPORT) { - for (var i = 0; i < size; ++i) { - that[i] = 0 - } - } - return that -} - -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ -Buffer.allocUnsafe = function (size) { - return allocUnsafe(null, size) -} -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ -Buffer.allocUnsafeSlow = function (size) { - return allocUnsafe(null, size) -} - -function fromString (that, string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' - } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('"encoding" must be a valid string encoding') - } - - var length = byteLength(string, encoding) | 0 - that = createBuffer(that, length) - - var actual = that.write(string, encoding) - - if (actual !== length) { - // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - that = that.slice(0, actual) - } - - return that -} - -function fromArrayLike (that, array) { - var length = array.length < 0 ? 0 : checked(array.length) | 0 - that = createBuffer(that, length) - for (var i = 0; i < length; i += 1) { - that[i] = array[i] & 255 - } - return that -} - -function fromArrayBuffer (that, array, byteOffset, length) { - array.byteLength // this throws if `array` is not a valid ArrayBuffer - - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('\'offset\' is out of bounds') - } - - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('\'length\' is out of bounds') - } - - if (byteOffset === undefined && length === undefined) { - array = new Uint8Array(array) - } else if (length === undefined) { - array = new Uint8Array(array, byteOffset) - } else { - array = new Uint8Array(array, byteOffset, length) - } - - if (Buffer.TYPED_ARRAY_SUPPORT) { - // Return an augmented `Uint8Array` instance, for best performance - that = array - that.__proto__ = Buffer.prototype - } else { - // Fallback: Return an object instance of the Buffer class - that = fromArrayLike(that, array) - } - return that -} - -function fromObject (that, obj) { - if (Buffer.isBuffer(obj)) { - var len = checked(obj.length) | 0 - that = createBuffer(that, len) - - if (that.length === 0) { - return that - } - - obj.copy(that, 0, 0, len) - return that - } - - if (obj) { - if ((typeof ArrayBuffer !== 'undefined' && - obj.buffer instanceof ArrayBuffer) || 'length' in obj) { - if (typeof obj.length !== 'number' || isnan(obj.length)) { - return createBuffer(that, 0) - } - return fromArrayLike(that, obj) - } - - if (obj.type === 'Buffer' && isArray(obj.data)) { - return fromArrayLike(that, obj.data) - } - } - - throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') -} - -function checked (length) { - // Note: cannot use `length < kMaxLength()` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= kMaxLength()) { - throw new RangeError('Attempt to allocate Buffer larger than maximum ' + - 'size: 0x' + kMaxLength().toString(16) + ' bytes') - } - return length | 0 -} - -function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0 - } - return Buffer.alloc(+length) -} - -Buffer.isBuffer = function isBuffer (b) { - return !!(b != null && b._isBuffer) -} - -Buffer.compare = function compare (a, b) { - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError('Arguments must be Buffers') - } - - if (a === b) return 0 - - var x = a.length - var y = b.length - - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i] - y = b[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -Buffer.isEncoding = function isEncoding (encoding) { - switch (String(encoding).toLowerCase()) { - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true - default: - return false - } -} - -Buffer.concat = function concat (list, length) { - if (!isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - - if (list.length === 0) { - return Buffer.alloc(0) - } - - var i - if (length === undefined) { - length = 0 - for (i = 0; i < list.length; ++i) { - length += list[i].length - } - } - - var buffer = Buffer.allocUnsafe(length) - var pos = 0 - for (i = 0; i < list.length; ++i) { - var buf = list[i] - if (!Buffer.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - buf.copy(buffer, pos) - pos += buf.length - } - return buffer -} - -function byteLength (string, encoding) { - if (Buffer.isBuffer(string)) { - return string.length - } - if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && - (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { - return string.byteLength - } - if (typeof string !== 'string') { - string = '' + string - } - - var len = string.length - if (len === 0) return 0 - - // Use a for loop to avoid recursion - var loweredCase = false - for (;;) { - switch (encoding) { - case 'ascii': - case 'latin1': - case 'binary': - return len - case 'utf8': - case 'utf-8': - case undefined: - return utf8ToBytes(string).length - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2 - case 'hex': - return len >>> 1 - case 'base64': - return base64ToBytes(string).length - default: - if (loweredCase) return utf8ToBytes(string).length // assume utf8 - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} -Buffer.byteLength = byteLength - -function slowToString (encoding, start, end) { - var loweredCase = false - - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) { - start = 0 - } - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) { - return '' - } - - if (end === undefined || end > this.length) { - end = this.length - } - - if (end <= 0) { - return '' - } - - // Force coersion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0 - start >>>= 0 - - if (end <= start) { - return '' - } - - if (!encoding) encoding = 'utf8' - - while (true) { - switch (encoding) { - case 'hex': - return hexSlice(this, start, end) - - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end) - - case 'ascii': - return asciiSlice(this, start, end) - - case 'latin1': - case 'binary': - return latin1Slice(this, start, end) - - case 'base64': - return base64Slice(this, start, end) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() - loweredCase = true - } - } -} - -// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect -// Buffer instances. -Buffer.prototype._isBuffer = true - -function swap (b, n, m) { - var i = b[n] - b[n] = b[m] - b[m] = i -} - -Buffer.prototype.swap16 = function swap16 () { - var len = this.length - if (len % 2 !== 0) { - throw new RangeError('Buffer size must be a multiple of 16-bits') - } - for (var i = 0; i < len; i += 2) { - swap(this, i, i + 1) - } - return this -} - -Buffer.prototype.swap32 = function swap32 () { - var len = this.length - if (len % 4 !== 0) { - throw new RangeError('Buffer size must be a multiple of 32-bits') - } - for (var i = 0; i < len; i += 4) { - swap(this, i, i + 3) - swap(this, i + 1, i + 2) - } - return this -} - -Buffer.prototype.swap64 = function swap64 () { - var len = this.length - if (len % 8 !== 0) { - throw new RangeError('Buffer size must be a multiple of 64-bits') - } - for (var i = 0; i < len; i += 8) { - swap(this, i, i + 7) - swap(this, i + 1, i + 6) - swap(this, i + 2, i + 5) - swap(this, i + 3, i + 4) - } - return this -} - -Buffer.prototype.toString = function toString () { - var length = this.length | 0 - if (length === 0) return '' - if (arguments.length === 0) return utf8Slice(this, 0, length) - return slowToString.apply(this, arguments) -} - -Buffer.prototype.equals = function equals (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return true - return Buffer.compare(this, b) === 0 -} - -Buffer.prototype.inspect = function inspect () { - var str = '' - var max = exports.INSPECT_MAX_BYTES - if (this.length > 0) { - str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') - if (this.length > max) str += ' ... ' - } - return '' -} - -Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { - if (!Buffer.isBuffer(target)) { - throw new TypeError('Argument must be a Buffer') - } - - if (start === undefined) { - start = 0 - } - if (end === undefined) { - end = target ? target.length : 0 - } - if (thisStart === undefined) { - thisStart = 0 - } - if (thisEnd === undefined) { - thisEnd = this.length - } - - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError('out of range index') - } - - if (thisStart >= thisEnd && start >= end) { - return 0 - } - if (thisStart >= thisEnd) { - return -1 - } - if (start >= end) { - return 1 - } - - start >>>= 0 - end >>>= 0 - thisStart >>>= 0 - thisEnd >>>= 0 - - if (this === target) return 0 - - var x = thisEnd - thisStart - var y = end - start - var len = Math.min(x, y) - - var thisCopy = this.slice(thisStart, thisEnd) - var targetCopy = target.slice(start, end) - - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i] - y = targetCopy[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1 - - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset - byteOffset = 0 - } else if (byteOffset > 0x7fffffff) { - byteOffset = 0x7fffffff - } else if (byteOffset < -0x80000000) { - byteOffset = -0x80000000 - } - byteOffset = +byteOffset // Coerce to Number. - if (isNaN(byteOffset)) { - // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : (buffer.length - 1) - } - - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset - if (byteOffset >= buffer.length) { - if (dir) return -1 - else byteOffset = buffer.length - 1 - } else if (byteOffset < 0) { - if (dir) byteOffset = 0 - else return -1 - } - - // Normalize val - if (typeof val === 'string') { - val = Buffer.from(val, encoding) - } - - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) { - return -1 - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir) - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - if (Buffer.TYPED_ARRAY_SUPPORT && - typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) - } - } - return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) - } - - throw new TypeError('val must be string, number or Buffer') -} - -function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - var indexSize = 1 - var arrLength = arr.length - var valLength = val.length - - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase() - if (encoding === 'ucs2' || encoding === 'ucs-2' || - encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) { - return -1 - } - indexSize = 2 - arrLength /= 2 - valLength /= 2 - byteOffset /= 2 - } - } - - function read (buf, i) { - if (indexSize === 1) { - return buf[i] - } else { - return buf.readUInt16BE(i * indexSize) - } - } - - var i - if (dir) { - var foundIndex = -1 - for (i = byteOffset; i < arrLength; i++) { - if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize - } else { - if (foundIndex !== -1) i -= i - foundIndex - foundIndex = -1 - } - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength - for (i = byteOffset; i >= 0; i--) { - var found = true - for (var j = 0; j < valLength; j++) { - if (read(arr, i + j) !== read(val, j)) { - found = false - break - } - } - if (found) return i - } - } - - return -1 -} - -Buffer.prototype.includes = function includes (val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1 -} - -Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true) -} - -Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false) -} - -function hexWrite (buf, string, offset, length) { - offset = Number(offset) || 0 - var remaining = buf.length - offset - if (!length) { - length = remaining - } else { - length = Number(length) - if (length > remaining) { - length = remaining - } - } - - // must be an even number of digits - var strLen = string.length - if (strLen % 2 !== 0) throw new TypeError('Invalid hex string') - - if (length > strLen / 2) { - length = strLen / 2 - } - for (var i = 0; i < length; ++i) { - var parsed = parseInt(string.substr(i * 2, 2), 16) - if (isNaN(parsed)) return i - buf[offset + i] = parsed - } - return i -} - -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) -} - -function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) -} - -function latin1Write (buf, string, offset, length) { - return asciiWrite(buf, string, offset, length) -} - -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) -} - -function ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) -} - -Buffer.prototype.write = function write (string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8' - length = this.length - offset = 0 - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset - length = this.length - offset = 0 - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset | 0 - if (isFinite(length)) { - length = length | 0 - if (encoding === undefined) encoding = 'utf8' - } else { - encoding = length - length = undefined - } - // legacy write(string, encoding, offset, length) - remove in v0.13 - } else { - throw new Error( - 'Buffer.write(string, encoding, offset[, length]) is no longer supported' - ) - } - - var remaining = this.length - offset - if (length === undefined || length > remaining) length = remaining - - if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { - throw new RangeError('Attempt to write outside buffer bounds') - } - - if (!encoding) encoding = 'utf8' - - var loweredCase = false - for (;;) { - switch (encoding) { - case 'hex': - return hexWrite(this, string, offset, length) - - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length) - - case 'ascii': - return asciiWrite(this, string, offset, length) - - case 'latin1': - case 'binary': - return latin1Write(this, string, offset, length) - - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} - -Buffer.prototype.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } -} - -function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) - } -} - -function utf8Slice (buf, start, end) { - end = Math.min(buf.length, end) - var res = [] - - var i = start - while (i < end) { - var firstByte = buf[i] - var codePoint = null - var bytesPerSequence = (firstByte > 0xEF) ? 4 - : (firstByte > 0xDF) ? 3 - : (firstByte > 0xBF) ? 2 - : 1 - - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint - - switch (bytesPerSequence) { - case 1: - if (firstByte < 0x80) { - codePoint = firstByte - } - break - case 2: - secondByte = buf[i + 1] - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) - if (tempCodePoint > 0x7F) { - codePoint = tempCodePoint - } - } - break - case 3: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { - codePoint = tempCodePoint - } - } - break - case 4: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - fourthByte = buf[i + 3] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { - codePoint = tempCodePoint - } - } - } - } - - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD - bytesPerSequence = 1 - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000 - res.push(codePoint >>> 10 & 0x3FF | 0xD800) - codePoint = 0xDC00 | codePoint & 0x3FF - } - - res.push(codePoint) - i += bytesPerSequence - } - - return decodeCodePointsArray(res) -} - -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -var MAX_ARGUMENTS_LENGTH = 0x1000 - -function decodeCodePointsArray (codePoints) { - var len = codePoints.length - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - } - - // Decode in chunks to avoid "call stack size exceeded". - var res = '' - var i = 0 - while (i < len) { - res += String.fromCharCode.apply( - String, - codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) - ) - } - return res -} - -function asciiSlice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i] & 0x7F) - } - return ret -} - -function latin1Slice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i]) - } - return ret -} - -function hexSlice (buf, start, end) { - var len = buf.length - - if (!start || start < 0) start = 0 - if (!end || end < 0 || end > len) end = len - - var out = '' - for (var i = start; i < end; ++i) { - out += toHex(buf[i]) - } - return out -} - -function utf16leSlice (buf, start, end) { - var bytes = buf.slice(start, end) - var res = '' - for (var i = 0; i < bytes.length; i += 2) { - res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) - } - return res -} - -Buffer.prototype.slice = function slice (start, end) { - var len = this.length - start = ~~start - end = end === undefined ? len : ~~end - - if (start < 0) { - start += len - if (start < 0) start = 0 - } else if (start > len) { - start = len - } - - if (end < 0) { - end += len - if (end < 0) end = 0 - } else if (end > len) { - end = len - } - - if (end < start) end = start - - var newBuf - if (Buffer.TYPED_ARRAY_SUPPORT) { - newBuf = this.subarray(start, end) - newBuf.__proto__ = Buffer.prototype - } else { - var sliceLen = end - start - newBuf = new Buffer(sliceLen, undefined) - for (var i = 0; i < sliceLen; ++i) { - newBuf[i] = this[i + start] - } - } - - return newBuf -} - -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ -function checkOffset (offset, ext, length) { - if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') -} - -Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - - return val -} - -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - checkOffset(offset, byteLength, this.length) - } - - var val = this[offset + --byteLength] - var mul = 1 - while (byteLength > 0 && (mul *= 0x100)) { - val += this[offset + --byteLength] * mul - } - - return val -} - -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] -} - -Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - return this[offset] | (this[offset + 1] << 8) -} - -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] -} - -Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return ((this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16)) + - (this[offset + 3] * 0x1000000) -} - -Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] * 0x1000000) + - ((this[offset + 1] << 16) | - (this[offset + 2] << 8) | - this[offset + 3]) -} - -Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var i = byteLength - var mul = 1 - var val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { - if (!noAssert) checkOffset(offset, 1, this.length) - if (!(this[offset] & 0x80)) return (this[offset]) - return ((0xff - this[offset] + 1) * -1) -} - -Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset] | (this[offset + 1] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset + 1] | (this[offset] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) -} - -Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) -} - -Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, true, 23, 4) -} - -Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, false, 23, 4) -} - -Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, true, 52, 8) -} - -Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, false, 52, 8) -} - -function checkInt (buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') - if (offset + ext > buf.length) throw new RangeError('Index out of range') -} - -Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var mul = 1 - var i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var i = byteLength - 1 - var mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) - if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) - this[offset] = (value & 0xff) - return offset + 1 -} - -function objectWriteUInt16 (buf, value, offset, littleEndian) { - if (value < 0) value = 0xffff + value + 1 - for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { - buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> - (littleEndian ? i : 1 - i) * 8 - } -} - -Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - } else { - objectWriteUInt16(this, value, offset, true) - } - return offset + 2 -} - -Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - } else { - objectWriteUInt16(this, value, offset, false) - } - return offset + 2 -} - -function objectWriteUInt32 (buf, value, offset, littleEndian) { - if (value < 0) value = 0xffffffff + value + 1 - for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { - buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff - } -} - -Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset + 3] = (value >>> 24) - this[offset + 2] = (value >>> 16) - this[offset + 1] = (value >>> 8) - this[offset] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, true) - } - return offset + 4 -} - -Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, false) - } - return offset + 4 -} - -Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = 0 - var mul = 1 - var sub = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = byteLength - 1 - var mul = 1 - var sub = 0 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) - if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) - if (value < 0) value = 0xff + value + 1 - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - } else { - objectWriteUInt16(this, value, offset, true) - } - return offset + 2 -} - -Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - } else { - objectWriteUInt16(this, value, offset, false) - } - return offset + 2 -} - -Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - this[offset + 2] = (value >>> 16) - this[offset + 3] = (value >>> 24) - } else { - objectWriteUInt32(this, value, offset, true) - } - return offset + 4 -} - -Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (value < 0) value = 0xffffffff + value + 1 - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, false) - } - return offset + 4 -} - -function checkIEEE754 (buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range') - if (offset < 0) throw new RangeError('Index out of range') -} - -function writeFloat (buf, value, offset, littleEndian, noAssert) { - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) - } - ieee754.write(buf, value, offset, littleEndian, 23, 4) - return offset + 4 -} - -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) -} - -function writeDouble (buf, value, offset, littleEndian, noAssert) { - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) - } - ieee754.write(buf, value, offset, littleEndian, 52, 8) - return offset + 8 -} - -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) -} - -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!start) start = 0 - if (!end && end !== 0) end = this.length - if (targetStart >= target.length) targetStart = target.length - if (!targetStart) targetStart = 0 - if (end > 0 && end < start) end = start - - // Copy 0 bytes; we're done - if (end === start) return 0 - if (target.length === 0 || this.length === 0) return 0 - - // Fatal error conditions - if (targetStart < 0) { - throw new RangeError('targetStart out of bounds') - } - if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') - if (end < 0) throw new RangeError('sourceEnd out of bounds') - - // Are we oob? - if (end > this.length) end = this.length - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start - } - - var len = end - start - var i - - if (this === target && start < targetStart && targetStart < end) { - // descending copy from end - for (i = len - 1; i >= 0; --i) { - target[i + targetStart] = this[i + start] - } - } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { - // ascending copy from start - for (i = 0; i < len; ++i) { - target[i + targetStart] = this[i + start] - } - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, start + len), - targetStart - ) - } - - return len -} - -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill (val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start - start = 0 - end = this.length - } else if (typeof end === 'string') { - encoding = end - end = this.length - } - if (val.length === 1) { - var code = val.charCodeAt(0) - if (code < 256) { - val = code - } - } - if (encoding !== undefined && typeof encoding !== 'string') { - throw new TypeError('encoding must be a string') - } - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - } else if (typeof val === 'number') { - val = val & 255 - } - - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError('Out of range index') - } - - if (end <= start) { - return this - } - - start = start >>> 0 - end = end === undefined ? this.length : end >>> 0 - - if (!val) val = 0 - - var i - if (typeof val === 'number') { - for (i = start; i < end; ++i) { - this[i] = val - } - } else { - var bytes = Buffer.isBuffer(val) - ? val - : utf8ToBytes(new Buffer(val, encoding).toString()) - var len = bytes.length - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len] - } - } - - return this -} - -// HELPER FUNCTIONS -// ================ - -var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g - -function base64clean (str) { - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = stringtrim(str).replace(INVALID_BASE64_RE, '') - // Node converts strings with length < 2 to '' - if (str.length < 2) return '' - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while (str.length % 4 !== 0) { - str = str + '=' - } - return str -} - -function stringtrim (str) { - if (str.trim) return str.trim() - return str.replace(/^\s+|\s+$/g, '') -} - -function toHex (n) { - if (n < 16) return '0' + n.toString(16) - return n.toString(16) -} - -function utf8ToBytes (string, units) { - units = units || Infinity - var codePoint - var length = string.length - var leadSurrogate = null - var bytes = [] - - for (var i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i) - - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } - - // valid lead - leadSurrogate = codePoint - - continue - } - - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = codePoint - continue - } - - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 - } else if (leadSurrogate) { - // valid bmp char, but last char was a lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - } - - leadSurrogate = null - - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break - bytes.push(codePoint) - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break - bytes.push( - codePoint >> 0x6 | 0xC0, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break - bytes.push( - codePoint >> 0xC | 0xE0, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break - bytes.push( - codePoint >> 0x12 | 0xF0, - codePoint >> 0xC & 0x3F | 0x80, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else { - throw new Error('Invalid code point') - } - } - - return bytes -} - -function asciiToBytes (str) { - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - // Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF) - } - return byteArray -} - -function utf16leToBytes (str, units) { - var c, hi, lo - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) break - - c = str.charCodeAt(i) - hi = c >> 8 - lo = c % 256 - byteArray.push(lo) - byteArray.push(hi) - } - - return byteArray -} - -function base64ToBytes (str) { - return base64.toByteArray(base64clean(str)) -} - -function blitBuffer (src, dst, offset, length) { - for (var i = 0; i < length; ++i) { - if ((i + offset >= dst.length) || (i >= src.length)) break - dst[i + offset] = src[i] - } - return i -} - -function isnan (val) { - return val !== val // eslint-disable-line no-self-compare -} - -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "../node_modules/webpack/buildin/global.js"))) - -/***/ }), - -/***/ "../node_modules/ieee754/index.js": -/*!****************************************!*\ - !*** ../node_modules/ieee754/index.js ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -exports.read = function (buffer, offset, isLE, mLen, nBytes) { - var e, m - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var nBits = -7 - var i = isLE ? (nBytes - 1) : 0 - var d = isLE ? -1 : 1 - var s = buffer[offset + i] - - i += d - - e = s & ((1 << (-nBits)) - 1) - s >>= (-nBits) - nBits += eLen - for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - m = e & ((1 << (-nBits)) - 1) - e >>= (-nBits) - nBits += mLen - for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - if (e === 0) { - e = 1 - eBias - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity) - } else { - m = m + Math.pow(2, mLen) - e = e - eBias - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen) -} - -exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) - var i = isLE ? 0 : (nBytes - 1) - var d = isLE ? 1 : -1 - var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 - - value = Math.abs(value) - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0 - e = eMax - } else { - e = Math.floor(Math.log(value) / Math.LN2) - if (value * (c = Math.pow(2, -e)) < 1) { - e-- - c *= 2 - } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) - } - if (value * c >= 2) { - e++ - c /= 2 - } - - if (e + eBias >= eMax) { - m = 0 - e = eMax - } else if (e + eBias >= 1) { - m = ((value * c) - 1) * Math.pow(2, mLen) - e = e + eBias - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) - e = 0 - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} - - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} - - buffer[offset + i - d] |= s * 128 -} - - -/***/ }), - -/***/ "../node_modules/isarray/index.js": -/*!****************************************!*\ - !*** ../node_modules/isarray/index.js ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -var toString = {}.toString; - -module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; -}; - - -/***/ }), - -/***/ "../node_modules/webpack/buildin/global.js": -/*!*************************************************!*\ - !*** ../node_modules/webpack/buildin/global.js ***! - \*************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -var g; - -// This works in non-strict mode -g = (function() { - return this; -})(); - -try { - // This works if eval is allowed (see CSP) - g = g || new Function("return this")(); -} catch (e) { - // This works if the window reference is available - if (typeof window === "object") g = window; -} - -// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} - -module.exports = g; - - -/***/ }), - -/***/ "./api/certificate/certificate.ts": -/*!****************************************!*\ - !*** ./api/certificate/certificate.ts ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var constants_1 = __webpack_require__(/*! ../../constants */ "./constants/index.ts"); -var exportBase64_1 = __webpack_require__(/*! ./exportBase64 */ "./api/certificate/exportBase64.ts"); -var getAlgorithm_1 = __webpack_require__(/*! ./getAlgorithm */ "./api/certificate/getAlgorithm.ts"); -var getCadesProp_1 = __webpack_require__(/*! ./getCadesProp */ "./api/certificate/getCadesProp.ts"); -var getDecodedExtendedKeyUsage_1 = __webpack_require__(/*! ./getDecodedExtendedKeyUsage */ "./api/certificate/getDecodedExtendedKeyUsage.ts"); -var getExtendedKeyUsage_1 = __webpack_require__(/*! ./getExtendedKeyUsage */ "./api/certificate/getExtendedKeyUsage.ts"); -var getInfo_1 = __webpack_require__(/*! ./getInfo */ "./api/certificate/getInfo.ts"); -var hasExtendedKeyUsage_1 = __webpack_require__(/*! ./hasExtendedKeyUsage */ "./api/certificate/hasExtendedKeyUsage.ts"); -var isValid_1 = __webpack_require__(/*! ./isValid */ "./api/certificate/isValid.ts"); -var Certificate = /** @class */ (function () { - function Certificate(_cadesCertificate, name, issuerName, subjectName, thumbprint, validFrom, validTo) { - this._cadesCertificate = _cadesCertificate; - this.name = name; - this.issuerName = issuerName; - this.subjectName = subjectName; - this.thumbprint = thumbprint; - this.validFrom = validFrom; - this.validTo = validTo; - } - Certificate.prototype.getOwnerInfo = function () { - return getInfo_1.getInfo.call(this, constants_1.SUBJECT_TAGS_TRANSLATIONS, 'SubjectName'); - }; - Certificate.prototype.getIssuerInfo = function () { - return getInfo_1.getInfo.call(this, constants_1.ISSUER_TAGS_TRANSLATIONS, 'IssuerName'); - }; - Certificate.prototype.getExtendedKeyUsage = function () { - return getExtendedKeyUsage_1.getExtendedKeyUsage.call(this); - }; - Certificate.prototype.getDecodedExtendedKeyUsage = function () { - return getDecodedExtendedKeyUsage_1.getDecodedExtendedKeyUsage.call(this); - }; - Certificate.prototype.getAlgorithm = function () { - return getAlgorithm_1.getAlgorithm.call(this); - }; - Certificate.prototype.getCadesProp = function (propName) { - return getCadesProp_1.getCadesProp.call(this, propName); - }; - Certificate.prototype.isValid = function () { - return isValid_1.isValid.call(this); - }; - Certificate.prototype.exportBase64 = function () { - return exportBase64_1.exportBase64.call(this); - }; - Certificate.prototype.hasExtendedKeyUsage = function (oids) { - return hasExtendedKeyUsage_1.hasExtendedKeyUsage.call(this, oids); - }; - return Certificate; -}()); -exports.Certificate = Certificate; - - -/***/ }), - -/***/ "./api/certificate/exportBase64.ts": -/*!*****************************************!*\ - !*** ./api/certificate/exportBase64.ts ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Экспортирует сертификат в формате base64 - * - * @returns сертификат в формате base64 - */ -exports.exportBase64 = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - var cadesCertificate = this._cadesCertificate; - return eval(_generateCadesFn_1._generateCadesFn(function exportBase64() { - var base64; - try { - base64 = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.Export(0); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при экспорте сертификата'); - } - return base64; - })); -}); - - -/***/ }), - -/***/ "./api/certificate/getAlgorithm.ts": -/*!*****************************************!*\ - !*** ./api/certificate/getAlgorithm.ts ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Возвращает информацию об алгоритме сертификата - * - * @returns информацию об алгоритме и его OID'е - */ -exports.getAlgorithm = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - var cadesCertificate = this._cadesCertificate; - return eval(_generateCadesFn_1._generateCadesFn(function getAlgorithm() { - var algorithmInfo = { - algorithm: null, - oid: null, - }; - var cadesPublicKey; - try { - cadesPublicKey = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.PublicKey(); - cadesPublicKey = _generateCadesFn_1.__cadesAsyncToken__ + cadesPublicKey.Algorithm; - algorithmInfo.algorithm = _generateCadesFn_1.__cadesAsyncToken__ + cadesPublicKey.FriendlyName; - algorithmInfo.oid = _generateCadesFn_1.__cadesAsyncToken__ + cadesPublicKey.Value; - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при получении алгоритма'); - } - return algorithmInfo; - })); -}); - - -/***/ }), - -/***/ "./api/certificate/getCadesProp.ts": -/*!*****************************************!*\ - !*** ./api/certificate/getCadesProp.ts ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Возвращает указанное внутренее свойство у сертификата в формате Cades - * - * @param propName = наименование свойства - * @returns значение запрошенного свойства - */ -exports.getCadesProp = _afterPluginsLoaded_1._afterPluginsLoaded(function (propName) { - var cadesCertificate = this._cadesCertificate; - return eval(_generateCadesFn_1._generateCadesFn(function getCadesProp() { - var propertyValue; - try { - propertyValue = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate[propName]; - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при обращении к свойству сертификата'); - } - return propertyValue; - })); -}); - - -/***/ }), - -/***/ "./api/certificate/getDecodedExtendedKeyUsage.ts": -/*!*******************************************************!*\ - !*** ./api/certificate/getDecodedExtendedKeyUsage.ts ***! - \*******************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; - } - return t; - }; - return __assign.apply(this, arguments); -}; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var constants_1 = __webpack_require__(/*! ../../constants */ "./constants/index.ts"); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -/** - * Возвращает расшифрованные ОИД'ы сертификата - * - * @returns словарь расшифрованных ОИД'ов - */ -exports.getDecodedExtendedKeyUsage = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - return __awaiter(this, void 0, void 0, function () { - var certificateOids; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.getExtendedKeyUsage()]; - case 1: - certificateOids = _a.sent(); - return [2 /*return*/, certificateOids.reduce(function (decodedOids, oidCode) { - var _a; - return (__assign(__assign({}, decodedOids), (_a = {}, _a[oidCode] = constants_1.OIDS_DICTIONARY[oidCode] || null, _a))); - }, {})]; - } - }); - }); -}); - - -/***/ }), - -/***/ "./api/certificate/getExtendedKeyUsage.ts": -/*!************************************************!*\ - !*** ./api/certificate/getExtendedKeyUsage.ts ***! - \************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Возвращает ОИД'ы сертификата - * - * @returns список ОИД'ов - */ -exports.getExtendedKeyUsage = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - var cadesCertificate = this._cadesCertificate; - return eval(_generateCadesFn_1._generateCadesFn(function getExtendedKeyUsage() { - var OIDS = []; - var count; - try { - count = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage(); - count = _generateCadesFn_1.__cadesAsyncToken__ + count.EKUs; - count = _generateCadesFn_1.__cadesAsyncToken__ + count.Count; - if (count > 0) { - while (count > 0) { - var cadesExtendedKeyUsage = void 0; - cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage(); - cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesExtendedKeyUsage.EKUs; - cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesExtendedKeyUsage.Item(count); - cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesExtendedKeyUsage.OID; - OIDS.push(cadesExtendedKeyUsage); - count--; - } - } - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || "Ошибка при получении ОИД'ов"); - } - return OIDS; - })); -}); - - -/***/ }), - -/***/ "./api/certificate/getInfo.ts": -/*!************************************!*\ - !*** ./api/certificate/getInfo.ts ***! - \************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _parseCertInfo_1 = __webpack_require__(/*! ../../helpers/_parseCertInfo */ "./helpers/_parseCertInfo.ts"); -var getCadesProp_1 = __webpack_require__(/*! ./getCadesProp */ "./api/certificate/getCadesProp.ts"); -/** - * Возвращает расшифрованную информацию о сертификате из указанного свойства по тэгам - * - * @param tags = словарь - * @param entitiesPath = путь к разбираемой сущности - * @returns расшифрованная информация по отдельным тэгам - */ -exports.getInfo = _afterPluginsLoaded_1._afterPluginsLoaded(function (tags, entitiesPath) { - return __awaiter(this, void 0, void 0, function () { - var entities, error_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, getCadesProp_1.getCadesProp.call(this, entitiesPath)]; - case 1: - entities = _a.sent(); - return [3 /*break*/, 3]; - case 2: - error_1 = _a.sent(); - console.error(error_1); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error_1) || 'Ошибка при извлечении информации из сертификата'); - case 3: return [2 /*return*/, _parseCertInfo_1._parseCertInfo(tags, entities)]; - } - }); - }); -}); - - -/***/ }), - -/***/ "./api/certificate/hasExtendedKeyUsage.ts": -/*!************************************************!*\ - !*** ./api/certificate/hasExtendedKeyUsage.ts ***! - \************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -/** - * Проверяет наличие ОИД'а (ОИД'ов) у сертификата - * - * @param oids - ОИД'ы для проверки - * @returns флаг наличия ОИД'ов у сертификата - */ -exports.hasExtendedKeyUsage = _afterPluginsLoaded_1._afterPluginsLoaded(function (oids) { - return __awaiter(this, void 0, void 0, function () { - var certOids, result; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.getExtendedKeyUsage()]; - case 1: - certOids = _a.sent(); - if (Array.isArray(oids)) { - result = oids.every(function (oidToCheck) { return certOids.some(function (certOid) { return certOid === oidToCheck; }); }); - } - else { - result = certOids.some(function (certOid) { return certOid === oids; }); - } - return [2 /*return*/, result]; - } - }); - }); -}); - - -/***/ }), - -/***/ "./api/certificate/index.ts": -/*!**********************************!*\ - !*** ./api/certificate/index.ts ***! - \**********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(/*! ./certificate */ "./api/certificate/certificate.ts")); - - -/***/ }), - -/***/ "./api/certificate/isValid.ts": -/*!************************************!*\ - !*** ./api/certificate/isValid.ts ***! - \************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Проверяет действительность сертификата - * - * @returns флаг валидности - */ -exports.isValid = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - var cadesCertificate = this._cadesCertificate; - return eval(_generateCadesFn_1._generateCadesFn(function isValid() { - var isValid; - try { - isValid = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.IsValid(); - isValid = _generateCadesFn_1.__cadesAsyncToken__ + isValid.Result; - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при проверке сертификата'); - } - return Boolean(isValid); - })); -}); - - -/***/ }), - -/***/ "./api/createAttachedSignature.ts": -/*!****************************************!*\ - !*** ./api/createAttachedSignature.ts ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(Buffer) { -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -var _getCadesCert_1 = __webpack_require__(/*! ../helpers/_getCadesCert */ "./helpers/_getCadesCert.ts"); -var _getDateObj_1 = __webpack_require__(/*! ../helpers/_getDateObj */ "./helpers/_getDateObj.ts"); -/** - * Создает присоединенную подпись сообщения по отпечатку сертификата - * - * @param thumbprint - отпечаток сертификата - * @param message - подписываемое сообщение - * @returns подпись в формате PKCS#7 - */ -exports.createAttachedSignature = _afterPluginsLoaded_1._afterPluginsLoaded(function (thumbprint, unencryptedMessage) { return __awaiter(void 0, void 0, void 0, function () { - var cadesplugin, cadesCertificate; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - cadesplugin = window.cadesplugin; - return [4 /*yield*/, _getCadesCert_1._getCadesCert(thumbprint)]; - case 1: - cadesCertificate = _a.sent(); - return [2 /*return*/, eval(_generateCadesFn_1._generateCadesFn(function createAttachedSignature() { - var cadesAttrs; - var cadesSignedData; - var cadesSigner; - try { - cadesAttrs = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CADESCOM.CPAttribute'); - cadesSignedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CadesSignedData'); - cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); - } - var currentTime = _getDateObj_1._getDateObj(new Date()); - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Name(constants_1.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи'); - } - var messageBase64; - try { - messageBase64 = Buffer.from(unencryptedMessage).toString('base64'); - } - catch (error) { - console.error(error); - throw new Error('Ошибка при преобразовании сообщения в Base64'); - } - var cadesAuthAttrs; - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); - cadesAuthAttrs = _generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2; - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_Content(messageBase64)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи'); - } - var signature; - try { - signature = _generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_PKCS7_TYPE); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); - } - return signature; - }))]; - } - }); -}); }); - -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/buffer/index.js */ "../node_modules/buffer/index.js").Buffer)) - -/***/ }), - -/***/ "./api/createDetachedSignature.ts": -/*!****************************************!*\ - !*** ./api/createDetachedSignature.ts ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -var _getCadesCert_1 = __webpack_require__(/*! ../helpers/_getCadesCert */ "./helpers/_getCadesCert.ts"); -var _getDateObj_1 = __webpack_require__(/*! ../helpers/_getDateObj */ "./helpers/_getDateObj.ts"); -/** - * Создает отсоединенную подпись хеша по отпечатку сертификата - * - * @param thumbprint - отпечаток сертификата - * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11-2012 256 бит - * @returns подпись в формате PKCS#7 - */ -exports.createDetachedSignature = _afterPluginsLoaded_1._afterPluginsLoaded(function (thumbprint, messageHash) { return __awaiter(void 0, void 0, void 0, function () { - var cadesplugin, cadesCertificate; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - cadesplugin = window.cadesplugin; - return [4 /*yield*/, _getCadesCert_1._getCadesCert(thumbprint)]; - case 1: - cadesCertificate = _a.sent(); - return [2 /*return*/, eval(_generateCadesFn_1._generateCadesFn(function createDetachedSignature() { - var cadesAttrs; - var cadesHashedData; - var cadesSignedData; - var cadesSigner; - try { - cadesAttrs = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CADESCOM.CPAttribute'); - cadesHashedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.HashedData'); - cadesSignedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CadesSignedData'); - cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); - } - var currentTime = _getDateObj_1._getDateObj(new Date()); - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Name(constants_1.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи'); - } - var cadesAuthAttrs; - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); - cadesAuthAttrs = _generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2; - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке сертификата'); - } - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + - cadesHashedData.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.SetHashValue(messageHash)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке хеша'); - } - var signature; - try { - signature = - _generateCadesFn_1.__cadesAsyncToken__ + - cadesSignedData.SignHash(cadesHashedData, cadesSigner, cadesplugin.CADESCOM_PKCS7_TYPE); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); - } - return signature; - }))]; - } - }); -}); }); - - -/***/ }), - -/***/ "./api/createHash.ts": -/*!***************************!*\ - !*** ./api/createHash.ts ***! - \***************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(Buffer) { -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Создает хеш сообщения по ГОСТ Р 34.11-2012 256 бит - * https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%B8%D0%B1%D0%BE%D0%B3_(%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F) - * - * @param unencryptedMessage - сообщение для хеширования - * - * @returns хеш - */ -exports.createHash = _afterPluginsLoaded_1._afterPluginsLoaded(function (unencryptedMessage) { return __awaiter(void 0, void 0, void 0, function () { - var cadesplugin; - return __generator(this, function (_a) { - cadesplugin = window.cadesplugin; - return [2 /*return*/, eval(_generateCadesFn_1._generateCadesFn(function createHash() { - var cadesHashedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.HashedData'); - var messageBase64; - var hash; - try { - messageBase64 = Buffer.from(unencryptedMessage).toString('base64'); - } - catch (error) { - console.error(error); - throw new Error('Ошибка при преобразовании сообщения в Base64'); - } - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + - cadesHashedData.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.propset_DataEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.Hash(messageBase64)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации хэширования'); - } - try { - hash = _generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.Value; - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при создании хэша'); - } - return hash; - }))]; - }); -}); }); - -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/buffer/index.js */ "../node_modules/buffer/index.js").Buffer)) - -/***/ }), - -/***/ "./api/createSignature.ts": -/*!********************************!*\ - !*** ./api/createSignature.ts ***! - \********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -var _getCadesCert_1 = __webpack_require__(/*! ../helpers/_getCadesCert */ "./helpers/_getCadesCert.ts"); -var _getDateObj_1 = __webpack_require__(/*! ../helpers/_getDateObj */ "./helpers/_getDateObj.ts"); -/** - * Создает подпись base64 строки по отпечатку сертификата - * - * @param thumbprint - отпечаток сертификата - * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11 - * @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false) - * @returns подпись - */ -exports.createSignature = _afterPluginsLoaded_1._afterPluginsLoaded(function (thumbprint, messageHash, detachedSignature) { - if (detachedSignature === void 0) { detachedSignature = true; } - return __awaiter(void 0, void 0, void 0, function () { - var cadesplugin, cadesCertificate; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - console.warn([ - 'cryptoPro: Метод "createSignature" является устаревшим и будет убран из будущих версий.', - 'Используйте "createAttachedSignature" и "createDetachedSignature".', - ].join('\n')); - cadesplugin = window.cadesplugin; - return [4 /*yield*/, _getCadesCert_1._getCadesCert(thumbprint)]; - case 1: - cadesCertificate = _a.sent(); - return [2 /*return*/, eval(_generateCadesFn_1._generateCadesFn(function createSignature() { - var cadesAttrs; - var cadesSignedData; - var cadesSigner; - try { - cadesAttrs = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CADESCOM.CPAttribute'); - cadesSignedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CadesSignedData'); - cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); - } - var currentTime = _getDateObj_1._getDateObj(new Date()); - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Name(constants_1.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи'); - } - var cadesAuthAttrs; - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); - cadesAuthAttrs = _generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2; - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_Content(messageHash)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи'); - } - var signature; - try { - signature = - _generateCadesFn_1.__cadesAsyncToken__ + - cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_CADES_BES, detachedSignature); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); - } - return signature; - }))]; - } - }); - }); -}); - - -/***/ }), - -/***/ "./api/createXMLSignature.ts": -/*!***********************************!*\ - !*** ./api/createXMLSignature.ts ***! - \***********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -var _getCadesCert_1 = __webpack_require__(/*! ../helpers/_getCadesCert */ "./helpers/_getCadesCert.ts"); -/** - * Создает XML подпись для документа в формате XML - * - * @param thumbprint - отпечаток сертификата - * @param unencryptedMessage - подписываемое сообщение в формате XML - * @returns подпись - */ -exports.createXMLSignature = _afterPluginsLoaded_1._afterPluginsLoaded(function (thumbprint, unencryptedMessage) { return __awaiter(void 0, void 0, void 0, function () { - var cadesplugin, cadesCertificate; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - cadesplugin = window.cadesplugin; - return [4 /*yield*/, _getCadesCert_1._getCadesCert(thumbprint)]; - case 1: - cadesCertificate = _a.sent(); - return [2 /*return*/, eval(_generateCadesFn_1._generateCadesFn(function createXMLSignature() { - var cadesSigner; - var cadesSignedXML; - try { - cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); - cadesSignedXML = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.SignedXML'); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); - } - try { - var signatureMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256'; - var digestMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256'; - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_CheckCertificate(true)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.propset_Content(unencryptedMessage)); - void (_generateCadesFn_1.__cadesAsyncToken__ + - cadesSignedXML.propset_SignatureType(cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.propset_SignatureMethod(signatureMethod)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.propset_DigestMethod(digestMethod)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи'); - } - var signature; - try { - signature = _generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.Sign(cadesSigner); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); - } - return signature; - }))]; - } - }); -}); }); - - -/***/ }), - -/***/ "./api/getCertificate.ts": -/*!*******************************!*\ - !*** ./api/getCertificate.ts ***! - \*******************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var getUserCertificates_1 = __webpack_require__(/*! ./getUserCertificates */ "./api/getUserCertificates.ts"); -/** - * Возвращает сертификат по отпечатку - * - * @param thumbprint - отпечаток сертификата - * @returns сертификат - */ -exports.getCertificate = _afterPluginsLoaded_1._afterPluginsLoaded(function (thumbprint) { return __awaiter(void 0, void 0, void 0, function () { - var availableCertificates, foundCertificate; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!thumbprint) { - throw new Error('Отпечаток не указан'); - } - return [4 /*yield*/, getUserCertificates_1.getUserCertificates()]; - case 1: - availableCertificates = _a.sent(); - foundCertificate = availableCertificates.find(function (cert) { return cert.thumbprint === thumbprint; }); - if (!foundCertificate) { - throw new Error("\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442 \u0441 \u043E\u0442\u043F\u0435\u0447\u0430\u0442\u043A\u043E\u043C: \"" + thumbprint + "\" \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D"); - } - return [2 /*return*/, foundCertificate]; - } - }); -}); }); - - -/***/ }), - -/***/ "./api/getSystemInfo.ts": -/*!******************************!*\ - !*** ./api/getSystemInfo.ts ***! - \******************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Предоставляет информацию о системе - * - * @returns информацию о CSP и плагине - */ -exports.getSystemInfo = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - var sysInfo = { - cadesVersion: null, - cspVersion: null, - }; - return eval(_generateCadesFn_1._generateCadesFn(function getSystemInfo() { - var cadesAbout; - try { - cadesAbout = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.About'); - sysInfo.cadesVersion = _generateCadesFn_1.__cadesAsyncToken__ + cadesAbout.PluginVersion; - sysInfo.cspVersion = _generateCadesFn_1.__cadesAsyncToken__ + cadesAbout.CSPVersion(); - if (!sysInfo.cadesVersion) { - sysInfo.cadesVersion = _generateCadesFn_1.__cadesAsyncToken__ + cadesAbout.Version; - } - sysInfo.cadesVersion = _generateCadesFn_1.__cadesAsyncToken__ + sysInfo.cadesVersion.toString(); - sysInfo.cspVersion = _generateCadesFn_1.__cadesAsyncToken__ + sysInfo.cspVersion.toString(); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при получении информации о системе'); - } - return sysInfo; - })); -}); - - -/***/ }), - -/***/ "./api/getUserCertificates.ts": -/*!************************************!*\ - !*** ./api/getUserCertificates.ts ***! - \************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var certificate_1 = __webpack_require__(/*! ./certificate */ "./api/certificate/index.ts"); -var constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractCommonName_1 = __webpack_require__(/*! ../helpers/_extractCommonName */ "./helpers/_extractCommonName.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -var certificatesCache; -/** - * Возвращает список сертификатов, доступных пользователю в системе - * - * @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов - * @returns список сертификатов - */ -exports.getUserCertificates = _afterPluginsLoaded_1._afterPluginsLoaded(function (resetCache) { - if (resetCache === void 0) { resetCache = false; } - var cadesplugin = window.cadesplugin; - if (!resetCache && certificatesCache) { - return certificatesCache; - } - return eval(_generateCadesFn_1._generateCadesFn(function getUserCertificates() { - var cadesStore; - try { - cadesStore = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.Store'); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу'); - } - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + - cadesStore.Open(cadesplugin.CAPICOM_CURRENT_USER_STORE, cadesplugin.CAPICOM_MY_STORE, cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища'); - } - var cadesCertificates; - var cadesCertificatesCount; - try { - cadesCertificates = _generateCadesFn_1.__cadesAsyncToken__ + cadesStore.Certificates; - if (cadesCertificates) { - cadesCertificates = - _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID); - /** - * Не рассматриваются сертификаты, в которых отсутствует закрытый ключ - * или не действительны на данный момент - */ - cadesCertificates = - _generateCadesFn_1.__cadesAsyncToken__ + - cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY, constants_1.CAPICOM_PROPID_KEY_PROV_INFO); - cadesCertificatesCount = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificates.Count; - } - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов'); - } - if (!cadesCertificatesCount) { - throw new Error('Нет доступных сертификатов'); - } - var certificateList = []; - try { - while (cadesCertificatesCount) { - var cadesCertificate = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificates.Item(cadesCertificatesCount); - certificateList.push(new certificate_1.Certificate(cadesCertificate, _extractCommonName_1._extractCommonName(_generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.SubjectName), _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.IssuerName, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.SubjectName, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.Thumbprint, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ValidFromDate, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ValidToDate)); - cadesCertificatesCount--; - } - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка обработки сертификатов'); - } - cadesStore.Close(); - certificatesCache = certificateList; - return certificatesCache; - })); -}); - - -/***/ }), - -/***/ "./api/index.ts": -/*!**********************!*\ - !*** ./api/index.ts ***! - \**********************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(/*! ./getCertificate */ "./api/getCertificate.ts")); -__export(__webpack_require__(/*! ./getUserCertificates */ "./api/getUserCertificates.ts")); -__export(__webpack_require__(/*! ./getSystemInfo */ "./api/getSystemInfo.ts")); -__export(__webpack_require__(/*! ./isValidSystemSetup */ "./api/isValidSystemSetup.ts")); -__export(__webpack_require__(/*! ./createSignature */ "./api/createSignature.ts")); -__export(__webpack_require__(/*! ./createXMLSignature */ "./api/createXMLSignature.ts")); -__export(__webpack_require__(/*! ./createDetachedSignature */ "./api/createDetachedSignature.ts")); -__export(__webpack_require__(/*! ./createAttachedSignature */ "./api/createAttachedSignature.ts")); -__export(__webpack_require__(/*! ./createHash */ "./api/createHash.ts")); -__export(__webpack_require__(/*! ./certificate */ "./api/certificate/index.ts")); - - -/***/ }), - -/***/ "./api/isValidSystemSetup.ts": -/*!***********************************!*\ - !*** ./api/isValidSystemSetup.ts ***! - \***********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _isSupportedCadesVersion_1 = __webpack_require__(/*! ../helpers/_isSupportedCadesVersion */ "./helpers/_isSupportedCadesVersion.ts"); -var _isSupportedCSPVersion_1 = __webpack_require__(/*! ../helpers/_isSupportedCSPVersion */ "./helpers/_isSupportedCSPVersion.ts"); -var getSystemInfo_1 = __webpack_require__(/*! ./getSystemInfo */ "./api/getSystemInfo.ts"); -/** - * Проверяет корректность настроек ЭП на машине - * - * @returns флаг корректности настроек - */ -exports.isValidSystemSetup = _afterPluginsLoaded_1._afterPluginsLoaded(function () { return __awaiter(void 0, void 0, void 0, function () { - var systemInfo, error_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, getSystemInfo_1.getSystemInfo()]; - case 1: - systemInfo = _a.sent(); - return [3 /*break*/, 3]; - case 2: - error_1 = _a.sent(); - console.error(error_1); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error_1) || 'Настройки ЭП на данной машине не верны'); - case 3: - if (!_isSupportedCadesVersion_1._isSupportedCadesVersion(systemInfo.cadesVersion)) { - throw new Error('Не поддерживаемая версия плагина'); - } - if (!_isSupportedCSPVersion_1._isSupportedCSPVersion(systemInfo.cspVersion)) { - throw new Error('Не поддерживаемая версия CSP'); - } - return [2 /*return*/, true]; - } - }); -}); }); - - -/***/ }), - -/***/ "./constants/cades-constants.ts": -/*!**************************************!*\ - !*** ./constants/cades-constants.ts ***! - \**************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CADESCOM_ATTRIBUTE_OTHER = -1; -exports.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; -exports.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; -exports.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0; -exports.CADESCOM_AllowNoOutstandingRequest = 1; -exports.CADESCOM_AllowNone = 0; -exports.CADESCOM_AllowUntrustedCertificate = 2; -exports.CADESCOM_AllowUntrustedRoot = 4; -exports.CADESCOM_BASE64_TO_BINARY = 0x01; -exports.CADESCOM_CADES_BES = 1; -exports.CADESCOM_CADES_DEFAULT = 0; -exports.CADESCOM_CADES_T = 5; -exports.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d; -exports.CADESCOM_CONTAINER_STORE = 100; -exports.CADESCOM_CURRENT_USER_STORE = 2; -exports.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2; -exports.CADESCOM_DISPLAY_DATA_CONTENT = 1; -exports.CADESCOM_DISPLAY_DATA_NONE = 0; -exports.CADESCOM_ENCODE_ANY = -1; -exports.CADESCOM_ENCODE_BASE64 = 0; -exports.CADESCOM_ENCODE_BINARY = 1; -exports.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3; -exports.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4; -exports.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2; -exports.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25; -exports.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0; -exports.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110; -exports.CADESCOM_HASH_ALGORITHM_MD2 = 1; -exports.CADESCOM_HASH_ALGORITHM_MD4 = 2; -exports.CADESCOM_HASH_ALGORITHM_MD5 = 3; -exports.CADESCOM_HASH_ALGORITHM_SHA1 = 0; -exports.CADESCOM_HASH_ALGORITHM_SHA_256 = 4; -exports.CADESCOM_HASH_ALGORITHM_SHA_384 = 5; -exports.CADESCOM_HASH_ALGORITHM_SHA_512 = 6; -exports.CADESCOM_LOCAL_MACHINE_STORE = 1; -exports.CADESCOM_PKCS7_TYPE = 65535; -exports.CADESCOM_STRING_TO_UCS2LE = 0x00; -exports.CADESCOM_SkipInstallToStore = 268435456; -exports.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0; -exports.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1; -exports.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2; -exports.CAPICOM_ACTIVE_DIRECTORY_USER_STORE = 3; -exports.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; -exports.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; -exports.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0; -exports.CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7; -exports.CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8; -exports.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6; -exports.CAPICOM_CERTIFICATE_FIND_EXTENSION = 5; -exports.CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2; -exports.CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12; -exports.CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3; -exports.CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0; -exports.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1; -exports.CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4; -exports.CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11; -exports.CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10; -exports.CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9; -exports.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0; -exports.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2; -exports.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1; -exports.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1; -exports.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0; -exports.CAPICOM_CURRENT_USER_STORE = 2; -exports.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128; -exports.CAPICOM_EKU_CLIENT_AUTH = 2; -exports.CAPICOM_EKU_OTHER = 0; -exports.CAPICOM_EKU_SMARTCARD_LOGON = 5; -exports.CAPICOM_LOCAL_MACHINE_STORE = 1; -exports.CAPICOM_MEMORY_STORE = 0; -exports.CAPICOM_MY_STORE = 'My'; -exports.CAPICOM_OID_KEY_USAGE_EXTENSION = 10; -exports.CAPICOM_OID_OTHER = 0; -exports.CAPICOM_PROPID_ACCESS_STATE = 14; -exports.CAPICOM_PROPID_ARCHIVED = 19; -exports.CAPICOM_PROPID_ARCHIVED_KEY_HASH = 65; -exports.CAPICOM_PROPID_AUTO_ENROLL = 21; -exports.CAPICOM_PROPID_CROSS_CERT_DIST_POINTS = 23; -exports.CAPICOM_PROPID_CTL_USAGE = 9; -exports.CAPICOM_PROPID_DATE_STAMP = 27; -exports.CAPICOM_PROPID_DESCRIPTION = 13; -exports.CAPICOM_PROPID_EFS = 17; -exports.CAPICOM_PROPID_ENHKEY_USAGE = 9; -exports.CAPICOM_PROPID_ENROLLMENT = 26; -exports.CAPICOM_PROPID_EXTENDED_ERROR_INFO = 30; -exports.CAPICOM_PROPID_FIRST_RESERVED = 66; -exports.CAPICOM_PROPID_FIRST_USER = 0x00008000; -exports.CAPICOM_PROPID_FORTEZZA_DATA = 18; -exports.CAPICOM_PROPID_FRIENDLY_NAME = 11; -exports.CAPICOM_PROPID_HASH_PROP = 3; -exports.CAPICOM_PROPID_IE30_RESERVED = 7; -exports.CAPICOM_PROPID_ISSUER_PUBLIC_KEY_MD5_HASH = 24; -exports.CAPICOM_PROPID_ISSUER_SERIAL_NUMBER_MD5_HASH = 28; -exports.CAPICOM_PROPID_KEY_CONTEXT = 5; -exports.CAPICOM_PROPID_KEY_IDENTIFIER = 20; -exports.CAPICOM_PROPID_KEY_PROV_HANDLE = 1; -exports.CAPICOM_PROPID_KEY_PROV_INFO = 2; -exports.CAPICOM_PROPID_KEY_SPEC = 6; -exports.CAPICOM_PROPID_LAST_RESERVED = 0x00007fff; -exports.CAPICOM_PROPID_LAST_USER = 0x0000ffff; -exports.CAPICOM_PROPID_MD5_HASH = 4; -exports.CAPICOM_PROPID_NEXT_UPDATE_LOCATION = 10; -exports.CAPICOM_PROPID_PUBKEY_ALG_PARA = 22; -exports.CAPICOM_PROPID_PUBKEY_HASH_RESERVED = 8; -exports.CAPICOM_PROPID_PVK_FILE = 12; -exports.CAPICOM_PROPID_RENEWAL = 64; -exports.CAPICOM_PROPID_SHA1_HASH = 3; -exports.CAPICOM_PROPID_SIGNATURE_HASH = 15; -exports.CAPICOM_PROPID_SMART_CARD_DATA = 16; -exports.CAPICOM_PROPID_SUBJECT_NAME_MD5_HASH = 29; -exports.CAPICOM_PROPID_SUBJECT_PUBLIC_KEY_MD5_HASH = 25; -exports.CAPICOM_PROPID_UNKNOWN = 0; -exports.CAPICOM_SMART_CARD_USER_STORE = 4; -exports.CAPICOM_STORE_OPEN_EXISTING_ONLY = 128; -exports.CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED = 256; -exports.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2; -exports.CAPICOM_STORE_OPEN_READ_ONLY = 0; -exports.CAPICOM_STORE_OPEN_READ_WRITE = 1; -exports.CHECK_NONE = 0; -exports.CHECK_OFFLINE_REVOCATION_STATUS = 16; -exports.CHECK_ONLINE_REVOCATION_STATUS = 8; -exports.CHECK_SIGNATURE_VALIDITY = 4; -exports.CHECK_TIME_VALIDITY = 2; -exports.CHECK_TRUSTED_ROOT = 1; -exports.LOG_LEVEL_DEBUG = 4; -exports.LOG_LEVEL_ERROR = 1; -exports.LOG_LEVEL_INFO = 2; -exports.TRUST_CTL_IS_NOT_SIGNATURE_VALID = 262144; -exports.TRUST_CTL_IS_NOT_TIME_VALID = 131072; -exports.TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 524288; -exports.TRUST_IS_CYCLIC = 128; -exports.TRUST_IS_NOT_SIGNATURE_VALID = 8; -exports.TRUST_IS_NOT_TIME_NESTED = 2; -exports.TRUST_IS_NOT_TIME_VALID = 1; -exports.TRUST_IS_NOT_VALID_FOR_USAGE = 16; -exports.TRUST_IS_PARTIAL_CHAIN = 65536; -exports.TRUST_IS_REVOKED = 4; -exports.TRUST_IS_UNTRUSTED_ROOT = 32; -exports.TRUST_REVOCATION_STATUS_UNKNOWN = 64; -exports.XmlDsigGost3410Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411'; -exports.XmlDsigGost3410UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411'; -exports.XmlDsigGost3411Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411'; -exports.XmlDsigGost3411UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr3411'; - - -/***/ }), - -/***/ "./constants/index.ts": -/*!****************************!*\ - !*** ./constants/index.ts ***! - \****************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(/*! ./cades-constants */ "./constants/cades-constants.ts")); -__export(__webpack_require__(/*! ./issuer-tags-translations */ "./constants/issuer-tags-translations.ts")); -__export(__webpack_require__(/*! ./oids-dictionary */ "./constants/oids-dictionary.ts")); -__export(__webpack_require__(/*! ./subject-tags-translations */ "./constants/subject-tags-translations.ts")); - - -/***/ }), - -/***/ "./constants/issuer-tags-translations.ts": -/*!***********************************************!*\ - !*** ./constants/issuer-tags-translations.ts ***! - \***********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ISSUER_TAGS_TRANSLATIONS = [ - { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' }, - { possibleNames: ['CN'], translation: 'Удостоверяющий центр' }, - { possibleNames: ['C'], translation: 'Страна' }, - { possibleNames: ['S'], translation: 'Регион' }, - { possibleNames: ['STREET'], translation: 'Адрес' }, - { possibleNames: ['O'], translation: 'Компания' }, - { possibleNames: ['OU'], translation: 'Тип' }, - { possibleNames: ['T'], translation: 'Должность' }, - { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' }, - { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' }, - { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' }, - { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' }, - { possibleNames: ['E'], translation: 'Email' }, - { possibleNames: ['L'], translation: 'Город' }, -]; - - -/***/ }), - -/***/ "./constants/oids-dictionary.ts": -/*!**************************************!*\ - !*** ./constants/oids-dictionary.ts ***! - \**************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.OIDS_DICTIONARY = { - '1.2.643.2.2.34.6': 'Пользователь Центра Регистрации', - '1.2.643.2.39.1.1': 'Использование в программных продуктах системы "1С:Предприятие 8"', - '1.2.643.3.131.1.1': 'ИНН', - '1.2.643.3.141.1.1': 'РНС ФСС', - '1.2.643.3.141.1.2': 'КП ФСС', - '1.2.643.3.2.100.65.13.11': 'Использование в системе АИС "Госзакупки" Сахалинской области.', - '1.2.643.3.8.100.1': 'Сертификат типа "ekey-ГОСТ"', - '1.2.643.3.8.100.1.1': 'Общее использование в системах ИОК без права заверения финансовых документов', - '1.2.643.3.8.100.1.10': 'Для участия в электронных торгах и подписания государственного контракта в информационных системах Тендерного комитета города Москвы уполномоченными лицами участников размещения государственного заказа города Москвы', - '1.2.643.3.8.100.1.11': 'Подписание электронных документов в автоматизированной информационной системе размещения государственного и муниципального заказа Саратовской области', - '1.2.643.3.8.100.1.12': 'Использование в системе государственного заказа Иркутской области', - '1.2.643.3.8.100.1.13': 'Использование в электронной торговой площадке агентства государственного заказа Красноярского края', - '1.2.643.3.8.100.1.14': 'Использование в электронной торговой площадке "Тендер"', - '1.2.643.3.8.100.1.2': 'Передача отчетности по ТКС', - '1.2.643.3.8.100.1.3': 'Оформление взаимных обязательств, соглашений, договоров, актов и т.п.', - '1.2.643.3.8.100.1.4': 'Внутрикорпоративный документооборот', - '1.2.643.3.8.100.1.5': 'Использование в системах электронной торговли', - '1.2.643.3.8.100.1.6': 'Использование в торгово-закупочной системе "ЭЛЕКТРА"', - '1.2.643.3.8.100.1.7': 'Использование в системе Портал государственных закупок Ставропольского края.', - '1.2.643.3.8.100.1.8': 'Использование в Единой системе электронной торговли B2B-Center и B2G.', - '1.2.643.3.8.100.1.9': 'Для участия в электронных торгах и подписания государственного контракта в электронной площадке ОАО «ЕЭТП» уполномоченными лицами участников размещения государственного или муниципального заказа', - '1.2.643.5.1.24.2.1.3': 'Формирование документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя', - '1.2.643.5.1.24.2.1.3.1': 'Формирование кадастровым инженером документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя', - '1.2.643.5.1.24.2.2.2': 'Формирование документов как результата оказания услуги со стороны органов регистрации прав', - '1.2.643.5.1.24.2.2.3': 'Формирование документов для получения государственных услуг в сфере государственной регистрации прав на недвижимое имущество и сделок с ним со стороны заявителя', - '1.2.643.6.2.1.7.1': 'Использование единоличным исполнительным органом юридического лица или уполномоченными представителями юридического лица в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских и иных прав и обязанностей в сфере негосударственного пенсионного обеспечения, негосударственного пенсионного страхования, в сфере деятельности паевых инвестиционных фондов, акционерных инвестиционных фондов, профессиональных участников рынка ценных бумаг, а также связанной с обслуживанием указанной деятельности услуг кредитных и иных организаций', - '1.2.643.6.2.1.7.2': 'Использование физическим лицом в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских прав и обязанностей в отношении инвестиционных паев паевых инвестиционных фондов, в том числе отношения, связанные с учетом и/или фиксацией прав на инвестиционные паи паевых инвестиционных фондов', - '1.2.643.6.3': 'Использование в электронных торговых системах и в программном обеспечении, связанным с обменом электронных сообщений', - '1.2.643.6.3.1.1': 'Использование на электронных площадок отобранных для проведения аукционах в электронной форме', - '1.2.643.6.3.1.2.1': 'Тип участника - Юридическое лицо', - '1.2.643.6.3.1.2.2': 'Тип участника - Физическое лицо', - '1.2.643.6.3.1.2.3': 'Тип участника - Индивидуальный предприниматель', - '1.2.643.6.3.1.3.1': 'Участник размещения заказа', - '1.2.643.6.3.1.4.1': 'Администратор организации', - '1.2.643.6.3.1.4.2': 'Уполномоченный специалист', - '1.2.643.6.3.1.4.3': 'Специалист с правом подписи контракта', - '1.2.840.113549.1.9.2': 'Неструктурированное имя', - '1.3.6.1.4.1.24138.1.1.8.1': 'Обеспечение юридической значимости в Системе "Электронная Торговая Площадка"', - '1.3.6.1.4.1.29919.21': 'Использование в системе Портал государственных закупок Ростовской области "Рефери".', - '1.3.6.1.5.5.7.3.2': 'Проверка подлинности клиента', - '1.3.6.1.5.5.7.3.4': 'Защищенная электронная почта', - '1.3.643.3.8.100.15': 'Использование в ЭТП "uTender"', -}; - - -/***/ }), - -/***/ "./constants/subject-tags-translations.ts": -/*!************************************************!*\ - !*** ./constants/subject-tags-translations.ts ***! - \************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SUBJECT_TAGS_TRANSLATIONS = [ - { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' }, - { possibleNames: ['CN'], translation: 'Владелец' }, - { possibleNames: ['SN'], translation: 'Фамилия' }, - { possibleNames: ['G'], translation: 'Имя Отчество' }, - { possibleNames: ['C'], translation: 'Страна' }, - { possibleNames: ['S'], translation: 'Регион' }, - { possibleNames: ['STREET'], translation: 'Адрес' }, - { possibleNames: ['O'], translation: 'Компания' }, - { possibleNames: ['OU'], translation: 'Отдел/подразделение' }, - { possibleNames: ['T'], translation: 'Должность' }, - { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' }, - { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' }, - { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' }, - { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' }, - { possibleNames: ['E'], translation: 'Email' }, - { possibleNames: ['L'], translation: 'Город' }, -]; - - -/***/ }), - -/***/ "./crypto-pro.ts": -/*!***********************!*\ - !*** ./crypto-pro.ts ***! - \***********************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(/*! ./api */ "./api/index.ts")); - - -/***/ }), - -/***/ "./helpers/_afterPluginsLoaded.ts": -/*!****************************************!*\ - !*** ./helpers/_afterPluginsLoaded.ts ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ./_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var isSetLogLevel = false; -var isPluginLoaded = false; -exports._afterPluginsLoaded = function (fn) { - var canPromise = Boolean(window.Promise); - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return __awaiter(this, void 0, void 0, function () { - var cadesplugin, error_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!isPluginLoaded) { - try { - __webpack_require__(/*! ../vendor/cadesplugin_api */ "./vendor/cadesplugin_api.js"); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подключении модуля для работы с Cades plugin'); - } - isPluginLoaded = true; - } - cadesplugin = window.cadesplugin; - if (!canPromise) { - throw new Error('Необходим полифилл для Promise'); - } - if (!cadesplugin) { - throw new Error('Не подключен модуль для работы с Cades plugin'); - } - if (!isSetLogLevel) { - cadesplugin.set_log_level(cadesplugin.LOG_LEVEL_ERROR); - isSetLogLevel = true; - } - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, cadesplugin]; - case 2: - _a.sent(); - return [3 /*break*/, 4]; - case 3: - error_1 = _a.sent(); - console.error(error_1); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error_1) || 'Ошибка при инициализации модуля для работы с Cades plugin'); - case 4: return [4 /*yield*/, fn.apply(this, args)]; - case 5: return [2 /*return*/, _a.sent()]; - } - }); - }); - }; -}; - - -/***/ }), - -/***/ "./helpers/_extractCommonName.ts": -/*!***************************************!*\ - !*** ./helpers/_extractCommonName.ts ***! - \***************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports._extractCommonName = function (subjectName) { var _a; return (_a = subjectName.match(/CN=(.+?)(?:,|$)/)) === null || _a === void 0 ? void 0 : _a[1]; }; - - -/***/ }), - -/***/ "./helpers/_extractMeaningfulErrorMessage.ts": -/*!***************************************************!*\ - !*** ./helpers/_extractMeaningfulErrorMessage.ts ***! - \***************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports._extractMeaningfulErrorMessage = function (error) { - var _a; - var errorContainer = ((_a = window.cadesplugin) === null || _a === void 0 ? void 0 : _a.getLastError) && window.cadesplugin.getLastError(error); - if (!(errorContainer === null || errorContainer === void 0 ? void 0 : errorContainer.message)) { - if (!error.message) { - return null; - } - errorContainer = error; - } - var containsRussianLetters = /[а-яА-Я]/.test(errorContainer.message); - if (!containsRussianLetters) { - return null; - } - var searchResult = errorContainer.message.match(/^(.*?)(?:(?:\.?\s?\(?(0x[0-9a-zA-Z]{1,8})\))|(?:\.?$))/); - return (searchResult ? searchResult[1] + (searchResult[2] ? '. Код ошибки: ' + searchResult[2] : '') : null); -}; - - -/***/ }), - -/***/ "./helpers/_generateCadesFn.ts": -/*!*************************************!*\ - !*** ./helpers/_generateCadesFn.ts ***! - \*************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -// синтетические переменные, которые подменяются в рантайме -exports.__cadesAsyncToken__ = {}; -exports.__createCadesPluginObject__ = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return ({}); -}; -function getGeneratorConstructor() { - return new Function('', 'return Object.getPrototypeOf(function*(){}).constructor')(); -} -exports._generateCadesFn = function (callback) { - var _a; - var cadesplugin = window.cadesplugin; - var cadesGeneratorsAPI = Boolean(cadesplugin.CreateObjectAsync); - var callbackName = callback.name || 'dynamicFn'; - var callbackLiteral = String(callback); - var callbackArguments = ((_a = callbackLiteral.match(/^function[\s\w]*?\((.*?)\)/)) === null || _a === void 0 ? void 0 : _a[1]) || ''; - var callbackBody = callbackLiteral.replace(/^.*?{([\s\S]*?)}$/, '$1'); - var crossEnvCallbackLiteral = String(new (cadesGeneratorsAPI ? getGeneratorConstructor() : Function)(callbackArguments, callbackBody)); - crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/\w+?\.__createCadesPluginObject__(\([\s\S]*?\))/gm, "cadesplugin.CreateObject" + (cadesGeneratorsAPI ? 'Async' : '') + "$1"); - crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/\w+?\.__cadesAsyncToken__\s*?\+\s*?\b/gm, cadesGeneratorsAPI ? 'yield ' : ''); - if (!cadesGeneratorsAPI) { - crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/propset_(.*?)\((.*?)\)/gm, '$1 = $2'); - } - return [ - cadesGeneratorsAPI ? "cadesplugin.async_spawn(" + crossEnvCallbackLiteral + ");" : "(" + crossEnvCallbackLiteral + ")();", - "//# sourceURL=crypto-pro_" + callbackName + ".js", - ].join(''); -}; - - -/***/ }), - -/***/ "./helpers/_getCadesCert.ts": -/*!**********************************!*\ - !*** ./helpers/_getCadesCert.ts ***! - \**********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ./_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ./_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ./_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Возвращает сертификат в формате Cades по отпечатку - * - * @param thumbprint - отпечаток сертификата - * @returns сертификат в формате Cades - */ -exports._getCadesCert = _afterPluginsLoaded_1._afterPluginsLoaded(function (thumbprint) { - var cadesplugin = window.cadesplugin; - return eval(_generateCadesFn_1._generateCadesFn(function _getCadesCert() { - var cadesStore; - try { - cadesStore = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.Store'); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу'); - } - if (!cadesStore) { - throw new Error('Не удалось получить доступ к хранилищу сертификатов'); - } - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + - cadesStore.Open(cadesplugin.CAPICOM_CURRENT_USER_STORE, cadesplugin.CAPICOM_MY_STORE, cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища'); - } - var cadesCertificateList; - var certificatesCount; - try { - cadesCertificateList = _generateCadesFn_1.__cadesAsyncToken__ + cadesStore.Certificates; - certificatesCount = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Count; - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов'); - } - if (!certificatesCount) { - throw new Error('Нет доступных сертификатов'); - } - var cadesCertificate; - try { - cadesCertificateList = - _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH, thumbprint); - var count = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Count; - if (!count) { - throw new Error("\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442 \u0441 \u043E\u0442\u043F\u0435\u0447\u0430\u0442\u043A\u043E\u043C: \"" + thumbprint + "\" \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D"); - } - cadesCertificate = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Item(1); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при получении сертификата'); - } - cadesStore.Close(); - return cadesCertificate; - })); -}); - - -/***/ }), - -/***/ "./helpers/_getDateObj.ts": -/*!********************************!*\ - !*** ./helpers/_getDateObj.ts ***! - \********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * Возвращает объект даты, совместимый с Cades plugin'ом, зависящий от браузера. - * - * В IE необходимо использовать специфичный формат "VT_DATE" - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Microsoft_Extensions/Date.getVarDate - */ -exports._getDateObj = function (dateObj) { return (dateObj.getVarDate ? dateObj.getVarDate() : dateObj); }; - - -/***/ }), - -/***/ "./helpers/_isSupportedCSPVersion.ts": -/*!*******************************************!*\ - !*** ./helpers/_isSupportedCSPVersion.ts ***! - \*******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var oldestSupportedCSPVersion = 4.0; -exports._isSupportedCSPVersion = function (version) { - var _a; - version = (_a = version.match(/\d+?\b(?:\.\d+)?/)) === null || _a === void 0 ? void 0 : _a[0]; - return Number(version) >= oldestSupportedCSPVersion; -}; - - -/***/ }), - -/***/ "./helpers/_isSupportedCadesVersion.ts": -/*!*********************************************!*\ - !*** ./helpers/_isSupportedCadesVersion.ts ***! - \*********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports._isSupportedCadesVersion = function (version) { - var match = version.match(/(\d+)\.(\d+)\.(\d+)/); - if (!match) { - return false; - } - var major = match[1], minor = match[2], patch = match[3]; - if (Number(major) < 2) { - return false; - } - if (Number(major) === 2 && Number(patch) < 12438) { - return false; - } - return true; -}; - - -/***/ }), - -/***/ "./helpers/_parseCertInfo.ts": -/*!***********************************!*\ - !*** ./helpers/_parseCertInfo.ts ***! - \***********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); -/** - * Парсит информацию из строки с информацией о сертификате - * - * @param tagsTranslations - словарь с расшифровками тэгов - * @param rawInfo - данные для парсинга - * @returns расшифрованная информация по отдельным тэгам - */ -exports._parseCertInfo = function (tagsTranslations, rawInfo) { - var extractedEntities = rawInfo.match(/([а-яА-Яa-zA-Z0-9\s.]+)=(?:("[^"]+?")|(.+?))(?:,|$)/g); - if (extractedEntities) { - return extractedEntities.map(function (group) { - var _a, _b, _c; - var segmentsMatch = group.trim().match(/^([а-яА-Яa-zA-Z0-9\s.]+)=(.+?),?$/); - var title = segmentsMatch === null || segmentsMatch === void 0 ? void 0 : segmentsMatch[1]; - // Вырезаем лишние кавычки - var description = (_b = (_a = segmentsMatch === null || segmentsMatch === void 0 ? void 0 : segmentsMatch[2]) === null || _a === void 0 ? void 0 : _a.replace(/^"(.*)"/, '$1')) === null || _b === void 0 ? void 0 : _b.replace(/"{2}/g, '"'); - var oidIdentifierMatch = title === null || title === void 0 ? void 0 : title.match(/^OID\.(.*)/); - var oidIdentifier = oidIdentifierMatch === null || oidIdentifierMatch === void 0 ? void 0 : oidIdentifierMatch[1]; - var isTranslated = false; - // Если нашли в тайтле ОИД, пытаемся его расшифровать - if (oidIdentifier) { - var oidTranslation = constants_1.OIDS_DICTIONARY[oidIdentifier]; - if (oidTranslation) { - title = oidTranslation; - isTranslated = true; - } - } - var tagTranslation = (_c = tagsTranslations.find(function (tag) { return tag.possibleNames.find(function (name) { return name === title; }); })) === null || _c === void 0 ? void 0 : _c.translation; - if (tagTranslation) { - title = tagTranslation; - isTranslated = true; - } - return { description: description, title: title, isTranslated: isTranslated }; - }); - } -}; - - -/***/ }), - -/***/ "./vendor/cadesplugin_api.js": -/*!***********************************!*\ - !*** ./vendor/cadesplugin_api.js ***! - \***********************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -;(function () { - //already loaded - if(window.cadesplugin) - return; - - var pluginObject; - var plugin_resolved = 0; - var plugin_reject; - var plugin_resolve; - var isOpera = 0; - var isFireFox = 0; - var isEdge = 0; - var isSafari = 0; - var failed_extensions = 0; - - var canPromise = !!window.Promise; - var cadesplugin; - - if(canPromise) - { - cadesplugin = new Promise(function(resolve, reject) - { - plugin_resolve = resolve; - plugin_reject = reject; - }); - } else - { - cadesplugin = {}; - } - - function check_browser() { - var ua= navigator.userAgent, tem, M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; - if(/trident/i.test(M[1])){ - tem= /\brv[ :]+(\d+)/g.exec(ua) || []; - return {name:'IE',version:(tem[1] || '')}; - } - if(M[1]=== 'Chrome'){ - tem= ua.match(/\b(OPR|Edge)\/(\d+)/); - if(tem!= null) return {name:tem[1].replace('OPR', 'Opera'),version:tem[2]}; - } - M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?']; - if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]); - return {name:M[0],version:M[1]}; - } - var browserSpecs = check_browser(); - - function cpcsp_console_log(level, msg){ - //IE9 не может писать в консоль если не открыта вкладка developer tools - if(typeof(console) === 'undefined') - return; - if (level <= cadesplugin.current_log_level ){ - if (level === cadesplugin.LOG_LEVEL_DEBUG) - console.log("DEBUG: %s", msg); - if (level === cadesplugin.LOG_LEVEL_INFO) - console.info("INFO: %s", msg); - if (level === cadesplugin.LOG_LEVEL_ERROR) - console.error("ERROR: %s", msg); - return; - } - } - - function set_log_level(level){ - if (!((level === cadesplugin.LOG_LEVEL_DEBUG) || - (level === cadesplugin.LOG_LEVEL_INFO) || - (level === cadesplugin.LOG_LEVEL_ERROR))){ - cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, "cadesplugin_api.js: Incorrect log_level: " + level); - return; - } - cadesplugin.current_log_level = level; - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = DEBUG"); - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = INFO"); - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = ERROR"); - if(isNativeMessageSupported()) - { - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG) - window.postMessage("set_log_level=debug", "*"); - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO) - window.postMessage("set_log_level=info", "*"); - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR) - window.postMessage("set_log_level=error", "*"); - } - } - - function set_constantValues() - { - cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1; - cadesplugin.CAPICOM_CURRENT_USER_STORE = 2; - cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1; - cadesplugin.CADESCOM_CURRENT_USER_STORE = 2; - cadesplugin.CADESCOM_CONTAINER_STORE = 100; - - cadesplugin.CAPICOM_MY_STORE = "My"; - - cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2; - - cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1; - - cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0; - cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1; - cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2; - - cadesplugin.XmlDsigGost3410UrlObsolete = "http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411"; - cadesplugin.XmlDsigGost3411UrlObsolete = "http://www.w3.org/2001/04/xmldsig-more#gostr3411"; - cadesplugin.XmlDsigGost3410Url = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411"; - cadesplugin.XmlDsigGost3411Url = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411"; - - cadesplugin.CADESCOM_CADES_DEFAULT = 0; - cadesplugin.CADESCOM_CADES_BES = 1; - cadesplugin.CADESCOM_CADES_T = 0x5; - cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d; - cadesplugin.CADESCOM_PKCS7_TYPE = 0xffff; - - cadesplugin.CADESCOM_ENCODE_BASE64 = 0; - cadesplugin.CADESCOM_ENCODE_BINARY = 1; - cadesplugin.CADESCOM_ENCODE_ANY = -1; - - cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0; - cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1; - cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2; - - cadesplugin.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0; - cadesplugin.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1; - - cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0; - cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1; - cadesplugin.CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2; - cadesplugin.CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3; - cadesplugin.CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4; - cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENSION = 5; - cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6; - cadesplugin.CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7; - cadesplugin.CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8; - cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9; - cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10; - cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11; - cadesplugin.CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12; - - cadesplugin.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128; - - cadesplugin.CAPICOM_PROPID_ENHKEY_USAGE = 9; - - cadesplugin.CAPICOM_OID_OTHER = 0; - cadesplugin.CAPICOM_OID_KEY_USAGE_EXTENSION = 10; - - cadesplugin.CAPICOM_EKU_CLIENT_AUTH = 2; - cadesplugin.CAPICOM_EKU_SMARTCARD_LOGON = 5; - cadesplugin.CAPICOM_EKU_OTHER = 0; - - cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0; - cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; - cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; - cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0; - cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; - cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; - cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1; - - cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0; - cadesplugin.CADESCOM_BASE64_TO_BINARY = 1; - - cadesplugin.CADESCOM_DISPLAY_DATA_NONE = 0; - cadesplugin.CADESCOM_DISPLAY_DATA_CONTENT = 1; - cadesplugin.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2; - - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25; - - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA1 = 0; - cadesplugin.CADESCOM_HASH_ALGORITHM_MD2 = 1; - cadesplugin.CADESCOM_HASH_ALGORITHM_MD4 = 2; - cadesplugin.CADESCOM_HASH_ALGORITHM_MD5 = 3; - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_256 = 4; - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_384 = 5; - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_512 = 6; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112; - - cadesplugin.LOG_LEVEL_DEBUG = 4; - cadesplugin.LOG_LEVEL_INFO = 2; - cadesplugin.LOG_LEVEL_ERROR = 1; - - cadesplugin.CADESCOM_AllowNone = 0; - cadesplugin.CADESCOM_AllowNoOutstandingRequest = 0x1; - cadesplugin.CADESCOM_AllowUntrustedCertificate = 0x2; - cadesplugin.CADESCOM_AllowUntrustedRoot = 0x4; - cadesplugin.CADESCOM_SkipInstallToStore = 0x10000000; - } - - function async_spawn(generatorFunc) { - function continuer(verb, arg) { - var result; - try { - result = generator[verb](arg); - } catch (err) { - return Promise.reject(err); - } - if (result.done) { - return result.value; - } else { - return Promise.resolve(result.value).then(onFulfilled, onRejected); - } - } - var generator = generatorFunc(Array.prototype.slice.call(arguments, 1)); - var onFulfilled = continuer.bind(continuer, "next"); - var onRejected = continuer.bind(continuer, "throw"); - return onFulfilled(); - } - - function isIE() { - // var retVal = (("Microsoft Internet Explorer" == navigator.appName) || // IE < 11 - // navigator.userAgent.match(/Trident\/./i)); // IE 11 - return (browserSpecs.name === 'IE' || browserSpecs.name === 'MSIE'); - } - - function isIOS() { - return (navigator.userAgent.match(/ipod/i) || - navigator.userAgent.match(/ipad/i) || - navigator.userAgent.match(/iphone/i)); - } - - function isNativeMessageSupported() - { - // В IE работаем через NPAPI - if(isIE()) - return false; - // В Edge работаем через NativeMessage - if(browserSpecs.name === 'Edge') { - isEdge = true; - return true; - } - // В Chrome, Firefox, Safari и Opera работаем через асинхронную версию в зависимости от версии - if(browserSpecs.name === 'Opera') { - isOpera = true; - if(browserSpecs.version >= 33){ - return true; - } - else{ - return false; - } - } - if(browserSpecs.name === 'Firefox') { - isFireFox = true; - if(browserSpecs.version >= 52){ - return true; - } - else{ - return false; - } - } - if(browserSpecs.name === 'Chrome') { - if(browserSpecs.version >= 42){ - return true; - } - else{ - return false; - } - } - //В Сафари начиная с 12 версии нет NPAPI - if(browserSpecs.name === 'Safari') { - isSafari = true; - if(browserSpecs.version >= 12) { - return true; - } else { - return false; - } - } - } - - // Функция активации объектов КриптоПро ЭЦП Browser plug-in - function CreateObject(name) { - if (isIOS()) { - // На iOS для создания объектов используется функция - // call_ru_cryptopro_npcades_10_native_bridge, определенная в IOS_npcades_supp.js - return call_ru_cryptopro_npcades_10_native_bridge("CreateObject", [name]); - } - if (isIE()) { - // В Internet Explorer создаются COM-объекты - if (name.match(/X509Enrollment/i)) { - try { - // Объекты CertEnroll пробуем создавать через нашу фабрику, - // если не получилось то через CX509EnrollmentWebClassFactory - var objCertEnrollClassFactory = document.getElementById("webClassFactory"); - return objCertEnrollClassFactory.CreateObject(name); - } - catch (e) { - try { - var objWebClassFactory = document.getElementById("certEnrollClassFactory"); - return objWebClassFactory.CreateObject(name); - } - catch (err) { - throw ("Для создания обьектов X509Enrollment следует настроить веб-узел на использование проверки подлинности по протоколу HTTPS"); - } - } - } - // Объекты CAPICOM и CAdESCOM создаются через CAdESCOM.WebClassFactory - try { - var objWebClassFactory = document.getElementById("webClassFactory"); - return objWebClassFactory.CreateObject(name); - } - catch (e) { - // Для версий плагина ниже 2.0.12538 - return new ActiveXObject(name); - } - } - // создаются объекты NPAPI - return pluginObject.CreateObject(name); - } - - function decimalToHexString(number) { - if (number < 0) { - number = 0xFFFFFFFF + number + 1; - } - - return number.toString(16).toUpperCase(); - } - - function GetMessageFromException(e) { - var err = e.message; - if (!err) { - err = e; - } else if (e.number) { - err += " (0x" + decimalToHexString(e.number) + ")"; - } - return err; - } - - function getLastError(exception) { - if(isNativeMessageSupported() || isIE() || isIOS() ) { - return GetMessageFromException(exception); - } - - try { - return pluginObject.getLastError(); - } catch(e) { - return GetMessageFromException(exception); - } - } - - // Функция для удаления созданных объектов - function ReleasePluginObjects() { - return cpcsp_chrome_nmcades.ReleasePluginObjects(); - } - - // Функция активации асинхронных объектов КриптоПро ЭЦП Browser plug-in - function CreateObjectAsync(name) { - return pluginObject.CreateObjectAsync(name); - } - - //Функции для IOS - var ru_cryptopro_npcades_10_native_bridge = { - callbacksCount : 1, - callbacks : {}, - - // Automatically called by native layer when a result is available - resultForCallback : function resultForCallback(callbackId, resultArray) { - var callback = ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId]; - if (!callback) return; - callback.apply(null,resultArray); - }, - - // Use this in javascript to request native objective-c code - // functionName : string (I think the name is explicit :p) - // args : array of arguments - // callback : function with n-arguments that is going to be called when the native code returned - call : function call(functionName, args, callback) { - var hasCallback = callback && typeof callback === "function"; - var callbackId = hasCallback ? ru_cryptopro_npcades_10_native_bridge.callbacksCount++ : 0; - - if (hasCallback) - ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId] = callback; - - var iframe = document.createElement("IFRAME"); - var arrObjs = new Array("_CPNP_handle"); - try{ - iframe.setAttribute("src", "cpnp-js-call:" + functionName + ":" + callbackId+ ":" + encodeURIComponent(JSON.stringify(args, arrObjs))); - } catch(e){ - alert(e); - } - document.documentElement.appendChild(iframe); - iframe.parentNode.removeChild(iframe); - iframe = null; - } - }; - - function call_ru_cryptopro_npcades_10_native_bridge(functionName, array){ - var tmpobj; - var ex; - ru_cryptopro_npcades_10_native_bridge.call(functionName, array, function(e, response){ - ex = e; - var str='tmpobj='+response; - eval(str); - if (typeof (tmpobj) === "string"){ - tmpobj = tmpobj.replace(/\\\n/gm, "\n"); - tmpobj = tmpobj.replace(/\\\r/gm, "\r"); - } - }); - if(ex) - throw ex; - return tmpobj; - } - - function show_firefox_missing_extension_dialog() - { - if (!window.cadesplugin_skip_extension_install) - { - var ovr = document.createElement('div'); - ovr.id = "cadesplugin_ovr"; - ovr.style = "visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)"; - ovr.innerHTML = "
" + - "" + - "

Для работы КриптоПро ЭЦП Browser plugin на данном сайте необходимо расширение для браузера. Убедитесь, что оно у Вас включено или установите его." + - "

Скачать расширение

" + - "
"; - document.getElementsByTagName("Body")[0].appendChild(ovr); - document.getElementById("cadesplugin_close_install").addEventListener('click',function() - { - plugin_loaded_error("Плагин недоступен"); - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - }); - - ovr.addEventListener('click',function() - { - plugin_loaded_error("Плагин недоступен"); - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - }); - ovr.style.visibility="visible"; - } - } - - - //Выводим окно поверх других с предложением установить расширение для Opera. - //Если установленна переменная cadesplugin_skip_extension_install - не предлагаем установить расширение - function install_opera_extension() - { - if (!window.cadesplugin_skip_extension_install) - { - document.addEventListener('DOMContentLoaded', function() { - var ovr = document.createElement('div'); - ovr.id = "cadesplugin_ovr"; - ovr.style = "visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)"; - ovr.innerHTML = "
" + - "" + - "

Для работы КриптоПро ЭЦП Browser plugin на данном сайте необходимо установить расширение из каталога дополнений Opera." + - "

" + - "
"; - document.getElementsByTagName("Body")[0].appendChild(ovr); - var btn_install = document.getElementById("cadesplugin_install"); - btn_install.addEventListener('click', function(event) { - opr.addons.installExtension("epebfcehmdedogndhlcacafjaacknbcm", - function() - { - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - location.reload(); - }, - function(){}) - }); - document.getElementById("cadesplugin_close_install").addEventListener('click',function() - { - plugin_loaded_error("Плагин недоступен"); - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - }); - - ovr.addEventListener('click',function() - { - plugin_loaded_error("Плагин недоступен"); - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - }); - ovr.style.visibility="visible"; - document.getElementById("cadesplugin_ovr_item").addEventListener('click',function(e){ - e.stopPropagation(); - }); - }); - }else - { - plugin_loaded_error("Плагин недоступен"); - } - } - - function firefox_or_edge_nmcades_onload() { - cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error); - } - - function nmcades_api_onload () { - window.postMessage("cadesplugin_echo_request", "*"); - window.addEventListener("message", function (event){ - if (typeof(event.data) !== "string" || !event.data.match("cadesplugin_loaded")) - return; - if(isFireFox || isEdge || isSafari) - { - // Для Firefox, Сафари, Edge вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js - var url = event.data.substring(event.data.indexOf("url:") + 4); - var fileref = document.createElement('script'); - fileref.setAttribute("type", "text/javascript"); - fileref.setAttribute("src", url); - fileref.onerror = plugin_loaded_error; - fileref.onload = firefox_or_edge_nmcades_onload; - document.getElementsByTagName("head")[0].appendChild(fileref); - // Для Firefox, Safari и Edge у нас только по одному расширению. - failed_extensions++; - }else { - cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error); - } - }, false); - } - - //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari - function load_extension() - { - - if(isFireFox || isEdge || isSafari){ - // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера. - nmcades_api_onload(); - } else { - // в асинхронном варианте для chrome и opera подключаем оба расширения - var fileref = document.createElement('script'); - fileref.setAttribute("type", "text/javascript"); - fileref.setAttribute("src", "chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js"); - fileref.onerror = plugin_loaded_error; - fileref.onload = nmcades_api_onload; - document.getElementsByTagName("head")[0].appendChild(fileref); - fileref = document.createElement('script'); - fileref.setAttribute("type", "text/javascript"); - fileref.setAttribute("src", "chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js"); - fileref.onerror = plugin_loaded_error; - fileref.onload = nmcades_api_onload; - document.getElementsByTagName("head")[0].appendChild(fileref); - } - } - - //Загружаем плагин для NPAPI - function load_npapi_plugin() - { - var elem = document.createElement('object'); - elem.setAttribute("id", "cadesplugin_object"); - elem.setAttribute("type", "application/x-cades"); - elem.setAttribute("style", "visibility: hidden"); - document.getElementsByTagName("body")[0].appendChild(elem); - pluginObject = document.getElementById("cadesplugin_object"); - if(isIE()) - { - var elem1 = document.createElement('object'); - elem1.setAttribute("id", "certEnrollClassFactory"); - elem1.setAttribute("classid", "clsid:884e2049-217d-11da-b2a4-000e7bbb2b09"); - elem1.setAttribute("style", "visibility: hidden"); - document.getElementsByTagName("body")[0].appendChild(elem1); - var elem2 = document.createElement('object'); - elem2.setAttribute("id", "webClassFactory"); - elem2.setAttribute("classid", "clsid:B04C8637-10BD-484E-B0DA-B8A039F60024"); - elem2.setAttribute("style", "visibility: hidden"); - document.getElementsByTagName("body")[0].appendChild(elem2); - } - } - - //Отправляем событие что все ок. - function plugin_loaded() - { - plugin_resolved = 1; - if(canPromise) - { - plugin_resolve(); - }else { - window.postMessage("cadesplugin_loaded", "*"); - } - } - - //Отправляем событие что сломались. - function plugin_loaded_error(msg) - { - if(isNativeMessageSupported()) - { - //в асинхронном варианте подключаем оба расширения, если сломались оба пробуем установить для Opera - failed_extensions++; - if(failed_extensions<2) - return; - if(isOpera && (typeof(msg) === 'undefined'|| typeof(msg) === 'object')) - { - install_opera_extension(); - return; - } - } - if(typeof(msg) === 'undefined' || typeof(msg) === 'object') - msg = "Плагин недоступен"; - plugin_resolved = 1; - if(canPromise) - { - plugin_reject(msg); - } else { - window.postMessage("cadesplugin_load_error", "*"); - } - } - - //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку - function check_load_timeout() - { - if(plugin_resolved === 1) - return; - if(isFireFox) - { - show_firefox_missing_extension_dialog(); - } - plugin_resolved = 1; - if(canPromise) - { - plugin_reject("Истекло время ожидания загрузки плагина"); - } else { - window.postMessage("cadesplugin_load_error", "*"); - } - - } - - //Вспомогательная функция для NPAPI - function createPromise(arg) - { - return new Promise(arg); - } - - function check_npapi_plugin (){ - try { - var oAbout = CreateObject("CAdESCOM.About"); - plugin_loaded(); - } - catch (err) { - document.getElementById("cadesplugin_object").style.display = 'none'; - // Объект создать не удалось, проверим, установлен ли - // вообще плагин. Такая возможность есть не во всех браузерах - var mimetype = navigator.mimeTypes["application/x-cades"]; - if (mimetype) { - var plugin = mimetype.enabledPlugin; - if (plugin) { - plugin_loaded_error("Плагин загружен, но не создаются обьекты"); - }else - { - plugin_loaded_error("Ошибка при загрузке плагина"); - } - }else - { - plugin_loaded_error("Плагин недоступен"); - } - } - } - - //Проверяем работает ли плагин - function check_plugin_working() - { - var div = document.createElement("div"); - div.innerHTML = ""; - var isIeLessThan9 = (div.getElementsByTagName("i").length === 1); - if (isIeLessThan9) { - plugin_loaded_error("Internet Explorer версии 8 и ниже не поддерживается"); - return; - } - - if(isNativeMessageSupported()) - { - load_extension(); - }else if(!canPromise) { - window.addEventListener("message", function (event){ - if (event.data !== "cadesplugin_echo_request") - return; - load_npapi_plugin(); - check_npapi_plugin(); - }, - false); - }else - { - if(document.readyState === "complete"){ - load_npapi_plugin(); - check_npapi_plugin(); - } else { - window.addEventListener("load", function (event) { - load_npapi_plugin(); - check_npapi_plugin(); - }, false); - } - } - } - - function set_pluginObject(obj) - { - pluginObject = obj; - } - - function is_capilite_enabled() - { - if ((typeof (cadesplugin.EnableInternalCSP) !== 'undefined') && cadesplugin.EnableInternalCSP) - return true; - return false; - }; - - //Export - cadesplugin.JSModuleVersion = "2.1.2"; - cadesplugin.async_spawn = async_spawn; - cadesplugin.set = set_pluginObject; - cadesplugin.set_log_level = set_log_level; - cadesplugin.getLastError = getLastError; - cadesplugin.is_capilite_enabled = is_capilite_enabled; - - if(isNativeMessageSupported()) - { - cadesplugin.CreateObjectAsync = CreateObjectAsync; - cadesplugin.ReleasePluginObjects = ReleasePluginObjects; - } - - if(!isNativeMessageSupported()) - { - cadesplugin.CreateObject = CreateObject; - } - - if(window.cadesplugin_load_timeout) - { - setTimeout(check_load_timeout, window.cadesplugin_load_timeout); - } - else - { - setTimeout(check_load_timeout, 20000); - } - - set_constantValues(); - - cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR; - window.cadesplugin = cadesplugin; - check_plugin_working(); -}()); - - -/***/ }) - -/******/ }); -}); -//# sourceMappingURL=crypto-pro.js.map \ No newline at end of file diff --git a/dist/crypto-pro.js.map b/dist/crypto-pro.js.map deleted file mode 100644 index f8c7554..0000000 --- a/dist/crypto-pro.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack://cryptoPro/webpack/universalModuleDefinition","webpack://cryptoPro/webpack/bootstrap","webpack://cryptoPro/../node_modules/base64-js/index.js","webpack://cryptoPro/../node_modules/buffer/index.js","webpack://cryptoPro/../node_modules/ieee754/index.js","webpack://cryptoPro/../node_modules/isarray/index.js","webpack://cryptoPro/../node_modules/webpack/buildin/global.js","webpack://cryptoPro/./api/certificate/certificate.ts","webpack://cryptoPro/./api/certificate/exportBase64.ts","webpack://cryptoPro/./api/certificate/getAlgorithm.ts","webpack://cryptoPro/./api/certificate/getCadesProp.ts","webpack://cryptoPro/./api/certificate/getDecodedExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/getExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/getInfo.ts","webpack://cryptoPro/./api/certificate/hasExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/index.ts","webpack://cryptoPro/./api/certificate/isValid.ts","webpack://cryptoPro/./api/createAttachedSignature.ts","webpack://cryptoPro/./api/createDetachedSignature.ts","webpack://cryptoPro/./api/createHash.ts","webpack://cryptoPro/./api/createSignature.ts","webpack://cryptoPro/./api/createXMLSignature.ts","webpack://cryptoPro/./api/getCertificate.ts","webpack://cryptoPro/./api/getSystemInfo.ts","webpack://cryptoPro/./api/getUserCertificates.ts","webpack://cryptoPro/./api/index.ts","webpack://cryptoPro/./api/isValidSystemSetup.ts","webpack://cryptoPro/./constants/cades-constants.ts","webpack://cryptoPro/./constants/index.ts","webpack://cryptoPro/./constants/issuer-tags-translations.ts","webpack://cryptoPro/./constants/oids-dictionary.ts","webpack://cryptoPro/./constants/subject-tags-translations.ts","webpack://cryptoPro/./crypto-pro.ts","webpack://cryptoPro/./helpers/_afterPluginsLoaded.ts","webpack://cryptoPro/./helpers/_extractCommonName.ts","webpack://cryptoPro/./helpers/_extractMeaningfulErrorMessage.ts","webpack://cryptoPro/./helpers/_generateCadesFn.ts","webpack://cryptoPro/./helpers/_getCadesCert.ts","webpack://cryptoPro/./helpers/_getDateObj.ts","webpack://cryptoPro/./helpers/_isSupportedCSPVersion.ts","webpack://cryptoPro/./helpers/_isSupportedCadesVersion.ts","webpack://cryptoPro/./helpers/_parseCertInfo.ts","webpack://cryptoPro/./vendor/cadesplugin_api.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;QCVA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFY;;AAEZ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kCAAkC,SAAS;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0CAA0C,UAAU;AACpD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;;;ACvJA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEY;;AAEZ,aAAa,mBAAO,CAAC,qDAAW;AAChC,cAAc,mBAAO,CAAC,iDAAS;AAC/B,cAAc,mBAAO,CAAC,iDAAS;;AAE/B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,mDAAmD;AACxE;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,UAAU;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,uCAAuC,SAAS;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gDAAgD,EAAE;AAClD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAwB,eAAe;AACvC;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,wBAAwB,QAAQ;AAChC;AACA,qBAAqB,eAAe;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,mBAAmB,cAAc;AACjC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uDAAuD,OAAO;AAC9D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA,uDAAuD,OAAO;AAC9D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,qBAAqB,QAAQ;AAC7B;AACA;AACA,GAAG;AACH;AACA,eAAe,SAAS;AACxB;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,YAAY;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,iBAAiB,gBAAgB;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,gBAAgB;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;;;;;;;AC5vDA;AACA;AACA;AACA;AACA;AAC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AAgB;AAChB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yDAAyD;AACzD;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sBAAsB;;AAEtB;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,iBAAiB,WAAW,UAAU,YAAY,aAAa;AAC3G,qFAAqF,aAAa,mBAAmB,uBAAuB,uBAAuB,cAAc,mBAAmB,YAAY;AAChN,4EAA4E,iBAAiB,yBAAyB,WAAW;AACjI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,iBAAiB,WAAW,UAAU,YAAY,aAAa;AAC/G,yFAAyF,aAAa,mBAAmB,uBAAuB,uBAAuB,cAAc,mBAAmB,YAAY;AACpN,gFAAgF,iBAAiB,yBAAyB,WAAW;AACrI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB,oCAAoC;AACpC,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,CAAC","file":"crypto-pro.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"cryptoPro\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"cryptoPro\"] = factory();\n\telse\n\t\troot[\"cryptoPro\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./crypto-pro.ts\");\n","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n","exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","import { ISSUER_TAGS_TRANSLATIONS, SUBJECT_TAGS_TRANSLATIONS } from '../../constants';\r\nimport { TagTranslation } from '../../helpers/_parseCertInfo';\r\nimport { exportBase64 } from './exportBase64';\r\nimport { getAlgorithm } from './getAlgorithm';\r\nimport { getCadesProp } from './getCadesProp';\r\nimport { getDecodedExtendedKeyUsage, ExtendedKeysTranslations } from './getDecodedExtendedKeyUsage';\r\nimport { getExtendedKeyUsage } from './getExtendedKeyUsage';\r\nimport { getInfo } from './getInfo';\r\nimport { hasExtendedKeyUsage } from './hasExtendedKeyUsage';\r\nimport { isValid } from './isValid';\r\n\r\nexport type CadesCertificate = any;\r\n\r\nexport class Certificate {\r\n constructor(\r\n public _cadesCertificate: CadesCertificate,\r\n public name: string,\r\n public issuerName: string,\r\n public subjectName: string,\r\n public thumbprint: string,\r\n public validFrom: string,\r\n public validTo: string,\r\n ) {}\r\n\r\n public getOwnerInfo(): Promise {\r\n return getInfo.call(this, SUBJECT_TAGS_TRANSLATIONS, 'SubjectName');\r\n }\r\n\r\n public getIssuerInfo(): Promise {\r\n return getInfo.call(this, ISSUER_TAGS_TRANSLATIONS, 'IssuerName');\r\n }\r\n\r\n public getExtendedKeyUsage(): Promise {\r\n return getExtendedKeyUsage.call(this);\r\n }\r\n\r\n public getDecodedExtendedKeyUsage(): Promise {\r\n return getDecodedExtendedKeyUsage.call(this);\r\n }\r\n\r\n public getAlgorithm(): Promise {\r\n return getAlgorithm.call(this);\r\n }\r\n\r\n public getCadesProp(propName): Promise {\r\n return getCadesProp.call(this, propName);\r\n }\r\n\r\n public isValid(): Promise {\r\n return isValid.call(this);\r\n }\r\n\r\n public exportBase64(): Promise {\r\n return exportBase64.call(this);\r\n }\r\n\r\n public hasExtendedKeyUsage(oids): Promise {\r\n return hasExtendedKeyUsage.call(this, oids);\r\n }\r\n}\r\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\r\nimport { Certificate } from './certificate';\r\n\r\n/**\r\n * Экспортирует сертификат в формате base64\r\n *\r\n * @returns сертификат в формате base64\r\n */\r\nexport const exportBase64 = _afterPluginsLoaded(function (): string {\r\n const cadesCertificate = (this as Certificate)._cadesCertificate;\r\n\r\n return eval(\r\n _generateCadesFn(function exportBase64(): string {\r\n let base64: string;\r\n\r\n try {\r\n base64 = __cadesAsyncToken__ + cadesCertificate.Export(0);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при экспорте сертификата');\r\n }\r\n\r\n return base64;\r\n }),\r\n );\r\n});\r\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\r\nimport { Certificate } from './certificate';\r\n\r\ninterface AlgorithmInfo {\r\n algorithm: string;\r\n oid: string;\r\n}\r\n\r\n/**\r\n * Возвращает информацию об алгоритме сертификата\r\n *\r\n * @returns информацию об алгоритме и его OID'е\r\n */\r\nexport const getAlgorithm = _afterPluginsLoaded(function (): AlgorithmInfo {\r\n const cadesCertificate = (this as Certificate)._cadesCertificate;\r\n\r\n return eval(\r\n _generateCadesFn(function getAlgorithm(): AlgorithmInfo {\r\n const algorithmInfo: AlgorithmInfo = {\r\n algorithm: null,\r\n oid: null,\r\n };\r\n let cadesPublicKey;\r\n\r\n try {\r\n cadesPublicKey = __cadesAsyncToken__ + cadesCertificate.PublicKey();\r\n cadesPublicKey = __cadesAsyncToken__ + cadesPublicKey.Algorithm;\r\n algorithmInfo.algorithm = __cadesAsyncToken__ + cadesPublicKey.FriendlyName;\r\n algorithmInfo.oid = __cadesAsyncToken__ + cadesPublicKey.Value;\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении алгоритма');\r\n }\r\n\r\n return algorithmInfo;\r\n }),\r\n );\r\n});\r\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\r\nimport { Certificate } from './certificate';\r\n\r\n/**\r\n * Возвращает указанное внутренее свойство у сертификата в формате Cades\r\n *\r\n * @param propName = наименование свойства\r\n * @returns значение запрошенного свойства\r\n */\r\nexport const getCadesProp = _afterPluginsLoaded(function (propName: string): any {\r\n const cadesCertificate = (this as Certificate)._cadesCertificate;\r\n\r\n return eval(\r\n _generateCadesFn(function getCadesProp() {\r\n let propertyValue;\r\n\r\n try {\r\n propertyValue = __cadesAsyncToken__ + cadesCertificate[propName];\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при обращении к свойству сертификата');\r\n }\r\n\r\n return propertyValue;\r\n }),\r\n );\r\n});\r\n","import { OIDS_DICTIONARY } from '../../constants';\r\nimport { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { Certificate } from './certificate';\r\n\r\nexport interface ExtendedKeysTranslations {\r\n [key: string]: string | null;\r\n}\r\n\r\n/**\r\n * Возвращает расшифрованные ОИД'ы сертификата\r\n *\r\n * @returns словарь расшифрованных ОИД'ов\r\n */\r\nexport const getDecodedExtendedKeyUsage = _afterPluginsLoaded(async function (): Promise {\r\n const certificateOids = await (this as Certificate).getExtendedKeyUsage();\r\n\r\n return certificateOids.reduce(\r\n (decodedOids, oidCode) => ({\r\n ...decodedOids,\r\n [oidCode]: OIDS_DICTIONARY[oidCode] || null,\r\n }),\r\n {},\r\n );\r\n});\r\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\r\nimport { Certificate } from './certificate';\r\n\r\n/**\r\n * Возвращает ОИД'ы сертификата\r\n *\r\n * @returns список ОИД'ов\r\n */\r\nexport const getExtendedKeyUsage = _afterPluginsLoaded(function (): string[] {\r\n const cadesCertificate = (this as Certificate)._cadesCertificate;\r\n\r\n return eval(\r\n _generateCadesFn(function getExtendedKeyUsage(): string[] {\r\n const OIDS: string[] = [];\r\n let count: any;\r\n\r\n try {\r\n count = __cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage();\r\n count = __cadesAsyncToken__ + count.EKUs;\r\n count = __cadesAsyncToken__ + count.Count;\r\n\r\n if (count > 0) {\r\n while (count > 0) {\r\n let cadesExtendedKeyUsage;\r\n\r\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage();\r\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.EKUs;\r\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.Item(count);\r\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.OID;\r\n\r\n OIDS.push(cadesExtendedKeyUsage);\r\n\r\n count--;\r\n }\r\n }\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || \"Ошибка при получении ОИД'ов\");\r\n }\r\n\r\n return OIDS;\r\n }),\r\n );\r\n});\r\n","import { TagsTranslations } from '../../constants/tags-translations';\r\nimport { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\r\nimport { _parseCertInfo, TagTranslation } from '../../helpers/_parseCertInfo';\r\nimport { getCadesProp } from './getCadesProp';\r\n\r\n/**\r\n * Возвращает расшифрованную информацию о сертификате из указанного свойства по тэгам\r\n *\r\n * @param tags = словарь\r\n * @param entitiesPath = путь к разбираемой сущности\r\n * @returns расшифрованная информация по отдельным тэгам\r\n */\r\nexport const getInfo = _afterPluginsLoaded(async function (\r\n tags: TagsTranslations[],\r\n entitiesPath: string,\r\n): Promise {\r\n let entities: string;\r\n\r\n try {\r\n entities = await getCadesProp.call(this, entitiesPath);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при извлечении информации из сертификата');\r\n }\r\n\r\n return _parseCertInfo(tags, entities);\r\n});\r\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { Certificate } from './certificate';\r\n\r\n/**\r\n * Проверяет наличие ОИД'а (ОИД'ов) у сертификата\r\n *\r\n * @param oids - ОИД'ы для проверки\r\n * @returns флаг наличия ОИД'ов у сертификата\r\n */\r\nexport const hasExtendedKeyUsage = _afterPluginsLoaded(async function (oids: string | string[]): Promise {\r\n const certOids = await (this as Certificate).getExtendedKeyUsage();\r\n\r\n let result: boolean;\r\n\r\n if (Array.isArray(oids)) {\r\n result = oids.every((oidToCheck) => certOids.some((certOid) => certOid === oidToCheck));\r\n } else {\r\n result = certOids.some((certOid) => certOid === oids);\r\n }\r\n\r\n return result;\r\n});\r\n","export * from './certificate';\r\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\r\nimport { Certificate } from './certificate';\r\n\r\n/**\r\n * Проверяет действительность сертификата\r\n *\r\n * @returns флаг валидности\r\n */\r\nexport const isValid = _afterPluginsLoaded(function (): boolean {\r\n const cadesCertificate = (this as Certificate)._cadesCertificate;\r\n\r\n return eval(\r\n _generateCadesFn(function isValid() {\r\n let isValid;\r\n\r\n try {\r\n isValid = __cadesAsyncToken__ + cadesCertificate.IsValid();\r\n isValid = __cadesAsyncToken__ + isValid.Result;\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при проверке сертификата');\r\n }\r\n\r\n return Boolean(isValid);\r\n }),\r\n );\r\n});\r\n","import { CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME } from '../constants';\r\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\nimport { _getCadesCert } from '../helpers/_getCadesCert';\r\nimport { _getDateObj } from '../helpers/_getDateObj';\r\n\r\n/**\r\n * Создает присоединенную подпись сообщения по отпечатку сертификата\r\n *\r\n * @param thumbprint - отпечаток сертификата\r\n * @param message - подписываемое сообщение\r\n * @returns подпись в формате PKCS#7\r\n */\r\nexport const createAttachedSignature = _afterPluginsLoaded(\r\n async (thumbprint: string, unencryptedMessage: string | ArrayBuffer): Promise => {\r\n const { cadesplugin } = window;\r\n const cadesCertificate = await _getCadesCert(thumbprint);\r\n\r\n return eval(\r\n _generateCadesFn(function createAttachedSignature(): string {\r\n let cadesAttrs;\r\n let cadesSignedData;\r\n let cadesSigner;\r\n\r\n try {\r\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\r\n cadesSignedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CadesSignedData');\r\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\r\n }\r\n\r\n const currentTime = _getDateObj(new Date());\r\n\r\n try {\r\n void (__cadesAsyncToken__ + cadesAttrs.propset_Name(CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME));\r\n void (__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи');\r\n }\r\n\r\n let messageBase64;\r\n\r\n try {\r\n messageBase64 = Buffer.from(unencryptedMessage).toString('base64');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error('Ошибка при преобразовании сообщения в Base64');\r\n }\r\n\r\n let cadesAuthAttrs;\r\n\r\n try {\r\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\r\n cadesAuthAttrs = __cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2;\r\n void (__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs));\r\n void (__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));\r\n void (__cadesAsyncToken__ + cadesSignedData.propset_Content(messageBase64));\r\n void (__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи');\r\n }\r\n\r\n let signature: string;\r\n\r\n try {\r\n signature = __cadesAsyncToken__ + cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_PKCS7_TYPE);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных');\r\n }\r\n\r\n return signature;\r\n }),\r\n );\r\n },\r\n);\r\n","import { CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME } from '../constants';\r\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\nimport { _getCadesCert } from '../helpers/_getCadesCert';\r\nimport { _getDateObj } from '../helpers/_getDateObj';\r\n\r\n/**\r\n * Создает отсоединенную подпись хеша по отпечатку сертификата\r\n *\r\n * @param thumbprint - отпечаток сертификата\r\n * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11-2012 256 бит\r\n * @returns подпись в формате PKCS#7\r\n */\r\nexport const createDetachedSignature = _afterPluginsLoaded(\r\n async (thumbprint: string, messageHash: string): Promise => {\r\n const { cadesplugin } = window;\r\n const cadesCertificate = await _getCadesCert(thumbprint);\r\n\r\n return eval(\r\n _generateCadesFn(function createDetachedSignature(): string {\r\n let cadesAttrs;\r\n let cadesHashedData;\r\n let cadesSignedData;\r\n let cadesSigner;\r\n\r\n try {\r\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\r\n cadesHashedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.HashedData');\r\n cadesSignedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CadesSignedData');\r\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\r\n }\r\n\r\n const currentTime = _getDateObj(new Date());\r\n\r\n try {\r\n void (__cadesAsyncToken__ + cadesAttrs.propset_Name(CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME));\r\n void (__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи');\r\n }\r\n\r\n let cadesAuthAttrs;\r\n\r\n try {\r\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\r\n cadesAuthAttrs = __cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2;\r\n void (__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs));\r\n void (__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке сертификата');\r\n }\r\n\r\n try {\r\n void (\r\n __cadesAsyncToken__ +\r\n cadesHashedData.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256)\r\n );\r\n void (__cadesAsyncToken__ + cadesHashedData.SetHashValue(messageHash));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке хеша');\r\n }\r\n\r\n let signature: string;\r\n\r\n try {\r\n signature =\r\n __cadesAsyncToken__ +\r\n cadesSignedData.SignHash(cadesHashedData, cadesSigner, cadesplugin.CADESCOM_PKCS7_TYPE);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных');\r\n }\r\n\r\n return signature;\r\n }),\r\n );\r\n },\r\n);\r\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\n\r\n/**\r\n * Создает хеш сообщения по ГОСТ Р 34.11-2012 256 бит\r\n * https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%B8%D0%B1%D0%BE%D0%B3_(%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F)\r\n *\r\n * @param unencryptedMessage - сообщение для хеширования\r\n *\r\n * @returns хеш\r\n */\r\nexport const createHash = _afterPluginsLoaded(\r\n async (unencryptedMessage: string | ArrayBuffer): Promise => {\r\n const { cadesplugin } = window;\r\n\r\n return eval(\r\n _generateCadesFn(function createHash(): string {\r\n const cadesHashedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.HashedData');\r\n let messageBase64;\r\n let hash;\r\n\r\n try {\r\n messageBase64 = Buffer.from(unencryptedMessage).toString('base64');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error('Ошибка при преобразовании сообщения в Base64');\r\n }\r\n\r\n try {\r\n void (\r\n __cadesAsyncToken__ +\r\n cadesHashedData.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256)\r\n );\r\n void (__cadesAsyncToken__ + cadesHashedData.propset_DataEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));\r\n void (__cadesAsyncToken__ + cadesHashedData.Hash(messageBase64));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации хэширования');\r\n }\r\n\r\n try {\r\n hash = __cadesAsyncToken__ + cadesHashedData.Value;\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при создании хэша');\r\n }\r\n\r\n return hash;\r\n }),\r\n );\r\n },\r\n);\r\n","import { CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME } from '../constants';\r\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\nimport { _getCadesCert } from '../helpers/_getCadesCert';\r\nimport { _getDateObj } from '../helpers/_getDateObj';\r\n\r\n/**\r\n * Создает подпись base64 строки по отпечатку сертификата\r\n *\r\n * @param thumbprint - отпечаток сертификата\r\n * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11\r\n * @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false)\r\n * @returns подпись\r\n */\r\nexport const createSignature = _afterPluginsLoaded(\r\n async (thumbprint: string, messageHash: string, detachedSignature: boolean = true): Promise => {\r\n console.warn(\r\n [\r\n 'cryptoPro: Метод \"createSignature\" является устаревшим и будет убран из будущих версий.',\r\n 'Используйте \"createAttachedSignature\" и \"createDetachedSignature\".',\r\n ].join('\\n'),\r\n );\r\n\r\n const { cadesplugin } = window;\r\n const cadesCertificate = await _getCadesCert(thumbprint);\r\n\r\n return eval(\r\n _generateCadesFn(function createSignature(): string {\r\n let cadesAttrs;\r\n let cadesSignedData;\r\n let cadesSigner;\r\n\r\n try {\r\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\r\n cadesSignedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CadesSignedData');\r\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\r\n }\r\n\r\n const currentTime = _getDateObj(new Date());\r\n\r\n try {\r\n void (__cadesAsyncToken__ + cadesAttrs.propset_Name(CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME));\r\n void (__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи');\r\n }\r\n\r\n let cadesAuthAttrs;\r\n\r\n try {\r\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\r\n cadesAuthAttrs = __cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2;\r\n void (__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs));\r\n void (__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));\r\n void (__cadesAsyncToken__ + cadesSignedData.propset_Content(messageHash));\r\n void (\r\n __cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY)\r\n );\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи');\r\n }\r\n\r\n let signature: string;\r\n\r\n try {\r\n signature =\r\n __cadesAsyncToken__ +\r\n cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_CADES_BES, detachedSignature);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных');\r\n }\r\n\r\n return signature;\r\n }),\r\n );\r\n },\r\n);\r\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\nimport { _getCadesCert } from '../helpers/_getCadesCert';\r\n\r\n/**\r\n * Создает XML подпись для документа в формате XML\r\n *\r\n * @param thumbprint - отпечаток сертификата\r\n * @param unencryptedMessage - подписываемое сообщение в формате XML\r\n * @returns подпись\r\n */\r\nexport const createXMLSignature = _afterPluginsLoaded(\r\n async (thumbprint: string, unencryptedMessage: string): Promise => {\r\n const { cadesplugin } = window;\r\n const cadesCertificate = await _getCadesCert(thumbprint);\r\n\r\n return eval(\r\n _generateCadesFn(function createXMLSignature(): string {\r\n let cadesSigner;\r\n let cadesSignedXML;\r\n\r\n try {\r\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\r\n cadesSignedXML = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.SignedXML');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\r\n }\r\n\r\n try {\r\n const signatureMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256';\r\n const digestMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256';\r\n\r\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\r\n void (__cadesAsyncToken__ + cadesSigner.propset_CheckCertificate(true));\r\n void (__cadesAsyncToken__ + cadesSignedXML.propset_Content(unencryptedMessage));\r\n void (\r\n __cadesAsyncToken__ +\r\n cadesSignedXML.propset_SignatureType(cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED)\r\n );\r\n void (__cadesAsyncToken__ + cadesSignedXML.propset_SignatureMethod(signatureMethod));\r\n void (__cadesAsyncToken__ + cadesSignedXML.propset_DigestMethod(digestMethod));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи');\r\n }\r\n\r\n let signature: string;\r\n\r\n try {\r\n signature = __cadesAsyncToken__ + cadesSignedXML.Sign(cadesSigner);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных');\r\n }\r\n\r\n return signature;\r\n }),\r\n );\r\n },\r\n);\r\n","import { Certificate } from './certificate';\r\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { getUserCertificates } from './getUserCertificates';\r\n\r\n/**\r\n * Возвращает сертификат по отпечатку\r\n *\r\n * @param thumbprint - отпечаток сертификата\r\n * @returns сертификат\r\n */\r\nexport const getCertificate = _afterPluginsLoaded(\r\n async (thumbprint: string): Promise => {\r\n if (!thumbprint) {\r\n throw new Error('Отпечаток не указан');\r\n }\r\n\r\n const availableCertificates: Certificate[] = await getUserCertificates();\r\n const foundCertificate: Certificate = availableCertificates.find((cert) => cert.thumbprint === thumbprint);\r\n\r\n if (!foundCertificate) {\r\n throw new Error(`Сертификат с отпечатком: \"${thumbprint}\" не найден`);\r\n }\r\n\r\n return foundCertificate;\r\n },\r\n);\r\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\n\r\nexport interface SystemInfo {\r\n cadesVersion: string;\r\n cspVersion: string;\r\n}\r\n\r\n/**\r\n * Предоставляет информацию о системе\r\n *\r\n * @returns информацию о CSP и плагине\r\n */\r\nexport const getSystemInfo = _afterPluginsLoaded(\r\n (): SystemInfo => {\r\n const sysInfo = {\r\n cadesVersion: null,\r\n cspVersion: null,\r\n };\r\n\r\n return eval(\r\n _generateCadesFn(function getSystemInfo(): SystemInfo {\r\n let cadesAbout;\r\n\r\n try {\r\n cadesAbout = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.About');\r\n\r\n sysInfo.cadesVersion = __cadesAsyncToken__ + cadesAbout.PluginVersion;\r\n sysInfo.cspVersion = __cadesAsyncToken__ + cadesAbout.CSPVersion();\r\n\r\n if (!sysInfo.cadesVersion) {\r\n sysInfo.cadesVersion = __cadesAsyncToken__ + cadesAbout.Version;\r\n }\r\n\r\n sysInfo.cadesVersion = __cadesAsyncToken__ + sysInfo.cadesVersion.toString();\r\n sysInfo.cspVersion = __cadesAsyncToken__ + sysInfo.cspVersion.toString();\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении информации о системе');\r\n }\r\n\r\n return sysInfo;\r\n }),\r\n );\r\n },\r\n);\r\n","import { CadesCertificate, Certificate } from './certificate';\r\nimport { CAPICOM_PROPID_KEY_PROV_INFO } from '../constants';\r\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractCommonName } from '../helpers/_extractCommonName';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\n\r\nlet certificatesCache: Certificate[];\r\n\r\n/**\r\n * Возвращает список сертификатов, доступных пользователю в системе\r\n *\r\n * @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов\r\n * @returns список сертификатов\r\n */\r\nexport const getUserCertificates = _afterPluginsLoaded((resetCache: boolean = false): Certificate[] => {\r\n const { cadesplugin } = window;\r\n\r\n if (!resetCache && certificatesCache) {\r\n return certificatesCache;\r\n }\r\n\r\n return eval(\r\n _generateCadesFn(function getUserCertificates(): Certificate[] {\r\n let cadesStore;\r\n\r\n try {\r\n cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');\r\n }\r\n\r\n try {\r\n void (\r\n __cadesAsyncToken__ +\r\n cadesStore.Open(\r\n cadesplugin.CAPICOM_CURRENT_USER_STORE,\r\n cadesplugin.CAPICOM_MY_STORE,\r\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,\r\n )\r\n );\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');\r\n }\r\n\r\n let cadesCertificates;\r\n let cadesCertificatesCount;\r\n\r\n try {\r\n cadesCertificates = __cadesAsyncToken__ + cadesStore.Certificates;\r\n\r\n if (cadesCertificates) {\r\n cadesCertificates =\r\n __cadesAsyncToken__ + cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID);\r\n\r\n /**\r\n * Не рассматриваются сертификаты, в которых отсутствует закрытый ключ\r\n * или не действительны на данный момент\r\n */\r\n cadesCertificates =\r\n __cadesAsyncToken__ +\r\n cadesCertificates.Find(\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY,\r\n CAPICOM_PROPID_KEY_PROV_INFO,\r\n );\r\n\r\n cadesCertificatesCount = __cadesAsyncToken__ + cadesCertificates.Count;\r\n }\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');\r\n }\r\n\r\n if (!cadesCertificatesCount) {\r\n throw new Error('Нет доступных сертификатов');\r\n }\r\n\r\n const certificateList: Certificate[] = [];\r\n\r\n try {\r\n while (cadesCertificatesCount) {\r\n const cadesCertificate: CadesCertificate =\r\n __cadesAsyncToken__ + cadesCertificates.Item(cadesCertificatesCount);\r\n\r\n certificateList.push(\r\n new Certificate(\r\n cadesCertificate,\r\n _extractCommonName(__cadesAsyncToken__ + cadesCertificate.SubjectName),\r\n __cadesAsyncToken__ + cadesCertificate.IssuerName,\r\n __cadesAsyncToken__ + cadesCertificate.SubjectName,\r\n __cadesAsyncToken__ + cadesCertificate.Thumbprint,\r\n __cadesAsyncToken__ + cadesCertificate.ValidFromDate,\r\n __cadesAsyncToken__ + cadesCertificate.ValidToDate,\r\n ),\r\n );\r\n\r\n cadesCertificatesCount--;\r\n }\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка обработки сертификатов');\r\n }\r\n\r\n cadesStore.Close();\r\n\r\n certificatesCache = certificateList;\r\n\r\n return certificatesCache;\r\n }),\r\n );\r\n});\r\n","export * from './getCertificate';\r\nexport * from './getUserCertificates';\r\nexport * from './getSystemInfo';\r\nexport * from './isValidSystemSetup';\r\nexport * from './createSignature';\r\nexport * from './createXMLSignature';\r\nexport * from './createDetachedSignature';\r\nexport * from './createAttachedSignature';\r\nexport * from './createHash';\r\nexport * from './certificate';\r\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { _isSupportedCadesVersion } from '../helpers/_isSupportedCadesVersion';\r\nimport { _isSupportedCSPVersion } from '../helpers/_isSupportedCSPVersion';\r\nimport { getSystemInfo, SystemInfo } from './getSystemInfo';\r\n\r\n/**\r\n * Проверяет корректность настроек ЭП на машине\r\n *\r\n * @returns флаг корректности настроек\r\n */\r\nexport const isValidSystemSetup = _afterPluginsLoaded(\r\n async (): Promise => {\r\n let systemInfo: SystemInfo;\r\n\r\n try {\r\n systemInfo = await getSystemInfo();\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Настройки ЭП на данной машине не верны');\r\n }\r\n\r\n if (!_isSupportedCadesVersion(systemInfo.cadesVersion)) {\r\n throw new Error('Не поддерживаемая версия плагина');\r\n }\r\n\r\n if (!_isSupportedCSPVersion(systemInfo.cspVersion)) {\r\n throw new Error('Не поддерживаемая версия CSP');\r\n }\r\n\r\n return true;\r\n },\r\n);\r\n","export const CADESCOM_ATTRIBUTE_OTHER = -1;\r\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\r\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\r\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\r\nexport const CADESCOM_AllowNoOutstandingRequest = 1;\r\nexport const CADESCOM_AllowNone = 0;\r\nexport const CADESCOM_AllowUntrustedCertificate = 2;\r\nexport const CADESCOM_AllowUntrustedRoot = 4;\r\nexport const CADESCOM_BASE64_TO_BINARY = 0x01;\r\nexport const CADESCOM_CADES_BES = 1;\r\nexport const CADESCOM_CADES_DEFAULT = 0;\r\nexport const CADESCOM_CADES_T = 5;\r\nexport const CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;\r\nexport const CADESCOM_CONTAINER_STORE = 100;\r\nexport const CADESCOM_CURRENT_USER_STORE = 2;\r\nexport const CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;\r\nexport const CADESCOM_DISPLAY_DATA_CONTENT = 1;\r\nexport const CADESCOM_DISPLAY_DATA_NONE = 0;\r\nexport const CADESCOM_ENCODE_ANY = -1;\r\nexport const CADESCOM_ENCODE_BASE64 = 0;\r\nexport const CADESCOM_ENCODE_BINARY = 1;\r\nexport const CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;\r\nexport const CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;\r\nexport const CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;\r\nexport const CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;\r\nexport const CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;\r\nexport const CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;\r\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;\r\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;\r\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111;\r\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;\r\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112;\r\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110;\r\nexport const CADESCOM_HASH_ALGORITHM_MD2 = 1;\r\nexport const CADESCOM_HASH_ALGORITHM_MD4 = 2;\r\nexport const CADESCOM_HASH_ALGORITHM_MD5 = 3;\r\nexport const CADESCOM_HASH_ALGORITHM_SHA1 = 0;\r\nexport const CADESCOM_HASH_ALGORITHM_SHA_256 = 4;\r\nexport const CADESCOM_HASH_ALGORITHM_SHA_384 = 5;\r\nexport const CADESCOM_HASH_ALGORITHM_SHA_512 = 6;\r\nexport const CADESCOM_LOCAL_MACHINE_STORE = 1;\r\nexport const CADESCOM_PKCS7_TYPE = 65535;\r\nexport const CADESCOM_STRING_TO_UCS2LE = 0x00;\r\nexport const CADESCOM_SkipInstallToStore = 268435456;\r\nexport const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;\r\nexport const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;\r\nexport const CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;\r\nexport const CAPICOM_ACTIVE_DIRECTORY_USER_STORE = 3;\r\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\r\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\r\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\r\nexport const CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;\r\nexport const CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;\r\nexport const CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;\r\nexport const CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;\r\nexport const CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;\r\nexport const CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;\r\nexport const CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;\r\nexport const CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;\r\nexport const CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\r\nexport const CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;\r\nexport const CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;\r\nexport const CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;\r\nexport const CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;\r\nexport const CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;\r\nexport const CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;\r\nexport const CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;\r\nexport const CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;\r\nexport const CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;\r\nexport const CAPICOM_CURRENT_USER_STORE = 2;\r\nexport const CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;\r\nexport const CAPICOM_EKU_CLIENT_AUTH = 2;\r\nexport const CAPICOM_EKU_OTHER = 0;\r\nexport const CAPICOM_EKU_SMARTCARD_LOGON = 5;\r\nexport const CAPICOM_LOCAL_MACHINE_STORE = 1;\r\nexport const CAPICOM_MEMORY_STORE = 0;\r\nexport const CAPICOM_MY_STORE = 'My';\r\nexport const CAPICOM_OID_KEY_USAGE_EXTENSION = 10;\r\nexport const CAPICOM_OID_OTHER = 0;\r\nexport const CAPICOM_PROPID_ACCESS_STATE = 14;\r\nexport const CAPICOM_PROPID_ARCHIVED = 19;\r\nexport const CAPICOM_PROPID_ARCHIVED_KEY_HASH = 65;\r\nexport const CAPICOM_PROPID_AUTO_ENROLL = 21;\r\nexport const CAPICOM_PROPID_CROSS_CERT_DIST_POINTS = 23;\r\nexport const CAPICOM_PROPID_CTL_USAGE = 9;\r\nexport const CAPICOM_PROPID_DATE_STAMP = 27;\r\nexport const CAPICOM_PROPID_DESCRIPTION = 13;\r\nexport const CAPICOM_PROPID_EFS = 17;\r\nexport const CAPICOM_PROPID_ENHKEY_USAGE = 9;\r\nexport const CAPICOM_PROPID_ENROLLMENT = 26;\r\nexport const CAPICOM_PROPID_EXTENDED_ERROR_INFO = 30;\r\nexport const CAPICOM_PROPID_FIRST_RESERVED = 66;\r\nexport const CAPICOM_PROPID_FIRST_USER = 0x00008000;\r\nexport const CAPICOM_PROPID_FORTEZZA_DATA = 18;\r\nexport const CAPICOM_PROPID_FRIENDLY_NAME = 11;\r\nexport const CAPICOM_PROPID_HASH_PROP = 3;\r\nexport const CAPICOM_PROPID_IE30_RESERVED = 7;\r\nexport const CAPICOM_PROPID_ISSUER_PUBLIC_KEY_MD5_HASH = 24;\r\nexport const CAPICOM_PROPID_ISSUER_SERIAL_NUMBER_MD5_HASH = 28;\r\nexport const CAPICOM_PROPID_KEY_CONTEXT = 5;\r\nexport const CAPICOM_PROPID_KEY_IDENTIFIER = 20;\r\nexport const CAPICOM_PROPID_KEY_PROV_HANDLE = 1;\r\nexport const CAPICOM_PROPID_KEY_PROV_INFO = 2;\r\nexport const CAPICOM_PROPID_KEY_SPEC = 6;\r\nexport const CAPICOM_PROPID_LAST_RESERVED = 0x00007fff;\r\nexport const CAPICOM_PROPID_LAST_USER = 0x0000ffff;\r\nexport const CAPICOM_PROPID_MD5_HASH = 4;\r\nexport const CAPICOM_PROPID_NEXT_UPDATE_LOCATION = 10;\r\nexport const CAPICOM_PROPID_PUBKEY_ALG_PARA = 22;\r\nexport const CAPICOM_PROPID_PUBKEY_HASH_RESERVED = 8;\r\nexport const CAPICOM_PROPID_PVK_FILE = 12;\r\nexport const CAPICOM_PROPID_RENEWAL = 64;\r\nexport const CAPICOM_PROPID_SHA1_HASH = 3;\r\nexport const CAPICOM_PROPID_SIGNATURE_HASH = 15;\r\nexport const CAPICOM_PROPID_SMART_CARD_DATA = 16;\r\nexport const CAPICOM_PROPID_SUBJECT_NAME_MD5_HASH = 29;\r\nexport const CAPICOM_PROPID_SUBJECT_PUBLIC_KEY_MD5_HASH = 25;\r\nexport const CAPICOM_PROPID_UNKNOWN = 0;\r\nexport const CAPICOM_SMART_CARD_USER_STORE = 4;\r\nexport const CAPICOM_STORE_OPEN_EXISTING_ONLY = 128;\r\nexport const CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED = 256;\r\nexport const CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;\r\nexport const CAPICOM_STORE_OPEN_READ_ONLY = 0;\r\nexport const CAPICOM_STORE_OPEN_READ_WRITE = 1;\r\nexport const CHECK_NONE = 0;\r\nexport const CHECK_OFFLINE_REVOCATION_STATUS = 16;\r\nexport const CHECK_ONLINE_REVOCATION_STATUS = 8;\r\nexport const CHECK_SIGNATURE_VALIDITY = 4;\r\nexport const CHECK_TIME_VALIDITY = 2;\r\nexport const CHECK_TRUSTED_ROOT = 1;\r\nexport const LOG_LEVEL_DEBUG = 4;\r\nexport const LOG_LEVEL_ERROR = 1;\r\nexport const LOG_LEVEL_INFO = 2;\r\nexport const TRUST_CTL_IS_NOT_SIGNATURE_VALID = 262144;\r\nexport const TRUST_CTL_IS_NOT_TIME_VALID = 131072;\r\nexport const TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 524288;\r\nexport const TRUST_IS_CYCLIC = 128;\r\nexport const TRUST_IS_NOT_SIGNATURE_VALID = 8;\r\nexport const TRUST_IS_NOT_TIME_NESTED = 2;\r\nexport const TRUST_IS_NOT_TIME_VALID = 1;\r\nexport const TRUST_IS_NOT_VALID_FOR_USAGE = 16;\r\nexport const TRUST_IS_PARTIAL_CHAIN = 65536;\r\nexport const TRUST_IS_REVOKED = 4;\r\nexport const TRUST_IS_UNTRUSTED_ROOT = 32;\r\nexport const TRUST_REVOCATION_STATUS_UNKNOWN = 64;\r\nexport const XmlDsigGost3410Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411';\r\nexport const XmlDsigGost3410UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411';\r\nexport const XmlDsigGost3411Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411';\r\nexport const XmlDsigGost3411UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr3411';\r\n","export * from './cades-constants';\r\nexport * from './issuer-tags-translations';\r\nexport * from './oids-dictionary';\r\nexport * from './subject-tags-translations';\r\n","import { TagsTranslations } from './tags-translations';\r\n\r\nexport const ISSUER_TAGS_TRANSLATIONS: TagsTranslations[] = [\r\n { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' },\r\n { possibleNames: ['CN'], translation: 'Удостоверяющий центр' },\r\n { possibleNames: ['C'], translation: 'Страна' },\r\n { possibleNames: ['S'], translation: 'Регион' },\r\n { possibleNames: ['STREET'], translation: 'Адрес' },\r\n { possibleNames: ['O'], translation: 'Компания' },\r\n { possibleNames: ['OU'], translation: 'Тип' },\r\n { possibleNames: ['T'], translation: 'Должность' },\r\n { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },\r\n { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },\r\n { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },\r\n { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },\r\n { possibleNames: ['E'], translation: 'Email' },\r\n { possibleNames: ['L'], translation: 'Город' },\r\n];\r\n","export const OIDS_DICTIONARY = {\r\n '1.2.643.2.2.34.6': 'Пользователь Центра Регистрации',\r\n '1.2.643.2.39.1.1': 'Использование в программных продуктах системы \"1С:Предприятие 8\"',\r\n '1.2.643.3.131.1.1': 'ИНН',\r\n '1.2.643.3.141.1.1': 'РНС ФСС',\r\n '1.2.643.3.141.1.2': 'КП ФСС',\r\n '1.2.643.3.2.100.65.13.11': 'Использование в системе АИС \"Госзакупки\" Сахалинской области.',\r\n '1.2.643.3.8.100.1': 'Сертификат типа \"ekey-ГОСТ\"',\r\n '1.2.643.3.8.100.1.1': 'Общее использование в системах ИОК без права заверения финансовых документов',\r\n '1.2.643.3.8.100.1.10':\r\n 'Для участия в электронных торгах и подписания государственного контракта в информационных системах Тендерного комитета города Москвы уполномоченными лицами участников размещения государственного заказа города Москвы',\r\n '1.2.643.3.8.100.1.11':\r\n 'Подписание электронных документов в автоматизированной информационной системе размещения государственного и муниципального заказа Саратовской области',\r\n '1.2.643.3.8.100.1.12': 'Использование в системе государственного заказа Иркутской области',\r\n '1.2.643.3.8.100.1.13':\r\n 'Использование в электронной торговой площадке агентства государственного заказа Красноярского края',\r\n '1.2.643.3.8.100.1.14': 'Использование в электронной торговой площадке \"Тендер\"',\r\n '1.2.643.3.8.100.1.2': 'Передача отчетности по ТКС',\r\n '1.2.643.3.8.100.1.3': 'Оформление взаимных обязательств, соглашений, договоров, актов и т.п.',\r\n '1.2.643.3.8.100.1.4': 'Внутрикорпоративный документооборот',\r\n '1.2.643.3.8.100.1.5': 'Использование в системах электронной торговли',\r\n '1.2.643.3.8.100.1.6': 'Использование в торгово-закупочной системе \"ЭЛЕКТРА\"',\r\n '1.2.643.3.8.100.1.7': 'Использование в системе Портал государственных закупок Ставропольского края.',\r\n '1.2.643.3.8.100.1.8': 'Использование в Единой системе электронной торговли B2B-Center и B2G.',\r\n '1.2.643.3.8.100.1.9':\r\n 'Для участия в электронных торгах и подписания государственного контракта в электронной площадке ОАО «ЕЭТП» уполномоченными лицами участников размещения государственного или муниципального заказа',\r\n '1.2.643.5.1.24.2.1.3':\r\n 'Формирование документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя',\r\n '1.2.643.5.1.24.2.1.3.1':\r\n 'Формирование кадастровым инженером документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя',\r\n '1.2.643.5.1.24.2.2.2': 'Формирование документов как результата оказания услуги со стороны органов регистрации прав',\r\n '1.2.643.5.1.24.2.2.3':\r\n 'Формирование документов для получения государственных услуг в сфере государственной регистрации прав на недвижимое имущество и сделок с ним со стороны заявителя',\r\n '1.2.643.6.2.1.7.1':\r\n 'Использование единоличным исполнительным органом юридического лица или уполномоченными представителями юридического лица в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских и иных прав и обязанностей в сфере негосударственного пенсионного обеспечения, негосударственного пенсионного страхования, в сфере деятельности паевых инвестиционных фондов, акционерных инвестиционных фондов, профессиональных участников рынка ценных бумаг, а также связанной с обслуживанием указанной деятельности услуг кредитных и иных организаций',\r\n '1.2.643.6.2.1.7.2':\r\n 'Использование физическим лицом в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских прав и обязанностей в отношении инвестиционных паев паевых инвестиционных фондов, в том числе отношения, связанные с учетом и/или фиксацией прав на инвестиционные паи паевых инвестиционных фондов',\r\n '1.2.643.6.3':\r\n 'Использование в электронных торговых системах и в программном обеспечении, связанным с обменом электронных сообщений',\r\n '1.2.643.6.3.1.1': 'Использование на электронных площадок отобранных для проведения аукционах в электронной форме',\r\n '1.2.643.6.3.1.2.1': 'Тип участника - Юридическое лицо',\r\n '1.2.643.6.3.1.2.2': 'Тип участника - Физическое лицо',\r\n '1.2.643.6.3.1.2.3': 'Тип участника - Индивидуальный предприниматель',\r\n '1.2.643.6.3.1.3.1': 'Участник размещения заказа',\r\n '1.2.643.6.3.1.4.1': 'Администратор организации',\r\n '1.2.643.6.3.1.4.2': 'Уполномоченный специалист',\r\n '1.2.643.6.3.1.4.3': 'Специалист с правом подписи контракта',\r\n '1.2.840.113549.1.9.2': 'Неструктурированное имя',\r\n '1.3.6.1.4.1.24138.1.1.8.1': 'Обеспечение юридической значимости в Системе \"Электронная Торговая Площадка\"',\r\n '1.3.6.1.4.1.29919.21': 'Использование в системе Портал государственных закупок Ростовской области \"Рефери\".',\r\n '1.3.6.1.5.5.7.3.2': 'Проверка подлинности клиента',\r\n '1.3.6.1.5.5.7.3.4': 'Защищенная электронная почта',\r\n '1.3.643.3.8.100.15': 'Использование в ЭТП \"uTender\"',\r\n};\r\n","import { TagsTranslations } from './tags-translations';\r\n\r\nexport const SUBJECT_TAGS_TRANSLATIONS: TagsTranslations[] = [\r\n { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' },\r\n { possibleNames: ['CN'], translation: 'Владелец' },\r\n { possibleNames: ['SN'], translation: 'Фамилия' },\r\n { possibleNames: ['G'], translation: 'Имя Отчество' },\r\n { possibleNames: ['C'], translation: 'Страна' },\r\n { possibleNames: ['S'], translation: 'Регион' },\r\n { possibleNames: ['STREET'], translation: 'Адрес' },\r\n { possibleNames: ['O'], translation: 'Компания' },\r\n { possibleNames: ['OU'], translation: 'Отдел/подразделение' },\r\n { possibleNames: ['T'], translation: 'Должность' },\r\n { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },\r\n { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },\r\n { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },\r\n { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },\r\n { possibleNames: ['E'], translation: 'Email' },\r\n { possibleNames: ['L'], translation: 'Город' },\r\n];\r\n","export * from './api';\r\n","import { _extractMeaningfulErrorMessage } from './_extractMeaningfulErrorMessage';\r\n\r\ntype Unpromisify = T extends Promise ? R : T;\r\n\r\nlet isSetLogLevel = false;\r\nlet isPluginLoaded = false;\r\n\r\nexport const _afterPluginsLoaded = any>(\r\n fn: T,\r\n): ((...args: Parameters) => Promise>>) => {\r\n const canPromise = Boolean(window.Promise);\r\n\r\n return async function (...args: Parameters): Promise>> {\r\n if (!isPluginLoaded) {\r\n try {\r\n require('../vendor/cadesplugin_api');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(\r\n _extractMeaningfulErrorMessage(error) || 'Ошибка при подключении модуля для работы с Cades plugin',\r\n );\r\n }\r\n\r\n isPluginLoaded = true;\r\n }\r\n\r\n const { cadesplugin } = window;\r\n\r\n if (!canPromise) {\r\n throw new Error('Необходим полифилл для Promise');\r\n }\r\n\r\n if (!cadesplugin) {\r\n throw new Error('Не подключен модуль для работы с Cades plugin');\r\n }\r\n\r\n if (!isSetLogLevel) {\r\n cadesplugin.set_log_level(cadesplugin.LOG_LEVEL_ERROR);\r\n\r\n isSetLogLevel = true;\r\n }\r\n\r\n try {\r\n await cadesplugin;\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(\r\n _extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации модуля для работы с Cades plugin',\r\n );\r\n }\r\n\r\n return await fn.apply(this, args);\r\n };\r\n};\r\n","export const _extractCommonName = (subjectName: string): string | undefined =>\r\n subjectName.match(/CN=(.+?)(?:,|$)/)?.[1];\r\n","export const _extractMeaningfulErrorMessage = (error: Error): string | null => {\n let errorContainer = window.cadesplugin?.getLastError && window.cadesplugin.getLastError(error);\n\n if (!errorContainer?.message) {\n if (!error.message) {\n return null;\n }\n\n errorContainer = error;\n }\n\n const containsRussianLetters = /[а-яА-Я]/.test(errorContainer.message);\n\n if (!containsRussianLetters) {\n return null;\n }\n\n const searchResult = errorContainer.message.match(/^(.*?)(?:(?:\\.?\\s?\\(?(0x[0-9a-zA-Z]{1,8})\\))|(?:\\.?$))/);\n\n return (searchResult ? searchResult[1] + (searchResult[2] ? '. Код ошибки: ' + searchResult[2] : '') : null);\n};\n","// синтетические переменные, которые подменяются в рантайме\r\nexport const __cadesAsyncToken__ = {};\r\nexport const __createCadesPluginObject__ = (...args): any => ({});\r\n\r\nfunction getGeneratorConstructor(): GeneratorFunction {\r\n return new Function('', 'return Object.getPrototypeOf(function*(){}).constructor')();\r\n}\r\n\r\nexport const _generateCadesFn = (callback: Function): string => {\r\n const { cadesplugin } = window;\r\n const cadesGeneratorsAPI = Boolean(cadesplugin.CreateObjectAsync);\r\n const callbackName = callback.name || 'dynamicFn';\r\n const callbackLiteral = String(callback);\r\n const callbackArguments = callbackLiteral.match(/^function[\\s\\w]*?\\((.*?)\\)/)?.[1] || '';\r\n const callbackBody = callbackLiteral.replace(/^.*?{([\\s\\S]*?)}$/, '$1');\r\n let crossEnvCallbackLiteral = String(\r\n new (cadesGeneratorsAPI ? getGeneratorConstructor() : Function)(callbackArguments, callbackBody),\r\n );\r\n\r\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(\r\n /\\w+?\\.__createCadesPluginObject__(\\([\\s\\S]*?\\))/gm,\r\n `cadesplugin.CreateObject${cadesGeneratorsAPI ? 'Async' : ''}$1`,\r\n );\r\n\r\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(\r\n /\\w+?\\.__cadesAsyncToken__\\s*?\\+\\s*?\\b/gm,\r\n cadesGeneratorsAPI ? 'yield ' : '',\r\n );\r\n\r\n if (!cadesGeneratorsAPI) {\r\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/propset_(.*?)\\((.*?)\\)/gm, '$1 = $2');\r\n }\r\n\r\n return [\r\n cadesGeneratorsAPI ? `cadesplugin.async_spawn(${crossEnvCallbackLiteral});` : `(${crossEnvCallbackLiteral})();`,\r\n `//# sourceURL=crypto-pro_${callbackName}.js`,\r\n ].join('');\r\n};\r\n","import { CadesCertificate } from '../api/certificate';\r\nimport { _afterPluginsLoaded } from './_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from './_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from './_generateCadesFn';\r\n\r\n/**\r\n * Возвращает сертификат в формате Cades по отпечатку\r\n *\r\n * @param thumbprint - отпечаток сертификата\r\n * @returns сертификат в формате Cades\r\n */\r\nexport const _getCadesCert = _afterPluginsLoaded(\r\n (thumbprint: string): CadesCertificate => {\r\n const { cadesplugin } = window;\r\n\r\n return eval(\r\n _generateCadesFn(function _getCadesCert() {\r\n let cadesStore;\r\n\r\n try {\r\n cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');\r\n }\r\n\r\n if (!cadesStore) {\r\n throw new Error('Не удалось получить доступ к хранилищу сертификатов');\r\n }\r\n\r\n try {\r\n void (\r\n __cadesAsyncToken__ +\r\n cadesStore.Open(\r\n cadesplugin.CAPICOM_CURRENT_USER_STORE,\r\n cadesplugin.CAPICOM_MY_STORE,\r\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,\r\n )\r\n );\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');\r\n }\r\n\r\n let cadesCertificateList;\r\n let certificatesCount;\r\n\r\n try {\r\n cadesCertificateList = __cadesAsyncToken__ + cadesStore.Certificates;\r\n certificatesCount = __cadesAsyncToken__ + cadesCertificateList.Count;\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');\r\n }\r\n\r\n if (!certificatesCount) {\r\n throw new Error('Нет доступных сертификатов');\r\n }\r\n\r\n let cadesCertificate: CadesCertificate;\r\n\r\n try {\r\n cadesCertificateList =\r\n __cadesAsyncToken__ + cadesCertificateList.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH, thumbprint);\r\n\r\n const count = __cadesAsyncToken__ + cadesCertificateList.Count;\r\n\r\n if (!count) {\r\n throw new Error(`Сертификат с отпечатком: \"${thumbprint}\" не найден`);\r\n }\r\n\r\n cadesCertificate = __cadesAsyncToken__ + cadesCertificateList.Item(1);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении сертификата');\r\n }\r\n\r\n cadesStore.Close();\r\n\r\n return cadesCertificate;\r\n }),\r\n );\r\n },\r\n);\r\n","/**\r\n * Возвращает объект даты, совместимый с Cades plugin'ом, зависящий от браузера.\r\n *\r\n * В IE необходимо использовать специфичный формат \"VT_DATE\"\r\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Microsoft_Extensions/Date.getVarDate\r\n */\r\nexport const _getDateObj = (dateObj): Date => (dateObj.getVarDate ? dateObj.getVarDate() : dateObj);\r\n","const oldestSupportedCSPVersion = 4.0;\r\n\r\nexport const _isSupportedCSPVersion = (version: string): boolean => {\r\n version = version.match(/\\d+?\\b(?:\\.\\d+)?/)?.[0];\r\n\r\n return Number(version) >= oldestSupportedCSPVersion;\r\n};\r\n","export const _isSupportedCadesVersion = (version: string): boolean => {\r\n const match = version.match(/(\\d+)\\.(\\d+)\\.(\\d+)/);\r\n\r\n if (!match) {\r\n return false;\r\n }\r\n\r\n const [, major, minor, patch] = match;\r\n\r\n if (Number(major) < 2) {\r\n return false;\r\n }\r\n\r\n if (Number(major) === 2 && Number(patch) < 12438) {\r\n return false;\r\n }\r\n\r\n return true;\r\n};\r\n","import { OIDS_DICTIONARY } from '../constants';\r\nimport { TagsTranslations } from '../constants/tags-translations';\r\n\r\nexport interface TagTranslation {\r\n description: string;\r\n title: string;\r\n isTranslated: boolean;\r\n}\r\n\r\n/**\r\n * Парсит информацию из строки с информацией о сертификате\r\n *\r\n * @param tagsTranslations - словарь с расшифровками тэгов\r\n * @param rawInfo - данные для парсинга\r\n * @returns расшифрованная информация по отдельным тэгам\r\n */\r\nexport const _parseCertInfo = (tagsTranslations: TagsTranslations[], rawInfo: string): TagTranslation[] => {\r\n const extractedEntities: string[] = rawInfo.match(/([а-яА-Яa-zA-Z0-9\\s.]+)=(?:(\"[^\"]+?\")|(.+?))(?:,|$)/g);\r\n\r\n if (extractedEntities) {\r\n return extractedEntities.map((group) => {\r\n const segmentsMatch = group.trim().match(/^([а-яА-Яa-zA-Z0-9\\s.]+)=(.+?),?$/);\r\n let title = segmentsMatch?.[1];\r\n // Вырезаем лишние кавычки\r\n const description = segmentsMatch?.[2]?.replace(/^\"(.*)\"/, '$1')?.replace(/\"{2}/g, '\"');\r\n const oidIdentifierMatch = title?.match(/^OID\\.(.*)/);\r\n const oidIdentifier = oidIdentifierMatch?.[1];\r\n let isTranslated = false;\r\n\r\n // Если нашли в тайтле ОИД, пытаемся его расшифровать\r\n if (oidIdentifier) {\r\n const oidTranslation = OIDS_DICTIONARY[oidIdentifier];\r\n\r\n if (oidTranslation) {\r\n title = oidTranslation;\r\n isTranslated = true;\r\n }\r\n }\r\n\r\n const tagTranslation = tagsTranslations.find((tag) => tag.possibleNames.find((name) => name === title))\r\n ?.translation;\r\n\r\n if (tagTranslation) {\r\n title = tagTranslation;\r\n isTranslated = true;\r\n }\r\n\r\n return { description, title, isTranslated };\r\n });\r\n }\r\n};\r\n",";(function () {\r\n //already loaded\r\n if(window.cadesplugin)\r\n return;\r\n\r\n var pluginObject;\r\n var plugin_resolved = 0;\r\n var plugin_reject;\r\n var plugin_resolve;\r\n var isOpera = 0;\r\n var isFireFox = 0;\r\n var isEdge = 0;\r\n var isSafari = 0;\r\n var failed_extensions = 0;\r\n\r\n var canPromise = !!window.Promise;\r\n var cadesplugin;\r\n\r\n if(canPromise)\r\n {\r\n cadesplugin = new Promise(function(resolve, reject)\r\n {\r\n plugin_resolve = resolve;\r\n plugin_reject = reject;\r\n });\r\n } else\r\n {\r\n cadesplugin = {};\r\n }\r\n\r\n function check_browser() {\r\n var ua= navigator.userAgent, tem, M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\\/))\\/?\\s*(\\d+)/i) || [];\r\n if(/trident/i.test(M[1])){\r\n tem= /\\brv[ :]+(\\d+)/g.exec(ua) || [];\r\n return {name:'IE',version:(tem[1] || '')};\r\n }\r\n if(M[1]=== 'Chrome'){\r\n tem= ua.match(/\\b(OPR|Edge)\\/(\\d+)/);\r\n if(tem!= null) return {name:tem[1].replace('OPR', 'Opera'),version:tem[2]};\r\n }\r\n M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];\r\n if((tem= ua.match(/version\\/(\\d+)/i))!= null) M.splice(1, 1, tem[1]);\r\n return {name:M[0],version:M[1]};\r\n }\r\n var browserSpecs = check_browser();\r\n\r\n function cpcsp_console_log(level, msg){\r\n //IE9 не может писать в консоль если не открыта вкладка developer tools\r\n if(typeof(console) === 'undefined')\r\n return;\r\n if (level <= cadesplugin.current_log_level ){\r\n if (level === cadesplugin.LOG_LEVEL_DEBUG)\r\n console.log(\"DEBUG: %s\", msg);\r\n if (level === cadesplugin.LOG_LEVEL_INFO)\r\n console.info(\"INFO: %s\", msg);\r\n if (level === cadesplugin.LOG_LEVEL_ERROR)\r\n console.error(\"ERROR: %s\", msg);\r\n return;\r\n }\r\n }\r\n\r\n function set_log_level(level){\r\n if (!((level === cadesplugin.LOG_LEVEL_DEBUG) ||\r\n (level === cadesplugin.LOG_LEVEL_INFO) ||\r\n (level === cadesplugin.LOG_LEVEL_ERROR))){\r\n cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, \"cadesplugin_api.js: Incorrect log_level: \" + level);\r\n return;\r\n }\r\n cadesplugin.current_log_level = level;\r\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG)\r\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = DEBUG\");\r\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO)\r\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = INFO\");\r\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR)\r\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = ERROR\");\r\n if(isNativeMessageSupported())\r\n {\r\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG)\r\n window.postMessage(\"set_log_level=debug\", \"*\");\r\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO)\r\n window.postMessage(\"set_log_level=info\", \"*\");\r\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR)\r\n window.postMessage(\"set_log_level=error\", \"*\");\r\n }\r\n }\r\n\r\n function set_constantValues()\r\n {\r\n cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1;\r\n cadesplugin.CAPICOM_CURRENT_USER_STORE = 2;\r\n cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1;\r\n cadesplugin.CADESCOM_CURRENT_USER_STORE = 2;\r\n cadesplugin.CADESCOM_CONTAINER_STORE = 100;\r\n\r\n cadesplugin.CAPICOM_MY_STORE = \"My\";\r\n\r\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;\r\n\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\r\n\r\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;\r\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;\r\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;\r\n\r\n cadesplugin.XmlDsigGost3410UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411\";\r\n cadesplugin.XmlDsigGost3411UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr3411\";\r\n cadesplugin.XmlDsigGost3410Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411\";\r\n cadesplugin.XmlDsigGost3411Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411\";\r\n\r\n cadesplugin.CADESCOM_CADES_DEFAULT = 0;\r\n cadesplugin.CADESCOM_CADES_BES = 1;\r\n cadesplugin.CADESCOM_CADES_T = 0x5;\r\n cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;\r\n cadesplugin.CADESCOM_PKCS7_TYPE = 0xffff;\r\n\r\n cadesplugin.CADESCOM_ENCODE_BASE64 = 0;\r\n cadesplugin.CADESCOM_ENCODE_BINARY = 1;\r\n cadesplugin.CADESCOM_ENCODE_ANY = -1;\r\n\r\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;\r\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;\r\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;\r\n\r\n cadesplugin.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;\r\n cadesplugin.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;\r\n\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;\r\n\r\n cadesplugin.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;\r\n\r\n cadesplugin.CAPICOM_PROPID_ENHKEY_USAGE = 9;\r\n\r\n cadesplugin.CAPICOM_OID_OTHER = 0;\r\n cadesplugin.CAPICOM_OID_KEY_USAGE_EXTENSION = 10;\r\n\r\n cadesplugin.CAPICOM_EKU_CLIENT_AUTH = 2;\r\n cadesplugin.CAPICOM_EKU_SMARTCARD_LOGON = 5;\r\n cadesplugin.CAPICOM_EKU_OTHER = 0;\r\n\r\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\r\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\r\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\r\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\r\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\r\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\r\n cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1;\r\n\r\n cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0;\r\n cadesplugin.CADESCOM_BASE64_TO_BINARY = 1;\r\n\r\n cadesplugin.CADESCOM_DISPLAY_DATA_NONE = 0;\r\n cadesplugin.CADESCOM_DISPLAY_DATA_CONTENT = 1;\r\n cadesplugin.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;\r\n\r\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;\r\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;\r\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;\r\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;\r\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;\r\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;\r\n\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA1 = 0;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD2 = 1;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD4 = 2;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD5 = 3;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_256 = 4;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_384 = 5;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_512 = 6;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112;\r\n\r\n cadesplugin.LOG_LEVEL_DEBUG = 4;\r\n cadesplugin.LOG_LEVEL_INFO = 2;\r\n cadesplugin.LOG_LEVEL_ERROR = 1;\r\n\r\n cadesplugin.CADESCOM_AllowNone = 0;\r\n cadesplugin.CADESCOM_AllowNoOutstandingRequest = 0x1;\r\n cadesplugin.CADESCOM_AllowUntrustedCertificate = 0x2;\r\n cadesplugin.CADESCOM_AllowUntrustedRoot = 0x4;\r\n cadesplugin.CADESCOM_SkipInstallToStore = 0x10000000;\r\n }\r\n\r\n function async_spawn(generatorFunc) {\r\n function continuer(verb, arg) {\r\n var result;\r\n try {\r\n result = generator[verb](arg);\r\n } catch (err) {\r\n return Promise.reject(err);\r\n }\r\n if (result.done) {\r\n return result.value;\r\n } else {\r\n return Promise.resolve(result.value).then(onFulfilled, onRejected);\r\n }\r\n }\r\n var generator = generatorFunc(Array.prototype.slice.call(arguments, 1));\r\n var onFulfilled = continuer.bind(continuer, \"next\");\r\n var onRejected = continuer.bind(continuer, \"throw\");\r\n return onFulfilled();\r\n }\r\n\r\n function isIE() {\r\n // var retVal = ((\"Microsoft Internet Explorer\" == navigator.appName) || // IE < 11\r\n // navigator.userAgent.match(/Trident\\/./i)); // IE 11\r\n return (browserSpecs.name === 'IE' || browserSpecs.name === 'MSIE');\r\n }\r\n\r\n function isIOS() {\r\n return (navigator.userAgent.match(/ipod/i) ||\r\n navigator.userAgent.match(/ipad/i) ||\r\n navigator.userAgent.match(/iphone/i));\r\n }\r\n\r\n function isNativeMessageSupported()\r\n {\r\n // В IE работаем через NPAPI\r\n if(isIE())\r\n return false;\r\n // В Edge работаем через NativeMessage\r\n if(browserSpecs.name === 'Edge') {\r\n isEdge = true;\r\n return true;\r\n }\r\n // В Chrome, Firefox, Safari и Opera работаем через асинхронную версию в зависимости от версии\r\n if(browserSpecs.name === 'Opera') {\r\n isOpera = true;\r\n if(browserSpecs.version >= 33){\r\n return true;\r\n }\r\n else{\r\n return false;\r\n }\r\n }\r\n if(browserSpecs.name === 'Firefox') {\r\n isFireFox = true;\r\n if(browserSpecs.version >= 52){\r\n return true;\r\n }\r\n else{\r\n return false;\r\n }\r\n }\r\n if(browserSpecs.name === 'Chrome') {\r\n if(browserSpecs.version >= 42){\r\n return true;\r\n }\r\n else{\r\n return false;\r\n }\r\n }\r\n //В Сафари начиная с 12 версии нет NPAPI\r\n if(browserSpecs.name === 'Safari') {\r\n isSafari = true;\r\n if(browserSpecs.version >= 12) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n // Функция активации объектов КриптоПро ЭЦП Browser plug-in\r\n function CreateObject(name) {\r\n if (isIOS()) {\r\n // На iOS для создания объектов используется функция\r\n // call_ru_cryptopro_npcades_10_native_bridge, определенная в IOS_npcades_supp.js\r\n return call_ru_cryptopro_npcades_10_native_bridge(\"CreateObject\", [name]);\r\n }\r\n if (isIE()) {\r\n // В Internet Explorer создаются COM-объекты\r\n if (name.match(/X509Enrollment/i)) {\r\n try {\r\n // Объекты CertEnroll пробуем создавать через нашу фабрику,\r\n // если не получилось то через CX509EnrollmentWebClassFactory\r\n var objCertEnrollClassFactory = document.getElementById(\"webClassFactory\");\r\n return objCertEnrollClassFactory.CreateObject(name);\r\n }\r\n catch (e) {\r\n try {\r\n var objWebClassFactory = document.getElementById(\"certEnrollClassFactory\");\r\n return objWebClassFactory.CreateObject(name);\r\n }\r\n catch (err) {\r\n throw (\"Для создания обьектов X509Enrollment следует настроить веб-узел на использование проверки подлинности по протоколу HTTPS\");\r\n }\r\n }\r\n }\r\n // Объекты CAPICOM и CAdESCOM создаются через CAdESCOM.WebClassFactory\r\n try {\r\n var objWebClassFactory = document.getElementById(\"webClassFactory\");\r\n return objWebClassFactory.CreateObject(name);\r\n }\r\n catch (e) {\r\n // Для версий плагина ниже 2.0.12538\r\n return new ActiveXObject(name);\r\n }\r\n }\r\n // создаются объекты NPAPI\r\n return pluginObject.CreateObject(name);\r\n }\r\n\r\n function decimalToHexString(number) {\r\n if (number < 0) {\r\n number = 0xFFFFFFFF + number + 1;\r\n }\r\n\r\n return number.toString(16).toUpperCase();\r\n }\r\n\r\n function GetMessageFromException(e) {\r\n var err = e.message;\r\n if (!err) {\r\n err = e;\r\n } else if (e.number) {\r\n err += \" (0x\" + decimalToHexString(e.number) + \")\";\r\n }\r\n return err;\r\n }\r\n\r\n function getLastError(exception) {\r\n if(isNativeMessageSupported() || isIE() || isIOS() ) {\r\n return GetMessageFromException(exception);\r\n }\r\n\r\n try {\r\n return pluginObject.getLastError();\r\n } catch(e) {\r\n return GetMessageFromException(exception);\r\n }\r\n }\r\n\r\n // Функция для удаления созданных объектов\r\n function ReleasePluginObjects() {\r\n return cpcsp_chrome_nmcades.ReleasePluginObjects();\r\n }\r\n\r\n // Функция активации асинхронных объектов КриптоПро ЭЦП Browser plug-in\r\n function CreateObjectAsync(name) {\r\n return pluginObject.CreateObjectAsync(name);\r\n }\r\n\r\n //Функции для IOS\r\n var ru_cryptopro_npcades_10_native_bridge = {\r\n callbacksCount : 1,\r\n callbacks : {},\r\n\r\n // Automatically called by native layer when a result is available\r\n resultForCallback : function resultForCallback(callbackId, resultArray) {\r\n var callback = ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId];\r\n if (!callback) return;\r\n callback.apply(null,resultArray);\r\n },\r\n\r\n // Use this in javascript to request native objective-c code\r\n // functionName : string (I think the name is explicit :p)\r\n // args : array of arguments\r\n // callback : function with n-arguments that is going to be called when the native code returned\r\n call : function call(functionName, args, callback) {\r\n var hasCallback = callback && typeof callback === \"function\";\r\n var callbackId = hasCallback ? ru_cryptopro_npcades_10_native_bridge.callbacksCount++ : 0;\r\n\r\n if (hasCallback)\r\n ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId] = callback;\r\n\r\n var iframe = document.createElement(\"IFRAME\");\r\n var arrObjs = new Array(\"_CPNP_handle\");\r\n try{\r\n iframe.setAttribute(\"src\", \"cpnp-js-call:\" + functionName + \":\" + callbackId+ \":\" + encodeURIComponent(JSON.stringify(args, arrObjs)));\r\n } catch(e){\r\n alert(e);\r\n }\r\n document.documentElement.appendChild(iframe);\r\n iframe.parentNode.removeChild(iframe);\r\n iframe = null;\r\n }\r\n };\r\n\r\n function call_ru_cryptopro_npcades_10_native_bridge(functionName, array){\r\n var tmpobj;\r\n var ex;\r\n ru_cryptopro_npcades_10_native_bridge.call(functionName, array, function(e, response){\r\n ex = e;\r\n var str='tmpobj='+response;\r\n eval(str);\r\n if (typeof (tmpobj) === \"string\"){\r\n tmpobj = tmpobj.replace(/\\\\\\n/gm, \"\\n\");\r\n tmpobj = tmpobj.replace(/\\\\\\r/gm, \"\\r\");\r\n }\r\n });\r\n if(ex)\r\n throw ex;\r\n return tmpobj;\r\n }\r\n\r\n function show_firefox_missing_extension_dialog()\r\n {\r\n if (!window.cadesplugin_skip_extension_install)\r\n {\r\n var ovr = document.createElement('div');\r\n ovr.id = \"cadesplugin_ovr\";\r\n ovr.style = \"visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)\";\r\n ovr.innerHTML = \"
\" +\r\n \"\" +\r\n \"

Для работы КриптоПро ЭЦП Browser plugin на данном сайте необходимо расширение для браузера. Убедитесь, что оно у Вас включено или установите его.\" +\r\n \"

Скачать расширение

\" +\r\n \"
\";\r\n document.getElementsByTagName(\"Body\")[0].appendChild(ovr);\r\n document.getElementById(\"cadesplugin_close_install\").addEventListener('click',function()\r\n {\r\n plugin_loaded_error(\"Плагин недоступен\");\r\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\r\n });\r\n\r\n ovr.addEventListener('click',function()\r\n {\r\n plugin_loaded_error(\"Плагин недоступен\");\r\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\r\n });\r\n ovr.style.visibility=\"visible\";\r\n }\r\n }\r\n\r\n\r\n //Выводим окно поверх других с предложением установить расширение для Opera.\r\n //Если установленна переменная cadesplugin_skip_extension_install - не предлагаем установить расширение\r\n function install_opera_extension()\r\n {\r\n if (!window.cadesplugin_skip_extension_install)\r\n {\r\n document.addEventListener('DOMContentLoaded', function() {\r\n var ovr = document.createElement('div');\r\n ovr.id = \"cadesplugin_ovr\";\r\n ovr.style = \"visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)\";\r\n ovr.innerHTML = \"
\" +\r\n \"\" +\r\n \"

Для работы КриптоПро ЭЦП Browser plugin на данном сайте необходимо установить расширение из каталога дополнений Opera.\" +\r\n \"

\" +\r\n \"
\";\r\n document.getElementsByTagName(\"Body\")[0].appendChild(ovr);\r\n var btn_install = document.getElementById(\"cadesplugin_install\");\r\n btn_install.addEventListener('click', function(event) {\r\n opr.addons.installExtension(\"epebfcehmdedogndhlcacafjaacknbcm\",\r\n function()\r\n {\r\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\r\n location.reload();\r\n },\r\n function(){})\r\n });\r\n document.getElementById(\"cadesplugin_close_install\").addEventListener('click',function()\r\n {\r\n plugin_loaded_error(\"Плагин недоступен\");\r\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\r\n });\r\n\r\n ovr.addEventListener('click',function()\r\n {\r\n plugin_loaded_error(\"Плагин недоступен\");\r\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\r\n });\r\n ovr.style.visibility=\"visible\";\r\n document.getElementById(\"cadesplugin_ovr_item\").addEventListener('click',function(e){\r\n e.stopPropagation();\r\n });\r\n });\r\n }else\r\n {\r\n plugin_loaded_error(\"Плагин недоступен\");\r\n }\r\n }\r\n\r\n function firefox_or_edge_nmcades_onload() {\r\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\r\n }\r\n\r\n function nmcades_api_onload () {\r\n window.postMessage(\"cadesplugin_echo_request\", \"*\");\r\n window.addEventListener(\"message\", function (event){\r\n if (typeof(event.data) !== \"string\" || !event.data.match(\"cadesplugin_loaded\"))\r\n return;\r\n if(isFireFox || isEdge || isSafari)\r\n {\r\n // Для Firefox, Сафари, Edge вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js\r\n var url = event.data.substring(event.data.indexOf(\"url:\") + 4);\r\n var fileref = document.createElement('script');\r\n fileref.setAttribute(\"type\", \"text/javascript\");\r\n fileref.setAttribute(\"src\", url);\r\n fileref.onerror = plugin_loaded_error;\r\n fileref.onload = firefox_or_edge_nmcades_onload;\r\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\r\n // Для Firefox, Safari и Edge у нас только по одному расширению.\r\n failed_extensions++;\r\n }else {\r\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\r\n }\r\n }, false);\r\n }\r\n\r\n //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari\r\n function load_extension()\r\n {\r\n\r\n if(isFireFox || isEdge || isSafari){\r\n // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера.\r\n nmcades_api_onload();\r\n } else {\r\n // в асинхронном варианте для chrome и opera подключаем оба расширения\r\n var fileref = document.createElement('script');\r\n fileref.setAttribute(\"type\", \"text/javascript\");\r\n fileref.setAttribute(\"src\", \"chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js\");\r\n fileref.onerror = plugin_loaded_error;\r\n fileref.onload = nmcades_api_onload;\r\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\r\n fileref = document.createElement('script');\r\n fileref.setAttribute(\"type\", \"text/javascript\");\r\n fileref.setAttribute(\"src\", \"chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js\");\r\n fileref.onerror = plugin_loaded_error;\r\n fileref.onload = nmcades_api_onload;\r\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\r\n }\r\n }\r\n\r\n //Загружаем плагин для NPAPI\r\n function load_npapi_plugin()\r\n {\r\n var elem = document.createElement('object');\r\n elem.setAttribute(\"id\", \"cadesplugin_object\");\r\n elem.setAttribute(\"type\", \"application/x-cades\");\r\n elem.setAttribute(\"style\", \"visibility: hidden\");\r\n document.getElementsByTagName(\"body\")[0].appendChild(elem);\r\n pluginObject = document.getElementById(\"cadesplugin_object\");\r\n if(isIE())\r\n {\r\n var elem1 = document.createElement('object');\r\n elem1.setAttribute(\"id\", \"certEnrollClassFactory\");\r\n elem1.setAttribute(\"classid\", \"clsid:884e2049-217d-11da-b2a4-000e7bbb2b09\");\r\n elem1.setAttribute(\"style\", \"visibility: hidden\");\r\n document.getElementsByTagName(\"body\")[0].appendChild(elem1);\r\n var elem2 = document.createElement('object');\r\n elem2.setAttribute(\"id\", \"webClassFactory\");\r\n elem2.setAttribute(\"classid\", \"clsid:B04C8637-10BD-484E-B0DA-B8A039F60024\");\r\n elem2.setAttribute(\"style\", \"visibility: hidden\");\r\n document.getElementsByTagName(\"body\")[0].appendChild(elem2);\r\n }\r\n }\r\n\r\n //Отправляем событие что все ок.\r\n function plugin_loaded()\r\n {\r\n plugin_resolved = 1;\r\n if(canPromise)\r\n {\r\n plugin_resolve();\r\n }else {\r\n window.postMessage(\"cadesplugin_loaded\", \"*\");\r\n }\r\n }\r\n\r\n //Отправляем событие что сломались.\r\n function plugin_loaded_error(msg)\r\n {\r\n if(isNativeMessageSupported())\r\n {\r\n //в асинхронном варианте подключаем оба расширения, если сломались оба пробуем установить для Opera\r\n failed_extensions++;\r\n if(failed_extensions<2)\r\n return;\r\n if(isOpera && (typeof(msg) === 'undefined'|| typeof(msg) === 'object'))\r\n {\r\n install_opera_extension();\r\n return;\r\n }\r\n }\r\n if(typeof(msg) === 'undefined' || typeof(msg) === 'object')\r\n msg = \"Плагин недоступен\";\r\n plugin_resolved = 1;\r\n if(canPromise)\r\n {\r\n plugin_reject(msg);\r\n } else {\r\n window.postMessage(\"cadesplugin_load_error\", \"*\");\r\n }\r\n }\r\n\r\n //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку\r\n function check_load_timeout()\r\n {\r\n if(plugin_resolved === 1)\r\n return;\r\n if(isFireFox)\r\n {\r\n show_firefox_missing_extension_dialog();\r\n }\r\n plugin_resolved = 1;\r\n if(canPromise)\r\n {\r\n plugin_reject(\"Истекло время ожидания загрузки плагина\");\r\n } else {\r\n window.postMessage(\"cadesplugin_load_error\", \"*\");\r\n }\r\n\r\n }\r\n\r\n //Вспомогательная функция для NPAPI\r\n function createPromise(arg)\r\n {\r\n return new Promise(arg);\r\n }\r\n\r\n function check_npapi_plugin (){\r\n try {\r\n var oAbout = CreateObject(\"CAdESCOM.About\");\r\n plugin_loaded();\r\n }\r\n catch (err) {\r\n document.getElementById(\"cadesplugin_object\").style.display = 'none';\r\n // Объект создать не удалось, проверим, установлен ли\r\n // вообще плагин. Такая возможность есть не во всех браузерах\r\n var mimetype = navigator.mimeTypes[\"application/x-cades\"];\r\n if (mimetype) {\r\n var plugin = mimetype.enabledPlugin;\r\n if (plugin) {\r\n plugin_loaded_error(\"Плагин загружен, но не создаются обьекты\");\r\n }else\r\n {\r\n plugin_loaded_error(\"Ошибка при загрузке плагина\");\r\n }\r\n }else\r\n {\r\n plugin_loaded_error(\"Плагин недоступен\");\r\n }\r\n }\r\n }\r\n\r\n //Проверяем работает ли плагин\r\n function check_plugin_working()\r\n {\r\n var div = document.createElement(\"div\");\r\n div.innerHTML = \"\";\r\n var isIeLessThan9 = (div.getElementsByTagName(\"i\").length === 1);\r\n if (isIeLessThan9) {\r\n plugin_loaded_error(\"Internet Explorer версии 8 и ниже не поддерживается\");\r\n return;\r\n }\r\n\r\n if(isNativeMessageSupported())\r\n {\r\n load_extension();\r\n }else if(!canPromise) {\r\n window.addEventListener(\"message\", function (event){\r\n if (event.data !== \"cadesplugin_echo_request\")\r\n return;\r\n load_npapi_plugin();\r\n check_npapi_plugin();\r\n },\r\n false);\r\n }else\r\n {\r\n if(document.readyState === \"complete\"){\r\n load_npapi_plugin();\r\n check_npapi_plugin();\r\n } else {\r\n window.addEventListener(\"load\", function (event) {\r\n load_npapi_plugin();\r\n check_npapi_plugin();\r\n }, false);\r\n }\r\n }\r\n }\r\n\r\n function set_pluginObject(obj)\r\n {\r\n pluginObject = obj;\r\n }\r\n\r\n function is_capilite_enabled()\r\n {\r\n if ((typeof (cadesplugin.EnableInternalCSP) !== 'undefined') && cadesplugin.EnableInternalCSP)\r\n return true;\r\n return false;\r\n };\r\n\r\n //Export\r\n cadesplugin.JSModuleVersion = \"2.1.2\";\r\n cadesplugin.async_spawn = async_spawn;\r\n cadesplugin.set = set_pluginObject;\r\n cadesplugin.set_log_level = set_log_level;\r\n cadesplugin.getLastError = getLastError;\r\n cadesplugin.is_capilite_enabled = is_capilite_enabled;\r\n\r\n if(isNativeMessageSupported())\r\n {\r\n cadesplugin.CreateObjectAsync = CreateObjectAsync;\r\n cadesplugin.ReleasePluginObjects = ReleasePluginObjects;\r\n }\r\n\r\n if(!isNativeMessageSupported())\r\n {\r\n cadesplugin.CreateObject = CreateObject;\r\n }\r\n\r\n if(window.cadesplugin_load_timeout)\r\n {\r\n setTimeout(check_load_timeout, window.cadesplugin_load_timeout);\r\n }\r\n else\r\n {\r\n setTimeout(check_load_timeout, 20000);\r\n }\r\n\r\n set_constantValues();\r\n\r\n cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR;\r\n window.cadesplugin = cadesplugin;\r\n check_plugin_working();\r\n}());\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/crypto-pro.min.js b/dist/crypto-pro.min.js deleted file mode 100644 index 6a606b6..0000000 --- a/dist/crypto-pro.min.js +++ /dev/null @@ -1,9 +0,0 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cryptoPro",[],t):"object"==typeof exports?exports.cryptoPro=t():e.cryptoPro=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=11)}([function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(a,o){function _(e){try{s(n.next(e))}catch(e){o(e)}}function i(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(_,i)}s((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,a,o,_={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(o){return function(i){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;_;)try{if(r=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return _.label++,{value:o[1],done:!1};case 5:_.label++,n=o[1],o=[0];continue;case 7:o=_.ops.pop(),_.trys.pop();continue;default:if(!(a=_.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){_=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1] - * @license MIT - */ -var n=r(37),a=r(38),o=r(39);function _(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(e,t){if(_()=_())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_().toString(16)+" bytes");return 0|e}function p(e,t){if(s.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return B(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(e).length;default:if(n)return B(e).length;t=(""+t).toLowerCase(),n=!0}}function g(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return v(this,t,r);case"utf8":case"utf-8":return w(this,t,r);case"ascii":return S(this,t,r);case"latin1":case"binary":return P(this,t,r);case"base64":return b(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function C(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function E(e,t,r,n,a){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=a?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(a)return-1;r=e.length-1}else if(r<0){if(!a)return-1;r=0}if("string"==typeof t&&(t=s.from(t,n)),s.isBuffer(t))return 0===t.length?-1:h(e,t,r,n,a);if("number"==typeof t)return t&=255,s.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):h(e,[t],r,n,a);throw new TypeError("val must be string, number or Buffer")}function h(e,t,r,n,a){var o,_=1,i=e.length,s=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;_=2,i/=2,s/=2,r/=2}function c(e,t){return 1===_?e[t]:e.readUInt16BE(t*_)}if(a){var u=-1;for(o=r;oi&&(r=i-s),o=r;o>=0;o--){for(var l=!0,d=0;da&&(n=a):n=a;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var _=0;_>8,a=r%256,o.push(a),o.push(n);return o}(t,e.length-r),e,r,n)}function b(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function w(e,t,r){r=Math.min(e.length,r);for(var n=[],a=t;a239?4:c>223?3:c>191?2:1;if(a+l<=r)switch(l){case 1:c<128&&(u=c);break;case 2:128==(192&(o=e[a+1]))&&(s=(31&c)<<6|63&o)>127&&(u=s);break;case 3:o=e[a+1],_=e[a+2],128==(192&o)&&128==(192&_)&&(s=(15&c)<<12|(63&o)<<6|63&_)>2047&&(s<55296||s>57343)&&(u=s);break;case 4:o=e[a+1],_=e[a+2],i=e[a+3],128==(192&o)&&128==(192&_)&&128==(192&i)&&(s=(15&c)<<18|(63&o)<<12|(63&_)<<6|63&i)>65535&&s<1114112&&(u=s)}null===u?(u=65533,l=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),a+=l}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),""},s.prototype.compare=function(e,t,r,n,a){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(a>>>=0)-(n>>>=0),_=(r>>>=0)-(t>>>=0),i=Math.min(o,_),c=this.slice(n,a),u=e.slice(t,r),l=0;la)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return A(this,e,t,r);case"utf8":case"utf-8":return O(this,e,t,r);case"ascii":return T(this,e,t,r);case"latin1":case"binary":return y(this,e,t,r);case"base64":return I(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function S(e,t,r){var n="";r=Math.min(e.length,r);for(var a=t;an)&&(r=n);for(var a="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,r,n,a,o){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError("Index out of range")}function N(e,t,r,n){t<0&&(t=65535+t+1);for(var a=0,o=Math.min(e.length-r,2);a>>8*(n?a:1-a)}function L(e,t,r,n){t<0&&(t=4294967295+t+1);for(var a=0,o=Math.min(e.length-r,4);a>>8*(n?a:3-a)&255}function x(e,t,r,n,a,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function F(e,t,r,n,o){return o||x(e,0,r,4),a.write(e,t,r,n,23,4),r+4}function k(e,t,r,n,o){return o||x(e,0,r,8),a.write(e,t,r,n,52,8),r+8}s.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t0&&(a*=256);)n+=this[e+--t]*a;return n},s.prototype.readUInt8=function(e,t){return t||R(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return t||R(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return t||R(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return t||R(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return t||R(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||R(e,t,this.length);for(var n=this[e],a=1,o=0;++o=(a*=128)&&(n-=Math.pow(2,8*t)),n},s.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||R(e,t,this.length);for(var n=t,a=1,o=this[e+--n];n>0&&(a*=256);)o+=this[e+--n]*a;return o>=(a*=128)&&(o-=Math.pow(2,8*t)),o},s.prototype.readInt8=function(e,t){return t||R(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){t||R(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(e,t){t||R(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(e,t){return t||R(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return t||R(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return t||R(e,4,this.length),a.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return t||R(e,4,this.length),a.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return t||R(e,8,this.length),a.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return t||R(e,8,this.length),a.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||D(this,e,t,r,Math.pow(2,8*r)-1,0);var a=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+a]=e/o&255;return t+r},s.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,1,255,0),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},s.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},s.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},s.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},s.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);D(this,e,t,r,a-1,-a)}var o=0,_=1,i=0;for(this[t]=255&e;++o>0)-i&255;return t+r},s.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);D(this,e,t,r,a-1,-a)}var o=r-1,_=1,i=0;for(this[t+o]=255&e;--o>=0&&(_*=256);)e<0&&0===i&&0!==this[t+o+1]&&(i=1),this[t+o]=(e/_>>0)-i&255;return t+r},s.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,1,127,-128),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},s.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},s.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},s.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},s.prototype.writeFloatLE=function(e,t,r){return F(this,e,t,!0,r)},s.prototype.writeFloatBE=function(e,t,r){return F(this,e,t,!1,r)},s.prototype.writeDoubleLE=function(e,t,r){return k(this,e,t,!0,r)},s.prototype.writeDoubleBE=function(e,t,r){return k(this,e,t,!1,r)},s.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--a)e[a+t]=this[a+r];else if(o<1e3||!s.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!a){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(_+1===n){(t-=3)>-1&&o.push(239,191,189);continue}a=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(t-=3)>-1&&o.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function G(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(U,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function j(e,t,r,n){for(var a=0;a=t.length||a>=e.length);++a)t[a+r]=e[a];return a}}).call(this,r(36))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}(r(12))},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),n(r(13)),n(r(6)),n(r(9)),n(r(29)),n(r(32)),n(r(33)),n(r(34)),n(r(35)),n(r(40)),n(r(7))},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(a,o){function _(e){try{s(n.next(e))}catch(e){o(e)}}function i(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(_,i)}s((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,a,o,_={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(o){return function(i){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;_;)try{if(r=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return _.label++,{value:o[1],done:!1};case 5:_.label++,n=o[1],o=[0];continue;case 7:o=_.ops.pop(),_.trys.pop();continue;default:if(!(a=_.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){_=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]=33):"Firefox"===browserSpecs.name?(isFireFox=!0,browserSpecs.version>=52):"Chrome"===browserSpecs.name?browserSpecs.version>=42:"Safari"===browserSpecs.name?(isSafari=!0,browserSpecs.version>=12):void 0)}function CreateObject(e){if(isIOS())return call_ru_cryptopro_npcades_10_native_bridge("CreateObject",[e]);if(isIE()){if(e.match(/X509Enrollment/i))try{return document.getElementById("webClassFactory").CreateObject(e)}catch(t){try{return document.getElementById("certEnrollClassFactory").CreateObject(e)}catch(e){throw"Для создания обьектов X509Enrollment следует настроить веб-узел на использование проверки подлинности по протоколу HTTPS"}}try{return document.getElementById("webClassFactory").CreateObject(e)}catch(t){return new ActiveXObject(e)}}return pluginObject.CreateObject(e)}function decimalToHexString(e){return e<0&&(e=4294967295+e+1),e.toString(16).toUpperCase()}function GetMessageFromException(e){var t=e.message;return t?e.number&&(t+=" (0x"+decimalToHexString(e.number)+")"):t=e,t}function getLastError(e){if(isNativeMessageSupported()||isIE()||isIOS())return GetMessageFromException(e);try{return pluginObject.getLastError()}catch(t){return GetMessageFromException(e)}}function ReleasePluginObjects(){return cpcsp_chrome_nmcades.ReleasePluginObjects()}function CreateObjectAsync(e){return pluginObject.CreateObjectAsync(e)}function call_ru_cryptopro_npcades_10_native_bridge(functionName,array){var tmpobj,ex;if(ru_cryptopro_npcades_10_native_bridge.call(functionName,array,(function(e,response){ex=e;var str="tmpobj="+response;eval(str),"string"==typeof tmpobj&&(tmpobj=tmpobj.replace(/\\\n/gm,"\n"),tmpobj=tmpobj.replace(/\\\r/gm,"\r"))})),ex)throw ex;return tmpobj}function show_firefox_missing_extension_dialog(){if(!window.cadesplugin_skip_extension_install){var e=document.createElement("div");e.id="cadesplugin_ovr",e.style="visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)",e.innerHTML="

Для работы КриптоПро ЭЦП Browser plugin на данном сайте необходимо расширение для браузера. Убедитесь, что оно у Вас включено или установите его.

Скачать расширение

",document.getElementsByTagName("Body")[0].appendChild(e),document.getElementById("cadesplugin_close_install").addEventListener("click",(function(){plugin_loaded_error("Плагин недоступен"),document.getElementById("cadesplugin_ovr").style.visibility="hidden"})),e.addEventListener("click",(function(){plugin_loaded_error("Плагин недоступен"),document.getElementById("cadesplugin_ovr").style.visibility="hidden"})),e.style.visibility="visible"}}function install_opera_extension(){window.cadesplugin_skip_extension_install?plugin_loaded_error("Плагин недоступен"):document.addEventListener("DOMContentLoaded",(function(){var e=document.createElement("div");e.id="cadesplugin_ovr",e.style="visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)",e.innerHTML="

Для работы КриптоПро ЭЦП Browser plugin на данном сайте необходимо установить расширение из каталога дополнений Opera.

",document.getElementsByTagName("Body")[0].appendChild(e),document.getElementById("cadesplugin_install").addEventListener("click",(function(e){opr.addons.installExtension("epebfcehmdedogndhlcacafjaacknbcm",(function(){document.getElementById("cadesplugin_ovr").style.visibility="hidden",location.reload()}),(function(){}))})),document.getElementById("cadesplugin_close_install").addEventListener("click",(function(){plugin_loaded_error("Плагин недоступен"),document.getElementById("cadesplugin_ovr").style.visibility="hidden"})),e.addEventListener("click",(function(){plugin_loaded_error("Плагин недоступен"),document.getElementById("cadesplugin_ovr").style.visibility="hidden"})),e.style.visibility="visible",document.getElementById("cadesplugin_ovr_item").addEventListener("click",(function(e){e.stopPropagation()}))}))}function firefox_or_edge_nmcades_onload(){cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded,plugin_loaded_error)}function nmcades_api_onload(){window.postMessage("cadesplugin_echo_request","*"),window.addEventListener("message",(function(e){if("string"==typeof e.data&&e.data.match("cadesplugin_loaded"))if(isFireFox||isEdge||isSafari){var t=e.data.substring(e.data.indexOf("url:")+4),r=document.createElement("script");r.setAttribute("type","text/javascript"),r.setAttribute("src",t),r.onerror=plugin_loaded_error,r.onload=firefox_or_edge_nmcades_onload,document.getElementsByTagName("head")[0].appendChild(r),failed_extensions++}else cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded,plugin_loaded_error)}),!1)}function load_extension(){if(isFireFox||isEdge||isSafari)nmcades_api_onload();else{var e=document.createElement("script");e.setAttribute("type","text/javascript"),e.setAttribute("src","chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js"),e.onerror=plugin_loaded_error,e.onload=nmcades_api_onload,document.getElementsByTagName("head")[0].appendChild(e),(e=document.createElement("script")).setAttribute("type","text/javascript"),e.setAttribute("src","chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js"),e.onerror=plugin_loaded_error,e.onload=nmcades_api_onload,document.getElementsByTagName("head")[0].appendChild(e)}}function load_npapi_plugin(){var e=document.createElement("object");if(e.setAttribute("id","cadesplugin_object"),e.setAttribute("type","application/x-cades"),e.setAttribute("style","visibility: hidden"),document.getElementsByTagName("body")[0].appendChild(e),pluginObject=document.getElementById("cadesplugin_object"),isIE()){var t=document.createElement("object");t.setAttribute("id","certEnrollClassFactory"),t.setAttribute("classid","clsid:884e2049-217d-11da-b2a4-000e7bbb2b09"),t.setAttribute("style","visibility: hidden"),document.getElementsByTagName("body")[0].appendChild(t);var r=document.createElement("object");r.setAttribute("id","webClassFactory"),r.setAttribute("classid","clsid:B04C8637-10BD-484E-B0DA-B8A039F60024"),r.setAttribute("style","visibility: hidden"),document.getElementsByTagName("body")[0].appendChild(r)}}function plugin_loaded(){plugin_resolved=1,canPromise?plugin_resolve():window.postMessage("cadesplugin_loaded","*")}function plugin_loaded_error(e){if(isNativeMessageSupported()){if(++failed_extensions<2)return;if(isOpera&&(void 0===e||"object"==typeof e))return void install_opera_extension()}void 0!==e&&"object"!=typeof e||(e="Плагин недоступен"),plugin_resolved=1,canPromise?plugin_reject(e):window.postMessage("cadesplugin_load_error","*")}function check_load_timeout(){1!==plugin_resolved&&(isFireFox&&show_firefox_missing_extension_dialog(),plugin_resolved=1,canPromise?plugin_reject("Истекло время ожидания загрузки плагина"):window.postMessage("cadesplugin_load_error","*"))}function createPromise(e){return new Promise(e)}function check_npapi_plugin(){try{CreateObject("CAdESCOM.About");plugin_loaded()}catch(t){document.getElementById("cadesplugin_object").style.display="none";var e=navigator.mimeTypes["application/x-cades"];if(e)plugin_loaded_error(e.enabledPlugin?"Плагин загружен, но не создаются обьекты":"Ошибка при загрузке плагина");else plugin_loaded_error("Плагин недоступен")}}function check_plugin_working(){var e=document.createElement("div");e.innerHTML="\x3c!--[if lt IE 9]>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){_=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]0)for(;e>0;){var r=void 0;r=_generateCadesFn_1.__cadesAsyncToken__+cadesCertificate.ExtendedKeyUsage(),r=_generateCadesFn_1.__cadesAsyncToken__+r.EKUs,r=_generateCadesFn_1.__cadesAsyncToken__+r.Item(e),r=_generateCadesFn_1.__cadesAsyncToken__+r.OID,t.push(r),e--}}catch(e){throw console.error(e),new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(e)||"Ошибка при получении ОИД'ов")}return t})))}))},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(a,o){function _(e){try{s(n.next(e))}catch(e){o(e)}}function i(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(_,i)}s((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,a,o,_={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(o){return function(i){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;_;)try{if(r=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return _.label++,{value:o[1],done:!1};case 5:_.label++,n=o[1],o=[0];continue;case 7:o=_.ops.pop(),_.trys.pop();continue;default:if(!(a=_.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){_=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]0&&a[a.length-1])||6!==o[0]&&2!==o[0])){_=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]0&&a[a.length-1])||6!==o[0]&&2!==o[0])){_=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]=4}},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(a,o){function _(e){try{s(n.next(e))}catch(e){o(e)}}function i(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(_,i)}s((n=n.apply(e,t||[])).next())}))},__generator=this&&this.__generator||function(e,t){var r,n,a,o,_={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(o){return function(i){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;_;)try{if(r=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return _.label++,{value:o[1],done:!1};case 5:_.label++,n=o[1],o=[0];continue;case 7:o=_.ops.pop(),_.trys.pop();continue;default:if(!(a=_.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){_=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]0&&a[a.length-1])||6!==o[0]&&2!==o[0])){_=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]0&&a[a.length-1])||6!==o[0]&&2!==o[0])){_=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]0&&a[a.length-1])||6!==o[0]&&2!==o[0])){_=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]0?_-4:_;for(r=0;r>16&255,s[u++]=t>>8&255,s[u++]=255&t;2===i&&(t=a[e.charCodeAt(r)]<<2|a[e.charCodeAt(r+1)]>>4,s[u++]=255&t);1===i&&(t=a[e.charCodeAt(r)]<<10|a[e.charCodeAt(r+1)]<<4|a[e.charCodeAt(r+2)]>>2,s[u++]=t>>8&255,s[u++]=255&t);return s},t.fromByteArray=function(e){for(var t,r=e.length,a=r%3,o=[],_=0,i=r-a;_i?i:_+16383));1===a?(t=e[r-1],o.push(n[t>>2]+n[t<<4&63]+"==")):2===a&&(t=(e[r-2]<<8)+e[r-1],o.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return o.join("")};for(var n=[],a=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,s=_.length;i0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e,t,r){for(var a,o,_=[],i=t;i>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return _.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,r,n,a){var o,_,i=8*a-n-1,s=(1<>1,u=-7,l=r?a-1:0,d=r?-1:1,f=e[t+l];for(l+=d,o=f&(1<<-u)-1,f>>=-u,u+=i;u>0;o=256*o+e[t+l],l+=d,u-=8);for(_=o&(1<<-u)-1,o>>=-u,u+=n;u>0;_=256*_+e[t+l],l+=d,u-=8);if(0===o)o=1-c;else{if(o===s)return _?NaN:1/0*(f?-1:1);_+=Math.pow(2,n),o-=c}return(f?-1:1)*_*Math.pow(2,o-n)},t.write=function(e,t,r,n,a,o){var _,i,s,c=8*o-a-1,u=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(i=isNaN(t)?1:0,_=u):(_=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-_))<1&&(_--,s*=2),(t+=_+l>=1?d/s:d*Math.pow(2,1-l))*s>=2&&(_++,s/=2),_+l>=u?(i=0,_=u):_+l>=1?(i=(t*s-1)*Math.pow(2,a),_+=l):(i=t*Math.pow(2,l-1)*Math.pow(2,a),_=0));a>=8;e[r+f]=255&i,f+=p,i/=256,a-=8);for(_=_<0;e[r+f]=255&_,f+=p,_/=256,c-=8);e[r+f-p]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(module,exports,__webpack_require__){"use strict";(function(Buffer){var __awaiter=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(a,o){function _(e){try{s(n.next(e))}catch(e){o(e)}}function i(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(_,i)}s((n=n.apply(e,t||[])).next())}))},__generator=this&&this.__generator||function(e,t){var r,n,a,o,_={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(o){return function(i){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;_;)try{if(r=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return _.label++,{value:o[1],done:!1};case 5:_.label++,n=o[1],o=[0];continue;case 7:o=_.ops.pop(),_.trys.pop();continue;default:if(!(a=_.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){_=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1] = T extends Promise ? R : T;\r\n\r\nlet isSetLogLevel = false;\r\nlet isPluginLoaded = false;\r\n\r\nexport const _afterPluginsLoaded = any>(\r\n fn: T,\r\n): ((...args: Parameters) => Promise>>) => {\r\n const canPromise = Boolean(window.Promise);\r\n\r\n return async function (...args: Parameters): Promise>> {\r\n if (!isPluginLoaded) {\r\n try {\r\n require('../vendor/cadesplugin_api');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(\r\n _extractMeaningfulErrorMessage(error) || 'Ошибка при подключении модуля для работы с Cades plugin',\r\n );\r\n }\r\n\r\n isPluginLoaded = true;\r\n }\r\n\r\n const { cadesplugin } = window;\r\n\r\n if (!canPromise) {\r\n throw new Error('Необходим полифилл для Promise');\r\n }\r\n\r\n if (!cadesplugin) {\r\n throw new Error('Не подключен модуль для работы с Cades plugin');\r\n }\r\n\r\n if (!isSetLogLevel) {\r\n cadesplugin.set_log_level(cadesplugin.LOG_LEVEL_ERROR);\r\n\r\n isSetLogLevel = true;\r\n }\r\n\r\n try {\r\n await cadesplugin;\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(\r\n _extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации модуля для работы с Cades plugin',\r\n );\r\n }\r\n\r\n return await fn.apply(this, args);\r\n };\r\n};\r\n","export const _extractMeaningfulErrorMessage = (error: Error): string | null => {\n let errorContainer = window.cadesplugin?.getLastError && window.cadesplugin.getLastError(error);\n\n if (!errorContainer?.message) {\n if (!error.message) {\n return null;\n }\n\n errorContainer = error;\n }\n\n const containsRussianLetters = /[а-яА-Я]/.test(errorContainer.message);\n\n if (!containsRussianLetters) {\n return null;\n }\n\n const searchResult = errorContainer.message.match(/^(.*?)(?:(?:\\.?\\s?\\(?(0x[0-9a-zA-Z]{1,8})\\))|(?:\\.?$))/);\n\n return (searchResult ? searchResult[1] + (searchResult[2] ? '. Код ошибки: ' + searchResult[2] : '') : null);\n};\n","// синтетические переменные, которые подменяются в рантайме\r\nexport const __cadesAsyncToken__ = {};\r\nexport const __createCadesPluginObject__ = (...args): any => ({});\r\n\r\nfunction getGeneratorConstructor(): GeneratorFunction {\r\n return new Function('', 'return Object.getPrototypeOf(function*(){}).constructor')();\r\n}\r\n\r\nexport const _generateCadesFn = (callback: Function): string => {\r\n const { cadesplugin } = window;\r\n const cadesGeneratorsAPI = Boolean(cadesplugin.CreateObjectAsync);\r\n const callbackName = callback.name || 'dynamicFn';\r\n const callbackLiteral = String(callback);\r\n const callbackArguments = callbackLiteral.match(/^function[\\s\\w]*?\\((.*?)\\)/)?.[1] || '';\r\n const callbackBody = callbackLiteral.replace(/^.*?{([\\s\\S]*?)}$/, '$1');\r\n let crossEnvCallbackLiteral = String(\r\n new (cadesGeneratorsAPI ? getGeneratorConstructor() : Function)(callbackArguments, callbackBody),\r\n );\r\n\r\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(\r\n /\\w+?\\.__createCadesPluginObject__(\\([\\s\\S]*?\\))/gm,\r\n `cadesplugin.CreateObject${cadesGeneratorsAPI ? 'Async' : ''}$1`,\r\n );\r\n\r\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(\r\n /\\w+?\\.__cadesAsyncToken__\\s*?\\+\\s*?\\b/gm,\r\n cadesGeneratorsAPI ? 'yield ' : '',\r\n );\r\n\r\n if (!cadesGeneratorsAPI) {\r\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/propset_(.*?)\\((.*?)\\)/gm, '$1 = $2');\r\n }\r\n\r\n return [\r\n cadesGeneratorsAPI ? `cadesplugin.async_spawn(${crossEnvCallbackLiteral});` : `(${crossEnvCallbackLiteral})();`,\r\n `//# sourceURL=crypto-pro_${callbackName}.js`,\r\n ].join('');\r\n};\r\n","export * from './cades-constants';\r\nexport * from './issuer-tags-translations';\r\nexport * from './oids-dictionary';\r\nexport * from './subject-tags-translations';\r\n","import { CadesCertificate } from '../api/certificate';\r\nimport { _afterPluginsLoaded } from './_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from './_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from './_generateCadesFn';\r\n\r\n/**\r\n * Возвращает сертификат в формате Cades по отпечатку\r\n *\r\n * @param thumbprint - отпечаток сертификата\r\n * @returns сертификат в формате Cades\r\n */\r\nexport const _getCadesCert = _afterPluginsLoaded(\r\n (thumbprint: string): CadesCertificate => {\r\n const { cadesplugin } = window;\r\n\r\n return eval(\r\n _generateCadesFn(function _getCadesCert() {\r\n let cadesStore;\r\n\r\n try {\r\n cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');\r\n }\r\n\r\n if (!cadesStore) {\r\n throw new Error('Не удалось получить доступ к хранилищу сертификатов');\r\n }\r\n\r\n try {\r\n void (\r\n __cadesAsyncToken__ +\r\n cadesStore.Open(\r\n cadesplugin.CAPICOM_CURRENT_USER_STORE,\r\n cadesplugin.CAPICOM_MY_STORE,\r\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,\r\n )\r\n );\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');\r\n }\r\n\r\n let cadesCertificateList;\r\n let certificatesCount;\r\n\r\n try {\r\n cadesCertificateList = __cadesAsyncToken__ + cadesStore.Certificates;\r\n certificatesCount = __cadesAsyncToken__ + cadesCertificateList.Count;\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');\r\n }\r\n\r\n if (!certificatesCount) {\r\n throw new Error('Нет доступных сертификатов');\r\n }\r\n\r\n let cadesCertificate: CadesCertificate;\r\n\r\n try {\r\n cadesCertificateList =\r\n __cadesAsyncToken__ + cadesCertificateList.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH, thumbprint);\r\n\r\n const count = __cadesAsyncToken__ + cadesCertificateList.Count;\r\n\r\n if (!count) {\r\n throw new Error(`Сертификат с отпечатком: \"${thumbprint}\" не найден`);\r\n }\r\n\r\n cadesCertificate = __cadesAsyncToken__ + cadesCertificateList.Item(1);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении сертификата');\r\n }\r\n\r\n cadesStore.Close();\r\n\r\n return cadesCertificate;\r\n }),\r\n );\r\n },\r\n);\r\n","/**\r\n * Возвращает объект даты, совместимый с Cades plugin'ом, зависящий от браузера.\r\n *\r\n * В IE необходимо использовать специфичный формат \"VT_DATE\"\r\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Microsoft_Extensions/Date.getVarDate\r\n */\r\nexport const _getDateObj = (dateObj): Date => (dateObj.getVarDate ? dateObj.getVarDate() : dateObj);\r\n","import { CadesCertificate, Certificate } from './certificate';\r\nimport { CAPICOM_PROPID_KEY_PROV_INFO } from '../constants';\r\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractCommonName } from '../helpers/_extractCommonName';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\n\r\nlet certificatesCache: Certificate[];\r\n\r\n/**\r\n * Возвращает список сертификатов, доступных пользователю в системе\r\n *\r\n * @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов\r\n * @returns список сертификатов\r\n */\r\nexport const getUserCertificates = _afterPluginsLoaded((resetCache: boolean = false): Certificate[] => {\r\n const { cadesplugin } = window;\r\n\r\n if (!resetCache && certificatesCache) {\r\n return certificatesCache;\r\n }\r\n\r\n return eval(\r\n _generateCadesFn(function getUserCertificates(): Certificate[] {\r\n let cadesStore;\r\n\r\n try {\r\n cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');\r\n }\r\n\r\n try {\r\n void (\r\n __cadesAsyncToken__ +\r\n cadesStore.Open(\r\n cadesplugin.CAPICOM_CURRENT_USER_STORE,\r\n cadesplugin.CAPICOM_MY_STORE,\r\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,\r\n )\r\n );\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');\r\n }\r\n\r\n let cadesCertificates;\r\n let cadesCertificatesCount;\r\n\r\n try {\r\n cadesCertificates = __cadesAsyncToken__ + cadesStore.Certificates;\r\n\r\n if (cadesCertificates) {\r\n cadesCertificates =\r\n __cadesAsyncToken__ + cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID);\r\n\r\n /**\r\n * Не рассматриваются сертификаты, в которых отсутствует закрытый ключ\r\n * или не действительны на данный момент\r\n */\r\n cadesCertificates =\r\n __cadesAsyncToken__ +\r\n cadesCertificates.Find(\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY,\r\n CAPICOM_PROPID_KEY_PROV_INFO,\r\n );\r\n\r\n cadesCertificatesCount = __cadesAsyncToken__ + cadesCertificates.Count;\r\n }\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');\r\n }\r\n\r\n if (!cadesCertificatesCount) {\r\n throw new Error('Нет доступных сертификатов');\r\n }\r\n\r\n const certificateList: Certificate[] = [];\r\n\r\n try {\r\n while (cadesCertificatesCount) {\r\n const cadesCertificate: CadesCertificate =\r\n __cadesAsyncToken__ + cadesCertificates.Item(cadesCertificatesCount);\r\n\r\n certificateList.push(\r\n new Certificate(\r\n cadesCertificate,\r\n _extractCommonName(__cadesAsyncToken__ + cadesCertificate.SubjectName),\r\n __cadesAsyncToken__ + cadesCertificate.IssuerName,\r\n __cadesAsyncToken__ + cadesCertificate.SubjectName,\r\n __cadesAsyncToken__ + cadesCertificate.Thumbprint,\r\n __cadesAsyncToken__ + cadesCertificate.ValidFromDate,\r\n __cadesAsyncToken__ + cadesCertificate.ValidToDate,\r\n ),\r\n );\r\n\r\n cadesCertificatesCount--;\r\n }\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка обработки сертификатов');\r\n }\r\n\r\n cadesStore.Close();\r\n\r\n certificatesCache = certificateList;\r\n\r\n return certificatesCache;\r\n }),\r\n );\r\n});\r\n","export * from './certificate';\r\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\r\nimport { Certificate } from './certificate';\r\n\r\n/**\r\n * Возвращает указанное внутренее свойство у сертификата в формате Cades\r\n *\r\n * @param propName = наименование свойства\r\n * @returns значение запрошенного свойства\r\n */\r\nexport const getCadesProp = _afterPluginsLoaded(function (propName: string): any {\r\n const cadesCertificate = (this as Certificate)._cadesCertificate;\r\n\r\n return eval(\r\n _generateCadesFn(function getCadesProp() {\r\n let propertyValue;\r\n\r\n try {\r\n propertyValue = __cadesAsyncToken__ + cadesCertificate[propName];\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при обращении к свойству сертификата');\r\n }\r\n\r\n return propertyValue;\r\n }),\r\n );\r\n});\r\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\n\r\nexport interface SystemInfo {\r\n cadesVersion: string;\r\n cspVersion: string;\r\n}\r\n\r\n/**\r\n * Предоставляет информацию о системе\r\n *\r\n * @returns информацию о CSP и плагине\r\n */\r\nexport const getSystemInfo = _afterPluginsLoaded(\r\n (): SystemInfo => {\r\n const sysInfo = {\r\n cadesVersion: null,\r\n cspVersion: null,\r\n };\r\n\r\n return eval(\r\n _generateCadesFn(function getSystemInfo(): SystemInfo {\r\n let cadesAbout;\r\n\r\n try {\r\n cadesAbout = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.About');\r\n\r\n sysInfo.cadesVersion = __cadesAsyncToken__ + cadesAbout.PluginVersion;\r\n sysInfo.cspVersion = __cadesAsyncToken__ + cadesAbout.CSPVersion();\r\n\r\n if (!sysInfo.cadesVersion) {\r\n sysInfo.cadesVersion = __cadesAsyncToken__ + cadesAbout.Version;\r\n }\r\n\r\n sysInfo.cadesVersion = __cadesAsyncToken__ + sysInfo.cadesVersion.toString();\r\n sysInfo.cspVersion = __cadesAsyncToken__ + sysInfo.cspVersion.toString();\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении информации о системе');\r\n }\r\n\r\n return sysInfo;\r\n }),\r\n );\r\n },\r\n);\r\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n","export * from './api';\r\n","export * from './getCertificate';\r\nexport * from './getUserCertificates';\r\nexport * from './getSystemInfo';\r\nexport * from './isValidSystemSetup';\r\nexport * from './createSignature';\r\nexport * from './createXMLSignature';\r\nexport * from './createDetachedSignature';\r\nexport * from './createAttachedSignature';\r\nexport * from './createHash';\r\nexport * from './certificate';\r\n","import { Certificate } from './certificate';\r\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { getUserCertificates } from './getUserCertificates';\r\n\r\n/**\r\n * Возвращает сертификат по отпечатку\r\n *\r\n * @param thumbprint - отпечаток сертификата\r\n * @returns сертификат\r\n */\r\nexport const getCertificate = _afterPluginsLoaded(\r\n async (thumbprint: string): Promise => {\r\n if (!thumbprint) {\r\n throw new Error('Отпечаток не указан');\r\n }\r\n\r\n const availableCertificates: Certificate[] = await getUserCertificates();\r\n const foundCertificate: Certificate = availableCertificates.find((cert) => cert.thumbprint === thumbprint);\r\n\r\n if (!foundCertificate) {\r\n throw new Error(`Сертификат с отпечатком: \"${thumbprint}\" не найден`);\r\n }\r\n\r\n return foundCertificate;\r\n },\r\n);\r\n",";(function () {\r\n //already loaded\r\n if(window.cadesplugin)\r\n return;\r\n\r\n var pluginObject;\r\n var plugin_resolved = 0;\r\n var plugin_reject;\r\n var plugin_resolve;\r\n var isOpera = 0;\r\n var isFireFox = 0;\r\n var isEdge = 0;\r\n var isSafari = 0;\r\n var failed_extensions = 0;\r\n\r\n var canPromise = !!window.Promise;\r\n var cadesplugin;\r\n\r\n if(canPromise)\r\n {\r\n cadesplugin = new Promise(function(resolve, reject)\r\n {\r\n plugin_resolve = resolve;\r\n plugin_reject = reject;\r\n });\r\n } else\r\n {\r\n cadesplugin = {};\r\n }\r\n\r\n function check_browser() {\r\n var ua= navigator.userAgent, tem, M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\\/))\\/?\\s*(\\d+)/i) || [];\r\n if(/trident/i.test(M[1])){\r\n tem= /\\brv[ :]+(\\d+)/g.exec(ua) || [];\r\n return {name:'IE',version:(tem[1] || '')};\r\n }\r\n if(M[1]=== 'Chrome'){\r\n tem= ua.match(/\\b(OPR|Edge)\\/(\\d+)/);\r\n if(tem!= null) return {name:tem[1].replace('OPR', 'Opera'),version:tem[2]};\r\n }\r\n M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];\r\n if((tem= ua.match(/version\\/(\\d+)/i))!= null) M.splice(1, 1, tem[1]);\r\n return {name:M[0],version:M[1]};\r\n }\r\n var browserSpecs = check_browser();\r\n\r\n function cpcsp_console_log(level, msg){\r\n //IE9 не может писать в консоль если не открыта вкладка developer tools\r\n if(typeof(console) === 'undefined')\r\n return;\r\n if (level <= cadesplugin.current_log_level ){\r\n if (level === cadesplugin.LOG_LEVEL_DEBUG)\r\n console.log(\"DEBUG: %s\", msg);\r\n if (level === cadesplugin.LOG_LEVEL_INFO)\r\n console.info(\"INFO: %s\", msg);\r\n if (level === cadesplugin.LOG_LEVEL_ERROR)\r\n console.error(\"ERROR: %s\", msg);\r\n return;\r\n }\r\n }\r\n\r\n function set_log_level(level){\r\n if (!((level === cadesplugin.LOG_LEVEL_DEBUG) ||\r\n (level === cadesplugin.LOG_LEVEL_INFO) ||\r\n (level === cadesplugin.LOG_LEVEL_ERROR))){\r\n cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, \"cadesplugin_api.js: Incorrect log_level: \" + level);\r\n return;\r\n }\r\n cadesplugin.current_log_level = level;\r\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG)\r\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = DEBUG\");\r\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO)\r\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = INFO\");\r\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR)\r\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = ERROR\");\r\n if(isNativeMessageSupported())\r\n {\r\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG)\r\n window.postMessage(\"set_log_level=debug\", \"*\");\r\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO)\r\n window.postMessage(\"set_log_level=info\", \"*\");\r\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR)\r\n window.postMessage(\"set_log_level=error\", \"*\");\r\n }\r\n }\r\n\r\n function set_constantValues()\r\n {\r\n cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1;\r\n cadesplugin.CAPICOM_CURRENT_USER_STORE = 2;\r\n cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1;\r\n cadesplugin.CADESCOM_CURRENT_USER_STORE = 2;\r\n cadesplugin.CADESCOM_CONTAINER_STORE = 100;\r\n\r\n cadesplugin.CAPICOM_MY_STORE = \"My\";\r\n\r\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;\r\n\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\r\n\r\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;\r\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;\r\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;\r\n\r\n cadesplugin.XmlDsigGost3410UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411\";\r\n cadesplugin.XmlDsigGost3411UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr3411\";\r\n cadesplugin.XmlDsigGost3410Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411\";\r\n cadesplugin.XmlDsigGost3411Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411\";\r\n\r\n cadesplugin.CADESCOM_CADES_DEFAULT = 0;\r\n cadesplugin.CADESCOM_CADES_BES = 1;\r\n cadesplugin.CADESCOM_CADES_T = 0x5;\r\n cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;\r\n cadesplugin.CADESCOM_PKCS7_TYPE = 0xffff;\r\n\r\n cadesplugin.CADESCOM_ENCODE_BASE64 = 0;\r\n cadesplugin.CADESCOM_ENCODE_BINARY = 1;\r\n cadesplugin.CADESCOM_ENCODE_ANY = -1;\r\n\r\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;\r\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;\r\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;\r\n\r\n cadesplugin.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;\r\n cadesplugin.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;\r\n\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;\r\n\r\n cadesplugin.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;\r\n\r\n cadesplugin.CAPICOM_PROPID_ENHKEY_USAGE = 9;\r\n\r\n cadesplugin.CAPICOM_OID_OTHER = 0;\r\n cadesplugin.CAPICOM_OID_KEY_USAGE_EXTENSION = 10;\r\n\r\n cadesplugin.CAPICOM_EKU_CLIENT_AUTH = 2;\r\n cadesplugin.CAPICOM_EKU_SMARTCARD_LOGON = 5;\r\n cadesplugin.CAPICOM_EKU_OTHER = 0;\r\n\r\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\r\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\r\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\r\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\r\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\r\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\r\n cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1;\r\n\r\n cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0;\r\n cadesplugin.CADESCOM_BASE64_TO_BINARY = 1;\r\n\r\n cadesplugin.CADESCOM_DISPLAY_DATA_NONE = 0;\r\n cadesplugin.CADESCOM_DISPLAY_DATA_CONTENT = 1;\r\n cadesplugin.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;\r\n\r\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;\r\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;\r\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;\r\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;\r\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;\r\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;\r\n\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA1 = 0;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD2 = 1;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD4 = 2;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD5 = 3;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_256 = 4;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_384 = 5;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_512 = 6;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112;\r\n\r\n cadesplugin.LOG_LEVEL_DEBUG = 4;\r\n cadesplugin.LOG_LEVEL_INFO = 2;\r\n cadesplugin.LOG_LEVEL_ERROR = 1;\r\n\r\n cadesplugin.CADESCOM_AllowNone = 0;\r\n cadesplugin.CADESCOM_AllowNoOutstandingRequest = 0x1;\r\n cadesplugin.CADESCOM_AllowUntrustedCertificate = 0x2;\r\n cadesplugin.CADESCOM_AllowUntrustedRoot = 0x4;\r\n cadesplugin.CADESCOM_SkipInstallToStore = 0x10000000;\r\n }\r\n\r\n function async_spawn(generatorFunc) {\r\n function continuer(verb, arg) {\r\n var result;\r\n try {\r\n result = generator[verb](arg);\r\n } catch (err) {\r\n return Promise.reject(err);\r\n }\r\n if (result.done) {\r\n return result.value;\r\n } else {\r\n return Promise.resolve(result.value).then(onFulfilled, onRejected);\r\n }\r\n }\r\n var generator = generatorFunc(Array.prototype.slice.call(arguments, 1));\r\n var onFulfilled = continuer.bind(continuer, \"next\");\r\n var onRejected = continuer.bind(continuer, \"throw\");\r\n return onFulfilled();\r\n }\r\n\r\n function isIE() {\r\n // var retVal = ((\"Microsoft Internet Explorer\" == navigator.appName) || // IE < 11\r\n // navigator.userAgent.match(/Trident\\/./i)); // IE 11\r\n return (browserSpecs.name === 'IE' || browserSpecs.name === 'MSIE');\r\n }\r\n\r\n function isIOS() {\r\n return (navigator.userAgent.match(/ipod/i) ||\r\n navigator.userAgent.match(/ipad/i) ||\r\n navigator.userAgent.match(/iphone/i));\r\n }\r\n\r\n function isNativeMessageSupported()\r\n {\r\n // В IE работаем через NPAPI\r\n if(isIE())\r\n return false;\r\n // В Edge работаем через NativeMessage\r\n if(browserSpecs.name === 'Edge') {\r\n isEdge = true;\r\n return true;\r\n }\r\n // В Chrome, Firefox, Safari и Opera работаем через асинхронную версию в зависимости от версии\r\n if(browserSpecs.name === 'Opera') {\r\n isOpera = true;\r\n if(browserSpecs.version >= 33){\r\n return true;\r\n }\r\n else{\r\n return false;\r\n }\r\n }\r\n if(browserSpecs.name === 'Firefox') {\r\n isFireFox = true;\r\n if(browserSpecs.version >= 52){\r\n return true;\r\n }\r\n else{\r\n return false;\r\n }\r\n }\r\n if(browserSpecs.name === 'Chrome') {\r\n if(browserSpecs.version >= 42){\r\n return true;\r\n }\r\n else{\r\n return false;\r\n }\r\n }\r\n //В Сафари начиная с 12 версии нет NPAPI\r\n if(browserSpecs.name === 'Safari') {\r\n isSafari = true;\r\n if(browserSpecs.version >= 12) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n // Функция активации объектов КриптоПро ЭЦП Browser plug-in\r\n function CreateObject(name) {\r\n if (isIOS()) {\r\n // На iOS для создания объектов используется функция\r\n // call_ru_cryptopro_npcades_10_native_bridge, определенная в IOS_npcades_supp.js\r\n return call_ru_cryptopro_npcades_10_native_bridge(\"CreateObject\", [name]);\r\n }\r\n if (isIE()) {\r\n // В Internet Explorer создаются COM-объекты\r\n if (name.match(/X509Enrollment/i)) {\r\n try {\r\n // Объекты CertEnroll пробуем создавать через нашу фабрику,\r\n // если не получилось то через CX509EnrollmentWebClassFactory\r\n var objCertEnrollClassFactory = document.getElementById(\"webClassFactory\");\r\n return objCertEnrollClassFactory.CreateObject(name);\r\n }\r\n catch (e) {\r\n try {\r\n var objWebClassFactory = document.getElementById(\"certEnrollClassFactory\");\r\n return objWebClassFactory.CreateObject(name);\r\n }\r\n catch (err) {\r\n throw (\"Для создания обьектов X509Enrollment следует настроить веб-узел на использование проверки подлинности по протоколу HTTPS\");\r\n }\r\n }\r\n }\r\n // Объекты CAPICOM и CAdESCOM создаются через CAdESCOM.WebClassFactory\r\n try {\r\n var objWebClassFactory = document.getElementById(\"webClassFactory\");\r\n return objWebClassFactory.CreateObject(name);\r\n }\r\n catch (e) {\r\n // Для версий плагина ниже 2.0.12538\r\n return new ActiveXObject(name);\r\n }\r\n }\r\n // создаются объекты NPAPI\r\n return pluginObject.CreateObject(name);\r\n }\r\n\r\n function decimalToHexString(number) {\r\n if (number < 0) {\r\n number = 0xFFFFFFFF + number + 1;\r\n }\r\n\r\n return number.toString(16).toUpperCase();\r\n }\r\n\r\n function GetMessageFromException(e) {\r\n var err = e.message;\r\n if (!err) {\r\n err = e;\r\n } else if (e.number) {\r\n err += \" (0x\" + decimalToHexString(e.number) + \")\";\r\n }\r\n return err;\r\n }\r\n\r\n function getLastError(exception) {\r\n if(isNativeMessageSupported() || isIE() || isIOS() ) {\r\n return GetMessageFromException(exception);\r\n }\r\n\r\n try {\r\n return pluginObject.getLastError();\r\n } catch(e) {\r\n return GetMessageFromException(exception);\r\n }\r\n }\r\n\r\n // Функция для удаления созданных объектов\r\n function ReleasePluginObjects() {\r\n return cpcsp_chrome_nmcades.ReleasePluginObjects();\r\n }\r\n\r\n // Функция активации асинхронных объектов КриптоПро ЭЦП Browser plug-in\r\n function CreateObjectAsync(name) {\r\n return pluginObject.CreateObjectAsync(name);\r\n }\r\n\r\n //Функции для IOS\r\n var ru_cryptopro_npcades_10_native_bridge = {\r\n callbacksCount : 1,\r\n callbacks : {},\r\n\r\n // Automatically called by native layer when a result is available\r\n resultForCallback : function resultForCallback(callbackId, resultArray) {\r\n var callback = ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId];\r\n if (!callback) return;\r\n callback.apply(null,resultArray);\r\n },\r\n\r\n // Use this in javascript to request native objective-c code\r\n // functionName : string (I think the name is explicit :p)\r\n // args : array of arguments\r\n // callback : function with n-arguments that is going to be called when the native code returned\r\n call : function call(functionName, args, callback) {\r\n var hasCallback = callback && typeof callback === \"function\";\r\n var callbackId = hasCallback ? ru_cryptopro_npcades_10_native_bridge.callbacksCount++ : 0;\r\n\r\n if (hasCallback)\r\n ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId] = callback;\r\n\r\n var iframe = document.createElement(\"IFRAME\");\r\n var arrObjs = new Array(\"_CPNP_handle\");\r\n try{\r\n iframe.setAttribute(\"src\", \"cpnp-js-call:\" + functionName + \":\" + callbackId+ \":\" + encodeURIComponent(JSON.stringify(args, arrObjs)));\r\n } catch(e){\r\n alert(e);\r\n }\r\n document.documentElement.appendChild(iframe);\r\n iframe.parentNode.removeChild(iframe);\r\n iframe = null;\r\n }\r\n };\r\n\r\n function call_ru_cryptopro_npcades_10_native_bridge(functionName, array){\r\n var tmpobj;\r\n var ex;\r\n ru_cryptopro_npcades_10_native_bridge.call(functionName, array, function(e, response){\r\n ex = e;\r\n var str='tmpobj='+response;\r\n eval(str);\r\n if (typeof (tmpobj) === \"string\"){\r\n tmpobj = tmpobj.replace(/\\\\\\n/gm, \"\\n\");\r\n tmpobj = tmpobj.replace(/\\\\\\r/gm, \"\\r\");\r\n }\r\n });\r\n if(ex)\r\n throw ex;\r\n return tmpobj;\r\n }\r\n\r\n function show_firefox_missing_extension_dialog()\r\n {\r\n if (!window.cadesplugin_skip_extension_install)\r\n {\r\n var ovr = document.createElement('div');\r\n ovr.id = \"cadesplugin_ovr\";\r\n ovr.style = \"visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)\";\r\n ovr.innerHTML = \"
\" +\r\n \"\" +\r\n \"

Для работы КриптоПро ЭЦП Browser plugin на данном сайте необходимо расширение для браузера. Убедитесь, что оно у Вас включено или установите его.\" +\r\n \"

Скачать расширение

\" +\r\n \"
\";\r\n document.getElementsByTagName(\"Body\")[0].appendChild(ovr);\r\n document.getElementById(\"cadesplugin_close_install\").addEventListener('click',function()\r\n {\r\n plugin_loaded_error(\"Плагин недоступен\");\r\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\r\n });\r\n\r\n ovr.addEventListener('click',function()\r\n {\r\n plugin_loaded_error(\"Плагин недоступен\");\r\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\r\n });\r\n ovr.style.visibility=\"visible\";\r\n }\r\n }\r\n\r\n\r\n //Выводим окно поверх других с предложением установить расширение для Opera.\r\n //Если установленна переменная cadesplugin_skip_extension_install - не предлагаем установить расширение\r\n function install_opera_extension()\r\n {\r\n if (!window.cadesplugin_skip_extension_install)\r\n {\r\n document.addEventListener('DOMContentLoaded', function() {\r\n var ovr = document.createElement('div');\r\n ovr.id = \"cadesplugin_ovr\";\r\n ovr.style = \"visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)\";\r\n ovr.innerHTML = \"
\" +\r\n \"\" +\r\n \"

Для работы КриптоПро ЭЦП Browser plugin на данном сайте необходимо установить расширение из каталога дополнений Opera.\" +\r\n \"

\" +\r\n \"
\";\r\n document.getElementsByTagName(\"Body\")[0].appendChild(ovr);\r\n var btn_install = document.getElementById(\"cadesplugin_install\");\r\n btn_install.addEventListener('click', function(event) {\r\n opr.addons.installExtension(\"epebfcehmdedogndhlcacafjaacknbcm\",\r\n function()\r\n {\r\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\r\n location.reload();\r\n },\r\n function(){})\r\n });\r\n document.getElementById(\"cadesplugin_close_install\").addEventListener('click',function()\r\n {\r\n plugin_loaded_error(\"Плагин недоступен\");\r\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\r\n });\r\n\r\n ovr.addEventListener('click',function()\r\n {\r\n plugin_loaded_error(\"Плагин недоступен\");\r\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\r\n });\r\n ovr.style.visibility=\"visible\";\r\n document.getElementById(\"cadesplugin_ovr_item\").addEventListener('click',function(e){\r\n e.stopPropagation();\r\n });\r\n });\r\n }else\r\n {\r\n plugin_loaded_error(\"Плагин недоступен\");\r\n }\r\n }\r\n\r\n function firefox_or_edge_nmcades_onload() {\r\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\r\n }\r\n\r\n function nmcades_api_onload () {\r\n window.postMessage(\"cadesplugin_echo_request\", \"*\");\r\n window.addEventListener(\"message\", function (event){\r\n if (typeof(event.data) !== \"string\" || !event.data.match(\"cadesplugin_loaded\"))\r\n return;\r\n if(isFireFox || isEdge || isSafari)\r\n {\r\n // Для Firefox, Сафари, Edge вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js\r\n var url = event.data.substring(event.data.indexOf(\"url:\") + 4);\r\n var fileref = document.createElement('script');\r\n fileref.setAttribute(\"type\", \"text/javascript\");\r\n fileref.setAttribute(\"src\", url);\r\n fileref.onerror = plugin_loaded_error;\r\n fileref.onload = firefox_or_edge_nmcades_onload;\r\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\r\n // Для Firefox, Safari и Edge у нас только по одному расширению.\r\n failed_extensions++;\r\n }else {\r\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\r\n }\r\n }, false);\r\n }\r\n\r\n //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari\r\n function load_extension()\r\n {\r\n\r\n if(isFireFox || isEdge || isSafari){\r\n // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера.\r\n nmcades_api_onload();\r\n } else {\r\n // в асинхронном варианте для chrome и opera подключаем оба расширения\r\n var fileref = document.createElement('script');\r\n fileref.setAttribute(\"type\", \"text/javascript\");\r\n fileref.setAttribute(\"src\", \"chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js\");\r\n fileref.onerror = plugin_loaded_error;\r\n fileref.onload = nmcades_api_onload;\r\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\r\n fileref = document.createElement('script');\r\n fileref.setAttribute(\"type\", \"text/javascript\");\r\n fileref.setAttribute(\"src\", \"chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js\");\r\n fileref.onerror = plugin_loaded_error;\r\n fileref.onload = nmcades_api_onload;\r\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\r\n }\r\n }\r\n\r\n //Загружаем плагин для NPAPI\r\n function load_npapi_plugin()\r\n {\r\n var elem = document.createElement('object');\r\n elem.setAttribute(\"id\", \"cadesplugin_object\");\r\n elem.setAttribute(\"type\", \"application/x-cades\");\r\n elem.setAttribute(\"style\", \"visibility: hidden\");\r\n document.getElementsByTagName(\"body\")[0].appendChild(elem);\r\n pluginObject = document.getElementById(\"cadesplugin_object\");\r\n if(isIE())\r\n {\r\n var elem1 = document.createElement('object');\r\n elem1.setAttribute(\"id\", \"certEnrollClassFactory\");\r\n elem1.setAttribute(\"classid\", \"clsid:884e2049-217d-11da-b2a4-000e7bbb2b09\");\r\n elem1.setAttribute(\"style\", \"visibility: hidden\");\r\n document.getElementsByTagName(\"body\")[0].appendChild(elem1);\r\n var elem2 = document.createElement('object');\r\n elem2.setAttribute(\"id\", \"webClassFactory\");\r\n elem2.setAttribute(\"classid\", \"clsid:B04C8637-10BD-484E-B0DA-B8A039F60024\");\r\n elem2.setAttribute(\"style\", \"visibility: hidden\");\r\n document.getElementsByTagName(\"body\")[0].appendChild(elem2);\r\n }\r\n }\r\n\r\n //Отправляем событие что все ок.\r\n function plugin_loaded()\r\n {\r\n plugin_resolved = 1;\r\n if(canPromise)\r\n {\r\n plugin_resolve();\r\n }else {\r\n window.postMessage(\"cadesplugin_loaded\", \"*\");\r\n }\r\n }\r\n\r\n //Отправляем событие что сломались.\r\n function plugin_loaded_error(msg)\r\n {\r\n if(isNativeMessageSupported())\r\n {\r\n //в асинхронном варианте подключаем оба расширения, если сломались оба пробуем установить для Opera\r\n failed_extensions++;\r\n if(failed_extensions<2)\r\n return;\r\n if(isOpera && (typeof(msg) === 'undefined'|| typeof(msg) === 'object'))\r\n {\r\n install_opera_extension();\r\n return;\r\n }\r\n }\r\n if(typeof(msg) === 'undefined' || typeof(msg) === 'object')\r\n msg = \"Плагин недоступен\";\r\n plugin_resolved = 1;\r\n if(canPromise)\r\n {\r\n plugin_reject(msg);\r\n } else {\r\n window.postMessage(\"cadesplugin_load_error\", \"*\");\r\n }\r\n }\r\n\r\n //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку\r\n function check_load_timeout()\r\n {\r\n if(plugin_resolved === 1)\r\n return;\r\n if(isFireFox)\r\n {\r\n show_firefox_missing_extension_dialog();\r\n }\r\n plugin_resolved = 1;\r\n if(canPromise)\r\n {\r\n plugin_reject(\"Истекло время ожидания загрузки плагина\");\r\n } else {\r\n window.postMessage(\"cadesplugin_load_error\", \"*\");\r\n }\r\n\r\n }\r\n\r\n //Вспомогательная функция для NPAPI\r\n function createPromise(arg)\r\n {\r\n return new Promise(arg);\r\n }\r\n\r\n function check_npapi_plugin (){\r\n try {\r\n var oAbout = CreateObject(\"CAdESCOM.About\");\r\n plugin_loaded();\r\n }\r\n catch (err) {\r\n document.getElementById(\"cadesplugin_object\").style.display = 'none';\r\n // Объект создать не удалось, проверим, установлен ли\r\n // вообще плагин. Такая возможность есть не во всех браузерах\r\n var mimetype = navigator.mimeTypes[\"application/x-cades\"];\r\n if (mimetype) {\r\n var plugin = mimetype.enabledPlugin;\r\n if (plugin) {\r\n plugin_loaded_error(\"Плагин загружен, но не создаются обьекты\");\r\n }else\r\n {\r\n plugin_loaded_error(\"Ошибка при загрузке плагина\");\r\n }\r\n }else\r\n {\r\n plugin_loaded_error(\"Плагин недоступен\");\r\n }\r\n }\r\n }\r\n\r\n //Проверяем работает ли плагин\r\n function check_plugin_working()\r\n {\r\n var div = document.createElement(\"div\");\r\n div.innerHTML = \"\";\r\n var isIeLessThan9 = (div.getElementsByTagName(\"i\").length === 1);\r\n if (isIeLessThan9) {\r\n plugin_loaded_error(\"Internet Explorer версии 8 и ниже не поддерживается\");\r\n return;\r\n }\r\n\r\n if(isNativeMessageSupported())\r\n {\r\n load_extension();\r\n }else if(!canPromise) {\r\n window.addEventListener(\"message\", function (event){\r\n if (event.data !== \"cadesplugin_echo_request\")\r\n return;\r\n load_npapi_plugin();\r\n check_npapi_plugin();\r\n },\r\n false);\r\n }else\r\n {\r\n if(document.readyState === \"complete\"){\r\n load_npapi_plugin();\r\n check_npapi_plugin();\r\n } else {\r\n window.addEventListener(\"load\", function (event) {\r\n load_npapi_plugin();\r\n check_npapi_plugin();\r\n }, false);\r\n }\r\n }\r\n }\r\n\r\n function set_pluginObject(obj)\r\n {\r\n pluginObject = obj;\r\n }\r\n\r\n function is_capilite_enabled()\r\n {\r\n if ((typeof (cadesplugin.EnableInternalCSP) !== 'undefined') && cadesplugin.EnableInternalCSP)\r\n return true;\r\n return false;\r\n };\r\n\r\n //Export\r\n cadesplugin.JSModuleVersion = \"2.1.2\";\r\n cadesplugin.async_spawn = async_spawn;\r\n cadesplugin.set = set_pluginObject;\r\n cadesplugin.set_log_level = set_log_level;\r\n cadesplugin.getLastError = getLastError;\r\n cadesplugin.is_capilite_enabled = is_capilite_enabled;\r\n\r\n if(isNativeMessageSupported())\r\n {\r\n cadesplugin.CreateObjectAsync = CreateObjectAsync;\r\n cadesplugin.ReleasePluginObjects = ReleasePluginObjects;\r\n }\r\n\r\n if(!isNativeMessageSupported())\r\n {\r\n cadesplugin.CreateObject = CreateObject;\r\n }\r\n\r\n if(window.cadesplugin_load_timeout)\r\n {\r\n setTimeout(check_load_timeout, window.cadesplugin_load_timeout);\r\n }\r\n else\r\n {\r\n setTimeout(check_load_timeout, 20000);\r\n }\r\n\r\n set_constantValues();\r\n\r\n cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR;\r\n window.cadesplugin = cadesplugin;\r\n check_plugin_working();\r\n}());\r\n","import { ISSUER_TAGS_TRANSLATIONS, SUBJECT_TAGS_TRANSLATIONS } from '../../constants';\r\nimport { TagTranslation } from '../../helpers/_parseCertInfo';\r\nimport { exportBase64 } from './exportBase64';\r\nimport { getAlgorithm } from './getAlgorithm';\r\nimport { getCadesProp } from './getCadesProp';\r\nimport { getDecodedExtendedKeyUsage, ExtendedKeysTranslations } from './getDecodedExtendedKeyUsage';\r\nimport { getExtendedKeyUsage } from './getExtendedKeyUsage';\r\nimport { getInfo } from './getInfo';\r\nimport { hasExtendedKeyUsage } from './hasExtendedKeyUsage';\r\nimport { isValid } from './isValid';\r\n\r\nexport type CadesCertificate = any;\r\n\r\nexport class Certificate {\r\n constructor(\r\n public _cadesCertificate: CadesCertificate,\r\n public name: string,\r\n public issuerName: string,\r\n public subjectName: string,\r\n public thumbprint: string,\r\n public validFrom: string,\r\n public validTo: string,\r\n ) {}\r\n\r\n public getOwnerInfo(): Promise {\r\n return getInfo.call(this, SUBJECT_TAGS_TRANSLATIONS, 'SubjectName');\r\n }\r\n\r\n public getIssuerInfo(): Promise {\r\n return getInfo.call(this, ISSUER_TAGS_TRANSLATIONS, 'IssuerName');\r\n }\r\n\r\n public getExtendedKeyUsage(): Promise {\r\n return getExtendedKeyUsage.call(this);\r\n }\r\n\r\n public getDecodedExtendedKeyUsage(): Promise {\r\n return getDecodedExtendedKeyUsage.call(this);\r\n }\r\n\r\n public getAlgorithm(): Promise {\r\n return getAlgorithm.call(this);\r\n }\r\n\r\n public getCadesProp(propName): Promise {\r\n return getCadesProp.call(this, propName);\r\n }\r\n\r\n public isValid(): Promise {\r\n return isValid.call(this);\r\n }\r\n\r\n public exportBase64(): Promise {\r\n return exportBase64.call(this);\r\n }\r\n\r\n public hasExtendedKeyUsage(oids): Promise {\r\n return hasExtendedKeyUsage.call(this, oids);\r\n }\r\n}\r\n","export const CADESCOM_ATTRIBUTE_OTHER = -1;\r\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\r\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\r\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\r\nexport const CADESCOM_AllowNoOutstandingRequest = 1;\r\nexport const CADESCOM_AllowNone = 0;\r\nexport const CADESCOM_AllowUntrustedCertificate = 2;\r\nexport const CADESCOM_AllowUntrustedRoot = 4;\r\nexport const CADESCOM_BASE64_TO_BINARY = 0x01;\r\nexport const CADESCOM_CADES_BES = 1;\r\nexport const CADESCOM_CADES_DEFAULT = 0;\r\nexport const CADESCOM_CADES_T = 5;\r\nexport const CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;\r\nexport const CADESCOM_CONTAINER_STORE = 100;\r\nexport const CADESCOM_CURRENT_USER_STORE = 2;\r\nexport const CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;\r\nexport const CADESCOM_DISPLAY_DATA_CONTENT = 1;\r\nexport const CADESCOM_DISPLAY_DATA_NONE = 0;\r\nexport const CADESCOM_ENCODE_ANY = -1;\r\nexport const CADESCOM_ENCODE_BASE64 = 0;\r\nexport const CADESCOM_ENCODE_BINARY = 1;\r\nexport const CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;\r\nexport const CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;\r\nexport const CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;\r\nexport const CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;\r\nexport const CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;\r\nexport const CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;\r\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;\r\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;\r\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111;\r\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;\r\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112;\r\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110;\r\nexport const CADESCOM_HASH_ALGORITHM_MD2 = 1;\r\nexport const CADESCOM_HASH_ALGORITHM_MD4 = 2;\r\nexport const CADESCOM_HASH_ALGORITHM_MD5 = 3;\r\nexport const CADESCOM_HASH_ALGORITHM_SHA1 = 0;\r\nexport const CADESCOM_HASH_ALGORITHM_SHA_256 = 4;\r\nexport const CADESCOM_HASH_ALGORITHM_SHA_384 = 5;\r\nexport const CADESCOM_HASH_ALGORITHM_SHA_512 = 6;\r\nexport const CADESCOM_LOCAL_MACHINE_STORE = 1;\r\nexport const CADESCOM_PKCS7_TYPE = 65535;\r\nexport const CADESCOM_STRING_TO_UCS2LE = 0x00;\r\nexport const CADESCOM_SkipInstallToStore = 268435456;\r\nexport const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;\r\nexport const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;\r\nexport const CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;\r\nexport const CAPICOM_ACTIVE_DIRECTORY_USER_STORE = 3;\r\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\r\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\r\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\r\nexport const CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;\r\nexport const CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;\r\nexport const CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;\r\nexport const CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;\r\nexport const CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;\r\nexport const CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;\r\nexport const CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;\r\nexport const CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;\r\nexport const CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\r\nexport const CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;\r\nexport const CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;\r\nexport const CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;\r\nexport const CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;\r\nexport const CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;\r\nexport const CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;\r\nexport const CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;\r\nexport const CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;\r\nexport const CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;\r\nexport const CAPICOM_CURRENT_USER_STORE = 2;\r\nexport const CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;\r\nexport const CAPICOM_EKU_CLIENT_AUTH = 2;\r\nexport const CAPICOM_EKU_OTHER = 0;\r\nexport const CAPICOM_EKU_SMARTCARD_LOGON = 5;\r\nexport const CAPICOM_LOCAL_MACHINE_STORE = 1;\r\nexport const CAPICOM_MEMORY_STORE = 0;\r\nexport const CAPICOM_MY_STORE = 'My';\r\nexport const CAPICOM_OID_KEY_USAGE_EXTENSION = 10;\r\nexport const CAPICOM_OID_OTHER = 0;\r\nexport const CAPICOM_PROPID_ACCESS_STATE = 14;\r\nexport const CAPICOM_PROPID_ARCHIVED = 19;\r\nexport const CAPICOM_PROPID_ARCHIVED_KEY_HASH = 65;\r\nexport const CAPICOM_PROPID_AUTO_ENROLL = 21;\r\nexport const CAPICOM_PROPID_CROSS_CERT_DIST_POINTS = 23;\r\nexport const CAPICOM_PROPID_CTL_USAGE = 9;\r\nexport const CAPICOM_PROPID_DATE_STAMP = 27;\r\nexport const CAPICOM_PROPID_DESCRIPTION = 13;\r\nexport const CAPICOM_PROPID_EFS = 17;\r\nexport const CAPICOM_PROPID_ENHKEY_USAGE = 9;\r\nexport const CAPICOM_PROPID_ENROLLMENT = 26;\r\nexport const CAPICOM_PROPID_EXTENDED_ERROR_INFO = 30;\r\nexport const CAPICOM_PROPID_FIRST_RESERVED = 66;\r\nexport const CAPICOM_PROPID_FIRST_USER = 0x00008000;\r\nexport const CAPICOM_PROPID_FORTEZZA_DATA = 18;\r\nexport const CAPICOM_PROPID_FRIENDLY_NAME = 11;\r\nexport const CAPICOM_PROPID_HASH_PROP = 3;\r\nexport const CAPICOM_PROPID_IE30_RESERVED = 7;\r\nexport const CAPICOM_PROPID_ISSUER_PUBLIC_KEY_MD5_HASH = 24;\r\nexport const CAPICOM_PROPID_ISSUER_SERIAL_NUMBER_MD5_HASH = 28;\r\nexport const CAPICOM_PROPID_KEY_CONTEXT = 5;\r\nexport const CAPICOM_PROPID_KEY_IDENTIFIER = 20;\r\nexport const CAPICOM_PROPID_KEY_PROV_HANDLE = 1;\r\nexport const CAPICOM_PROPID_KEY_PROV_INFO = 2;\r\nexport const CAPICOM_PROPID_KEY_SPEC = 6;\r\nexport const CAPICOM_PROPID_LAST_RESERVED = 0x00007fff;\r\nexport const CAPICOM_PROPID_LAST_USER = 0x0000ffff;\r\nexport const CAPICOM_PROPID_MD5_HASH = 4;\r\nexport const CAPICOM_PROPID_NEXT_UPDATE_LOCATION = 10;\r\nexport const CAPICOM_PROPID_PUBKEY_ALG_PARA = 22;\r\nexport const CAPICOM_PROPID_PUBKEY_HASH_RESERVED = 8;\r\nexport const CAPICOM_PROPID_PVK_FILE = 12;\r\nexport const CAPICOM_PROPID_RENEWAL = 64;\r\nexport const CAPICOM_PROPID_SHA1_HASH = 3;\r\nexport const CAPICOM_PROPID_SIGNATURE_HASH = 15;\r\nexport const CAPICOM_PROPID_SMART_CARD_DATA = 16;\r\nexport const CAPICOM_PROPID_SUBJECT_NAME_MD5_HASH = 29;\r\nexport const CAPICOM_PROPID_SUBJECT_PUBLIC_KEY_MD5_HASH = 25;\r\nexport const CAPICOM_PROPID_UNKNOWN = 0;\r\nexport const CAPICOM_SMART_CARD_USER_STORE = 4;\r\nexport const CAPICOM_STORE_OPEN_EXISTING_ONLY = 128;\r\nexport const CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED = 256;\r\nexport const CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;\r\nexport const CAPICOM_STORE_OPEN_READ_ONLY = 0;\r\nexport const CAPICOM_STORE_OPEN_READ_WRITE = 1;\r\nexport const CHECK_NONE = 0;\r\nexport const CHECK_OFFLINE_REVOCATION_STATUS = 16;\r\nexport const CHECK_ONLINE_REVOCATION_STATUS = 8;\r\nexport const CHECK_SIGNATURE_VALIDITY = 4;\r\nexport const CHECK_TIME_VALIDITY = 2;\r\nexport const CHECK_TRUSTED_ROOT = 1;\r\nexport const LOG_LEVEL_DEBUG = 4;\r\nexport const LOG_LEVEL_ERROR = 1;\r\nexport const LOG_LEVEL_INFO = 2;\r\nexport const TRUST_CTL_IS_NOT_SIGNATURE_VALID = 262144;\r\nexport const TRUST_CTL_IS_NOT_TIME_VALID = 131072;\r\nexport const TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 524288;\r\nexport const TRUST_IS_CYCLIC = 128;\r\nexport const TRUST_IS_NOT_SIGNATURE_VALID = 8;\r\nexport const TRUST_IS_NOT_TIME_NESTED = 2;\r\nexport const TRUST_IS_NOT_TIME_VALID = 1;\r\nexport const TRUST_IS_NOT_VALID_FOR_USAGE = 16;\r\nexport const TRUST_IS_PARTIAL_CHAIN = 65536;\r\nexport const TRUST_IS_REVOKED = 4;\r\nexport const TRUST_IS_UNTRUSTED_ROOT = 32;\r\nexport const TRUST_REVOCATION_STATUS_UNKNOWN = 64;\r\nexport const XmlDsigGost3410Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411';\r\nexport const XmlDsigGost3410UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411';\r\nexport const XmlDsigGost3411Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411';\r\nexport const XmlDsigGost3411UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr3411';\r\n","import { TagsTranslations } from './tags-translations';\r\n\r\nexport const ISSUER_TAGS_TRANSLATIONS: TagsTranslations[] = [\r\n { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' },\r\n { possibleNames: ['CN'], translation: 'Удостоверяющий центр' },\r\n { possibleNames: ['C'], translation: 'Страна' },\r\n { possibleNames: ['S'], translation: 'Регион' },\r\n { possibleNames: ['STREET'], translation: 'Адрес' },\r\n { possibleNames: ['O'], translation: 'Компания' },\r\n { possibleNames: ['OU'], translation: 'Тип' },\r\n { possibleNames: ['T'], translation: 'Должность' },\r\n { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },\r\n { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },\r\n { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },\r\n { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },\r\n { possibleNames: ['E'], translation: 'Email' },\r\n { possibleNames: ['L'], translation: 'Город' },\r\n];\r\n","export const OIDS_DICTIONARY = {\r\n '1.2.643.2.2.34.6': 'Пользователь Центра Регистрации',\r\n '1.2.643.2.39.1.1': 'Использование в программных продуктах системы \"1С:Предприятие 8\"',\r\n '1.2.643.3.131.1.1': 'ИНН',\r\n '1.2.643.3.141.1.1': 'РНС ФСС',\r\n '1.2.643.3.141.1.2': 'КП ФСС',\r\n '1.2.643.3.2.100.65.13.11': 'Использование в системе АИС \"Госзакупки\" Сахалинской области.',\r\n '1.2.643.3.8.100.1': 'Сертификат типа \"ekey-ГОСТ\"',\r\n '1.2.643.3.8.100.1.1': 'Общее использование в системах ИОК без права заверения финансовых документов',\r\n '1.2.643.3.8.100.1.10':\r\n 'Для участия в электронных торгах и подписания государственного контракта в информационных системах Тендерного комитета города Москвы уполномоченными лицами участников размещения государственного заказа города Москвы',\r\n '1.2.643.3.8.100.1.11':\r\n 'Подписание электронных документов в автоматизированной информационной системе размещения государственного и муниципального заказа Саратовской области',\r\n '1.2.643.3.8.100.1.12': 'Использование в системе государственного заказа Иркутской области',\r\n '1.2.643.3.8.100.1.13':\r\n 'Использование в электронной торговой площадке агентства государственного заказа Красноярского края',\r\n '1.2.643.3.8.100.1.14': 'Использование в электронной торговой площадке \"Тендер\"',\r\n '1.2.643.3.8.100.1.2': 'Передача отчетности по ТКС',\r\n '1.2.643.3.8.100.1.3': 'Оформление взаимных обязательств, соглашений, договоров, актов и т.п.',\r\n '1.2.643.3.8.100.1.4': 'Внутрикорпоративный документооборот',\r\n '1.2.643.3.8.100.1.5': 'Использование в системах электронной торговли',\r\n '1.2.643.3.8.100.1.6': 'Использование в торгово-закупочной системе \"ЭЛЕКТРА\"',\r\n '1.2.643.3.8.100.1.7': 'Использование в системе Портал государственных закупок Ставропольского края.',\r\n '1.2.643.3.8.100.1.8': 'Использование в Единой системе электронной торговли B2B-Center и B2G.',\r\n '1.2.643.3.8.100.1.9':\r\n 'Для участия в электронных торгах и подписания государственного контракта в электронной площадке ОАО «ЕЭТП» уполномоченными лицами участников размещения государственного или муниципального заказа',\r\n '1.2.643.5.1.24.2.1.3':\r\n 'Формирование документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя',\r\n '1.2.643.5.1.24.2.1.3.1':\r\n 'Формирование кадастровым инженером документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя',\r\n '1.2.643.5.1.24.2.2.2': 'Формирование документов как результата оказания услуги со стороны органов регистрации прав',\r\n '1.2.643.5.1.24.2.2.3':\r\n 'Формирование документов для получения государственных услуг в сфере государственной регистрации прав на недвижимое имущество и сделок с ним со стороны заявителя',\r\n '1.2.643.6.2.1.7.1':\r\n 'Использование единоличным исполнительным органом юридического лица или уполномоченными представителями юридического лица в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских и иных прав и обязанностей в сфере негосударственного пенсионного обеспечения, негосударственного пенсионного страхования, в сфере деятельности паевых инвестиционных фондов, акционерных инвестиционных фондов, профессиональных участников рынка ценных бумаг, а также связанной с обслуживанием указанной деятельности услуг кредитных и иных организаций',\r\n '1.2.643.6.2.1.7.2':\r\n 'Использование физическим лицом в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских прав и обязанностей в отношении инвестиционных паев паевых инвестиционных фондов, в том числе отношения, связанные с учетом и/или фиксацией прав на инвестиционные паи паевых инвестиционных фондов',\r\n '1.2.643.6.3':\r\n 'Использование в электронных торговых системах и в программном обеспечении, связанным с обменом электронных сообщений',\r\n '1.2.643.6.3.1.1': 'Использование на электронных площадок отобранных для проведения аукционах в электронной форме',\r\n '1.2.643.6.3.1.2.1': 'Тип участника - Юридическое лицо',\r\n '1.2.643.6.3.1.2.2': 'Тип участника - Физическое лицо',\r\n '1.2.643.6.3.1.2.3': 'Тип участника - Индивидуальный предприниматель',\r\n '1.2.643.6.3.1.3.1': 'Участник размещения заказа',\r\n '1.2.643.6.3.1.4.1': 'Администратор организации',\r\n '1.2.643.6.3.1.4.2': 'Уполномоченный специалист',\r\n '1.2.643.6.3.1.4.3': 'Специалист с правом подписи контракта',\r\n '1.2.840.113549.1.9.2': 'Неструктурированное имя',\r\n '1.3.6.1.4.1.24138.1.1.8.1': 'Обеспечение юридической значимости в Системе \"Электронная Торговая Площадка\"',\r\n '1.3.6.1.4.1.29919.21': 'Использование в системе Портал государственных закупок Ростовской области \"Рефери\".',\r\n '1.3.6.1.5.5.7.3.2': 'Проверка подлинности клиента',\r\n '1.3.6.1.5.5.7.3.4': 'Защищенная электронная почта',\r\n '1.3.643.3.8.100.15': 'Использование в ЭТП \"uTender\"',\r\n};\r\n","import { TagsTranslations } from './tags-translations';\r\n\r\nexport const SUBJECT_TAGS_TRANSLATIONS: TagsTranslations[] = [\r\n { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' },\r\n { possibleNames: ['CN'], translation: 'Владелец' },\r\n { possibleNames: ['SN'], translation: 'Фамилия' },\r\n { possibleNames: ['G'], translation: 'Имя Отчество' },\r\n { possibleNames: ['C'], translation: 'Страна' },\r\n { possibleNames: ['S'], translation: 'Регион' },\r\n { possibleNames: ['STREET'], translation: 'Адрес' },\r\n { possibleNames: ['O'], translation: 'Компания' },\r\n { possibleNames: ['OU'], translation: 'Отдел/подразделение' },\r\n { possibleNames: ['T'], translation: 'Должность' },\r\n { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },\r\n { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },\r\n { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },\r\n { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },\r\n { possibleNames: ['E'], translation: 'Email' },\r\n { possibleNames: ['L'], translation: 'Город' },\r\n];\r\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\r\nimport { Certificate } from './certificate';\r\n\r\n/**\r\n * Экспортирует сертификат в формате base64\r\n *\r\n * @returns сертификат в формате base64\r\n */\r\nexport const exportBase64 = _afterPluginsLoaded(function (): string {\r\n const cadesCertificate = (this as Certificate)._cadesCertificate;\r\n\r\n return eval(\r\n _generateCadesFn(function exportBase64(): string {\r\n let base64: string;\r\n\r\n try {\r\n base64 = __cadesAsyncToken__ + cadesCertificate.Export(0);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при экспорте сертификата');\r\n }\r\n\r\n return base64;\r\n }),\r\n );\r\n});\r\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\r\nimport { Certificate } from './certificate';\r\n\r\ninterface AlgorithmInfo {\r\n algorithm: string;\r\n oid: string;\r\n}\r\n\r\n/**\r\n * Возвращает информацию об алгоритме сертификата\r\n *\r\n * @returns информацию об алгоритме и его OID'е\r\n */\r\nexport const getAlgorithm = _afterPluginsLoaded(function (): AlgorithmInfo {\r\n const cadesCertificate = (this as Certificate)._cadesCertificate;\r\n\r\n return eval(\r\n _generateCadesFn(function getAlgorithm(): AlgorithmInfo {\r\n const algorithmInfo: AlgorithmInfo = {\r\n algorithm: null,\r\n oid: null,\r\n };\r\n let cadesPublicKey;\r\n\r\n try {\r\n cadesPublicKey = __cadesAsyncToken__ + cadesCertificate.PublicKey();\r\n cadesPublicKey = __cadesAsyncToken__ + cadesPublicKey.Algorithm;\r\n algorithmInfo.algorithm = __cadesAsyncToken__ + cadesPublicKey.FriendlyName;\r\n algorithmInfo.oid = __cadesAsyncToken__ + cadesPublicKey.Value;\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении алгоритма');\r\n }\r\n\r\n return algorithmInfo;\r\n }),\r\n );\r\n});\r\n","import { OIDS_DICTIONARY } from '../../constants';\r\nimport { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { Certificate } from './certificate';\r\n\r\nexport interface ExtendedKeysTranslations {\r\n [key: string]: string | null;\r\n}\r\n\r\n/**\r\n * Возвращает расшифрованные ОИД'ы сертификата\r\n *\r\n * @returns словарь расшифрованных ОИД'ов\r\n */\r\nexport const getDecodedExtendedKeyUsage = _afterPluginsLoaded(async function (): Promise {\r\n const certificateOids = await (this as Certificate).getExtendedKeyUsage();\r\n\r\n return certificateOids.reduce(\r\n (decodedOids, oidCode) => ({\r\n ...decodedOids,\r\n [oidCode]: OIDS_DICTIONARY[oidCode] || null,\r\n }),\r\n {},\r\n );\r\n});\r\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\r\nimport { Certificate } from './certificate';\r\n\r\n/**\r\n * Возвращает ОИД'ы сертификата\r\n *\r\n * @returns список ОИД'ов\r\n */\r\nexport const getExtendedKeyUsage = _afterPluginsLoaded(function (): string[] {\r\n const cadesCertificate = (this as Certificate)._cadesCertificate;\r\n\r\n return eval(\r\n _generateCadesFn(function getExtendedKeyUsage(): string[] {\r\n const OIDS: string[] = [];\r\n let count: any;\r\n\r\n try {\r\n count = __cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage();\r\n count = __cadesAsyncToken__ + count.EKUs;\r\n count = __cadesAsyncToken__ + count.Count;\r\n\r\n if (count > 0) {\r\n while (count > 0) {\r\n let cadesExtendedKeyUsage;\r\n\r\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage();\r\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.EKUs;\r\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.Item(count);\r\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.OID;\r\n\r\n OIDS.push(cadesExtendedKeyUsage);\r\n\r\n count--;\r\n }\r\n }\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || \"Ошибка при получении ОИД'ов\");\r\n }\r\n\r\n return OIDS;\r\n }),\r\n );\r\n});\r\n","import { TagsTranslations } from '../../constants/tags-translations';\r\nimport { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\r\nimport { _parseCertInfo, TagTranslation } from '../../helpers/_parseCertInfo';\r\nimport { getCadesProp } from './getCadesProp';\r\n\r\n/**\r\n * Возвращает расшифрованную информацию о сертификате из указанного свойства по тэгам\r\n *\r\n * @param tags = словарь\r\n * @param entitiesPath = путь к разбираемой сущности\r\n * @returns расшифрованная информация по отдельным тэгам\r\n */\r\nexport const getInfo = _afterPluginsLoaded(async function (\r\n tags: TagsTranslations[],\r\n entitiesPath: string,\r\n): Promise {\r\n let entities: string;\r\n\r\n try {\r\n entities = await getCadesProp.call(this, entitiesPath);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при извлечении информации из сертификата');\r\n }\r\n\r\n return _parseCertInfo(tags, entities);\r\n});\r\n","import { OIDS_DICTIONARY } from '../constants';\r\nimport { TagsTranslations } from '../constants/tags-translations';\r\n\r\nexport interface TagTranslation {\r\n description: string;\r\n title: string;\r\n isTranslated: boolean;\r\n}\r\n\r\n/**\r\n * Парсит информацию из строки с информацией о сертификате\r\n *\r\n * @param tagsTranslations - словарь с расшифровками тэгов\r\n * @param rawInfo - данные для парсинга\r\n * @returns расшифрованная информация по отдельным тэгам\r\n */\r\nexport const _parseCertInfo = (tagsTranslations: TagsTranslations[], rawInfo: string): TagTranslation[] => {\r\n const extractedEntities: string[] = rawInfo.match(/([а-яА-Яa-zA-Z0-9\\s.]+)=(?:(\"[^\"]+?\")|(.+?))(?:,|$)/g);\r\n\r\n if (extractedEntities) {\r\n return extractedEntities.map((group) => {\r\n const segmentsMatch = group.trim().match(/^([а-яА-Яa-zA-Z0-9\\s.]+)=(.+?),?$/);\r\n let title = segmentsMatch?.[1];\r\n // Вырезаем лишние кавычки\r\n const description = segmentsMatch?.[2]?.replace(/^\"(.*)\"/, '$1')?.replace(/\"{2}/g, '\"');\r\n const oidIdentifierMatch = title?.match(/^OID\\.(.*)/);\r\n const oidIdentifier = oidIdentifierMatch?.[1];\r\n let isTranslated = false;\r\n\r\n // Если нашли в тайтле ОИД, пытаемся его расшифровать\r\n if (oidIdentifier) {\r\n const oidTranslation = OIDS_DICTIONARY[oidIdentifier];\r\n\r\n if (oidTranslation) {\r\n title = oidTranslation;\r\n isTranslated = true;\r\n }\r\n }\r\n\r\n const tagTranslation = tagsTranslations.find((tag) => tag.possibleNames.find((name) => name === title))\r\n ?.translation;\r\n\r\n if (tagTranslation) {\r\n title = tagTranslation;\r\n isTranslated = true;\r\n }\r\n\r\n return { description, title, isTranslated };\r\n });\r\n }\r\n};\r\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { Certificate } from './certificate';\r\n\r\n/**\r\n * Проверяет наличие ОИД'а (ОИД'ов) у сертификата\r\n *\r\n * @param oids - ОИД'ы для проверки\r\n * @returns флаг наличия ОИД'ов у сертификата\r\n */\r\nexport const hasExtendedKeyUsage = _afterPluginsLoaded(async function (oids: string | string[]): Promise {\r\n const certOids = await (this as Certificate).getExtendedKeyUsage();\r\n\r\n let result: boolean;\r\n\r\n if (Array.isArray(oids)) {\r\n result = oids.every((oidToCheck) => certOids.some((certOid) => certOid === oidToCheck));\r\n } else {\r\n result = certOids.some((certOid) => certOid === oids);\r\n }\r\n\r\n return result;\r\n});\r\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\r\nimport { Certificate } from './certificate';\r\n\r\n/**\r\n * Проверяет действительность сертификата\r\n *\r\n * @returns флаг валидности\r\n */\r\nexport const isValid = _afterPluginsLoaded(function (): boolean {\r\n const cadesCertificate = (this as Certificate)._cadesCertificate;\r\n\r\n return eval(\r\n _generateCadesFn(function isValid() {\r\n let isValid;\r\n\r\n try {\r\n isValid = __cadesAsyncToken__ + cadesCertificate.IsValid();\r\n isValid = __cadesAsyncToken__ + isValid.Result;\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при проверке сертификата');\r\n }\r\n\r\n return Boolean(isValid);\r\n }),\r\n );\r\n});\r\n","export const _extractCommonName = (subjectName: string): string | undefined =>\r\n subjectName.match(/CN=(.+?)(?:,|$)/)?.[1];\r\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { _isSupportedCadesVersion } from '../helpers/_isSupportedCadesVersion';\r\nimport { _isSupportedCSPVersion } from '../helpers/_isSupportedCSPVersion';\r\nimport { getSystemInfo, SystemInfo } from './getSystemInfo';\r\n\r\n/**\r\n * Проверяет корректность настроек ЭП на машине\r\n *\r\n * @returns флаг корректности настроек\r\n */\r\nexport const isValidSystemSetup = _afterPluginsLoaded(\r\n async (): Promise => {\r\n let systemInfo: SystemInfo;\r\n\r\n try {\r\n systemInfo = await getSystemInfo();\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Настройки ЭП на данной машине не верны');\r\n }\r\n\r\n if (!_isSupportedCadesVersion(systemInfo.cadesVersion)) {\r\n throw new Error('Не поддерживаемая версия плагина');\r\n }\r\n\r\n if (!_isSupportedCSPVersion(systemInfo.cspVersion)) {\r\n throw new Error('Не поддерживаемая версия CSP');\r\n }\r\n\r\n return true;\r\n },\r\n);\r\n","export const _isSupportedCadesVersion = (version: string): boolean => {\r\n const match = version.match(/(\\d+)\\.(\\d+)\\.(\\d+)/);\r\n\r\n if (!match) {\r\n return false;\r\n }\r\n\r\n const [, major, minor, patch] = match;\r\n\r\n if (Number(major) < 2) {\r\n return false;\r\n }\r\n\r\n if (Number(major) === 2 && Number(patch) < 12438) {\r\n return false;\r\n }\r\n\r\n return true;\r\n};\r\n","const oldestSupportedCSPVersion = 4.0;\r\n\r\nexport const _isSupportedCSPVersion = (version: string): boolean => {\r\n version = version.match(/\\d+?\\b(?:\\.\\d+)?/)?.[0];\r\n\r\n return Number(version) >= oldestSupportedCSPVersion;\r\n};\r\n","import { CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME } from '../constants';\r\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\nimport { _getCadesCert } from '../helpers/_getCadesCert';\r\nimport { _getDateObj } from '../helpers/_getDateObj';\r\n\r\n/**\r\n * Создает подпись base64 строки по отпечатку сертификата\r\n *\r\n * @param thumbprint - отпечаток сертификата\r\n * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11\r\n * @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false)\r\n * @returns подпись\r\n */\r\nexport const createSignature = _afterPluginsLoaded(\r\n async (thumbprint: string, messageHash: string, detachedSignature: boolean = true): Promise => {\r\n console.warn(\r\n [\r\n 'cryptoPro: Метод \"createSignature\" является устаревшим и будет убран из будущих версий.',\r\n 'Используйте \"createAttachedSignature\" и \"createDetachedSignature\".',\r\n ].join('\\n'),\r\n );\r\n\r\n const { cadesplugin } = window;\r\n const cadesCertificate = await _getCadesCert(thumbprint);\r\n\r\n return eval(\r\n _generateCadesFn(function createSignature(): string {\r\n let cadesAttrs;\r\n let cadesSignedData;\r\n let cadesSigner;\r\n\r\n try {\r\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\r\n cadesSignedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CadesSignedData');\r\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\r\n }\r\n\r\n const currentTime = _getDateObj(new Date());\r\n\r\n try {\r\n void (__cadesAsyncToken__ + cadesAttrs.propset_Name(CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME));\r\n void (__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи');\r\n }\r\n\r\n let cadesAuthAttrs;\r\n\r\n try {\r\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\r\n cadesAuthAttrs = __cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2;\r\n void (__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs));\r\n void (__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));\r\n void (__cadesAsyncToken__ + cadesSignedData.propset_Content(messageHash));\r\n void (\r\n __cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY)\r\n );\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи');\r\n }\r\n\r\n let signature: string;\r\n\r\n try {\r\n signature =\r\n __cadesAsyncToken__ +\r\n cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_CADES_BES, detachedSignature);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных');\r\n }\r\n\r\n return signature;\r\n }),\r\n );\r\n },\r\n);\r\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\nimport { _getCadesCert } from '../helpers/_getCadesCert';\r\n\r\n/**\r\n * Создает XML подпись для документа в формате XML\r\n *\r\n * @param thumbprint - отпечаток сертификата\r\n * @param unencryptedMessage - подписываемое сообщение в формате XML\r\n * @returns подпись\r\n */\r\nexport const createXMLSignature = _afterPluginsLoaded(\r\n async (thumbprint: string, unencryptedMessage: string): Promise => {\r\n const { cadesplugin } = window;\r\n const cadesCertificate = await _getCadesCert(thumbprint);\r\n\r\n return eval(\r\n _generateCadesFn(function createXMLSignature(): string {\r\n let cadesSigner;\r\n let cadesSignedXML;\r\n\r\n try {\r\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\r\n cadesSignedXML = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.SignedXML');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\r\n }\r\n\r\n try {\r\n const signatureMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256';\r\n const digestMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256';\r\n\r\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\r\n void (__cadesAsyncToken__ + cadesSigner.propset_CheckCertificate(true));\r\n void (__cadesAsyncToken__ + cadesSignedXML.propset_Content(unencryptedMessage));\r\n void (\r\n __cadesAsyncToken__ +\r\n cadesSignedXML.propset_SignatureType(cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED)\r\n );\r\n void (__cadesAsyncToken__ + cadesSignedXML.propset_SignatureMethod(signatureMethod));\r\n void (__cadesAsyncToken__ + cadesSignedXML.propset_DigestMethod(digestMethod));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи');\r\n }\r\n\r\n let signature: string;\r\n\r\n try {\r\n signature = __cadesAsyncToken__ + cadesSignedXML.Sign(cadesSigner);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных');\r\n }\r\n\r\n return signature;\r\n }),\r\n );\r\n },\r\n);\r\n","import { CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME } from '../constants';\r\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\nimport { _getCadesCert } from '../helpers/_getCadesCert';\r\nimport { _getDateObj } from '../helpers/_getDateObj';\r\n\r\n/**\r\n * Создает отсоединенную подпись хеша по отпечатку сертификата\r\n *\r\n * @param thumbprint - отпечаток сертификата\r\n * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11-2012 256 бит\r\n * @returns подпись в формате PKCS#7\r\n */\r\nexport const createDetachedSignature = _afterPluginsLoaded(\r\n async (thumbprint: string, messageHash: string): Promise => {\r\n const { cadesplugin } = window;\r\n const cadesCertificate = await _getCadesCert(thumbprint);\r\n\r\n return eval(\r\n _generateCadesFn(function createDetachedSignature(): string {\r\n let cadesAttrs;\r\n let cadesHashedData;\r\n let cadesSignedData;\r\n let cadesSigner;\r\n\r\n try {\r\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\r\n cadesHashedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.HashedData');\r\n cadesSignedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CadesSignedData');\r\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\r\n }\r\n\r\n const currentTime = _getDateObj(new Date());\r\n\r\n try {\r\n void (__cadesAsyncToken__ + cadesAttrs.propset_Name(CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME));\r\n void (__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи');\r\n }\r\n\r\n let cadesAuthAttrs;\r\n\r\n try {\r\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\r\n cadesAuthAttrs = __cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2;\r\n void (__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs));\r\n void (__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке сертификата');\r\n }\r\n\r\n try {\r\n void (\r\n __cadesAsyncToken__ +\r\n cadesHashedData.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256)\r\n );\r\n void (__cadesAsyncToken__ + cadesHashedData.SetHashValue(messageHash));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке хеша');\r\n }\r\n\r\n let signature: string;\r\n\r\n try {\r\n signature =\r\n __cadesAsyncToken__ +\r\n cadesSignedData.SignHash(cadesHashedData, cadesSigner, cadesplugin.CADESCOM_PKCS7_TYPE);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных');\r\n }\r\n\r\n return signature;\r\n }),\r\n );\r\n },\r\n);\r\n","import { CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME } from '../constants';\r\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\nimport { _getCadesCert } from '../helpers/_getCadesCert';\r\nimport { _getDateObj } from '../helpers/_getDateObj';\r\n\r\n/**\r\n * Создает присоединенную подпись сообщения по отпечатку сертификата\r\n *\r\n * @param thumbprint - отпечаток сертификата\r\n * @param message - подписываемое сообщение\r\n * @returns подпись в формате PKCS#7\r\n */\r\nexport const createAttachedSignature = _afterPluginsLoaded(\r\n async (thumbprint: string, unencryptedMessage: string | ArrayBuffer): Promise => {\r\n const { cadesplugin } = window;\r\n const cadesCertificate = await _getCadesCert(thumbprint);\r\n\r\n return eval(\r\n _generateCadesFn(function createAttachedSignature(): string {\r\n let cadesAttrs;\r\n let cadesSignedData;\r\n let cadesSigner;\r\n\r\n try {\r\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\r\n cadesSignedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CadesSignedData');\r\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\r\n }\r\n\r\n const currentTime = _getDateObj(new Date());\r\n\r\n try {\r\n void (__cadesAsyncToken__ + cadesAttrs.propset_Name(CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME));\r\n void (__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи');\r\n }\r\n\r\n let messageBase64;\r\n\r\n try {\r\n messageBase64 = Buffer.from(unencryptedMessage).toString('base64');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error('Ошибка при преобразовании сообщения в Base64');\r\n }\r\n\r\n let cadesAuthAttrs;\r\n\r\n try {\r\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\r\n cadesAuthAttrs = __cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2;\r\n void (__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs));\r\n void (__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));\r\n void (__cadesAsyncToken__ + cadesSignedData.propset_Content(messageBase64));\r\n void (__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи');\r\n }\r\n\r\n let signature: string;\r\n\r\n try {\r\n signature = __cadesAsyncToken__ + cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_PKCS7_TYPE);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных');\r\n }\r\n\r\n return signature;\r\n }),\r\n );\r\n },\r\n);\r\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\n\r\n/**\r\n * Создает хеш сообщения по ГОСТ Р 34.11-2012 256 бит\r\n * https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%B8%D0%B1%D0%BE%D0%B3_(%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F)\r\n *\r\n * @param unencryptedMessage - сообщение для хеширования\r\n *\r\n * @returns хеш\r\n */\r\nexport const createHash = _afterPluginsLoaded(\r\n async (unencryptedMessage: string | ArrayBuffer): Promise => {\r\n const { cadesplugin } = window;\r\n\r\n return eval(\r\n _generateCadesFn(function createHash(): string {\r\n const cadesHashedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.HashedData');\r\n let messageBase64;\r\n let hash;\r\n\r\n try {\r\n messageBase64 = Buffer.from(unencryptedMessage).toString('base64');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error('Ошибка при преобразовании сообщения в Base64');\r\n }\r\n\r\n try {\r\n void (\r\n __cadesAsyncToken__ +\r\n cadesHashedData.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256)\r\n );\r\n void (__cadesAsyncToken__ + cadesHashedData.propset_DataEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));\r\n void (__cadesAsyncToken__ + cadesHashedData.Hash(messageBase64));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации хэширования');\r\n }\r\n\r\n try {\r\n hash = __cadesAsyncToken__ + cadesHashedData.Value;\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при создании хэша');\r\n }\r\n\r\n return hash;\r\n }),\r\n );\r\n },\r\n);\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/examples/angular/browserslist b/examples/angular/browserslist index 8084853..ade2627 100644 --- a/examples/angular/browserslist +++ b/examples/angular/browserslist @@ -1,12 +1,15 @@ -# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. -# For additional information regarding the format and rule options, please see: -# https://github.com/browserslist/browserslist#queries +#!/bin/sh +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") -# You can see what browsers were selected by your queries by running: -# npx browserslist +case `uname` in + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; +esac -> 0.5% -last 2 versions -Firefox ESR -not dead -not IE 9-11 # For IE 9-11 support, remove 'not'. \ No newline at end of file +if [ -x "$basedir/node" ]; then + "$basedir/node" "$basedir/node_modules/browserslist/cli.js" "$@" + ret=$? +else + node "$basedir/node_modules/browserslist/cli.js" "$@" + ret=$? +fi +exit $ret diff --git a/lib/crypto-pro.d.ts b/lib/crypto-pro.d.ts deleted file mode 100644 index c1bda63..0000000 --- a/lib/crypto-pro.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -// Type definitions for crypto-pro 2.2.0 -// Project: crypto-pro -// Definitions by: Vitalii Goma https://github.com/vgoma - -export * from './api'; diff --git a/lib/crypto-pro.js b/lib/crypto-pro.js deleted file mode 100644 index 73c8cc8..0000000 --- a/lib/crypto-pro.js +++ /dev/null @@ -1,4705 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define("cryptoPro", [], factory); - else if(typeof exports === 'object') - exports["cryptoPro"] = factory(); - else - root["cryptoPro"] = factory(); -})(window, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./crypto-pro.ts"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "../node_modules/base64-js/index.js": -/*!******************************************!*\ - !*** ../node_modules/base64-js/index.js ***! - \******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.byteLength = byteLength -exports.toByteArray = toByteArray -exports.fromByteArray = fromByteArray - -var lookup = [] -var revLookup = [] -var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array - -var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' -for (var i = 0, len = code.length; i < len; ++i) { - lookup[i] = code[i] - revLookup[code.charCodeAt(i)] = i -} - -// Support decoding URL-safe base64 strings, as Node.js does. -// See: https://en.wikipedia.org/wiki/Base64#URL_applications -revLookup['-'.charCodeAt(0)] = 62 -revLookup['_'.charCodeAt(0)] = 63 - -function getLens (b64) { - var len = b64.length - - if (len % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4') - } - - // Trim off extra bytes after placeholder bytes are found - // See: https://github.com/beatgammit/base64-js/issues/42 - var validLen = b64.indexOf('=') - if (validLen === -1) validLen = len - - var placeHoldersLen = validLen === len - ? 0 - : 4 - (validLen % 4) - - return [validLen, placeHoldersLen] -} - -// base64 is 4/3 + up to two characters of the original data -function byteLength (b64) { - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function _byteLength (b64, validLen, placeHoldersLen) { - return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen -} - -function toByteArray (b64) { - var tmp - var lens = getLens(b64) - var validLen = lens[0] - var placeHoldersLen = lens[1] - - var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) - - var curByte = 0 - - // if there are placeholders, only get up to the last complete 4 chars - var len = placeHoldersLen > 0 - ? validLen - 4 - : validLen - - var i - for (i = 0; i < len; i += 4) { - tmp = - (revLookup[b64.charCodeAt(i)] << 18) | - (revLookup[b64.charCodeAt(i + 1)] << 12) | - (revLookup[b64.charCodeAt(i + 2)] << 6) | - revLookup[b64.charCodeAt(i + 3)] - arr[curByte++] = (tmp >> 16) & 0xFF - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 2) { - tmp = - (revLookup[b64.charCodeAt(i)] << 2) | - (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[curByte++] = tmp & 0xFF - } - - if (placeHoldersLen === 1) { - tmp = - (revLookup[b64.charCodeAt(i)] << 10) | - (revLookup[b64.charCodeAt(i + 1)] << 4) | - (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[curByte++] = (tmp >> 8) & 0xFF - arr[curByte++] = tmp & 0xFF - } - - return arr -} - -function tripletToBase64 (num) { - return lookup[num >> 18 & 0x3F] + - lookup[num >> 12 & 0x3F] + - lookup[num >> 6 & 0x3F] + - lookup[num & 0x3F] -} - -function encodeChunk (uint8, start, end) { - var tmp - var output = [] - for (var i = start; i < end; i += 3) { - tmp = - ((uint8[i] << 16) & 0xFF0000) + - ((uint8[i + 1] << 8) & 0xFF00) + - (uint8[i + 2] & 0xFF) - output.push(tripletToBase64(tmp)) - } - return output.join('') -} - -function fromByteArray (uint8) { - var tmp - var len = uint8.length - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - var parts = [] - var maxChunkLength = 16383 // must be multiple of 3 - - // go through the array every three bytes, we'll deal with trailing stuff later - for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { - parts.push(encodeChunk( - uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength) - )) - } - - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - parts.push( - lookup[tmp >> 2] + - lookup[(tmp << 4) & 0x3F] + - '==' - ) - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + uint8[len - 1] - parts.push( - lookup[tmp >> 10] + - lookup[(tmp >> 4) & 0x3F] + - lookup[(tmp << 2) & 0x3F] + - '=' - ) - } - - return parts.join('') -} - - -/***/ }), - -/***/ "../node_modules/buffer/index.js": -/*!***************************************!*\ - !*** ../node_modules/buffer/index.js ***! - \***************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(global) {/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -/* eslint-disable no-proto */ - - - -var base64 = __webpack_require__(/*! base64-js */ "../node_modules/base64-js/index.js") -var ieee754 = __webpack_require__(/*! ieee754 */ "../node_modules/ieee754/index.js") -var isArray = __webpack_require__(/*! isarray */ "../node_modules/isarray/index.js") - -exports.Buffer = Buffer -exports.SlowBuffer = SlowBuffer -exports.INSPECT_MAX_BYTES = 50 - -/** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Use Object implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * Due to various browser bugs, sometimes the Object implementation will be used even - * when the browser supports typed arrays. - * - * Note: - * - * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, - * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. - * - * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. - * - * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of - * incorrect length in some situations. - - * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they - * get the Object implementation, which is slower but behaves correctly. - */ -Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined - ? global.TYPED_ARRAY_SUPPORT - : typedArraySupport() - -/* - * Export kMaxLength after typed array support is determined. - */ -exports.kMaxLength = kMaxLength() - -function typedArraySupport () { - try { - var arr = new Uint8Array(1) - arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }} - return arr.foo() === 42 && // typed array instances can be augmented - typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` - arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` - } catch (e) { - return false - } -} - -function kMaxLength () { - return Buffer.TYPED_ARRAY_SUPPORT - ? 0x7fffffff - : 0x3fffffff -} - -function createBuffer (that, length) { - if (kMaxLength() < length) { - throw new RangeError('Invalid typed array length') - } - if (Buffer.TYPED_ARRAY_SUPPORT) { - // Return an augmented `Uint8Array` instance, for best performance - that = new Uint8Array(length) - that.__proto__ = Buffer.prototype - } else { - // Fallback: Return an object instance of the Buffer class - if (that === null) { - that = new Buffer(length) - } - that.length = length - } - - return that -} - -/** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ - -function Buffer (arg, encodingOrOffset, length) { - if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { - return new Buffer(arg, encodingOrOffset, length) - } - - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') { - throw new Error( - 'If encoding is specified then the first argument must be a string' - ) - } - return allocUnsafe(this, arg) - } - return from(this, arg, encodingOrOffset, length) -} - -Buffer.poolSize = 8192 // not used by this implementation - -// TODO: Legacy, not needed anymore. Remove in next major version. -Buffer._augment = function (arr) { - arr.__proto__ = Buffer.prototype - return arr -} - -function from (that, value, encodingOrOffset, length) { - if (typeof value === 'number') { - throw new TypeError('"value" argument must not be a number') - } - - if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { - return fromArrayBuffer(that, value, encodingOrOffset, length) - } - - if (typeof value === 'string') { - return fromString(that, value, encodingOrOffset) - } - - return fromObject(that, value) -} - -/** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ -Buffer.from = function (value, encodingOrOffset, length) { - return from(null, value, encodingOrOffset, length) -} - -if (Buffer.TYPED_ARRAY_SUPPORT) { - Buffer.prototype.__proto__ = Uint8Array.prototype - Buffer.__proto__ = Uint8Array - if (typeof Symbol !== 'undefined' && Symbol.species && - Buffer[Symbol.species] === Buffer) { - // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 - Object.defineProperty(Buffer, Symbol.species, { - value: null, - configurable: true - }) - } -} - -function assertSize (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be a number') - } else if (size < 0) { - throw new RangeError('"size" argument must not be negative') - } -} - -function alloc (that, size, fill, encoding) { - assertSize(size) - if (size <= 0) { - return createBuffer(that, size) - } - if (fill !== undefined) { - // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpretted as a start offset. - return typeof encoding === 'string' - ? createBuffer(that, size).fill(fill, encoding) - : createBuffer(that, size).fill(fill) - } - return createBuffer(that, size) -} - -/** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ -Buffer.alloc = function (size, fill, encoding) { - return alloc(null, size, fill, encoding) -} - -function allocUnsafe (that, size) { - assertSize(size) - that = createBuffer(that, size < 0 ? 0 : checked(size) | 0) - if (!Buffer.TYPED_ARRAY_SUPPORT) { - for (var i = 0; i < size; ++i) { - that[i] = 0 - } - } - return that -} - -/** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ -Buffer.allocUnsafe = function (size) { - return allocUnsafe(null, size) -} -/** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ -Buffer.allocUnsafeSlow = function (size) { - return allocUnsafe(null, size) -} - -function fromString (that, string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' - } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('"encoding" must be a valid string encoding') - } - - var length = byteLength(string, encoding) | 0 - that = createBuffer(that, length) - - var actual = that.write(string, encoding) - - if (actual !== length) { - // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - that = that.slice(0, actual) - } - - return that -} - -function fromArrayLike (that, array) { - var length = array.length < 0 ? 0 : checked(array.length) | 0 - that = createBuffer(that, length) - for (var i = 0; i < length; i += 1) { - that[i] = array[i] & 255 - } - return that -} - -function fromArrayBuffer (that, array, byteOffset, length) { - array.byteLength // this throws if `array` is not a valid ArrayBuffer - - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('\'offset\' is out of bounds') - } - - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('\'length\' is out of bounds') - } - - if (byteOffset === undefined && length === undefined) { - array = new Uint8Array(array) - } else if (length === undefined) { - array = new Uint8Array(array, byteOffset) - } else { - array = new Uint8Array(array, byteOffset, length) - } - - if (Buffer.TYPED_ARRAY_SUPPORT) { - // Return an augmented `Uint8Array` instance, for best performance - that = array - that.__proto__ = Buffer.prototype - } else { - // Fallback: Return an object instance of the Buffer class - that = fromArrayLike(that, array) - } - return that -} - -function fromObject (that, obj) { - if (Buffer.isBuffer(obj)) { - var len = checked(obj.length) | 0 - that = createBuffer(that, len) - - if (that.length === 0) { - return that - } - - obj.copy(that, 0, 0, len) - return that - } - - if (obj) { - if ((typeof ArrayBuffer !== 'undefined' && - obj.buffer instanceof ArrayBuffer) || 'length' in obj) { - if (typeof obj.length !== 'number' || isnan(obj.length)) { - return createBuffer(that, 0) - } - return fromArrayLike(that, obj) - } - - if (obj.type === 'Buffer' && isArray(obj.data)) { - return fromArrayLike(that, obj.data) - } - } - - throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') -} - -function checked (length) { - // Note: cannot use `length < kMaxLength()` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= kMaxLength()) { - throw new RangeError('Attempt to allocate Buffer larger than maximum ' + - 'size: 0x' + kMaxLength().toString(16) + ' bytes') - } - return length | 0 -} - -function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0 - } - return Buffer.alloc(+length) -} - -Buffer.isBuffer = function isBuffer (b) { - return !!(b != null && b._isBuffer) -} - -Buffer.compare = function compare (a, b) { - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError('Arguments must be Buffers') - } - - if (a === b) return 0 - - var x = a.length - var y = b.length - - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i] - y = b[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -Buffer.isEncoding = function isEncoding (encoding) { - switch (String(encoding).toLowerCase()) { - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true - default: - return false - } -} - -Buffer.concat = function concat (list, length) { - if (!isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - - if (list.length === 0) { - return Buffer.alloc(0) - } - - var i - if (length === undefined) { - length = 0 - for (i = 0; i < list.length; ++i) { - length += list[i].length - } - } - - var buffer = Buffer.allocUnsafe(length) - var pos = 0 - for (i = 0; i < list.length; ++i) { - var buf = list[i] - if (!Buffer.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - buf.copy(buffer, pos) - pos += buf.length - } - return buffer -} - -function byteLength (string, encoding) { - if (Buffer.isBuffer(string)) { - return string.length - } - if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && - (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { - return string.byteLength - } - if (typeof string !== 'string') { - string = '' + string - } - - var len = string.length - if (len === 0) return 0 - - // Use a for loop to avoid recursion - var loweredCase = false - for (;;) { - switch (encoding) { - case 'ascii': - case 'latin1': - case 'binary': - return len - case 'utf8': - case 'utf-8': - case undefined: - return utf8ToBytes(string).length - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2 - case 'hex': - return len >>> 1 - case 'base64': - return base64ToBytes(string).length - default: - if (loweredCase) return utf8ToBytes(string).length // assume utf8 - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} -Buffer.byteLength = byteLength - -function slowToString (encoding, start, end) { - var loweredCase = false - - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) { - start = 0 - } - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) { - return '' - } - - if (end === undefined || end > this.length) { - end = this.length - } - - if (end <= 0) { - return '' - } - - // Force coersion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0 - start >>>= 0 - - if (end <= start) { - return '' - } - - if (!encoding) encoding = 'utf8' - - while (true) { - switch (encoding) { - case 'hex': - return hexSlice(this, start, end) - - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end) - - case 'ascii': - return asciiSlice(this, start, end) - - case 'latin1': - case 'binary': - return latin1Slice(this, start, end) - - case 'base64': - return base64Slice(this, start, end) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() - loweredCase = true - } - } -} - -// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect -// Buffer instances. -Buffer.prototype._isBuffer = true - -function swap (b, n, m) { - var i = b[n] - b[n] = b[m] - b[m] = i -} - -Buffer.prototype.swap16 = function swap16 () { - var len = this.length - if (len % 2 !== 0) { - throw new RangeError('Buffer size must be a multiple of 16-bits') - } - for (var i = 0; i < len; i += 2) { - swap(this, i, i + 1) - } - return this -} - -Buffer.prototype.swap32 = function swap32 () { - var len = this.length - if (len % 4 !== 0) { - throw new RangeError('Buffer size must be a multiple of 32-bits') - } - for (var i = 0; i < len; i += 4) { - swap(this, i, i + 3) - swap(this, i + 1, i + 2) - } - return this -} - -Buffer.prototype.swap64 = function swap64 () { - var len = this.length - if (len % 8 !== 0) { - throw new RangeError('Buffer size must be a multiple of 64-bits') - } - for (var i = 0; i < len; i += 8) { - swap(this, i, i + 7) - swap(this, i + 1, i + 6) - swap(this, i + 2, i + 5) - swap(this, i + 3, i + 4) - } - return this -} - -Buffer.prototype.toString = function toString () { - var length = this.length | 0 - if (length === 0) return '' - if (arguments.length === 0) return utf8Slice(this, 0, length) - return slowToString.apply(this, arguments) -} - -Buffer.prototype.equals = function equals (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return true - return Buffer.compare(this, b) === 0 -} - -Buffer.prototype.inspect = function inspect () { - var str = '' - var max = exports.INSPECT_MAX_BYTES - if (this.length > 0) { - str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') - if (this.length > max) str += ' ... ' - } - return '' -} - -Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { - if (!Buffer.isBuffer(target)) { - throw new TypeError('Argument must be a Buffer') - } - - if (start === undefined) { - start = 0 - } - if (end === undefined) { - end = target ? target.length : 0 - } - if (thisStart === undefined) { - thisStart = 0 - } - if (thisEnd === undefined) { - thisEnd = this.length - } - - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError('out of range index') - } - - if (thisStart >= thisEnd && start >= end) { - return 0 - } - if (thisStart >= thisEnd) { - return -1 - } - if (start >= end) { - return 1 - } - - start >>>= 0 - end >>>= 0 - thisStart >>>= 0 - thisEnd >>>= 0 - - if (this === target) return 0 - - var x = thisEnd - thisStart - var y = end - start - var len = Math.min(x, y) - - var thisCopy = this.slice(thisStart, thisEnd) - var targetCopy = target.slice(start, end) - - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i] - y = targetCopy[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 -} - -// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, -// OR the last index of `val` in `buffer` at offset <= `byteOffset`. -// -// Arguments: -// - buffer - a Buffer to search -// - val - a string, Buffer, or number -// - byteOffset - an index into `buffer`; will be clamped to an int32 -// - encoding - an optional encoding, relevant is val is a string -// - dir - true for indexOf, false for lastIndexOf -function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1 - - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset - byteOffset = 0 - } else if (byteOffset > 0x7fffffff) { - byteOffset = 0x7fffffff - } else if (byteOffset < -0x80000000) { - byteOffset = -0x80000000 - } - byteOffset = +byteOffset // Coerce to Number. - if (isNaN(byteOffset)) { - // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : (buffer.length - 1) - } - - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset - if (byteOffset >= buffer.length) { - if (dir) return -1 - else byteOffset = buffer.length - 1 - } else if (byteOffset < 0) { - if (dir) byteOffset = 0 - else return -1 - } - - // Normalize val - if (typeof val === 'string') { - val = Buffer.from(val, encoding) - } - - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) { - return -1 - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir) - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - if (Buffer.TYPED_ARRAY_SUPPORT && - typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) - } - } - return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) - } - - throw new TypeError('val must be string, number or Buffer') -} - -function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - var indexSize = 1 - var arrLength = arr.length - var valLength = val.length - - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase() - if (encoding === 'ucs2' || encoding === 'ucs-2' || - encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) { - return -1 - } - indexSize = 2 - arrLength /= 2 - valLength /= 2 - byteOffset /= 2 - } - } - - function read (buf, i) { - if (indexSize === 1) { - return buf[i] - } else { - return buf.readUInt16BE(i * indexSize) - } - } - - var i - if (dir) { - var foundIndex = -1 - for (i = byteOffset; i < arrLength; i++) { - if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize - } else { - if (foundIndex !== -1) i -= i - foundIndex - foundIndex = -1 - } - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength - for (i = byteOffset; i >= 0; i--) { - var found = true - for (var j = 0; j < valLength; j++) { - if (read(arr, i + j) !== read(val, j)) { - found = false - break - } - } - if (found) return i - } - } - - return -1 -} - -Buffer.prototype.includes = function includes (val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1 -} - -Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true) -} - -Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false) -} - -function hexWrite (buf, string, offset, length) { - offset = Number(offset) || 0 - var remaining = buf.length - offset - if (!length) { - length = remaining - } else { - length = Number(length) - if (length > remaining) { - length = remaining - } - } - - // must be an even number of digits - var strLen = string.length - if (strLen % 2 !== 0) throw new TypeError('Invalid hex string') - - if (length > strLen / 2) { - length = strLen / 2 - } - for (var i = 0; i < length; ++i) { - var parsed = parseInt(string.substr(i * 2, 2), 16) - if (isNaN(parsed)) return i - buf[offset + i] = parsed - } - return i -} - -function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) -} - -function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) -} - -function latin1Write (buf, string, offset, length) { - return asciiWrite(buf, string, offset, length) -} - -function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) -} - -function ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) -} - -Buffer.prototype.write = function write (string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8' - length = this.length - offset = 0 - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset - length = this.length - offset = 0 - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset | 0 - if (isFinite(length)) { - length = length | 0 - if (encoding === undefined) encoding = 'utf8' - } else { - encoding = length - length = undefined - } - // legacy write(string, encoding, offset, length) - remove in v0.13 - } else { - throw new Error( - 'Buffer.write(string, encoding, offset[, length]) is no longer supported' - ) - } - - var remaining = this.length - offset - if (length === undefined || length > remaining) length = remaining - - if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { - throw new RangeError('Attempt to write outside buffer bounds') - } - - if (!encoding) encoding = 'utf8' - - var loweredCase = false - for (;;) { - switch (encoding) { - case 'hex': - return hexWrite(this, string, offset, length) - - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length) - - case 'ascii': - return asciiWrite(this, string, offset, length) - - case 'latin1': - case 'binary': - return latin1Write(this, string, offset, length) - - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } -} - -Buffer.prototype.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } -} - -function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) - } -} - -function utf8Slice (buf, start, end) { - end = Math.min(buf.length, end) - var res = [] - - var i = start - while (i < end) { - var firstByte = buf[i] - var codePoint = null - var bytesPerSequence = (firstByte > 0xEF) ? 4 - : (firstByte > 0xDF) ? 3 - : (firstByte > 0xBF) ? 2 - : 1 - - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint - - switch (bytesPerSequence) { - case 1: - if (firstByte < 0x80) { - codePoint = firstByte - } - break - case 2: - secondByte = buf[i + 1] - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) - if (tempCodePoint > 0x7F) { - codePoint = tempCodePoint - } - } - break - case 3: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { - codePoint = tempCodePoint - } - } - break - case 4: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - fourthByte = buf[i + 3] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { - codePoint = tempCodePoint - } - } - } - } - - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD - bytesPerSequence = 1 - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000 - res.push(codePoint >>> 10 & 0x3FF | 0xD800) - codePoint = 0xDC00 | codePoint & 0x3FF - } - - res.push(codePoint) - i += bytesPerSequence - } - - return decodeCodePointsArray(res) -} - -// Based on http://stackoverflow.com/a/22747272/680742, the browser with -// the lowest limit is Chrome, with 0x10000 args. -// We go 1 magnitude less, for safety -var MAX_ARGUMENTS_LENGTH = 0x1000 - -function decodeCodePointsArray (codePoints) { - var len = codePoints.length - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - } - - // Decode in chunks to avoid "call stack size exceeded". - var res = '' - var i = 0 - while (i < len) { - res += String.fromCharCode.apply( - String, - codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) - ) - } - return res -} - -function asciiSlice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i] & 0x7F) - } - return ret -} - -function latin1Slice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i]) - } - return ret -} - -function hexSlice (buf, start, end) { - var len = buf.length - - if (!start || start < 0) start = 0 - if (!end || end < 0 || end > len) end = len - - var out = '' - for (var i = start; i < end; ++i) { - out += toHex(buf[i]) - } - return out -} - -function utf16leSlice (buf, start, end) { - var bytes = buf.slice(start, end) - var res = '' - for (var i = 0; i < bytes.length; i += 2) { - res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) - } - return res -} - -Buffer.prototype.slice = function slice (start, end) { - var len = this.length - start = ~~start - end = end === undefined ? len : ~~end - - if (start < 0) { - start += len - if (start < 0) start = 0 - } else if (start > len) { - start = len - } - - if (end < 0) { - end += len - if (end < 0) end = 0 - } else if (end > len) { - end = len - } - - if (end < start) end = start - - var newBuf - if (Buffer.TYPED_ARRAY_SUPPORT) { - newBuf = this.subarray(start, end) - newBuf.__proto__ = Buffer.prototype - } else { - var sliceLen = end - start - newBuf = new Buffer(sliceLen, undefined) - for (var i = 0; i < sliceLen; ++i) { - newBuf[i] = this[i + start] - } - } - - return newBuf -} - -/* - * Need to make sure that buffer isn't trying to write out of bounds. - */ -function checkOffset (offset, ext, length) { - if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') -} - -Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - - return val -} - -Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - checkOffset(offset, byteLength, this.length) - } - - var val = this[offset + --byteLength] - var mul = 1 - while (byteLength > 0 && (mul *= 0x100)) { - val += this[offset + --byteLength] * mul - } - - return val -} - -Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] -} - -Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - return this[offset] | (this[offset + 1] << 8) -} - -Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] -} - -Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return ((this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16)) + - (this[offset + 3] * 0x1000000) -} - -Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] * 0x1000000) + - ((this[offset + 1] << 16) | - (this[offset + 2] << 8) | - this[offset + 3]) -} - -Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var i = byteLength - var mul = 1 - var val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val -} - -Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { - if (!noAssert) checkOffset(offset, 1, this.length) - if (!(this[offset] & 0x80)) return (this[offset]) - return ((0xff - this[offset] + 1) * -1) -} - -Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset] | (this[offset + 1] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset + 1] | (this[offset] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val -} - -Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) -} - -Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) -} - -Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, true, 23, 4) -} - -Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, false, 23, 4) -} - -Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, true, 52, 8) -} - -Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, false, 52, 8) -} - -function checkInt (buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') - if (offset + ext > buf.length) throw new RangeError('Index out of range') -} - -Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var mul = 1 - var i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var i = byteLength - 1 - var mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) - if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) - this[offset] = (value & 0xff) - return offset + 1 -} - -function objectWriteUInt16 (buf, value, offset, littleEndian) { - if (value < 0) value = 0xffff + value + 1 - for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { - buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> - (littleEndian ? i : 1 - i) * 8 - } -} - -Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - } else { - objectWriteUInt16(this, value, offset, true) - } - return offset + 2 -} - -Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - } else { - objectWriteUInt16(this, value, offset, false) - } - return offset + 2 -} - -function objectWriteUInt32 (buf, value, offset, littleEndian) { - if (value < 0) value = 0xffffffff + value + 1 - for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { - buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff - } -} - -Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset + 3] = (value >>> 24) - this[offset + 2] = (value >>> 16) - this[offset + 1] = (value >>> 8) - this[offset] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, true) - } - return offset + 4 -} - -Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, false) - } - return offset + 4 -} - -Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = 0 - var mul = 1 - var sub = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = byteLength - 1 - var mul = 1 - var sub = 0 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength -} - -Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) - if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) - if (value < 0) value = 0xff + value + 1 - this[offset] = (value & 0xff) - return offset + 1 -} - -Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - } else { - objectWriteUInt16(this, value, offset, true) - } - return offset + 2 -} - -Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - } else { - objectWriteUInt16(this, value, offset, false) - } - return offset + 2 -} - -Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - this[offset + 2] = (value >>> 16) - this[offset + 3] = (value >>> 24) - } else { - objectWriteUInt32(this, value, offset, true) - } - return offset + 4 -} - -Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (value < 0) value = 0xffffffff + value + 1 - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, false) - } - return offset + 4 -} - -function checkIEEE754 (buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range') - if (offset < 0) throw new RangeError('Index out of range') -} - -function writeFloat (buf, value, offset, littleEndian, noAssert) { - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) - } - ieee754.write(buf, value, offset, littleEndian, 23, 4) - return offset + 4 -} - -Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) -} - -function writeDouble (buf, value, offset, littleEndian, noAssert) { - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) - } - ieee754.write(buf, value, offset, littleEndian, 52, 8) - return offset + 8 -} - -Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) -} - -Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) -} - -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!start) start = 0 - if (!end && end !== 0) end = this.length - if (targetStart >= target.length) targetStart = target.length - if (!targetStart) targetStart = 0 - if (end > 0 && end < start) end = start - - // Copy 0 bytes; we're done - if (end === start) return 0 - if (target.length === 0 || this.length === 0) return 0 - - // Fatal error conditions - if (targetStart < 0) { - throw new RangeError('targetStart out of bounds') - } - if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') - if (end < 0) throw new RangeError('sourceEnd out of bounds') - - // Are we oob? - if (end > this.length) end = this.length - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start - } - - var len = end - start - var i - - if (this === target && start < targetStart && targetStart < end) { - // descending copy from end - for (i = len - 1; i >= 0; --i) { - target[i + targetStart] = this[i + start] - } - } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { - // ascending copy from start - for (i = 0; i < len; ++i) { - target[i + targetStart] = this[i + start] - } - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, start + len), - targetStart - ) - } - - return len -} - -// Usage: -// buffer.fill(number[, offset[, end]]) -// buffer.fill(buffer[, offset[, end]]) -// buffer.fill(string[, offset[, end]][, encoding]) -Buffer.prototype.fill = function fill (val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start - start = 0 - end = this.length - } else if (typeof end === 'string') { - encoding = end - end = this.length - } - if (val.length === 1) { - var code = val.charCodeAt(0) - if (code < 256) { - val = code - } - } - if (encoding !== undefined && typeof encoding !== 'string') { - throw new TypeError('encoding must be a string') - } - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - } else if (typeof val === 'number') { - val = val & 255 - } - - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError('Out of range index') - } - - if (end <= start) { - return this - } - - start = start >>> 0 - end = end === undefined ? this.length : end >>> 0 - - if (!val) val = 0 - - var i - if (typeof val === 'number') { - for (i = start; i < end; ++i) { - this[i] = val - } - } else { - var bytes = Buffer.isBuffer(val) - ? val - : utf8ToBytes(new Buffer(val, encoding).toString()) - var len = bytes.length - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len] - } - } - - return this -} - -// HELPER FUNCTIONS -// ================ - -var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g - -function base64clean (str) { - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = stringtrim(str).replace(INVALID_BASE64_RE, '') - // Node converts strings with length < 2 to '' - if (str.length < 2) return '' - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while (str.length % 4 !== 0) { - str = str + '=' - } - return str -} - -function stringtrim (str) { - if (str.trim) return str.trim() - return str.replace(/^\s+|\s+$/g, '') -} - -function toHex (n) { - if (n < 16) return '0' + n.toString(16) - return n.toString(16) -} - -function utf8ToBytes (string, units) { - units = units || Infinity - var codePoint - var length = string.length - var leadSurrogate = null - var bytes = [] - - for (var i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i) - - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } - - // valid lead - leadSurrogate = codePoint - - continue - } - - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = codePoint - continue - } - - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 - } else if (leadSurrogate) { - // valid bmp char, but last char was a lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - } - - leadSurrogate = null - - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break - bytes.push(codePoint) - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break - bytes.push( - codePoint >> 0x6 | 0xC0, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break - bytes.push( - codePoint >> 0xC | 0xE0, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break - bytes.push( - codePoint >> 0x12 | 0xF0, - codePoint >> 0xC & 0x3F | 0x80, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else { - throw new Error('Invalid code point') - } - } - - return bytes -} - -function asciiToBytes (str) { - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - // Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF) - } - return byteArray -} - -function utf16leToBytes (str, units) { - var c, hi, lo - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) break - - c = str.charCodeAt(i) - hi = c >> 8 - lo = c % 256 - byteArray.push(lo) - byteArray.push(hi) - } - - return byteArray -} - -function base64ToBytes (str) { - return base64.toByteArray(base64clean(str)) -} - -function blitBuffer (src, dst, offset, length) { - for (var i = 0; i < length; ++i) { - if ((i + offset >= dst.length) || (i >= src.length)) break - dst[i + offset] = src[i] - } - return i -} - -function isnan (val) { - return val !== val // eslint-disable-line no-self-compare -} - -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "../node_modules/webpack/buildin/global.js"))) - -/***/ }), - -/***/ "../node_modules/ieee754/index.js": -/*!****************************************!*\ - !*** ../node_modules/ieee754/index.js ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -exports.read = function (buffer, offset, isLE, mLen, nBytes) { - var e, m - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var nBits = -7 - var i = isLE ? (nBytes - 1) : 0 - var d = isLE ? -1 : 1 - var s = buffer[offset + i] - - i += d - - e = s & ((1 << (-nBits)) - 1) - s >>= (-nBits) - nBits += eLen - for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - m = e & ((1 << (-nBits)) - 1) - e >>= (-nBits) - nBits += mLen - for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} - - if (e === 0) { - e = 1 - eBias - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity) - } else { - m = m + Math.pow(2, mLen) - e = e - eBias - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen) -} - -exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c - var eLen = (nBytes * 8) - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) - var i = isLE ? 0 : (nBytes - 1) - var d = isLE ? 1 : -1 - var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 - - value = Math.abs(value) - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0 - e = eMax - } else { - e = Math.floor(Math.log(value) / Math.LN2) - if (value * (c = Math.pow(2, -e)) < 1) { - e-- - c *= 2 - } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) - } - if (value * c >= 2) { - e++ - c /= 2 - } - - if (e + eBias >= eMax) { - m = 0 - e = eMax - } else if (e + eBias >= 1) { - m = ((value * c) - 1) * Math.pow(2, mLen) - e = e + eBias - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) - e = 0 - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} - - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} - - buffer[offset + i - d] |= s * 128 -} - - -/***/ }), - -/***/ "../node_modules/isarray/index.js": -/*!****************************************!*\ - !*** ../node_modules/isarray/index.js ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -var toString = {}.toString; - -module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; -}; - - -/***/ }), - -/***/ "../node_modules/webpack/buildin/global.js": -/*!*************************************************!*\ - !*** ../node_modules/webpack/buildin/global.js ***! - \*************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -var g; - -// This works in non-strict mode -g = (function() { - return this; -})(); - -try { - // This works if eval is allowed (see CSP) - g = g || new Function("return this")(); -} catch (e) { - // This works if the window reference is available - if (typeof window === "object") g = window; -} - -// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} - -module.exports = g; - - -/***/ }), - -/***/ "./api/certificate/certificate.ts": -/*!****************************************!*\ - !*** ./api/certificate/certificate.ts ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const constants_1 = __webpack_require__(/*! ../../constants */ "./constants/index.ts"); -const exportBase64_1 = __webpack_require__(/*! ./exportBase64 */ "./api/certificate/exportBase64.ts"); -const getAlgorithm_1 = __webpack_require__(/*! ./getAlgorithm */ "./api/certificate/getAlgorithm.ts"); -const getCadesProp_1 = __webpack_require__(/*! ./getCadesProp */ "./api/certificate/getCadesProp.ts"); -const getDecodedExtendedKeyUsage_1 = __webpack_require__(/*! ./getDecodedExtendedKeyUsage */ "./api/certificate/getDecodedExtendedKeyUsage.ts"); -const getExtendedKeyUsage_1 = __webpack_require__(/*! ./getExtendedKeyUsage */ "./api/certificate/getExtendedKeyUsage.ts"); -const getInfo_1 = __webpack_require__(/*! ./getInfo */ "./api/certificate/getInfo.ts"); -const hasExtendedKeyUsage_1 = __webpack_require__(/*! ./hasExtendedKeyUsage */ "./api/certificate/hasExtendedKeyUsage.ts"); -const isValid_1 = __webpack_require__(/*! ./isValid */ "./api/certificate/isValid.ts"); -class Certificate { - constructor(_cadesCertificate, name, issuerName, subjectName, thumbprint, validFrom, validTo) { - this._cadesCertificate = _cadesCertificate; - this.name = name; - this.issuerName = issuerName; - this.subjectName = subjectName; - this.thumbprint = thumbprint; - this.validFrom = validFrom; - this.validTo = validTo; - } - getOwnerInfo() { - return getInfo_1.getInfo.call(this, constants_1.SUBJECT_TAGS_TRANSLATIONS, 'SubjectName'); - } - getIssuerInfo() { - return getInfo_1.getInfo.call(this, constants_1.ISSUER_TAGS_TRANSLATIONS, 'IssuerName'); - } - getExtendedKeyUsage() { - return getExtendedKeyUsage_1.getExtendedKeyUsage.call(this); - } - getDecodedExtendedKeyUsage() { - return getDecodedExtendedKeyUsage_1.getDecodedExtendedKeyUsage.call(this); - } - getAlgorithm() { - return getAlgorithm_1.getAlgorithm.call(this); - } - getCadesProp(propName) { - return getCadesProp_1.getCadesProp.call(this, propName); - } - isValid() { - return isValid_1.isValid.call(this); - } - exportBase64() { - return exportBase64_1.exportBase64.call(this); - } - hasExtendedKeyUsage(oids) { - return hasExtendedKeyUsage_1.hasExtendedKeyUsage.call(this, oids); - } -} -exports.Certificate = Certificate; - - -/***/ }), - -/***/ "./api/certificate/exportBase64.ts": -/*!*****************************************!*\ - !*** ./api/certificate/exportBase64.ts ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Экспортирует сертификат в формате base64 - * - * @returns сертификат в формате base64 - */ -exports.exportBase64 = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - const cadesCertificate = this._cadesCertificate; - return eval(_generateCadesFn_1._generateCadesFn(function exportBase64() { - let base64; - try { - base64 = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.Export(0); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при экспорте сертификата'); - } - return base64; - })); -}); - - -/***/ }), - -/***/ "./api/certificate/getAlgorithm.ts": -/*!*****************************************!*\ - !*** ./api/certificate/getAlgorithm.ts ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Возвращает информацию об алгоритме сертификата - * - * @returns информацию об алгоритме и его OID'е - */ -exports.getAlgorithm = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - const cadesCertificate = this._cadesCertificate; - return eval(_generateCadesFn_1._generateCadesFn(function getAlgorithm() { - const algorithmInfo = { - algorithm: null, - oid: null, - }; - let cadesPublicKey; - try { - cadesPublicKey = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.PublicKey(); - cadesPublicKey = _generateCadesFn_1.__cadesAsyncToken__ + cadesPublicKey.Algorithm; - algorithmInfo.algorithm = _generateCadesFn_1.__cadesAsyncToken__ + cadesPublicKey.FriendlyName; - algorithmInfo.oid = _generateCadesFn_1.__cadesAsyncToken__ + cadesPublicKey.Value; - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при получении алгоритма'); - } - return algorithmInfo; - })); -}); - - -/***/ }), - -/***/ "./api/certificate/getCadesProp.ts": -/*!*****************************************!*\ - !*** ./api/certificate/getCadesProp.ts ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Возвращает указанное внутренее свойство у сертификата в формате Cades - * - * @param propName = наименование свойства - * @returns значение запрошенного свойства - */ -exports.getCadesProp = _afterPluginsLoaded_1._afterPluginsLoaded(function (propName) { - const cadesCertificate = this._cadesCertificate; - return eval(_generateCadesFn_1._generateCadesFn(function getCadesProp() { - let propertyValue; - try { - propertyValue = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate[propName]; - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при обращении к свойству сертификата'); - } - return propertyValue; - })); -}); - - -/***/ }), - -/***/ "./api/certificate/getDecodedExtendedKeyUsage.ts": -/*!*******************************************************!*\ - !*** ./api/certificate/getDecodedExtendedKeyUsage.ts ***! - \*******************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const constants_1 = __webpack_require__(/*! ../../constants */ "./constants/index.ts"); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -/** - * Возвращает расшифрованные ОИД'ы сертификата - * - * @returns словарь расшифрованных ОИД'ов - */ -exports.getDecodedExtendedKeyUsage = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - return __awaiter(this, void 0, void 0, function* () { - const certificateOids = yield this.getExtendedKeyUsage(); - return certificateOids.reduce((decodedOids, oidCode) => (Object.assign(Object.assign({}, decodedOids), { [oidCode]: constants_1.OIDS_DICTIONARY[oidCode] || null })), {}); - }); -}); - - -/***/ }), - -/***/ "./api/certificate/getExtendedKeyUsage.ts": -/*!************************************************!*\ - !*** ./api/certificate/getExtendedKeyUsage.ts ***! - \************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Возвращает ОИД'ы сертификата - * - * @returns список ОИД'ов - */ -exports.getExtendedKeyUsage = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - const cadesCertificate = this._cadesCertificate; - return eval(_generateCadesFn_1._generateCadesFn(function getExtendedKeyUsage() { - const OIDS = []; - let count; - try { - count = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage(); - count = _generateCadesFn_1.__cadesAsyncToken__ + count.EKUs; - count = _generateCadesFn_1.__cadesAsyncToken__ + count.Count; - if (count > 0) { - while (count > 0) { - let cadesExtendedKeyUsage; - cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage(); - cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesExtendedKeyUsage.EKUs; - cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesExtendedKeyUsage.Item(count); - cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesExtendedKeyUsage.OID; - OIDS.push(cadesExtendedKeyUsage); - count--; - } - } - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || "Ошибка при получении ОИД'ов"); - } - return OIDS; - })); -}); - - -/***/ }), - -/***/ "./api/certificate/getInfo.ts": -/*!************************************!*\ - !*** ./api/certificate/getInfo.ts ***! - \************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _parseCertInfo_1 = __webpack_require__(/*! ../../helpers/_parseCertInfo */ "./helpers/_parseCertInfo.ts"); -const getCadesProp_1 = __webpack_require__(/*! ./getCadesProp */ "./api/certificate/getCadesProp.ts"); -/** - * Возвращает расшифрованную информацию о сертификате из указанного свойства по тэгам - * - * @param tags = словарь - * @param entitiesPath = путь к разбираемой сущности - * @returns расшифрованная информация по отдельным тэгам - */ -exports.getInfo = _afterPluginsLoaded_1._afterPluginsLoaded(function (tags, entitiesPath) { - return __awaiter(this, void 0, void 0, function* () { - let entities; - try { - entities = yield getCadesProp_1.getCadesProp.call(this, entitiesPath); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при извлечении информации из сертификата'); - } - return _parseCertInfo_1._parseCertInfo(tags, entities); - }); -}); - - -/***/ }), - -/***/ "./api/certificate/hasExtendedKeyUsage.ts": -/*!************************************************!*\ - !*** ./api/certificate/hasExtendedKeyUsage.ts ***! - \************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -/** - * Проверяет наличие ОИД'а (ОИД'ов) у сертификата - * - * @param oids - ОИД'ы для проверки - * @returns флаг наличия ОИД'ов у сертификата - */ -exports.hasExtendedKeyUsage = _afterPluginsLoaded_1._afterPluginsLoaded(function (oids) { - return __awaiter(this, void 0, void 0, function* () { - const certOids = yield this.getExtendedKeyUsage(); - let result; - if (Array.isArray(oids)) { - result = oids.every((oidToCheck) => certOids.some((certOid) => certOid === oidToCheck)); - } - else { - result = certOids.some((certOid) => certOid === oids); - } - return result; - }); -}); - - -/***/ }), - -/***/ "./api/certificate/index.ts": -/*!**********************************!*\ - !*** ./api/certificate/index.ts ***! - \**********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(/*! ./certificate */ "./api/certificate/certificate.ts")); - - -/***/ }), - -/***/ "./api/certificate/isValid.ts": -/*!************************************!*\ - !*** ./api/certificate/isValid.ts ***! - \************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Проверяет действительность сертификата - * - * @returns флаг валидности - */ -exports.isValid = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - const cadesCertificate = this._cadesCertificate; - return eval(_generateCadesFn_1._generateCadesFn(function isValid() { - let isValid; - try { - isValid = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.IsValid(); - isValid = _generateCadesFn_1.__cadesAsyncToken__ + isValid.Result; - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при проверке сертификата'); - } - return Boolean(isValid); - })); -}); - - -/***/ }), - -/***/ "./api/createAttachedSignature.ts": -/*!****************************************!*\ - !*** ./api/createAttachedSignature.ts ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(Buffer) { -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -const _getCadesCert_1 = __webpack_require__(/*! ../helpers/_getCadesCert */ "./helpers/_getCadesCert.ts"); -const _getDateObj_1 = __webpack_require__(/*! ../helpers/_getDateObj */ "./helpers/_getDateObj.ts"); -/** - * Создает присоединенную подпись сообщения по отпечатку сертификата - * - * @param thumbprint - отпечаток сертификата - * @param message - подписываемое сообщение - * @returns подпись в формате PKCS#7 - */ -exports.createAttachedSignature = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint, unencryptedMessage) => __awaiter(void 0, void 0, void 0, function* () { - const { cadesplugin } = window; - const cadesCertificate = yield _getCadesCert_1._getCadesCert(thumbprint); - return eval(_generateCadesFn_1._generateCadesFn(function createAttachedSignature() { - let cadesAttrs; - let cadesSignedData; - let cadesSigner; - try { - cadesAttrs = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CADESCOM.CPAttribute'); - cadesSignedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CadesSignedData'); - cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); - } - const currentTime = _getDateObj_1._getDateObj(new Date()); - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Name(constants_1.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи'); - } - let messageBase64; - try { - messageBase64 = Buffer.from(unencryptedMessage).toString('base64'); - } - catch (error) { - console.error(error); - throw new Error('Ошибка при преобразовании сообщения в Base64'); - } - let cadesAuthAttrs; - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); - cadesAuthAttrs = _generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2; - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_Content(messageBase64)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи'); - } - let signature; - try { - signature = _generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_PKCS7_TYPE); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); - } - return signature; - })); -})); - -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/buffer/index.js */ "../node_modules/buffer/index.js").Buffer)) - -/***/ }), - -/***/ "./api/createDetachedSignature.ts": -/*!****************************************!*\ - !*** ./api/createDetachedSignature.ts ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -const _getCadesCert_1 = __webpack_require__(/*! ../helpers/_getCadesCert */ "./helpers/_getCadesCert.ts"); -const _getDateObj_1 = __webpack_require__(/*! ../helpers/_getDateObj */ "./helpers/_getDateObj.ts"); -/** - * Создает отсоединенную подпись хеша по отпечатку сертификата - * - * @param thumbprint - отпечаток сертификата - * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11-2012 256 бит - * @returns подпись в формате PKCS#7 - */ -exports.createDetachedSignature = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint, messageHash) => __awaiter(void 0, void 0, void 0, function* () { - const { cadesplugin } = window; - const cadesCertificate = yield _getCadesCert_1._getCadesCert(thumbprint); - return eval(_generateCadesFn_1._generateCadesFn(function createDetachedSignature() { - let cadesAttrs; - let cadesHashedData; - let cadesSignedData; - let cadesSigner; - try { - cadesAttrs = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CADESCOM.CPAttribute'); - cadesHashedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.HashedData'); - cadesSignedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CadesSignedData'); - cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); - } - const currentTime = _getDateObj_1._getDateObj(new Date()); - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Name(constants_1.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи'); - } - let cadesAuthAttrs; - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); - cadesAuthAttrs = _generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2; - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке сертификата'); - } - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + - cadesHashedData.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.SetHashValue(messageHash)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке хеша'); - } - let signature; - try { - signature = - _generateCadesFn_1.__cadesAsyncToken__ + - cadesSignedData.SignHash(cadesHashedData, cadesSigner, cadesplugin.CADESCOM_PKCS7_TYPE); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); - } - return signature; - })); -})); - - -/***/ }), - -/***/ "./api/createHash.ts": -/*!***************************!*\ - !*** ./api/createHash.ts ***! - \***************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(Buffer) { -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Создает хеш сообщения по ГОСТ Р 34.11-2012 256 бит - * https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%B8%D0%B1%D0%BE%D0%B3_(%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F) - * - * @param unencryptedMessage - сообщение для хеширования - * - * @returns хеш - */ -exports.createHash = _afterPluginsLoaded_1._afterPluginsLoaded((unencryptedMessage) => __awaiter(void 0, void 0, void 0, function* () { - const { cadesplugin } = window; - return eval(_generateCadesFn_1._generateCadesFn(function createHash() { - const cadesHashedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.HashedData'); - let messageBase64; - let hash; - try { - messageBase64 = Buffer.from(unencryptedMessage).toString('base64'); - } - catch (error) { - console.error(error); - throw new Error('Ошибка при преобразовании сообщения в Base64'); - } - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + - cadesHashedData.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.propset_DataEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.Hash(messageBase64)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации хэширования'); - } - try { - hash = _generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.Value; - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при создании хэша'); - } - return hash; - })); -})); - -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/buffer/index.js */ "../node_modules/buffer/index.js").Buffer)) - -/***/ }), - -/***/ "./api/createSignature.ts": -/*!********************************!*\ - !*** ./api/createSignature.ts ***! - \********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -const _getCadesCert_1 = __webpack_require__(/*! ../helpers/_getCadesCert */ "./helpers/_getCadesCert.ts"); -const _getDateObj_1 = __webpack_require__(/*! ../helpers/_getDateObj */ "./helpers/_getDateObj.ts"); -/** - * Создает подпись base64 строки по отпечатку сертификата - * - * @param thumbprint - отпечаток сертификата - * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11 - * @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false) - * @returns подпись - */ -exports.createSignature = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint, messageHash, detachedSignature = true) => __awaiter(void 0, void 0, void 0, function* () { - console.warn([ - 'cryptoPro: Метод "createSignature" является устаревшим и будет убран из будущих версий.', - 'Используйте "createAttachedSignature" и "createDetachedSignature".', - ].join('\n')); - const { cadesplugin } = window; - const cadesCertificate = yield _getCadesCert_1._getCadesCert(thumbprint); - return eval(_generateCadesFn_1._generateCadesFn(function createSignature() { - let cadesAttrs; - let cadesSignedData; - let cadesSigner; - try { - cadesAttrs = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CADESCOM.CPAttribute'); - cadesSignedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CadesSignedData'); - cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); - } - const currentTime = _getDateObj_1._getDateObj(new Date()); - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Name(constants_1.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи'); - } - let cadesAuthAttrs; - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); - cadesAuthAttrs = _generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2; - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_Content(messageHash)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи'); - } - let signature; - try { - signature = - _generateCadesFn_1.__cadesAsyncToken__ + - cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_CADES_BES, detachedSignature); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); - } - return signature; - })); -})); - - -/***/ }), - -/***/ "./api/createXMLSignature.ts": -/*!***********************************!*\ - !*** ./api/createXMLSignature.ts ***! - \***********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -const _getCadesCert_1 = __webpack_require__(/*! ../helpers/_getCadesCert */ "./helpers/_getCadesCert.ts"); -/** - * Создает XML подпись для документа в формате XML - * - * @param thumbprint - отпечаток сертификата - * @param unencryptedMessage - подписываемое сообщение в формате XML - * @returns подпись - */ -exports.createXMLSignature = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint, unencryptedMessage) => __awaiter(void 0, void 0, void 0, function* () { - const { cadesplugin } = window; - const cadesCertificate = yield _getCadesCert_1._getCadesCert(thumbprint); - return eval(_generateCadesFn_1._generateCadesFn(function createXMLSignature() { - let cadesSigner; - let cadesSignedXML; - try { - cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); - cadesSignedXML = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.SignedXML'); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); - } - try { - const signatureMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256'; - const digestMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256'; - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_CheckCertificate(true)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.propset_Content(unencryptedMessage)); - void (_generateCadesFn_1.__cadesAsyncToken__ + - cadesSignedXML.propset_SignatureType(cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.propset_SignatureMethod(signatureMethod)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.propset_DigestMethod(digestMethod)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи'); - } - let signature; - try { - signature = _generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.Sign(cadesSigner); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); - } - return signature; - })); -})); - - -/***/ }), - -/***/ "./api/getCertificate.ts": -/*!*******************************!*\ - !*** ./api/getCertificate.ts ***! - \*******************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const getUserCertificates_1 = __webpack_require__(/*! ./getUserCertificates */ "./api/getUserCertificates.ts"); -/** - * Возвращает сертификат по отпечатку - * - * @param thumbprint - отпечаток сертификата - * @returns сертификат - */ -exports.getCertificate = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint) => __awaiter(void 0, void 0, void 0, function* () { - if (!thumbprint) { - throw new Error('Отпечаток не указан'); - } - const availableCertificates = yield getUserCertificates_1.getUserCertificates(); - const foundCertificate = availableCertificates.find((cert) => cert.thumbprint === thumbprint); - if (!foundCertificate) { - throw new Error(`Сертификат с отпечатком: "${thumbprint}" не найден`); - } - return foundCertificate; -})); - - -/***/ }), - -/***/ "./api/getSystemInfo.ts": -/*!******************************!*\ - !*** ./api/getSystemInfo.ts ***! - \******************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Предоставляет информацию о системе - * - * @returns информацию о CSP и плагине - */ -exports.getSystemInfo = _afterPluginsLoaded_1._afterPluginsLoaded(() => { - const sysInfo = { - cadesVersion: null, - cspVersion: null, - }; - return eval(_generateCadesFn_1._generateCadesFn(function getSystemInfo() { - let cadesAbout; - try { - cadesAbout = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.About'); - sysInfo.cadesVersion = _generateCadesFn_1.__cadesAsyncToken__ + cadesAbout.PluginVersion; - sysInfo.cspVersion = _generateCadesFn_1.__cadesAsyncToken__ + cadesAbout.CSPVersion(); - if (!sysInfo.cadesVersion) { - sysInfo.cadesVersion = _generateCadesFn_1.__cadesAsyncToken__ + cadesAbout.Version; - } - sysInfo.cadesVersion = _generateCadesFn_1.__cadesAsyncToken__ + sysInfo.cadesVersion.toString(); - sysInfo.cspVersion = _generateCadesFn_1.__cadesAsyncToken__ + sysInfo.cspVersion.toString(); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при получении информации о системе'); - } - return sysInfo; - })); -}); - - -/***/ }), - -/***/ "./api/getUserCertificates.ts": -/*!************************************!*\ - !*** ./api/getUserCertificates.ts ***! - \************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const certificate_1 = __webpack_require__(/*! ./certificate */ "./api/certificate/index.ts"); -const constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractCommonName_1 = __webpack_require__(/*! ../helpers/_extractCommonName */ "./helpers/_extractCommonName.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -let certificatesCache; -/** - * Возвращает список сертификатов, доступных пользователю в системе - * - * @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов - * @returns список сертификатов - */ -exports.getUserCertificates = _afterPluginsLoaded_1._afterPluginsLoaded((resetCache = false) => { - const { cadesplugin } = window; - if (!resetCache && certificatesCache) { - return certificatesCache; - } - return eval(_generateCadesFn_1._generateCadesFn(function getUserCertificates() { - let cadesStore; - try { - cadesStore = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.Store'); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу'); - } - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + - cadesStore.Open(cadesplugin.CAPICOM_CURRENT_USER_STORE, cadesplugin.CAPICOM_MY_STORE, cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища'); - } - let cadesCertificates; - let cadesCertificatesCount; - try { - cadesCertificates = _generateCadesFn_1.__cadesAsyncToken__ + cadesStore.Certificates; - if (cadesCertificates) { - cadesCertificates = - _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID); - /** - * Не рассматриваются сертификаты, в которых отсутствует закрытый ключ - * или не действительны на данный момент - */ - cadesCertificates = - _generateCadesFn_1.__cadesAsyncToken__ + - cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY, constants_1.CAPICOM_PROPID_KEY_PROV_INFO); - cadesCertificatesCount = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificates.Count; - } - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов'); - } - if (!cadesCertificatesCount) { - throw new Error('Нет доступных сертификатов'); - } - const certificateList = []; - try { - while (cadesCertificatesCount) { - const cadesCertificate = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificates.Item(cadesCertificatesCount); - certificateList.push(new certificate_1.Certificate(cadesCertificate, _extractCommonName_1._extractCommonName(_generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.SubjectName), _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.IssuerName, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.SubjectName, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.Thumbprint, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ValidFromDate, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ValidToDate)); - cadesCertificatesCount--; - } - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка обработки сертификатов'); - } - cadesStore.Close(); - certificatesCache = certificateList; - return certificatesCache; - })); -}); - - -/***/ }), - -/***/ "./api/index.ts": -/*!**********************!*\ - !*** ./api/index.ts ***! - \**********************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(/*! ./getCertificate */ "./api/getCertificate.ts")); -__export(__webpack_require__(/*! ./getUserCertificates */ "./api/getUserCertificates.ts")); -__export(__webpack_require__(/*! ./getSystemInfo */ "./api/getSystemInfo.ts")); -__export(__webpack_require__(/*! ./isValidSystemSetup */ "./api/isValidSystemSetup.ts")); -__export(__webpack_require__(/*! ./createSignature */ "./api/createSignature.ts")); -__export(__webpack_require__(/*! ./createXMLSignature */ "./api/createXMLSignature.ts")); -__export(__webpack_require__(/*! ./createDetachedSignature */ "./api/createDetachedSignature.ts")); -__export(__webpack_require__(/*! ./createAttachedSignature */ "./api/createAttachedSignature.ts")); -__export(__webpack_require__(/*! ./createHash */ "./api/createHash.ts")); -__export(__webpack_require__(/*! ./certificate */ "./api/certificate/index.ts")); - - -/***/ }), - -/***/ "./api/isValidSystemSetup.ts": -/*!***********************************!*\ - !*** ./api/isValidSystemSetup.ts ***! - \***********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _isSupportedCadesVersion_1 = __webpack_require__(/*! ../helpers/_isSupportedCadesVersion */ "./helpers/_isSupportedCadesVersion.ts"); -const _isSupportedCSPVersion_1 = __webpack_require__(/*! ../helpers/_isSupportedCSPVersion */ "./helpers/_isSupportedCSPVersion.ts"); -const getSystemInfo_1 = __webpack_require__(/*! ./getSystemInfo */ "./api/getSystemInfo.ts"); -/** - * Проверяет корректность настроек ЭП на машине - * - * @returns флаг корректности настроек - */ -exports.isValidSystemSetup = _afterPluginsLoaded_1._afterPluginsLoaded(() => __awaiter(void 0, void 0, void 0, function* () { - let systemInfo; - try { - systemInfo = yield getSystemInfo_1.getSystemInfo(); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Настройки ЭП на данной машине не верны'); - } - if (!_isSupportedCadesVersion_1._isSupportedCadesVersion(systemInfo.cadesVersion)) { - throw new Error('Не поддерживаемая версия плагина'); - } - if (!_isSupportedCSPVersion_1._isSupportedCSPVersion(systemInfo.cspVersion)) { - throw new Error('Не поддерживаемая версия CSP'); - } - return true; -})); - - -/***/ }), - -/***/ "./constants/cades-constants.ts": -/*!**************************************!*\ - !*** ./constants/cades-constants.ts ***! - \**************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CADESCOM_ATTRIBUTE_OTHER = -1; -exports.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; -exports.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; -exports.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0; -exports.CADESCOM_AllowNoOutstandingRequest = 1; -exports.CADESCOM_AllowNone = 0; -exports.CADESCOM_AllowUntrustedCertificate = 2; -exports.CADESCOM_AllowUntrustedRoot = 4; -exports.CADESCOM_BASE64_TO_BINARY = 0x01; -exports.CADESCOM_CADES_BES = 1; -exports.CADESCOM_CADES_DEFAULT = 0; -exports.CADESCOM_CADES_T = 5; -exports.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d; -exports.CADESCOM_CONTAINER_STORE = 100; -exports.CADESCOM_CURRENT_USER_STORE = 2; -exports.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2; -exports.CADESCOM_DISPLAY_DATA_CONTENT = 1; -exports.CADESCOM_DISPLAY_DATA_NONE = 0; -exports.CADESCOM_ENCODE_ANY = -1; -exports.CADESCOM_ENCODE_BASE64 = 0; -exports.CADESCOM_ENCODE_BINARY = 1; -exports.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3; -exports.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4; -exports.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2; -exports.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25; -exports.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0; -exports.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110; -exports.CADESCOM_HASH_ALGORITHM_MD2 = 1; -exports.CADESCOM_HASH_ALGORITHM_MD4 = 2; -exports.CADESCOM_HASH_ALGORITHM_MD5 = 3; -exports.CADESCOM_HASH_ALGORITHM_SHA1 = 0; -exports.CADESCOM_HASH_ALGORITHM_SHA_256 = 4; -exports.CADESCOM_HASH_ALGORITHM_SHA_384 = 5; -exports.CADESCOM_HASH_ALGORITHM_SHA_512 = 6; -exports.CADESCOM_LOCAL_MACHINE_STORE = 1; -exports.CADESCOM_PKCS7_TYPE = 65535; -exports.CADESCOM_STRING_TO_UCS2LE = 0x00; -exports.CADESCOM_SkipInstallToStore = 268435456; -exports.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0; -exports.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1; -exports.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2; -exports.CAPICOM_ACTIVE_DIRECTORY_USER_STORE = 3; -exports.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; -exports.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; -exports.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0; -exports.CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7; -exports.CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8; -exports.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6; -exports.CAPICOM_CERTIFICATE_FIND_EXTENSION = 5; -exports.CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2; -exports.CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12; -exports.CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3; -exports.CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0; -exports.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1; -exports.CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4; -exports.CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11; -exports.CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10; -exports.CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9; -exports.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0; -exports.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2; -exports.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1; -exports.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1; -exports.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0; -exports.CAPICOM_CURRENT_USER_STORE = 2; -exports.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128; -exports.CAPICOM_EKU_CLIENT_AUTH = 2; -exports.CAPICOM_EKU_OTHER = 0; -exports.CAPICOM_EKU_SMARTCARD_LOGON = 5; -exports.CAPICOM_LOCAL_MACHINE_STORE = 1; -exports.CAPICOM_MEMORY_STORE = 0; -exports.CAPICOM_MY_STORE = 'My'; -exports.CAPICOM_OID_KEY_USAGE_EXTENSION = 10; -exports.CAPICOM_OID_OTHER = 0; -exports.CAPICOM_PROPID_ACCESS_STATE = 14; -exports.CAPICOM_PROPID_ARCHIVED = 19; -exports.CAPICOM_PROPID_ARCHIVED_KEY_HASH = 65; -exports.CAPICOM_PROPID_AUTO_ENROLL = 21; -exports.CAPICOM_PROPID_CROSS_CERT_DIST_POINTS = 23; -exports.CAPICOM_PROPID_CTL_USAGE = 9; -exports.CAPICOM_PROPID_DATE_STAMP = 27; -exports.CAPICOM_PROPID_DESCRIPTION = 13; -exports.CAPICOM_PROPID_EFS = 17; -exports.CAPICOM_PROPID_ENHKEY_USAGE = 9; -exports.CAPICOM_PROPID_ENROLLMENT = 26; -exports.CAPICOM_PROPID_EXTENDED_ERROR_INFO = 30; -exports.CAPICOM_PROPID_FIRST_RESERVED = 66; -exports.CAPICOM_PROPID_FIRST_USER = 0x00008000; -exports.CAPICOM_PROPID_FORTEZZA_DATA = 18; -exports.CAPICOM_PROPID_FRIENDLY_NAME = 11; -exports.CAPICOM_PROPID_HASH_PROP = 3; -exports.CAPICOM_PROPID_IE30_RESERVED = 7; -exports.CAPICOM_PROPID_ISSUER_PUBLIC_KEY_MD5_HASH = 24; -exports.CAPICOM_PROPID_ISSUER_SERIAL_NUMBER_MD5_HASH = 28; -exports.CAPICOM_PROPID_KEY_CONTEXT = 5; -exports.CAPICOM_PROPID_KEY_IDENTIFIER = 20; -exports.CAPICOM_PROPID_KEY_PROV_HANDLE = 1; -exports.CAPICOM_PROPID_KEY_PROV_INFO = 2; -exports.CAPICOM_PROPID_KEY_SPEC = 6; -exports.CAPICOM_PROPID_LAST_RESERVED = 0x00007fff; -exports.CAPICOM_PROPID_LAST_USER = 0x0000ffff; -exports.CAPICOM_PROPID_MD5_HASH = 4; -exports.CAPICOM_PROPID_NEXT_UPDATE_LOCATION = 10; -exports.CAPICOM_PROPID_PUBKEY_ALG_PARA = 22; -exports.CAPICOM_PROPID_PUBKEY_HASH_RESERVED = 8; -exports.CAPICOM_PROPID_PVK_FILE = 12; -exports.CAPICOM_PROPID_RENEWAL = 64; -exports.CAPICOM_PROPID_SHA1_HASH = 3; -exports.CAPICOM_PROPID_SIGNATURE_HASH = 15; -exports.CAPICOM_PROPID_SMART_CARD_DATA = 16; -exports.CAPICOM_PROPID_SUBJECT_NAME_MD5_HASH = 29; -exports.CAPICOM_PROPID_SUBJECT_PUBLIC_KEY_MD5_HASH = 25; -exports.CAPICOM_PROPID_UNKNOWN = 0; -exports.CAPICOM_SMART_CARD_USER_STORE = 4; -exports.CAPICOM_STORE_OPEN_EXISTING_ONLY = 128; -exports.CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED = 256; -exports.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2; -exports.CAPICOM_STORE_OPEN_READ_ONLY = 0; -exports.CAPICOM_STORE_OPEN_READ_WRITE = 1; -exports.CHECK_NONE = 0; -exports.CHECK_OFFLINE_REVOCATION_STATUS = 16; -exports.CHECK_ONLINE_REVOCATION_STATUS = 8; -exports.CHECK_SIGNATURE_VALIDITY = 4; -exports.CHECK_TIME_VALIDITY = 2; -exports.CHECK_TRUSTED_ROOT = 1; -exports.LOG_LEVEL_DEBUG = 4; -exports.LOG_LEVEL_ERROR = 1; -exports.LOG_LEVEL_INFO = 2; -exports.TRUST_CTL_IS_NOT_SIGNATURE_VALID = 262144; -exports.TRUST_CTL_IS_NOT_TIME_VALID = 131072; -exports.TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 524288; -exports.TRUST_IS_CYCLIC = 128; -exports.TRUST_IS_NOT_SIGNATURE_VALID = 8; -exports.TRUST_IS_NOT_TIME_NESTED = 2; -exports.TRUST_IS_NOT_TIME_VALID = 1; -exports.TRUST_IS_NOT_VALID_FOR_USAGE = 16; -exports.TRUST_IS_PARTIAL_CHAIN = 65536; -exports.TRUST_IS_REVOKED = 4; -exports.TRUST_IS_UNTRUSTED_ROOT = 32; -exports.TRUST_REVOCATION_STATUS_UNKNOWN = 64; -exports.XmlDsigGost3410Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411'; -exports.XmlDsigGost3410UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411'; -exports.XmlDsigGost3411Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411'; -exports.XmlDsigGost3411UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr3411'; - - -/***/ }), - -/***/ "./constants/index.ts": -/*!****************************!*\ - !*** ./constants/index.ts ***! - \****************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(/*! ./cades-constants */ "./constants/cades-constants.ts")); -__export(__webpack_require__(/*! ./issuer-tags-translations */ "./constants/issuer-tags-translations.ts")); -__export(__webpack_require__(/*! ./oids-dictionary */ "./constants/oids-dictionary.ts")); -__export(__webpack_require__(/*! ./subject-tags-translations */ "./constants/subject-tags-translations.ts")); - - -/***/ }), - -/***/ "./constants/issuer-tags-translations.ts": -/*!***********************************************!*\ - !*** ./constants/issuer-tags-translations.ts ***! - \***********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ISSUER_TAGS_TRANSLATIONS = [ - { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' }, - { possibleNames: ['CN'], translation: 'Удостоверяющий центр' }, - { possibleNames: ['C'], translation: 'Страна' }, - { possibleNames: ['S'], translation: 'Регион' }, - { possibleNames: ['STREET'], translation: 'Адрес' }, - { possibleNames: ['O'], translation: 'Компания' }, - { possibleNames: ['OU'], translation: 'Тип' }, - { possibleNames: ['T'], translation: 'Должность' }, - { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' }, - { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' }, - { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' }, - { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' }, - { possibleNames: ['E'], translation: 'Email' }, - { possibleNames: ['L'], translation: 'Город' }, -]; - - -/***/ }), - -/***/ "./constants/oids-dictionary.ts": -/*!**************************************!*\ - !*** ./constants/oids-dictionary.ts ***! - \**************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.OIDS_DICTIONARY = { - '1.2.643.2.2.34.6': 'Пользователь Центра Регистрации', - '1.2.643.2.39.1.1': 'Использование в программных продуктах системы "1С:Предприятие 8"', - '1.2.643.3.131.1.1': 'ИНН', - '1.2.643.3.141.1.1': 'РНС ФСС', - '1.2.643.3.141.1.2': 'КП ФСС', - '1.2.643.3.2.100.65.13.11': 'Использование в системе АИС "Госзакупки" Сахалинской области.', - '1.2.643.3.8.100.1': 'Сертификат типа "ekey-ГОСТ"', - '1.2.643.3.8.100.1.1': 'Общее использование в системах ИОК без права заверения финансовых документов', - '1.2.643.3.8.100.1.10': 'Для участия в электронных торгах и подписания государственного контракта в информационных системах Тендерного комитета города Москвы уполномоченными лицами участников размещения государственного заказа города Москвы', - '1.2.643.3.8.100.1.11': 'Подписание электронных документов в автоматизированной информационной системе размещения государственного и муниципального заказа Саратовской области', - '1.2.643.3.8.100.1.12': 'Использование в системе государственного заказа Иркутской области', - '1.2.643.3.8.100.1.13': 'Использование в электронной торговой площадке агентства государственного заказа Красноярского края', - '1.2.643.3.8.100.1.14': 'Использование в электронной торговой площадке "Тендер"', - '1.2.643.3.8.100.1.2': 'Передача отчетности по ТКС', - '1.2.643.3.8.100.1.3': 'Оформление взаимных обязательств, соглашений, договоров, актов и т.п.', - '1.2.643.3.8.100.1.4': 'Внутрикорпоративный документооборот', - '1.2.643.3.8.100.1.5': 'Использование в системах электронной торговли', - '1.2.643.3.8.100.1.6': 'Использование в торгово-закупочной системе "ЭЛЕКТРА"', - '1.2.643.3.8.100.1.7': 'Использование в системе Портал государственных закупок Ставропольского края.', - '1.2.643.3.8.100.1.8': 'Использование в Единой системе электронной торговли B2B-Center и B2G.', - '1.2.643.3.8.100.1.9': 'Для участия в электронных торгах и подписания государственного контракта в электронной площадке ОАО «ЕЭТП» уполномоченными лицами участников размещения государственного или муниципального заказа', - '1.2.643.5.1.24.2.1.3': 'Формирование документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя', - '1.2.643.5.1.24.2.1.3.1': 'Формирование кадастровым инженером документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя', - '1.2.643.5.1.24.2.2.2': 'Формирование документов как результата оказания услуги со стороны органов регистрации прав', - '1.2.643.5.1.24.2.2.3': 'Формирование документов для получения государственных услуг в сфере государственной регистрации прав на недвижимое имущество и сделок с ним со стороны заявителя', - '1.2.643.6.2.1.7.1': 'Использование единоличным исполнительным органом юридического лица или уполномоченными представителями юридического лица в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских и иных прав и обязанностей в сфере негосударственного пенсионного обеспечения, негосударственного пенсионного страхования, в сфере деятельности паевых инвестиционных фондов, акционерных инвестиционных фондов, профессиональных участников рынка ценных бумаг, а также связанной с обслуживанием указанной деятельности услуг кредитных и иных организаций', - '1.2.643.6.2.1.7.2': 'Использование физическим лицом в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских прав и обязанностей в отношении инвестиционных паев паевых инвестиционных фондов, в том числе отношения, связанные с учетом и/или фиксацией прав на инвестиционные паи паевых инвестиционных фондов', - '1.2.643.6.3': 'Использование в электронных торговых системах и в программном обеспечении, связанным с обменом электронных сообщений', - '1.2.643.6.3.1.1': 'Использование на электронных площадок отобранных для проведения аукционах в электронной форме', - '1.2.643.6.3.1.2.1': 'Тип участника - Юридическое лицо', - '1.2.643.6.3.1.2.2': 'Тип участника - Физическое лицо', - '1.2.643.6.3.1.2.3': 'Тип участника - Индивидуальный предприниматель', - '1.2.643.6.3.1.3.1': 'Участник размещения заказа', - '1.2.643.6.3.1.4.1': 'Администратор организации', - '1.2.643.6.3.1.4.2': 'Уполномоченный специалист', - '1.2.643.6.3.1.4.3': 'Специалист с правом подписи контракта', - '1.2.840.113549.1.9.2': 'Неструктурированное имя', - '1.3.6.1.4.1.24138.1.1.8.1': 'Обеспечение юридической значимости в Системе "Электронная Торговая Площадка"', - '1.3.6.1.4.1.29919.21': 'Использование в системе Портал государственных закупок Ростовской области "Рефери".', - '1.3.6.1.5.5.7.3.2': 'Проверка подлинности клиента', - '1.3.6.1.5.5.7.3.4': 'Защищенная электронная почта', - '1.3.643.3.8.100.15': 'Использование в ЭТП "uTender"', -}; - - -/***/ }), - -/***/ "./constants/subject-tags-translations.ts": -/*!************************************************!*\ - !*** ./constants/subject-tags-translations.ts ***! - \************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SUBJECT_TAGS_TRANSLATIONS = [ - { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' }, - { possibleNames: ['CN'], translation: 'Владелец' }, - { possibleNames: ['SN'], translation: 'Фамилия' }, - { possibleNames: ['G'], translation: 'Имя Отчество' }, - { possibleNames: ['C'], translation: 'Страна' }, - { possibleNames: ['S'], translation: 'Регион' }, - { possibleNames: ['STREET'], translation: 'Адрес' }, - { possibleNames: ['O'], translation: 'Компания' }, - { possibleNames: ['OU'], translation: 'Отдел/подразделение' }, - { possibleNames: ['T'], translation: 'Должность' }, - { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' }, - { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' }, - { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' }, - { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' }, - { possibleNames: ['E'], translation: 'Email' }, - { possibleNames: ['L'], translation: 'Город' }, -]; - - -/***/ }), - -/***/ "./crypto-pro.ts": -/*!***********************!*\ - !*** ./crypto-pro.ts ***! - \***********************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(/*! ./api */ "./api/index.ts")); - - -/***/ }), - -/***/ "./helpers/_afterPluginsLoaded.ts": -/*!****************************************!*\ - !*** ./helpers/_afterPluginsLoaded.ts ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ./_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -let isSetLogLevel = false; -let isPluginLoaded = false; -exports._afterPluginsLoaded = (fn) => { - const canPromise = Boolean(window.Promise); - return function (...args) { - return __awaiter(this, void 0, void 0, function* () { - if (!isPluginLoaded) { - try { - __webpack_require__(/*! ../vendor/cadesplugin_api */ "./vendor/cadesplugin_api.js"); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подключении модуля для работы с Cades plugin'); - } - isPluginLoaded = true; - } - const { cadesplugin } = window; - if (!canPromise) { - throw new Error('Необходим полифилл для Promise'); - } - if (!cadesplugin) { - throw new Error('Не подключен модуль для работы с Cades plugin'); - } - if (!isSetLogLevel) { - cadesplugin.set_log_level(cadesplugin.LOG_LEVEL_ERROR); - isSetLogLevel = true; - } - try { - yield cadesplugin; - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации модуля для работы с Cades plugin'); - } - return yield fn.apply(this, args); - }); - }; -}; - - -/***/ }), - -/***/ "./helpers/_extractCommonName.ts": -/*!***************************************!*\ - !*** ./helpers/_extractCommonName.ts ***! - \***************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports._extractCommonName = (subjectName) => { var _a; return (_a = subjectName.match(/CN=(.+?)(?:,|$)/)) === null || _a === void 0 ? void 0 : _a[1]; }; - - -/***/ }), - -/***/ "./helpers/_extractMeaningfulErrorMessage.ts": -/*!***************************************************!*\ - !*** ./helpers/_extractMeaningfulErrorMessage.ts ***! - \***************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports._extractMeaningfulErrorMessage = (error) => { - var _a; - let errorContainer = ((_a = window.cadesplugin) === null || _a === void 0 ? void 0 : _a.getLastError) && window.cadesplugin.getLastError(error); - if (!(errorContainer === null || errorContainer === void 0 ? void 0 : errorContainer.message)) { - if (!error.message) { - return null; - } - errorContainer = error; - } - const containsRussianLetters = /[а-яА-Я]/.test(errorContainer.message); - if (!containsRussianLetters) { - return null; - } - const searchResult = errorContainer.message.match(/^(.*?)(?:(?:\.?\s?\(?(0x[0-9a-zA-Z]{1,8})\))|(?:\.?$))/); - return (searchResult ? searchResult[1] + (searchResult[2] ? '. Код ошибки: ' + searchResult[2] : '') : null); -}; - - -/***/ }), - -/***/ "./helpers/_generateCadesFn.ts": -/*!*************************************!*\ - !*** ./helpers/_generateCadesFn.ts ***! - \*************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -// синтетические переменные, которые подменяются в рантайме -exports.__cadesAsyncToken__ = {}; -exports.__createCadesPluginObject__ = (...args) => ({}); -function getGeneratorConstructor() { - return new Function('', 'return Object.getPrototypeOf(function*(){}).constructor')(); -} -exports._generateCadesFn = (callback) => { - var _a; - const { cadesplugin } = window; - const cadesGeneratorsAPI = Boolean(cadesplugin.CreateObjectAsync); - const callbackName = callback.name || 'dynamicFn'; - const callbackLiteral = String(callback); - const callbackArguments = ((_a = callbackLiteral.match(/^function[\s\w]*?\((.*?)\)/)) === null || _a === void 0 ? void 0 : _a[1]) || ''; - const callbackBody = callbackLiteral.replace(/^.*?{([\s\S]*?)}$/, '$1'); - let crossEnvCallbackLiteral = String(new (cadesGeneratorsAPI ? getGeneratorConstructor() : Function)(callbackArguments, callbackBody)); - crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/\w+?\.__createCadesPluginObject__(\([\s\S]*?\))/gm, `cadesplugin.CreateObject${cadesGeneratorsAPI ? 'Async' : ''}$1`); - crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/\w+?\.__cadesAsyncToken__\s*?\+\s*?\b/gm, cadesGeneratorsAPI ? 'yield ' : ''); - if (!cadesGeneratorsAPI) { - crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/propset_(.*?)\((.*?)\)/gm, '$1 = $2'); - } - return [ - cadesGeneratorsAPI ? `cadesplugin.async_spawn(${crossEnvCallbackLiteral});` : `(${crossEnvCallbackLiteral})();`, - `//# sourceURL=crypto-pro_${callbackName}.js`, - ].join(''); -}; - - -/***/ }), - -/***/ "./helpers/_getCadesCert.ts": -/*!**********************************!*\ - !*** ./helpers/_getCadesCert.ts ***! - \**********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ./_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ./_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ./_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Возвращает сертификат в формате Cades по отпечатку - * - * @param thumbprint - отпечаток сертификата - * @returns сертификат в формате Cades - */ -exports._getCadesCert = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint) => { - const { cadesplugin } = window; - return eval(_generateCadesFn_1._generateCadesFn(function _getCadesCert() { - let cadesStore; - try { - cadesStore = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.Store'); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу'); - } - if (!cadesStore) { - throw new Error('Не удалось получить доступ к хранилищу сертификатов'); - } - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + - cadesStore.Open(cadesplugin.CAPICOM_CURRENT_USER_STORE, cadesplugin.CAPICOM_MY_STORE, cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища'); - } - let cadesCertificateList; - let certificatesCount; - try { - cadesCertificateList = _generateCadesFn_1.__cadesAsyncToken__ + cadesStore.Certificates; - certificatesCount = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Count; - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов'); - } - if (!certificatesCount) { - throw new Error('Нет доступных сертификатов'); - } - let cadesCertificate; - try { - cadesCertificateList = - _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH, thumbprint); - const count = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Count; - if (!count) { - throw new Error(`Сертификат с отпечатком: "${thumbprint}" не найден`); - } - cadesCertificate = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Item(1); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при получении сертификата'); - } - cadesStore.Close(); - return cadesCertificate; - })); -}); - - -/***/ }), - -/***/ "./helpers/_getDateObj.ts": -/*!********************************!*\ - !*** ./helpers/_getDateObj.ts ***! - \********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * Возвращает объект даты, совместимый с Cades plugin'ом, зависящий от браузера. - * - * В IE необходимо использовать специфичный формат "VT_DATE" - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Microsoft_Extensions/Date.getVarDate - */ -exports._getDateObj = (dateObj) => (dateObj.getVarDate ? dateObj.getVarDate() : dateObj); - - -/***/ }), - -/***/ "./helpers/_isSupportedCSPVersion.ts": -/*!*******************************************!*\ - !*** ./helpers/_isSupportedCSPVersion.ts ***! - \*******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const oldestSupportedCSPVersion = 4.0; -exports._isSupportedCSPVersion = (version) => { - var _a; - version = (_a = version.match(/\d+?\b(?:\.\d+)?/)) === null || _a === void 0 ? void 0 : _a[0]; - return Number(version) >= oldestSupportedCSPVersion; -}; - - -/***/ }), - -/***/ "./helpers/_isSupportedCadesVersion.ts": -/*!*********************************************!*\ - !*** ./helpers/_isSupportedCadesVersion.ts ***! - \*********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports._isSupportedCadesVersion = (version) => { - const match = version.match(/(\d+)\.(\d+)\.(\d+)/); - if (!match) { - return false; - } - const [, major, minor, patch] = match; - if (Number(major) < 2) { - return false; - } - if (Number(major) === 2 && Number(patch) < 12438) { - return false; - } - return true; -}; - - -/***/ }), - -/***/ "./helpers/_parseCertInfo.ts": -/*!***********************************!*\ - !*** ./helpers/_parseCertInfo.ts ***! - \***********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); -/** - * Парсит информацию из строки с информацией о сертификате - * - * @param tagsTranslations - словарь с расшифровками тэгов - * @param rawInfo - данные для парсинга - * @returns расшифрованная информация по отдельным тэгам - */ -exports._parseCertInfo = (tagsTranslations, rawInfo) => { - const extractedEntities = rawInfo.match(/([а-яА-Яa-zA-Z0-9\s.]+)=(?:("[^"]+?")|(.+?))(?:,|$)/g); - if (extractedEntities) { - return extractedEntities.map((group) => { - var _a, _b, _c; - const segmentsMatch = group.trim().match(/^([а-яА-Яa-zA-Z0-9\s.]+)=(.+?),?$/); - let title = segmentsMatch === null || segmentsMatch === void 0 ? void 0 : segmentsMatch[1]; - // Вырезаем лишние кавычки - const description = (_b = (_a = segmentsMatch === null || segmentsMatch === void 0 ? void 0 : segmentsMatch[2]) === null || _a === void 0 ? void 0 : _a.replace(/^"(.*)"/, '$1')) === null || _b === void 0 ? void 0 : _b.replace(/"{2}/g, '"'); - const oidIdentifierMatch = title === null || title === void 0 ? void 0 : title.match(/^OID\.(.*)/); - const oidIdentifier = oidIdentifierMatch === null || oidIdentifierMatch === void 0 ? void 0 : oidIdentifierMatch[1]; - let isTranslated = false; - // Если нашли в тайтле ОИД, пытаемся его расшифровать - if (oidIdentifier) { - const oidTranslation = constants_1.OIDS_DICTIONARY[oidIdentifier]; - if (oidTranslation) { - title = oidTranslation; - isTranslated = true; - } - } - const tagTranslation = (_c = tagsTranslations.find((tag) => tag.possibleNames.find((name) => name === title))) === null || _c === void 0 ? void 0 : _c.translation; - if (tagTranslation) { - title = tagTranslation; - isTranslated = true; - } - return { description, title, isTranslated }; - }); - } -}; - - -/***/ }), - -/***/ "./vendor/cadesplugin_api.js": -/*!***********************************!*\ - !*** ./vendor/cadesplugin_api.js ***! - \***********************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -;(function () { - //already loaded - if(window.cadesplugin) - return; - - var pluginObject; - var plugin_resolved = 0; - var plugin_reject; - var plugin_resolve; - var isOpera = 0; - var isFireFox = 0; - var isEdge = 0; - var isSafari = 0; - var failed_extensions = 0; - - var canPromise = !!window.Promise; - var cadesplugin; - - if(canPromise) - { - cadesplugin = new Promise(function(resolve, reject) - { - plugin_resolve = resolve; - plugin_reject = reject; - }); - } else - { - cadesplugin = {}; - } - - function check_browser() { - var ua= navigator.userAgent, tem, M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; - if(/trident/i.test(M[1])){ - tem= /\brv[ :]+(\d+)/g.exec(ua) || []; - return {name:'IE',version:(tem[1] || '')}; - } - if(M[1]=== 'Chrome'){ - tem= ua.match(/\b(OPR|Edge)\/(\d+)/); - if(tem!= null) return {name:tem[1].replace('OPR', 'Opera'),version:tem[2]}; - } - M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?']; - if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]); - return {name:M[0],version:M[1]}; - } - var browserSpecs = check_browser(); - - function cpcsp_console_log(level, msg){ - //IE9 не может писать в консоль если не открыта вкладка developer tools - if(typeof(console) === 'undefined') - return; - if (level <= cadesplugin.current_log_level ){ - if (level === cadesplugin.LOG_LEVEL_DEBUG) - console.log("DEBUG: %s", msg); - if (level === cadesplugin.LOG_LEVEL_INFO) - console.info("INFO: %s", msg); - if (level === cadesplugin.LOG_LEVEL_ERROR) - console.error("ERROR: %s", msg); - return; - } - } - - function set_log_level(level){ - if (!((level === cadesplugin.LOG_LEVEL_DEBUG) || - (level === cadesplugin.LOG_LEVEL_INFO) || - (level === cadesplugin.LOG_LEVEL_ERROR))){ - cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, "cadesplugin_api.js: Incorrect log_level: " + level); - return; - } - cadesplugin.current_log_level = level; - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = DEBUG"); - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = INFO"); - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = ERROR"); - if(isNativeMessageSupported()) - { - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG) - window.postMessage("set_log_level=debug", "*"); - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO) - window.postMessage("set_log_level=info", "*"); - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR) - window.postMessage("set_log_level=error", "*"); - } - } - - function set_constantValues() - { - cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1; - cadesplugin.CAPICOM_CURRENT_USER_STORE = 2; - cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1; - cadesplugin.CADESCOM_CURRENT_USER_STORE = 2; - cadesplugin.CADESCOM_CONTAINER_STORE = 100; - - cadesplugin.CAPICOM_MY_STORE = "My"; - - cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2; - - cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1; - - cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0; - cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1; - cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2; - - cadesplugin.XmlDsigGost3410UrlObsolete = "http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411"; - cadesplugin.XmlDsigGost3411UrlObsolete = "http://www.w3.org/2001/04/xmldsig-more#gostr3411"; - cadesplugin.XmlDsigGost3410Url = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411"; - cadesplugin.XmlDsigGost3411Url = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411"; - - cadesplugin.CADESCOM_CADES_DEFAULT = 0; - cadesplugin.CADESCOM_CADES_BES = 1; - cadesplugin.CADESCOM_CADES_T = 0x5; - cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d; - cadesplugin.CADESCOM_PKCS7_TYPE = 0xffff; - - cadesplugin.CADESCOM_ENCODE_BASE64 = 0; - cadesplugin.CADESCOM_ENCODE_BINARY = 1; - cadesplugin.CADESCOM_ENCODE_ANY = -1; - - cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0; - cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1; - cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2; - - cadesplugin.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0; - cadesplugin.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1; - - cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0; - cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1; - cadesplugin.CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2; - cadesplugin.CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3; - cadesplugin.CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4; - cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENSION = 5; - cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6; - cadesplugin.CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7; - cadesplugin.CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8; - cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9; - cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10; - cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11; - cadesplugin.CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12; - - cadesplugin.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128; - - cadesplugin.CAPICOM_PROPID_ENHKEY_USAGE = 9; - - cadesplugin.CAPICOM_OID_OTHER = 0; - cadesplugin.CAPICOM_OID_KEY_USAGE_EXTENSION = 10; - - cadesplugin.CAPICOM_EKU_CLIENT_AUTH = 2; - cadesplugin.CAPICOM_EKU_SMARTCARD_LOGON = 5; - cadesplugin.CAPICOM_EKU_OTHER = 0; - - cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0; - cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; - cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; - cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0; - cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; - cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; - cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1; - - cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0; - cadesplugin.CADESCOM_BASE64_TO_BINARY = 1; - - cadesplugin.CADESCOM_DISPLAY_DATA_NONE = 0; - cadesplugin.CADESCOM_DISPLAY_DATA_CONTENT = 1; - cadesplugin.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2; - - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25; - - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA1 = 0; - cadesplugin.CADESCOM_HASH_ALGORITHM_MD2 = 1; - cadesplugin.CADESCOM_HASH_ALGORITHM_MD4 = 2; - cadesplugin.CADESCOM_HASH_ALGORITHM_MD5 = 3; - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_256 = 4; - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_384 = 5; - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_512 = 6; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112; - - cadesplugin.LOG_LEVEL_DEBUG = 4; - cadesplugin.LOG_LEVEL_INFO = 2; - cadesplugin.LOG_LEVEL_ERROR = 1; - - cadesplugin.CADESCOM_AllowNone = 0; - cadesplugin.CADESCOM_AllowNoOutstandingRequest = 0x1; - cadesplugin.CADESCOM_AllowUntrustedCertificate = 0x2; - cadesplugin.CADESCOM_AllowUntrustedRoot = 0x4; - cadesplugin.CADESCOM_SkipInstallToStore = 0x10000000; - } - - function async_spawn(generatorFunc) { - function continuer(verb, arg) { - var result; - try { - result = generator[verb](arg); - } catch (err) { - return Promise.reject(err); - } - if (result.done) { - return result.value; - } else { - return Promise.resolve(result.value).then(onFulfilled, onRejected); - } - } - var generator = generatorFunc(Array.prototype.slice.call(arguments, 1)); - var onFulfilled = continuer.bind(continuer, "next"); - var onRejected = continuer.bind(continuer, "throw"); - return onFulfilled(); - } - - function isIE() { - // var retVal = (("Microsoft Internet Explorer" == navigator.appName) || // IE < 11 - // navigator.userAgent.match(/Trident\/./i)); // IE 11 - return (browserSpecs.name === 'IE' || browserSpecs.name === 'MSIE'); - } - - function isIOS() { - return (navigator.userAgent.match(/ipod/i) || - navigator.userAgent.match(/ipad/i) || - navigator.userAgent.match(/iphone/i)); - } - - function isNativeMessageSupported() - { - // В IE работаем через NPAPI - if(isIE()) - return false; - // В Edge работаем через NativeMessage - if(browserSpecs.name === 'Edge') { - isEdge = true; - return true; - } - // В Chrome, Firefox, Safari и Opera работаем через асинхронную версию в зависимости от версии - if(browserSpecs.name === 'Opera') { - isOpera = true; - if(browserSpecs.version >= 33){ - return true; - } - else{ - return false; - } - } - if(browserSpecs.name === 'Firefox') { - isFireFox = true; - if(browserSpecs.version >= 52){ - return true; - } - else{ - return false; - } - } - if(browserSpecs.name === 'Chrome') { - if(browserSpecs.version >= 42){ - return true; - } - else{ - return false; - } - } - //В Сафари начиная с 12 версии нет NPAPI - if(browserSpecs.name === 'Safari') { - isSafari = true; - if(browserSpecs.version >= 12) { - return true; - } else { - return false; - } - } - } - - // Функция активации объектов КриптоПро ЭЦП Browser plug-in - function CreateObject(name) { - if (isIOS()) { - // На iOS для создания объектов используется функция - // call_ru_cryptopro_npcades_10_native_bridge, определенная в IOS_npcades_supp.js - return call_ru_cryptopro_npcades_10_native_bridge("CreateObject", [name]); - } - if (isIE()) { - // В Internet Explorer создаются COM-объекты - if (name.match(/X509Enrollment/i)) { - try { - // Объекты CertEnroll пробуем создавать через нашу фабрику, - // если не получилось то через CX509EnrollmentWebClassFactory - var objCertEnrollClassFactory = document.getElementById("webClassFactory"); - return objCertEnrollClassFactory.CreateObject(name); - } - catch (e) { - try { - var objWebClassFactory = document.getElementById("certEnrollClassFactory"); - return objWebClassFactory.CreateObject(name); - } - catch (err) { - throw ("Для создания обьектов X509Enrollment следует настроить веб-узел на использование проверки подлинности по протоколу HTTPS"); - } - } - } - // Объекты CAPICOM и CAdESCOM создаются через CAdESCOM.WebClassFactory - try { - var objWebClassFactory = document.getElementById("webClassFactory"); - return objWebClassFactory.CreateObject(name); - } - catch (e) { - // Для версий плагина ниже 2.0.12538 - return new ActiveXObject(name); - } - } - // создаются объекты NPAPI - return pluginObject.CreateObject(name); - } - - function decimalToHexString(number) { - if (number < 0) { - number = 0xFFFFFFFF + number + 1; - } - - return number.toString(16).toUpperCase(); - } - - function GetMessageFromException(e) { - var err = e.message; - if (!err) { - err = e; - } else if (e.number) { - err += " (0x" + decimalToHexString(e.number) + ")"; - } - return err; - } - - function getLastError(exception) { - if(isNativeMessageSupported() || isIE() || isIOS() ) { - return GetMessageFromException(exception); - } - - try { - return pluginObject.getLastError(); - } catch(e) { - return GetMessageFromException(exception); - } - } - - // Функция для удаления созданных объектов - function ReleasePluginObjects() { - return cpcsp_chrome_nmcades.ReleasePluginObjects(); - } - - // Функция активации асинхронных объектов КриптоПро ЭЦП Browser plug-in - function CreateObjectAsync(name) { - return pluginObject.CreateObjectAsync(name); - } - - //Функции для IOS - var ru_cryptopro_npcades_10_native_bridge = { - callbacksCount : 1, - callbacks : {}, - - // Automatically called by native layer when a result is available - resultForCallback : function resultForCallback(callbackId, resultArray) { - var callback = ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId]; - if (!callback) return; - callback.apply(null,resultArray); - }, - - // Use this in javascript to request native objective-c code - // functionName : string (I think the name is explicit :p) - // args : array of arguments - // callback : function with n-arguments that is going to be called when the native code returned - call : function call(functionName, args, callback) { - var hasCallback = callback && typeof callback === "function"; - var callbackId = hasCallback ? ru_cryptopro_npcades_10_native_bridge.callbacksCount++ : 0; - - if (hasCallback) - ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId] = callback; - - var iframe = document.createElement("IFRAME"); - var arrObjs = new Array("_CPNP_handle"); - try{ - iframe.setAttribute("src", "cpnp-js-call:" + functionName + ":" + callbackId+ ":" + encodeURIComponent(JSON.stringify(args, arrObjs))); - } catch(e){ - alert(e); - } - document.documentElement.appendChild(iframe); - iframe.parentNode.removeChild(iframe); - iframe = null; - } - }; - - function call_ru_cryptopro_npcades_10_native_bridge(functionName, array){ - var tmpobj; - var ex; - ru_cryptopro_npcades_10_native_bridge.call(functionName, array, function(e, response){ - ex = e; - var str='tmpobj='+response; - eval(str); - if (typeof (tmpobj) === "string"){ - tmpobj = tmpobj.replace(/\\\n/gm, "\n"); - tmpobj = tmpobj.replace(/\\\r/gm, "\r"); - } - }); - if(ex) - throw ex; - return tmpobj; - } - - function show_firefox_missing_extension_dialog() - { - if (!window.cadesplugin_skip_extension_install) - { - var ovr = document.createElement('div'); - ovr.id = "cadesplugin_ovr"; - ovr.style = "visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)"; - ovr.innerHTML = "
" + - "" + - "

Для работы КриптоПро ЭЦП Browser plugin на данном сайте необходимо расширение для браузера. Убедитесь, что оно у Вас включено или установите его." + - "

Скачать расширение

" + - "
"; - document.getElementsByTagName("Body")[0].appendChild(ovr); - document.getElementById("cadesplugin_close_install").addEventListener('click',function() - { - plugin_loaded_error("Плагин недоступен"); - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - }); - - ovr.addEventListener('click',function() - { - plugin_loaded_error("Плагин недоступен"); - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - }); - ovr.style.visibility="visible"; - } - } - - - //Выводим окно поверх других с предложением установить расширение для Opera. - //Если установленна переменная cadesplugin_skip_extension_install - не предлагаем установить расширение - function install_opera_extension() - { - if (!window.cadesplugin_skip_extension_install) - { - document.addEventListener('DOMContentLoaded', function() { - var ovr = document.createElement('div'); - ovr.id = "cadesplugin_ovr"; - ovr.style = "visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)"; - ovr.innerHTML = "
" + - "" + - "

Для работы КриптоПро ЭЦП Browser plugin на данном сайте необходимо установить расширение из каталога дополнений Opera." + - "

" + - "
"; - document.getElementsByTagName("Body")[0].appendChild(ovr); - var btn_install = document.getElementById("cadesplugin_install"); - btn_install.addEventListener('click', function(event) { - opr.addons.installExtension("epebfcehmdedogndhlcacafjaacknbcm", - function() - { - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - location.reload(); - }, - function(){}) - }); - document.getElementById("cadesplugin_close_install").addEventListener('click',function() - { - plugin_loaded_error("Плагин недоступен"); - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - }); - - ovr.addEventListener('click',function() - { - plugin_loaded_error("Плагин недоступен"); - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - }); - ovr.style.visibility="visible"; - document.getElementById("cadesplugin_ovr_item").addEventListener('click',function(e){ - e.stopPropagation(); - }); - }); - }else - { - plugin_loaded_error("Плагин недоступен"); - } - } - - function firefox_or_edge_nmcades_onload() { - cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error); - } - - function nmcades_api_onload () { - window.postMessage("cadesplugin_echo_request", "*"); - window.addEventListener("message", function (event){ - if (typeof(event.data) !== "string" || !event.data.match("cadesplugin_loaded")) - return; - if(isFireFox || isEdge || isSafari) - { - // Для Firefox, Сафари, Edge вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js - var url = event.data.substring(event.data.indexOf("url:") + 4); - var fileref = document.createElement('script'); - fileref.setAttribute("type", "text/javascript"); - fileref.setAttribute("src", url); - fileref.onerror = plugin_loaded_error; - fileref.onload = firefox_or_edge_nmcades_onload; - document.getElementsByTagName("head")[0].appendChild(fileref); - // Для Firefox, Safari и Edge у нас только по одному расширению. - failed_extensions++; - }else { - cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error); - } - }, false); - } - - //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari - function load_extension() - { - - if(isFireFox || isEdge || isSafari){ - // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера. - nmcades_api_onload(); - } else { - // в асинхронном варианте для chrome и opera подключаем оба расширения - var fileref = document.createElement('script'); - fileref.setAttribute("type", "text/javascript"); - fileref.setAttribute("src", "chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js"); - fileref.onerror = plugin_loaded_error; - fileref.onload = nmcades_api_onload; - document.getElementsByTagName("head")[0].appendChild(fileref); - fileref = document.createElement('script'); - fileref.setAttribute("type", "text/javascript"); - fileref.setAttribute("src", "chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js"); - fileref.onerror = plugin_loaded_error; - fileref.onload = nmcades_api_onload; - document.getElementsByTagName("head")[0].appendChild(fileref); - } - } - - //Загружаем плагин для NPAPI - function load_npapi_plugin() - { - var elem = document.createElement('object'); - elem.setAttribute("id", "cadesplugin_object"); - elem.setAttribute("type", "application/x-cades"); - elem.setAttribute("style", "visibility: hidden"); - document.getElementsByTagName("body")[0].appendChild(elem); - pluginObject = document.getElementById("cadesplugin_object"); - if(isIE()) - { - var elem1 = document.createElement('object'); - elem1.setAttribute("id", "certEnrollClassFactory"); - elem1.setAttribute("classid", "clsid:884e2049-217d-11da-b2a4-000e7bbb2b09"); - elem1.setAttribute("style", "visibility: hidden"); - document.getElementsByTagName("body")[0].appendChild(elem1); - var elem2 = document.createElement('object'); - elem2.setAttribute("id", "webClassFactory"); - elem2.setAttribute("classid", "clsid:B04C8637-10BD-484E-B0DA-B8A039F60024"); - elem2.setAttribute("style", "visibility: hidden"); - document.getElementsByTagName("body")[0].appendChild(elem2); - } - } - - //Отправляем событие что все ок. - function plugin_loaded() - { - plugin_resolved = 1; - if(canPromise) - { - plugin_resolve(); - }else { - window.postMessage("cadesplugin_loaded", "*"); - } - } - - //Отправляем событие что сломались. - function plugin_loaded_error(msg) - { - if(isNativeMessageSupported()) - { - //в асинхронном варианте подключаем оба расширения, если сломались оба пробуем установить для Opera - failed_extensions++; - if(failed_extensions<2) - return; - if(isOpera && (typeof(msg) === 'undefined'|| typeof(msg) === 'object')) - { - install_opera_extension(); - return; - } - } - if(typeof(msg) === 'undefined' || typeof(msg) === 'object') - msg = "Плагин недоступен"; - plugin_resolved = 1; - if(canPromise) - { - plugin_reject(msg); - } else { - window.postMessage("cadesplugin_load_error", "*"); - } - } - - //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку - function check_load_timeout() - { - if(plugin_resolved === 1) - return; - if(isFireFox) - { - show_firefox_missing_extension_dialog(); - } - plugin_resolved = 1; - if(canPromise) - { - plugin_reject("Истекло время ожидания загрузки плагина"); - } else { - window.postMessage("cadesplugin_load_error", "*"); - } - - } - - //Вспомогательная функция для NPAPI - function createPromise(arg) - { - return new Promise(arg); - } - - function check_npapi_plugin (){ - try { - var oAbout = CreateObject("CAdESCOM.About"); - plugin_loaded(); - } - catch (err) { - document.getElementById("cadesplugin_object").style.display = 'none'; - // Объект создать не удалось, проверим, установлен ли - // вообще плагин. Такая возможность есть не во всех браузерах - var mimetype = navigator.mimeTypes["application/x-cades"]; - if (mimetype) { - var plugin = mimetype.enabledPlugin; - if (plugin) { - plugin_loaded_error("Плагин загружен, но не создаются обьекты"); - }else - { - plugin_loaded_error("Ошибка при загрузке плагина"); - } - }else - { - plugin_loaded_error("Плагин недоступен"); - } - } - } - - //Проверяем работает ли плагин - function check_plugin_working() - { - var div = document.createElement("div"); - div.innerHTML = ""; - var isIeLessThan9 = (div.getElementsByTagName("i").length === 1); - if (isIeLessThan9) { - plugin_loaded_error("Internet Explorer версии 8 и ниже не поддерживается"); - return; - } - - if(isNativeMessageSupported()) - { - load_extension(); - }else if(!canPromise) { - window.addEventListener("message", function (event){ - if (event.data !== "cadesplugin_echo_request") - return; - load_npapi_plugin(); - check_npapi_plugin(); - }, - false); - }else - { - if(document.readyState === "complete"){ - load_npapi_plugin(); - check_npapi_plugin(); - } else { - window.addEventListener("load", function (event) { - load_npapi_plugin(); - check_npapi_plugin(); - }, false); - } - } - } - - function set_pluginObject(obj) - { - pluginObject = obj; - } - - function is_capilite_enabled() - { - if ((typeof (cadesplugin.EnableInternalCSP) !== 'undefined') && cadesplugin.EnableInternalCSP) - return true; - return false; - }; - - //Export - cadesplugin.JSModuleVersion = "2.1.2"; - cadesplugin.async_spawn = async_spawn; - cadesplugin.set = set_pluginObject; - cadesplugin.set_log_level = set_log_level; - cadesplugin.getLastError = getLastError; - cadesplugin.is_capilite_enabled = is_capilite_enabled; - - if(isNativeMessageSupported()) - { - cadesplugin.CreateObjectAsync = CreateObjectAsync; - cadesplugin.ReleasePluginObjects = ReleasePluginObjects; - } - - if(!isNativeMessageSupported()) - { - cadesplugin.CreateObject = CreateObject; - } - - if(window.cadesplugin_load_timeout) - { - setTimeout(check_load_timeout, window.cadesplugin_load_timeout); - } - else - { - setTimeout(check_load_timeout, 20000); - } - - set_constantValues(); - - cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR; - window.cadesplugin = cadesplugin; - check_plugin_working(); -}()); - - -/***/ }) - -/******/ }); -}); -//# sourceMappingURL=crypto-pro.js.map \ No newline at end of file diff --git a/lib/crypto-pro.js.map b/lib/crypto-pro.js.map deleted file mode 100644 index 277a885..0000000 --- a/lib/crypto-pro.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack://cryptoPro/webpack/universalModuleDefinition","webpack://cryptoPro/webpack/bootstrap","webpack://cryptoPro/../node_modules/base64-js/index.js","webpack://cryptoPro/../node_modules/buffer/index.js","webpack://cryptoPro/../node_modules/ieee754/index.js","webpack://cryptoPro/../node_modules/isarray/index.js","webpack://cryptoPro/../node_modules/webpack/buildin/global.js","webpack://cryptoPro/./api/certificate/certificate.ts","webpack://cryptoPro/./api/certificate/exportBase64.ts","webpack://cryptoPro/./api/certificate/getAlgorithm.ts","webpack://cryptoPro/./api/certificate/getCadesProp.ts","webpack://cryptoPro/./api/certificate/getDecodedExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/getExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/getInfo.ts","webpack://cryptoPro/./api/certificate/hasExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/index.ts","webpack://cryptoPro/./api/certificate/isValid.ts","webpack://cryptoPro/./api/createAttachedSignature.ts","webpack://cryptoPro/./api/createDetachedSignature.ts","webpack://cryptoPro/./api/createHash.ts","webpack://cryptoPro/./api/createSignature.ts","webpack://cryptoPro/./api/createXMLSignature.ts","webpack://cryptoPro/./api/getCertificate.ts","webpack://cryptoPro/./api/getSystemInfo.ts","webpack://cryptoPro/./api/getUserCertificates.ts","webpack://cryptoPro/./api/index.ts","webpack://cryptoPro/./api/isValidSystemSetup.ts","webpack://cryptoPro/./constants/cades-constants.ts","webpack://cryptoPro/./constants/index.ts","webpack://cryptoPro/./constants/issuer-tags-translations.ts","webpack://cryptoPro/./constants/oids-dictionary.ts","webpack://cryptoPro/./constants/subject-tags-translations.ts","webpack://cryptoPro/./crypto-pro.ts","webpack://cryptoPro/./helpers/_afterPluginsLoaded.ts","webpack://cryptoPro/./helpers/_extractCommonName.ts","webpack://cryptoPro/./helpers/_extractMeaningfulErrorMessage.ts","webpack://cryptoPro/./helpers/_generateCadesFn.ts","webpack://cryptoPro/./helpers/_getCadesCert.ts","webpack://cryptoPro/./helpers/_getDateObj.ts","webpack://cryptoPro/./helpers/_isSupportedCSPVersion.ts","webpack://cryptoPro/./helpers/_isSupportedCadesVersion.ts","webpack://cryptoPro/./helpers/_parseCertInfo.ts","webpack://cryptoPro/./vendor/cadesplugin_api.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;QCVA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;AClFY;;AAEZ;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,kCAAkC,SAAS;AAC3C;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0CAA0C,UAAU;AACpD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;;;;;;ACvJA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEY;;AAEZ,aAAa,mBAAO,CAAC,qDAAW;AAChC,cAAc,mBAAO,CAAC,iDAAS;AAC/B,cAAc,mBAAO,CAAC,iDAAS;;AAE/B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAqB,mDAAmD;AACxE;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,mBAAmB,UAAU;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA,uCAAuC,SAAS;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;;AAEA;AACA;AACA,aAAa,iBAAiB;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,gDAAgD,EAAE;AAClD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,iBAAiB,SAAS;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAwB,eAAe;AACvC;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,wBAAwB,QAAQ;AAChC;AACA,qBAAqB,eAAe;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA,qBAAqB,SAAS;AAC9B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,kBAAkB;AACnC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA,mBAAmB,cAAc;AACjC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uDAAuD,OAAO;AAC9D;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA,uDAAuD,OAAO;AAC9D;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAkB;AAClB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,qBAAqB,QAAQ;AAC7B;AACA;AACA,GAAG;AACH;AACA,eAAe,SAAS;AACxB;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA,mBAAmB,SAAS;AAC5B;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,YAAY;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,iBAAiB,gBAAgB;AACjC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,iBAAiB,gBAAgB;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,iBAAiB,YAAY;AAC7B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;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;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,yDAAyD;AACzD;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,sBAAsB;;AAEtB;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,iBAAiB,WAAW,UAAU,YAAY,aAAa;AAC3G,qFAAqF,aAAa,mBAAmB,uBAAuB,uBAAuB,cAAc,mBAAmB,YAAY;AAChN,4EAA4E,iBAAiB,yBAAyB,WAAW;AACjI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,iBAAiB,WAAW,UAAU,YAAY,aAAa;AAC/G,yFAAyF,aAAa,mBAAmB,uBAAuB,uBAAuB,cAAc,mBAAmB,YAAY;AACpN,gFAAgF,iBAAiB,yBAAyB,WAAW;AACrI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB,oCAAoC;AACpC,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;;AAEjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,CAAC","file":"crypto-pro.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"cryptoPro\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"cryptoPro\"] = factory();\n\telse\n\t\troot[\"cryptoPro\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./crypto-pro.ts\");\n","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n","exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","import { ISSUER_TAGS_TRANSLATIONS, SUBJECT_TAGS_TRANSLATIONS } from '../../constants';\r\nimport { TagTranslation } from '../../helpers/_parseCertInfo';\r\nimport { exportBase64 } from './exportBase64';\r\nimport { getAlgorithm } from './getAlgorithm';\r\nimport { getCadesProp } from './getCadesProp';\r\nimport { getDecodedExtendedKeyUsage, ExtendedKeysTranslations } from './getDecodedExtendedKeyUsage';\r\nimport { getExtendedKeyUsage } from './getExtendedKeyUsage';\r\nimport { getInfo } from './getInfo';\r\nimport { hasExtendedKeyUsage } from './hasExtendedKeyUsage';\r\nimport { isValid } from './isValid';\r\n\r\nexport type CadesCertificate = any;\r\n\r\nexport class Certificate {\r\n constructor(\r\n public _cadesCertificate: CadesCertificate,\r\n public name: string,\r\n public issuerName: string,\r\n public subjectName: string,\r\n public thumbprint: string,\r\n public validFrom: string,\r\n public validTo: string,\r\n ) {}\r\n\r\n public getOwnerInfo(): Promise {\r\n return getInfo.call(this, SUBJECT_TAGS_TRANSLATIONS, 'SubjectName');\r\n }\r\n\r\n public getIssuerInfo(): Promise {\r\n return getInfo.call(this, ISSUER_TAGS_TRANSLATIONS, 'IssuerName');\r\n }\r\n\r\n public getExtendedKeyUsage(): Promise {\r\n return getExtendedKeyUsage.call(this);\r\n }\r\n\r\n public getDecodedExtendedKeyUsage(): Promise {\r\n return getDecodedExtendedKeyUsage.call(this);\r\n }\r\n\r\n public getAlgorithm(): Promise {\r\n return getAlgorithm.call(this);\r\n }\r\n\r\n public getCadesProp(propName): Promise {\r\n return getCadesProp.call(this, propName);\r\n }\r\n\r\n public isValid(): Promise {\r\n return isValid.call(this);\r\n }\r\n\r\n public exportBase64(): Promise {\r\n return exportBase64.call(this);\r\n }\r\n\r\n public hasExtendedKeyUsage(oids): Promise {\r\n return hasExtendedKeyUsage.call(this, oids);\r\n }\r\n}\r\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\r\nimport { Certificate } from './certificate';\r\n\r\n/**\r\n * Экспортирует сертификат в формате base64\r\n *\r\n * @returns сертификат в формате base64\r\n */\r\nexport const exportBase64 = _afterPluginsLoaded(function (): string {\r\n const cadesCertificate = (this as Certificate)._cadesCertificate;\r\n\r\n return eval(\r\n _generateCadesFn(function exportBase64(): string {\r\n let base64: string;\r\n\r\n try {\r\n base64 = __cadesAsyncToken__ + cadesCertificate.Export(0);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при экспорте сертификата');\r\n }\r\n\r\n return base64;\r\n }),\r\n );\r\n});\r\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\r\nimport { Certificate } from './certificate';\r\n\r\ninterface AlgorithmInfo {\r\n algorithm: string;\r\n oid: string;\r\n}\r\n\r\n/**\r\n * Возвращает информацию об алгоритме сертификата\r\n *\r\n * @returns информацию об алгоритме и его OID'е\r\n */\r\nexport const getAlgorithm = _afterPluginsLoaded(function (): AlgorithmInfo {\r\n const cadesCertificate = (this as Certificate)._cadesCertificate;\r\n\r\n return eval(\r\n _generateCadesFn(function getAlgorithm(): AlgorithmInfo {\r\n const algorithmInfo: AlgorithmInfo = {\r\n algorithm: null,\r\n oid: null,\r\n };\r\n let cadesPublicKey;\r\n\r\n try {\r\n cadesPublicKey = __cadesAsyncToken__ + cadesCertificate.PublicKey();\r\n cadesPublicKey = __cadesAsyncToken__ + cadesPublicKey.Algorithm;\r\n algorithmInfo.algorithm = __cadesAsyncToken__ + cadesPublicKey.FriendlyName;\r\n algorithmInfo.oid = __cadesAsyncToken__ + cadesPublicKey.Value;\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении алгоритма');\r\n }\r\n\r\n return algorithmInfo;\r\n }),\r\n );\r\n});\r\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\r\nimport { Certificate } from './certificate';\r\n\r\n/**\r\n * Возвращает указанное внутренее свойство у сертификата в формате Cades\r\n *\r\n * @param propName = наименование свойства\r\n * @returns значение запрошенного свойства\r\n */\r\nexport const getCadesProp = _afterPluginsLoaded(function (propName: string): any {\r\n const cadesCertificate = (this as Certificate)._cadesCertificate;\r\n\r\n return eval(\r\n _generateCadesFn(function getCadesProp() {\r\n let propertyValue;\r\n\r\n try {\r\n propertyValue = __cadesAsyncToken__ + cadesCertificate[propName];\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при обращении к свойству сертификата');\r\n }\r\n\r\n return propertyValue;\r\n }),\r\n );\r\n});\r\n","import { OIDS_DICTIONARY } from '../../constants';\r\nimport { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { Certificate } from './certificate';\r\n\r\nexport interface ExtendedKeysTranslations {\r\n [key: string]: string | null;\r\n}\r\n\r\n/**\r\n * Возвращает расшифрованные ОИД'ы сертификата\r\n *\r\n * @returns словарь расшифрованных ОИД'ов\r\n */\r\nexport const getDecodedExtendedKeyUsage = _afterPluginsLoaded(async function (): Promise {\r\n const certificateOids = await (this as Certificate).getExtendedKeyUsage();\r\n\r\n return certificateOids.reduce(\r\n (decodedOids, oidCode) => ({\r\n ...decodedOids,\r\n [oidCode]: OIDS_DICTIONARY[oidCode] || null,\r\n }),\r\n {},\r\n );\r\n});\r\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\r\nimport { Certificate } from './certificate';\r\n\r\n/**\r\n * Возвращает ОИД'ы сертификата\r\n *\r\n * @returns список ОИД'ов\r\n */\r\nexport const getExtendedKeyUsage = _afterPluginsLoaded(function (): string[] {\r\n const cadesCertificate = (this as Certificate)._cadesCertificate;\r\n\r\n return eval(\r\n _generateCadesFn(function getExtendedKeyUsage(): string[] {\r\n const OIDS: string[] = [];\r\n let count: any;\r\n\r\n try {\r\n count = __cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage();\r\n count = __cadesAsyncToken__ + count.EKUs;\r\n count = __cadesAsyncToken__ + count.Count;\r\n\r\n if (count > 0) {\r\n while (count > 0) {\r\n let cadesExtendedKeyUsage;\r\n\r\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage();\r\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.EKUs;\r\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.Item(count);\r\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.OID;\r\n\r\n OIDS.push(cadesExtendedKeyUsage);\r\n\r\n count--;\r\n }\r\n }\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || \"Ошибка при получении ОИД'ов\");\r\n }\r\n\r\n return OIDS;\r\n }),\r\n );\r\n});\r\n","import { TagsTranslations } from '../../constants/tags-translations';\r\nimport { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\r\nimport { _parseCertInfo, TagTranslation } from '../../helpers/_parseCertInfo';\r\nimport { getCadesProp } from './getCadesProp';\r\n\r\n/**\r\n * Возвращает расшифрованную информацию о сертификате из указанного свойства по тэгам\r\n *\r\n * @param tags = словарь\r\n * @param entitiesPath = путь к разбираемой сущности\r\n * @returns расшифрованная информация по отдельным тэгам\r\n */\r\nexport const getInfo = _afterPluginsLoaded(async function (\r\n tags: TagsTranslations[],\r\n entitiesPath: string,\r\n): Promise {\r\n let entities: string;\r\n\r\n try {\r\n entities = await getCadesProp.call(this, entitiesPath);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при извлечении информации из сертификата');\r\n }\r\n\r\n return _parseCertInfo(tags, entities);\r\n});\r\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { Certificate } from './certificate';\r\n\r\n/**\r\n * Проверяет наличие ОИД'а (ОИД'ов) у сертификата\r\n *\r\n * @param oids - ОИД'ы для проверки\r\n * @returns флаг наличия ОИД'ов у сертификата\r\n */\r\nexport const hasExtendedKeyUsage = _afterPluginsLoaded(async function (oids: string | string[]): Promise {\r\n const certOids = await (this as Certificate).getExtendedKeyUsage();\r\n\r\n let result: boolean;\r\n\r\n if (Array.isArray(oids)) {\r\n result = oids.every((oidToCheck) => certOids.some((certOid) => certOid === oidToCheck));\r\n } else {\r\n result = certOids.some((certOid) => certOid === oids);\r\n }\r\n\r\n return result;\r\n});\r\n","export * from './certificate';\r\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\r\nimport { Certificate } from './certificate';\r\n\r\n/**\r\n * Проверяет действительность сертификата\r\n *\r\n * @returns флаг валидности\r\n */\r\nexport const isValid = _afterPluginsLoaded(function (): boolean {\r\n const cadesCertificate = (this as Certificate)._cadesCertificate;\r\n\r\n return eval(\r\n _generateCadesFn(function isValid() {\r\n let isValid;\r\n\r\n try {\r\n isValid = __cadesAsyncToken__ + cadesCertificate.IsValid();\r\n isValid = __cadesAsyncToken__ + isValid.Result;\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при проверке сертификата');\r\n }\r\n\r\n return Boolean(isValid);\r\n }),\r\n );\r\n});\r\n","import { CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME } from '../constants';\r\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\nimport { _getCadesCert } from '../helpers/_getCadesCert';\r\nimport { _getDateObj } from '../helpers/_getDateObj';\r\n\r\n/**\r\n * Создает присоединенную подпись сообщения по отпечатку сертификата\r\n *\r\n * @param thumbprint - отпечаток сертификата\r\n * @param message - подписываемое сообщение\r\n * @returns подпись в формате PKCS#7\r\n */\r\nexport const createAttachedSignature = _afterPluginsLoaded(\r\n async (thumbprint: string, unencryptedMessage: string | ArrayBuffer): Promise => {\r\n const { cadesplugin } = window;\r\n const cadesCertificate = await _getCadesCert(thumbprint);\r\n\r\n return eval(\r\n _generateCadesFn(function createAttachedSignature(): string {\r\n let cadesAttrs;\r\n let cadesSignedData;\r\n let cadesSigner;\r\n\r\n try {\r\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\r\n cadesSignedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CadesSignedData');\r\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\r\n }\r\n\r\n const currentTime = _getDateObj(new Date());\r\n\r\n try {\r\n void (__cadesAsyncToken__ + cadesAttrs.propset_Name(CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME));\r\n void (__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи');\r\n }\r\n\r\n let messageBase64;\r\n\r\n try {\r\n messageBase64 = Buffer.from(unencryptedMessage).toString('base64');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error('Ошибка при преобразовании сообщения в Base64');\r\n }\r\n\r\n let cadesAuthAttrs;\r\n\r\n try {\r\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\r\n cadesAuthAttrs = __cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2;\r\n void (__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs));\r\n void (__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));\r\n void (__cadesAsyncToken__ + cadesSignedData.propset_Content(messageBase64));\r\n void (__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи');\r\n }\r\n\r\n let signature: string;\r\n\r\n try {\r\n signature = __cadesAsyncToken__ + cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_PKCS7_TYPE);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных');\r\n }\r\n\r\n return signature;\r\n }),\r\n );\r\n },\r\n);\r\n","import { CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME } from '../constants';\r\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\nimport { _getCadesCert } from '../helpers/_getCadesCert';\r\nimport { _getDateObj } from '../helpers/_getDateObj';\r\n\r\n/**\r\n * Создает отсоединенную подпись хеша по отпечатку сертификата\r\n *\r\n * @param thumbprint - отпечаток сертификата\r\n * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11-2012 256 бит\r\n * @returns подпись в формате PKCS#7\r\n */\r\nexport const createDetachedSignature = _afterPluginsLoaded(\r\n async (thumbprint: string, messageHash: string): Promise => {\r\n const { cadesplugin } = window;\r\n const cadesCertificate = await _getCadesCert(thumbprint);\r\n\r\n return eval(\r\n _generateCadesFn(function createDetachedSignature(): string {\r\n let cadesAttrs;\r\n let cadesHashedData;\r\n let cadesSignedData;\r\n let cadesSigner;\r\n\r\n try {\r\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\r\n cadesHashedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.HashedData');\r\n cadesSignedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CadesSignedData');\r\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\r\n }\r\n\r\n const currentTime = _getDateObj(new Date());\r\n\r\n try {\r\n void (__cadesAsyncToken__ + cadesAttrs.propset_Name(CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME));\r\n void (__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи');\r\n }\r\n\r\n let cadesAuthAttrs;\r\n\r\n try {\r\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\r\n cadesAuthAttrs = __cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2;\r\n void (__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs));\r\n void (__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке сертификата');\r\n }\r\n\r\n try {\r\n void (\r\n __cadesAsyncToken__ +\r\n cadesHashedData.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256)\r\n );\r\n void (__cadesAsyncToken__ + cadesHashedData.SetHashValue(messageHash));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке хеша');\r\n }\r\n\r\n let signature: string;\r\n\r\n try {\r\n signature =\r\n __cadesAsyncToken__ +\r\n cadesSignedData.SignHash(cadesHashedData, cadesSigner, cadesplugin.CADESCOM_PKCS7_TYPE);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных');\r\n }\r\n\r\n return signature;\r\n }),\r\n );\r\n },\r\n);\r\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\n\r\n/**\r\n * Создает хеш сообщения по ГОСТ Р 34.11-2012 256 бит\r\n * https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%B8%D0%B1%D0%BE%D0%B3_(%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F)\r\n *\r\n * @param unencryptedMessage - сообщение для хеширования\r\n *\r\n * @returns хеш\r\n */\r\nexport const createHash = _afterPluginsLoaded(\r\n async (unencryptedMessage: string | ArrayBuffer): Promise => {\r\n const { cadesplugin } = window;\r\n\r\n return eval(\r\n _generateCadesFn(function createHash(): string {\r\n const cadesHashedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.HashedData');\r\n let messageBase64;\r\n let hash;\r\n\r\n try {\r\n messageBase64 = Buffer.from(unencryptedMessage).toString('base64');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error('Ошибка при преобразовании сообщения в Base64');\r\n }\r\n\r\n try {\r\n void (\r\n __cadesAsyncToken__ +\r\n cadesHashedData.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256)\r\n );\r\n void (__cadesAsyncToken__ + cadesHashedData.propset_DataEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));\r\n void (__cadesAsyncToken__ + cadesHashedData.Hash(messageBase64));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации хэширования');\r\n }\r\n\r\n try {\r\n hash = __cadesAsyncToken__ + cadesHashedData.Value;\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при создании хэша');\r\n }\r\n\r\n return hash;\r\n }),\r\n );\r\n },\r\n);\r\n","import { CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME } from '../constants';\r\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\nimport { _getCadesCert } from '../helpers/_getCadesCert';\r\nimport { _getDateObj } from '../helpers/_getDateObj';\r\n\r\n/**\r\n * Создает подпись base64 строки по отпечатку сертификата\r\n *\r\n * @param thumbprint - отпечаток сертификата\r\n * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11\r\n * @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false)\r\n * @returns подпись\r\n */\r\nexport const createSignature = _afterPluginsLoaded(\r\n async (thumbprint: string, messageHash: string, detachedSignature: boolean = true): Promise => {\r\n console.warn(\r\n [\r\n 'cryptoPro: Метод \"createSignature\" является устаревшим и будет убран из будущих версий.',\r\n 'Используйте \"createAttachedSignature\" и \"createDetachedSignature\".',\r\n ].join('\\n'),\r\n );\r\n\r\n const { cadesplugin } = window;\r\n const cadesCertificate = await _getCadesCert(thumbprint);\r\n\r\n return eval(\r\n _generateCadesFn(function createSignature(): string {\r\n let cadesAttrs;\r\n let cadesSignedData;\r\n let cadesSigner;\r\n\r\n try {\r\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\r\n cadesSignedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CadesSignedData');\r\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\r\n }\r\n\r\n const currentTime = _getDateObj(new Date());\r\n\r\n try {\r\n void (__cadesAsyncToken__ + cadesAttrs.propset_Name(CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME));\r\n void (__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи');\r\n }\r\n\r\n let cadesAuthAttrs;\r\n\r\n try {\r\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\r\n cadesAuthAttrs = __cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2;\r\n void (__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs));\r\n void (__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));\r\n void (__cadesAsyncToken__ + cadesSignedData.propset_Content(messageHash));\r\n void (\r\n __cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY)\r\n );\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи');\r\n }\r\n\r\n let signature: string;\r\n\r\n try {\r\n signature =\r\n __cadesAsyncToken__ +\r\n cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_CADES_BES, detachedSignature);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных');\r\n }\r\n\r\n return signature;\r\n }),\r\n );\r\n },\r\n);\r\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\nimport { _getCadesCert } from '../helpers/_getCadesCert';\r\n\r\n/**\r\n * Создает XML подпись для документа в формате XML\r\n *\r\n * @param thumbprint - отпечаток сертификата\r\n * @param unencryptedMessage - подписываемое сообщение в формате XML\r\n * @returns подпись\r\n */\r\nexport const createXMLSignature = _afterPluginsLoaded(\r\n async (thumbprint: string, unencryptedMessage: string): Promise => {\r\n const { cadesplugin } = window;\r\n const cadesCertificate = await _getCadesCert(thumbprint);\r\n\r\n return eval(\r\n _generateCadesFn(function createXMLSignature(): string {\r\n let cadesSigner;\r\n let cadesSignedXML;\r\n\r\n try {\r\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\r\n cadesSignedXML = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.SignedXML');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\r\n }\r\n\r\n try {\r\n const signatureMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256';\r\n const digestMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256';\r\n\r\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\r\n void (__cadesAsyncToken__ + cadesSigner.propset_CheckCertificate(true));\r\n void (__cadesAsyncToken__ + cadesSignedXML.propset_Content(unencryptedMessage));\r\n void (\r\n __cadesAsyncToken__ +\r\n cadesSignedXML.propset_SignatureType(cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED)\r\n );\r\n void (__cadesAsyncToken__ + cadesSignedXML.propset_SignatureMethod(signatureMethod));\r\n void (__cadesAsyncToken__ + cadesSignedXML.propset_DigestMethod(digestMethod));\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи');\r\n }\r\n\r\n let signature: string;\r\n\r\n try {\r\n signature = __cadesAsyncToken__ + cadesSignedXML.Sign(cadesSigner);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных');\r\n }\r\n\r\n return signature;\r\n }),\r\n );\r\n },\r\n);\r\n","import { Certificate } from './certificate';\r\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { getUserCertificates } from './getUserCertificates';\r\n\r\n/**\r\n * Возвращает сертификат по отпечатку\r\n *\r\n * @param thumbprint - отпечаток сертификата\r\n * @returns сертификат\r\n */\r\nexport const getCertificate = _afterPluginsLoaded(\r\n async (thumbprint: string): Promise => {\r\n if (!thumbprint) {\r\n throw new Error('Отпечаток не указан');\r\n }\r\n\r\n const availableCertificates: Certificate[] = await getUserCertificates();\r\n const foundCertificate: Certificate = availableCertificates.find((cert) => cert.thumbprint === thumbprint);\r\n\r\n if (!foundCertificate) {\r\n throw new Error(`Сертификат с отпечатком: \"${thumbprint}\" не найден`);\r\n }\r\n\r\n return foundCertificate;\r\n },\r\n);\r\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\n\r\nexport interface SystemInfo {\r\n cadesVersion: string;\r\n cspVersion: string;\r\n}\r\n\r\n/**\r\n * Предоставляет информацию о системе\r\n *\r\n * @returns информацию о CSP и плагине\r\n */\r\nexport const getSystemInfo = _afterPluginsLoaded(\r\n (): SystemInfo => {\r\n const sysInfo = {\r\n cadesVersion: null,\r\n cspVersion: null,\r\n };\r\n\r\n return eval(\r\n _generateCadesFn(function getSystemInfo(): SystemInfo {\r\n let cadesAbout;\r\n\r\n try {\r\n cadesAbout = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.About');\r\n\r\n sysInfo.cadesVersion = __cadesAsyncToken__ + cadesAbout.PluginVersion;\r\n sysInfo.cspVersion = __cadesAsyncToken__ + cadesAbout.CSPVersion();\r\n\r\n if (!sysInfo.cadesVersion) {\r\n sysInfo.cadesVersion = __cadesAsyncToken__ + cadesAbout.Version;\r\n }\r\n\r\n sysInfo.cadesVersion = __cadesAsyncToken__ + sysInfo.cadesVersion.toString();\r\n sysInfo.cspVersion = __cadesAsyncToken__ + sysInfo.cspVersion.toString();\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении информации о системе');\r\n }\r\n\r\n return sysInfo;\r\n }),\r\n );\r\n },\r\n);\r\n","import { CadesCertificate, Certificate } from './certificate';\r\nimport { CAPICOM_PROPID_KEY_PROV_INFO } from '../constants';\r\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractCommonName } from '../helpers/_extractCommonName';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\r\n\r\nlet certificatesCache: Certificate[];\r\n\r\n/**\r\n * Возвращает список сертификатов, доступных пользователю в системе\r\n *\r\n * @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов\r\n * @returns список сертификатов\r\n */\r\nexport const getUserCertificates = _afterPluginsLoaded((resetCache: boolean = false): Certificate[] => {\r\n const { cadesplugin } = window;\r\n\r\n if (!resetCache && certificatesCache) {\r\n return certificatesCache;\r\n }\r\n\r\n return eval(\r\n _generateCadesFn(function getUserCertificates(): Certificate[] {\r\n let cadesStore;\r\n\r\n try {\r\n cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');\r\n }\r\n\r\n try {\r\n void (\r\n __cadesAsyncToken__ +\r\n cadesStore.Open(\r\n cadesplugin.CAPICOM_CURRENT_USER_STORE,\r\n cadesplugin.CAPICOM_MY_STORE,\r\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,\r\n )\r\n );\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');\r\n }\r\n\r\n let cadesCertificates;\r\n let cadesCertificatesCount;\r\n\r\n try {\r\n cadesCertificates = __cadesAsyncToken__ + cadesStore.Certificates;\r\n\r\n if (cadesCertificates) {\r\n cadesCertificates =\r\n __cadesAsyncToken__ + cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID);\r\n\r\n /**\r\n * Не рассматриваются сертификаты, в которых отсутствует закрытый ключ\r\n * или не действительны на данный момент\r\n */\r\n cadesCertificates =\r\n __cadesAsyncToken__ +\r\n cadesCertificates.Find(\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY,\r\n CAPICOM_PROPID_KEY_PROV_INFO,\r\n );\r\n\r\n cadesCertificatesCount = __cadesAsyncToken__ + cadesCertificates.Count;\r\n }\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');\r\n }\r\n\r\n if (!cadesCertificatesCount) {\r\n throw new Error('Нет доступных сертификатов');\r\n }\r\n\r\n const certificateList: Certificate[] = [];\r\n\r\n try {\r\n while (cadesCertificatesCount) {\r\n const cadesCertificate: CadesCertificate =\r\n __cadesAsyncToken__ + cadesCertificates.Item(cadesCertificatesCount);\r\n\r\n certificateList.push(\r\n new Certificate(\r\n cadesCertificate,\r\n _extractCommonName(__cadesAsyncToken__ + cadesCertificate.SubjectName),\r\n __cadesAsyncToken__ + cadesCertificate.IssuerName,\r\n __cadesAsyncToken__ + cadesCertificate.SubjectName,\r\n __cadesAsyncToken__ + cadesCertificate.Thumbprint,\r\n __cadesAsyncToken__ + cadesCertificate.ValidFromDate,\r\n __cadesAsyncToken__ + cadesCertificate.ValidToDate,\r\n ),\r\n );\r\n\r\n cadesCertificatesCount--;\r\n }\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка обработки сертификатов');\r\n }\r\n\r\n cadesStore.Close();\r\n\r\n certificatesCache = certificateList;\r\n\r\n return certificatesCache;\r\n }),\r\n );\r\n});\r\n","export * from './getCertificate';\r\nexport * from './getUserCertificates';\r\nexport * from './getSystemInfo';\r\nexport * from './isValidSystemSetup';\r\nexport * from './createSignature';\r\nexport * from './createXMLSignature';\r\nexport * from './createDetachedSignature';\r\nexport * from './createAttachedSignature';\r\nexport * from './createHash';\r\nexport * from './certificate';\r\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\r\nimport { _isSupportedCadesVersion } from '../helpers/_isSupportedCadesVersion';\r\nimport { _isSupportedCSPVersion } from '../helpers/_isSupportedCSPVersion';\r\nimport { getSystemInfo, SystemInfo } from './getSystemInfo';\r\n\r\n/**\r\n * Проверяет корректность настроек ЭП на машине\r\n *\r\n * @returns флаг корректности настроек\r\n */\r\nexport const isValidSystemSetup = _afterPluginsLoaded(\r\n async (): Promise => {\r\n let systemInfo: SystemInfo;\r\n\r\n try {\r\n systemInfo = await getSystemInfo();\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Настройки ЭП на данной машине не верны');\r\n }\r\n\r\n if (!_isSupportedCadesVersion(systemInfo.cadesVersion)) {\r\n throw new Error('Не поддерживаемая версия плагина');\r\n }\r\n\r\n if (!_isSupportedCSPVersion(systemInfo.cspVersion)) {\r\n throw new Error('Не поддерживаемая версия CSP');\r\n }\r\n\r\n return true;\r\n },\r\n);\r\n","export const CADESCOM_ATTRIBUTE_OTHER = -1;\r\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\r\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\r\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\r\nexport const CADESCOM_AllowNoOutstandingRequest = 1;\r\nexport const CADESCOM_AllowNone = 0;\r\nexport const CADESCOM_AllowUntrustedCertificate = 2;\r\nexport const CADESCOM_AllowUntrustedRoot = 4;\r\nexport const CADESCOM_BASE64_TO_BINARY = 0x01;\r\nexport const CADESCOM_CADES_BES = 1;\r\nexport const CADESCOM_CADES_DEFAULT = 0;\r\nexport const CADESCOM_CADES_T = 5;\r\nexport const CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;\r\nexport const CADESCOM_CONTAINER_STORE = 100;\r\nexport const CADESCOM_CURRENT_USER_STORE = 2;\r\nexport const CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;\r\nexport const CADESCOM_DISPLAY_DATA_CONTENT = 1;\r\nexport const CADESCOM_DISPLAY_DATA_NONE = 0;\r\nexport const CADESCOM_ENCODE_ANY = -1;\r\nexport const CADESCOM_ENCODE_BASE64 = 0;\r\nexport const CADESCOM_ENCODE_BINARY = 1;\r\nexport const CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;\r\nexport const CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;\r\nexport const CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;\r\nexport const CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;\r\nexport const CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;\r\nexport const CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;\r\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;\r\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;\r\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111;\r\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;\r\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112;\r\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110;\r\nexport const CADESCOM_HASH_ALGORITHM_MD2 = 1;\r\nexport const CADESCOM_HASH_ALGORITHM_MD4 = 2;\r\nexport const CADESCOM_HASH_ALGORITHM_MD5 = 3;\r\nexport const CADESCOM_HASH_ALGORITHM_SHA1 = 0;\r\nexport const CADESCOM_HASH_ALGORITHM_SHA_256 = 4;\r\nexport const CADESCOM_HASH_ALGORITHM_SHA_384 = 5;\r\nexport const CADESCOM_HASH_ALGORITHM_SHA_512 = 6;\r\nexport const CADESCOM_LOCAL_MACHINE_STORE = 1;\r\nexport const CADESCOM_PKCS7_TYPE = 65535;\r\nexport const CADESCOM_STRING_TO_UCS2LE = 0x00;\r\nexport const CADESCOM_SkipInstallToStore = 268435456;\r\nexport const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;\r\nexport const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;\r\nexport const CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;\r\nexport const CAPICOM_ACTIVE_DIRECTORY_USER_STORE = 3;\r\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\r\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\r\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\r\nexport const CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;\r\nexport const CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;\r\nexport const CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;\r\nexport const CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;\r\nexport const CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;\r\nexport const CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;\r\nexport const CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;\r\nexport const CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;\r\nexport const CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\r\nexport const CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;\r\nexport const CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;\r\nexport const CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;\r\nexport const CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;\r\nexport const CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;\r\nexport const CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;\r\nexport const CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;\r\nexport const CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;\r\nexport const CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;\r\nexport const CAPICOM_CURRENT_USER_STORE = 2;\r\nexport const CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;\r\nexport const CAPICOM_EKU_CLIENT_AUTH = 2;\r\nexport const CAPICOM_EKU_OTHER = 0;\r\nexport const CAPICOM_EKU_SMARTCARD_LOGON = 5;\r\nexport const CAPICOM_LOCAL_MACHINE_STORE = 1;\r\nexport const CAPICOM_MEMORY_STORE = 0;\r\nexport const CAPICOM_MY_STORE = 'My';\r\nexport const CAPICOM_OID_KEY_USAGE_EXTENSION = 10;\r\nexport const CAPICOM_OID_OTHER = 0;\r\nexport const CAPICOM_PROPID_ACCESS_STATE = 14;\r\nexport const CAPICOM_PROPID_ARCHIVED = 19;\r\nexport const CAPICOM_PROPID_ARCHIVED_KEY_HASH = 65;\r\nexport const CAPICOM_PROPID_AUTO_ENROLL = 21;\r\nexport const CAPICOM_PROPID_CROSS_CERT_DIST_POINTS = 23;\r\nexport const CAPICOM_PROPID_CTL_USAGE = 9;\r\nexport const CAPICOM_PROPID_DATE_STAMP = 27;\r\nexport const CAPICOM_PROPID_DESCRIPTION = 13;\r\nexport const CAPICOM_PROPID_EFS = 17;\r\nexport const CAPICOM_PROPID_ENHKEY_USAGE = 9;\r\nexport const CAPICOM_PROPID_ENROLLMENT = 26;\r\nexport const CAPICOM_PROPID_EXTENDED_ERROR_INFO = 30;\r\nexport const CAPICOM_PROPID_FIRST_RESERVED = 66;\r\nexport const CAPICOM_PROPID_FIRST_USER = 0x00008000;\r\nexport const CAPICOM_PROPID_FORTEZZA_DATA = 18;\r\nexport const CAPICOM_PROPID_FRIENDLY_NAME = 11;\r\nexport const CAPICOM_PROPID_HASH_PROP = 3;\r\nexport const CAPICOM_PROPID_IE30_RESERVED = 7;\r\nexport const CAPICOM_PROPID_ISSUER_PUBLIC_KEY_MD5_HASH = 24;\r\nexport const CAPICOM_PROPID_ISSUER_SERIAL_NUMBER_MD5_HASH = 28;\r\nexport const CAPICOM_PROPID_KEY_CONTEXT = 5;\r\nexport const CAPICOM_PROPID_KEY_IDENTIFIER = 20;\r\nexport const CAPICOM_PROPID_KEY_PROV_HANDLE = 1;\r\nexport const CAPICOM_PROPID_KEY_PROV_INFO = 2;\r\nexport const CAPICOM_PROPID_KEY_SPEC = 6;\r\nexport const CAPICOM_PROPID_LAST_RESERVED = 0x00007fff;\r\nexport const CAPICOM_PROPID_LAST_USER = 0x0000ffff;\r\nexport const CAPICOM_PROPID_MD5_HASH = 4;\r\nexport const CAPICOM_PROPID_NEXT_UPDATE_LOCATION = 10;\r\nexport const CAPICOM_PROPID_PUBKEY_ALG_PARA = 22;\r\nexport const CAPICOM_PROPID_PUBKEY_HASH_RESERVED = 8;\r\nexport const CAPICOM_PROPID_PVK_FILE = 12;\r\nexport const CAPICOM_PROPID_RENEWAL = 64;\r\nexport const CAPICOM_PROPID_SHA1_HASH = 3;\r\nexport const CAPICOM_PROPID_SIGNATURE_HASH = 15;\r\nexport const CAPICOM_PROPID_SMART_CARD_DATA = 16;\r\nexport const CAPICOM_PROPID_SUBJECT_NAME_MD5_HASH = 29;\r\nexport const CAPICOM_PROPID_SUBJECT_PUBLIC_KEY_MD5_HASH = 25;\r\nexport const CAPICOM_PROPID_UNKNOWN = 0;\r\nexport const CAPICOM_SMART_CARD_USER_STORE = 4;\r\nexport const CAPICOM_STORE_OPEN_EXISTING_ONLY = 128;\r\nexport const CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED = 256;\r\nexport const CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;\r\nexport const CAPICOM_STORE_OPEN_READ_ONLY = 0;\r\nexport const CAPICOM_STORE_OPEN_READ_WRITE = 1;\r\nexport const CHECK_NONE = 0;\r\nexport const CHECK_OFFLINE_REVOCATION_STATUS = 16;\r\nexport const CHECK_ONLINE_REVOCATION_STATUS = 8;\r\nexport const CHECK_SIGNATURE_VALIDITY = 4;\r\nexport const CHECK_TIME_VALIDITY = 2;\r\nexport const CHECK_TRUSTED_ROOT = 1;\r\nexport const LOG_LEVEL_DEBUG = 4;\r\nexport const LOG_LEVEL_ERROR = 1;\r\nexport const LOG_LEVEL_INFO = 2;\r\nexport const TRUST_CTL_IS_NOT_SIGNATURE_VALID = 262144;\r\nexport const TRUST_CTL_IS_NOT_TIME_VALID = 131072;\r\nexport const TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 524288;\r\nexport const TRUST_IS_CYCLIC = 128;\r\nexport const TRUST_IS_NOT_SIGNATURE_VALID = 8;\r\nexport const TRUST_IS_NOT_TIME_NESTED = 2;\r\nexport const TRUST_IS_NOT_TIME_VALID = 1;\r\nexport const TRUST_IS_NOT_VALID_FOR_USAGE = 16;\r\nexport const TRUST_IS_PARTIAL_CHAIN = 65536;\r\nexport const TRUST_IS_REVOKED = 4;\r\nexport const TRUST_IS_UNTRUSTED_ROOT = 32;\r\nexport const TRUST_REVOCATION_STATUS_UNKNOWN = 64;\r\nexport const XmlDsigGost3410Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411';\r\nexport const XmlDsigGost3410UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411';\r\nexport const XmlDsigGost3411Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411';\r\nexport const XmlDsigGost3411UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr3411';\r\n","export * from './cades-constants';\r\nexport * from './issuer-tags-translations';\r\nexport * from './oids-dictionary';\r\nexport * from './subject-tags-translations';\r\n","import { TagsTranslations } from './tags-translations';\r\n\r\nexport const ISSUER_TAGS_TRANSLATIONS: TagsTranslations[] = [\r\n { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' },\r\n { possibleNames: ['CN'], translation: 'Удостоверяющий центр' },\r\n { possibleNames: ['C'], translation: 'Страна' },\r\n { possibleNames: ['S'], translation: 'Регион' },\r\n { possibleNames: ['STREET'], translation: 'Адрес' },\r\n { possibleNames: ['O'], translation: 'Компания' },\r\n { possibleNames: ['OU'], translation: 'Тип' },\r\n { possibleNames: ['T'], translation: 'Должность' },\r\n { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },\r\n { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },\r\n { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },\r\n { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },\r\n { possibleNames: ['E'], translation: 'Email' },\r\n { possibleNames: ['L'], translation: 'Город' },\r\n];\r\n","export const OIDS_DICTIONARY = {\r\n '1.2.643.2.2.34.6': 'Пользователь Центра Регистрации',\r\n '1.2.643.2.39.1.1': 'Использование в программных продуктах системы \"1С:Предприятие 8\"',\r\n '1.2.643.3.131.1.1': 'ИНН',\r\n '1.2.643.3.141.1.1': 'РНС ФСС',\r\n '1.2.643.3.141.1.2': 'КП ФСС',\r\n '1.2.643.3.2.100.65.13.11': 'Использование в системе АИС \"Госзакупки\" Сахалинской области.',\r\n '1.2.643.3.8.100.1': 'Сертификат типа \"ekey-ГОСТ\"',\r\n '1.2.643.3.8.100.1.1': 'Общее использование в системах ИОК без права заверения финансовых документов',\r\n '1.2.643.3.8.100.1.10':\r\n 'Для участия в электронных торгах и подписания государственного контракта в информационных системах Тендерного комитета города Москвы уполномоченными лицами участников размещения государственного заказа города Москвы',\r\n '1.2.643.3.8.100.1.11':\r\n 'Подписание электронных документов в автоматизированной информационной системе размещения государственного и муниципального заказа Саратовской области',\r\n '1.2.643.3.8.100.1.12': 'Использование в системе государственного заказа Иркутской области',\r\n '1.2.643.3.8.100.1.13':\r\n 'Использование в электронной торговой площадке агентства государственного заказа Красноярского края',\r\n '1.2.643.3.8.100.1.14': 'Использование в электронной торговой площадке \"Тендер\"',\r\n '1.2.643.3.8.100.1.2': 'Передача отчетности по ТКС',\r\n '1.2.643.3.8.100.1.3': 'Оформление взаимных обязательств, соглашений, договоров, актов и т.п.',\r\n '1.2.643.3.8.100.1.4': 'Внутрикорпоративный документооборот',\r\n '1.2.643.3.8.100.1.5': 'Использование в системах электронной торговли',\r\n '1.2.643.3.8.100.1.6': 'Использование в торгово-закупочной системе \"ЭЛЕКТРА\"',\r\n '1.2.643.3.8.100.1.7': 'Использование в системе Портал государственных закупок Ставропольского края.',\r\n '1.2.643.3.8.100.1.8': 'Использование в Единой системе электронной торговли B2B-Center и B2G.',\r\n '1.2.643.3.8.100.1.9':\r\n 'Для участия в электронных торгах и подписания государственного контракта в электронной площадке ОАО «ЕЭТП» уполномоченными лицами участников размещения государственного или муниципального заказа',\r\n '1.2.643.5.1.24.2.1.3':\r\n 'Формирование документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя',\r\n '1.2.643.5.1.24.2.1.3.1':\r\n 'Формирование кадастровым инженером документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя',\r\n '1.2.643.5.1.24.2.2.2': 'Формирование документов как результата оказания услуги со стороны органов регистрации прав',\r\n '1.2.643.5.1.24.2.2.3':\r\n 'Формирование документов для получения государственных услуг в сфере государственной регистрации прав на недвижимое имущество и сделок с ним со стороны заявителя',\r\n '1.2.643.6.2.1.7.1':\r\n 'Использование единоличным исполнительным органом юридического лица или уполномоченными представителями юридического лица в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских и иных прав и обязанностей в сфере негосударственного пенсионного обеспечения, негосударственного пенсионного страхования, в сфере деятельности паевых инвестиционных фондов, акционерных инвестиционных фондов, профессиональных участников рынка ценных бумаг, а также связанной с обслуживанием указанной деятельности услуг кредитных и иных организаций',\r\n '1.2.643.6.2.1.7.2':\r\n 'Использование физическим лицом в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских прав и обязанностей в отношении инвестиционных паев паевых инвестиционных фондов, в том числе отношения, связанные с учетом и/или фиксацией прав на инвестиционные паи паевых инвестиционных фондов',\r\n '1.2.643.6.3':\r\n 'Использование в электронных торговых системах и в программном обеспечении, связанным с обменом электронных сообщений',\r\n '1.2.643.6.3.1.1': 'Использование на электронных площадок отобранных для проведения аукционах в электронной форме',\r\n '1.2.643.6.3.1.2.1': 'Тип участника - Юридическое лицо',\r\n '1.2.643.6.3.1.2.2': 'Тип участника - Физическое лицо',\r\n '1.2.643.6.3.1.2.3': 'Тип участника - Индивидуальный предприниматель',\r\n '1.2.643.6.3.1.3.1': 'Участник размещения заказа',\r\n '1.2.643.6.3.1.4.1': 'Администратор организации',\r\n '1.2.643.6.3.1.4.2': 'Уполномоченный специалист',\r\n '1.2.643.6.3.1.4.3': 'Специалист с правом подписи контракта',\r\n '1.2.840.113549.1.9.2': 'Неструктурированное имя',\r\n '1.3.6.1.4.1.24138.1.1.8.1': 'Обеспечение юридической значимости в Системе \"Электронная Торговая Площадка\"',\r\n '1.3.6.1.4.1.29919.21': 'Использование в системе Портал государственных закупок Ростовской области \"Рефери\".',\r\n '1.3.6.1.5.5.7.3.2': 'Проверка подлинности клиента',\r\n '1.3.6.1.5.5.7.3.4': 'Защищенная электронная почта',\r\n '1.3.643.3.8.100.15': 'Использование в ЭТП \"uTender\"',\r\n};\r\n","import { TagsTranslations } from './tags-translations';\r\n\r\nexport const SUBJECT_TAGS_TRANSLATIONS: TagsTranslations[] = [\r\n { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' },\r\n { possibleNames: ['CN'], translation: 'Владелец' },\r\n { possibleNames: ['SN'], translation: 'Фамилия' },\r\n { possibleNames: ['G'], translation: 'Имя Отчество' },\r\n { possibleNames: ['C'], translation: 'Страна' },\r\n { possibleNames: ['S'], translation: 'Регион' },\r\n { possibleNames: ['STREET'], translation: 'Адрес' },\r\n { possibleNames: ['O'], translation: 'Компания' },\r\n { possibleNames: ['OU'], translation: 'Отдел/подразделение' },\r\n { possibleNames: ['T'], translation: 'Должность' },\r\n { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },\r\n { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },\r\n { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },\r\n { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },\r\n { possibleNames: ['E'], translation: 'Email' },\r\n { possibleNames: ['L'], translation: 'Город' },\r\n];\r\n","export * from './api';\r\n","import { _extractMeaningfulErrorMessage } from './_extractMeaningfulErrorMessage';\r\n\r\ntype Unpromisify = T extends Promise ? R : T;\r\n\r\nlet isSetLogLevel = false;\r\nlet isPluginLoaded = false;\r\n\r\nexport const _afterPluginsLoaded = any>(\r\n fn: T,\r\n): ((...args: Parameters) => Promise>>) => {\r\n const canPromise = Boolean(window.Promise);\r\n\r\n return async function (...args: Parameters): Promise>> {\r\n if (!isPluginLoaded) {\r\n try {\r\n require('../vendor/cadesplugin_api');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(\r\n _extractMeaningfulErrorMessage(error) || 'Ошибка при подключении модуля для работы с Cades plugin',\r\n );\r\n }\r\n\r\n isPluginLoaded = true;\r\n }\r\n\r\n const { cadesplugin } = window;\r\n\r\n if (!canPromise) {\r\n throw new Error('Необходим полифилл для Promise');\r\n }\r\n\r\n if (!cadesplugin) {\r\n throw new Error('Не подключен модуль для работы с Cades plugin');\r\n }\r\n\r\n if (!isSetLogLevel) {\r\n cadesplugin.set_log_level(cadesplugin.LOG_LEVEL_ERROR);\r\n\r\n isSetLogLevel = true;\r\n }\r\n\r\n try {\r\n await cadesplugin;\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(\r\n _extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации модуля для работы с Cades plugin',\r\n );\r\n }\r\n\r\n return await fn.apply(this, args);\r\n };\r\n};\r\n","export const _extractCommonName = (subjectName: string): string | undefined =>\r\n subjectName.match(/CN=(.+?)(?:,|$)/)?.[1];\r\n","export const _extractMeaningfulErrorMessage = (error: Error): string | null => {\n let errorContainer = window.cadesplugin?.getLastError && window.cadesplugin.getLastError(error);\n\n if (!errorContainer?.message) {\n if (!error.message) {\n return null;\n }\n\n errorContainer = error;\n }\n\n const containsRussianLetters = /[а-яА-Я]/.test(errorContainer.message);\n\n if (!containsRussianLetters) {\n return null;\n }\n\n const searchResult = errorContainer.message.match(/^(.*?)(?:(?:\\.?\\s?\\(?(0x[0-9a-zA-Z]{1,8})\\))|(?:\\.?$))/);\n\n return (searchResult ? searchResult[1] + (searchResult[2] ? '. Код ошибки: ' + searchResult[2] : '') : null);\n};\n","// синтетические переменные, которые подменяются в рантайме\r\nexport const __cadesAsyncToken__ = {};\r\nexport const __createCadesPluginObject__ = (...args): any => ({});\r\n\r\nfunction getGeneratorConstructor(): GeneratorFunction {\r\n return new Function('', 'return Object.getPrototypeOf(function*(){}).constructor')();\r\n}\r\n\r\nexport const _generateCadesFn = (callback: Function): string => {\r\n const { cadesplugin } = window;\r\n const cadesGeneratorsAPI = Boolean(cadesplugin.CreateObjectAsync);\r\n const callbackName = callback.name || 'dynamicFn';\r\n const callbackLiteral = String(callback);\r\n const callbackArguments = callbackLiteral.match(/^function[\\s\\w]*?\\((.*?)\\)/)?.[1] || '';\r\n const callbackBody = callbackLiteral.replace(/^.*?{([\\s\\S]*?)}$/, '$1');\r\n let crossEnvCallbackLiteral = String(\r\n new (cadesGeneratorsAPI ? getGeneratorConstructor() : Function)(callbackArguments, callbackBody),\r\n );\r\n\r\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(\r\n /\\w+?\\.__createCadesPluginObject__(\\([\\s\\S]*?\\))/gm,\r\n `cadesplugin.CreateObject${cadesGeneratorsAPI ? 'Async' : ''}$1`,\r\n );\r\n\r\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(\r\n /\\w+?\\.__cadesAsyncToken__\\s*?\\+\\s*?\\b/gm,\r\n cadesGeneratorsAPI ? 'yield ' : '',\r\n );\r\n\r\n if (!cadesGeneratorsAPI) {\r\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/propset_(.*?)\\((.*?)\\)/gm, '$1 = $2');\r\n }\r\n\r\n return [\r\n cadesGeneratorsAPI ? `cadesplugin.async_spawn(${crossEnvCallbackLiteral});` : `(${crossEnvCallbackLiteral})();`,\r\n `//# sourceURL=crypto-pro_${callbackName}.js`,\r\n ].join('');\r\n};\r\n","import { CadesCertificate } from '../api/certificate';\r\nimport { _afterPluginsLoaded } from './_afterPluginsLoaded';\r\nimport { _extractMeaningfulErrorMessage } from './_extractMeaningfulErrorMessage';\r\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from './_generateCadesFn';\r\n\r\n/**\r\n * Возвращает сертификат в формате Cades по отпечатку\r\n *\r\n * @param thumbprint - отпечаток сертификата\r\n * @returns сертификат в формате Cades\r\n */\r\nexport const _getCadesCert = _afterPluginsLoaded(\r\n (thumbprint: string): CadesCertificate => {\r\n const { cadesplugin } = window;\r\n\r\n return eval(\r\n _generateCadesFn(function _getCadesCert() {\r\n let cadesStore;\r\n\r\n try {\r\n cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');\r\n }\r\n\r\n if (!cadesStore) {\r\n throw new Error('Не удалось получить доступ к хранилищу сертификатов');\r\n }\r\n\r\n try {\r\n void (\r\n __cadesAsyncToken__ +\r\n cadesStore.Open(\r\n cadesplugin.CAPICOM_CURRENT_USER_STORE,\r\n cadesplugin.CAPICOM_MY_STORE,\r\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,\r\n )\r\n );\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');\r\n }\r\n\r\n let cadesCertificateList;\r\n let certificatesCount;\r\n\r\n try {\r\n cadesCertificateList = __cadesAsyncToken__ + cadesStore.Certificates;\r\n certificatesCount = __cadesAsyncToken__ + cadesCertificateList.Count;\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');\r\n }\r\n\r\n if (!certificatesCount) {\r\n throw new Error('Нет доступных сертификатов');\r\n }\r\n\r\n let cadesCertificate: CadesCertificate;\r\n\r\n try {\r\n cadesCertificateList =\r\n __cadesAsyncToken__ + cadesCertificateList.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH, thumbprint);\r\n\r\n const count = __cadesAsyncToken__ + cadesCertificateList.Count;\r\n\r\n if (!count) {\r\n throw new Error(`Сертификат с отпечатком: \"${thumbprint}\" не найден`);\r\n }\r\n\r\n cadesCertificate = __cadesAsyncToken__ + cadesCertificateList.Item(1);\r\n } catch (error) {\r\n console.error(error);\r\n\r\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении сертификата');\r\n }\r\n\r\n cadesStore.Close();\r\n\r\n return cadesCertificate;\r\n }),\r\n );\r\n },\r\n);\r\n","/**\r\n * Возвращает объект даты, совместимый с Cades plugin'ом, зависящий от браузера.\r\n *\r\n * В IE необходимо использовать специфичный формат \"VT_DATE\"\r\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Microsoft_Extensions/Date.getVarDate\r\n */\r\nexport const _getDateObj = (dateObj): Date => (dateObj.getVarDate ? dateObj.getVarDate() : dateObj);\r\n","const oldestSupportedCSPVersion = 4.0;\r\n\r\nexport const _isSupportedCSPVersion = (version: string): boolean => {\r\n version = version.match(/\\d+?\\b(?:\\.\\d+)?/)?.[0];\r\n\r\n return Number(version) >= oldestSupportedCSPVersion;\r\n};\r\n","export const _isSupportedCadesVersion = (version: string): boolean => {\r\n const match = version.match(/(\\d+)\\.(\\d+)\\.(\\d+)/);\r\n\r\n if (!match) {\r\n return false;\r\n }\r\n\r\n const [, major, minor, patch] = match;\r\n\r\n if (Number(major) < 2) {\r\n return false;\r\n }\r\n\r\n if (Number(major) === 2 && Number(patch) < 12438) {\r\n return false;\r\n }\r\n\r\n return true;\r\n};\r\n","import { OIDS_DICTIONARY } from '../constants';\r\nimport { TagsTranslations } from '../constants/tags-translations';\r\n\r\nexport interface TagTranslation {\r\n description: string;\r\n title: string;\r\n isTranslated: boolean;\r\n}\r\n\r\n/**\r\n * Парсит информацию из строки с информацией о сертификате\r\n *\r\n * @param tagsTranslations - словарь с расшифровками тэгов\r\n * @param rawInfo - данные для парсинга\r\n * @returns расшифрованная информация по отдельным тэгам\r\n */\r\nexport const _parseCertInfo = (tagsTranslations: TagsTranslations[], rawInfo: string): TagTranslation[] => {\r\n const extractedEntities: string[] = rawInfo.match(/([а-яА-Яa-zA-Z0-9\\s.]+)=(?:(\"[^\"]+?\")|(.+?))(?:,|$)/g);\r\n\r\n if (extractedEntities) {\r\n return extractedEntities.map((group) => {\r\n const segmentsMatch = group.trim().match(/^([а-яА-Яa-zA-Z0-9\\s.]+)=(.+?),?$/);\r\n let title = segmentsMatch?.[1];\r\n // Вырезаем лишние кавычки\r\n const description = segmentsMatch?.[2]?.replace(/^\"(.*)\"/, '$1')?.replace(/\"{2}/g, '\"');\r\n const oidIdentifierMatch = title?.match(/^OID\\.(.*)/);\r\n const oidIdentifier = oidIdentifierMatch?.[1];\r\n let isTranslated = false;\r\n\r\n // Если нашли в тайтле ОИД, пытаемся его расшифровать\r\n if (oidIdentifier) {\r\n const oidTranslation = OIDS_DICTIONARY[oidIdentifier];\r\n\r\n if (oidTranslation) {\r\n title = oidTranslation;\r\n isTranslated = true;\r\n }\r\n }\r\n\r\n const tagTranslation = tagsTranslations.find((tag) => tag.possibleNames.find((name) => name === title))\r\n ?.translation;\r\n\r\n if (tagTranslation) {\r\n title = tagTranslation;\r\n isTranslated = true;\r\n }\r\n\r\n return { description, title, isTranslated };\r\n });\r\n }\r\n};\r\n",";(function () {\r\n //already loaded\r\n if(window.cadesplugin)\r\n return;\r\n\r\n var pluginObject;\r\n var plugin_resolved = 0;\r\n var plugin_reject;\r\n var plugin_resolve;\r\n var isOpera = 0;\r\n var isFireFox = 0;\r\n var isEdge = 0;\r\n var isSafari = 0;\r\n var failed_extensions = 0;\r\n\r\n var canPromise = !!window.Promise;\r\n var cadesplugin;\r\n\r\n if(canPromise)\r\n {\r\n cadesplugin = new Promise(function(resolve, reject)\r\n {\r\n plugin_resolve = resolve;\r\n plugin_reject = reject;\r\n });\r\n } else\r\n {\r\n cadesplugin = {};\r\n }\r\n\r\n function check_browser() {\r\n var ua= navigator.userAgent, tem, M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\\/))\\/?\\s*(\\d+)/i) || [];\r\n if(/trident/i.test(M[1])){\r\n tem= /\\brv[ :]+(\\d+)/g.exec(ua) || [];\r\n return {name:'IE',version:(tem[1] || '')};\r\n }\r\n if(M[1]=== 'Chrome'){\r\n tem= ua.match(/\\b(OPR|Edge)\\/(\\d+)/);\r\n if(tem!= null) return {name:tem[1].replace('OPR', 'Opera'),version:tem[2]};\r\n }\r\n M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];\r\n if((tem= ua.match(/version\\/(\\d+)/i))!= null) M.splice(1, 1, tem[1]);\r\n return {name:M[0],version:M[1]};\r\n }\r\n var browserSpecs = check_browser();\r\n\r\n function cpcsp_console_log(level, msg){\r\n //IE9 не может писать в консоль если не открыта вкладка developer tools\r\n if(typeof(console) === 'undefined')\r\n return;\r\n if (level <= cadesplugin.current_log_level ){\r\n if (level === cadesplugin.LOG_LEVEL_DEBUG)\r\n console.log(\"DEBUG: %s\", msg);\r\n if (level === cadesplugin.LOG_LEVEL_INFO)\r\n console.info(\"INFO: %s\", msg);\r\n if (level === cadesplugin.LOG_LEVEL_ERROR)\r\n console.error(\"ERROR: %s\", msg);\r\n return;\r\n }\r\n }\r\n\r\n function set_log_level(level){\r\n if (!((level === cadesplugin.LOG_LEVEL_DEBUG) ||\r\n (level === cadesplugin.LOG_LEVEL_INFO) ||\r\n (level === cadesplugin.LOG_LEVEL_ERROR))){\r\n cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, \"cadesplugin_api.js: Incorrect log_level: \" + level);\r\n return;\r\n }\r\n cadesplugin.current_log_level = level;\r\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG)\r\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = DEBUG\");\r\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO)\r\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = INFO\");\r\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR)\r\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = ERROR\");\r\n if(isNativeMessageSupported())\r\n {\r\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG)\r\n window.postMessage(\"set_log_level=debug\", \"*\");\r\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO)\r\n window.postMessage(\"set_log_level=info\", \"*\");\r\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR)\r\n window.postMessage(\"set_log_level=error\", \"*\");\r\n }\r\n }\r\n\r\n function set_constantValues()\r\n {\r\n cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1;\r\n cadesplugin.CAPICOM_CURRENT_USER_STORE = 2;\r\n cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1;\r\n cadesplugin.CADESCOM_CURRENT_USER_STORE = 2;\r\n cadesplugin.CADESCOM_CONTAINER_STORE = 100;\r\n\r\n cadesplugin.CAPICOM_MY_STORE = \"My\";\r\n\r\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;\r\n\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\r\n\r\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;\r\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;\r\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;\r\n\r\n cadesplugin.XmlDsigGost3410UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411\";\r\n cadesplugin.XmlDsigGost3411UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr3411\";\r\n cadesplugin.XmlDsigGost3410Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411\";\r\n cadesplugin.XmlDsigGost3411Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411\";\r\n\r\n cadesplugin.CADESCOM_CADES_DEFAULT = 0;\r\n cadesplugin.CADESCOM_CADES_BES = 1;\r\n cadesplugin.CADESCOM_CADES_T = 0x5;\r\n cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;\r\n cadesplugin.CADESCOM_PKCS7_TYPE = 0xffff;\r\n\r\n cadesplugin.CADESCOM_ENCODE_BASE64 = 0;\r\n cadesplugin.CADESCOM_ENCODE_BINARY = 1;\r\n cadesplugin.CADESCOM_ENCODE_ANY = -1;\r\n\r\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;\r\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;\r\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;\r\n\r\n cadesplugin.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;\r\n cadesplugin.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;\r\n\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;\r\n cadesplugin.CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;\r\n\r\n cadesplugin.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;\r\n\r\n cadesplugin.CAPICOM_PROPID_ENHKEY_USAGE = 9;\r\n\r\n cadesplugin.CAPICOM_OID_OTHER = 0;\r\n cadesplugin.CAPICOM_OID_KEY_USAGE_EXTENSION = 10;\r\n\r\n cadesplugin.CAPICOM_EKU_CLIENT_AUTH = 2;\r\n cadesplugin.CAPICOM_EKU_SMARTCARD_LOGON = 5;\r\n cadesplugin.CAPICOM_EKU_OTHER = 0;\r\n\r\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\r\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\r\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\r\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\r\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\r\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\r\n cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1;\r\n\r\n cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0;\r\n cadesplugin.CADESCOM_BASE64_TO_BINARY = 1;\r\n\r\n cadesplugin.CADESCOM_DISPLAY_DATA_NONE = 0;\r\n cadesplugin.CADESCOM_DISPLAY_DATA_CONTENT = 1;\r\n cadesplugin.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;\r\n\r\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;\r\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;\r\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;\r\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;\r\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;\r\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;\r\n\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA1 = 0;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD2 = 1;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD4 = 2;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD5 = 3;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_256 = 4;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_384 = 5;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_512 = 6;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111;\r\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112;\r\n\r\n cadesplugin.LOG_LEVEL_DEBUG = 4;\r\n cadesplugin.LOG_LEVEL_INFO = 2;\r\n cadesplugin.LOG_LEVEL_ERROR = 1;\r\n\r\n cadesplugin.CADESCOM_AllowNone = 0;\r\n cadesplugin.CADESCOM_AllowNoOutstandingRequest = 0x1;\r\n cadesplugin.CADESCOM_AllowUntrustedCertificate = 0x2;\r\n cadesplugin.CADESCOM_AllowUntrustedRoot = 0x4;\r\n cadesplugin.CADESCOM_SkipInstallToStore = 0x10000000;\r\n }\r\n\r\n function async_spawn(generatorFunc) {\r\n function continuer(verb, arg) {\r\n var result;\r\n try {\r\n result = generator[verb](arg);\r\n } catch (err) {\r\n return Promise.reject(err);\r\n }\r\n if (result.done) {\r\n return result.value;\r\n } else {\r\n return Promise.resolve(result.value).then(onFulfilled, onRejected);\r\n }\r\n }\r\n var generator = generatorFunc(Array.prototype.slice.call(arguments, 1));\r\n var onFulfilled = continuer.bind(continuer, \"next\");\r\n var onRejected = continuer.bind(continuer, \"throw\");\r\n return onFulfilled();\r\n }\r\n\r\n function isIE() {\r\n // var retVal = ((\"Microsoft Internet Explorer\" == navigator.appName) || // IE < 11\r\n // navigator.userAgent.match(/Trident\\/./i)); // IE 11\r\n return (browserSpecs.name === 'IE' || browserSpecs.name === 'MSIE');\r\n }\r\n\r\n function isIOS() {\r\n return (navigator.userAgent.match(/ipod/i) ||\r\n navigator.userAgent.match(/ipad/i) ||\r\n navigator.userAgent.match(/iphone/i));\r\n }\r\n\r\n function isNativeMessageSupported()\r\n {\r\n // В IE работаем через NPAPI\r\n if(isIE())\r\n return false;\r\n // В Edge работаем через NativeMessage\r\n if(browserSpecs.name === 'Edge') {\r\n isEdge = true;\r\n return true;\r\n }\r\n // В Chrome, Firefox, Safari и Opera работаем через асинхронную версию в зависимости от версии\r\n if(browserSpecs.name === 'Opera') {\r\n isOpera = true;\r\n if(browserSpecs.version >= 33){\r\n return true;\r\n }\r\n else{\r\n return false;\r\n }\r\n }\r\n if(browserSpecs.name === 'Firefox') {\r\n isFireFox = true;\r\n if(browserSpecs.version >= 52){\r\n return true;\r\n }\r\n else{\r\n return false;\r\n }\r\n }\r\n if(browserSpecs.name === 'Chrome') {\r\n if(browserSpecs.version >= 42){\r\n return true;\r\n }\r\n else{\r\n return false;\r\n }\r\n }\r\n //В Сафари начиная с 12 версии нет NPAPI\r\n if(browserSpecs.name === 'Safari') {\r\n isSafari = true;\r\n if(browserSpecs.version >= 12) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n // Функция активации объектов КриптоПро ЭЦП Browser plug-in\r\n function CreateObject(name) {\r\n if (isIOS()) {\r\n // На iOS для создания объектов используется функция\r\n // call_ru_cryptopro_npcades_10_native_bridge, определенная в IOS_npcades_supp.js\r\n return call_ru_cryptopro_npcades_10_native_bridge(\"CreateObject\", [name]);\r\n }\r\n if (isIE()) {\r\n // В Internet Explorer создаются COM-объекты\r\n if (name.match(/X509Enrollment/i)) {\r\n try {\r\n // Объекты CertEnroll пробуем создавать через нашу фабрику,\r\n // если не получилось то через CX509EnrollmentWebClassFactory\r\n var objCertEnrollClassFactory = document.getElementById(\"webClassFactory\");\r\n return objCertEnrollClassFactory.CreateObject(name);\r\n }\r\n catch (e) {\r\n try {\r\n var objWebClassFactory = document.getElementById(\"certEnrollClassFactory\");\r\n return objWebClassFactory.CreateObject(name);\r\n }\r\n catch (err) {\r\n throw (\"Для создания обьектов X509Enrollment следует настроить веб-узел на использование проверки подлинности по протоколу HTTPS\");\r\n }\r\n }\r\n }\r\n // Объекты CAPICOM и CAdESCOM создаются через CAdESCOM.WebClassFactory\r\n try {\r\n var objWebClassFactory = document.getElementById(\"webClassFactory\");\r\n return objWebClassFactory.CreateObject(name);\r\n }\r\n catch (e) {\r\n // Для версий плагина ниже 2.0.12538\r\n return new ActiveXObject(name);\r\n }\r\n }\r\n // создаются объекты NPAPI\r\n return pluginObject.CreateObject(name);\r\n }\r\n\r\n function decimalToHexString(number) {\r\n if (number < 0) {\r\n number = 0xFFFFFFFF + number + 1;\r\n }\r\n\r\n return number.toString(16).toUpperCase();\r\n }\r\n\r\n function GetMessageFromException(e) {\r\n var err = e.message;\r\n if (!err) {\r\n err = e;\r\n } else if (e.number) {\r\n err += \" (0x\" + decimalToHexString(e.number) + \")\";\r\n }\r\n return err;\r\n }\r\n\r\n function getLastError(exception) {\r\n if(isNativeMessageSupported() || isIE() || isIOS() ) {\r\n return GetMessageFromException(exception);\r\n }\r\n\r\n try {\r\n return pluginObject.getLastError();\r\n } catch(e) {\r\n return GetMessageFromException(exception);\r\n }\r\n }\r\n\r\n // Функция для удаления созданных объектов\r\n function ReleasePluginObjects() {\r\n return cpcsp_chrome_nmcades.ReleasePluginObjects();\r\n }\r\n\r\n // Функция активации асинхронных объектов КриптоПро ЭЦП Browser plug-in\r\n function CreateObjectAsync(name) {\r\n return pluginObject.CreateObjectAsync(name);\r\n }\r\n\r\n //Функции для IOS\r\n var ru_cryptopro_npcades_10_native_bridge = {\r\n callbacksCount : 1,\r\n callbacks : {},\r\n\r\n // Automatically called by native layer when a result is available\r\n resultForCallback : function resultForCallback(callbackId, resultArray) {\r\n var callback = ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId];\r\n if (!callback) return;\r\n callback.apply(null,resultArray);\r\n },\r\n\r\n // Use this in javascript to request native objective-c code\r\n // functionName : string (I think the name is explicit :p)\r\n // args : array of arguments\r\n // callback : function with n-arguments that is going to be called when the native code returned\r\n call : function call(functionName, args, callback) {\r\n var hasCallback = callback && typeof callback === \"function\";\r\n var callbackId = hasCallback ? ru_cryptopro_npcades_10_native_bridge.callbacksCount++ : 0;\r\n\r\n if (hasCallback)\r\n ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId] = callback;\r\n\r\n var iframe = document.createElement(\"IFRAME\");\r\n var arrObjs = new Array(\"_CPNP_handle\");\r\n try{\r\n iframe.setAttribute(\"src\", \"cpnp-js-call:\" + functionName + \":\" + callbackId+ \":\" + encodeURIComponent(JSON.stringify(args, arrObjs)));\r\n } catch(e){\r\n alert(e);\r\n }\r\n document.documentElement.appendChild(iframe);\r\n iframe.parentNode.removeChild(iframe);\r\n iframe = null;\r\n }\r\n };\r\n\r\n function call_ru_cryptopro_npcades_10_native_bridge(functionName, array){\r\n var tmpobj;\r\n var ex;\r\n ru_cryptopro_npcades_10_native_bridge.call(functionName, array, function(e, response){\r\n ex = e;\r\n var str='tmpobj='+response;\r\n eval(str);\r\n if (typeof (tmpobj) === \"string\"){\r\n tmpobj = tmpobj.replace(/\\\\\\n/gm, \"\\n\");\r\n tmpobj = tmpobj.replace(/\\\\\\r/gm, \"\\r\");\r\n }\r\n });\r\n if(ex)\r\n throw ex;\r\n return tmpobj;\r\n }\r\n\r\n function show_firefox_missing_extension_dialog()\r\n {\r\n if (!window.cadesplugin_skip_extension_install)\r\n {\r\n var ovr = document.createElement('div');\r\n ovr.id = \"cadesplugin_ovr\";\r\n ovr.style = \"visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)\";\r\n ovr.innerHTML = \"
\" +\r\n \"\" +\r\n \"

Для работы КриптоПро ЭЦП Browser plugin на данном сайте необходимо расширение для браузера. Убедитесь, что оно у Вас включено или установите его.\" +\r\n \"

Скачать расширение

\" +\r\n \"
\";\r\n document.getElementsByTagName(\"Body\")[0].appendChild(ovr);\r\n document.getElementById(\"cadesplugin_close_install\").addEventListener('click',function()\r\n {\r\n plugin_loaded_error(\"Плагин недоступен\");\r\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\r\n });\r\n\r\n ovr.addEventListener('click',function()\r\n {\r\n plugin_loaded_error(\"Плагин недоступен\");\r\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\r\n });\r\n ovr.style.visibility=\"visible\";\r\n }\r\n }\r\n\r\n\r\n //Выводим окно поверх других с предложением установить расширение для Opera.\r\n //Если установленна переменная cadesplugin_skip_extension_install - не предлагаем установить расширение\r\n function install_opera_extension()\r\n {\r\n if (!window.cadesplugin_skip_extension_install)\r\n {\r\n document.addEventListener('DOMContentLoaded', function() {\r\n var ovr = document.createElement('div');\r\n ovr.id = \"cadesplugin_ovr\";\r\n ovr.style = \"visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)\";\r\n ovr.innerHTML = \"
\" +\r\n \"\" +\r\n \"

Для работы КриптоПро ЭЦП Browser plugin на данном сайте необходимо установить расширение из каталога дополнений Opera.\" +\r\n \"

\" +\r\n \"
\";\r\n document.getElementsByTagName(\"Body\")[0].appendChild(ovr);\r\n var btn_install = document.getElementById(\"cadesplugin_install\");\r\n btn_install.addEventListener('click', function(event) {\r\n opr.addons.installExtension(\"epebfcehmdedogndhlcacafjaacknbcm\",\r\n function()\r\n {\r\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\r\n location.reload();\r\n },\r\n function(){})\r\n });\r\n document.getElementById(\"cadesplugin_close_install\").addEventListener('click',function()\r\n {\r\n plugin_loaded_error(\"Плагин недоступен\");\r\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\r\n });\r\n\r\n ovr.addEventListener('click',function()\r\n {\r\n plugin_loaded_error(\"Плагин недоступен\");\r\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\r\n });\r\n ovr.style.visibility=\"visible\";\r\n document.getElementById(\"cadesplugin_ovr_item\").addEventListener('click',function(e){\r\n e.stopPropagation();\r\n });\r\n });\r\n }else\r\n {\r\n plugin_loaded_error(\"Плагин недоступен\");\r\n }\r\n }\r\n\r\n function firefox_or_edge_nmcades_onload() {\r\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\r\n }\r\n\r\n function nmcades_api_onload () {\r\n window.postMessage(\"cadesplugin_echo_request\", \"*\");\r\n window.addEventListener(\"message\", function (event){\r\n if (typeof(event.data) !== \"string\" || !event.data.match(\"cadesplugin_loaded\"))\r\n return;\r\n if(isFireFox || isEdge || isSafari)\r\n {\r\n // Для Firefox, Сафари, Edge вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js\r\n var url = event.data.substring(event.data.indexOf(\"url:\") + 4);\r\n var fileref = document.createElement('script');\r\n fileref.setAttribute(\"type\", \"text/javascript\");\r\n fileref.setAttribute(\"src\", url);\r\n fileref.onerror = plugin_loaded_error;\r\n fileref.onload = firefox_or_edge_nmcades_onload;\r\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\r\n // Для Firefox, Safari и Edge у нас только по одному расширению.\r\n failed_extensions++;\r\n }else {\r\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\r\n }\r\n }, false);\r\n }\r\n\r\n //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari\r\n function load_extension()\r\n {\r\n\r\n if(isFireFox || isEdge || isSafari){\r\n // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера.\r\n nmcades_api_onload();\r\n } else {\r\n // в асинхронном варианте для chrome и opera подключаем оба расширения\r\n var fileref = document.createElement('script');\r\n fileref.setAttribute(\"type\", \"text/javascript\");\r\n fileref.setAttribute(\"src\", \"chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js\");\r\n fileref.onerror = plugin_loaded_error;\r\n fileref.onload = nmcades_api_onload;\r\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\r\n fileref = document.createElement('script');\r\n fileref.setAttribute(\"type\", \"text/javascript\");\r\n fileref.setAttribute(\"src\", \"chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js\");\r\n fileref.onerror = plugin_loaded_error;\r\n fileref.onload = nmcades_api_onload;\r\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\r\n }\r\n }\r\n\r\n //Загружаем плагин для NPAPI\r\n function load_npapi_plugin()\r\n {\r\n var elem = document.createElement('object');\r\n elem.setAttribute(\"id\", \"cadesplugin_object\");\r\n elem.setAttribute(\"type\", \"application/x-cades\");\r\n elem.setAttribute(\"style\", \"visibility: hidden\");\r\n document.getElementsByTagName(\"body\")[0].appendChild(elem);\r\n pluginObject = document.getElementById(\"cadesplugin_object\");\r\n if(isIE())\r\n {\r\n var elem1 = document.createElement('object');\r\n elem1.setAttribute(\"id\", \"certEnrollClassFactory\");\r\n elem1.setAttribute(\"classid\", \"clsid:884e2049-217d-11da-b2a4-000e7bbb2b09\");\r\n elem1.setAttribute(\"style\", \"visibility: hidden\");\r\n document.getElementsByTagName(\"body\")[0].appendChild(elem1);\r\n var elem2 = document.createElement('object');\r\n elem2.setAttribute(\"id\", \"webClassFactory\");\r\n elem2.setAttribute(\"classid\", \"clsid:B04C8637-10BD-484E-B0DA-B8A039F60024\");\r\n elem2.setAttribute(\"style\", \"visibility: hidden\");\r\n document.getElementsByTagName(\"body\")[0].appendChild(elem2);\r\n }\r\n }\r\n\r\n //Отправляем событие что все ок.\r\n function plugin_loaded()\r\n {\r\n plugin_resolved = 1;\r\n if(canPromise)\r\n {\r\n plugin_resolve();\r\n }else {\r\n window.postMessage(\"cadesplugin_loaded\", \"*\");\r\n }\r\n }\r\n\r\n //Отправляем событие что сломались.\r\n function plugin_loaded_error(msg)\r\n {\r\n if(isNativeMessageSupported())\r\n {\r\n //в асинхронном варианте подключаем оба расширения, если сломались оба пробуем установить для Opera\r\n failed_extensions++;\r\n if(failed_extensions<2)\r\n return;\r\n if(isOpera && (typeof(msg) === 'undefined'|| typeof(msg) === 'object'))\r\n {\r\n install_opera_extension();\r\n return;\r\n }\r\n }\r\n if(typeof(msg) === 'undefined' || typeof(msg) === 'object')\r\n msg = \"Плагин недоступен\";\r\n plugin_resolved = 1;\r\n if(canPromise)\r\n {\r\n plugin_reject(msg);\r\n } else {\r\n window.postMessage(\"cadesplugin_load_error\", \"*\");\r\n }\r\n }\r\n\r\n //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку\r\n function check_load_timeout()\r\n {\r\n if(plugin_resolved === 1)\r\n return;\r\n if(isFireFox)\r\n {\r\n show_firefox_missing_extension_dialog();\r\n }\r\n plugin_resolved = 1;\r\n if(canPromise)\r\n {\r\n plugin_reject(\"Истекло время ожидания загрузки плагина\");\r\n } else {\r\n window.postMessage(\"cadesplugin_load_error\", \"*\");\r\n }\r\n\r\n }\r\n\r\n //Вспомогательная функция для NPAPI\r\n function createPromise(arg)\r\n {\r\n return new Promise(arg);\r\n }\r\n\r\n function check_npapi_plugin (){\r\n try {\r\n var oAbout = CreateObject(\"CAdESCOM.About\");\r\n plugin_loaded();\r\n }\r\n catch (err) {\r\n document.getElementById(\"cadesplugin_object\").style.display = 'none';\r\n // Объект создать не удалось, проверим, установлен ли\r\n // вообще плагин. Такая возможность есть не во всех браузерах\r\n var mimetype = navigator.mimeTypes[\"application/x-cades\"];\r\n if (mimetype) {\r\n var plugin = mimetype.enabledPlugin;\r\n if (plugin) {\r\n plugin_loaded_error(\"Плагин загружен, но не создаются обьекты\");\r\n }else\r\n {\r\n plugin_loaded_error(\"Ошибка при загрузке плагина\");\r\n }\r\n }else\r\n {\r\n plugin_loaded_error(\"Плагин недоступен\");\r\n }\r\n }\r\n }\r\n\r\n //Проверяем работает ли плагин\r\n function check_plugin_working()\r\n {\r\n var div = document.createElement(\"div\");\r\n div.innerHTML = \"\";\r\n var isIeLessThan9 = (div.getElementsByTagName(\"i\").length === 1);\r\n if (isIeLessThan9) {\r\n plugin_loaded_error(\"Internet Explorer версии 8 и ниже не поддерживается\");\r\n return;\r\n }\r\n\r\n if(isNativeMessageSupported())\r\n {\r\n load_extension();\r\n }else if(!canPromise) {\r\n window.addEventListener(\"message\", function (event){\r\n if (event.data !== \"cadesplugin_echo_request\")\r\n return;\r\n load_npapi_plugin();\r\n check_npapi_plugin();\r\n },\r\n false);\r\n }else\r\n {\r\n if(document.readyState === \"complete\"){\r\n load_npapi_plugin();\r\n check_npapi_plugin();\r\n } else {\r\n window.addEventListener(\"load\", function (event) {\r\n load_npapi_plugin();\r\n check_npapi_plugin();\r\n }, false);\r\n }\r\n }\r\n }\r\n\r\n function set_pluginObject(obj)\r\n {\r\n pluginObject = obj;\r\n }\r\n\r\n function is_capilite_enabled()\r\n {\r\n if ((typeof (cadesplugin.EnableInternalCSP) !== 'undefined') && cadesplugin.EnableInternalCSP)\r\n return true;\r\n return false;\r\n };\r\n\r\n //Export\r\n cadesplugin.JSModuleVersion = \"2.1.2\";\r\n cadesplugin.async_spawn = async_spawn;\r\n cadesplugin.set = set_pluginObject;\r\n cadesplugin.set_log_level = set_log_level;\r\n cadesplugin.getLastError = getLastError;\r\n cadesplugin.is_capilite_enabled = is_capilite_enabled;\r\n\r\n if(isNativeMessageSupported())\r\n {\r\n cadesplugin.CreateObjectAsync = CreateObjectAsync;\r\n cadesplugin.ReleasePluginObjects = ReleasePluginObjects;\r\n }\r\n\r\n if(!isNativeMessageSupported())\r\n {\r\n cadesplugin.CreateObject = CreateObject;\r\n }\r\n\r\n if(window.cadesplugin_load_timeout)\r\n {\r\n setTimeout(check_load_timeout, window.cadesplugin_load_timeout);\r\n }\r\n else\r\n {\r\n setTimeout(check_load_timeout, 20000);\r\n }\r\n\r\n set_constantValues();\r\n\r\n cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR;\r\n window.cadesplugin = cadesplugin;\r\n check_plugin_working();\r\n}());\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 4f223c8..5b30763 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "crypto-pro", + "name": "crypto-pro-custom", "version": "2.2.0", "lockfileVersion": 1, "requires": true, diff --git a/package.json b/package.json index 7b887ef..1858651 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "crypto-pro", + "name": "crypto-pro-custom", "version": "2.2.0", - "description": "API для взаимодействия с КриптоПро", + "description": "Кастомизированный API для взаимодействия с КриптоПро", "main": "./lib/crypto-pro.js", "types": "./lib/crypto-pro.d.ts", "files": [ @@ -20,29 +20,35 @@ "build:definition-header:esm": "cross-env TS_CONFIG=tsconfig-esm.json node definition-header.js", "build:esm": "npm run build:uncompressed:esm && npm run build:definition-header:esm", "build": "npm run clean && npm run build:es5 && npm run build:esm", - "pack:clean": "cross-env-shell rimraf $npm_package_name-$npm_package_version.tgz", - "pack:uncompress": "cross-env-shell tar xopf $npm_package_name-$npm_package_version.tgz", + "pack:clean": "cross-env rimraf %npm_package_name%-%npm_package_version%.tgz", + "pack:uncompress": "cross-env tar xopf %npm_package_name%-%npm_package_version%.tgz", "test": "jest --coverage && coveralls < coverage/lcov.info", - "lint": "eslint --config .eslintrc.js './src/**/*'", - "lint:fix": "eslint --fix --config .eslintrc.js './src/**/*'", + "lint": "eslint --config .eslintrc.js --ext .ts --ext .js src", + "lint:fix": "eslint --fix --config .eslintrc.js --ext .ts --ext .js src", "examples-update": "npm run examples-update:script-tag && npm run examples-update:angular && npm run examples-update:react", "examples-update:script-tag": "npm --prefix ./examples/script-tag r crypto-pro && npm --prefix ./examples/script-tag i crypto-pro", "examples-update:angular": "npm --prefix ./examples/angular r crypto-pro && npm --prefix ./examples/angular i crypto-pro", "examples-update:react": "npm --prefix ./examples/react r crypto-pro && npm --prefix ./examples/react i crypto-pro", "prepack": "npm run build", - "postpack": "npm run pack:uncompress && npm run pack:clean", "prepublishOnly": "npm run lint && jest && npm run build", "postpublish": "npm run examples-update" }, "repository": { "type": "git", - "url": "https://github.com/vgoma/crypto-pro" + "url": "https://github.com/kernusr/crypto-pro" }, "author": { - "name": "Vitalii Goma", - "email": "vgoma@yandex.ru", - "url": "https://github.com/vgoma" + "name": "Artem Vasilev", + "email": "kern.usr@gmail.com", + "url": "https://github.com/kernusr" }, + "contributors": [ + { + "name": "Vitalii Goma", + "email": "vgoma@yandex.ru", + "url": "https://github.com/vgoma" + } + ], "keywords": [ "crypto", "cryptopro", @@ -59,7 +65,7 @@ "@typescript-eslint/eslint-plugin": "2.25.0", "@typescript-eslint/parser": "2.25.0", "coveralls": "3.0.11", - "cross-env": "7.0.2", + "cross-env": "^7.0.2", "eslint": "6.8.0", "eslint-config-prettier": "6.10.1", "eslint-plugin-prettier": "3.1.2", diff --git a/src/crypto-pro.ts b/src/crypto-pro-custom.ts old mode 100755 new mode 100644 similarity index 100% rename from src/crypto-pro.ts rename to src/crypto-pro-custom.ts diff --git a/src/helpers/_extractMeaningfulErrorMessage.test.ts b/src/helpers/_extractMeaningfulErrorMessage.test.ts index ce19b30..5187ae1 100644 --- a/src/helpers/_extractMeaningfulErrorMessage.test.ts +++ b/src/helpers/_extractMeaningfulErrorMessage.test.ts @@ -5,15 +5,15 @@ describe('_extractMeaningfulErrorMessage', () => { test("returns meaningful message provided by vendor if it's possible", () => { expect( _extractMeaningfulErrorMessage(new Error('Какое-то более-менее подробное сообщение об ошибке. (0x8010006E)')), - ).toBe('Какое-то более-менее подробное сообщение об ошибке'); + ).toBe('Какое-то более-менее подробное сообщение об ошибке (Код ошибки: 0x8010006E)'); expect( _extractMeaningfulErrorMessage(new Error('Какое-то более-менее подробное сообщение об ошибке. (0x801')), - ).toBe('Какое-то более-менее подробное сообщение об ошибке'); + ).toBe('Какое-то более-менее подробное сообщение об ошибке (Код ошибки: 0x801)'); expect(_extractMeaningfulErrorMessage(new Error('Какое-то более-менее подробное сообщение об ошибке.(0x801'))).toBe( - 'Какое-то более-менее подробное сообщение об ошибке', + 'Какое-то более-менее подробное сообщение об ошибке (Код ошибки: 0x801)', ); expect(_extractMeaningfulErrorMessage(new Error('Какое-то более-менее подробное сообщение об ошибке(0x801'))).toBe( - 'Какое-то более-менее подробное сообщение об ошибке', + 'Какое-то более-менее подробное сообщение об ошибке (Код ошибки: 0x801)', ); expect(_extractMeaningfulErrorMessage(new Error('Какое-то более-менее подробное сообщение об ошибке.'))).toBe( 'Какое-то более-менее подробное сообщение об ошибке', @@ -28,9 +28,11 @@ describe('_extractMeaningfulErrorMessage', () => { 'Какое-то более-менее. Подробное сообщение об ошибке', ); expect(_extractMeaningfulErrorMessage(new Error('Какая-то error случилась, по причине 666 (0x801'))).toBe( - 'Какая-то error случилась, по причине 666', + 'Какая-то error случилась, по причине 666 (Код ошибки: 0x801)', + ); + expect(_extractMeaningfulErrorMessage(new Error('Не удалось. 0x8010006E'))).toBe( + 'Не удалось (Код ошибки: 0x8010006E)', ); - expect(_extractMeaningfulErrorMessage(new Error('Не удалось. 0x8010006E'))).toBe('Не удалось'); }); test("returns null if can't extract meaningful error message", () => { diff --git a/src/helpers/_extractMeaningfulErrorMessage.ts b/src/helpers/_extractMeaningfulErrorMessage.ts index 036e0de..5fb0ee3 100644 --- a/src/helpers/_extractMeaningfulErrorMessage.ts +++ b/src/helpers/_extractMeaningfulErrorMessage.ts @@ -15,7 +15,7 @@ export const _extractMeaningfulErrorMessage = (error: Error): string | null => { return null; } - const searchResult = errorContainer.message.match(/^(.*?)(?:(?:\.?\s?\(?(0x[0-9a-zA-Z]{1,8})\))|(?:\.?$))/); + const searchResult = errorContainer.message.match(/^(.*?)(?:(?:\.?\s?\(?(0x[0-9a-zA-Z]{1,8})\)?)|(?:\.?$))/); - return (searchResult ? searchResult[1] + (searchResult[2] ? '. Код ошибки: ' + searchResult[2] : '') : null); + return searchResult ? searchResult[1] + (searchResult[2] ? ' (Код ошибки: ' + searchResult[2] + ')' : '') : null; }; diff --git a/tsconfig.json b/tsconfig.json index 51170b5..32bb937 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,7 +14,7 @@ ] }, "include": [ - "./src/crypto-pro.ts" + "./src/crypto-pro-custom.ts" ], "exclude": [ "node_modules"