From 242794d3bf7f9f5b9d5fe81b3c6e3dd7699dfc4b Mon Sep 17 00:00:00 2001 From: vgoma Date: Thu, 27 Aug 2020 21:46:38 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B5=D1=82=D0=BE=D0=B4=D1=8B=20=D1=81?= =?UTF-8?q?=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BE=D1=82=D0=B4?= =?UTF-8?q?=D0=B5=D0=BB=D0=B5=D0=BD=D0=BD=D0=BE=D0=B9=20=D0=B8=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=D1=81=D0=BE=D0=B5=D0=B4=D0=B8=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=BD=D0=BE=D0=B9=20=D0=BF=D0=BE=D0=B4=D0=BF=D0=B8=D1=81=D0=B8?= =?UTF-8?q?=20=D1=80=D0=B0=D0=B7=D0=B4=D0=B5=D0=BB=D0=B5=D0=BD=D1=8B=20?= =?UTF-8?q?=D0=B8=20=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D1=8B=20=D1=81=20=D0=BF=D0=BE=D0=B4=D0=B4=D0=B5=D1=80?= =?UTF-8?q?=D0=B6=D0=BA=D0=BE=D0=B9=20=D0=B8=D1=85=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D0=BA=D0=B8=20=D0=BD=D0=B0=20=D1=81=D0=B0?= =?UTF-8?q?=D0=B9=D1=82=D0=B5=20=D0=B3=D0=BE=D1=81=D1=83=D1=81=D0=BB=D1=83?= =?UTF-8?q?=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/api/createAttachedSignature.d.ts | 8 + dist/api/createDetachedSignature.d.ts | 8 + dist/api/createHash.d.ts | 9 + dist/api/createSignature.d.ts | 4 +- dist/api/index.d.ts | 3 + dist/api/signHash.d.ts | 8 + dist/crypto-pro.d.ts | 6 - dist/crypto-pro.js | 2463 ++++++++++++++++++++++++- dist/crypto-pro.js.map | 2 +- dist/crypto-pro.min.js | 11 +- dist/crypto-pro.min.js.map | 2 +- lib/api/createHash.d.ts | 18 + lib/api/createSignature.d.ts | 4 +- lib/api/index.d.ts | 1 + lib/crypto-pro.js | 2192 +++++++++++++++++++++- lib/crypto-pro.js.map | 2 +- src/api/createAttachedSignature.ts | 86 + src/api/createDetachedSignature.ts | 71 + src/api/createSignature.ts | 7 + src/api/index.ts | 2 + 20 files changed, 4885 insertions(+), 22 deletions(-) create mode 100644 dist/api/createAttachedSignature.d.ts create mode 100644 dist/api/createDetachedSignature.d.ts create mode 100644 dist/api/createHash.d.ts create mode 100644 dist/api/signHash.d.ts create mode 100644 lib/api/createHash.d.ts create mode 100644 src/api/createAttachedSignature.ts create mode 100644 src/api/createDetachedSignature.ts diff --git a/dist/api/createAttachedSignature.d.ts b/dist/api/createAttachedSignature.d.ts new file mode 100644 index 0000000..b771957 --- /dev/null +++ b/dist/api/createAttachedSignature.d.ts @@ -0,0 +1,8 @@ +/** + * Создает присоединенную подпись сообщения по отпечатку сертификата + * + * @param thumbprint - отпечаток сертификата + * @param message - подписываемое сообщение + * @returns подпись в формате PKCS#7 + */ +export declare const createAttachedSignature: (thumbprint: string, unencryptedMessage: string | ArrayBuffer) => Promise; diff --git a/dist/api/createDetachedSignature.d.ts b/dist/api/createDetachedSignature.d.ts new file mode 100644 index 0000000..f7c1dbe --- /dev/null +++ b/dist/api/createDetachedSignature.d.ts @@ -0,0 +1,8 @@ +/** + * Создает отсоединенную подпись хеша по отпечатку сертификата + * + * @param thumbprint - отпечаток сертификата + * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11-2012 256 бит + * @returns подпись в формате PKCS#7 + */ +export declare const createDetachedSignature: (thumbprint: string, messageHash: string) => Promise; diff --git a/dist/api/createHash.d.ts b/dist/api/createHash.d.ts new file mode 100644 index 0000000..9cb401b --- /dev/null +++ b/dist/api/createHash.d.ts @@ -0,0 +1,9 @@ +/** + * Создает хэш сообщения по ГОСТ Р 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 хэш + */ +export declare const createHash: (unencryptedMessage: string | ArrayBuffer) => Promise; diff --git a/dist/api/createSignature.d.ts b/dist/api/createSignature.d.ts index 29bc69e..d23e168 100644 --- a/dist/api/createSignature.d.ts +++ b/dist/api/createSignature.d.ts @@ -2,8 +2,8 @@ * Создает подпись base64 строки по отпечатку сертификата * * @param thumbprint - отпечаток сертификата - * @param dataBase64 - строковые данные в формате base64 + * @param messageHash - хэш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11 * @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false) * @returns подпись */ -export declare const createSignature: (thumbprint: string, dataBase64: string, detachedSignature?: boolean) => Promise; +export declare const createSignature: (thumbprint: string, messageHash: string, detachedSignature?: boolean) => Promise; diff --git a/dist/api/index.d.ts b/dist/api/index.d.ts index 2fd4070..9b0a854 100644 --- a/dist/api/index.d.ts +++ b/dist/api/index.d.ts @@ -3,4 +3,7 @@ export * from './getUserCertificates'; export * from './getSystemInfo'; export * from './isValidSystemSetup'; export * from './createSignature'; +export * from './createDetachedSignature'; +export * from './createAttachedSignature'; +export * from './createHash'; export * from './certificate'; diff --git a/dist/api/signHash.d.ts b/dist/api/signHash.d.ts new file mode 100644 index 0000000..f2adb8b --- /dev/null +++ b/dist/api/signHash.d.ts @@ -0,0 +1,8 @@ +/** + * Создает подпись хеша по отпечатку сертификата + * + * @param thumbprint - отпечаток сертификата + * @param messageHash - хэш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11 + * @returns подпись + */ +export declare const signHash: (thumbprint: string, messageHash: string) => Promise; diff --git a/dist/crypto-pro.d.ts b/dist/crypto-pro.d.ts index 99bd9af..b1c13e7 100644 --- a/dist/crypto-pro.d.ts +++ b/dist/crypto-pro.d.ts @@ -1,7 +1 @@ -// Type definitions for crypto-pro 2.0.5 -// 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 index 8c19c2e..f4077f5 100644 --- a/dist/crypto-pro.js +++ b/dist/crypto-pro.js @@ -96,6 +96,2114 @@ return /******/ (function(modules) { // webpackBootstrap /************************************************************************/ /******/ ({ +/***/ "../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 ***! @@ -619,6 +2727,348 @@ exports.isValid = _afterPluginsLoaded_1._afterPluginsLoaded(function () { }); +/***/ }), + +/***/ "./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 _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"); +/** + * Создает отсоединенную подпись хеша по отпечатку сертификата + * + * @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 cadesHashedData; + var cadesSignedData; + var cadesSigner; + try { + 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) || 'Ошибка при инициализации подписи'); + } + try { + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); + 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": @@ -677,17 +3127,21 @@ var _getDateObj_1 = __webpack_require__(/*! ../helpers/_getDateObj */ "./helpers * Создает подпись base64 строки по отпечатку сертификата * * @param thumbprint - отпечаток сертификата - * @param dataBase64 - строковые данные в формате base64 + * @param messageHash - хэш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11 * @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false) * @returns подпись */ -exports.createSignature = _afterPluginsLoaded_1._afterPluginsLoaded(function (thumbprint, dataBase64, detachedSignature) { +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: @@ -720,7 +3174,7 @@ exports.createSignature = _afterPluginsLoaded_1._afterPluginsLoaded(function (th 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(dataBase64)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_Content(messageHash)); void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY)); } catch (error) { @@ -979,6 +3433,9 @@ __export(__webpack_require__(/*! ./getUserCertificates */ "./api/getUserCertific __export(__webpack_require__(/*! ./getSystemInfo */ "./api/getSystemInfo.ts")); __export(__webpack_require__(/*! ./isValidSystemSetup */ "./api/isValidSystemSetup.ts")); __export(__webpack_require__(/*! ./createSignature */ "./api/createSignature.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")); diff --git a/dist/crypto-pro.js.map b/dist/crypto-pro.js.map index a2c2d77..64932cb 100644 --- a/dist/crypto-pro.js.map +++ b/dist/crypto-pro.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://cryptoPro/webpack/universalModuleDefinition","webpack://cryptoPro/webpack/bootstrap","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/createSignature.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;;;;;;;;;;;;;;;AClFA,qFAAsF;AAEtF,oGAA8C;AAC9C,oGAA8C;AAC9C,oGAA8C;AAC9C,8IAAoG;AACpG,yHAA4D;AAC5D,qFAAoC;AACpC,yHAA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;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA,gBAAgB;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","import { ISSUER_TAGS_TRANSLATIONS, SUBJECT_TAGS_TRANSLATIONS } from '../../constants';\nimport { TagTranslation } from '../../helpers/_parseCertInfo';\nimport { exportBase64 } from './exportBase64';\nimport { getAlgorithm } from './getAlgorithm';\nimport { getCadesProp } from './getCadesProp';\nimport { getDecodedExtendedKeyUsage, ExtendedKeysTranslations } from './getDecodedExtendedKeyUsage';\nimport { getExtendedKeyUsage } from './getExtendedKeyUsage';\nimport { getInfo } from './getInfo';\nimport { hasExtendedKeyUsage } from './hasExtendedKeyUsage';\nimport { isValid } from './isValid';\n\nexport type CadesCertificate = any;\n\nexport class Certificate {\n constructor(\n public _cadesCertificate: CadesCertificate,\n public name: string,\n public issuerName: string,\n public subjectName: string,\n public thumbprint: string,\n public validFrom: string,\n public validTo: string,\n ) {}\n\n public getOwnerInfo(): Promise {\n return getInfo.call(this, SUBJECT_TAGS_TRANSLATIONS, 'SubjectName');\n }\n\n public getIssuerInfo(): Promise {\n return getInfo.call(this, ISSUER_TAGS_TRANSLATIONS, 'IssuerName');\n }\n\n public getExtendedKeyUsage(): Promise {\n return getExtendedKeyUsage.call(this);\n }\n\n public getDecodedExtendedKeyUsage(): Promise {\n return getDecodedExtendedKeyUsage.call(this);\n }\n\n public getAlgorithm(): Promise {\n return getAlgorithm.call(this);\n }\n\n public getCadesProp(propName): Promise {\n return getCadesProp.call(this, propName);\n }\n\n public isValid(): Promise {\n return isValid.call(this);\n }\n\n public exportBase64(): Promise {\n return exportBase64.call(this);\n }\n\n public hasExtendedKeyUsage(oids): Promise {\n return hasExtendedKeyUsage.call(this, oids);\n }\n}\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Экспортирует сертификат в формате base64\n *\n * @returns сертификат в формате base64\n */\nexport const exportBase64 = _afterPluginsLoaded(function (): string {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function exportBase64(): string {\n let base64: string;\n\n try {\n base64 = __cadesAsyncToken__ + cadesCertificate.Export(0);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при экспорте сертификата');\n }\n\n return base64;\n }),\n );\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\ninterface AlgorithmInfo {\n algorithm: string;\n oid: string;\n}\n\n/**\n * Возвращает информацию об алгоритме сертификата\n *\n * @returns информацию об алгоритме и его OID'е\n */\nexport const getAlgorithm = _afterPluginsLoaded(function (): AlgorithmInfo {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function getAlgorithm(): AlgorithmInfo {\n const algorithmInfo: AlgorithmInfo = {\n algorithm: null,\n oid: null,\n };\n let cadesPublicKey;\n\n try {\n cadesPublicKey = __cadesAsyncToken__ + cadesCertificate.PublicKey();\n cadesPublicKey = __cadesAsyncToken__ + cadesPublicKey.Algorithm;\n algorithmInfo.algorithm = __cadesAsyncToken__ + cadesPublicKey.FriendlyName;\n algorithmInfo.oid = __cadesAsyncToken__ + cadesPublicKey.Value;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении алгоритма');\n }\n\n return algorithmInfo;\n }),\n );\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Возвращает указанное внутренее свойство у сертификата в формате Cades\n *\n * @param propName = наименование свойства\n * @returns значение запрошенного свойства\n */\nexport const getCadesProp = _afterPluginsLoaded(function (propName: string): any {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function getCadesProp() {\n let propertyValue;\n\n try {\n propertyValue = __cadesAsyncToken__ + cadesCertificate[propName];\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при обращении к свойству сертификата');\n }\n\n return propertyValue;\n }),\n );\n});\n","import { OIDS_DICTIONARY } from '../../constants';\nimport { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { Certificate } from './certificate';\n\nexport interface ExtendedKeysTranslations {\n [key: string]: string | null;\n}\n\n/**\n * Возвращает расшифрованные ОИД'ы сертификата\n *\n * @returns словарь расшифрованных ОИД'ов\n */\nexport const getDecodedExtendedKeyUsage = _afterPluginsLoaded(async function (): Promise {\n const certificateOids = await (this as Certificate).getExtendedKeyUsage();\n\n return certificateOids.reduce(\n (decodedOids, oidCode) => ({\n ...decodedOids,\n [oidCode]: OIDS_DICTIONARY[oidCode] || null,\n }),\n {},\n );\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Возвращает ОИД'ы сертификата\n *\n * @returns список ОИД'ов\n */\nexport const getExtendedKeyUsage = _afterPluginsLoaded(function (): string[] {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function getExtendedKeyUsage(): string[] {\n const OIDS: string[] = [];\n let count: any;\n\n try {\n count = __cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage();\n count = __cadesAsyncToken__ + count.EKUs;\n count = __cadesAsyncToken__ + count.Count;\n\n if (count > 0) {\n while (count > 0) {\n let cadesExtendedKeyUsage;\n\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage();\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.EKUs;\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.Item(count);\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.OID;\n\n OIDS.push(cadesExtendedKeyUsage);\n\n count--;\n }\n }\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || \"Ошибка при получении ОИД'ов\");\n }\n\n return OIDS;\n }),\n );\n});\n","import { TagsTranslations } from '../../constants/tags-translations';\nimport { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { _parseCertInfo, TagTranslation } from '../../helpers/_parseCertInfo';\nimport { getCadesProp } from './getCadesProp';\n\n/**\n * Возвращает расшифрованную информацию о сертификате из указанного свойства по тэгам\n *\n * @param tags = словарь\n * @param entitiesPath = путь к разбираемой сущности\n * @returns расшифрованная информация по отдельным тэгам\n */\nexport const getInfo = _afterPluginsLoaded(async function (\n tags: TagsTranslations[],\n entitiesPath: string,\n): Promise {\n let entities: string;\n\n try {\n entities = await getCadesProp.call(this, entitiesPath);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при извлечении информации из сертификата');\n }\n\n return _parseCertInfo(tags, entities);\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { Certificate } from './certificate';\n\n/**\n * Проверяет наличие ОИД'а (ОИД'ов) у сертификата\n *\n * @param oids - ОИД'ы для проверки\n * @returns флаг наличия ОИД'ов у сертификата\n */\nexport const hasExtendedKeyUsage = _afterPluginsLoaded(async function (oids: string | string[]): Promise {\n const certOids = await (this as Certificate).getExtendedKeyUsage();\n\n let result: boolean;\n\n if (Array.isArray(oids)) {\n result = oids.every((oidToCheck) => certOids.some((certOid) => certOid === oidToCheck));\n } else {\n result = certOids.some((certOid) => certOid === oids);\n }\n\n return result;\n});\n","export * from './certificate';\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Проверяет действительность сертификата\n *\n * @returns флаг валидности\n */\nexport const isValid = _afterPluginsLoaded(function (): boolean {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function isValid() {\n let isValid;\n\n try {\n isValid = __cadesAsyncToken__ + cadesCertificate.IsValid();\n isValid = __cadesAsyncToken__ + isValid.Result;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при проверке сертификата');\n }\n\n return Boolean(isValid);\n }),\n );\n});\n","import { CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME } from '../constants';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\nimport { _getCadesCert } from '../helpers/_getCadesCert';\nimport { _getDateObj } from '../helpers/_getDateObj';\n\n/**\n * Создает подпись base64 строки по отпечатку сертификата\n *\n * @param thumbprint - отпечаток сертификата\n * @param dataBase64 - строковые данные в формате base64\n * @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false)\n * @returns подпись\n */\nexport const createSignature = _afterPluginsLoaded(\n async (thumbprint: string, dataBase64: string, detachedSignature: boolean = true): Promise => {\n const { cadesplugin } = window;\n const cadesCertificate = await _getCadesCert(thumbprint);\n\n return eval(\n _generateCadesFn(function createSignature(): string {\n let cadesAttrs;\n let cadesSignedData;\n let cadesSigner;\n\n try {\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\n cadesSignedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CadesSignedData');\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\n }\n\n const currentTime = _getDateObj(new Date());\n\n try {\n void (__cadesAsyncToken__ + cadesAttrs.propset_Name(CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME));\n void (__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime));\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи');\n }\n\n let cadesAuthAttrs;\n\n try {\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\n cadesAuthAttrs = __cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2;\n void (__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs));\n void (__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));\n void (__cadesAsyncToken__ + cadesSignedData.propset_Content(dataBase64));\n void (\n __cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY)\n );\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи');\n }\n\n let signature: string;\n\n try {\n signature =\n __cadesAsyncToken__ +\n cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_CADES_BES, detachedSignature);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных');\n }\n\n return signature;\n }),\n );\n },\n);\n","import { Certificate } from './certificate';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { getUserCertificates } from './getUserCertificates';\n\n/**\n * Возвращает сертификат по отпечатку\n *\n * @param thumbprint - отпечаток сертификата\n * @returns сертификат\n */\nexport const getCertificate = _afterPluginsLoaded(\n async (thumbprint: string): Promise => {\n if (!thumbprint) {\n throw new Error('Отпечаток не указан');\n }\n\n const availableCertificates: Certificate[] = await getUserCertificates();\n const foundCertificate: Certificate = availableCertificates.find((cert) => cert.thumbprint === thumbprint);\n\n if (!foundCertificate) {\n throw new Error(`Сертификат с отпечатком: \"${thumbprint}\" не найден`);\n }\n\n return foundCertificate;\n },\n);\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\nexport interface SystemInfo {\n cadesVersion: string;\n cspVersion: string;\n}\n\n/**\n * Предоставляет информацию о системе\n *\n * @returns информацию о CSP и плагине\n */\nexport const getSystemInfo = _afterPluginsLoaded(\n (): SystemInfo => {\n const sysInfo = {\n cadesVersion: null,\n cspVersion: null,\n };\n\n return eval(\n _generateCadesFn(function getSystemInfo(): SystemInfo {\n let cadesAbout;\n\n try {\n cadesAbout = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.About');\n\n sysInfo.cadesVersion = __cadesAsyncToken__ + cadesAbout.PluginVersion;\n sysInfo.cspVersion = __cadesAsyncToken__ + cadesAbout.CSPVersion();\n\n if (!sysInfo.cadesVersion) {\n sysInfo.cadesVersion = __cadesAsyncToken__ + cadesAbout.Version;\n }\n\n sysInfo.cadesVersion = __cadesAsyncToken__ + sysInfo.cadesVersion.toString();\n sysInfo.cspVersion = __cadesAsyncToken__ + sysInfo.cspVersion.toString();\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении информации о системе');\n }\n\n return sysInfo;\n }),\n );\n },\n);\n","import { CadesCertificate, Certificate } from './certificate';\nimport { CAPICOM_PROPID_KEY_PROV_INFO } from '../constants';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractCommonName } from '../helpers/_extractCommonName';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\nlet certificatesCache: Certificate[];\n\n/**\n * Возвращает список сертификатов, доступных пользователю в системе\n *\n * @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов\n * @returns список сертификатов\n */\nexport const getUserCertificates = _afterPluginsLoaded((resetCache: boolean = false): Certificate[] => {\n const { cadesplugin } = window;\n\n if (!resetCache && certificatesCache) {\n return certificatesCache;\n }\n\n return eval(\n _generateCadesFn(function getUserCertificates(): Certificate[] {\n let cadesStore;\n\n try {\n cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');\n }\n\n try {\n void (\n __cadesAsyncToken__ +\n cadesStore.Open(\n cadesplugin.CAPICOM_CURRENT_USER_STORE,\n cadesplugin.CAPICOM_MY_STORE,\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,\n )\n );\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');\n }\n\n let cadesCertificates;\n let cadesCertificatesCount;\n\n try {\n cadesCertificates = __cadesAsyncToken__ + cadesStore.Certificates;\n\n if (cadesCertificates) {\n cadesCertificates =\n __cadesAsyncToken__ + cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID);\n\n /**\n * Не рассматриваются сертификаты, в которых отсутствует закрытый ключ\n * или не действительны на данный момент\n */\n cadesCertificates =\n __cadesAsyncToken__ +\n cadesCertificates.Find(\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY,\n CAPICOM_PROPID_KEY_PROV_INFO,\n );\n\n cadesCertificatesCount = __cadesAsyncToken__ + cadesCertificates.Count;\n }\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');\n }\n\n if (!cadesCertificatesCount) {\n throw new Error('Нет доступных сертификатов');\n }\n\n const certificateList: Certificate[] = [];\n\n try {\n while (cadesCertificatesCount) {\n const cadesCertificate: CadesCertificate =\n __cadesAsyncToken__ + cadesCertificates.Item(cadesCertificatesCount);\n\n certificateList.push(\n new Certificate(\n cadesCertificate,\n _extractCommonName(__cadesAsyncToken__ + cadesCertificate.SubjectName),\n __cadesAsyncToken__ + cadesCertificate.IssuerName,\n __cadesAsyncToken__ + cadesCertificate.SubjectName,\n __cadesAsyncToken__ + cadesCertificate.Thumbprint,\n __cadesAsyncToken__ + cadesCertificate.ValidFromDate,\n __cadesAsyncToken__ + cadesCertificate.ValidToDate,\n ),\n );\n\n cadesCertificatesCount--;\n }\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка обработки сертификатов');\n }\n\n cadesStore.Close();\n\n certificatesCache = certificateList;\n\n return certificatesCache;\n }),\n );\n});\n","export * from './getCertificate';\nexport * from './getUserCertificates';\nexport * from './getSystemInfo';\nexport * from './isValidSystemSetup';\nexport * from './createSignature';\nexport * from './certificate';\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { _isSupportedCadesVersion } from '../helpers/_isSupportedCadesVersion';\nimport { _isSupportedCSPVersion } from '../helpers/_isSupportedCSPVersion';\nimport { getSystemInfo, SystemInfo } from './getSystemInfo';\n\n/**\n * Проверяет корректность настроек ЭП на машине\n *\n * @returns флаг корректности настроек\n */\nexport const isValidSystemSetup = _afterPluginsLoaded(\n async (): Promise => {\n let systemInfo: SystemInfo;\n\n try {\n systemInfo = await getSystemInfo();\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Настройки ЭП на данной машине не верны');\n }\n\n if (!_isSupportedCadesVersion(systemInfo.cadesVersion)) {\n throw new Error('Не поддерживаемая версия плагина');\n }\n\n if (!_isSupportedCSPVersion(systemInfo.cspVersion)) {\n throw new Error('Не поддерживаемая версия CSP');\n }\n\n return true;\n },\n);\n","export const CADESCOM_ATTRIBUTE_OTHER = -1;\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\nexport const CADESCOM_AllowNoOutstandingRequest = 1;\nexport const CADESCOM_AllowNone = 0;\nexport const CADESCOM_AllowUntrustedCertificate = 2;\nexport const CADESCOM_AllowUntrustedRoot = 4;\nexport const CADESCOM_BASE64_TO_BINARY = 0x01;\nexport const CADESCOM_CADES_BES = 1;\nexport const CADESCOM_CADES_DEFAULT = 0;\nexport const CADESCOM_CADES_T = 5;\nexport const CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;\nexport const CADESCOM_CONTAINER_STORE = 100;\nexport const CADESCOM_CURRENT_USER_STORE = 2;\nexport const CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;\nexport const CADESCOM_DISPLAY_DATA_CONTENT = 1;\nexport const CADESCOM_DISPLAY_DATA_NONE = 0;\nexport const CADESCOM_ENCODE_ANY = -1;\nexport const CADESCOM_ENCODE_BASE64 = 0;\nexport const CADESCOM_ENCODE_BINARY = 1;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110;\nexport const CADESCOM_HASH_ALGORITHM_MD2 = 1;\nexport const CADESCOM_HASH_ALGORITHM_MD4 = 2;\nexport const CADESCOM_HASH_ALGORITHM_MD5 = 3;\nexport const CADESCOM_HASH_ALGORITHM_SHA1 = 0;\nexport const CADESCOM_HASH_ALGORITHM_SHA_256 = 4;\nexport const CADESCOM_HASH_ALGORITHM_SHA_384 = 5;\nexport const CADESCOM_HASH_ALGORITHM_SHA_512 = 6;\nexport const CADESCOM_LOCAL_MACHINE_STORE = 1;\nexport const CADESCOM_PKCS7_TYPE = 65535;\nexport const CADESCOM_STRING_TO_UCS2LE = 0x00;\nexport const CADESCOM_SkipInstallToStore = 268435456;\nexport const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;\nexport const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;\nexport const CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;\nexport const CAPICOM_ACTIVE_DIRECTORY_USER_STORE = 3;\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\nexport const CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;\nexport const CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;\nexport const CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;\nexport const CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;\nexport const CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;\nexport const CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;\nexport const CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;\nexport const CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;\nexport const CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\nexport const CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;\nexport const CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;\nexport const CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;\nexport const CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;\nexport const CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;\nexport const CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;\nexport const CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;\nexport const CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;\nexport const CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;\nexport const CAPICOM_CURRENT_USER_STORE = 2;\nexport const CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;\nexport const CAPICOM_EKU_CLIENT_AUTH = 2;\nexport const CAPICOM_EKU_OTHER = 0;\nexport const CAPICOM_EKU_SMARTCARD_LOGON = 5;\nexport const CAPICOM_LOCAL_MACHINE_STORE = 1;\nexport const CAPICOM_MEMORY_STORE = 0;\nexport const CAPICOM_MY_STORE = 'My';\nexport const CAPICOM_OID_KEY_USAGE_EXTENSION = 10;\nexport const CAPICOM_OID_OTHER = 0;\nexport const CAPICOM_PROPID_ACCESS_STATE = 14;\nexport const CAPICOM_PROPID_ARCHIVED = 19;\nexport const CAPICOM_PROPID_ARCHIVED_KEY_HASH = 65;\nexport const CAPICOM_PROPID_AUTO_ENROLL = 21;\nexport const CAPICOM_PROPID_CROSS_CERT_DIST_POINTS = 23;\nexport const CAPICOM_PROPID_CTL_USAGE = 9;\nexport const CAPICOM_PROPID_DATE_STAMP = 27;\nexport const CAPICOM_PROPID_DESCRIPTION = 13;\nexport const CAPICOM_PROPID_EFS = 17;\nexport const CAPICOM_PROPID_ENHKEY_USAGE = 9;\nexport const CAPICOM_PROPID_ENROLLMENT = 26;\nexport const CAPICOM_PROPID_EXTENDED_ERROR_INFO = 30;\nexport const CAPICOM_PROPID_FIRST_RESERVED = 66;\nexport const CAPICOM_PROPID_FIRST_USER = 0x00008000;\nexport const CAPICOM_PROPID_FORTEZZA_DATA = 18;\nexport const CAPICOM_PROPID_FRIENDLY_NAME = 11;\nexport const CAPICOM_PROPID_HASH_PROP = 3;\nexport const CAPICOM_PROPID_IE30_RESERVED = 7;\nexport const CAPICOM_PROPID_ISSUER_PUBLIC_KEY_MD5_HASH = 24;\nexport const CAPICOM_PROPID_ISSUER_SERIAL_NUMBER_MD5_HASH = 28;\nexport const CAPICOM_PROPID_KEY_CONTEXT = 5;\nexport const CAPICOM_PROPID_KEY_IDENTIFIER = 20;\nexport const CAPICOM_PROPID_KEY_PROV_HANDLE = 1;\nexport const CAPICOM_PROPID_KEY_PROV_INFO = 2;\nexport const CAPICOM_PROPID_KEY_SPEC = 6;\nexport const CAPICOM_PROPID_LAST_RESERVED = 0x00007fff;\nexport const CAPICOM_PROPID_LAST_USER = 0x0000ffff;\nexport const CAPICOM_PROPID_MD5_HASH = 4;\nexport const CAPICOM_PROPID_NEXT_UPDATE_LOCATION = 10;\nexport const CAPICOM_PROPID_PUBKEY_ALG_PARA = 22;\nexport const CAPICOM_PROPID_PUBKEY_HASH_RESERVED = 8;\nexport const CAPICOM_PROPID_PVK_FILE = 12;\nexport const CAPICOM_PROPID_RENEWAL = 64;\nexport const CAPICOM_PROPID_SHA1_HASH = 3;\nexport const CAPICOM_PROPID_SIGNATURE_HASH = 15;\nexport const CAPICOM_PROPID_SMART_CARD_DATA = 16;\nexport const CAPICOM_PROPID_SUBJECT_NAME_MD5_HASH = 29;\nexport const CAPICOM_PROPID_SUBJECT_PUBLIC_KEY_MD5_HASH = 25;\nexport const CAPICOM_PROPID_UNKNOWN = 0;\nexport const CAPICOM_SMART_CARD_USER_STORE = 4;\nexport const CAPICOM_STORE_OPEN_EXISTING_ONLY = 128;\nexport const CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED = 256;\nexport const CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;\nexport const CAPICOM_STORE_OPEN_READ_ONLY = 0;\nexport const CAPICOM_STORE_OPEN_READ_WRITE = 1;\nexport const CHECK_NONE = 0;\nexport const CHECK_OFFLINE_REVOCATION_STATUS = 16;\nexport const CHECK_ONLINE_REVOCATION_STATUS = 8;\nexport const CHECK_SIGNATURE_VALIDITY = 4;\nexport const CHECK_TIME_VALIDITY = 2;\nexport const CHECK_TRUSTED_ROOT = 1;\nexport const LOG_LEVEL_DEBUG = 4;\nexport const LOG_LEVEL_ERROR = 1;\nexport const LOG_LEVEL_INFO = 2;\nexport const TRUST_CTL_IS_NOT_SIGNATURE_VALID = 262144;\nexport const TRUST_CTL_IS_NOT_TIME_VALID = 131072;\nexport const TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 524288;\nexport const TRUST_IS_CYCLIC = 128;\nexport const TRUST_IS_NOT_SIGNATURE_VALID = 8;\nexport const TRUST_IS_NOT_TIME_NESTED = 2;\nexport const TRUST_IS_NOT_TIME_VALID = 1;\nexport const TRUST_IS_NOT_VALID_FOR_USAGE = 16;\nexport const TRUST_IS_PARTIAL_CHAIN = 65536;\nexport const TRUST_IS_REVOKED = 4;\nexport const TRUST_IS_UNTRUSTED_ROOT = 32;\nexport const TRUST_REVOCATION_STATUS_UNKNOWN = 64;\nexport const XmlDsigGost3410Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411';\nexport const XmlDsigGost3410UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411';\nexport const XmlDsigGost3411Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411';\nexport const XmlDsigGost3411UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr3411';\n","export * from './cades-constants';\nexport * from './issuer-tags-translations';\nexport * from './oids-dictionary';\nexport * from './subject-tags-translations';\n","import { TagsTranslations } from './tags-translations';\n\nexport const ISSUER_TAGS_TRANSLATIONS: TagsTranslations[] = [\n { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' },\n { possibleNames: ['CN'], translation: 'Удостоверяющий центр' },\n { possibleNames: ['C'], translation: 'Страна' },\n { possibleNames: ['S'], translation: 'Регион' },\n { possibleNames: ['STREET'], translation: 'Адрес' },\n { possibleNames: ['O'], translation: 'Компания' },\n { possibleNames: ['OU'], translation: 'Тип' },\n { possibleNames: ['T'], translation: 'Должность' },\n { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },\n { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },\n { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },\n { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },\n { possibleNames: ['E'], translation: 'Email' },\n { possibleNames: ['L'], translation: 'Город' },\n];\n","export const OIDS_DICTIONARY = {\n '1.2.643.2.2.34.6': 'Пользователь Центра Регистрации',\n '1.2.643.2.39.1.1': 'Использование в программных продуктах системы \"1С:Предприятие 8\"',\n '1.2.643.3.131.1.1': 'ИНН',\n '1.2.643.3.141.1.1': 'РНС ФСС',\n '1.2.643.3.141.1.2': 'КП ФСС',\n '1.2.643.3.2.100.65.13.11': 'Использование в системе АИС \"Госзакупки\" Сахалинской области.',\n '1.2.643.3.8.100.1': 'Сертификат типа \"ekey-ГОСТ\"',\n '1.2.643.3.8.100.1.1': 'Общее использование в системах ИОК без права заверения финансовых документов',\n '1.2.643.3.8.100.1.10':\n 'Для участия в электронных торгах и подписания государственного контракта в информационных системах Тендерного комитета города Москвы уполномоченными лицами участников размещения государственного заказа города Москвы',\n '1.2.643.3.8.100.1.11':\n 'Подписание электронных документов в автоматизированной информационной системе размещения государственного и муниципального заказа Саратовской области',\n '1.2.643.3.8.100.1.12': 'Использование в системе государственного заказа Иркутской области',\n '1.2.643.3.8.100.1.13':\n 'Использование в электронной торговой площадке агентства государственного заказа Красноярского края',\n '1.2.643.3.8.100.1.14': 'Использование в электронной торговой площадке \"Тендер\"',\n '1.2.643.3.8.100.1.2': 'Передача отчетности по ТКС',\n '1.2.643.3.8.100.1.3': 'Оформление взаимных обязательств, соглашений, договоров, актов и т.п.',\n '1.2.643.3.8.100.1.4': 'Внутрикорпоративный документооборот',\n '1.2.643.3.8.100.1.5': 'Использование в системах электронной торговли',\n '1.2.643.3.8.100.1.6': 'Использование в торгово-закупочной системе \"ЭЛЕКТРА\"',\n '1.2.643.3.8.100.1.7': 'Использование в системе Портал государственных закупок Ставропольского края.',\n '1.2.643.3.8.100.1.8': 'Использование в Единой системе электронной торговли B2B-Center и B2G.',\n '1.2.643.3.8.100.1.9':\n 'Для участия в электронных торгах и подписания государственного контракта в электронной площадке ОАО «ЕЭТП» уполномоченными лицами участников размещения государственного или муниципального заказа',\n '1.2.643.5.1.24.2.1.3':\n 'Формирование документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя',\n '1.2.643.5.1.24.2.1.3.1':\n 'Формирование кадастровым инженером документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя',\n '1.2.643.5.1.24.2.2.2': 'Формирование документов как результата оказания услуги со стороны органов регистрации прав',\n '1.2.643.5.1.24.2.2.3':\n 'Формирование документов для получения государственных услуг в сфере государственной регистрации прав на недвижимое имущество и сделок с ним со стороны заявителя',\n '1.2.643.6.2.1.7.1':\n 'Использование единоличным исполнительным органом юридического лица или уполномоченными представителями юридического лица в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских и иных прав и обязанностей в сфере негосударственного пенсионного обеспечения, негосударственного пенсионного страхования, в сфере деятельности паевых инвестиционных фондов, акционерных инвестиционных фондов, профессиональных участников рынка ценных бумаг, а также связанной с обслуживанием указанной деятельности услуг кредитных и иных организаций',\n '1.2.643.6.2.1.7.2':\n 'Использование физическим лицом в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских прав и обязанностей в отношении инвестиционных паев паевых инвестиционных фондов, в том числе отношения, связанные с учетом и/или фиксацией прав на инвестиционные паи паевых инвестиционных фондов',\n '1.2.643.6.3':\n 'Использование в электронных торговых системах и в программном обеспечении, связанным с обменом электронных сообщений',\n '1.2.643.6.3.1.1': 'Использование на электронных площадок отобранных для проведения аукционах в электронной форме',\n '1.2.643.6.3.1.2.1': 'Тип участника - Юридическое лицо',\n '1.2.643.6.3.1.2.2': 'Тип участника - Физическое лицо',\n '1.2.643.6.3.1.2.3': 'Тип участника - Индивидуальный предприниматель',\n '1.2.643.6.3.1.3.1': 'Участник размещения заказа',\n '1.2.643.6.3.1.4.1': 'Администратор организации',\n '1.2.643.6.3.1.4.2': 'Уполномоченный специалист',\n '1.2.643.6.3.1.4.3': 'Специалист с правом подписи контракта',\n '1.2.840.113549.1.9.2': 'Неструктурированное имя',\n '1.3.6.1.4.1.24138.1.1.8.1': 'Обеспечение юридической значимости в Системе \"Электронная Торговая Площадка\"',\n '1.3.6.1.4.1.29919.21': 'Использование в системе Портал государственных закупок Ростовской области \"Рефери\".',\n '1.3.6.1.5.5.7.3.2': 'Проверка подлинности клиента',\n '1.3.6.1.5.5.7.3.4': 'Защищенная электронная почта',\n '1.3.643.3.8.100.15': 'Использование в ЭТП \"uTender\"',\n};\n","import { TagsTranslations } from './tags-translations';\n\nexport const SUBJECT_TAGS_TRANSLATIONS: TagsTranslations[] = [\n { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' },\n { possibleNames: ['CN'], translation: 'Владелец' },\n { possibleNames: ['SN'], translation: 'Фамилия' },\n { possibleNames: ['G'], translation: 'Имя Отчество' },\n { possibleNames: ['C'], translation: 'Страна' },\n { possibleNames: ['S'], translation: 'Регион' },\n { possibleNames: ['STREET'], translation: 'Адрес' },\n { possibleNames: ['O'], translation: 'Компания' },\n { possibleNames: ['OU'], translation: 'Отдел/подразделение' },\n { possibleNames: ['T'], translation: 'Должность' },\n { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },\n { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },\n { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },\n { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },\n { possibleNames: ['E'], translation: 'Email' },\n { possibleNames: ['L'], translation: 'Город' },\n];\n","export * from './api';\n","import { _extractMeaningfulErrorMessage } from './_extractMeaningfulErrorMessage';\n\ntype Unpromisify = T extends Promise ? R : T;\n\nlet isSetLogLevel = false;\nlet isPluginLoaded = false;\n\nexport const _afterPluginsLoaded = any>(\n fn: T,\n): ((...args: Parameters) => Promise>>) => {\n const canPromise = Boolean(window.Promise);\n\n return async function (...args: Parameters): Promise>> {\n if (!isPluginLoaded) {\n try {\n require('../vendor/cadesplugin_api');\n } catch (error) {\n console.error(error);\n\n throw new Error(\n _extractMeaningfulErrorMessage(error) || 'Ошибка при подключении модуля для работы с Cades plugin',\n );\n }\n\n isPluginLoaded = true;\n }\n\n const { cadesplugin } = window;\n\n if (!canPromise) {\n throw new Error('Необходим полифилл для Promise');\n }\n\n if (!cadesplugin) {\n throw new Error('Не подключен модуль для работы с Cades plugin');\n }\n\n if (!isSetLogLevel) {\n cadesplugin.set_log_level(cadesplugin.LOG_LEVEL_ERROR);\n\n isSetLogLevel = true;\n }\n\n try {\n await cadesplugin;\n } catch (error) {\n console.error(error);\n\n throw new Error(\n _extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации модуля для работы с Cades plugin',\n );\n }\n\n return await fn.apply(this, args);\n };\n};\n","export const _extractCommonName = (subjectName: string): string | undefined =>\n subjectName.match(/CN=(.+?)(?:,|$)/)?.[1];\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)|(?:\\.?$))/);\n\n return searchResult ? searchResult[1] : null;\n};\n","// синтетические переменные, которые подменяются в рантайме\nexport const __cadesAsyncToken__ = {};\nexport const __createCadesPluginObject__ = (...args): any => ({});\n\nfunction getGeneratorConstructor(): GeneratorFunction {\n return new Function('', 'return Object.getPrototypeOf(function*(){}).constructor')();\n}\n\nexport const _generateCadesFn = (callback: Function): string => {\n const { cadesplugin } = window;\n const cadesGeneratorsAPI = Boolean(cadesplugin.CreateObjectAsync);\n const callbackName = callback.name || 'dynamicFn';\n const callbackLiteral = String(callback);\n const callbackArguments = callbackLiteral.match(/^function[\\s\\w]*?\\((.*?)\\)/)?.[1] || '';\n const callbackBody = callbackLiteral.replace(/^.*?{([\\s\\S]*?)}$/, '$1');\n let crossEnvCallbackLiteral = String(\n new (cadesGeneratorsAPI ? getGeneratorConstructor() : Function)(callbackArguments, callbackBody),\n );\n\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(\n /\\w+?\\.__createCadesPluginObject__(\\([\\s\\S]*?\\))/gm,\n `cadesplugin.CreateObject${cadesGeneratorsAPI ? 'Async' : ''}$1`,\n );\n\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(\n /\\w+?\\.__cadesAsyncToken__\\s*?\\+\\s*?\\b/gm,\n cadesGeneratorsAPI ? 'yield ' : '',\n );\n\n if (!cadesGeneratorsAPI) {\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/propset_(.*?)\\((.*?)\\)/gm, '$1 = $2');\n }\n\n return [\n cadesGeneratorsAPI ? `cadesplugin.async_spawn(${crossEnvCallbackLiteral});` : `(${crossEnvCallbackLiteral})();`,\n `//# sourceURL=crypto-pro_${callbackName}.js`,\n ].join('');\n};\n","import { CadesCertificate } from '../api/certificate';\nimport { _afterPluginsLoaded } from './_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from './_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from './_generateCadesFn';\n\n/**\n * Возвращает сертификат в формате Cades по отпечатку\n *\n * @param thumbprint - отпечаток сертификата\n * @returns сертификат в формате Cades\n */\nexport const _getCadesCert = _afterPluginsLoaded(\n (thumbprint: string): CadesCertificate => {\n const { cadesplugin } = window;\n\n return eval(\n _generateCadesFn(function _getCadesCert() {\n let cadesStore;\n\n try {\n cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');\n }\n\n if (!cadesStore) {\n throw new Error('Не удалось получить доступ к хранилищу сертификатов');\n }\n\n try {\n void (\n __cadesAsyncToken__ +\n cadesStore.Open(\n cadesplugin.CAPICOM_CURRENT_USER_STORE,\n cadesplugin.CAPICOM_MY_STORE,\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,\n )\n );\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');\n }\n\n let cadesCertificateList;\n let certificatesCount;\n\n try {\n cadesCertificateList = __cadesAsyncToken__ + cadesStore.Certificates;\n certificatesCount = __cadesAsyncToken__ + cadesCertificateList.Count;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');\n }\n\n if (!certificatesCount) {\n throw new Error('Нет доступных сертификатов');\n }\n\n let cadesCertificate: CadesCertificate;\n\n try {\n cadesCertificateList =\n __cadesAsyncToken__ + cadesCertificateList.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH, thumbprint);\n\n const count = __cadesAsyncToken__ + cadesCertificateList.Count;\n\n if (!count) {\n throw new Error(`Сертификат с отпечатком: \"${thumbprint}\" не найден`);\n }\n\n cadesCertificate = __cadesAsyncToken__ + cadesCertificateList.Item(1);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении сертификата');\n }\n\n cadesStore.Close();\n\n return cadesCertificate;\n }),\n );\n },\n);\n","/**\n * Возвращает объект даты, совместимый с Cades plugin'ом, зависящий от браузера.\n *\n * В IE необходимо использовать специфичный формат \"VT_DATE\"\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Microsoft_Extensions/Date.getVarDate\n */\nexport const _getDateObj = (dateObj): Date => (dateObj.getVarDate ? dateObj.getVarDate() : dateObj);\n","const oldestSupportedCSPVersion = 4.0;\n\nexport const _isSupportedCSPVersion = (version: string): boolean => {\n version = version.match(/\\d+?\\b(?:\\.\\d+)?/)?.[0];\n\n return Number(version) >= oldestSupportedCSPVersion;\n};\n","export const _isSupportedCadesVersion = (version: string): boolean => {\n const match = version.match(/(\\d+)\\.(\\d+)\\.(\\d+)/);\n\n if (!match) {\n return false;\n }\n\n const [, major, minor, patch] = match;\n\n if (Number(major) < 2) {\n return false;\n }\n\n if (Number(major) === 2 && Number(patch) < 12438) {\n return false;\n }\n\n return true;\n};\n","import { OIDS_DICTIONARY } from '../constants';\nimport { TagsTranslations } from '../constants/tags-translations';\n\nexport interface TagTranslation {\n description: string;\n title: string;\n isTranslated: boolean;\n}\n\n/**\n * Парсит информацию из строки с информацией о сертификате\n *\n * @param tagsTranslations - словарь с расшифровками тэгов\n * @param rawInfo - данные для парсинга\n * @returns расшифрованная информация по отдельным тэгам\n */\nexport const _parseCertInfo = (tagsTranslations: TagsTranslations[], rawInfo: string): TagTranslation[] => {\n const extractedEntities: string[] = rawInfo.match(/([а-яА-Яa-zA-Z0-9\\s.]+)=(?:(\"[^\"]+?\")|(.+?))(?:,|$)/g);\n\n if (extractedEntities) {\n return extractedEntities.map((group) => {\n const segmentsMatch = group.trim().match(/^([а-яА-Яa-zA-Z0-9\\s.]+)=(.+?),?$/);\n let title = segmentsMatch?.[1];\n // Вырезаем лишние кавычки\n const description = segmentsMatch?.[2]?.replace(/^\"(.*)\"/, '$1')?.replace(/\"{2}/g, '\"');\n const oidIdentifierMatch = title?.match(/^OID\\.(.*)/);\n const oidIdentifier = oidIdentifierMatch?.[1];\n let isTranslated = false;\n\n // Если нашли в тайтле ОИД, пытаемся его расшифровать\n if (oidIdentifier) {\n const oidTranslation = OIDS_DICTIONARY[oidIdentifier];\n\n if (oidTranslation) {\n title = oidTranslation;\n isTranslated = true;\n }\n }\n\n const tagTranslation = tagsTranslations.find((tag) => tag.possibleNames.find((name) => name === title))\n ?.translation;\n\n if (tagTranslation) {\n title = tagTranslation;\n isTranslated = true;\n }\n\n return { description, title, isTranslated };\n });\n }\n};\n",";(function () {\n //already loaded\n if(window.cadesplugin)\n return;\n\n var pluginObject;\n var plugin_resolved = 0;\n var plugin_reject;\n var plugin_resolve;\n var isOpera = 0;\n var isFireFox = 0;\n var isEdge = 0;\n var isSafari = 0;\n var failed_extensions = 0;\n\n var canPromise = !!window.Promise;\n var cadesplugin;\n\n if(canPromise)\n {\n cadesplugin = new Promise(function(resolve, reject)\n {\n plugin_resolve = resolve;\n plugin_reject = reject;\n });\n } else\n {\n cadesplugin = {};\n }\n\n function check_browser() {\n var ua= navigator.userAgent, tem, M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\\/))\\/?\\s*(\\d+)/i) || [];\n if(/trident/i.test(M[1])){\n tem= /\\brv[ :]+(\\d+)/g.exec(ua) || [];\n return {name:'IE',version:(tem[1] || '')};\n }\n if(M[1]=== 'Chrome'){\n tem= ua.match(/\\b(OPR|Edge)\\/(\\d+)/);\n if(tem!= null) return {name:tem[1].replace('OPR', 'Opera'),version:tem[2]};\n }\n M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];\n if((tem= ua.match(/version\\/(\\d+)/i))!= null) M.splice(1, 1, tem[1]);\n return {name:M[0],version:M[1]};\n }\n var browserSpecs = check_browser();\n\n function cpcsp_console_log(level, msg){\n //IE9 не может писать в консоль если не открыта вкладка developer tools\n if(typeof(console) === 'undefined')\n return;\n if (level <= cadesplugin.current_log_level ){\n if (level === cadesplugin.LOG_LEVEL_DEBUG)\n console.log(\"DEBUG: %s\", msg);\n if (level === cadesplugin.LOG_LEVEL_INFO)\n console.info(\"INFO: %s\", msg);\n if (level === cadesplugin.LOG_LEVEL_ERROR)\n console.error(\"ERROR: %s\", msg);\n return;\n }\n }\n\n function set_log_level(level){\n if (!((level === cadesplugin.LOG_LEVEL_DEBUG) ||\n (level === cadesplugin.LOG_LEVEL_INFO) ||\n (level === cadesplugin.LOG_LEVEL_ERROR))){\n cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, \"cadesplugin_api.js: Incorrect log_level: \" + level);\n return;\n }\n cadesplugin.current_log_level = level;\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = DEBUG\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = INFO\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = ERROR\");\n if(isNativeMessageSupported())\n {\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG)\n window.postMessage(\"set_log_level=debug\", \"*\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO)\n window.postMessage(\"set_log_level=info\", \"*\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR)\n window.postMessage(\"set_log_level=error\", \"*\");\n }\n }\n\n function set_constantValues()\n {\n cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CAPICOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CADESCOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_CONTAINER_STORE = 100;\n\n cadesplugin.CAPICOM_MY_STORE = \"My\";\n\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;\n\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\n\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;\n\n cadesplugin.XmlDsigGost3410UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411\";\n cadesplugin.XmlDsigGost3411UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr3411\";\n cadesplugin.XmlDsigGost3410Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411\";\n cadesplugin.XmlDsigGost3411Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411\";\n\n cadesplugin.CADESCOM_CADES_DEFAULT = 0;\n cadesplugin.CADESCOM_CADES_BES = 1;\n cadesplugin.CADESCOM_CADES_T = 0x5;\n cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;\n cadesplugin.CADESCOM_PKCS7_TYPE = 0xffff;\n\n cadesplugin.CADESCOM_ENCODE_BASE64 = 0;\n cadesplugin.CADESCOM_ENCODE_BINARY = 1;\n cadesplugin.CADESCOM_ENCODE_ANY = -1;\n\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;\n\n cadesplugin.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;\n cadesplugin.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;\n\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;\n\n cadesplugin.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;\n\n cadesplugin.CAPICOM_PROPID_ENHKEY_USAGE = 9;\n\n cadesplugin.CAPICOM_OID_OTHER = 0;\n cadesplugin.CAPICOM_OID_KEY_USAGE_EXTENSION = 10;\n\n cadesplugin.CAPICOM_EKU_CLIENT_AUTH = 2;\n cadesplugin.CAPICOM_EKU_SMARTCARD_LOGON = 5;\n cadesplugin.CAPICOM_EKU_OTHER = 0;\n\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\n cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1;\n\n cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0;\n cadesplugin.CADESCOM_BASE64_TO_BINARY = 1;\n\n cadesplugin.CADESCOM_DISPLAY_DATA_NONE = 0;\n cadesplugin.CADESCOM_DISPLAY_DATA_CONTENT = 1;\n cadesplugin.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;\n\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;\n\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA1 = 0;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD2 = 1;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD4 = 2;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD5 = 3;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_256 = 4;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_384 = 5;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_512 = 6;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112;\n\n cadesplugin.LOG_LEVEL_DEBUG = 4;\n cadesplugin.LOG_LEVEL_INFO = 2;\n cadesplugin.LOG_LEVEL_ERROR = 1;\n\n cadesplugin.CADESCOM_AllowNone = 0;\n cadesplugin.CADESCOM_AllowNoOutstandingRequest = 0x1;\n cadesplugin.CADESCOM_AllowUntrustedCertificate = 0x2;\n cadesplugin.CADESCOM_AllowUntrustedRoot = 0x4;\n cadesplugin.CADESCOM_SkipInstallToStore = 0x10000000;\n }\n\n function async_spawn(generatorFunc) {\n function continuer(verb, arg) {\n var result;\n try {\n result = generator[verb](arg);\n } catch (err) {\n return Promise.reject(err);\n }\n if (result.done) {\n return result.value;\n } else {\n return Promise.resolve(result.value).then(onFulfilled, onRejected);\n }\n }\n var generator = generatorFunc(Array.prototype.slice.call(arguments, 1));\n var onFulfilled = continuer.bind(continuer, \"next\");\n var onRejected = continuer.bind(continuer, \"throw\");\n return onFulfilled();\n }\n\n function isIE() {\n // var retVal = ((\"Microsoft Internet Explorer\" == navigator.appName) || // IE < 11\n // navigator.userAgent.match(/Trident\\/./i)); // IE 11\n return (browserSpecs.name === 'IE' || browserSpecs.name === 'MSIE');\n }\n\n function isIOS() {\n return (navigator.userAgent.match(/ipod/i) ||\n navigator.userAgent.match(/ipad/i) ||\n navigator.userAgent.match(/iphone/i));\n }\n\n function isNativeMessageSupported()\n {\n // В IE работаем через NPAPI\n if(isIE())\n return false;\n // В Edge работаем через NativeMessage\n if(browserSpecs.name === 'Edge') {\n isEdge = true;\n return true;\n }\n // В Chrome, Firefox, Safari и Opera работаем через асинхронную версию в зависимости от версии\n if(browserSpecs.name === 'Opera') {\n isOpera = true;\n if(browserSpecs.version >= 33){\n return true;\n }\n else{\n return false;\n }\n }\n if(browserSpecs.name === 'Firefox') {\n isFireFox = true;\n if(browserSpecs.version >= 52){\n return true;\n }\n else{\n return false;\n }\n }\n if(browserSpecs.name === 'Chrome') {\n if(browserSpecs.version >= 42){\n return true;\n }\n else{\n return false;\n }\n }\n //В Сафари начиная с 12 версии нет NPAPI\n if(browserSpecs.name === 'Safari') {\n isSafari = true;\n if(browserSpecs.version >= 12) {\n return true;\n } else {\n return false;\n }\n }\n }\n\n // Функция активации объектов КриптоПро ЭЦП Browser plug-in\n function CreateObject(name) {\n if (isIOS()) {\n // На iOS для создания объектов используется функция\n // call_ru_cryptopro_npcades_10_native_bridge, определенная в IOS_npcades_supp.js\n return call_ru_cryptopro_npcades_10_native_bridge(\"CreateObject\", [name]);\n }\n if (isIE()) {\n // В Internet Explorer создаются COM-объекты\n if (name.match(/X509Enrollment/i)) {\n try {\n // Объекты CertEnroll пробуем создавать через нашу фабрику,\n // если не получилось то через CX509EnrollmentWebClassFactory\n var objCertEnrollClassFactory = document.getElementById(\"webClassFactory\");\n return objCertEnrollClassFactory.CreateObject(name);\n }\n catch (e) {\n try {\n var objWebClassFactory = document.getElementById(\"certEnrollClassFactory\");\n return objWebClassFactory.CreateObject(name);\n }\n catch (err) {\n throw (\"Для создания обьектов X509Enrollment следует настроить веб-узел на использование проверки подлинности по протоколу HTTPS\");\n }\n }\n }\n // Объекты CAPICOM и CAdESCOM создаются через CAdESCOM.WebClassFactory\n try {\n var objWebClassFactory = document.getElementById(\"webClassFactory\");\n return objWebClassFactory.CreateObject(name);\n }\n catch (e) {\n // Для версий плагина ниже 2.0.12538\n return new ActiveXObject(name);\n }\n }\n // создаются объекты NPAPI\n return pluginObject.CreateObject(name);\n }\n\n function decimalToHexString(number) {\n if (number < 0) {\n number = 0xFFFFFFFF + number + 1;\n }\n\n return number.toString(16).toUpperCase();\n }\n\n function GetMessageFromException(e) {\n var err = e.message;\n if (!err) {\n err = e;\n } else if (e.number) {\n err += \" (0x\" + decimalToHexString(e.number) + \")\";\n }\n return err;\n }\n\n function getLastError(exception) {\n if(isNativeMessageSupported() || isIE() || isIOS() ) {\n return GetMessageFromException(exception);\n }\n\n try {\n return pluginObject.getLastError();\n } catch(e) {\n return GetMessageFromException(exception);\n }\n }\n\n // Функция для удаления созданных объектов\n function ReleasePluginObjects() {\n return cpcsp_chrome_nmcades.ReleasePluginObjects();\n }\n\n // Функция активации асинхронных объектов КриптоПро ЭЦП Browser plug-in\n function CreateObjectAsync(name) {\n return pluginObject.CreateObjectAsync(name);\n }\n\n //Функции для IOS\n var ru_cryptopro_npcades_10_native_bridge = {\n callbacksCount : 1,\n callbacks : {},\n\n // Automatically called by native layer when a result is available\n resultForCallback : function resultForCallback(callbackId, resultArray) {\n var callback = ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId];\n if (!callback) return;\n callback.apply(null,resultArray);\n },\n\n // Use this in javascript to request native objective-c code\n // functionName : string (I think the name is explicit :p)\n // args : array of arguments\n // callback : function with n-arguments that is going to be called when the native code returned\n call : function call(functionName, args, callback) {\n var hasCallback = callback && typeof callback === \"function\";\n var callbackId = hasCallback ? ru_cryptopro_npcades_10_native_bridge.callbacksCount++ : 0;\n\n if (hasCallback)\n ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId] = callback;\n\n var iframe = document.createElement(\"IFRAME\");\n var arrObjs = new Array(\"_CPNP_handle\");\n try{\n iframe.setAttribute(\"src\", \"cpnp-js-call:\" + functionName + \":\" + callbackId+ \":\" + encodeURIComponent(JSON.stringify(args, arrObjs)));\n } catch(e){\n alert(e);\n }\n document.documentElement.appendChild(iframe);\n iframe.parentNode.removeChild(iframe);\n iframe = null;\n }\n };\n\n function call_ru_cryptopro_npcades_10_native_bridge(functionName, array){\n var tmpobj;\n var ex;\n ru_cryptopro_npcades_10_native_bridge.call(functionName, array, function(e, response){\n ex = e;\n var str='tmpobj='+response;\n eval(str);\n if (typeof (tmpobj) === \"string\"){\n tmpobj = tmpobj.replace(/\\\\\\n/gm, \"\\n\");\n tmpobj = tmpobj.replace(/\\\\\\r/gm, \"\\r\");\n }\n });\n if(ex)\n throw ex;\n return tmpobj;\n }\n\n function show_firefox_missing_extension_dialog()\n {\n if (!window.cadesplugin_skip_extension_install)\n {\n var ovr = document.createElement('div');\n ovr.id = \"cadesplugin_ovr\";\n ovr.style = \"visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)\";\n ovr.innerHTML = \"
\" +\n \"\" +\n \"

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

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

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

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

\" +\n \"
\";\n document.getElementsByTagName(\"Body\")[0].appendChild(ovr);\n var btn_install = document.getElementById(\"cadesplugin_install\");\n btn_install.addEventListener('click', function(event) {\n opr.addons.installExtension(\"epebfcehmdedogndhlcacafjaacknbcm\",\n function()\n {\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n location.reload();\n },\n function(){})\n });\n document.getElementById(\"cadesplugin_close_install\").addEventListener('click',function()\n {\n plugin_loaded_error(\"Плагин недоступен\");\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n });\n\n ovr.addEventListener('click',function()\n {\n plugin_loaded_error(\"Плагин недоступен\");\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n });\n ovr.style.visibility=\"visible\";\n document.getElementById(\"cadesplugin_ovr_item\").addEventListener('click',function(e){\n e.stopPropagation();\n });\n });\n }else\n {\n plugin_loaded_error(\"Плагин недоступен\");\n }\n }\n\n function firefox_or_edge_nmcades_onload() {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n\n function nmcades_api_onload () {\n window.postMessage(\"cadesplugin_echo_request\", \"*\");\n window.addEventListener(\"message\", function (event){\n if (typeof(event.data) !== \"string\" || !event.data.match(\"cadesplugin_loaded\"))\n return;\n if(isFireFox || isEdge || isSafari)\n {\n // Для Firefox, Сафари, Edge вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js\n var url = event.data.substring(event.data.indexOf(\"url:\") + 4);\n var fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", url);\n fileref.onerror = plugin_loaded_error;\n fileref.onload = firefox_or_edge_nmcades_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n // Для Firefox, Safari и Edge у нас только по одному расширению.\n failed_extensions++;\n }else {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n }, false);\n }\n\n //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari\n function load_extension()\n {\n\n if(isFireFox || isEdge || isSafari){\n // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера.\n nmcades_api_onload();\n } else {\n // в асинхронном варианте для chrome и opera подключаем оба расширения\n var fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", \"chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js\");\n fileref.onerror = plugin_loaded_error;\n fileref.onload = nmcades_api_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", \"chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js\");\n fileref.onerror = plugin_loaded_error;\n fileref.onload = nmcades_api_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n }\n }\n\n //Загружаем плагин для NPAPI\n function load_npapi_plugin()\n {\n var elem = document.createElement('object');\n elem.setAttribute(\"id\", \"cadesplugin_object\");\n elem.setAttribute(\"type\", \"application/x-cades\");\n elem.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem);\n pluginObject = document.getElementById(\"cadesplugin_object\");\n if(isIE())\n {\n var elem1 = document.createElement('object');\n elem1.setAttribute(\"id\", \"certEnrollClassFactory\");\n elem1.setAttribute(\"classid\", \"clsid:884e2049-217d-11da-b2a4-000e7bbb2b09\");\n elem1.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem1);\n var elem2 = document.createElement('object');\n elem2.setAttribute(\"id\", \"webClassFactory\");\n elem2.setAttribute(\"classid\", \"clsid:B04C8637-10BD-484E-B0DA-B8A039F60024\");\n elem2.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem2);\n }\n }\n\n //Отправляем событие что все ок.\n function plugin_loaded()\n {\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_resolve();\n }else {\n window.postMessage(\"cadesplugin_loaded\", \"*\");\n }\n }\n\n //Отправляем событие что сломались.\n function plugin_loaded_error(msg)\n {\n if(isNativeMessageSupported())\n {\n //в асинхронном варианте подключаем оба расширения, если сломались оба пробуем установить для Opera\n failed_extensions++;\n if(failed_extensions<2)\n return;\n if(isOpera && (typeof(msg) === 'undefined'|| typeof(msg) === 'object'))\n {\n install_opera_extension();\n return;\n }\n }\n if(typeof(msg) === 'undefined' || typeof(msg) === 'object')\n msg = \"Плагин недоступен\";\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_reject(msg);\n } else {\n window.postMessage(\"cadesplugin_load_error\", \"*\");\n }\n }\n\n //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку\n function check_load_timeout()\n {\n if(plugin_resolved === 1)\n return;\n if(isFireFox)\n {\n show_firefox_missing_extension_dialog();\n }\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_reject(\"Истекло время ожидания загрузки плагина\");\n } else {\n window.postMessage(\"cadesplugin_load_error\", \"*\");\n }\n\n }\n\n //Вспомогательная функция для NPAPI\n function createPromise(arg)\n {\n return new Promise(arg);\n }\n\n function check_npapi_plugin (){\n try {\n var oAbout = CreateObject(\"CAdESCOM.About\");\n plugin_loaded();\n }\n catch (err) {\n document.getElementById(\"cadesplugin_object\").style.display = 'none';\n // Объект создать не удалось, проверим, установлен ли\n // вообще плагин. Такая возможность есть не во всех браузерах\n var mimetype = navigator.mimeTypes[\"application/x-cades\"];\n if (mimetype) {\n var plugin = mimetype.enabledPlugin;\n if (plugin) {\n plugin_loaded_error(\"Плагин загружен, но не создаются обьекты\");\n }else\n {\n plugin_loaded_error(\"Ошибка при загрузке плагина\");\n }\n }else\n {\n plugin_loaded_error(\"Плагин недоступен\");\n }\n }\n }\n\n //Проверяем работает ли плагин\n function check_plugin_working()\n {\n var div = document.createElement(\"div\");\n div.innerHTML = \"\";\n var isIeLessThan9 = (div.getElementsByTagName(\"i\").length === 1);\n if (isIeLessThan9) {\n plugin_loaded_error(\"Internet Explorer версии 8 и ниже не поддерживается\");\n return;\n }\n\n if(isNativeMessageSupported())\n {\n load_extension();\n }else if(!canPromise) {\n window.addEventListener(\"message\", function (event){\n if (event.data !== \"cadesplugin_echo_request\")\n return;\n load_npapi_plugin();\n check_npapi_plugin();\n },\n false);\n }else\n {\n if(document.readyState === \"complete\"){\n load_npapi_plugin();\n check_npapi_plugin();\n } else {\n window.addEventListener(\"load\", function (event) {\n load_npapi_plugin();\n check_npapi_plugin();\n }, false);\n }\n }\n }\n\n function set_pluginObject(obj)\n {\n pluginObject = obj;\n }\n\n function is_capilite_enabled()\n {\n if ((typeof (cadesplugin.EnableInternalCSP) !== 'undefined') && cadesplugin.EnableInternalCSP)\n return true;\n return false;\n };\n\n //Export\n cadesplugin.JSModuleVersion = \"2.1.2\";\n cadesplugin.async_spawn = async_spawn;\n cadesplugin.set = set_pluginObject;\n cadesplugin.set_log_level = set_log_level;\n cadesplugin.getLastError = getLastError;\n cadesplugin.is_capilite_enabled = is_capilite_enabled;\n\n if(isNativeMessageSupported())\n {\n cadesplugin.CreateObjectAsync = CreateObjectAsync;\n cadesplugin.ReleasePluginObjects = ReleasePluginObjects;\n }\n\n if(!isNativeMessageSupported())\n {\n cadesplugin.CreateObject = CreateObject;\n }\n\n if(window.cadesplugin_load_timeout)\n {\n setTimeout(check_load_timeout, window.cadesplugin_load_timeout);\n }\n else\n {\n setTimeout(check_load_timeout, 20000);\n }\n\n set_constantValues();\n\n cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR;\n window.cadesplugin = cadesplugin;\n check_plugin_working();\n}());\n"],"sourceRoot":""} \ No newline at end of file +{"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/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;;A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A;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';\nimport { TagTranslation } from '../../helpers/_parseCertInfo';\nimport { exportBase64 } from './exportBase64';\nimport { getAlgorithm } from './getAlgorithm';\nimport { getCadesProp } from './getCadesProp';\nimport { getDecodedExtendedKeyUsage, ExtendedKeysTranslations } from './getDecodedExtendedKeyUsage';\nimport { getExtendedKeyUsage } from './getExtendedKeyUsage';\nimport { getInfo } from './getInfo';\nimport { hasExtendedKeyUsage } from './hasExtendedKeyUsage';\nimport { isValid } from './isValid';\n\nexport type CadesCertificate = any;\n\nexport class Certificate {\n constructor(\n public _cadesCertificate: CadesCertificate,\n public name: string,\n public issuerName: string,\n public subjectName: string,\n public thumbprint: string,\n public validFrom: string,\n public validTo: string,\n ) {}\n\n public getOwnerInfo(): Promise {\n return getInfo.call(this, SUBJECT_TAGS_TRANSLATIONS, 'SubjectName');\n }\n\n public getIssuerInfo(): Promise {\n return getInfo.call(this, ISSUER_TAGS_TRANSLATIONS, 'IssuerName');\n }\n\n public getExtendedKeyUsage(): Promise {\n return getExtendedKeyUsage.call(this);\n }\n\n public getDecodedExtendedKeyUsage(): Promise {\n return getDecodedExtendedKeyUsage.call(this);\n }\n\n public getAlgorithm(): Promise {\n return getAlgorithm.call(this);\n }\n\n public getCadesProp(propName): Promise {\n return getCadesProp.call(this, propName);\n }\n\n public isValid(): Promise {\n return isValid.call(this);\n }\n\n public exportBase64(): Promise {\n return exportBase64.call(this);\n }\n\n public hasExtendedKeyUsage(oids): Promise {\n return hasExtendedKeyUsage.call(this, oids);\n }\n}\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Экспортирует сертификат в формате base64\n *\n * @returns сертификат в формате base64\n */\nexport const exportBase64 = _afterPluginsLoaded(function (): string {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function exportBase64(): string {\n let base64: string;\n\n try {\n base64 = __cadesAsyncToken__ + cadesCertificate.Export(0);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при экспорте сертификата');\n }\n\n return base64;\n }),\n );\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\ninterface AlgorithmInfo {\n algorithm: string;\n oid: string;\n}\n\n/**\n * Возвращает информацию об алгоритме сертификата\n *\n * @returns информацию об алгоритме и его OID'е\n */\nexport const getAlgorithm = _afterPluginsLoaded(function (): AlgorithmInfo {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function getAlgorithm(): AlgorithmInfo {\n const algorithmInfo: AlgorithmInfo = {\n algorithm: null,\n oid: null,\n };\n let cadesPublicKey;\n\n try {\n cadesPublicKey = __cadesAsyncToken__ + cadesCertificate.PublicKey();\n cadesPublicKey = __cadesAsyncToken__ + cadesPublicKey.Algorithm;\n algorithmInfo.algorithm = __cadesAsyncToken__ + cadesPublicKey.FriendlyName;\n algorithmInfo.oid = __cadesAsyncToken__ + cadesPublicKey.Value;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении алгоритма');\n }\n\n return algorithmInfo;\n }),\n );\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Возвращает указанное внутренее свойство у сертификата в формате Cades\n *\n * @param propName = наименование свойства\n * @returns значение запрошенного свойства\n */\nexport const getCadesProp = _afterPluginsLoaded(function (propName: string): any {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function getCadesProp() {\n let propertyValue;\n\n try {\n propertyValue = __cadesAsyncToken__ + cadesCertificate[propName];\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при обращении к свойству сертификата');\n }\n\n return propertyValue;\n }),\n );\n});\n","import { OIDS_DICTIONARY } from '../../constants';\nimport { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { Certificate } from './certificate';\n\nexport interface ExtendedKeysTranslations {\n [key: string]: string | null;\n}\n\n/**\n * Возвращает расшифрованные ОИД'ы сертификата\n *\n * @returns словарь расшифрованных ОИД'ов\n */\nexport const getDecodedExtendedKeyUsage = _afterPluginsLoaded(async function (): Promise {\n const certificateOids = await (this as Certificate).getExtendedKeyUsage();\n\n return certificateOids.reduce(\n (decodedOids, oidCode) => ({\n ...decodedOids,\n [oidCode]: OIDS_DICTIONARY[oidCode] || null,\n }),\n {},\n );\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Возвращает ОИД'ы сертификата\n *\n * @returns список ОИД'ов\n */\nexport const getExtendedKeyUsage = _afterPluginsLoaded(function (): string[] {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function getExtendedKeyUsage(): string[] {\n const OIDS: string[] = [];\n let count: any;\n\n try {\n count = __cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage();\n count = __cadesAsyncToken__ + count.EKUs;\n count = __cadesAsyncToken__ + count.Count;\n\n if (count > 0) {\n while (count > 0) {\n let cadesExtendedKeyUsage;\n\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage();\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.EKUs;\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.Item(count);\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.OID;\n\n OIDS.push(cadesExtendedKeyUsage);\n\n count--;\n }\n }\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || \"Ошибка при получении ОИД'ов\");\n }\n\n return OIDS;\n }),\n );\n});\n","import { TagsTranslations } from '../../constants/tags-translations';\nimport { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { _parseCertInfo, TagTranslation } from '../../helpers/_parseCertInfo';\nimport { getCadesProp } from './getCadesProp';\n\n/**\n * Возвращает расшифрованную информацию о сертификате из указанного свойства по тэгам\n *\n * @param tags = словарь\n * @param entitiesPath = путь к разбираемой сущности\n * @returns расшифрованная информация по отдельным тэгам\n */\nexport const getInfo = _afterPluginsLoaded(async function (\n tags: TagsTranslations[],\n entitiesPath: string,\n): Promise {\n let entities: string;\n\n try {\n entities = await getCadesProp.call(this, entitiesPath);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при извлечении информации из сертификата');\n }\n\n return _parseCertInfo(tags, entities);\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { Certificate } from './certificate';\n\n/**\n * Проверяет наличие ОИД'а (ОИД'ов) у сертификата\n *\n * @param oids - ОИД'ы для проверки\n * @returns флаг наличия ОИД'ов у сертификата\n */\nexport const hasExtendedKeyUsage = _afterPluginsLoaded(async function (oids: string | string[]): Promise {\n const certOids = await (this as Certificate).getExtendedKeyUsage();\n\n let result: boolean;\n\n if (Array.isArray(oids)) {\n result = oids.every((oidToCheck) => certOids.some((certOid) => certOid === oidToCheck));\n } else {\n result = certOids.some((certOid) => certOid === oids);\n }\n\n return result;\n});\n","export * from './certificate';\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Проверяет действительность сертификата\n *\n * @returns флаг валидности\n */\nexport const isValid = _afterPluginsLoaded(function (): boolean {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function isValid() {\n let isValid;\n\n try {\n isValid = __cadesAsyncToken__ + cadesCertificate.IsValid();\n isValid = __cadesAsyncToken__ + isValid.Result;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при проверке сертификата');\n }\n\n return Boolean(isValid);\n }),\n );\n});\n","import { CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME } from '../constants';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\nimport { _getCadesCert } from '../helpers/_getCadesCert';\nimport { _getDateObj } from '../helpers/_getDateObj';\n\n/**\n * Создает присоединенную подпись сообщения по отпечатку сертификата\n *\n * @param thumbprint - отпечаток сертификата\n * @param message - подписываемое сообщение\n * @returns подпись в формате PKCS#7\n */\nexport const createAttachedSignature = _afterPluginsLoaded(\n async (thumbprint: string, unencryptedMessage: string | ArrayBuffer): Promise => {\n const { cadesplugin } = window;\n const cadesCertificate = await _getCadesCert(thumbprint);\n\n return eval(\n _generateCadesFn(function createAttachedSignature(): string {\n let cadesAttrs;\n let cadesSignedData;\n let cadesSigner;\n\n try {\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\n cadesSignedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CadesSignedData');\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\n }\n\n const currentTime = _getDateObj(new Date());\n\n try {\n void (__cadesAsyncToken__ + cadesAttrs.propset_Name(CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME));\n void (__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime));\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи');\n }\n\n let messageBase64;\n\n try {\n messageBase64 = Buffer.from(unencryptedMessage).toString('base64');\n } catch (error) {\n console.error(error);\n\n throw new Error('Ошибка при преобразовании сообщения в Base64');\n }\n\n let cadesAuthAttrs;\n\n try {\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\n cadesAuthAttrs = __cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2;\n void (__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs));\n void (__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));\n void (__cadesAsyncToken__ + cadesSignedData.propset_Content(messageBase64));\n void (__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN));\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи');\n }\n\n let signature: string;\n\n try {\n signature = __cadesAsyncToken__ + cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_PKCS7_TYPE);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных');\n }\n\n return signature;\n }),\n );\n },\n);\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\nimport { _getCadesCert } from '../helpers/_getCadesCert';\n\n/**\n * Создает отсоединенную подпись хеша по отпечатку сертификата\n *\n * @param thumbprint - отпечаток сертификата\n * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11-2012 256 бит\n * @returns подпись в формате PKCS#7\n */\nexport const createDetachedSignature = _afterPluginsLoaded(\n async (thumbprint: string, messageHash: string): Promise => {\n const { cadesplugin } = window;\n const cadesCertificate = await _getCadesCert(thumbprint);\n\n return eval(\n _generateCadesFn(function createDetachedSignature(): string {\n let cadesHashedData;\n let cadesSignedData;\n let cadesSigner;\n\n try {\n cadesHashedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.HashedData');\n cadesSignedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CadesSignedData');\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\n }\n\n try {\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\n void (__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN));\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке сертификата');\n }\n\n try {\n void (\n __cadesAsyncToken__ +\n cadesHashedData.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256)\n );\n void (__cadesAsyncToken__ + cadesHashedData.SetHashValue(messageHash));\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке хеша');\n }\n\n let signature: string;\n\n try {\n signature =\n __cadesAsyncToken__ +\n cadesSignedData.SignHash(cadesHashedData, cadesSigner, cadesplugin.CADESCOM_PKCS7_TYPE);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных');\n }\n\n return signature;\n }),\n );\n },\n);\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\n/**\n * Создает хэш сообщения по ГОСТ Р 34.11-2012 256 бит\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)\n *\n * @param unencryptedMessage - сообщение для хеширования\n *\n * @returns хэш\n */\nexport const createHash = _afterPluginsLoaded(\n async (unencryptedMessage: string | ArrayBuffer): Promise => {\n const { cadesplugin } = window;\n\n return eval(\n _generateCadesFn(function createHash(): string {\n const cadesHashedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.HashedData');\n let messageBase64;\n let hash;\n\n try {\n messageBase64 = Buffer.from(unencryptedMessage).toString('base64');\n } catch (error) {\n console.error(error);\n\n throw new Error('Ошибка при преобразовании сообщения в Base64');\n }\n\n try {\n void (\n __cadesAsyncToken__ +\n cadesHashedData.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256)\n );\n void (__cadesAsyncToken__ + cadesHashedData.propset_DataEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));\n void (__cadesAsyncToken__ + cadesHashedData.Hash(messageBase64));\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации хэширования');\n }\n\n try {\n hash = __cadesAsyncToken__ + cadesHashedData.Value;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при создании хэша');\n }\n\n return hash;\n }),\n );\n },\n);\n","import { CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME } from '../constants';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\nimport { _getCadesCert } from '../helpers/_getCadesCert';\nimport { _getDateObj } from '../helpers/_getDateObj';\n\n/**\n * Создает подпись base64 строки по отпечатку сертификата\n *\n * @param thumbprint - отпечаток сертификата\n * @param messageHash - хэш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11\n * @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false)\n * @returns подпись\n */\nexport const createSignature = _afterPluginsLoaded(\n async (thumbprint: string, messageHash: string, detachedSignature: boolean = true): Promise => {\n console.warn(\n [\n 'cryptoPro: Метод \"createSignature\" является устаревшим и будет убран из будущих версий.',\n 'Используйте \"createAttachedSignature\" и \"createDetachedSignature\".',\n ].join('\\n'),\n );\n\n const { cadesplugin } = window;\n const cadesCertificate = await _getCadesCert(thumbprint);\n\n return eval(\n _generateCadesFn(function createSignature(): string {\n let cadesAttrs;\n let cadesSignedData;\n let cadesSigner;\n\n try {\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\n cadesSignedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CadesSignedData');\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\n }\n\n const currentTime = _getDateObj(new Date());\n\n try {\n void (__cadesAsyncToken__ + cadesAttrs.propset_Name(CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME));\n void (__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime));\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи');\n }\n\n let cadesAuthAttrs;\n\n try {\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\n cadesAuthAttrs = __cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2;\n void (__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs));\n void (__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));\n void (__cadesAsyncToken__ + cadesSignedData.propset_Content(messageHash));\n void (\n __cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY)\n );\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи');\n }\n\n let signature: string;\n\n try {\n signature =\n __cadesAsyncToken__ +\n cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_CADES_BES, detachedSignature);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных');\n }\n\n return signature;\n }),\n );\n },\n);\n","import { Certificate } from './certificate';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { getUserCertificates } from './getUserCertificates';\n\n/**\n * Возвращает сертификат по отпечатку\n *\n * @param thumbprint - отпечаток сертификата\n * @returns сертификат\n */\nexport const getCertificate = _afterPluginsLoaded(\n async (thumbprint: string): Promise => {\n if (!thumbprint) {\n throw new Error('Отпечаток не указан');\n }\n\n const availableCertificates: Certificate[] = await getUserCertificates();\n const foundCertificate: Certificate = availableCertificates.find((cert) => cert.thumbprint === thumbprint);\n\n if (!foundCertificate) {\n throw new Error(`Сертификат с отпечатком: \"${thumbprint}\" не найден`);\n }\n\n return foundCertificate;\n },\n);\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\nexport interface SystemInfo {\n cadesVersion: string;\n cspVersion: string;\n}\n\n/**\n * Предоставляет информацию о системе\n *\n * @returns информацию о CSP и плагине\n */\nexport const getSystemInfo = _afterPluginsLoaded(\n (): SystemInfo => {\n const sysInfo = {\n cadesVersion: null,\n cspVersion: null,\n };\n\n return eval(\n _generateCadesFn(function getSystemInfo(): SystemInfo {\n let cadesAbout;\n\n try {\n cadesAbout = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.About');\n\n sysInfo.cadesVersion = __cadesAsyncToken__ + cadesAbout.PluginVersion;\n sysInfo.cspVersion = __cadesAsyncToken__ + cadesAbout.CSPVersion();\n\n if (!sysInfo.cadesVersion) {\n sysInfo.cadesVersion = __cadesAsyncToken__ + cadesAbout.Version;\n }\n\n sysInfo.cadesVersion = __cadesAsyncToken__ + sysInfo.cadesVersion.toString();\n sysInfo.cspVersion = __cadesAsyncToken__ + sysInfo.cspVersion.toString();\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении информации о системе');\n }\n\n return sysInfo;\n }),\n );\n },\n);\n","import { CadesCertificate, Certificate } from './certificate';\nimport { CAPICOM_PROPID_KEY_PROV_INFO } from '../constants';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractCommonName } from '../helpers/_extractCommonName';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\nlet certificatesCache: Certificate[];\n\n/**\n * Возвращает список сертификатов, доступных пользователю в системе\n *\n * @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов\n * @returns список сертификатов\n */\nexport const getUserCertificates = _afterPluginsLoaded((resetCache: boolean = false): Certificate[] => {\n const { cadesplugin } = window;\n\n if (!resetCache && certificatesCache) {\n return certificatesCache;\n }\n\n return eval(\n _generateCadesFn(function getUserCertificates(): Certificate[] {\n let cadesStore;\n\n try {\n cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');\n }\n\n try {\n void (\n __cadesAsyncToken__ +\n cadesStore.Open(\n cadesplugin.CAPICOM_CURRENT_USER_STORE,\n cadesplugin.CAPICOM_MY_STORE,\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,\n )\n );\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');\n }\n\n let cadesCertificates;\n let cadesCertificatesCount;\n\n try {\n cadesCertificates = __cadesAsyncToken__ + cadesStore.Certificates;\n\n if (cadesCertificates) {\n cadesCertificates =\n __cadesAsyncToken__ + cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID);\n\n /**\n * Не рассматриваются сертификаты, в которых отсутствует закрытый ключ\n * или не действительны на данный момент\n */\n cadesCertificates =\n __cadesAsyncToken__ +\n cadesCertificates.Find(\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY,\n CAPICOM_PROPID_KEY_PROV_INFO,\n );\n\n cadesCertificatesCount = __cadesAsyncToken__ + cadesCertificates.Count;\n }\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');\n }\n\n if (!cadesCertificatesCount) {\n throw new Error('Нет доступных сертификатов');\n }\n\n const certificateList: Certificate[] = [];\n\n try {\n while (cadesCertificatesCount) {\n const cadesCertificate: CadesCertificate =\n __cadesAsyncToken__ + cadesCertificates.Item(cadesCertificatesCount);\n\n certificateList.push(\n new Certificate(\n cadesCertificate,\n _extractCommonName(__cadesAsyncToken__ + cadesCertificate.SubjectName),\n __cadesAsyncToken__ + cadesCertificate.IssuerName,\n __cadesAsyncToken__ + cadesCertificate.SubjectName,\n __cadesAsyncToken__ + cadesCertificate.Thumbprint,\n __cadesAsyncToken__ + cadesCertificate.ValidFromDate,\n __cadesAsyncToken__ + cadesCertificate.ValidToDate,\n ),\n );\n\n cadesCertificatesCount--;\n }\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка обработки сертификатов');\n }\n\n cadesStore.Close();\n\n certificatesCache = certificateList;\n\n return certificatesCache;\n }),\n );\n});\n","export * from './getCertificate';\nexport * from './getUserCertificates';\nexport * from './getSystemInfo';\nexport * from './isValidSystemSetup';\nexport * from './createSignature';\nexport * from './createDetachedSignature';\nexport * from './createAttachedSignature';\nexport * from './createHash';\nexport * from './certificate';\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { _isSupportedCadesVersion } from '../helpers/_isSupportedCadesVersion';\nimport { _isSupportedCSPVersion } from '../helpers/_isSupportedCSPVersion';\nimport { getSystemInfo, SystemInfo } from './getSystemInfo';\n\n/**\n * Проверяет корректность настроек ЭП на машине\n *\n * @returns флаг корректности настроек\n */\nexport const isValidSystemSetup = _afterPluginsLoaded(\n async (): Promise => {\n let systemInfo: SystemInfo;\n\n try {\n systemInfo = await getSystemInfo();\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Настройки ЭП на данной машине не верны');\n }\n\n if (!_isSupportedCadesVersion(systemInfo.cadesVersion)) {\n throw new Error('Не поддерживаемая версия плагина');\n }\n\n if (!_isSupportedCSPVersion(systemInfo.cspVersion)) {\n throw new Error('Не поддерживаемая версия CSP');\n }\n\n return true;\n },\n);\n","export const CADESCOM_ATTRIBUTE_OTHER = -1;\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\nexport const CADESCOM_AllowNoOutstandingRequest = 1;\nexport const CADESCOM_AllowNone = 0;\nexport const CADESCOM_AllowUntrustedCertificate = 2;\nexport const CADESCOM_AllowUntrustedRoot = 4;\nexport const CADESCOM_BASE64_TO_BINARY = 0x01;\nexport const CADESCOM_CADES_BES = 1;\nexport const CADESCOM_CADES_DEFAULT = 0;\nexport const CADESCOM_CADES_T = 5;\nexport const CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;\nexport const CADESCOM_CONTAINER_STORE = 100;\nexport const CADESCOM_CURRENT_USER_STORE = 2;\nexport const CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;\nexport const CADESCOM_DISPLAY_DATA_CONTENT = 1;\nexport const CADESCOM_DISPLAY_DATA_NONE = 0;\nexport const CADESCOM_ENCODE_ANY = -1;\nexport const CADESCOM_ENCODE_BASE64 = 0;\nexport const CADESCOM_ENCODE_BINARY = 1;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110;\nexport const CADESCOM_HASH_ALGORITHM_MD2 = 1;\nexport const CADESCOM_HASH_ALGORITHM_MD4 = 2;\nexport const CADESCOM_HASH_ALGORITHM_MD5 = 3;\nexport const CADESCOM_HASH_ALGORITHM_SHA1 = 0;\nexport const CADESCOM_HASH_ALGORITHM_SHA_256 = 4;\nexport const CADESCOM_HASH_ALGORITHM_SHA_384 = 5;\nexport const CADESCOM_HASH_ALGORITHM_SHA_512 = 6;\nexport const CADESCOM_LOCAL_MACHINE_STORE = 1;\nexport const CADESCOM_PKCS7_TYPE = 65535;\nexport const CADESCOM_STRING_TO_UCS2LE = 0x00;\nexport const CADESCOM_SkipInstallToStore = 268435456;\nexport const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;\nexport const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;\nexport const CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;\nexport const CAPICOM_ACTIVE_DIRECTORY_USER_STORE = 3;\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\nexport const CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;\nexport const CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;\nexport const CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;\nexport const CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;\nexport const CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;\nexport const CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;\nexport const CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;\nexport const CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;\nexport const CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\nexport const CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;\nexport const CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;\nexport const CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;\nexport const CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;\nexport const CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;\nexport const CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;\nexport const CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;\nexport const CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;\nexport const CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;\nexport const CAPICOM_CURRENT_USER_STORE = 2;\nexport const CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;\nexport const CAPICOM_EKU_CLIENT_AUTH = 2;\nexport const CAPICOM_EKU_OTHER = 0;\nexport const CAPICOM_EKU_SMARTCARD_LOGON = 5;\nexport const CAPICOM_LOCAL_MACHINE_STORE = 1;\nexport const CAPICOM_MEMORY_STORE = 0;\nexport const CAPICOM_MY_STORE = 'My';\nexport const CAPICOM_OID_KEY_USAGE_EXTENSION = 10;\nexport const CAPICOM_OID_OTHER = 0;\nexport const CAPICOM_PROPID_ACCESS_STATE = 14;\nexport const CAPICOM_PROPID_ARCHIVED = 19;\nexport const CAPICOM_PROPID_ARCHIVED_KEY_HASH = 65;\nexport const CAPICOM_PROPID_AUTO_ENROLL = 21;\nexport const CAPICOM_PROPID_CROSS_CERT_DIST_POINTS = 23;\nexport const CAPICOM_PROPID_CTL_USAGE = 9;\nexport const CAPICOM_PROPID_DATE_STAMP = 27;\nexport const CAPICOM_PROPID_DESCRIPTION = 13;\nexport const CAPICOM_PROPID_EFS = 17;\nexport const CAPICOM_PROPID_ENHKEY_USAGE = 9;\nexport const CAPICOM_PROPID_ENROLLMENT = 26;\nexport const CAPICOM_PROPID_EXTENDED_ERROR_INFO = 30;\nexport const CAPICOM_PROPID_FIRST_RESERVED = 66;\nexport const CAPICOM_PROPID_FIRST_USER = 0x00008000;\nexport const CAPICOM_PROPID_FORTEZZA_DATA = 18;\nexport const CAPICOM_PROPID_FRIENDLY_NAME = 11;\nexport const CAPICOM_PROPID_HASH_PROP = 3;\nexport const CAPICOM_PROPID_IE30_RESERVED = 7;\nexport const CAPICOM_PROPID_ISSUER_PUBLIC_KEY_MD5_HASH = 24;\nexport const CAPICOM_PROPID_ISSUER_SERIAL_NUMBER_MD5_HASH = 28;\nexport const CAPICOM_PROPID_KEY_CONTEXT = 5;\nexport const CAPICOM_PROPID_KEY_IDENTIFIER = 20;\nexport const CAPICOM_PROPID_KEY_PROV_HANDLE = 1;\nexport const CAPICOM_PROPID_KEY_PROV_INFO = 2;\nexport const CAPICOM_PROPID_KEY_SPEC = 6;\nexport const CAPICOM_PROPID_LAST_RESERVED = 0x00007fff;\nexport const CAPICOM_PROPID_LAST_USER = 0x0000ffff;\nexport const CAPICOM_PROPID_MD5_HASH = 4;\nexport const CAPICOM_PROPID_NEXT_UPDATE_LOCATION = 10;\nexport const CAPICOM_PROPID_PUBKEY_ALG_PARA = 22;\nexport const CAPICOM_PROPID_PUBKEY_HASH_RESERVED = 8;\nexport const CAPICOM_PROPID_PVK_FILE = 12;\nexport const CAPICOM_PROPID_RENEWAL = 64;\nexport const CAPICOM_PROPID_SHA1_HASH = 3;\nexport const CAPICOM_PROPID_SIGNATURE_HASH = 15;\nexport const CAPICOM_PROPID_SMART_CARD_DATA = 16;\nexport const CAPICOM_PROPID_SUBJECT_NAME_MD5_HASH = 29;\nexport const CAPICOM_PROPID_SUBJECT_PUBLIC_KEY_MD5_HASH = 25;\nexport const CAPICOM_PROPID_UNKNOWN = 0;\nexport const CAPICOM_SMART_CARD_USER_STORE = 4;\nexport const CAPICOM_STORE_OPEN_EXISTING_ONLY = 128;\nexport const CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED = 256;\nexport const CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;\nexport const CAPICOM_STORE_OPEN_READ_ONLY = 0;\nexport const CAPICOM_STORE_OPEN_READ_WRITE = 1;\nexport const CHECK_NONE = 0;\nexport const CHECK_OFFLINE_REVOCATION_STATUS = 16;\nexport const CHECK_ONLINE_REVOCATION_STATUS = 8;\nexport const CHECK_SIGNATURE_VALIDITY = 4;\nexport const CHECK_TIME_VALIDITY = 2;\nexport const CHECK_TRUSTED_ROOT = 1;\nexport const LOG_LEVEL_DEBUG = 4;\nexport const LOG_LEVEL_ERROR = 1;\nexport const LOG_LEVEL_INFO = 2;\nexport const TRUST_CTL_IS_NOT_SIGNATURE_VALID = 262144;\nexport const TRUST_CTL_IS_NOT_TIME_VALID = 131072;\nexport const TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 524288;\nexport const TRUST_IS_CYCLIC = 128;\nexport const TRUST_IS_NOT_SIGNATURE_VALID = 8;\nexport const TRUST_IS_NOT_TIME_NESTED = 2;\nexport const TRUST_IS_NOT_TIME_VALID = 1;\nexport const TRUST_IS_NOT_VALID_FOR_USAGE = 16;\nexport const TRUST_IS_PARTIAL_CHAIN = 65536;\nexport const TRUST_IS_REVOKED = 4;\nexport const TRUST_IS_UNTRUSTED_ROOT = 32;\nexport const TRUST_REVOCATION_STATUS_UNKNOWN = 64;\nexport const XmlDsigGost3410Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411';\nexport const XmlDsigGost3410UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411';\nexport const XmlDsigGost3411Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411';\nexport const XmlDsigGost3411UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr3411';\n","export * from './cades-constants';\nexport * from './issuer-tags-translations';\nexport * from './oids-dictionary';\nexport * from './subject-tags-translations';\n","import { TagsTranslations } from './tags-translations';\n\nexport const ISSUER_TAGS_TRANSLATIONS: TagsTranslations[] = [\n { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' },\n { possibleNames: ['CN'], translation: 'Удостоверяющий центр' },\n { possibleNames: ['C'], translation: 'Страна' },\n { possibleNames: ['S'], translation: 'Регион' },\n { possibleNames: ['STREET'], translation: 'Адрес' },\n { possibleNames: ['O'], translation: 'Компания' },\n { possibleNames: ['OU'], translation: 'Тип' },\n { possibleNames: ['T'], translation: 'Должность' },\n { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },\n { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },\n { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },\n { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },\n { possibleNames: ['E'], translation: 'Email' },\n { possibleNames: ['L'], translation: 'Город' },\n];\n","export const OIDS_DICTIONARY = {\n '1.2.643.2.2.34.6': 'Пользователь Центра Регистрации',\n '1.2.643.2.39.1.1': 'Использование в программных продуктах системы \"1С:Предприятие 8\"',\n '1.2.643.3.131.1.1': 'ИНН',\n '1.2.643.3.141.1.1': 'РНС ФСС',\n '1.2.643.3.141.1.2': 'КП ФСС',\n '1.2.643.3.2.100.65.13.11': 'Использование в системе АИС \"Госзакупки\" Сахалинской области.',\n '1.2.643.3.8.100.1': 'Сертификат типа \"ekey-ГОСТ\"',\n '1.2.643.3.8.100.1.1': 'Общее использование в системах ИОК без права заверения финансовых документов',\n '1.2.643.3.8.100.1.10':\n 'Для участия в электронных торгах и подписания государственного контракта в информационных системах Тендерного комитета города Москвы уполномоченными лицами участников размещения государственного заказа города Москвы',\n '1.2.643.3.8.100.1.11':\n 'Подписание электронных документов в автоматизированной информационной системе размещения государственного и муниципального заказа Саратовской области',\n '1.2.643.3.8.100.1.12': 'Использование в системе государственного заказа Иркутской области',\n '1.2.643.3.8.100.1.13':\n 'Использование в электронной торговой площадке агентства государственного заказа Красноярского края',\n '1.2.643.3.8.100.1.14': 'Использование в электронной торговой площадке \"Тендер\"',\n '1.2.643.3.8.100.1.2': 'Передача отчетности по ТКС',\n '1.2.643.3.8.100.1.3': 'Оформление взаимных обязательств, соглашений, договоров, актов и т.п.',\n '1.2.643.3.8.100.1.4': 'Внутрикорпоративный документооборот',\n '1.2.643.3.8.100.1.5': 'Использование в системах электронной торговли',\n '1.2.643.3.8.100.1.6': 'Использование в торгово-закупочной системе \"ЭЛЕКТРА\"',\n '1.2.643.3.8.100.1.7': 'Использование в системе Портал государственных закупок Ставропольского края.',\n '1.2.643.3.8.100.1.8': 'Использование в Единой системе электронной торговли B2B-Center и B2G.',\n '1.2.643.3.8.100.1.9':\n 'Для участия в электронных торгах и подписания государственного контракта в электронной площадке ОАО «ЕЭТП» уполномоченными лицами участников размещения государственного или муниципального заказа',\n '1.2.643.5.1.24.2.1.3':\n 'Формирование документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя',\n '1.2.643.5.1.24.2.1.3.1':\n 'Формирование кадастровым инженером документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя',\n '1.2.643.5.1.24.2.2.2': 'Формирование документов как результата оказания услуги со стороны органов регистрации прав',\n '1.2.643.5.1.24.2.2.3':\n 'Формирование документов для получения государственных услуг в сфере государственной регистрации прав на недвижимое имущество и сделок с ним со стороны заявителя',\n '1.2.643.6.2.1.7.1':\n 'Использование единоличным исполнительным органом юридического лица или уполномоченными представителями юридического лица в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских и иных прав и обязанностей в сфере негосударственного пенсионного обеспечения, негосударственного пенсионного страхования, в сфере деятельности паевых инвестиционных фондов, акционерных инвестиционных фондов, профессиональных участников рынка ценных бумаг, а также связанной с обслуживанием указанной деятельности услуг кредитных и иных организаций',\n '1.2.643.6.2.1.7.2':\n 'Использование физическим лицом в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских прав и обязанностей в отношении инвестиционных паев паевых инвестиционных фондов, в том числе отношения, связанные с учетом и/или фиксацией прав на инвестиционные паи паевых инвестиционных фондов',\n '1.2.643.6.3':\n 'Использование в электронных торговых системах и в программном обеспечении, связанным с обменом электронных сообщений',\n '1.2.643.6.3.1.1': 'Использование на электронных площадок отобранных для проведения аукционах в электронной форме',\n '1.2.643.6.3.1.2.1': 'Тип участника - Юридическое лицо',\n '1.2.643.6.3.1.2.2': 'Тип участника - Физическое лицо',\n '1.2.643.6.3.1.2.3': 'Тип участника - Индивидуальный предприниматель',\n '1.2.643.6.3.1.3.1': 'Участник размещения заказа',\n '1.2.643.6.3.1.4.1': 'Администратор организации',\n '1.2.643.6.3.1.4.2': 'Уполномоченный специалист',\n '1.2.643.6.3.1.4.3': 'Специалист с правом подписи контракта',\n '1.2.840.113549.1.9.2': 'Неструктурированное имя',\n '1.3.6.1.4.1.24138.1.1.8.1': 'Обеспечение юридической значимости в Системе \"Электронная Торговая Площадка\"',\n '1.3.6.1.4.1.29919.21': 'Использование в системе Портал государственных закупок Ростовской области \"Рефери\".',\n '1.3.6.1.5.5.7.3.2': 'Проверка подлинности клиента',\n '1.3.6.1.5.5.7.3.4': 'Защищенная электронная почта',\n '1.3.643.3.8.100.15': 'Использование в ЭТП \"uTender\"',\n};\n","import { TagsTranslations } from './tags-translations';\n\nexport const SUBJECT_TAGS_TRANSLATIONS: TagsTranslations[] = [\n { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' },\n { possibleNames: ['CN'], translation: 'Владелец' },\n { possibleNames: ['SN'], translation: 'Фамилия' },\n { possibleNames: ['G'], translation: 'Имя Отчество' },\n { possibleNames: ['C'], translation: 'Страна' },\n { possibleNames: ['S'], translation: 'Регион' },\n { possibleNames: ['STREET'], translation: 'Адрес' },\n { possibleNames: ['O'], translation: 'Компания' },\n { possibleNames: ['OU'], translation: 'Отдел/подразделение' },\n { possibleNames: ['T'], translation: 'Должность' },\n { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },\n { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },\n { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },\n { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },\n { possibleNames: ['E'], translation: 'Email' },\n { possibleNames: ['L'], translation: 'Город' },\n];\n","export * from './api';\n","import { _extractMeaningfulErrorMessage } from './_extractMeaningfulErrorMessage';\n\ntype Unpromisify = T extends Promise ? R : T;\n\nlet isSetLogLevel = false;\nlet isPluginLoaded = false;\n\nexport const _afterPluginsLoaded = any>(\n fn: T,\n): ((...args: Parameters) => Promise>>) => {\n const canPromise = Boolean(window.Promise);\n\n return async function (...args: Parameters): Promise>> {\n if (!isPluginLoaded) {\n try {\n require('../vendor/cadesplugin_api');\n } catch (error) {\n console.error(error);\n\n throw new Error(\n _extractMeaningfulErrorMessage(error) || 'Ошибка при подключении модуля для работы с Cades plugin',\n );\n }\n\n isPluginLoaded = true;\n }\n\n const { cadesplugin } = window;\n\n if (!canPromise) {\n throw new Error('Необходим полифилл для Promise');\n }\n\n if (!cadesplugin) {\n throw new Error('Не подключен модуль для работы с Cades plugin');\n }\n\n if (!isSetLogLevel) {\n cadesplugin.set_log_level(cadesplugin.LOG_LEVEL_ERROR);\n\n isSetLogLevel = true;\n }\n\n try {\n await cadesplugin;\n } catch (error) {\n console.error(error);\n\n throw new Error(\n _extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации модуля для работы с Cades plugin',\n );\n }\n\n return await fn.apply(this, args);\n };\n};\n","export const _extractCommonName = (subjectName: string): string | undefined =>\n subjectName.match(/CN=(.+?)(?:,|$)/)?.[1];\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)|(?:\\.?$))/);\n\n return searchResult ? searchResult[1] : null;\n};\n","// синтетические переменные, которые подменяются в рантайме\nexport const __cadesAsyncToken__ = {};\nexport const __createCadesPluginObject__ = (...args): any => ({});\n\nfunction getGeneratorConstructor(): GeneratorFunction {\n return new Function('', 'return Object.getPrototypeOf(function*(){}).constructor')();\n}\n\nexport const _generateCadesFn = (callback: Function): string => {\n const { cadesplugin } = window;\n const cadesGeneratorsAPI = Boolean(cadesplugin.CreateObjectAsync);\n const callbackName = callback.name || 'dynamicFn';\n const callbackLiteral = String(callback);\n const callbackArguments = callbackLiteral.match(/^function[\\s\\w]*?\\((.*?)\\)/)?.[1] || '';\n const callbackBody = callbackLiteral.replace(/^.*?{([\\s\\S]*?)}$/, '$1');\n let crossEnvCallbackLiteral = String(\n new (cadesGeneratorsAPI ? getGeneratorConstructor() : Function)(callbackArguments, callbackBody),\n );\n\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(\n /\\w+?\\.__createCadesPluginObject__(\\([\\s\\S]*?\\))/gm,\n `cadesplugin.CreateObject${cadesGeneratorsAPI ? 'Async' : ''}$1`,\n );\n\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(\n /\\w+?\\.__cadesAsyncToken__\\s*?\\+\\s*?\\b/gm,\n cadesGeneratorsAPI ? 'yield ' : '',\n );\n\n if (!cadesGeneratorsAPI) {\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/propset_(.*?)\\((.*?)\\)/gm, '$1 = $2');\n }\n\n return [\n cadesGeneratorsAPI ? `cadesplugin.async_spawn(${crossEnvCallbackLiteral});` : `(${crossEnvCallbackLiteral})();`,\n `//# sourceURL=crypto-pro_${callbackName}.js`,\n ].join('');\n};\n","import { CadesCertificate } from '../api/certificate';\nimport { _afterPluginsLoaded } from './_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from './_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from './_generateCadesFn';\n\n/**\n * Возвращает сертификат в формате Cades по отпечатку\n *\n * @param thumbprint - отпечаток сертификата\n * @returns сертификат в формате Cades\n */\nexport const _getCadesCert = _afterPluginsLoaded(\n (thumbprint: string): CadesCertificate => {\n const { cadesplugin } = window;\n\n return eval(\n _generateCadesFn(function _getCadesCert() {\n let cadesStore;\n\n try {\n cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');\n }\n\n if (!cadesStore) {\n throw new Error('Не удалось получить доступ к хранилищу сертификатов');\n }\n\n try {\n void (\n __cadesAsyncToken__ +\n cadesStore.Open(\n cadesplugin.CAPICOM_CURRENT_USER_STORE,\n cadesplugin.CAPICOM_MY_STORE,\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,\n )\n );\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');\n }\n\n let cadesCertificateList;\n let certificatesCount;\n\n try {\n cadesCertificateList = __cadesAsyncToken__ + cadesStore.Certificates;\n certificatesCount = __cadesAsyncToken__ + cadesCertificateList.Count;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');\n }\n\n if (!certificatesCount) {\n throw new Error('Нет доступных сертификатов');\n }\n\n let cadesCertificate: CadesCertificate;\n\n try {\n cadesCertificateList =\n __cadesAsyncToken__ + cadesCertificateList.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH, thumbprint);\n\n const count = __cadesAsyncToken__ + cadesCertificateList.Count;\n\n if (!count) {\n throw new Error(`Сертификат с отпечатком: \"${thumbprint}\" не найден`);\n }\n\n cadesCertificate = __cadesAsyncToken__ + cadesCertificateList.Item(1);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении сертификата');\n }\n\n cadesStore.Close();\n\n return cadesCertificate;\n }),\n );\n },\n);\n","/**\n * Возвращает объект даты, совместимый с Cades plugin'ом, зависящий от браузера.\n *\n * В IE необходимо использовать специфичный формат \"VT_DATE\"\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Microsoft_Extensions/Date.getVarDate\n */\nexport const _getDateObj = (dateObj): Date => (dateObj.getVarDate ? dateObj.getVarDate() : dateObj);\n","const oldestSupportedCSPVersion = 4.0;\n\nexport const _isSupportedCSPVersion = (version: string): boolean => {\n version = version.match(/\\d+?\\b(?:\\.\\d+)?/)?.[0];\n\n return Number(version) >= oldestSupportedCSPVersion;\n};\n","export const _isSupportedCadesVersion = (version: string): boolean => {\n const match = version.match(/(\\d+)\\.(\\d+)\\.(\\d+)/);\n\n if (!match) {\n return false;\n }\n\n const [, major, minor, patch] = match;\n\n if (Number(major) < 2) {\n return false;\n }\n\n if (Number(major) === 2 && Number(patch) < 12438) {\n return false;\n }\n\n return true;\n};\n","import { OIDS_DICTIONARY } from '../constants';\nimport { TagsTranslations } from '../constants/tags-translations';\n\nexport interface TagTranslation {\n description: string;\n title: string;\n isTranslated: boolean;\n}\n\n/**\n * Парсит информацию из строки с информацией о сертификате\n *\n * @param tagsTranslations - словарь с расшифровками тэгов\n * @param rawInfo - данные для парсинга\n * @returns расшифрованная информация по отдельным тэгам\n */\nexport const _parseCertInfo = (tagsTranslations: TagsTranslations[], rawInfo: string): TagTranslation[] => {\n const extractedEntities: string[] = rawInfo.match(/([а-яА-Яa-zA-Z0-9\\s.]+)=(?:(\"[^\"]+?\")|(.+?))(?:,|$)/g);\n\n if (extractedEntities) {\n return extractedEntities.map((group) => {\n const segmentsMatch = group.trim().match(/^([а-яА-Яa-zA-Z0-9\\s.]+)=(.+?),?$/);\n let title = segmentsMatch?.[1];\n // Вырезаем лишние кавычки\n const description = segmentsMatch?.[2]?.replace(/^\"(.*)\"/, '$1')?.replace(/\"{2}/g, '\"');\n const oidIdentifierMatch = title?.match(/^OID\\.(.*)/);\n const oidIdentifier = oidIdentifierMatch?.[1];\n let isTranslated = false;\n\n // Если нашли в тайтле ОИД, пытаемся его расшифровать\n if (oidIdentifier) {\n const oidTranslation = OIDS_DICTIONARY[oidIdentifier];\n\n if (oidTranslation) {\n title = oidTranslation;\n isTranslated = true;\n }\n }\n\n const tagTranslation = tagsTranslations.find((tag) => tag.possibleNames.find((name) => name === title))\n ?.translation;\n\n if (tagTranslation) {\n title = tagTranslation;\n isTranslated = true;\n }\n\n return { description, title, isTranslated };\n });\n }\n};\n",";(function () {\n //already loaded\n if(window.cadesplugin)\n return;\n\n var pluginObject;\n var plugin_resolved = 0;\n var plugin_reject;\n var plugin_resolve;\n var isOpera = 0;\n var isFireFox = 0;\n var isEdge = 0;\n var isSafari = 0;\n var failed_extensions = 0;\n\n var canPromise = !!window.Promise;\n var cadesplugin;\n\n if(canPromise)\n {\n cadesplugin = new Promise(function(resolve, reject)\n {\n plugin_resolve = resolve;\n plugin_reject = reject;\n });\n } else\n {\n cadesplugin = {};\n }\n\n function check_browser() {\n var ua= navigator.userAgent, tem, M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\\/))\\/?\\s*(\\d+)/i) || [];\n if(/trident/i.test(M[1])){\n tem= /\\brv[ :]+(\\d+)/g.exec(ua) || [];\n return {name:'IE',version:(tem[1] || '')};\n }\n if(M[1]=== 'Chrome'){\n tem= ua.match(/\\b(OPR|Edge)\\/(\\d+)/);\n if(tem!= null) return {name:tem[1].replace('OPR', 'Opera'),version:tem[2]};\n }\n M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];\n if((tem= ua.match(/version\\/(\\d+)/i))!= null) M.splice(1, 1, tem[1]);\n return {name:M[0],version:M[1]};\n }\n var browserSpecs = check_browser();\n\n function cpcsp_console_log(level, msg){\n //IE9 не может писать в консоль если не открыта вкладка developer tools\n if(typeof(console) === 'undefined')\n return;\n if (level <= cadesplugin.current_log_level ){\n if (level === cadesplugin.LOG_LEVEL_DEBUG)\n console.log(\"DEBUG: %s\", msg);\n if (level === cadesplugin.LOG_LEVEL_INFO)\n console.info(\"INFO: %s\", msg);\n if (level === cadesplugin.LOG_LEVEL_ERROR)\n console.error(\"ERROR: %s\", msg);\n return;\n }\n }\n\n function set_log_level(level){\n if (!((level === cadesplugin.LOG_LEVEL_DEBUG) ||\n (level === cadesplugin.LOG_LEVEL_INFO) ||\n (level === cadesplugin.LOG_LEVEL_ERROR))){\n cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, \"cadesplugin_api.js: Incorrect log_level: \" + level);\n return;\n }\n cadesplugin.current_log_level = level;\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = DEBUG\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = INFO\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = ERROR\");\n if(isNativeMessageSupported())\n {\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG)\n window.postMessage(\"set_log_level=debug\", \"*\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO)\n window.postMessage(\"set_log_level=info\", \"*\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR)\n window.postMessage(\"set_log_level=error\", \"*\");\n }\n }\n\n function set_constantValues()\n {\n cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CAPICOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CADESCOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_CONTAINER_STORE = 100;\n\n cadesplugin.CAPICOM_MY_STORE = \"My\";\n\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;\n\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\n\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;\n\n cadesplugin.XmlDsigGost3410UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411\";\n cadesplugin.XmlDsigGost3411UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr3411\";\n cadesplugin.XmlDsigGost3410Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411\";\n cadesplugin.XmlDsigGost3411Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411\";\n\n cadesplugin.CADESCOM_CADES_DEFAULT = 0;\n cadesplugin.CADESCOM_CADES_BES = 1;\n cadesplugin.CADESCOM_CADES_T = 0x5;\n cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;\n cadesplugin.CADESCOM_PKCS7_TYPE = 0xffff;\n\n cadesplugin.CADESCOM_ENCODE_BASE64 = 0;\n cadesplugin.CADESCOM_ENCODE_BINARY = 1;\n cadesplugin.CADESCOM_ENCODE_ANY = -1;\n\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;\n\n cadesplugin.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;\n cadesplugin.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;\n\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;\n\n cadesplugin.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;\n\n cadesplugin.CAPICOM_PROPID_ENHKEY_USAGE = 9;\n\n cadesplugin.CAPICOM_OID_OTHER = 0;\n cadesplugin.CAPICOM_OID_KEY_USAGE_EXTENSION = 10;\n\n cadesplugin.CAPICOM_EKU_CLIENT_AUTH = 2;\n cadesplugin.CAPICOM_EKU_SMARTCARD_LOGON = 5;\n cadesplugin.CAPICOM_EKU_OTHER = 0;\n\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\n cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1;\n\n cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0;\n cadesplugin.CADESCOM_BASE64_TO_BINARY = 1;\n\n cadesplugin.CADESCOM_DISPLAY_DATA_NONE = 0;\n cadesplugin.CADESCOM_DISPLAY_DATA_CONTENT = 1;\n cadesplugin.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;\n\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;\n\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA1 = 0;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD2 = 1;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD4 = 2;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD5 = 3;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_256 = 4;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_384 = 5;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_512 = 6;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112;\n\n cadesplugin.LOG_LEVEL_DEBUG = 4;\n cadesplugin.LOG_LEVEL_INFO = 2;\n cadesplugin.LOG_LEVEL_ERROR = 1;\n\n cadesplugin.CADESCOM_AllowNone = 0;\n cadesplugin.CADESCOM_AllowNoOutstandingRequest = 0x1;\n cadesplugin.CADESCOM_AllowUntrustedCertificate = 0x2;\n cadesplugin.CADESCOM_AllowUntrustedRoot = 0x4;\n cadesplugin.CADESCOM_SkipInstallToStore = 0x10000000;\n }\n\n function async_spawn(generatorFunc) {\n function continuer(verb, arg) {\n var result;\n try {\n result = generator[verb](arg);\n } catch (err) {\n return Promise.reject(err);\n }\n if (result.done) {\n return result.value;\n } else {\n return Promise.resolve(result.value).then(onFulfilled, onRejected);\n }\n }\n var generator = generatorFunc(Array.prototype.slice.call(arguments, 1));\n var onFulfilled = continuer.bind(continuer, \"next\");\n var onRejected = continuer.bind(continuer, \"throw\");\n return onFulfilled();\n }\n\n function isIE() {\n // var retVal = ((\"Microsoft Internet Explorer\" == navigator.appName) || // IE < 11\n // navigator.userAgent.match(/Trident\\/./i)); // IE 11\n return (browserSpecs.name === 'IE' || browserSpecs.name === 'MSIE');\n }\n\n function isIOS() {\n return (navigator.userAgent.match(/ipod/i) ||\n navigator.userAgent.match(/ipad/i) ||\n navigator.userAgent.match(/iphone/i));\n }\n\n function isNativeMessageSupported()\n {\n // В IE работаем через NPAPI\n if(isIE())\n return false;\n // В Edge работаем через NativeMessage\n if(browserSpecs.name === 'Edge') {\n isEdge = true;\n return true;\n }\n // В Chrome, Firefox, Safari и Opera работаем через асинхронную версию в зависимости от версии\n if(browserSpecs.name === 'Opera') {\n isOpera = true;\n if(browserSpecs.version >= 33){\n return true;\n }\n else{\n return false;\n }\n }\n if(browserSpecs.name === 'Firefox') {\n isFireFox = true;\n if(browserSpecs.version >= 52){\n return true;\n }\n else{\n return false;\n }\n }\n if(browserSpecs.name === 'Chrome') {\n if(browserSpecs.version >= 42){\n return true;\n }\n else{\n return false;\n }\n }\n //В Сафари начиная с 12 версии нет NPAPI\n if(browserSpecs.name === 'Safari') {\n isSafari = true;\n if(browserSpecs.version >= 12) {\n return true;\n } else {\n return false;\n }\n }\n }\n\n // Функция активации объектов КриптоПро ЭЦП Browser plug-in\n function CreateObject(name) {\n if (isIOS()) {\n // На iOS для создания объектов используется функция\n // call_ru_cryptopro_npcades_10_native_bridge, определенная в IOS_npcades_supp.js\n return call_ru_cryptopro_npcades_10_native_bridge(\"CreateObject\", [name]);\n }\n if (isIE()) {\n // В Internet Explorer создаются COM-объекты\n if (name.match(/X509Enrollment/i)) {\n try {\n // Объекты CertEnroll пробуем создавать через нашу фабрику,\n // если не получилось то через CX509EnrollmentWebClassFactory\n var objCertEnrollClassFactory = document.getElementById(\"webClassFactory\");\n return objCertEnrollClassFactory.CreateObject(name);\n }\n catch (e) {\n try {\n var objWebClassFactory = document.getElementById(\"certEnrollClassFactory\");\n return objWebClassFactory.CreateObject(name);\n }\n catch (err) {\n throw (\"Для создания обьектов X509Enrollment следует настроить веб-узел на использование проверки подлинности по протоколу HTTPS\");\n }\n }\n }\n // Объекты CAPICOM и CAdESCOM создаются через CAdESCOM.WebClassFactory\n try {\n var objWebClassFactory = document.getElementById(\"webClassFactory\");\n return objWebClassFactory.CreateObject(name);\n }\n catch (e) {\n // Для версий плагина ниже 2.0.12538\n return new ActiveXObject(name);\n }\n }\n // создаются объекты NPAPI\n return pluginObject.CreateObject(name);\n }\n\n function decimalToHexString(number) {\n if (number < 0) {\n number = 0xFFFFFFFF + number + 1;\n }\n\n return number.toString(16).toUpperCase();\n }\n\n function GetMessageFromException(e) {\n var err = e.message;\n if (!err) {\n err = e;\n } else if (e.number) {\n err += \" (0x\" + decimalToHexString(e.number) + \")\";\n }\n return err;\n }\n\n function getLastError(exception) {\n if(isNativeMessageSupported() || isIE() || isIOS() ) {\n return GetMessageFromException(exception);\n }\n\n try {\n return pluginObject.getLastError();\n } catch(e) {\n return GetMessageFromException(exception);\n }\n }\n\n // Функция для удаления созданных объектов\n function ReleasePluginObjects() {\n return cpcsp_chrome_nmcades.ReleasePluginObjects();\n }\n\n // Функция активации асинхронных объектов КриптоПро ЭЦП Browser plug-in\n function CreateObjectAsync(name) {\n return pluginObject.CreateObjectAsync(name);\n }\n\n //Функции для IOS\n var ru_cryptopro_npcades_10_native_bridge = {\n callbacksCount : 1,\n callbacks : {},\n\n // Automatically called by native layer when a result is available\n resultForCallback : function resultForCallback(callbackId, resultArray) {\n var callback = ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId];\n if (!callback) return;\n callback.apply(null,resultArray);\n },\n\n // Use this in javascript to request native objective-c code\n // functionName : string (I think the name is explicit :p)\n // args : array of arguments\n // callback : function with n-arguments that is going to be called when the native code returned\n call : function call(functionName, args, callback) {\n var hasCallback = callback && typeof callback === \"function\";\n var callbackId = hasCallback ? ru_cryptopro_npcades_10_native_bridge.callbacksCount++ : 0;\n\n if (hasCallback)\n ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId] = callback;\n\n var iframe = document.createElement(\"IFRAME\");\n var arrObjs = new Array(\"_CPNP_handle\");\n try{\n iframe.setAttribute(\"src\", \"cpnp-js-call:\" + functionName + \":\" + callbackId+ \":\" + encodeURIComponent(JSON.stringify(args, arrObjs)));\n } catch(e){\n alert(e);\n }\n document.documentElement.appendChild(iframe);\n iframe.parentNode.removeChild(iframe);\n iframe = null;\n }\n };\n\n function call_ru_cryptopro_npcades_10_native_bridge(functionName, array){\n var tmpobj;\n var ex;\n ru_cryptopro_npcades_10_native_bridge.call(functionName, array, function(e, response){\n ex = e;\n var str='tmpobj='+response;\n eval(str);\n if (typeof (tmpobj) === \"string\"){\n tmpobj = tmpobj.replace(/\\\\\\n/gm, \"\\n\");\n tmpobj = tmpobj.replace(/\\\\\\r/gm, \"\\r\");\n }\n });\n if(ex)\n throw ex;\n return tmpobj;\n }\n\n function show_firefox_missing_extension_dialog()\n {\n if (!window.cadesplugin_skip_extension_install)\n {\n var ovr = document.createElement('div');\n ovr.id = \"cadesplugin_ovr\";\n ovr.style = \"visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)\";\n ovr.innerHTML = \"
\" +\n \"\" +\n \"

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

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

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

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

\" +\n \"
\";\n document.getElementsByTagName(\"Body\")[0].appendChild(ovr);\n var btn_install = document.getElementById(\"cadesplugin_install\");\n btn_install.addEventListener('click', function(event) {\n opr.addons.installExtension(\"epebfcehmdedogndhlcacafjaacknbcm\",\n function()\n {\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n location.reload();\n },\n function(){})\n });\n document.getElementById(\"cadesplugin_close_install\").addEventListener('click',function()\n {\n plugin_loaded_error(\"Плагин недоступен\");\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n });\n\n ovr.addEventListener('click',function()\n {\n plugin_loaded_error(\"Плагин недоступен\");\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n });\n ovr.style.visibility=\"visible\";\n document.getElementById(\"cadesplugin_ovr_item\").addEventListener('click',function(e){\n e.stopPropagation();\n });\n });\n }else\n {\n plugin_loaded_error(\"Плагин недоступен\");\n }\n }\n\n function firefox_or_edge_nmcades_onload() {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n\n function nmcades_api_onload () {\n window.postMessage(\"cadesplugin_echo_request\", \"*\");\n window.addEventListener(\"message\", function (event){\n if (typeof(event.data) !== \"string\" || !event.data.match(\"cadesplugin_loaded\"))\n return;\n if(isFireFox || isEdge || isSafari)\n {\n // Для Firefox, Сафари, Edge вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js\n var url = event.data.substring(event.data.indexOf(\"url:\") + 4);\n var fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", url);\n fileref.onerror = plugin_loaded_error;\n fileref.onload = firefox_or_edge_nmcades_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n // Для Firefox, Safari и Edge у нас только по одному расширению.\n failed_extensions++;\n }else {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n }, false);\n }\n\n //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari\n function load_extension()\n {\n\n if(isFireFox || isEdge || isSafari){\n // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера.\n nmcades_api_onload();\n } else {\n // в асинхронном варианте для chrome и opera подключаем оба расширения\n var fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", \"chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js\");\n fileref.onerror = plugin_loaded_error;\n fileref.onload = nmcades_api_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", \"chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js\");\n fileref.onerror = plugin_loaded_error;\n fileref.onload = nmcades_api_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n }\n }\n\n //Загружаем плагин для NPAPI\n function load_npapi_plugin()\n {\n var elem = document.createElement('object');\n elem.setAttribute(\"id\", \"cadesplugin_object\");\n elem.setAttribute(\"type\", \"application/x-cades\");\n elem.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem);\n pluginObject = document.getElementById(\"cadesplugin_object\");\n if(isIE())\n {\n var elem1 = document.createElement('object');\n elem1.setAttribute(\"id\", \"certEnrollClassFactory\");\n elem1.setAttribute(\"classid\", \"clsid:884e2049-217d-11da-b2a4-000e7bbb2b09\");\n elem1.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem1);\n var elem2 = document.createElement('object');\n elem2.setAttribute(\"id\", \"webClassFactory\");\n elem2.setAttribute(\"classid\", \"clsid:B04C8637-10BD-484E-B0DA-B8A039F60024\");\n elem2.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem2);\n }\n }\n\n //Отправляем событие что все ок.\n function plugin_loaded()\n {\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_resolve();\n }else {\n window.postMessage(\"cadesplugin_loaded\", \"*\");\n }\n }\n\n //Отправляем событие что сломались.\n function plugin_loaded_error(msg)\n {\n if(isNativeMessageSupported())\n {\n //в асинхронном варианте подключаем оба расширения, если сломались оба пробуем установить для Opera\n failed_extensions++;\n if(failed_extensions<2)\n return;\n if(isOpera && (typeof(msg) === 'undefined'|| typeof(msg) === 'object'))\n {\n install_opera_extension();\n return;\n }\n }\n if(typeof(msg) === 'undefined' || typeof(msg) === 'object')\n msg = \"Плагин недоступен\";\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_reject(msg);\n } else {\n window.postMessage(\"cadesplugin_load_error\", \"*\");\n }\n }\n\n //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку\n function check_load_timeout()\n {\n if(plugin_resolved === 1)\n return;\n if(isFireFox)\n {\n show_firefox_missing_extension_dialog();\n }\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_reject(\"Истекло время ожидания загрузки плагина\");\n } else {\n window.postMessage(\"cadesplugin_load_error\", \"*\");\n }\n\n }\n\n //Вспомогательная функция для NPAPI\n function createPromise(arg)\n {\n return new Promise(arg);\n }\n\n function check_npapi_plugin (){\n try {\n var oAbout = CreateObject(\"CAdESCOM.About\");\n plugin_loaded();\n }\n catch (err) {\n document.getElementById(\"cadesplugin_object\").style.display = 'none';\n // Объект создать не удалось, проверим, установлен ли\n // вообще плагин. Такая возможность есть не во всех браузерах\n var mimetype = navigator.mimeTypes[\"application/x-cades\"];\n if (mimetype) {\n var plugin = mimetype.enabledPlugin;\n if (plugin) {\n plugin_loaded_error(\"Плагин загружен, но не создаются обьекты\");\n }else\n {\n plugin_loaded_error(\"Ошибка при загрузке плагина\");\n }\n }else\n {\n plugin_loaded_error(\"Плагин недоступен\");\n }\n }\n }\n\n //Проверяем работает ли плагин\n function check_plugin_working()\n {\n var div = document.createElement(\"div\");\n div.innerHTML = \"\";\n var isIeLessThan9 = (div.getElementsByTagName(\"i\").length === 1);\n if (isIeLessThan9) {\n plugin_loaded_error(\"Internet Explorer версии 8 и ниже не поддерживается\");\n return;\n }\n\n if(isNativeMessageSupported())\n {\n load_extension();\n }else if(!canPromise) {\n window.addEventListener(\"message\", function (event){\n if (event.data !== \"cadesplugin_echo_request\")\n return;\n load_npapi_plugin();\n check_npapi_plugin();\n },\n false);\n }else\n {\n if(document.readyState === \"complete\"){\n load_npapi_plugin();\n check_npapi_plugin();\n } else {\n window.addEventListener(\"load\", function (event) {\n load_npapi_plugin();\n check_npapi_plugin();\n }, false);\n }\n }\n }\n\n function set_pluginObject(obj)\n {\n pluginObject = obj;\n }\n\n function is_capilite_enabled()\n {\n if ((typeof (cadesplugin.EnableInternalCSP) !== 'undefined') && cadesplugin.EnableInternalCSP)\n return true;\n return false;\n };\n\n //Export\n cadesplugin.JSModuleVersion = \"2.1.2\";\n cadesplugin.async_spawn = async_spawn;\n cadesplugin.set = set_pluginObject;\n cadesplugin.set_log_level = set_log_level;\n cadesplugin.getLastError = getLastError;\n cadesplugin.is_capilite_enabled = is_capilite_enabled;\n\n if(isNativeMessageSupported())\n {\n cadesplugin.CreateObjectAsync = CreateObjectAsync;\n cadesplugin.ReleasePluginObjects = ReleasePluginObjects;\n }\n\n if(!isNativeMessageSupported())\n {\n cadesplugin.CreateObject = CreateObject;\n }\n\n if(window.cadesplugin_load_timeout)\n {\n setTimeout(check_load_timeout, window.cadesplugin_load_timeout);\n }\n else\n {\n setTimeout(check_load_timeout, 20000);\n }\n\n set_constantValues();\n\n cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR;\n window.cadesplugin = cadesplugin;\n check_plugin_working();\n}());\n"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/crypto-pro.min.js b/dist/crypto-pro.min.js index fca077e..ca0e579 100644 --- a/dist/crypto-pro.min.js +++ b/dist/crypto-pro.min.js @@ -1,2 +1,9 @@ -!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("cryptoPro",[],n):"object"==typeof exports?exports.cryptoPro=n():e.cryptoPro=n()}(window,(function(){return function(e){var n={};function t(r){if(n[r])return n[r].exports;var _=n[r]={i:r,l:!1,exports:{}};return e[r].call(_.exports,_,_.exports,t),_.l=!0,_.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var _ in e)t.d(r,_,function(n){return e[n]}.bind(null,_));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=8)}([function(e,n,t){"use strict";var r=this&&this.__awaiter||function(e,n,t,r){return new(t||(t=Promise))((function(_,a){function s(e){try{o(r.next(e))}catch(e){a(e)}}function i(e){try{o(r.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?_(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,i)}o((r=r.apply(e,n||[])).next())}))},_=this&&this.__generator||function(e,n){var t,r,_,a,s={label:0,sent:function(){if(1&_[0])throw _[1];return _[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;s;)try{if(t=1,r&&(_=2&a[0]?r.return:a[0]?r.throw||((_=r.return)&&_.call(r),0):r.next)&&!(_=_.call(r,a[1])).done)return _;switch(r=0,_&&(a=[2&a[0],_.value]),a[0]){case 0:case 1:_=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(_=s.trys,(_=_.length>0&&_[_.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!_||a[1]>_[0]&&a[1]<_[3])){s.label=a[1];break}if(6===a[0]&&s.label<_[1]){s.label=_[1],_=a;break}if(_&&s.label<_[2]){s.label=_[2],s.ops.push(a);break}_[2]&&s.ops.pop(),s.trys.pop();continue}a=n.call(e,s)}catch(e){a=[6,e],r=0}finally{t=_=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}};Object.defineProperty(n,"__esModule",{value:!0});var a=t(1),s=!1,i=!1;n._afterPluginsLoaded=function(e){var n=Boolean(window.Promise);return function(){for(var o=[],c=0;c0&&_[_.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!_||a[1]>_[0]&&a[1]<_[3])){s.label=a[1];break}if(6===a[0]&&s.label<_[1]){s.label=_[1],_=a;break}if(_&&s.label<_[2]){s.label=_[2],s.ops.push(a);break}_[2]&&s.ops.pop(),s.trys.pop();continue}a=n.call(e,s)}catch(e){a=[6,e],r=0}finally{t=_=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}};Object.defineProperty(n,"__esModule",{value:!0});var a=t(0),s=t(4);n.getCertificate=a._afterPluginsLoaded((function(e){return r(void 0,void 0,void 0,(function(){var n,t;return _(this,(function(r){switch(r.label){case 0:if(!e)throw new Error("Отпечаток не указан");return[4,s.getUserCertificates()];case 1:if(n=r.sent(),!(t=n.find((function(n){return n.thumbprint===e}))))throw new Error('Сертификат с отпечатком: "'+e+'" не найден');return[2,t]}}))}))}))},function(module,exports){!function(){if(!window.cadesplugin){var pluginObject,plugin_resolved=0,plugin_reject,plugin_resolve,isOpera=0,isFireFox=0,isEdge=0,isSafari=0,failed_extensions=0,canPromise=!!window.Promise,cadesplugin;cadesplugin=canPromise?new Promise((function(e,n){plugin_resolve=e,plugin_reject=n})):{};var browserSpecs=check_browser(),ru_cryptopro_npcades_10_native_bridge={callbacksCount:1,callbacks:{},resultForCallback:function(e,n){var t=ru_cryptopro_npcades_10_native_bridge.callbacks[e];t&&t.apply(null,n)},call:function(e,n,t){var r=t&&"function"==typeof t,_=r?ru_cryptopro_npcades_10_native_bridge.callbacksCount++:0;r&&(ru_cryptopro_npcades_10_native_bridge.callbacks[_]=t);var a=document.createElement("IFRAME"),s=new Array("_CPNP_handle");try{a.setAttribute("src","cpnp-js-call:"+e+":"+_+":"+encodeURIComponent(JSON.stringify(n,s)))}catch(e){alert(e)}document.documentElement.appendChild(a),a.parentNode.removeChild(a),a=null}};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,isNativeMessageSupported()&&(cadesplugin.CreateObjectAsync=CreateObjectAsync,cadesplugin.ReleasePluginObjects=ReleasePluginObjects),isNativeMessageSupported()||(cadesplugin.CreateObject=CreateObject),window.cadesplugin_load_timeout?setTimeout(check_load_timeout,window.cadesplugin_load_timeout):setTimeout(check_load_timeout,2e4),set_constantValues(),cadesplugin.current_log_level=cadesplugin.LOG_LEVEL_ERROR,window.cadesplugin=cadesplugin,check_plugin_working()}function check_browser(){var e,n=navigator.userAgent,t=n.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return/trident/i.test(t[1])?{name:"IE",version:(e=/\brv[ :]+(\d+)/g.exec(n)||[])[1]||""}:"Chrome"===t[1]&&null!=(e=n.match(/\b(OPR|Edge)\/(\d+)/))?{name:e[1].replace("OPR","Opera"),version:e[2]}:(t=t[2]?[t[1],t[2]]:[navigator.appName,navigator.appVersion,"-?"],null!=(e=n.match(/version\/(\d+)/i))&&t.splice(1,1,e[1]),{name:t[0],version:t[1]})}function cpcsp_console_log(e,n){if("undefined"!=typeof console)return e<=cadesplugin.current_log_level?(e===cadesplugin.LOG_LEVEL_DEBUG&&console.log("DEBUG: %s",n),e===cadesplugin.LOG_LEVEL_INFO&&console.info("INFO: %s",n),void(e===cadesplugin.LOG_LEVEL_ERROR&&console.error("ERROR: %s",n))):void 0}function set_log_level(e){e===cadesplugin.LOG_LEVEL_DEBUG||e===cadesplugin.LOG_LEVEL_INFO||e===cadesplugin.LOG_LEVEL_ERROR?(cadesplugin.current_log_level=e,cadesplugin.current_log_level===cadesplugin.LOG_LEVEL_DEBUG&&cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO,"cadesplugin_api.js: log_level = DEBUG"),cadesplugin.current_log_level===cadesplugin.LOG_LEVEL_INFO&&cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO,"cadesplugin_api.js: log_level = INFO"),cadesplugin.current_log_level===cadesplugin.LOG_LEVEL_ERROR&&cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO,"cadesplugin_api.js: log_level = ERROR"),isNativeMessageSupported()&&(cadesplugin.current_log_level===cadesplugin.LOG_LEVEL_DEBUG&&window.postMessage("set_log_level=debug","*"),cadesplugin.current_log_level===cadesplugin.LOG_LEVEL_INFO&&window.postMessage("set_log_level=info","*"),cadesplugin.current_log_level===cadesplugin.LOG_LEVEL_ERROR&&window.postMessage("set_log_level=error","*"))):cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR,"cadesplugin_api.js: Incorrect log_level: "+e)}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=5,cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1=93,cadesplugin.CADESCOM_PKCS7_TYPE=65535,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=1,cadesplugin.CADESCOM_AllowUntrustedCertificate=2,cadesplugin.CADESCOM_AllowUntrustedRoot=4,cadesplugin.CADESCOM_SkipInstallToStore=268435456}function async_spawn(e){function n(e,n){var a;try{a=t[e](n)}catch(e){return Promise.reject(e)}return a.done?a.value:Promise.resolve(a.value).then(r,_)}var t=e(Array.prototype.slice.call(arguments,1)),r=n.bind(n,"next"),_=n.bind(n,"throw");return r()}function isIE(){return"IE"===browserSpecs.name||"MSIE"===browserSpecs.name}function isIOS(){return navigator.userAgent.match(/ipod/i)||navigator.userAgent.match(/ipad/i)||navigator.userAgent.match(/iphone/i)}function isNativeMessageSupported(){return!isIE()&&("Edge"===browserSpecs.name?(isEdge=!0,!0):"Opera"===browserSpecs.name?(isOpera=!0,browserSpecs.version>=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(n){try{return document.getElementById("certEnrollClassFactory").CreateObject(e)}catch(e){throw"Для создания обьектов X509Enrollment следует настроить веб-узел на использование проверки подлинности по протоколу HTTPS"}}try{return document.getElementById("webClassFactory").CreateObject(e)}catch(n){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 n=e.message;return n?e.number&&(n+=" (0x"+decimalToHexString(e.number)+")"):n=e,n}function getLastError(e){if(isNativeMessageSupported()||isIE()||isIOS())return GetMessageFromException(e);try{return pluginObject.getLastError()}catch(n){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 n=e.data.substring(e.data.indexOf("url:")+4),t=document.createElement("script");t.setAttribute("type","text/javascript"),t.setAttribute("src",n),t.onerror=plugin_loaded_error,t.onload=firefox_or_edge_nmcades_onload,document.getElementsByTagName("head")[0].appendChild(t),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 n=document.createElement("object");n.setAttribute("id","certEnrollClassFactory"),n.setAttribute("classid","clsid:884e2049-217d-11da-b2a4-000e7bbb2b09"),n.setAttribute("style","visibility: hidden"),document.getElementsByTagName("body")[0].appendChild(n);var t=document.createElement("object");t.setAttribute("id","webClassFactory"),t.setAttribute("classid","clsid:B04C8637-10BD-484E-B0DA-B8A039F60024"),t.setAttribute("style","visibility: hidden"),document.getElementsByTagName("body")[0].appendChild(t)}}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(n){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&&_[_.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!_||a[1]>_[0]&&a[1]<_[3])){s.label=a[1];break}if(6===a[0]&&s.label<_[1]){s.label=_[1],_=a;break}if(_&&s.label<_[2]){s.label=_[2],s.ops.push(a);break}_[2]&&s.ops.pop(),s.trys.pop();continue}a=n.call(e,s)}catch(e){a=[6,e],r=0}finally{t=_=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}};Object.defineProperty(n,"__esModule",{value:!0});var s=t(3),i=t(0);n.getDecodedExtendedKeyUsage=i._afterPluginsLoaded((function(){return _(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.getExtendedKeyUsage()];case 1:return[2,e.sent().reduce((function(e,n){var t;return r(r({},e),((t={})[n]=s.OIDS_DICTIONARY[n]||null,t))}),{})]}}))}))}))},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _afterPluginsLoaded_1=__webpack_require__(0),_extractMeaningfulErrorMessage_1=__webpack_require__(1),_generateCadesFn_1=__webpack_require__(2);exports.getExtendedKeyUsage=_afterPluginsLoaded_1._afterPluginsLoaded((function(){var cadesCertificate=this._cadesCertificate;return eval(_generateCadesFn_1._generateCadesFn((function(){var e,n=[];try{if(e=_generateCadesFn_1.__cadesAsyncToken__+cadesCertificate.ExtendedKeyUsage(),e=_generateCadesFn_1.__cadesAsyncToken__+e.EKUs,(e=_generateCadesFn_1.__cadesAsyncToken__+e.Count)>0)for(;e>0;){var t=void 0;t=_generateCadesFn_1.__cadesAsyncToken__+cadesCertificate.ExtendedKeyUsage(),t=_generateCadesFn_1.__cadesAsyncToken__+t.EKUs,t=_generateCadesFn_1.__cadesAsyncToken__+t.Item(e),t=_generateCadesFn_1.__cadesAsyncToken__+t.OID,n.push(t),e--}}catch(e){throw console.error(e),new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(e)||"Ошибка при получении ОИД'ов")}return n})))}))},function(e,n,t){"use strict";var r=this&&this.__awaiter||function(e,n,t,r){return new(t||(t=Promise))((function(_,a){function s(e){try{o(r.next(e))}catch(e){a(e)}}function i(e){try{o(r.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?_(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,i)}o((r=r.apply(e,n||[])).next())}))},_=this&&this.__generator||function(e,n){var t,r,_,a,s={label:0,sent:function(){if(1&_[0])throw _[1];return _[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;s;)try{if(t=1,r&&(_=2&a[0]?r.return:a[0]?r.throw||((_=r.return)&&_.call(r),0):r.next)&&!(_=_.call(r,a[1])).done)return _;switch(r=0,_&&(a=[2&a[0],_.value]),a[0]){case 0:case 1:_=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(_=s.trys,(_=_.length>0&&_[_.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!_||a[1]>_[0]&&a[1]<_[3])){s.label=a[1];break}if(6===a[0]&&s.label<_[1]){s.label=_[1],_=a;break}if(_&&s.label<_[2]){s.label=_[2],s.ops.push(a);break}_[2]&&s.ops.pop(),s.trys.pop();continue}a=n.call(e,s)}catch(e){a=[6,e],r=0}finally{t=_=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}};Object.defineProperty(n,"__esModule",{value:!0});var a=t(0),s=t(1),i=t(22),o=t(6);n.getInfo=a._afterPluginsLoaded((function(e,n){return r(this,void 0,void 0,(function(){var t,r;return _(this,(function(_){switch(_.label){case 0:return _.trys.push([0,2,,3]),[4,o.getCadesProp.call(this,n)];case 1:return t=_.sent(),[3,3];case 2:throw r=_.sent(),console.error(r),new Error(s._extractMeaningfulErrorMessage(r)||"Ошибка при извлечении информации из сертификата");case 3:return[2,i._parseCertInfo(e,t)]}}))}))}))},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=t(3);n._parseCertInfo=function(e,n){var t=n.match(/([а-яА-Яa-zA-Z0-9\s.]+)=(?:("[^"]+?")|(.+?))(?:,|$)/g);if(t)return t.map((function(n){var t,_,a,s=n.trim().match(/^([а-яА-Яa-zA-Z0-9\s.]+)=(.+?),?$/),i=null==s?void 0:s[1],o=null===(_=null===(t=null==s?void 0:s[2])||void 0===t?void 0:t.replace(/^"(.*)"/,"$1"))||void 0===_?void 0:_.replace(/"{2}/g,'"'),c=null==i?void 0:i.match(/^OID\.(.*)/),l=null==c?void 0:c[1],u=!1;if(l){var d=r.OIDS_DICTIONARY[l];d&&(i=d,u=!0)}var C=null===(a=e.find((function(e){return e.possibleNames.find((function(e){return e===i}))})))||void 0===a?void 0:a.translation;return C&&(i=C,u=!0),{description:o,title:i,isTranslated:u}}))}},function(e,n,t){"use strict";var r=this&&this.__awaiter||function(e,n,t,r){return new(t||(t=Promise))((function(_,a){function s(e){try{o(r.next(e))}catch(e){a(e)}}function i(e){try{o(r.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?_(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,i)}o((r=r.apply(e,n||[])).next())}))},_=this&&this.__generator||function(e,n){var t,r,_,a,s={label:0,sent:function(){if(1&_[0])throw _[1];return _[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;s;)try{if(t=1,r&&(_=2&a[0]?r.return:a[0]?r.throw||((_=r.return)&&_.call(r),0):r.next)&&!(_=_.call(r,a[1])).done)return _;switch(r=0,_&&(a=[2&a[0],_.value]),a[0]){case 0:case 1:_=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(_=s.trys,(_=_.length>0&&_[_.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!_||a[1]>_[0]&&a[1]<_[3])){s.label=a[1];break}if(6===a[0]&&s.label<_[1]){s.label=_[1],_=a;break}if(_&&s.label<_[2]){s.label=_[2],s.ops.push(a);break}_[2]&&s.ops.pop(),s.trys.pop();continue}a=n.call(e,s)}catch(e){a=[6,e],r=0}finally{t=_=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}};Object.defineProperty(n,"__esModule",{value:!0});var a=t(0);n.hasExtendedKeyUsage=a._afterPluginsLoaded((function(e){return r(this,void 0,void 0,(function(){var n;return _(this,(function(t){switch(t.label){case 0:return[4,this.getExtendedKeyUsage()];case 1:return n=t.sent(),[2,Array.isArray(e)?e.every((function(e){return n.some((function(n){return n===e}))})):n.some((function(n){return n===e}))]}}))}))}))},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _afterPluginsLoaded_1=__webpack_require__(0),_extractMeaningfulErrorMessage_1=__webpack_require__(1),_generateCadesFn_1=__webpack_require__(2);exports.isValid=_afterPluginsLoaded_1._afterPluginsLoaded((function(){var cadesCertificate=this._cadesCertificate;return eval(_generateCadesFn_1._generateCadesFn((function(){var e;try{e=_generateCadesFn_1.__cadesAsyncToken__+cadesCertificate.IsValid(),e=_generateCadesFn_1.__cadesAsyncToken__+e.Result}catch(e){throw console.error(e),new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(e)||"Ошибка при проверке сертификата")}return Boolean(e)})))}))},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n._extractCommonName=function(e){var n;return null===(n=e.match(/CN=(.+?)(?:,|$)/))||void 0===n?void 0:n[1]}},function(e,n,t){"use strict";var r=this&&this.__awaiter||function(e,n,t,r){return new(t||(t=Promise))((function(_,a){function s(e){try{o(r.next(e))}catch(e){a(e)}}function i(e){try{o(r.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?_(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,i)}o((r=r.apply(e,n||[])).next())}))},_=this&&this.__generator||function(e,n){var t,r,_,a,s={label:0,sent:function(){if(1&_[0])throw _[1];return _[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;s;)try{if(t=1,r&&(_=2&a[0]?r.return:a[0]?r.throw||((_=r.return)&&_.call(r),0):r.next)&&!(_=_.call(r,a[1])).done)return _;switch(r=0,_&&(a=[2&a[0],_.value]),a[0]){case 0:case 1:_=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(_=s.trys,(_=_.length>0&&_[_.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!_||a[1]>_[0]&&a[1]<_[3])){s.label=a[1];break}if(6===a[0]&&s.label<_[1]){s.label=_[1],_=a;break}if(_&&s.label<_[2]){s.label=_[2],s.ops.push(a);break}_[2]&&s.ops.pop(),s.trys.pop();continue}a=n.call(e,s)}catch(e){a=[6,e],r=0}finally{t=_=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}};Object.defineProperty(n,"__esModule",{value:!0});var a=t(0),s=t(1),i=t(27),o=t(28),c=t(7);n.isValidSystemSetup=a._afterPluginsLoaded((function(){return r(void 0,void 0,void 0,(function(){var e,n;return _(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,c.getSystemInfo()];case 1:return e=t.sent(),[3,3];case 2:throw n=t.sent(),console.error(n),new Error(s._extractMeaningfulErrorMessage(n)||"Настройки ЭП на данной машине не верны");case 3:if(!i._isSupportedCadesVersion(e.cadesVersion))throw new Error("Не поддерживаемая версия плагина");if(!o._isSupportedCSPVersion(e.cspVersion))throw new Error("Не поддерживаемая версия CSP");return[2,!0]}}))}))}))},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n._isSupportedCadesVersion=function(e){var n=e.match(/(\d+)\.(\d+)\.(\d+)/);if(!n)return!1;var t=n[1],r=(n[2],n[3]);return!(Number(t)<2)&&!(2===Number(t)&&Number(r)<12438)}},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n._isSupportedCSPVersion=function(e){var n;return e=null===(n=e.match(/\d+?\b(?:\.\d+)?/))||void 0===n?void 0:n[0],Number(e)>=4}},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(e,n,t,r){return new(t||(t=Promise))((function(_,a){function s(e){try{o(r.next(e))}catch(e){a(e)}}function i(e){try{o(r.throw(e))}catch(e){a(e)}}function o(e){var n;e.done?_(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,i)}o((r=r.apply(e,n||[])).next())}))},__generator=this&&this.__generator||function(e,n){var t,r,_,a,s={label:0,sent:function(){if(1&_[0])throw _[1];return _[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;s;)try{if(t=1,r&&(_=2&a[0]?r.return:a[0]?r.throw||((_=r.return)&&_.call(r),0):r.next)&&!(_=_.call(r,a[1])).done)return _;switch(r=0,_&&(a=[2&a[0],_.value]),a[0]){case 0:case 1:_=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(_=s.trys,(_=_.length>0&&_[_.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!_||a[1]>_[0]&&a[1]<_[3])){s.label=a[1];break}if(6===a[0]&&s.label<_[1]){s.label=_[1],_=a;break}if(_&&s.label<_[2]){s.label=_[2],s.ops.push(a);break}_[2]&&s.ops.pop(),s.trys.pop();continue}a=n.call(e,s)}catch(e){a=[6,e],r=0}finally{t=_=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,i])}}};Object.defineProperty(exports,"__esModule",{value:!0});var constants_1=__webpack_require__(3),_afterPluginsLoaded_1=__webpack_require__(0),_extractMeaningfulErrorMessage_1=__webpack_require__(1),_generateCadesFn_1=__webpack_require__(2),_getCadesCert_1=__webpack_require__(30),_getDateObj_1=__webpack_require__(31);exports.createSignature=_afterPluginsLoaded_1._afterPluginsLoaded((function(thumbprint,dataBase64,detachedSignature){return void 0===detachedSignature&&(detachedSignature=!0),__awaiter(void 0,void 0,void 0,(function(){var cadesplugin,cadesCertificate;return __generator(this,(function(_a){switch(_a.label){case 0:return cadesplugin=window.cadesplugin,[4,_getCadesCert_1._getCadesCert(thumbprint)];case 1:return cadesCertificate=_a.sent(),[2,eval(_generateCadesFn_1._generateCadesFn((function(){var e,n,t;try{e=_generateCadesFn_1.__cadesAsyncToken__+_generateCadesFn_1.__createCadesPluginObject__("CADESCOM.CPAttribute"),n=_generateCadesFn_1.__cadesAsyncToken__+_generateCadesFn_1.__createCadesPluginObject__("CAdESCOM.CadesSignedData"),t=_generateCadesFn_1.__cadesAsyncToken__+_generateCadesFn_1.__createCadesPluginObject__("CAdESCOM.CPSigner")}catch(e){throw console.error(e),new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(e)||"Ошибка при инициализации подписи")}var r,_,a=_getDateObj_1._getDateObj(new Date);try{_generateCadesFn_1.__cadesAsyncToken__,e.propset_Name(constants_1.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME),_generateCadesFn_1.__cadesAsyncToken__,e.propset_Value(a)}catch(e){throw console.error(e),new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(e)||"Ошибка при установке времени подписи")}try{_generateCadesFn_1.__cadesAsyncToken__,t.propset_Certificate(cadesCertificate),r=_generateCadesFn_1.__cadesAsyncToken__+t.AuthenticatedAttributes2,_generateCadesFn_1.__cadesAsyncToken__,r.Add(e),_generateCadesFn_1.__cadesAsyncToken__,n.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY),_generateCadesFn_1.__cadesAsyncToken__,n.propset_Content(dataBase64),_generateCadesFn_1.__cadesAsyncToken__,t.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY)}catch(e){throw console.error(e),new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(e)||"Ошибка при указании данных для подписи")}try{_=_generateCadesFn_1.__cadesAsyncToken__+n.SignCades(t,cadesplugin.CADESCOM_CADES_BES,detachedSignature)}catch(e){throw console.error(e),new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(e)||"Ошибка при подписании данных")}return _})))]}}))}))}))},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _afterPluginsLoaded_1=__webpack_require__(0),_extractMeaningfulErrorMessage_1=__webpack_require__(1),_generateCadesFn_1=__webpack_require__(2);exports._getCadesCert=_afterPluginsLoaded_1._afterPluginsLoaded((function(thumbprint){var cadesplugin=window.cadesplugin;return eval(_generateCadesFn_1._generateCadesFn((function(){var e,n,t,r;try{e=_generateCadesFn_1.__cadesAsyncToken__+_generateCadesFn_1.__createCadesPluginObject__("CAdESCOM.Store")}catch(e){throw console.error(e),new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(e)||"Ошибка при попытке доступа к хранилищу")}if(!e)throw new Error("Не удалось получить доступ к хранилищу сертификатов");try{_generateCadesFn_1.__cadesAsyncToken__,e.Open(cadesplugin.CAPICOM_CURRENT_USER_STORE,cadesplugin.CAPICOM_MY_STORE,cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED)}catch(e){throw console.error(e),new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(e)||"Ошибка при открытии хранилища")}try{n=_generateCadesFn_1.__cadesAsyncToken__+e.Certificates,t=_generateCadesFn_1.__cadesAsyncToken__+n.Count}catch(e){throw console.error(e),new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(e)||"Ошибка получения списка сертификатов")}if(!t)throw new Error("Нет доступных сертификатов");try{if(n=_generateCadesFn_1.__cadesAsyncToken__+n.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH,thumbprint),!(_generateCadesFn_1.__cadesAsyncToken__+n.Count))throw new Error('Сертификат с отпечатком: "'+thumbprint+'" не найден');r=_generateCadesFn_1.__cadesAsyncToken__+n.Item(1)}catch(e){throw console.error(e),new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(e)||"Ошибка при получении сертификата")}return e.Close(),r})))}))},function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n._getDateObj=function(e){return e.getVarDate?e.getVarDate():e}}])})); -//# sourceMappingURL=crypto-pro.min.js.map \ No newline at end of file +!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=8)}([function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(a,i){function o(e){try{_(n.next(e))}catch(e){i(e)}}function s(e){try{_(n.throw(e))}catch(e){i(e)}}function _(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}_((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,a,i,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[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!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[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,i){function o(e){try{_(n.next(e))}catch(e){i(e)}}function s(e){try{_(n.throw(e))}catch(e){i(e)}}function _(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}_((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,a,i,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[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,i){function o(e){try{_(n.next(e))}catch(e){i(e)}}function s(e){try{_(n.throw(e))}catch(e){i(e)}}function _(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}_((n=n.apply(e,t||[])).next())}))},__generator=this&&this.__generator||function(e,t){var r,n,a,i,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(a=2&i[0]?n.return:i[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,i[1])).done)return a;switch(n=0,a&&(i=[2&i[0],a.value]),i[0]){case 0:case 1:a=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(a=o.trys,(a=a.length>0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1]0&&a[a.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!a||i[1]>a[0]&&i[1] + * @license MIT + */ +var n=r(35),a=r(36),i=r(37);function o(){return _.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function p(e,t){if(_.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 b(this,t,r);case"ascii":return P(this,t,r);case"latin1":case"binary":return w(this,t,r);case"base64":return S(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function E(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function C(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=_.from(t,n)),_.isBuffer(t))return 0===t.length?-1:h(e,t,r,n,a);if("number"==typeof t)return t&=255,_.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 i,o=1,s=e.length,_=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;o=2,s/=2,_/=2,r/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(a){var u=-1;for(i=r;is&&(r=s-_),i=r;i>=0;i--){for(var l=!0,d=0;d<_;d++)if(c(e,i+d)!==c(t,d)){l=!1;break}if(l)return i}return-1}function A(e,t,r,n){r=Number(r)||0;var a=e.length-r;n?(n=Number(n))>a&&(n=a):n=a;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var o=0;o>8,a=r%256,i.push(a),i.push(n);return i}(t,e.length-r),e,r,n)}function S(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function b(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&(i=e[a+1]))&&(_=(31&c)<<6|63&i)>127&&(u=_);break;case 3:i=e[a+1],o=e[a+2],128==(192&i)&&128==(192&o)&&(_=(15&c)<<12|(63&i)<<6|63&o)>2047&&(_<55296||_>57343)&&(u=_);break;case 4:i=e[a+1],o=e[a+2],s=e[a+3],128==(192&i)&&128==(192&o)&&128==(192&s)&&(_=(15&c)<<18|(63&i)<<12|(63&o)<<6|63&s)>65535&&_<1114112&&(u=_)}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+=" ... ")),""},_.prototype.compare=function(e,t,r,n,a){if(!_.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 i=(a>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),s=Math.min(i,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 i=!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 I(this,e,t,r);case"latin1":case"binary":return T(this,e,t,r);case"base64":return y(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},_.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function P(e,t,r){var n="";r=Math.min(e.length,r);for(var a=t;an)&&(r=n);for(var a="",i=t;ir)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,r,n,a,i){if(!_.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 D(e,t,r,n){t<0&&(t=65535+t+1);for(var a=0,i=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,i=Math.min(e.length-r,4);a>>8*(n?a:3-a)&255}function x(e,t,r,n,a,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function U(e,t,r,n,i){return i||x(e,0,r,4),a.write(e,t,r,n,23,4),r+4}function F(e,t,r,n,i){return i||x(e,0,r,8),a.write(e,t,r,n,52,8),r+8}_.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},_.prototype.readUInt8=function(e,t){return t||m(e,1,this.length),this[e]},_.prototype.readUInt16LE=function(e,t){return t||m(e,2,this.length),this[e]|this[e+1]<<8},_.prototype.readUInt16BE=function(e,t){return t||m(e,2,this.length),this[e]<<8|this[e+1]},_.prototype.readUInt32LE=function(e,t){return t||m(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},_.prototype.readUInt32BE=function(e,t){return t||m(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},_.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||m(e,t,this.length);for(var n=this[e],a=1,i=0;++i=(a*=128)&&(n-=Math.pow(2,8*t)),n},_.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||m(e,t,this.length);for(var n=t,a=1,i=this[e+--n];n>0&&(a*=256);)i+=this[e+--n]*a;return i>=(a*=128)&&(i-=Math.pow(2,8*t)),i},_.prototype.readInt8=function(e,t){return t||m(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},_.prototype.readInt16LE=function(e,t){t||m(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},_.prototype.readInt16BE=function(e,t){t||m(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},_.prototype.readInt32LE=function(e,t){return t||m(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},_.prototype.readInt32BE=function(e,t){return t||m(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},_.prototype.readFloatLE=function(e,t){return t||m(e,4,this.length),a.read(this,e,!0,23,4)},_.prototype.readFloatBE=function(e,t){return t||m(e,4,this.length),a.read(this,e,!1,23,4)},_.prototype.readDoubleLE=function(e,t){return t||m(e,8,this.length),a.read(this,e,!0,52,8)},_.prototype.readDoubleBE=function(e,t){return t||m(e,8,this.length),a.read(this,e,!1,52,8)},_.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||N(this,e,t,r,Math.pow(2,8*r)-1,0);var a=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+a]=e/i&255;return t+r},_.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,1,255,0),_.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},_.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,2,65535,0),_.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},_.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,2,65535,0),_.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},_.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,4,4294967295,0),_.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},_.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,4,4294967295,0),_.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},_.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);N(this,e,t,r,a-1,-a)}var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},_.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var a=Math.pow(2,8*r-1);N(this,e,t,r,a-1,-a)}var i=r-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},_.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,1,127,-128),_.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},_.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,2,32767,-32768),_.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},_.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,2,32767,-32768),_.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},_.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,4,2147483647,-2147483648),_.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},_.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),_.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},_.prototype.writeFloatLE=function(e,t,r){return U(this,e,t,!0,r)},_.prototype.writeFloatBE=function(e,t,r){return U(this,e,t,!1,r)},_.prototype.writeDoubleLE=function(e,t,r){return F(this,e,t,!0,r)},_.prototype.writeDoubleBE=function(e,t,r){return F(this,e,t,!1,r)},_.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(i<1e3||!_.TYPED_ARRAY_SUPPORT)for(a=0;a>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&r<57344){if(!a){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(t-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function G(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(k,"")).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(34))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=c(e),o=n[0],s=n[1],_=new i(function(e,t,r){return 3*(t+r)/4-r}(0,o,s)),u=0,l=s>0?o-4:o;for(r=0;r>16&255,_[u++]=t>>8&255,_[u++]=255&t;2===s&&(t=a[e.charCodeAt(r)]<<2|a[e.charCodeAt(r+1)]>>4,_[u++]=255&t);1===s&&(t=a[e.charCodeAt(r)]<<10|a[e.charCodeAt(r+1)]<<4|a[e.charCodeAt(r+2)]>>2,_[u++]=t>>8&255,_[u++]=255&t);return _},t.fromByteArray=function(e){for(var t,r=e.length,a=r%3,i=[],o=0,s=r-a;os?s:o+16383));1===a?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===a&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],a=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,_=o.length;s<_;++s)n[s]=o[s],a[o.charCodeAt(s)]=s;function c(e){var t=e.length;if(t%4>0)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,i,o=[],s=t;s>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return o.join("")}a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,r,n,a){var i,o,s=8*a-n-1,_=(1<>1,u=-7,l=r?a-1:0,d=r?-1:1,f=e[t+l];for(l+=d,i=f&(1<<-u)-1,f>>=-u,u+=s;u>0;i=256*i+e[t+l],l+=d,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=n;u>0;o=256*o+e[t+l],l+=d,u-=8);if(0===i)i=1-c;else{if(i===_)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),i-=c}return(f?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,s,_,c=8*i-a-1,u=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:i-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?(s=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(_=Math.pow(2,-o))<1&&(o--,_*=2),(t+=o+l>=1?d/_:d*Math.pow(2,1-l))*_>=2&&(o++,_/=2),o+l>=u?(s=0,o=u):o+l>=1?(s=(t*_-1)*Math.pow(2,a),o+=l):(s=t*Math.pow(2,l-1)*Math.pow(2,a),o=0));a>=8;e[r+f]=255&s,f+=p,s/=256,a-=8);for(o=o<0;e[r+f]=255&o,f+=p,o/=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)}}])})); +//# sourceMappingURL=crypto-pro.min.js.map diff --git a/dist/crypto-pro.min.js.map b/dist/crypto-pro.min.js.map index 80808ee..d50f2d7 100644 --- a/dist/crypto-pro.min.js.map +++ b/dist/crypto-pro.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://cryptoPro/webpack/universalModuleDefinition","webpack://cryptoPro/webpack/bootstrap","webpack://cryptoPro/./helpers/_afterPluginsLoaded.ts","webpack://cryptoPro/./helpers/_extractMeaningfulErrorMessage.ts","webpack://cryptoPro/./helpers/_generateCadesFn.ts","webpack://cryptoPro/./constants/index.ts","webpack://cryptoPro/./api/getUserCertificates.ts","webpack://cryptoPro/./api/certificate/index.ts","webpack://cryptoPro/./api/certificate/getCadesProp.ts","webpack://cryptoPro/./api/getSystemInfo.ts","webpack://cryptoPro/./crypto-pro.ts","webpack://cryptoPro/./api/index.ts","webpack://cryptoPro/./api/getCertificate.ts","webpack://cryptoPro/./vendor/cadesplugin_api.js","webpack://cryptoPro/./api/certificate/certificate.ts","webpack://cryptoPro/./constants/cades-constants.ts","webpack://cryptoPro/./constants/issuer-tags-translations.ts","webpack://cryptoPro/./constants/oids-dictionary.ts","webpack://cryptoPro/./constants/subject-tags-translations.ts","webpack://cryptoPro/./api/certificate/exportBase64.ts","webpack://cryptoPro/./api/certificate/getAlgorithm.ts","webpack://cryptoPro/./api/certificate/getDecodedExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/getExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/getInfo.ts","webpack://cryptoPro/./helpers/_parseCertInfo.ts","webpack://cryptoPro/./api/certificate/hasExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/isValid.ts","webpack://cryptoPro/./helpers/_extractCommonName.ts","webpack://cryptoPro/./api/isValidSystemSetup.ts","webpack://cryptoPro/./helpers/_isSupportedCadesVersion.ts","webpack://cryptoPro/./helpers/_isSupportedCSPVersion.ts","webpack://cryptoPro/./api/createSignature.ts","webpack://cryptoPro/./helpers/_getCadesCert.ts","webpack://cryptoPro/./helpers/_getDateObj.ts"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","isSetLogLevel","isPluginLoaded","_afterPluginsLoaded","fn","canPromise","Boolean","Promise","error","console","Error","_extractMeaningfulErrorMessage","cadesplugin","set_log_level","LOG_LEVEL_ERROR","apply","this","args","errorContainer","getLastError","message","test","searchResult","match","__cadesAsyncToken__","__createCadesPluginObject__","_generateCadesFn","callback","cadesGeneratorsAPI","CreateObjectAsync","callbackName","callbackLiteral","String","callbackArguments","callbackBody","replace","crossEnvCallbackLiteral","Function","join","certificatesCache","getUserCertificates","resetCache","eval","cadesStore","cadesCertificates","cadesCertificatesCount","Open","CAPICOM_CURRENT_USER_STORE","CAPICOM_MY_STORE","CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED","Certificates","Find","CAPICOM_CERTIFICATE_FIND_TIME_VALID","CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY","CAPICOM_PROPID_KEY_PROV_INFO","Count","certificateList","cadesCertificate","Item","push","Certificate","_extractCommonName","SubjectName","IssuerName","Thumbprint","ValidFromDate","ValidToDate","Close","getCadesProp","propName","_cadesCertificate","propertyValue","getSystemInfo","sysInfo","cadesVersion","cspVersion","cadesAbout","PluginVersion","CSPVersion","Version","toString","getCertificate","thumbprint","availableCertificates","foundCertificate","find","cert","pluginObject","plugin_resolved","plugin_reject","plugin_resolve","isOpera","isFireFox","isEdge","isSafari","failed_extensions","resolve","reject","browserSpecs","check_browser","ru_cryptopro_npcades_10_native_bridge","callbacksCount","callbacks","resultForCallback","callbackId","resultArray","functionName","hasCallback","iframe","document","createElement","arrObjs","Array","setAttribute","encodeURIComponent","JSON","stringify","e","alert","documentElement","appendChild","parentNode","removeChild","JSModuleVersion","async_spawn","set","set_pluginObject","is_capilite_enabled","isNativeMessageSupported","ReleasePluginObjects","CreateObject","cadesplugin_load_timeout","setTimeout","check_load_timeout","set_constantValues","current_log_level","check_plugin_working","tem","ua","navigator","userAgent","M","version","exec","appName","appVersion","splice","cpcsp_console_log","level","msg","LOG_LEVEL_DEBUG","log","LOG_LEVEL_INFO","info","postMessage","CAPICOM_LOCAL_MACHINE_STORE","CADESCOM_LOCAL_MACHINE_STORE","CADESCOM_CURRENT_USER_STORE","CADESCOM_CONTAINER_STORE","CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME","CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED","CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING","CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE","XmlDsigGost3410UrlObsolete","XmlDsigGost3411UrlObsolete","XmlDsigGost3410Url","XmlDsigGost3411Url","CADESCOM_CADES_DEFAULT","CADESCOM_CADES_BES","CADESCOM_CADES_T","CADESCOM_CADES_X_LONG_TYPE_1","CADESCOM_PKCS7_TYPE","CADESCOM_ENCODE_BASE64","CADESCOM_ENCODE_BINARY","CADESCOM_ENCODE_ANY","CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT","CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN","CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY","CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME","CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME","CAPICOM_CERTIFICATE_FIND_SHA1_HASH","CAPICOM_CERTIFICATE_FIND_ISSUER_NAME","CAPICOM_CERTIFICATE_FIND_ROOT_NAME","CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME","CAPICOM_CERTIFICATE_FIND_EXTENSION","CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY","CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY","CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID","CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED","CAPICOM_CERTIFICATE_FIND_KEY_USAGE","CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE","CAPICOM_PROPID_ENHKEY_USAGE","CAPICOM_OID_OTHER","CAPICOM_OID_KEY_USAGE_EXTENSION","CAPICOM_EKU_CLIENT_AUTH","CAPICOM_EKU_SMARTCARD_LOGON","CAPICOM_EKU_OTHER","CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME","CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME","CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION","CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME","CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME","CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION","CADESCOM_ATTRIBUTE_OTHER","CADESCOM_STRING_TO_UCS2LE","CADESCOM_BASE64_TO_BINARY","CADESCOM_DISPLAY_DATA_NONE","CADESCOM_DISPLAY_DATA_CONTENT","CADESCOM_DISPLAY_DATA_ATTRIBUTE","CADESCOM_ENCRYPTION_ALGORITHM_RC2","CADESCOM_ENCRYPTION_ALGORITHM_RC4","CADESCOM_ENCRYPTION_ALGORITHM_DES","CADESCOM_ENCRYPTION_ALGORITHM_3DES","CADESCOM_ENCRYPTION_ALGORITHM_AES","CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89","CADESCOM_HASH_ALGORITHM_SHA1","CADESCOM_HASH_ALGORITHM_MD2","CADESCOM_HASH_ALGORITHM_MD4","CADESCOM_HASH_ALGORITHM_MD5","CADESCOM_HASH_ALGORITHM_SHA_256","CADESCOM_HASH_ALGORITHM_SHA_384","CADESCOM_HASH_ALGORITHM_SHA_512","CADESCOM_HASH_ALGORITHM_CP_GOST_3411","CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256","CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512","CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC","CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC","CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC","CADESCOM_AllowNone","CADESCOM_AllowNoOutstandingRequest","CADESCOM_AllowUntrustedCertificate","CADESCOM_AllowUntrustedRoot","CADESCOM_SkipInstallToStore","generatorFunc","continuer","verb","arg","result","generator","err","done","then","onFulfilled","onRejected","slice","arguments","isIE","isIOS","call_ru_cryptopro_npcades_10_native_bridge","getElementById","ActiveXObject","decimalToHexString","number","toUpperCase","GetMessageFromException","exception","cpcsp_chrome_nmcades","array","tmpobj","ex","response","str","show_firefox_missing_extension_dialog","cadesplugin_skip_extension_install","ovr","id","style","innerHTML","getElementsByTagName","addEventListener","plugin_loaded_error","visibility","install_opera_extension","event","opr","addons","installExtension","location","reload","stopPropagation","firefox_or_edge_nmcades_onload","check_chrome_plugin","plugin_loaded","nmcades_api_onload","data","url","substring","indexOf","fileref","onerror","onload","load_extension","load_npapi_plugin","elem","elem1","elem2","createPromise","check_npapi_plugin","display","mimetype","mimeTypes","enabledPlugin","div","length","readyState","obj","EnableInternalCSP","issuerName","subjectName","validFrom","validTo","getOwnerInfo","getInfo","SUBJECT_TAGS_TRANSLATIONS","getIssuerInfo","ISSUER_TAGS_TRANSLATIONS","getExtendedKeyUsage","getDecodedExtendedKeyUsage","getAlgorithm","isValid","exportBase64","hasExtendedKeyUsage","oids","CAPICOM_ACTIVE_DIRECTORY_USER_STORE","CAPICOM_MEMORY_STORE","CAPICOM_PROPID_ACCESS_STATE","CAPICOM_PROPID_ARCHIVED","CAPICOM_PROPID_ARCHIVED_KEY_HASH","CAPICOM_PROPID_AUTO_ENROLL","CAPICOM_PROPID_CROSS_CERT_DIST_POINTS","CAPICOM_PROPID_CTL_USAGE","CAPICOM_PROPID_DATE_STAMP","CAPICOM_PROPID_DESCRIPTION","CAPICOM_PROPID_EFS","CAPICOM_PROPID_ENROLLMENT","CAPICOM_PROPID_EXTENDED_ERROR_INFO","CAPICOM_PROPID_FIRST_RESERVED","CAPICOM_PROPID_FIRST_USER","CAPICOM_PROPID_FORTEZZA_DATA","CAPICOM_PROPID_FRIENDLY_NAME","CAPICOM_PROPID_HASH_PROP","CAPICOM_PROPID_IE30_RESERVED","CAPICOM_PROPID_ISSUER_PUBLIC_KEY_MD5_HASH","CAPICOM_PROPID_ISSUER_SERIAL_NUMBER_MD5_HASH","CAPICOM_PROPID_KEY_CONTEXT","CAPICOM_PROPID_KEY_IDENTIFIER","CAPICOM_PROPID_KEY_PROV_HANDLE","CAPICOM_PROPID_KEY_SPEC","CAPICOM_PROPID_LAST_RESERVED","CAPICOM_PROPID_LAST_USER","CAPICOM_PROPID_MD5_HASH","CAPICOM_PROPID_NEXT_UPDATE_LOCATION","CAPICOM_PROPID_PUBKEY_ALG_PARA","CAPICOM_PROPID_PUBKEY_HASH_RESERVED","CAPICOM_PROPID_PVK_FILE","CAPICOM_PROPID_RENEWAL","CAPICOM_PROPID_SHA1_HASH","CAPICOM_PROPID_SIGNATURE_HASH","CAPICOM_PROPID_SMART_CARD_DATA","CAPICOM_PROPID_SUBJECT_NAME_MD5_HASH","CAPICOM_PROPID_SUBJECT_PUBLIC_KEY_MD5_HASH","CAPICOM_PROPID_UNKNOWN","CAPICOM_SMART_CARD_USER_STORE","CAPICOM_STORE_OPEN_EXISTING_ONLY","CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED","CAPICOM_STORE_OPEN_READ_ONLY","CAPICOM_STORE_OPEN_READ_WRITE","CHECK_NONE","CHECK_OFFLINE_REVOCATION_STATUS","CHECK_ONLINE_REVOCATION_STATUS","CHECK_SIGNATURE_VALIDITY","CHECK_TIME_VALIDITY","CHECK_TRUSTED_ROOT","TRUST_CTL_IS_NOT_SIGNATURE_VALID","TRUST_CTL_IS_NOT_TIME_VALID","TRUST_CTL_IS_NOT_VALID_FOR_USAGE","TRUST_IS_CYCLIC","TRUST_IS_NOT_SIGNATURE_VALID","TRUST_IS_NOT_TIME_NESTED","TRUST_IS_NOT_TIME_VALID","TRUST_IS_NOT_VALID_FOR_USAGE","TRUST_IS_PARTIAL_CHAIN","TRUST_IS_REVOKED","TRUST_IS_UNTRUSTED_ROOT","TRUST_REVOCATION_STATUS_UNKNOWN","possibleNames","translation","OIDS_DICTIONARY","base64","Export","cadesPublicKey","algorithmInfo","algorithm","oid","PublicKey","Algorithm","FriendlyName","Value","reduce","decodedOids","oidCode","count","OIDS","ExtendedKeyUsage","EKUs","cadesExtendedKeyUsage","OID","tags","entitiesPath","entities","_parseCertInfo","tagsTranslations","rawInfo","extractedEntities","map","group","segmentsMatch","trim","title","description","oidIdentifierMatch","oidIdentifier","isTranslated","oidTranslation","tagTranslation","tag","certOids","isArray","every","oidToCheck","some","certOid","IsValid","Result","isValidSystemSetup","systemInfo","_isSupportedCadesVersion","_isSupportedCSPVersion","major","patch","Number","createSignature","dataBase64","detachedSignature","_getCadesCert","cadesAttrs","cadesSignedData","cadesSigner","cadesAuthAttrs","signature","currentTime","_getDateObj","Date","propset_Name","propset_Value","propset_Certificate","AuthenticatedAttributes2","Add","propset_ContentEncoding","propset_Content","propset_Options","SignCades","cadesCertificateList","certificatesCount","dateObj","getVarDate"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,YAAa,GAAIH,GACE,iBAAZC,QACdA,QAAmB,UAAID,IAEvBD,EAAgB,UAAIC,IARtB,CASGK,QAAQ,WACX,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUP,QAGnC,IAAIC,EAASI,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHT,QAAS,IAUV,OANAU,EAAQH,GAAUI,KAAKV,EAAOD,QAASC,EAAQA,EAAOD,QAASM,GAG/DL,EAAOQ,GAAI,EAGJR,EAAOD,QA0Df,OArDAM,EAAoBM,EAAIF,EAGxBJ,EAAoBO,EAAIR,EAGxBC,EAAoBQ,EAAI,SAASd,EAASe,EAAMC,GAC3CV,EAAoBW,EAAEjB,EAASe,IAClCG,OAAOC,eAAenB,EAASe,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEV,EAAoBgB,EAAI,SAAStB,GACX,oBAAXuB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAenB,EAASuB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAenB,EAAS,aAAc,CAAEyB,OAAO,KAQvDnB,EAAoBoB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQnB,EAAoBmB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFAxB,EAAoBgB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,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EAAWwB,QAEJV,U,8EC7EF,EAAA0Y,YAAc,SAACa,GAAkB,OAACA,EAAQC,WAAaD,EAAQC,aAAeD","file":"crypto-pro.min.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 = 8);\n","import { _extractMeaningfulErrorMessage } from './_extractMeaningfulErrorMessage';\n\ntype Unpromisify = T extends Promise ? R : T;\n\nlet isSetLogLevel = false;\nlet isPluginLoaded = false;\n\nexport const _afterPluginsLoaded = any>(\n fn: T,\n): ((...args: Parameters) => Promise>>) => {\n const canPromise = Boolean(window.Promise);\n\n return async function (...args: Parameters): Promise>> {\n if (!isPluginLoaded) {\n try {\n require('../vendor/cadesplugin_api');\n } catch (error) {\n console.error(error);\n\n throw new Error(\n _extractMeaningfulErrorMessage(error) || 'Ошибка при подключении модуля для работы с Cades plugin',\n );\n }\n\n isPluginLoaded = true;\n }\n\n const { cadesplugin } = window;\n\n if (!canPromise) {\n throw new Error('Необходим полифилл для Promise');\n }\n\n if (!cadesplugin) {\n throw new Error('Не подключен модуль для работы с Cades plugin');\n }\n\n if (!isSetLogLevel) {\n cadesplugin.set_log_level(cadesplugin.LOG_LEVEL_ERROR);\n\n isSetLogLevel = true;\n }\n\n try {\n await cadesplugin;\n } catch (error) {\n console.error(error);\n\n throw new Error(\n _extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации модуля для работы с Cades plugin',\n );\n }\n\n return await fn.apply(this, args);\n };\n};\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)|(?:\\.?$))/);\n\n return searchResult ? searchResult[1] : null;\n};\n","// синтетические переменные, которые подменяются в рантайме\nexport const __cadesAsyncToken__ = {};\nexport const __createCadesPluginObject__ = (...args): any => ({});\n\nfunction getGeneratorConstructor(): GeneratorFunction {\n return new Function('', 'return Object.getPrototypeOf(function*(){}).constructor')();\n}\n\nexport const _generateCadesFn = (callback: Function): string => {\n const { cadesplugin } = window;\n const cadesGeneratorsAPI = Boolean(cadesplugin.CreateObjectAsync);\n const callbackName = callback.name || 'dynamicFn';\n const callbackLiteral = String(callback);\n const callbackArguments = callbackLiteral.match(/^function[\\s\\w]*?\\((.*?)\\)/)?.[1] || '';\n const callbackBody = callbackLiteral.replace(/^.*?{([\\s\\S]*?)}$/, '$1');\n let crossEnvCallbackLiteral = String(\n new (cadesGeneratorsAPI ? getGeneratorConstructor() : Function)(callbackArguments, callbackBody),\n );\n\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(\n /\\w+?\\.__createCadesPluginObject__(\\([\\s\\S]*?\\))/gm,\n `cadesplugin.CreateObject${cadesGeneratorsAPI ? 'Async' : ''}$1`,\n );\n\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(\n /\\w+?\\.__cadesAsyncToken__\\s*?\\+\\s*?\\b/gm,\n cadesGeneratorsAPI ? 'yield ' : '',\n );\n\n if (!cadesGeneratorsAPI) {\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/propset_(.*?)\\((.*?)\\)/gm, '$1 = $2');\n }\n\n return [\n cadesGeneratorsAPI ? `cadesplugin.async_spawn(${crossEnvCallbackLiteral});` : `(${crossEnvCallbackLiteral})();`,\n `//# sourceURL=crypto-pro_${callbackName}.js`,\n ].join('');\n};\n","export * from './cades-constants';\nexport * from './issuer-tags-translations';\nexport * from './oids-dictionary';\nexport * from './subject-tags-translations';\n","import { CadesCertificate, Certificate } from './certificate';\nimport { CAPICOM_PROPID_KEY_PROV_INFO } from '../constants';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractCommonName } from '../helpers/_extractCommonName';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\nlet certificatesCache: Certificate[];\n\n/**\n * Возвращает список сертификатов, доступных пользователю в системе\n *\n * @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов\n * @returns список сертификатов\n */\nexport const getUserCertificates = _afterPluginsLoaded((resetCache: boolean = false): Certificate[] => {\n const { cadesplugin } = window;\n\n if (!resetCache && certificatesCache) {\n return certificatesCache;\n }\n\n return eval(\n _generateCadesFn(function getUserCertificates(): Certificate[] {\n let cadesStore;\n\n try {\n cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');\n }\n\n try {\n void (\n __cadesAsyncToken__ +\n cadesStore.Open(\n cadesplugin.CAPICOM_CURRENT_USER_STORE,\n cadesplugin.CAPICOM_MY_STORE,\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,\n )\n );\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');\n }\n\n let cadesCertificates;\n let cadesCertificatesCount;\n\n try {\n cadesCertificates = __cadesAsyncToken__ + cadesStore.Certificates;\n\n if (cadesCertificates) {\n cadesCertificates =\n __cadesAsyncToken__ + cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID);\n\n /**\n * Не рассматриваются сертификаты, в которых отсутствует закрытый ключ\n * или не действительны на данный момент\n */\n cadesCertificates =\n __cadesAsyncToken__ +\n cadesCertificates.Find(\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY,\n CAPICOM_PROPID_KEY_PROV_INFO,\n );\n\n cadesCertificatesCount = __cadesAsyncToken__ + cadesCertificates.Count;\n }\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');\n }\n\n if (!cadesCertificatesCount) {\n throw new Error('Нет доступных сертификатов');\n }\n\n const certificateList: Certificate[] = [];\n\n try {\n while (cadesCertificatesCount) {\n const cadesCertificate: CadesCertificate =\n __cadesAsyncToken__ + cadesCertificates.Item(cadesCertificatesCount);\n\n certificateList.push(\n new Certificate(\n cadesCertificate,\n _extractCommonName(__cadesAsyncToken__ + cadesCertificate.SubjectName),\n __cadesAsyncToken__ + cadesCertificate.IssuerName,\n __cadesAsyncToken__ + cadesCertificate.SubjectName,\n __cadesAsyncToken__ + cadesCertificate.Thumbprint,\n __cadesAsyncToken__ + cadesCertificate.ValidFromDate,\n __cadesAsyncToken__ + cadesCertificate.ValidToDate,\n ),\n );\n\n cadesCertificatesCount--;\n }\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка обработки сертификатов');\n }\n\n cadesStore.Close();\n\n certificatesCache = certificateList;\n\n return certificatesCache;\n }),\n );\n});\n","export * from './certificate';\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Возвращает указанное внутренее свойство у сертификата в формате Cades\n *\n * @param propName = наименование свойства\n * @returns значение запрошенного свойства\n */\nexport const getCadesProp = _afterPluginsLoaded(function (propName: string): any {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function getCadesProp() {\n let propertyValue;\n\n try {\n propertyValue = __cadesAsyncToken__ + cadesCertificate[propName];\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при обращении к свойству сертификата');\n }\n\n return propertyValue;\n }),\n );\n});\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\nexport interface SystemInfo {\n cadesVersion: string;\n cspVersion: string;\n}\n\n/**\n * Предоставляет информацию о системе\n *\n * @returns информацию о CSP и плагине\n */\nexport const getSystemInfo = _afterPluginsLoaded(\n (): SystemInfo => {\n const sysInfo = {\n cadesVersion: null,\n cspVersion: null,\n };\n\n return eval(\n _generateCadesFn(function getSystemInfo(): SystemInfo {\n let cadesAbout;\n\n try {\n cadesAbout = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.About');\n\n sysInfo.cadesVersion = __cadesAsyncToken__ + cadesAbout.PluginVersion;\n sysInfo.cspVersion = __cadesAsyncToken__ + cadesAbout.CSPVersion();\n\n if (!sysInfo.cadesVersion) {\n sysInfo.cadesVersion = __cadesAsyncToken__ + cadesAbout.Version;\n }\n\n sysInfo.cadesVersion = __cadesAsyncToken__ + sysInfo.cadesVersion.toString();\n sysInfo.cspVersion = __cadesAsyncToken__ + sysInfo.cspVersion.toString();\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении информации о системе');\n }\n\n return sysInfo;\n }),\n );\n },\n);\n","export * from './api';\n","export * from './getCertificate';\nexport * from './getUserCertificates';\nexport * from './getSystemInfo';\nexport * from './isValidSystemSetup';\nexport * from './createSignature';\nexport * from './certificate';\n","import { Certificate } from './certificate';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { getUserCertificates } from './getUserCertificates';\n\n/**\n * Возвращает сертификат по отпечатку\n *\n * @param thumbprint - отпечаток сертификата\n * @returns сертификат\n */\nexport const getCertificate = _afterPluginsLoaded(\n async (thumbprint: string): Promise => {\n if (!thumbprint) {\n throw new Error('Отпечаток не указан');\n }\n\n const availableCertificates: Certificate[] = await getUserCertificates();\n const foundCertificate: Certificate = availableCertificates.find((cert) => cert.thumbprint === thumbprint);\n\n if (!foundCertificate) {\n throw new Error(`Сертификат с отпечатком: \"${thumbprint}\" не найден`);\n }\n\n return foundCertificate;\n },\n);\n",";(function () {\n //already loaded\n if(window.cadesplugin)\n return;\n\n var pluginObject;\n var plugin_resolved = 0;\n var plugin_reject;\n var plugin_resolve;\n var isOpera = 0;\n var isFireFox = 0;\n var isEdge = 0;\n var isSafari = 0;\n var failed_extensions = 0;\n\n var canPromise = !!window.Promise;\n var cadesplugin;\n\n if(canPromise)\n {\n cadesplugin = new Promise(function(resolve, reject)\n {\n plugin_resolve = resolve;\n plugin_reject = reject;\n });\n } else\n {\n cadesplugin = {};\n }\n\n function check_browser() {\n var ua= navigator.userAgent, tem, M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\\/))\\/?\\s*(\\d+)/i) || [];\n if(/trident/i.test(M[1])){\n tem= /\\brv[ :]+(\\d+)/g.exec(ua) || [];\n return {name:'IE',version:(tem[1] || '')};\n }\n if(M[1]=== 'Chrome'){\n tem= ua.match(/\\b(OPR|Edge)\\/(\\d+)/);\n if(tem!= null) return {name:tem[1].replace('OPR', 'Opera'),version:tem[2]};\n }\n M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];\n if((tem= ua.match(/version\\/(\\d+)/i))!= null) M.splice(1, 1, tem[1]);\n return {name:M[0],version:M[1]};\n }\n var browserSpecs = check_browser();\n\n function cpcsp_console_log(level, msg){\n //IE9 не может писать в консоль если не открыта вкладка developer tools\n if(typeof(console) === 'undefined')\n return;\n if (level <= cadesplugin.current_log_level ){\n if (level === cadesplugin.LOG_LEVEL_DEBUG)\n console.log(\"DEBUG: %s\", msg);\n if (level === cadesplugin.LOG_LEVEL_INFO)\n console.info(\"INFO: %s\", msg);\n if (level === cadesplugin.LOG_LEVEL_ERROR)\n console.error(\"ERROR: %s\", msg);\n return;\n }\n }\n\n function set_log_level(level){\n if (!((level === cadesplugin.LOG_LEVEL_DEBUG) ||\n (level === cadesplugin.LOG_LEVEL_INFO) ||\n (level === cadesplugin.LOG_LEVEL_ERROR))){\n cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, \"cadesplugin_api.js: Incorrect log_level: \" + level);\n return;\n }\n cadesplugin.current_log_level = level;\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = DEBUG\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = INFO\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = ERROR\");\n if(isNativeMessageSupported())\n {\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG)\n window.postMessage(\"set_log_level=debug\", \"*\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO)\n window.postMessage(\"set_log_level=info\", \"*\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR)\n window.postMessage(\"set_log_level=error\", \"*\");\n }\n }\n\n function set_constantValues()\n {\n cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CAPICOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CADESCOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_CONTAINER_STORE = 100;\n\n cadesplugin.CAPICOM_MY_STORE = \"My\";\n\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;\n\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\n\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;\n\n cadesplugin.XmlDsigGost3410UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411\";\n cadesplugin.XmlDsigGost3411UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr3411\";\n cadesplugin.XmlDsigGost3410Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411\";\n cadesplugin.XmlDsigGost3411Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411\";\n\n cadesplugin.CADESCOM_CADES_DEFAULT = 0;\n cadesplugin.CADESCOM_CADES_BES = 1;\n cadesplugin.CADESCOM_CADES_T = 0x5;\n cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;\n cadesplugin.CADESCOM_PKCS7_TYPE = 0xffff;\n\n cadesplugin.CADESCOM_ENCODE_BASE64 = 0;\n cadesplugin.CADESCOM_ENCODE_BINARY = 1;\n cadesplugin.CADESCOM_ENCODE_ANY = -1;\n\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;\n\n cadesplugin.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;\n cadesplugin.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;\n\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;\n\n cadesplugin.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;\n\n cadesplugin.CAPICOM_PROPID_ENHKEY_USAGE = 9;\n\n cadesplugin.CAPICOM_OID_OTHER = 0;\n cadesplugin.CAPICOM_OID_KEY_USAGE_EXTENSION = 10;\n\n cadesplugin.CAPICOM_EKU_CLIENT_AUTH = 2;\n cadesplugin.CAPICOM_EKU_SMARTCARD_LOGON = 5;\n cadesplugin.CAPICOM_EKU_OTHER = 0;\n\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\n cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1;\n\n cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0;\n cadesplugin.CADESCOM_BASE64_TO_BINARY = 1;\n\n cadesplugin.CADESCOM_DISPLAY_DATA_NONE = 0;\n cadesplugin.CADESCOM_DISPLAY_DATA_CONTENT = 1;\n cadesplugin.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;\n\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;\n\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA1 = 0;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD2 = 1;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD4 = 2;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD5 = 3;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_256 = 4;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_384 = 5;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_512 = 6;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112;\n\n cadesplugin.LOG_LEVEL_DEBUG = 4;\n cadesplugin.LOG_LEVEL_INFO = 2;\n cadesplugin.LOG_LEVEL_ERROR = 1;\n\n cadesplugin.CADESCOM_AllowNone = 0;\n cadesplugin.CADESCOM_AllowNoOutstandingRequest = 0x1;\n cadesplugin.CADESCOM_AllowUntrustedCertificate = 0x2;\n cadesplugin.CADESCOM_AllowUntrustedRoot = 0x4;\n cadesplugin.CADESCOM_SkipInstallToStore = 0x10000000;\n }\n\n function async_spawn(generatorFunc) {\n function continuer(verb, arg) {\n var result;\n try {\n result = generator[verb](arg);\n } catch (err) {\n return Promise.reject(err);\n }\n if (result.done) {\n return result.value;\n } else {\n return Promise.resolve(result.value).then(onFulfilled, onRejected);\n }\n }\n var generator = generatorFunc(Array.prototype.slice.call(arguments, 1));\n var onFulfilled = continuer.bind(continuer, \"next\");\n var onRejected = continuer.bind(continuer, \"throw\");\n return onFulfilled();\n }\n\n function isIE() {\n // var retVal = ((\"Microsoft Internet Explorer\" == navigator.appName) || // IE < 11\n // navigator.userAgent.match(/Trident\\/./i)); // IE 11\n return (browserSpecs.name === 'IE' || browserSpecs.name === 'MSIE');\n }\n\n function isIOS() {\n return (navigator.userAgent.match(/ipod/i) ||\n navigator.userAgent.match(/ipad/i) ||\n navigator.userAgent.match(/iphone/i));\n }\n\n function isNativeMessageSupported()\n {\n // В IE работаем через NPAPI\n if(isIE())\n return false;\n // В Edge работаем через NativeMessage\n if(browserSpecs.name === 'Edge') {\n isEdge = true;\n return true;\n }\n // В Chrome, Firefox, Safari и Opera работаем через асинхронную версию в зависимости от версии\n if(browserSpecs.name === 'Opera') {\n isOpera = true;\n if(browserSpecs.version >= 33){\n return true;\n }\n else{\n return false;\n }\n }\n if(browserSpecs.name === 'Firefox') {\n isFireFox = true;\n if(browserSpecs.version >= 52){\n return true;\n }\n else{\n return false;\n }\n }\n if(browserSpecs.name === 'Chrome') {\n if(browserSpecs.version >= 42){\n return true;\n }\n else{\n return false;\n }\n }\n //В Сафари начиная с 12 версии нет NPAPI\n if(browserSpecs.name === 'Safari') {\n isSafari = true;\n if(browserSpecs.version >= 12) {\n return true;\n } else {\n return false;\n }\n }\n }\n\n // Функция активации объектов КриптоПро ЭЦП Browser plug-in\n function CreateObject(name) {\n if (isIOS()) {\n // На iOS для создания объектов используется функция\n // call_ru_cryptopro_npcades_10_native_bridge, определенная в IOS_npcades_supp.js\n return call_ru_cryptopro_npcades_10_native_bridge(\"CreateObject\", [name]);\n }\n if (isIE()) {\n // В Internet Explorer создаются COM-объекты\n if (name.match(/X509Enrollment/i)) {\n try {\n // Объекты CertEnroll пробуем создавать через нашу фабрику,\n // если не получилось то через CX509EnrollmentWebClassFactory\n var objCertEnrollClassFactory = document.getElementById(\"webClassFactory\");\n return objCertEnrollClassFactory.CreateObject(name);\n }\n catch (e) {\n try {\n var objWebClassFactory = document.getElementById(\"certEnrollClassFactory\");\n return objWebClassFactory.CreateObject(name);\n }\n catch (err) {\n throw (\"Для создания обьектов X509Enrollment следует настроить веб-узел на использование проверки подлинности по протоколу HTTPS\");\n }\n }\n }\n // Объекты CAPICOM и CAdESCOM создаются через CAdESCOM.WebClassFactory\n try {\n var objWebClassFactory = document.getElementById(\"webClassFactory\");\n return objWebClassFactory.CreateObject(name);\n }\n catch (e) {\n // Для версий плагина ниже 2.0.12538\n return new ActiveXObject(name);\n }\n }\n // создаются объекты NPAPI\n return pluginObject.CreateObject(name);\n }\n\n function decimalToHexString(number) {\n if (number < 0) {\n number = 0xFFFFFFFF + number + 1;\n }\n\n return number.toString(16).toUpperCase();\n }\n\n function GetMessageFromException(e) {\n var err = e.message;\n if (!err) {\n err = e;\n } else if (e.number) {\n err += \" (0x\" + decimalToHexString(e.number) + \")\";\n }\n return err;\n }\n\n function getLastError(exception) {\n if(isNativeMessageSupported() || isIE() || isIOS() ) {\n return GetMessageFromException(exception);\n }\n\n try {\n return pluginObject.getLastError();\n } catch(e) {\n return GetMessageFromException(exception);\n }\n }\n\n // Функция для удаления созданных объектов\n function ReleasePluginObjects() {\n return cpcsp_chrome_nmcades.ReleasePluginObjects();\n }\n\n // Функция активации асинхронных объектов КриптоПро ЭЦП Browser plug-in\n function CreateObjectAsync(name) {\n return pluginObject.CreateObjectAsync(name);\n }\n\n //Функции для IOS\n var ru_cryptopro_npcades_10_native_bridge = {\n callbacksCount : 1,\n callbacks : {},\n\n // Automatically called by native layer when a result is available\n resultForCallback : function resultForCallback(callbackId, resultArray) {\n var callback = ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId];\n if (!callback) return;\n callback.apply(null,resultArray);\n },\n\n // Use this in javascript to request native objective-c code\n // functionName : string (I think the name is explicit :p)\n // args : array of arguments\n // callback : function with n-arguments that is going to be called when the native code returned\n call : function call(functionName, args, callback) {\n var hasCallback = callback && typeof callback === \"function\";\n var callbackId = hasCallback ? ru_cryptopro_npcades_10_native_bridge.callbacksCount++ : 0;\n\n if (hasCallback)\n ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId] = callback;\n\n var iframe = document.createElement(\"IFRAME\");\n var arrObjs = new Array(\"_CPNP_handle\");\n try{\n iframe.setAttribute(\"src\", \"cpnp-js-call:\" + functionName + \":\" + callbackId+ \":\" + encodeURIComponent(JSON.stringify(args, arrObjs)));\n } catch(e){\n alert(e);\n }\n document.documentElement.appendChild(iframe);\n iframe.parentNode.removeChild(iframe);\n iframe = null;\n }\n };\n\n function call_ru_cryptopro_npcades_10_native_bridge(functionName, array){\n var tmpobj;\n var ex;\n ru_cryptopro_npcades_10_native_bridge.call(functionName, array, function(e, response){\n ex = e;\n var str='tmpobj='+response;\n eval(str);\n if (typeof (tmpobj) === \"string\"){\n tmpobj = tmpobj.replace(/\\\\\\n/gm, \"\\n\");\n tmpobj = tmpobj.replace(/\\\\\\r/gm, \"\\r\");\n }\n });\n if(ex)\n throw ex;\n return tmpobj;\n }\n\n function show_firefox_missing_extension_dialog()\n {\n if (!window.cadesplugin_skip_extension_install)\n {\n var ovr = document.createElement('div');\n ovr.id = \"cadesplugin_ovr\";\n ovr.style = \"visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)\";\n ovr.innerHTML = \"
\" +\n \"\" +\n \"

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

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

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

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

\" +\n \"
\";\n document.getElementsByTagName(\"Body\")[0].appendChild(ovr);\n var btn_install = document.getElementById(\"cadesplugin_install\");\n btn_install.addEventListener('click', function(event) {\n opr.addons.installExtension(\"epebfcehmdedogndhlcacafjaacknbcm\",\n function()\n {\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n location.reload();\n },\n function(){})\n });\n document.getElementById(\"cadesplugin_close_install\").addEventListener('click',function()\n {\n plugin_loaded_error(\"Плагин недоступен\");\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n });\n\n ovr.addEventListener('click',function()\n {\n plugin_loaded_error(\"Плагин недоступен\");\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n });\n ovr.style.visibility=\"visible\";\n document.getElementById(\"cadesplugin_ovr_item\").addEventListener('click',function(e){\n e.stopPropagation();\n });\n });\n }else\n {\n plugin_loaded_error(\"Плагин недоступен\");\n }\n }\n\n function firefox_or_edge_nmcades_onload() {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n\n function nmcades_api_onload () {\n window.postMessage(\"cadesplugin_echo_request\", \"*\");\n window.addEventListener(\"message\", function (event){\n if (typeof(event.data) !== \"string\" || !event.data.match(\"cadesplugin_loaded\"))\n return;\n if(isFireFox || isEdge || isSafari)\n {\n // Для Firefox, Сафари, Edge вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js\n var url = event.data.substring(event.data.indexOf(\"url:\") + 4);\n var fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", url);\n fileref.onerror = plugin_loaded_error;\n fileref.onload = firefox_or_edge_nmcades_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n // Для Firefox, Safari и Edge у нас только по одному расширению.\n failed_extensions++;\n }else {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n }, false);\n }\n\n //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari\n function load_extension()\n {\n\n if(isFireFox || isEdge || isSafari){\n // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера.\n nmcades_api_onload();\n } else {\n // в асинхронном варианте для chrome и opera подключаем оба расширения\n var fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", \"chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js\");\n fileref.onerror = plugin_loaded_error;\n fileref.onload = nmcades_api_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", \"chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js\");\n fileref.onerror = plugin_loaded_error;\n fileref.onload = nmcades_api_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n }\n }\n\n //Загружаем плагин для NPAPI\n function load_npapi_plugin()\n {\n var elem = document.createElement('object');\n elem.setAttribute(\"id\", \"cadesplugin_object\");\n elem.setAttribute(\"type\", \"application/x-cades\");\n elem.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem);\n pluginObject = document.getElementById(\"cadesplugin_object\");\n if(isIE())\n {\n var elem1 = document.createElement('object');\n elem1.setAttribute(\"id\", \"certEnrollClassFactory\");\n elem1.setAttribute(\"classid\", \"clsid:884e2049-217d-11da-b2a4-000e7bbb2b09\");\n elem1.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem1);\n var elem2 = document.createElement('object');\n elem2.setAttribute(\"id\", \"webClassFactory\");\n elem2.setAttribute(\"classid\", \"clsid:B04C8637-10BD-484E-B0DA-B8A039F60024\");\n elem2.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem2);\n }\n }\n\n //Отправляем событие что все ок.\n function plugin_loaded()\n {\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_resolve();\n }else {\n window.postMessage(\"cadesplugin_loaded\", \"*\");\n }\n }\n\n //Отправляем событие что сломались.\n function plugin_loaded_error(msg)\n {\n if(isNativeMessageSupported())\n {\n //в асинхронном варианте подключаем оба расширения, если сломались оба пробуем установить для Opera\n failed_extensions++;\n if(failed_extensions<2)\n return;\n if(isOpera && (typeof(msg) === 'undefined'|| typeof(msg) === 'object'))\n {\n install_opera_extension();\n return;\n }\n }\n if(typeof(msg) === 'undefined' || typeof(msg) === 'object')\n msg = \"Плагин недоступен\";\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_reject(msg);\n } else {\n window.postMessage(\"cadesplugin_load_error\", \"*\");\n }\n }\n\n //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку\n function check_load_timeout()\n {\n if(plugin_resolved === 1)\n return;\n if(isFireFox)\n {\n show_firefox_missing_extension_dialog();\n }\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_reject(\"Истекло время ожидания загрузки плагина\");\n } else {\n window.postMessage(\"cadesplugin_load_error\", \"*\");\n }\n\n }\n\n //Вспомогательная функция для NPAPI\n function createPromise(arg)\n {\n return new Promise(arg);\n }\n\n function check_npapi_plugin (){\n try {\n var oAbout = CreateObject(\"CAdESCOM.About\");\n plugin_loaded();\n }\n catch (err) {\n document.getElementById(\"cadesplugin_object\").style.display = 'none';\n // Объект создать не удалось, проверим, установлен ли\n // вообще плагин. Такая возможность есть не во всех браузерах\n var mimetype = navigator.mimeTypes[\"application/x-cades\"];\n if (mimetype) {\n var plugin = mimetype.enabledPlugin;\n if (plugin) {\n plugin_loaded_error(\"Плагин загружен, но не создаются обьекты\");\n }else\n {\n plugin_loaded_error(\"Ошибка при загрузке плагина\");\n }\n }else\n {\n plugin_loaded_error(\"Плагин недоступен\");\n }\n }\n }\n\n //Проверяем работает ли плагин\n function check_plugin_working()\n {\n var div = document.createElement(\"div\");\n div.innerHTML = \"\";\n var isIeLessThan9 = (div.getElementsByTagName(\"i\").length === 1);\n if (isIeLessThan9) {\n plugin_loaded_error(\"Internet Explorer версии 8 и ниже не поддерживается\");\n return;\n }\n\n if(isNativeMessageSupported())\n {\n load_extension();\n }else if(!canPromise) {\n window.addEventListener(\"message\", function (event){\n if (event.data !== \"cadesplugin_echo_request\")\n return;\n load_npapi_plugin();\n check_npapi_plugin();\n },\n false);\n }else\n {\n if(document.readyState === \"complete\"){\n load_npapi_plugin();\n check_npapi_plugin();\n } else {\n window.addEventListener(\"load\", function (event) {\n load_npapi_plugin();\n check_npapi_plugin();\n }, false);\n }\n }\n }\n\n function set_pluginObject(obj)\n {\n pluginObject = obj;\n }\n\n function is_capilite_enabled()\n {\n if ((typeof (cadesplugin.EnableInternalCSP) !== 'undefined') && cadesplugin.EnableInternalCSP)\n return true;\n return false;\n };\n\n //Export\n cadesplugin.JSModuleVersion = \"2.1.2\";\n cadesplugin.async_spawn = async_spawn;\n cadesplugin.set = set_pluginObject;\n cadesplugin.set_log_level = set_log_level;\n cadesplugin.getLastError = getLastError;\n cadesplugin.is_capilite_enabled = is_capilite_enabled;\n\n if(isNativeMessageSupported())\n {\n cadesplugin.CreateObjectAsync = CreateObjectAsync;\n cadesplugin.ReleasePluginObjects = ReleasePluginObjects;\n }\n\n if(!isNativeMessageSupported())\n {\n cadesplugin.CreateObject = CreateObject;\n }\n\n if(window.cadesplugin_load_timeout)\n {\n setTimeout(check_load_timeout, window.cadesplugin_load_timeout);\n }\n else\n {\n setTimeout(check_load_timeout, 20000);\n }\n\n set_constantValues();\n\n cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR;\n window.cadesplugin = cadesplugin;\n check_plugin_working();\n}());\n","import { ISSUER_TAGS_TRANSLATIONS, SUBJECT_TAGS_TRANSLATIONS } from '../../constants';\nimport { TagTranslation } from '../../helpers/_parseCertInfo';\nimport { exportBase64 } from './exportBase64';\nimport { getAlgorithm } from './getAlgorithm';\nimport { getCadesProp } from './getCadesProp';\nimport { getDecodedExtendedKeyUsage, ExtendedKeysTranslations } from './getDecodedExtendedKeyUsage';\nimport { getExtendedKeyUsage } from './getExtendedKeyUsage';\nimport { getInfo } from './getInfo';\nimport { hasExtendedKeyUsage } from './hasExtendedKeyUsage';\nimport { isValid } from './isValid';\n\nexport type CadesCertificate = any;\n\nexport class Certificate {\n constructor(\n public _cadesCertificate: CadesCertificate,\n public name: string,\n public issuerName: string,\n public subjectName: string,\n public thumbprint: string,\n public validFrom: string,\n public validTo: string,\n ) {}\n\n public getOwnerInfo(): Promise {\n return getInfo.call(this, SUBJECT_TAGS_TRANSLATIONS, 'SubjectName');\n }\n\n public getIssuerInfo(): Promise {\n return getInfo.call(this, ISSUER_TAGS_TRANSLATIONS, 'IssuerName');\n }\n\n public getExtendedKeyUsage(): Promise {\n return getExtendedKeyUsage.call(this);\n }\n\n public getDecodedExtendedKeyUsage(): Promise {\n return getDecodedExtendedKeyUsage.call(this);\n }\n\n public getAlgorithm(): Promise {\n return getAlgorithm.call(this);\n }\n\n public getCadesProp(propName): Promise {\n return getCadesProp.call(this, propName);\n }\n\n public isValid(): Promise {\n return isValid.call(this);\n }\n\n public exportBase64(): Promise {\n return exportBase64.call(this);\n }\n\n public hasExtendedKeyUsage(oids): Promise {\n return hasExtendedKeyUsage.call(this, oids);\n }\n}\n","export const CADESCOM_ATTRIBUTE_OTHER = -1;\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\nexport const CADESCOM_AllowNoOutstandingRequest = 1;\nexport const CADESCOM_AllowNone = 0;\nexport const CADESCOM_AllowUntrustedCertificate = 2;\nexport const CADESCOM_AllowUntrustedRoot = 4;\nexport const CADESCOM_BASE64_TO_BINARY = 0x01;\nexport const CADESCOM_CADES_BES = 1;\nexport const CADESCOM_CADES_DEFAULT = 0;\nexport const CADESCOM_CADES_T = 5;\nexport const CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;\nexport const CADESCOM_CONTAINER_STORE = 100;\nexport const CADESCOM_CURRENT_USER_STORE = 2;\nexport const CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;\nexport const CADESCOM_DISPLAY_DATA_CONTENT = 1;\nexport const CADESCOM_DISPLAY_DATA_NONE = 0;\nexport const CADESCOM_ENCODE_ANY = -1;\nexport const CADESCOM_ENCODE_BASE64 = 0;\nexport const CADESCOM_ENCODE_BINARY = 1;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110;\nexport const CADESCOM_HASH_ALGORITHM_MD2 = 1;\nexport const CADESCOM_HASH_ALGORITHM_MD4 = 2;\nexport const CADESCOM_HASH_ALGORITHM_MD5 = 3;\nexport const CADESCOM_HASH_ALGORITHM_SHA1 = 0;\nexport const CADESCOM_HASH_ALGORITHM_SHA_256 = 4;\nexport const CADESCOM_HASH_ALGORITHM_SHA_384 = 5;\nexport const CADESCOM_HASH_ALGORITHM_SHA_512 = 6;\nexport const CADESCOM_LOCAL_MACHINE_STORE = 1;\nexport const CADESCOM_PKCS7_TYPE = 65535;\nexport const CADESCOM_STRING_TO_UCS2LE = 0x00;\nexport const CADESCOM_SkipInstallToStore = 268435456;\nexport const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;\nexport const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;\nexport const CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;\nexport const CAPICOM_ACTIVE_DIRECTORY_USER_STORE = 3;\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\nexport const CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;\nexport const CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;\nexport const CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;\nexport const CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;\nexport const CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;\nexport const CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;\nexport const CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;\nexport const CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;\nexport const CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\nexport const CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;\nexport const CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;\nexport const CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;\nexport const CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;\nexport const CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;\nexport const CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;\nexport const CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;\nexport const CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;\nexport const CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;\nexport const CAPICOM_CURRENT_USER_STORE = 2;\nexport const CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;\nexport const CAPICOM_EKU_CLIENT_AUTH = 2;\nexport const CAPICOM_EKU_OTHER = 0;\nexport const CAPICOM_EKU_SMARTCARD_LOGON = 5;\nexport const CAPICOM_LOCAL_MACHINE_STORE = 1;\nexport const CAPICOM_MEMORY_STORE = 0;\nexport const CAPICOM_MY_STORE = 'My';\nexport const CAPICOM_OID_KEY_USAGE_EXTENSION = 10;\nexport const CAPICOM_OID_OTHER = 0;\nexport const CAPICOM_PROPID_ACCESS_STATE = 14;\nexport const CAPICOM_PROPID_ARCHIVED = 19;\nexport const CAPICOM_PROPID_ARCHIVED_KEY_HASH = 65;\nexport const CAPICOM_PROPID_AUTO_ENROLL = 21;\nexport const CAPICOM_PROPID_CROSS_CERT_DIST_POINTS = 23;\nexport const CAPICOM_PROPID_CTL_USAGE = 9;\nexport const CAPICOM_PROPID_DATE_STAMP = 27;\nexport const CAPICOM_PROPID_DESCRIPTION = 13;\nexport const CAPICOM_PROPID_EFS = 17;\nexport const CAPICOM_PROPID_ENHKEY_USAGE = 9;\nexport const CAPICOM_PROPID_ENROLLMENT = 26;\nexport const CAPICOM_PROPID_EXTENDED_ERROR_INFO = 30;\nexport const CAPICOM_PROPID_FIRST_RESERVED = 66;\nexport const CAPICOM_PROPID_FIRST_USER = 0x00008000;\nexport const CAPICOM_PROPID_FORTEZZA_DATA = 18;\nexport const CAPICOM_PROPID_FRIENDLY_NAME = 11;\nexport const CAPICOM_PROPID_HASH_PROP = 3;\nexport const CAPICOM_PROPID_IE30_RESERVED = 7;\nexport const CAPICOM_PROPID_ISSUER_PUBLIC_KEY_MD5_HASH = 24;\nexport const CAPICOM_PROPID_ISSUER_SERIAL_NUMBER_MD5_HASH = 28;\nexport const CAPICOM_PROPID_KEY_CONTEXT = 5;\nexport const CAPICOM_PROPID_KEY_IDENTIFIER = 20;\nexport const CAPICOM_PROPID_KEY_PROV_HANDLE = 1;\nexport const CAPICOM_PROPID_KEY_PROV_INFO = 2;\nexport const CAPICOM_PROPID_KEY_SPEC = 6;\nexport const CAPICOM_PROPID_LAST_RESERVED = 0x00007fff;\nexport const CAPICOM_PROPID_LAST_USER = 0x0000ffff;\nexport const CAPICOM_PROPID_MD5_HASH = 4;\nexport const CAPICOM_PROPID_NEXT_UPDATE_LOCATION = 10;\nexport const CAPICOM_PROPID_PUBKEY_ALG_PARA = 22;\nexport const CAPICOM_PROPID_PUBKEY_HASH_RESERVED = 8;\nexport const CAPICOM_PROPID_PVK_FILE = 12;\nexport const CAPICOM_PROPID_RENEWAL = 64;\nexport const CAPICOM_PROPID_SHA1_HASH = 3;\nexport const CAPICOM_PROPID_SIGNATURE_HASH = 15;\nexport const CAPICOM_PROPID_SMART_CARD_DATA = 16;\nexport const CAPICOM_PROPID_SUBJECT_NAME_MD5_HASH = 29;\nexport const CAPICOM_PROPID_SUBJECT_PUBLIC_KEY_MD5_HASH = 25;\nexport const CAPICOM_PROPID_UNKNOWN = 0;\nexport const CAPICOM_SMART_CARD_USER_STORE = 4;\nexport const CAPICOM_STORE_OPEN_EXISTING_ONLY = 128;\nexport const CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED = 256;\nexport const CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;\nexport const CAPICOM_STORE_OPEN_READ_ONLY = 0;\nexport const CAPICOM_STORE_OPEN_READ_WRITE = 1;\nexport const CHECK_NONE = 0;\nexport const CHECK_OFFLINE_REVOCATION_STATUS = 16;\nexport const CHECK_ONLINE_REVOCATION_STATUS = 8;\nexport const CHECK_SIGNATURE_VALIDITY = 4;\nexport const CHECK_TIME_VALIDITY = 2;\nexport const CHECK_TRUSTED_ROOT = 1;\nexport const LOG_LEVEL_DEBUG = 4;\nexport const LOG_LEVEL_ERROR = 1;\nexport const LOG_LEVEL_INFO = 2;\nexport const TRUST_CTL_IS_NOT_SIGNATURE_VALID = 262144;\nexport const TRUST_CTL_IS_NOT_TIME_VALID = 131072;\nexport const TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 524288;\nexport const TRUST_IS_CYCLIC = 128;\nexport const TRUST_IS_NOT_SIGNATURE_VALID = 8;\nexport const TRUST_IS_NOT_TIME_NESTED = 2;\nexport const TRUST_IS_NOT_TIME_VALID = 1;\nexport const TRUST_IS_NOT_VALID_FOR_USAGE = 16;\nexport const TRUST_IS_PARTIAL_CHAIN = 65536;\nexport const TRUST_IS_REVOKED = 4;\nexport const TRUST_IS_UNTRUSTED_ROOT = 32;\nexport const TRUST_REVOCATION_STATUS_UNKNOWN = 64;\nexport const XmlDsigGost3410Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411';\nexport const XmlDsigGost3410UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411';\nexport const XmlDsigGost3411Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411';\nexport const XmlDsigGost3411UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr3411';\n","import { TagsTranslations } from './tags-translations';\n\nexport const ISSUER_TAGS_TRANSLATIONS: TagsTranslations[] = [\n { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' },\n { possibleNames: ['CN'], translation: 'Удостоверяющий центр' },\n { possibleNames: ['C'], translation: 'Страна' },\n { possibleNames: ['S'], translation: 'Регион' },\n { possibleNames: ['STREET'], translation: 'Адрес' },\n { possibleNames: ['O'], translation: 'Компания' },\n { possibleNames: ['OU'], translation: 'Тип' },\n { possibleNames: ['T'], translation: 'Должность' },\n { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },\n { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },\n { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },\n { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },\n { possibleNames: ['E'], translation: 'Email' },\n { possibleNames: ['L'], translation: 'Город' },\n];\n","export const OIDS_DICTIONARY = {\n '1.2.643.2.2.34.6': 'Пользователь Центра Регистрации',\n '1.2.643.2.39.1.1': 'Использование в программных продуктах системы \"1С:Предприятие 8\"',\n '1.2.643.3.131.1.1': 'ИНН',\n '1.2.643.3.141.1.1': 'РНС ФСС',\n '1.2.643.3.141.1.2': 'КП ФСС',\n '1.2.643.3.2.100.65.13.11': 'Использование в системе АИС \"Госзакупки\" Сахалинской области.',\n '1.2.643.3.8.100.1': 'Сертификат типа \"ekey-ГОСТ\"',\n '1.2.643.3.8.100.1.1': 'Общее использование в системах ИОК без права заверения финансовых документов',\n '1.2.643.3.8.100.1.10':\n 'Для участия в электронных торгах и подписания государственного контракта в информационных системах Тендерного комитета города Москвы уполномоченными лицами участников размещения государственного заказа города Москвы',\n '1.2.643.3.8.100.1.11':\n 'Подписание электронных документов в автоматизированной информационной системе размещения государственного и муниципального заказа Саратовской области',\n '1.2.643.3.8.100.1.12': 'Использование в системе государственного заказа Иркутской области',\n '1.2.643.3.8.100.1.13':\n 'Использование в электронной торговой площадке агентства государственного заказа Красноярского края',\n '1.2.643.3.8.100.1.14': 'Использование в электронной торговой площадке \"Тендер\"',\n '1.2.643.3.8.100.1.2': 'Передача отчетности по ТКС',\n '1.2.643.3.8.100.1.3': 'Оформление взаимных обязательств, соглашений, договоров, актов и т.п.',\n '1.2.643.3.8.100.1.4': 'Внутрикорпоративный документооборот',\n '1.2.643.3.8.100.1.5': 'Использование в системах электронной торговли',\n '1.2.643.3.8.100.1.6': 'Использование в торгово-закупочной системе \"ЭЛЕКТРА\"',\n '1.2.643.3.8.100.1.7': 'Использование в системе Портал государственных закупок Ставропольского края.',\n '1.2.643.3.8.100.1.8': 'Использование в Единой системе электронной торговли B2B-Center и B2G.',\n '1.2.643.3.8.100.1.9':\n 'Для участия в электронных торгах и подписания государственного контракта в электронной площадке ОАО «ЕЭТП» уполномоченными лицами участников размещения государственного или муниципального заказа',\n '1.2.643.5.1.24.2.1.3':\n 'Формирование документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя',\n '1.2.643.5.1.24.2.1.3.1':\n 'Формирование кадастровым инженером документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя',\n '1.2.643.5.1.24.2.2.2': 'Формирование документов как результата оказания услуги со стороны органов регистрации прав',\n '1.2.643.5.1.24.2.2.3':\n 'Формирование документов для получения государственных услуг в сфере государственной регистрации прав на недвижимое имущество и сделок с ним со стороны заявителя',\n '1.2.643.6.2.1.7.1':\n 'Использование единоличным исполнительным органом юридического лица или уполномоченными представителями юридического лица в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских и иных прав и обязанностей в сфере негосударственного пенсионного обеспечения, негосударственного пенсионного страхования, в сфере деятельности паевых инвестиционных фондов, акционерных инвестиционных фондов, профессиональных участников рынка ценных бумаг, а также связанной с обслуживанием указанной деятельности услуг кредитных и иных организаций',\n '1.2.643.6.2.1.7.2':\n 'Использование физическим лицом в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских прав и обязанностей в отношении инвестиционных паев паевых инвестиционных фондов, в том числе отношения, связанные с учетом и/или фиксацией прав на инвестиционные паи паевых инвестиционных фондов',\n '1.2.643.6.3':\n 'Использование в электронных торговых системах и в программном обеспечении, связанным с обменом электронных сообщений',\n '1.2.643.6.3.1.1': 'Использование на электронных площадок отобранных для проведения аукционах в электронной форме',\n '1.2.643.6.3.1.2.1': 'Тип участника - Юридическое лицо',\n '1.2.643.6.3.1.2.2': 'Тип участника - Физическое лицо',\n '1.2.643.6.3.1.2.3': 'Тип участника - Индивидуальный предприниматель',\n '1.2.643.6.3.1.3.1': 'Участник размещения заказа',\n '1.2.643.6.3.1.4.1': 'Администратор организации',\n '1.2.643.6.3.1.4.2': 'Уполномоченный специалист',\n '1.2.643.6.3.1.4.3': 'Специалист с правом подписи контракта',\n '1.2.840.113549.1.9.2': 'Неструктурированное имя',\n '1.3.6.1.4.1.24138.1.1.8.1': 'Обеспечение юридической значимости в Системе \"Электронная Торговая Площадка\"',\n '1.3.6.1.4.1.29919.21': 'Использование в системе Портал государственных закупок Ростовской области \"Рефери\".',\n '1.3.6.1.5.5.7.3.2': 'Проверка подлинности клиента',\n '1.3.6.1.5.5.7.3.4': 'Защищенная электронная почта',\n '1.3.643.3.8.100.15': 'Использование в ЭТП \"uTender\"',\n};\n","import { TagsTranslations } from './tags-translations';\n\nexport const SUBJECT_TAGS_TRANSLATIONS: TagsTranslations[] = [\n { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' },\n { possibleNames: ['CN'], translation: 'Владелец' },\n { possibleNames: ['SN'], translation: 'Фамилия' },\n { possibleNames: ['G'], translation: 'Имя Отчество' },\n { possibleNames: ['C'], translation: 'Страна' },\n { possibleNames: ['S'], translation: 'Регион' },\n { possibleNames: ['STREET'], translation: 'Адрес' },\n { possibleNames: ['O'], translation: 'Компания' },\n { possibleNames: ['OU'], translation: 'Отдел/подразделение' },\n { possibleNames: ['T'], translation: 'Должность' },\n { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },\n { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },\n { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },\n { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },\n { possibleNames: ['E'], translation: 'Email' },\n { possibleNames: ['L'], translation: 'Город' },\n];\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Экспортирует сертификат в формате base64\n *\n * @returns сертификат в формате base64\n */\nexport const exportBase64 = _afterPluginsLoaded(function (): string {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function exportBase64(): string {\n let base64: string;\n\n try {\n base64 = __cadesAsyncToken__ + cadesCertificate.Export(0);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при экспорте сертификата');\n }\n\n return base64;\n }),\n );\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\ninterface AlgorithmInfo {\n algorithm: string;\n oid: string;\n}\n\n/**\n * Возвращает информацию об алгоритме сертификата\n *\n * @returns информацию об алгоритме и его OID'е\n */\nexport const getAlgorithm = _afterPluginsLoaded(function (): AlgorithmInfo {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function getAlgorithm(): AlgorithmInfo {\n const algorithmInfo: AlgorithmInfo = {\n algorithm: null,\n oid: null,\n };\n let cadesPublicKey;\n\n try {\n cadesPublicKey = __cadesAsyncToken__ + cadesCertificate.PublicKey();\n cadesPublicKey = __cadesAsyncToken__ + cadesPublicKey.Algorithm;\n algorithmInfo.algorithm = __cadesAsyncToken__ + cadesPublicKey.FriendlyName;\n algorithmInfo.oid = __cadesAsyncToken__ + cadesPublicKey.Value;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении алгоритма');\n }\n\n return algorithmInfo;\n }),\n );\n});\n","import { OIDS_DICTIONARY } from '../../constants';\nimport { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { Certificate } from './certificate';\n\nexport interface ExtendedKeysTranslations {\n [key: string]: string | null;\n}\n\n/**\n * Возвращает расшифрованные ОИД'ы сертификата\n *\n * @returns словарь расшифрованных ОИД'ов\n */\nexport const getDecodedExtendedKeyUsage = _afterPluginsLoaded(async function (): Promise {\n const certificateOids = await (this as Certificate).getExtendedKeyUsage();\n\n return certificateOids.reduce(\n (decodedOids, oidCode) => ({\n ...decodedOids,\n [oidCode]: OIDS_DICTIONARY[oidCode] || null,\n }),\n {},\n );\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Возвращает ОИД'ы сертификата\n *\n * @returns список ОИД'ов\n */\nexport const getExtendedKeyUsage = _afterPluginsLoaded(function (): string[] {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function getExtendedKeyUsage(): string[] {\n const OIDS: string[] = [];\n let count: any;\n\n try {\n count = __cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage();\n count = __cadesAsyncToken__ + count.EKUs;\n count = __cadesAsyncToken__ + count.Count;\n\n if (count > 0) {\n while (count > 0) {\n let cadesExtendedKeyUsage;\n\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage();\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.EKUs;\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.Item(count);\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.OID;\n\n OIDS.push(cadesExtendedKeyUsage);\n\n count--;\n }\n }\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || \"Ошибка при получении ОИД'ов\");\n }\n\n return OIDS;\n }),\n );\n});\n","import { TagsTranslations } from '../../constants/tags-translations';\nimport { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { _parseCertInfo, TagTranslation } from '../../helpers/_parseCertInfo';\nimport { getCadesProp } from './getCadesProp';\n\n/**\n * Возвращает расшифрованную информацию о сертификате из указанного свойства по тэгам\n *\n * @param tags = словарь\n * @param entitiesPath = путь к разбираемой сущности\n * @returns расшифрованная информация по отдельным тэгам\n */\nexport const getInfo = _afterPluginsLoaded(async function (\n tags: TagsTranslations[],\n entitiesPath: string,\n): Promise {\n let entities: string;\n\n try {\n entities = await getCadesProp.call(this, entitiesPath);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при извлечении информации из сертификата');\n }\n\n return _parseCertInfo(tags, entities);\n});\n","import { OIDS_DICTIONARY } from '../constants';\nimport { TagsTranslations } from '../constants/tags-translations';\n\nexport interface TagTranslation {\n description: string;\n title: string;\n isTranslated: boolean;\n}\n\n/**\n * Парсит информацию из строки с информацией о сертификате\n *\n * @param tagsTranslations - словарь с расшифровками тэгов\n * @param rawInfo - данные для парсинга\n * @returns расшифрованная информация по отдельным тэгам\n */\nexport const _parseCertInfo = (tagsTranslations: TagsTranslations[], rawInfo: string): TagTranslation[] => {\n const extractedEntities: string[] = rawInfo.match(/([а-яА-Яa-zA-Z0-9\\s.]+)=(?:(\"[^\"]+?\")|(.+?))(?:,|$)/g);\n\n if (extractedEntities) {\n return extractedEntities.map((group) => {\n const segmentsMatch = group.trim().match(/^([а-яА-Яa-zA-Z0-9\\s.]+)=(.+?),?$/);\n let title = segmentsMatch?.[1];\n // Вырезаем лишние кавычки\n const description = segmentsMatch?.[2]?.replace(/^\"(.*)\"/, '$1')?.replace(/\"{2}/g, '\"');\n const oidIdentifierMatch = title?.match(/^OID\\.(.*)/);\n const oidIdentifier = oidIdentifierMatch?.[1];\n let isTranslated = false;\n\n // Если нашли в тайтле ОИД, пытаемся его расшифровать\n if (oidIdentifier) {\n const oidTranslation = OIDS_DICTIONARY[oidIdentifier];\n\n if (oidTranslation) {\n title = oidTranslation;\n isTranslated = true;\n }\n }\n\n const tagTranslation = tagsTranslations.find((tag) => tag.possibleNames.find((name) => name === title))\n ?.translation;\n\n if (tagTranslation) {\n title = tagTranslation;\n isTranslated = true;\n }\n\n return { description, title, isTranslated };\n });\n }\n};\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { Certificate } from './certificate';\n\n/**\n * Проверяет наличие ОИД'а (ОИД'ов) у сертификата\n *\n * @param oids - ОИД'ы для проверки\n * @returns флаг наличия ОИД'ов у сертификата\n */\nexport const hasExtendedKeyUsage = _afterPluginsLoaded(async function (oids: string | string[]): Promise {\n const certOids = await (this as Certificate).getExtendedKeyUsage();\n\n let result: boolean;\n\n if (Array.isArray(oids)) {\n result = oids.every((oidToCheck) => certOids.some((certOid) => certOid === oidToCheck));\n } else {\n result = certOids.some((certOid) => certOid === oids);\n }\n\n return result;\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Проверяет действительность сертификата\n *\n * @returns флаг валидности\n */\nexport const isValid = _afterPluginsLoaded(function (): boolean {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function isValid() {\n let isValid;\n\n try {\n isValid = __cadesAsyncToken__ + cadesCertificate.IsValid();\n isValid = __cadesAsyncToken__ + isValid.Result;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при проверке сертификата');\n }\n\n return Boolean(isValid);\n }),\n );\n});\n","export const _extractCommonName = (subjectName: string): string | undefined =>\n subjectName.match(/CN=(.+?)(?:,|$)/)?.[1];\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { _isSupportedCadesVersion } from '../helpers/_isSupportedCadesVersion';\nimport { _isSupportedCSPVersion } from '../helpers/_isSupportedCSPVersion';\nimport { getSystemInfo, SystemInfo } from './getSystemInfo';\n\n/**\n * Проверяет корректность настроек ЭП на машине\n *\n * @returns флаг корректности настроек\n */\nexport const isValidSystemSetup = _afterPluginsLoaded(\n async (): Promise => {\n let systemInfo: SystemInfo;\n\n try {\n systemInfo = await getSystemInfo();\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Настройки ЭП на данной машине не верны');\n }\n\n if (!_isSupportedCadesVersion(systemInfo.cadesVersion)) {\n throw new Error('Не поддерживаемая версия плагина');\n }\n\n if (!_isSupportedCSPVersion(systemInfo.cspVersion)) {\n throw new Error('Не поддерживаемая версия CSP');\n }\n\n return true;\n },\n);\n","export const _isSupportedCadesVersion = (version: string): boolean => {\n const match = version.match(/(\\d+)\\.(\\d+)\\.(\\d+)/);\n\n if (!match) {\n return false;\n }\n\n const [, major, minor, patch] = match;\n\n if (Number(major) < 2) {\n return false;\n }\n\n if (Number(major) === 2 && Number(patch) < 12438) {\n return false;\n }\n\n return true;\n};\n","const oldestSupportedCSPVersion = 4.0;\n\nexport const _isSupportedCSPVersion = (version: string): boolean => {\n version = version.match(/\\d+?\\b(?:\\.\\d+)?/)?.[0];\n\n return Number(version) >= oldestSupportedCSPVersion;\n};\n","import { CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME } from '../constants';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\nimport { _getCadesCert } from '../helpers/_getCadesCert';\nimport { _getDateObj } from '../helpers/_getDateObj';\n\n/**\n * Создает подпись base64 строки по отпечатку сертификата\n *\n * @param thumbprint - отпечаток сертификата\n * @param dataBase64 - строковые данные в формате base64\n * @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false)\n * @returns подпись\n */\nexport const createSignature = _afterPluginsLoaded(\n async (thumbprint: string, dataBase64: string, detachedSignature: boolean = true): Promise => {\n const { cadesplugin } = window;\n const cadesCertificate = await _getCadesCert(thumbprint);\n\n return eval(\n _generateCadesFn(function createSignature(): string {\n let cadesAttrs;\n let cadesSignedData;\n let cadesSigner;\n\n try {\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\n cadesSignedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CadesSignedData');\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\n }\n\n const currentTime = _getDateObj(new Date());\n\n try {\n void (__cadesAsyncToken__ + cadesAttrs.propset_Name(CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME));\n void (__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime));\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи');\n }\n\n let cadesAuthAttrs;\n\n try {\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\n cadesAuthAttrs = __cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2;\n void (__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs));\n void (__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));\n void (__cadesAsyncToken__ + cadesSignedData.propset_Content(dataBase64));\n void (\n __cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY)\n );\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи');\n }\n\n let signature: string;\n\n try {\n signature =\n __cadesAsyncToken__ +\n cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_CADES_BES, detachedSignature);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных');\n }\n\n return signature;\n }),\n );\n },\n);\n","import { CadesCertificate } from '../api/certificate';\nimport { _afterPluginsLoaded } from './_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from './_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from './_generateCadesFn';\n\n/**\n * Возвращает сертификат в формате Cades по отпечатку\n *\n * @param thumbprint - отпечаток сертификата\n * @returns сертификат в формате Cades\n */\nexport const _getCadesCert = _afterPluginsLoaded(\n (thumbprint: string): CadesCertificate => {\n const { cadesplugin } = window;\n\n return eval(\n _generateCadesFn(function _getCadesCert() {\n let cadesStore;\n\n try {\n cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');\n }\n\n if (!cadesStore) {\n throw new Error('Не удалось получить доступ к хранилищу сертификатов');\n }\n\n try {\n void (\n __cadesAsyncToken__ +\n cadesStore.Open(\n cadesplugin.CAPICOM_CURRENT_USER_STORE,\n cadesplugin.CAPICOM_MY_STORE,\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,\n )\n );\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');\n }\n\n let cadesCertificateList;\n let certificatesCount;\n\n try {\n cadesCertificateList = __cadesAsyncToken__ + cadesStore.Certificates;\n certificatesCount = __cadesAsyncToken__ + cadesCertificateList.Count;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');\n }\n\n if (!certificatesCount) {\n throw new Error('Нет доступных сертификатов');\n }\n\n let cadesCertificate: CadesCertificate;\n\n try {\n cadesCertificateList =\n __cadesAsyncToken__ + cadesCertificateList.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH, thumbprint);\n\n const count = __cadesAsyncToken__ + cadesCertificateList.Count;\n\n if (!count) {\n throw new Error(`Сертификат с отпечатком: \"${thumbprint}\" не найден`);\n }\n\n cadesCertificate = __cadesAsyncToken__ + cadesCertificateList.Item(1);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении сертификата');\n }\n\n cadesStore.Close();\n\n return cadesCertificate;\n }),\n );\n },\n);\n","/**\n * Возвращает объект даты, совместимый с Cades plugin'ом, зависящий от браузера.\n *\n * В IE необходимо использовать специфичный формат \"VT_DATE\"\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Microsoft_Extensions/Date.getVarDate\n */\nexport const _getDateObj = (dateObj): Date => (dateObj.getVarDate ? dateObj.getVarDate() : dateObj);\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://cryptoPro/webpack/universalModuleDefinition","webpack://cryptoPro/webpack/bootstrap","webpack://cryptoPro/./helpers/_afterPluginsLoaded.ts","webpack://cryptoPro/./helpers/_extractMeaningfulErrorMessage.ts","webpack://cryptoPro/./helpers/_generateCadesFn.ts","webpack://cryptoPro/./constants/index.ts","webpack://cryptoPro/./api/getUserCertificates.ts","webpack://cryptoPro/./api/certificate/index.ts","webpack://cryptoPro/./api/certificate/getCadesProp.ts","webpack://cryptoPro/./api/getSystemInfo.ts","webpack://cryptoPro/./crypto-pro.ts","webpack://cryptoPro/./api/index.ts","webpack://cryptoPro/./api/getCertificate.ts","webpack://cryptoPro/./vendor/cadesplugin_api.js","webpack://cryptoPro/./api/certificate/certificate.ts","webpack://cryptoPro/./constants/cades-constants.ts","webpack://cryptoPro/./constants/issuer-tags-translations.ts","webpack://cryptoPro/./constants/oids-dictionary.ts","webpack://cryptoPro/./constants/subject-tags-translations.ts","webpack://cryptoPro/./api/certificate/exportBase64.ts","webpack://cryptoPro/./api/certificate/getAlgorithm.ts","webpack://cryptoPro/./api/certificate/getDecodedExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/getExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/getInfo.ts","webpack://cryptoPro/./helpers/_parseCertInfo.ts","webpack://cryptoPro/./api/certificate/hasExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/isValid.ts","webpack://cryptoPro/./helpers/_extractCommonName.ts","webpack://cryptoPro/./api/isValidSystemSetup.ts","webpack://cryptoPro/./helpers/_isSupportedCadesVersion.ts","webpack://cryptoPro/./helpers/_isSupportedCSPVersion.ts","webpack://cryptoPro/./api/createSignature.ts","webpack://cryptoPro/./helpers/_getCadesCert.ts","webpack://cryptoPro/./helpers/_getDateObj.ts","webpack://cryptoPro/./api/createHash.ts","webpack://cryptoPro/../node_modules/buffer/index.js","webpack://cryptoPro/../node_modules/webpack/buildin/global.js","webpack://cryptoPro/../node_modules/base64-js/index.js","webpack://cryptoPro/../node_modules/ieee754/index.js","webpack://cryptoPro/../node_modules/isarray/index.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","isSetLogLevel","isPluginLoaded","_afterPluginsLoaded","fn","canPromise","Boolean","Promise","error","console","Error","_extractMeaningfulErrorMessage","cadesplugin","set_log_level","LOG_LEVEL_ERROR","apply","this","args","errorContainer","getLastError","message","test","searchResult","match","__cadesAsyncToken__","__createCadesPluginObject__","_generateCadesFn","callback","cadesGeneratorsAPI","CreateObjectAsync","callbackName","callbackLiteral","String","callbackArguments","callbackBody","replace","crossEnvCallbackLiteral","Function","join","certificatesCache","getUserCertificates","resetCache","eval","cadesStore","cadesCertificates","cadesCertificatesCount","Open","CAPICOM_CURRENT_USER_STORE","CAPICOM_MY_STORE","CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED","Certificates","Find","CAPICOM_CERTIFICATE_FIND_TIME_VALID","CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY","CAPICOM_PROPID_KEY_PROV_INFO","Count","certificateList","cadesCertificate","Item","push","Certificate","_extractCommonName","SubjectName","IssuerName","Thumbprint","ValidFromDate","ValidToDate","Close","getCadesProp","propName","_cadesCertificate","propertyValue","getSystemInfo","sysInfo","cadesVersion","cspVersion","cadesAbout","PluginVersion","CSPVersion","Version","toString","getCertificate","thumbprint","availableCertificates","foundCertificate","find","cert","pluginObject","plugin_resolved","plugin_reject","plugin_resolve","isOpera","isFireFox","isEdge","isSafari","failed_extensions","resolve","reject","browserSpecs","check_browser","ru_cryptopro_npcades_10_native_bridge","callbacksCount","callbacks","resultForCallback","callbackId","resultArray","functionName","hasCallback","iframe","document","createElement","arrObjs","Array","setAttribute","encodeURIComponent","JSON","stringify","e","alert","documentElement","appendChild","parentNode","removeChild","JSModuleVersion","async_spawn","set","set_pluginObject","is_capilite_enabled","isNativeMessageSupported","ReleasePluginObjects","CreateObject","cadesplugin_load_timeout","setTimeout","check_load_timeout","set_constantValues","current_log_level","check_plugin_working","tem","ua","navigator","userAgent","M","version","exec","appName","appVersion","splice","cpcsp_console_log","level","msg","LOG_LEVEL_DEBUG","log","LOG_LEVEL_INFO","info","postMessage","CAPICOM_LOCAL_MACHINE_STORE","CADESCOM_LOCAL_MACHINE_STORE","CADESCOM_CURRENT_USER_STORE","CADESCOM_CONTAINER_STORE","CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME","CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED","CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING","CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE","XmlDsigGost3410UrlObsolete","XmlDsigGost3411UrlObsolete","XmlDsigGost3410Url","XmlDsigGost3411Url","CADESCOM_CADES_DEFAULT","CADESCOM_CADES_BES","CADESCOM_CADES_T","CADESCOM_CADES_X_LONG_TYPE_1","CADESCOM_PKCS7_TYPE","CADESCOM_ENCODE_BASE64","CADESCOM_ENCODE_BINARY","CADESCOM_ENCODE_ANY","CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT","CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN","CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY","CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME","CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME","CAPICOM_CERTIFICATE_FIND_SHA1_HASH","CAPICOM_CERTIFICATE_FIND_ISSUER_NAME","CAPICOM_CERTIFICATE_FIND_ROOT_NAME","CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME","CAPICOM_CERTIFICATE_FIND_EXTENSION","CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY","CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY","CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID","CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED","CAPICOM_CERTIFICATE_FIND_KEY_USAGE","CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE","CAPICOM_PROPID_ENHKEY_USAGE","CAPICOM_OID_OTHER","CAPICOM_OID_KEY_USAGE_EXTENSION","CAPICOM_EKU_CLIENT_AUTH","CAPICOM_EKU_SMARTCARD_LOGON","CAPICOM_EKU_OTHER","CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME","CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME","CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION","CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME","CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME","CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION","CADESCOM_ATTRIBUTE_OTHER","CADESCOM_STRING_TO_UCS2LE","CADESCOM_BASE64_TO_BINARY","CADESCOM_DISPLAY_DATA_NONE","CADESCOM_DISPLAY_DATA_CONTENT","CADESCOM_DISPLAY_DATA_ATTRIBUTE","CADESCOM_ENCRYPTION_ALGORITHM_RC2","CADESCOM_ENCRYPTION_ALGORITHM_RC4","CADESCOM_ENCRYPTION_ALGORITHM_DES","CADESCOM_ENCRYPTION_ALGORITHM_3DES","CADESCOM_ENCRYPTION_ALGORITHM_AES","CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89","CADESCOM_HASH_ALGORITHM_SHA1","CADESCOM_HASH_ALGORITHM_MD2","CADESCOM_HASH_ALGORITHM_MD4","CADESCOM_HASH_ALGORITHM_MD5","CADESCOM_HASH_ALGORITHM_SHA_256","CADESCOM_HASH_ALGORITHM_SHA_384","CADESCOM_HASH_ALGORITHM_SHA_512","CADESCOM_HASH_ALGORITHM_CP_GOST_3411","CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256","CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512","CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC","CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC","CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC","CADESCOM_AllowNone","CADESCOM_AllowNoOutstandingRequest","CADESCOM_AllowUntrustedCertificate","CADESCOM_AllowUntrustedRoot","CADESCOM_SkipInstallToStore","generatorFunc","continuer","verb","arg","result","generator","err","done","then","onFulfilled","onRejected","slice","arguments","isIE","isIOS","call_ru_cryptopro_npcades_10_native_bridge","getElementById","ActiveXObject","decimalToHexString","number","toUpperCase","GetMessageFromException","exception","cpcsp_chrome_nmcades","array","tmpobj","ex","response","str","show_firefox_missing_extension_dialog","cadesplugin_skip_extension_install","ovr","id","style","innerHTML","getElementsByTagName","addEventListener","plugin_loaded_error","visibility","install_opera_extension","event","opr","addons","installExtension","location","reload","stopPropagation","firefox_or_edge_nmcades_onload","check_chrome_plugin","plugin_loaded","nmcades_api_onload","data","url","substring","indexOf","fileref","onerror","onload","load_extension","load_npapi_plugin","elem","elem1","elem2","createPromise","check_npapi_plugin","display","mimetype","mimeTypes","enabledPlugin","div","length","readyState","obj","EnableInternalCSP","issuerName","subjectName","validFrom","validTo","getOwnerInfo","getInfo","SUBJECT_TAGS_TRANSLATIONS","getIssuerInfo","ISSUER_TAGS_TRANSLATIONS","getExtendedKeyUsage","getDecodedExtendedKeyUsage","getAlgorithm","isValid","exportBase64","hasExtendedKeyUsage","oids","CAPICOM_ACTIVE_DIRECTORY_USER_STORE","CAPICOM_MEMORY_STORE","CAPICOM_PROPID_ACCESS_STATE","CAPICOM_PROPID_ARCHIVED","CAPICOM_PROPID_ARCHIVED_KEY_HASH","CAPICOM_PROPID_AUTO_ENROLL","CAPICOM_PROPID_CROSS_CERT_DIST_POINTS","CAPICOM_PROPID_CTL_USAGE","CAPICOM_PROPID_DATE_STAMP","CAPICOM_PROPID_DESCRIPTION","CAPICOM_PROPID_EFS","CAPICOM_PROPID_ENROLLMENT","CAPICOM_PROPID_EXTENDED_ERROR_INFO","CAPICOM_PROPID_FIRST_RESERVED","CAPICOM_PROPID_FIRST_USER","CAPICOM_PROPID_FORTEZZA_DATA","CAPICOM_PROPID_FRIENDLY_NAME","CAPICOM_PROPID_HASH_PROP","CAPICOM_PROPID_IE30_RESERVED","CAPICOM_PROPID_ISSUER_PUBLIC_KEY_MD5_HASH","CAPICOM_PROPID_ISSUER_SERIAL_NUMBER_MD5_HASH","CAPICOM_PROPID_KEY_CONTEXT","CAPICOM_PROPID_KEY_IDENTIFIER","CAPICOM_PROPID_KEY_PROV_HANDLE","CAPICOM_PROPID_KEY_SPEC","CAPICOM_PROPID_LAST_RESERVED","CAPICOM_PROPID_LAST_USER","CAPICOM_PROPID_MD5_HASH","CAPICOM_PROPID_NEXT_UPDATE_LOCATION","CAPICOM_PROPID_PUBKEY_ALG_PARA","CAPICOM_PROPID_PUBKEY_HASH_RESERVED","CAPICOM_PROPID_PVK_FILE","CAPICOM_PROPID_RENEWAL","CAPICOM_PROPID_SHA1_HASH","CAPICOM_PROPID_SIGNATURE_HASH","CAPICOM_PROPID_SMART_CARD_DATA","CAPICOM_PROPID_SUBJECT_NAME_MD5_HASH","CAPICOM_PROPID_SUBJECT_PUBLIC_KEY_MD5_HASH","CAPICOM_PROPID_UNKNOWN","CAPICOM_SMART_CARD_USER_STORE","CAPICOM_STORE_OPEN_EXISTING_ONLY","CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED","CAPICOM_STORE_OPEN_READ_ONLY","CAPICOM_STORE_OPEN_READ_WRITE","CHECK_NONE","CHECK_OFFLINE_REVOCATION_STATUS","CHECK_ONLINE_REVOCATION_STATUS","CHECK_SIGNATURE_VALIDITY","CHECK_TIME_VALIDITY","CHECK_TRUSTED_ROOT","TRUST_CTL_IS_NOT_SIGNATURE_VALID","TRUST_CTL_IS_NOT_TIME_VALID","TRUST_CTL_IS_NOT_VALID_FOR_USAGE","TRUST_IS_CYCLIC","TRUST_IS_NOT_SIGNATURE_VALID","TRUST_IS_NOT_TIME_NESTED","TRUST_IS_NOT_TIME_VALID","TRUST_IS_NOT_VALID_FOR_USAGE","TRUST_IS_PARTIAL_CHAIN","TRUST_IS_REVOKED","TRUST_IS_UNTRUSTED_ROOT","TRUST_REVOCATION_STATUS_UNKNOWN","possibleNames","translation","OIDS_DICTIONARY","base64","Export","cadesPublicKey","algorithmInfo","algorithm","oid","PublicKey","Algorithm","FriendlyName","Value","reduce","decodedOids","oidCode","count","OIDS","ExtendedKeyUsage","EKUs","cadesExtendedKeyUsage","OID","tags","entitiesPath","entities","_parseCertInfo","tagsTranslations","rawInfo","extractedEntities","map","group","segmentsMatch","trim","title","description","oidIdentifierMatch","oidIdentifier","isTranslated","oidTranslation","tagTranslation","tag","certOids","isArray","every","oidToCheck","some","certOid","IsValid","Result","isValidSystemSetup","systemInfo","_isSupportedCadesVersion","_isSupportedCSPVersion","major","patch","Number","createSignature","messageHash","detachedSignature","_getCadesCert","cadesAttrs","cadesSignedData","cadesSigner","cadesAuthAttrs","signature","currentTime","_getDateObj","Date","propset_Name","propset_Value","propset_Certificate","AuthenticatedAttributes2","Add","propset_ContentEncoding","propset_Content","propset_Options","SignCades","cadesCertificateList","certificatesCount","dateObj","getVarDate","createHash","unencryptedMessage","messageBase64","hash","cadesHashedData","Buffer","from","propset_Algorithm","propset_DataEncoding","Hash","ieee754","kMaxLength","TYPED_ARRAY_SUPPORT","createBuffer","that","RangeError","Uint8Array","__proto__","encodingOrOffset","allocUnsafe","TypeError","ArrayBuffer","byteOffset","byteLength","undefined","fromArrayLike","fromArrayBuffer","string","encoding","isEncoding","actual","write","fromString","isBuffer","len","checked","copy","buffer","val","type","fromObject","assertSize","size","isView","loweredCase","utf8ToBytes","base64ToBytes","toLowerCase","slowToString","start","end","hexSlice","utf8Slice","asciiSlice","latin1Slice","base64Slice","utf16leSlice","swap","b","bidirectionalIndexOf","dir","isNaN","arrayIndexOf","lastIndexOf","arr","indexSize","arrLength","valLength","read","buf","readUInt16BE","foundIndex","found","j","hexWrite","offset","remaining","strLen","parsed","parseInt","substr","utf8Write","blitBuffer","asciiWrite","byteArray","charCodeAt","asciiToBytes","latin1Write","base64Write","ucs2Write","units","hi","lo","utf16leToBytes","fromByteArray","Math","min","res","secondByte","thirdByte","fourthByte","tempCodePoint","firstByte","codePoint","bytesPerSequence","codePoints","fromCharCode","decodeCodePointsArray","SlowBuffer","alloc","INSPECT_MAX_BYTES","global","foo","subarray","typedArraySupport","poolSize","_augment","species","configurable","fill","allocUnsafeSlow","_isBuffer","compare","a","x","y","concat","list","pos","swap16","swap32","swap64","equals","inspect","max","target","thisStart","thisEnd","thisCopy","targetCopy","includes","isFinite","toJSON","_arr","ret","out","toHex","bytes","checkOffset","ext","checkInt","objectWriteUInt16","littleEndian","objectWriteUInt32","checkIEEE754","writeFloat","noAssert","writeDouble","newBuf","sliceLen","readUIntLE","mul","readUIntBE","readUInt8","readUInt16LE","readUInt32LE","readUInt32BE","readIntLE","pow","readIntBE","readInt8","readInt16LE","readInt16BE","readInt32LE","readInt32BE","readFloatLE","readFloatBE","readDoubleLE","readDoubleBE","writeUIntLE","writeUIntBE","writeUInt8","floor","writeUInt16LE","writeUInt16BE","writeUInt32LE","writeUInt32BE","writeIntLE","limit","sub","writeIntBE","writeInt8","writeInt16LE","writeInt16BE","writeInt32LE","writeInt32BE","writeFloatLE","writeFloatBE","writeDoubleLE","writeDoubleBE","targetStart","code","INVALID_BASE64_RE","Infinity","leadSurrogate","toByteArray","stringtrim","base64clean","src","dst","g","b64","lens","getLens","validLen","placeHoldersLen","tmp","Arr","_byteLength","curByte","revLookup","uint8","extraBytes","parts","len2","encodeChunk","lookup","num","output","isLE","mLen","nBytes","eLen","eMax","eBias","nBits","NaN","rt","abs","LN2"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,YAAa,GAAIH,GACE,iBAAZC,QACdA,QAAmB,UAAID,IAEvBD,EAAgB,UAAIC,IARtB,CASGK,QAAQ,WACX,O,YCTE,IAAIC,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUP,QAGnC,IAAIC,EAASI,EAAiBE,GAAY,CACzCC,EAAGD,EACHE,GAAG,EACHT,QAAS,IAUV,OANAU,EAAQH,GAAUI,KAAKV,EAAOD,QAASC,EAAQA,EAAOD,QAASM,GAG/DL,EAAOQ,GAAI,EAGJR,EAAOD,QA0Df,OArDAM,EAAoBM,EAAIF,EAGxBJ,EAAoBO,EAAIR,EAGxBC,EAAoBQ,EAAI,SAASd,EAASe,EAAMC,GAC3CV,EAAoBW,EAAEjB,EAASe,IAClCG,OAAOC,eAAenB,EAASe,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEV,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F,KAAK1Z,IAAIrK,GAAS+jB,KAAKgJ,KAClC/sB,GAASZ,EAAI2kB,KAAKyE,IAAI,GAAIrgB,IAAM,IAClCA,IACA/I,GAAK,IAGLY,GADEmI,EAAIukB,GAAS,EACNG,EAAKztB,EAELytB,EAAK9I,KAAKyE,IAAI,EAAG,EAAIkE,IAEpBttB,GAAK,IACf+I,IACA/I,GAAK,GAGH+I,EAAIukB,GAASD,GACfttB,EAAI,EACJgJ,EAAIskB,GACKtkB,EAAIukB,GAAS,GACtBvtB,GAAMa,EAAQZ,EAAK,GAAK2kB,KAAKyE,IAAI,EAAG8D,GACpCnkB,GAAQukB,IAERvtB,EAAIa,EAAQ+jB,KAAKyE,IAAI,EAAGkE,EAAQ,GAAK3I,KAAKyE,IAAI,EAAG8D,GACjDnkB,EAAI,IAIDmkB,GAAQ,EAAGjM,EAAOsC,EAAS5jB,GAAS,IAAJI,EAAUJ,GAAKM,EAAGF,GAAK,IAAKmtB,GAAQ,GAI3E,IAFAnkB,EAAKA,GAAKmkB,EAAQntB,EAClBqtB,GAAQF,EACDE,EAAO,EAAGnM,EAAOsC,EAAS5jB,GAAS,IAAJoJ,EAAUpJ,GAAKM,EAAG8I,GAAK,IAAKqkB,GAAQ,GAE1EnM,EAAOsC,EAAS5jB,EAAIM,IAAU,IAAJyB,I,cClF5B,IAAIgF,EAAW,GAAGA,SAElBtH,EAAOD,QAAUuJ,MAAM2T,SAAW,SAAUuG,GAC1C,MAA6B,kBAAtBlc,EAAS5G,KAAK8iB","file":"crypto-pro.min.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 = 8);\n","import { _extractMeaningfulErrorMessage } from './_extractMeaningfulErrorMessage';\n\ntype Unpromisify = T extends Promise ? R : T;\n\nlet isSetLogLevel = false;\nlet isPluginLoaded = false;\n\nexport const _afterPluginsLoaded = any>(\n fn: T,\n): ((...args: Parameters) => Promise>>) => {\n const canPromise = Boolean(window.Promise);\n\n return async function (...args: Parameters): Promise>> {\n if (!isPluginLoaded) {\n try {\n require('../vendor/cadesplugin_api');\n } catch (error) {\n console.error(error);\n\n throw new Error(\n _extractMeaningfulErrorMessage(error) || 'Ошибка при подключении модуля для работы с Cades plugin',\n );\n }\n\n isPluginLoaded = true;\n }\n\n const { cadesplugin } = window;\n\n if (!canPromise) {\n throw new Error('Необходим полифилл для Promise');\n }\n\n if (!cadesplugin) {\n throw new Error('Не подключен модуль для работы с Cades plugin');\n }\n\n if (!isSetLogLevel) {\n cadesplugin.set_log_level(cadesplugin.LOG_LEVEL_ERROR);\n\n isSetLogLevel = true;\n }\n\n try {\n await cadesplugin;\n } catch (error) {\n console.error(error);\n\n throw new Error(\n _extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации модуля для работы с Cades plugin',\n );\n }\n\n return await fn.apply(this, args);\n };\n};\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)|(?:\\.?$))/);\n\n return searchResult ? searchResult[1] : null;\n};\n","// синтетические переменные, которые подменяются в рантайме\nexport const __cadesAsyncToken__ = {};\nexport const __createCadesPluginObject__ = (...args): any => ({});\n\nfunction getGeneratorConstructor(): GeneratorFunction {\n return new Function('', 'return Object.getPrototypeOf(function*(){}).constructor')();\n}\n\nexport const _generateCadesFn = (callback: Function): string => {\n const { cadesplugin } = window;\n const cadesGeneratorsAPI = Boolean(cadesplugin.CreateObjectAsync);\n const callbackName = callback.name || 'dynamicFn';\n const callbackLiteral = String(callback);\n const callbackArguments = callbackLiteral.match(/^function[\\s\\w]*?\\((.*?)\\)/)?.[1] || '';\n const callbackBody = callbackLiteral.replace(/^.*?{([\\s\\S]*?)}$/, '$1');\n let crossEnvCallbackLiteral = String(\n new (cadesGeneratorsAPI ? getGeneratorConstructor() : Function)(callbackArguments, callbackBody),\n );\n\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(\n /\\w+?\\.__createCadesPluginObject__(\\([\\s\\S]*?\\))/gm,\n `cadesplugin.CreateObject${cadesGeneratorsAPI ? 'Async' : ''}$1`,\n );\n\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(\n /\\w+?\\.__cadesAsyncToken__\\s*?\\+\\s*?\\b/gm,\n cadesGeneratorsAPI ? 'yield ' : '',\n );\n\n if (!cadesGeneratorsAPI) {\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/propset_(.*?)\\((.*?)\\)/gm, '$1 = $2');\n }\n\n return [\n cadesGeneratorsAPI ? `cadesplugin.async_spawn(${crossEnvCallbackLiteral});` : `(${crossEnvCallbackLiteral})();`,\n `//# sourceURL=crypto-pro_${callbackName}.js`,\n ].join('');\n};\n","export * from './cades-constants';\nexport * from './issuer-tags-translations';\nexport * from './oids-dictionary';\nexport * from './subject-tags-translations';\n","import { CadesCertificate, Certificate } from './certificate';\nimport { CAPICOM_PROPID_KEY_PROV_INFO } from '../constants';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractCommonName } from '../helpers/_extractCommonName';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\nlet certificatesCache: Certificate[];\n\n/**\n * Возвращает список сертификатов, доступных пользователю в системе\n *\n * @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов\n * @returns список сертификатов\n */\nexport const getUserCertificates = _afterPluginsLoaded((resetCache: boolean = false): Certificate[] => {\n const { cadesplugin } = window;\n\n if (!resetCache && certificatesCache) {\n return certificatesCache;\n }\n\n return eval(\n _generateCadesFn(function getUserCertificates(): Certificate[] {\n let cadesStore;\n\n try {\n cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');\n }\n\n try {\n void (\n __cadesAsyncToken__ +\n cadesStore.Open(\n cadesplugin.CAPICOM_CURRENT_USER_STORE,\n cadesplugin.CAPICOM_MY_STORE,\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,\n )\n );\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');\n }\n\n let cadesCertificates;\n let cadesCertificatesCount;\n\n try {\n cadesCertificates = __cadesAsyncToken__ + cadesStore.Certificates;\n\n if (cadesCertificates) {\n cadesCertificates =\n __cadesAsyncToken__ + cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID);\n\n /**\n * Не рассматриваются сертификаты, в которых отсутствует закрытый ключ\n * или не действительны на данный момент\n */\n cadesCertificates =\n __cadesAsyncToken__ +\n cadesCertificates.Find(\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY,\n CAPICOM_PROPID_KEY_PROV_INFO,\n );\n\n cadesCertificatesCount = __cadesAsyncToken__ + cadesCertificates.Count;\n }\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');\n }\n\n if (!cadesCertificatesCount) {\n throw new Error('Нет доступных сертификатов');\n }\n\n const certificateList: Certificate[] = [];\n\n try {\n while (cadesCertificatesCount) {\n const cadesCertificate: CadesCertificate =\n __cadesAsyncToken__ + cadesCertificates.Item(cadesCertificatesCount);\n\n certificateList.push(\n new Certificate(\n cadesCertificate,\n _extractCommonName(__cadesAsyncToken__ + cadesCertificate.SubjectName),\n __cadesAsyncToken__ + cadesCertificate.IssuerName,\n __cadesAsyncToken__ + cadesCertificate.SubjectName,\n __cadesAsyncToken__ + cadesCertificate.Thumbprint,\n __cadesAsyncToken__ + cadesCertificate.ValidFromDate,\n __cadesAsyncToken__ + cadesCertificate.ValidToDate,\n ),\n );\n\n cadesCertificatesCount--;\n }\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка обработки сертификатов');\n }\n\n cadesStore.Close();\n\n certificatesCache = certificateList;\n\n return certificatesCache;\n }),\n );\n});\n","export * from './certificate';\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Возвращает указанное внутренее свойство у сертификата в формате Cades\n *\n * @param propName = наименование свойства\n * @returns значение запрошенного свойства\n */\nexport const getCadesProp = _afterPluginsLoaded(function (propName: string): any {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function getCadesProp() {\n let propertyValue;\n\n try {\n propertyValue = __cadesAsyncToken__ + cadesCertificate[propName];\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при обращении к свойству сертификата');\n }\n\n return propertyValue;\n }),\n );\n});\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\nexport interface SystemInfo {\n cadesVersion: string;\n cspVersion: string;\n}\n\n/**\n * Предоставляет информацию о системе\n *\n * @returns информацию о CSP и плагине\n */\nexport const getSystemInfo = _afterPluginsLoaded(\n (): SystemInfo => {\n const sysInfo = {\n cadesVersion: null,\n cspVersion: null,\n };\n\n return eval(\n _generateCadesFn(function getSystemInfo(): SystemInfo {\n let cadesAbout;\n\n try {\n cadesAbout = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.About');\n\n sysInfo.cadesVersion = __cadesAsyncToken__ + cadesAbout.PluginVersion;\n sysInfo.cspVersion = __cadesAsyncToken__ + cadesAbout.CSPVersion();\n\n if (!sysInfo.cadesVersion) {\n sysInfo.cadesVersion = __cadesAsyncToken__ + cadesAbout.Version;\n }\n\n sysInfo.cadesVersion = __cadesAsyncToken__ + sysInfo.cadesVersion.toString();\n sysInfo.cspVersion = __cadesAsyncToken__ + sysInfo.cspVersion.toString();\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении информации о системе');\n }\n\n return sysInfo;\n }),\n );\n },\n);\n","export * from './api';\n","export * from './getCertificate';\nexport * from './getUserCertificates';\nexport * from './getSystemInfo';\nexport * from './isValidSystemSetup';\nexport * from './createSignature';\nexport * from './createHash';\nexport * from './certificate';\n","import { Certificate } from './certificate';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { getUserCertificates } from './getUserCertificates';\n\n/**\n * Возвращает сертификат по отпечатку\n *\n * @param thumbprint - отпечаток сертификата\n * @returns сертификат\n */\nexport const getCertificate = _afterPluginsLoaded(\n async (thumbprint: string): Promise => {\n if (!thumbprint) {\n throw new Error('Отпечаток не указан');\n }\n\n const availableCertificates: Certificate[] = await getUserCertificates();\n const foundCertificate: Certificate = availableCertificates.find((cert) => cert.thumbprint === thumbprint);\n\n if (!foundCertificate) {\n throw new Error(`Сертификат с отпечатком: \"${thumbprint}\" не найден`);\n }\n\n return foundCertificate;\n },\n);\n",";(function () {\n //already loaded\n if(window.cadesplugin)\n return;\n\n var pluginObject;\n var plugin_resolved = 0;\n var plugin_reject;\n var plugin_resolve;\n var isOpera = 0;\n var isFireFox = 0;\n var isEdge = 0;\n var isSafari = 0;\n var failed_extensions = 0;\n\n var canPromise = !!window.Promise;\n var cadesplugin;\n\n if(canPromise)\n {\n cadesplugin = new Promise(function(resolve, reject)\n {\n plugin_resolve = resolve;\n plugin_reject = reject;\n });\n } else\n {\n cadesplugin = {};\n }\n\n function check_browser() {\n var ua= navigator.userAgent, tem, M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\\/))\\/?\\s*(\\d+)/i) || [];\n if(/trident/i.test(M[1])){\n tem= /\\brv[ :]+(\\d+)/g.exec(ua) || [];\n return {name:'IE',version:(tem[1] || '')};\n }\n if(M[1]=== 'Chrome'){\n tem= ua.match(/\\b(OPR|Edge)\\/(\\d+)/);\n if(tem!= null) return {name:tem[1].replace('OPR', 'Opera'),version:tem[2]};\n }\n M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];\n if((tem= ua.match(/version\\/(\\d+)/i))!= null) M.splice(1, 1, tem[1]);\n return {name:M[0],version:M[1]};\n }\n var browserSpecs = check_browser();\n\n function cpcsp_console_log(level, msg){\n //IE9 не может писать в консоль если не открыта вкладка developer tools\n if(typeof(console) === 'undefined')\n return;\n if (level <= cadesplugin.current_log_level ){\n if (level === cadesplugin.LOG_LEVEL_DEBUG)\n console.log(\"DEBUG: %s\", msg);\n if (level === cadesplugin.LOG_LEVEL_INFO)\n console.info(\"INFO: %s\", msg);\n if (level === cadesplugin.LOG_LEVEL_ERROR)\n console.error(\"ERROR: %s\", msg);\n return;\n }\n }\n\n function set_log_level(level){\n if (!((level === cadesplugin.LOG_LEVEL_DEBUG) ||\n (level === cadesplugin.LOG_LEVEL_INFO) ||\n (level === cadesplugin.LOG_LEVEL_ERROR))){\n cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, \"cadesplugin_api.js: Incorrect log_level: \" + level);\n return;\n }\n cadesplugin.current_log_level = level;\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = DEBUG\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = INFO\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = ERROR\");\n if(isNativeMessageSupported())\n {\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG)\n window.postMessage(\"set_log_level=debug\", \"*\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO)\n window.postMessage(\"set_log_level=info\", \"*\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR)\n window.postMessage(\"set_log_level=error\", \"*\");\n }\n }\n\n function set_constantValues()\n {\n cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CAPICOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CADESCOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_CONTAINER_STORE = 100;\n\n cadesplugin.CAPICOM_MY_STORE = \"My\";\n\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;\n\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\n\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;\n\n cadesplugin.XmlDsigGost3410UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411\";\n cadesplugin.XmlDsigGost3411UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr3411\";\n cadesplugin.XmlDsigGost3410Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411\";\n cadesplugin.XmlDsigGost3411Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411\";\n\n cadesplugin.CADESCOM_CADES_DEFAULT = 0;\n cadesplugin.CADESCOM_CADES_BES = 1;\n cadesplugin.CADESCOM_CADES_T = 0x5;\n cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;\n cadesplugin.CADESCOM_PKCS7_TYPE = 0xffff;\n\n cadesplugin.CADESCOM_ENCODE_BASE64 = 0;\n cadesplugin.CADESCOM_ENCODE_BINARY = 1;\n cadesplugin.CADESCOM_ENCODE_ANY = -1;\n\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;\n\n cadesplugin.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;\n cadesplugin.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;\n\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;\n\n cadesplugin.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;\n\n cadesplugin.CAPICOM_PROPID_ENHKEY_USAGE = 9;\n\n cadesplugin.CAPICOM_OID_OTHER = 0;\n cadesplugin.CAPICOM_OID_KEY_USAGE_EXTENSION = 10;\n\n cadesplugin.CAPICOM_EKU_CLIENT_AUTH = 2;\n cadesplugin.CAPICOM_EKU_SMARTCARD_LOGON = 5;\n cadesplugin.CAPICOM_EKU_OTHER = 0;\n\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\n cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1;\n\n cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0;\n cadesplugin.CADESCOM_BASE64_TO_BINARY = 1;\n\n cadesplugin.CADESCOM_DISPLAY_DATA_NONE = 0;\n cadesplugin.CADESCOM_DISPLAY_DATA_CONTENT = 1;\n cadesplugin.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;\n\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;\n\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA1 = 0;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD2 = 1;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD4 = 2;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD5 = 3;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_256 = 4;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_384 = 5;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_512 = 6;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112;\n\n cadesplugin.LOG_LEVEL_DEBUG = 4;\n cadesplugin.LOG_LEVEL_INFO = 2;\n cadesplugin.LOG_LEVEL_ERROR = 1;\n\n cadesplugin.CADESCOM_AllowNone = 0;\n cadesplugin.CADESCOM_AllowNoOutstandingRequest = 0x1;\n cadesplugin.CADESCOM_AllowUntrustedCertificate = 0x2;\n cadesplugin.CADESCOM_AllowUntrustedRoot = 0x4;\n cadesplugin.CADESCOM_SkipInstallToStore = 0x10000000;\n }\n\n function async_spawn(generatorFunc) {\n function continuer(verb, arg) {\n var result;\n try {\n result = generator[verb](arg);\n } catch (err) {\n return Promise.reject(err);\n }\n if (result.done) {\n return result.value;\n } else {\n return Promise.resolve(result.value).then(onFulfilled, onRejected);\n }\n }\n var generator = generatorFunc(Array.prototype.slice.call(arguments, 1));\n var onFulfilled = continuer.bind(continuer, \"next\");\n var onRejected = continuer.bind(continuer, \"throw\");\n return onFulfilled();\n }\n\n function isIE() {\n // var retVal = ((\"Microsoft Internet Explorer\" == navigator.appName) || // IE < 11\n // navigator.userAgent.match(/Trident\\/./i)); // IE 11\n return (browserSpecs.name === 'IE' || browserSpecs.name === 'MSIE');\n }\n\n function isIOS() {\n return (navigator.userAgent.match(/ipod/i) ||\n navigator.userAgent.match(/ipad/i) ||\n navigator.userAgent.match(/iphone/i));\n }\n\n function isNativeMessageSupported()\n {\n // В IE работаем через NPAPI\n if(isIE())\n return false;\n // В Edge работаем через NativeMessage\n if(browserSpecs.name === 'Edge') {\n isEdge = true;\n return true;\n }\n // В Chrome, Firefox, Safari и Opera работаем через асинхронную версию в зависимости от версии\n if(browserSpecs.name === 'Opera') {\n isOpera = true;\n if(browserSpecs.version >= 33){\n return true;\n }\n else{\n return false;\n }\n }\n if(browserSpecs.name === 'Firefox') {\n isFireFox = true;\n if(browserSpecs.version >= 52){\n return true;\n }\n else{\n return false;\n }\n }\n if(browserSpecs.name === 'Chrome') {\n if(browserSpecs.version >= 42){\n return true;\n }\n else{\n return false;\n }\n }\n //В Сафари начиная с 12 версии нет NPAPI\n if(browserSpecs.name === 'Safari') {\n isSafari = true;\n if(browserSpecs.version >= 12) {\n return true;\n } else {\n return false;\n }\n }\n }\n\n // Функция активации объектов КриптоПро ЭЦП Browser plug-in\n function CreateObject(name) {\n if (isIOS()) {\n // На iOS для создания объектов используется функция\n // call_ru_cryptopro_npcades_10_native_bridge, определенная в IOS_npcades_supp.js\n return call_ru_cryptopro_npcades_10_native_bridge(\"CreateObject\", [name]);\n }\n if (isIE()) {\n // В Internet Explorer создаются COM-объекты\n if (name.match(/X509Enrollment/i)) {\n try {\n // Объекты CertEnroll пробуем создавать через нашу фабрику,\n // если не получилось то через CX509EnrollmentWebClassFactory\n var objCertEnrollClassFactory = document.getElementById(\"webClassFactory\");\n return objCertEnrollClassFactory.CreateObject(name);\n }\n catch (e) {\n try {\n var objWebClassFactory = document.getElementById(\"certEnrollClassFactory\");\n return objWebClassFactory.CreateObject(name);\n }\n catch (err) {\n throw (\"Для создания обьектов X509Enrollment следует настроить веб-узел на использование проверки подлинности по протоколу HTTPS\");\n }\n }\n }\n // Объекты CAPICOM и CAdESCOM создаются через CAdESCOM.WebClassFactory\n try {\n var objWebClassFactory = document.getElementById(\"webClassFactory\");\n return objWebClassFactory.CreateObject(name);\n }\n catch (e) {\n // Для версий плагина ниже 2.0.12538\n return new ActiveXObject(name);\n }\n }\n // создаются объекты NPAPI\n return pluginObject.CreateObject(name);\n }\n\n function decimalToHexString(number) {\n if (number < 0) {\n number = 0xFFFFFFFF + number + 1;\n }\n\n return number.toString(16).toUpperCase();\n }\n\n function GetMessageFromException(e) {\n var err = e.message;\n if (!err) {\n err = e;\n } else if (e.number) {\n err += \" (0x\" + decimalToHexString(e.number) + \")\";\n }\n return err;\n }\n\n function getLastError(exception) {\n if(isNativeMessageSupported() || isIE() || isIOS() ) {\n return GetMessageFromException(exception);\n }\n\n try {\n return pluginObject.getLastError();\n } catch(e) {\n return GetMessageFromException(exception);\n }\n }\n\n // Функция для удаления созданных объектов\n function ReleasePluginObjects() {\n return cpcsp_chrome_nmcades.ReleasePluginObjects();\n }\n\n // Функция активации асинхронных объектов КриптоПро ЭЦП Browser plug-in\n function CreateObjectAsync(name) {\n return pluginObject.CreateObjectAsync(name);\n }\n\n //Функции для IOS\n var ru_cryptopro_npcades_10_native_bridge = {\n callbacksCount : 1,\n callbacks : {},\n\n // Automatically called by native layer when a result is available\n resultForCallback : function resultForCallback(callbackId, resultArray) {\n var callback = ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId];\n if (!callback) return;\n callback.apply(null,resultArray);\n },\n\n // Use this in javascript to request native objective-c code\n // functionName : string (I think the name is explicit :p)\n // args : array of arguments\n // callback : function with n-arguments that is going to be called when the native code returned\n call : function call(functionName, args, callback) {\n var hasCallback = callback && typeof callback === \"function\";\n var callbackId = hasCallback ? ru_cryptopro_npcades_10_native_bridge.callbacksCount++ : 0;\n\n if (hasCallback)\n ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId] = callback;\n\n var iframe = document.createElement(\"IFRAME\");\n var arrObjs = new Array(\"_CPNP_handle\");\n try{\n iframe.setAttribute(\"src\", \"cpnp-js-call:\" + functionName + \":\" + callbackId+ \":\" + encodeURIComponent(JSON.stringify(args, arrObjs)));\n } catch(e){\n alert(e);\n }\n document.documentElement.appendChild(iframe);\n iframe.parentNode.removeChild(iframe);\n iframe = null;\n }\n };\n\n function call_ru_cryptopro_npcades_10_native_bridge(functionName, array){\n var tmpobj;\n var ex;\n ru_cryptopro_npcades_10_native_bridge.call(functionName, array, function(e, response){\n ex = e;\n var str='tmpobj='+response;\n eval(str);\n if (typeof (tmpobj) === \"string\"){\n tmpobj = tmpobj.replace(/\\\\\\n/gm, \"\\n\");\n tmpobj = tmpobj.replace(/\\\\\\r/gm, \"\\r\");\n }\n });\n if(ex)\n throw ex;\n return tmpobj;\n }\n\n function show_firefox_missing_extension_dialog()\n {\n if (!window.cadesplugin_skip_extension_install)\n {\n var ovr = document.createElement('div');\n ovr.id = \"cadesplugin_ovr\";\n ovr.style = \"visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)\";\n ovr.innerHTML = \"
\" +\n \"\" +\n \"

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

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

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

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

\" +\n \"
\";\n document.getElementsByTagName(\"Body\")[0].appendChild(ovr);\n var btn_install = document.getElementById(\"cadesplugin_install\");\n btn_install.addEventListener('click', function(event) {\n opr.addons.installExtension(\"epebfcehmdedogndhlcacafjaacknbcm\",\n function()\n {\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n location.reload();\n },\n function(){})\n });\n document.getElementById(\"cadesplugin_close_install\").addEventListener('click',function()\n {\n plugin_loaded_error(\"Плагин недоступен\");\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n });\n\n ovr.addEventListener('click',function()\n {\n plugin_loaded_error(\"Плагин недоступен\");\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n });\n ovr.style.visibility=\"visible\";\n document.getElementById(\"cadesplugin_ovr_item\").addEventListener('click',function(e){\n e.stopPropagation();\n });\n });\n }else\n {\n plugin_loaded_error(\"Плагин недоступен\");\n }\n }\n\n function firefox_or_edge_nmcades_onload() {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n\n function nmcades_api_onload () {\n window.postMessage(\"cadesplugin_echo_request\", \"*\");\n window.addEventListener(\"message\", function (event){\n if (typeof(event.data) !== \"string\" || !event.data.match(\"cadesplugin_loaded\"))\n return;\n if(isFireFox || isEdge || isSafari)\n {\n // Для Firefox, Сафари, Edge вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js\n var url = event.data.substring(event.data.indexOf(\"url:\") + 4);\n var fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", url);\n fileref.onerror = plugin_loaded_error;\n fileref.onload = firefox_or_edge_nmcades_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n // Для Firefox, Safari и Edge у нас только по одному расширению.\n failed_extensions++;\n }else {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n }, false);\n }\n\n //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari\n function load_extension()\n {\n\n if(isFireFox || isEdge || isSafari){\n // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера.\n nmcades_api_onload();\n } else {\n // в асинхронном варианте для chrome и opera подключаем оба расширения\n var fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", \"chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js\");\n fileref.onerror = plugin_loaded_error;\n fileref.onload = nmcades_api_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", \"chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js\");\n fileref.onerror = plugin_loaded_error;\n fileref.onload = nmcades_api_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n }\n }\n\n //Загружаем плагин для NPAPI\n function load_npapi_plugin()\n {\n var elem = document.createElement('object');\n elem.setAttribute(\"id\", \"cadesplugin_object\");\n elem.setAttribute(\"type\", \"application/x-cades\");\n elem.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem);\n pluginObject = document.getElementById(\"cadesplugin_object\");\n if(isIE())\n {\n var elem1 = document.createElement('object');\n elem1.setAttribute(\"id\", \"certEnrollClassFactory\");\n elem1.setAttribute(\"classid\", \"clsid:884e2049-217d-11da-b2a4-000e7bbb2b09\");\n elem1.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem1);\n var elem2 = document.createElement('object');\n elem2.setAttribute(\"id\", \"webClassFactory\");\n elem2.setAttribute(\"classid\", \"clsid:B04C8637-10BD-484E-B0DA-B8A039F60024\");\n elem2.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem2);\n }\n }\n\n //Отправляем событие что все ок.\n function plugin_loaded()\n {\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_resolve();\n }else {\n window.postMessage(\"cadesplugin_loaded\", \"*\");\n }\n }\n\n //Отправляем событие что сломались.\n function plugin_loaded_error(msg)\n {\n if(isNativeMessageSupported())\n {\n //в асинхронном варианте подключаем оба расширения, если сломались оба пробуем установить для Opera\n failed_extensions++;\n if(failed_extensions<2)\n return;\n if(isOpera && (typeof(msg) === 'undefined'|| typeof(msg) === 'object'))\n {\n install_opera_extension();\n return;\n }\n }\n if(typeof(msg) === 'undefined' || typeof(msg) === 'object')\n msg = \"Плагин недоступен\";\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_reject(msg);\n } else {\n window.postMessage(\"cadesplugin_load_error\", \"*\");\n }\n }\n\n //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку\n function check_load_timeout()\n {\n if(plugin_resolved === 1)\n return;\n if(isFireFox)\n {\n show_firefox_missing_extension_dialog();\n }\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_reject(\"Истекло время ожидания загрузки плагина\");\n } else {\n window.postMessage(\"cadesplugin_load_error\", \"*\");\n }\n\n }\n\n //Вспомогательная функция для NPAPI\n function createPromise(arg)\n {\n return new Promise(arg);\n }\n\n function check_npapi_plugin (){\n try {\n var oAbout = CreateObject(\"CAdESCOM.About\");\n plugin_loaded();\n }\n catch (err) {\n document.getElementById(\"cadesplugin_object\").style.display = 'none';\n // Объект создать не удалось, проверим, установлен ли\n // вообще плагин. Такая возможность есть не во всех браузерах\n var mimetype = navigator.mimeTypes[\"application/x-cades\"];\n if (mimetype) {\n var plugin = mimetype.enabledPlugin;\n if (plugin) {\n plugin_loaded_error(\"Плагин загружен, но не создаются обьекты\");\n }else\n {\n plugin_loaded_error(\"Ошибка при загрузке плагина\");\n }\n }else\n {\n plugin_loaded_error(\"Плагин недоступен\");\n }\n }\n }\n\n //Проверяем работает ли плагин\n function check_plugin_working()\n {\n var div = document.createElement(\"div\");\n div.innerHTML = \"\";\n var isIeLessThan9 = (div.getElementsByTagName(\"i\").length === 1);\n if (isIeLessThan9) {\n plugin_loaded_error(\"Internet Explorer версии 8 и ниже не поддерживается\");\n return;\n }\n\n if(isNativeMessageSupported())\n {\n load_extension();\n }else if(!canPromise) {\n window.addEventListener(\"message\", function (event){\n if (event.data !== \"cadesplugin_echo_request\")\n return;\n load_npapi_plugin();\n check_npapi_plugin();\n },\n false);\n }else\n {\n if(document.readyState === \"complete\"){\n load_npapi_plugin();\n check_npapi_plugin();\n } else {\n window.addEventListener(\"load\", function (event) {\n load_npapi_plugin();\n check_npapi_plugin();\n }, false);\n }\n }\n }\n\n function set_pluginObject(obj)\n {\n pluginObject = obj;\n }\n\n function is_capilite_enabled()\n {\n if ((typeof (cadesplugin.EnableInternalCSP) !== 'undefined') && cadesplugin.EnableInternalCSP)\n return true;\n return false;\n };\n\n //Export\n cadesplugin.JSModuleVersion = \"2.1.2\";\n cadesplugin.async_spawn = async_spawn;\n cadesplugin.set = set_pluginObject;\n cadesplugin.set_log_level = set_log_level;\n cadesplugin.getLastError = getLastError;\n cadesplugin.is_capilite_enabled = is_capilite_enabled;\n\n if(isNativeMessageSupported())\n {\n cadesplugin.CreateObjectAsync = CreateObjectAsync;\n cadesplugin.ReleasePluginObjects = ReleasePluginObjects;\n }\n\n if(!isNativeMessageSupported())\n {\n cadesplugin.CreateObject = CreateObject;\n }\n\n if(window.cadesplugin_load_timeout)\n {\n setTimeout(check_load_timeout, window.cadesplugin_load_timeout);\n }\n else\n {\n setTimeout(check_load_timeout, 20000);\n }\n\n set_constantValues();\n\n cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR;\n window.cadesplugin = cadesplugin;\n check_plugin_working();\n}());\n","import { ISSUER_TAGS_TRANSLATIONS, SUBJECT_TAGS_TRANSLATIONS } from '../../constants';\nimport { TagTranslation } from '../../helpers/_parseCertInfo';\nimport { exportBase64 } from './exportBase64';\nimport { getAlgorithm } from './getAlgorithm';\nimport { getCadesProp } from './getCadesProp';\nimport { getDecodedExtendedKeyUsage, ExtendedKeysTranslations } from './getDecodedExtendedKeyUsage';\nimport { getExtendedKeyUsage } from './getExtendedKeyUsage';\nimport { getInfo } from './getInfo';\nimport { hasExtendedKeyUsage } from './hasExtendedKeyUsage';\nimport { isValid } from './isValid';\n\nexport type CadesCertificate = any;\n\nexport class Certificate {\n constructor(\n public _cadesCertificate: CadesCertificate,\n public name: string,\n public issuerName: string,\n public subjectName: string,\n public thumbprint: string,\n public validFrom: string,\n public validTo: string,\n ) {}\n\n public getOwnerInfo(): Promise {\n return getInfo.call(this, SUBJECT_TAGS_TRANSLATIONS, 'SubjectName');\n }\n\n public getIssuerInfo(): Promise {\n return getInfo.call(this, ISSUER_TAGS_TRANSLATIONS, 'IssuerName');\n }\n\n public getExtendedKeyUsage(): Promise {\n return getExtendedKeyUsage.call(this);\n }\n\n public getDecodedExtendedKeyUsage(): Promise {\n return getDecodedExtendedKeyUsage.call(this);\n }\n\n public getAlgorithm(): Promise {\n return getAlgorithm.call(this);\n }\n\n public getCadesProp(propName): Promise {\n return getCadesProp.call(this, propName);\n }\n\n public isValid(): Promise {\n return isValid.call(this);\n }\n\n public exportBase64(): Promise {\n return exportBase64.call(this);\n }\n\n public hasExtendedKeyUsage(oids): Promise {\n return hasExtendedKeyUsage.call(this, oids);\n }\n}\n","export const CADESCOM_ATTRIBUTE_OTHER = -1;\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\nexport const CADESCOM_AllowNoOutstandingRequest = 1;\nexport const CADESCOM_AllowNone = 0;\nexport const CADESCOM_AllowUntrustedCertificate = 2;\nexport const CADESCOM_AllowUntrustedRoot = 4;\nexport const CADESCOM_BASE64_TO_BINARY = 0x01;\nexport const CADESCOM_CADES_BES = 1;\nexport const CADESCOM_CADES_DEFAULT = 0;\nexport const CADESCOM_CADES_T = 5;\nexport const CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;\nexport const CADESCOM_CONTAINER_STORE = 100;\nexport const CADESCOM_CURRENT_USER_STORE = 2;\nexport const CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;\nexport const CADESCOM_DISPLAY_DATA_CONTENT = 1;\nexport const CADESCOM_DISPLAY_DATA_NONE = 0;\nexport const CADESCOM_ENCODE_ANY = -1;\nexport const CADESCOM_ENCODE_BASE64 = 0;\nexport const CADESCOM_ENCODE_BINARY = 1;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110;\nexport const CADESCOM_HASH_ALGORITHM_MD2 = 1;\nexport const CADESCOM_HASH_ALGORITHM_MD4 = 2;\nexport const CADESCOM_HASH_ALGORITHM_MD5 = 3;\nexport const CADESCOM_HASH_ALGORITHM_SHA1 = 0;\nexport const CADESCOM_HASH_ALGORITHM_SHA_256 = 4;\nexport const CADESCOM_HASH_ALGORITHM_SHA_384 = 5;\nexport const CADESCOM_HASH_ALGORITHM_SHA_512 = 6;\nexport const CADESCOM_LOCAL_MACHINE_STORE = 1;\nexport const CADESCOM_PKCS7_TYPE = 65535;\nexport const CADESCOM_STRING_TO_UCS2LE = 0x00;\nexport const CADESCOM_SkipInstallToStore = 268435456;\nexport const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;\nexport const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;\nexport const CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;\nexport const CAPICOM_ACTIVE_DIRECTORY_USER_STORE = 3;\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\nexport const CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;\nexport const CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;\nexport const CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;\nexport const CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;\nexport const CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;\nexport const CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;\nexport const CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;\nexport const CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;\nexport const CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\nexport const CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;\nexport const CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;\nexport const CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;\nexport const CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;\nexport const CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;\nexport const CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;\nexport const CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;\nexport const CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;\nexport const CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;\nexport const CAPICOM_CURRENT_USER_STORE = 2;\nexport const CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;\nexport const CAPICOM_EKU_CLIENT_AUTH = 2;\nexport const CAPICOM_EKU_OTHER = 0;\nexport const CAPICOM_EKU_SMARTCARD_LOGON = 5;\nexport const CAPICOM_LOCAL_MACHINE_STORE = 1;\nexport const CAPICOM_MEMORY_STORE = 0;\nexport const CAPICOM_MY_STORE = 'My';\nexport const CAPICOM_OID_KEY_USAGE_EXTENSION = 10;\nexport const CAPICOM_OID_OTHER = 0;\nexport const CAPICOM_PROPID_ACCESS_STATE = 14;\nexport const CAPICOM_PROPID_ARCHIVED = 19;\nexport const CAPICOM_PROPID_ARCHIVED_KEY_HASH = 65;\nexport const CAPICOM_PROPID_AUTO_ENROLL = 21;\nexport const CAPICOM_PROPID_CROSS_CERT_DIST_POINTS = 23;\nexport const CAPICOM_PROPID_CTL_USAGE = 9;\nexport const CAPICOM_PROPID_DATE_STAMP = 27;\nexport const CAPICOM_PROPID_DESCRIPTION = 13;\nexport const CAPICOM_PROPID_EFS = 17;\nexport const CAPICOM_PROPID_ENHKEY_USAGE = 9;\nexport const CAPICOM_PROPID_ENROLLMENT = 26;\nexport const CAPICOM_PROPID_EXTENDED_ERROR_INFO = 30;\nexport const CAPICOM_PROPID_FIRST_RESERVED = 66;\nexport const CAPICOM_PROPID_FIRST_USER = 0x00008000;\nexport const CAPICOM_PROPID_FORTEZZA_DATA = 18;\nexport const CAPICOM_PROPID_FRIENDLY_NAME = 11;\nexport const CAPICOM_PROPID_HASH_PROP = 3;\nexport const CAPICOM_PROPID_IE30_RESERVED = 7;\nexport const CAPICOM_PROPID_ISSUER_PUBLIC_KEY_MD5_HASH = 24;\nexport const CAPICOM_PROPID_ISSUER_SERIAL_NUMBER_MD5_HASH = 28;\nexport const CAPICOM_PROPID_KEY_CONTEXT = 5;\nexport const CAPICOM_PROPID_KEY_IDENTIFIER = 20;\nexport const CAPICOM_PROPID_KEY_PROV_HANDLE = 1;\nexport const CAPICOM_PROPID_KEY_PROV_INFO = 2;\nexport const CAPICOM_PROPID_KEY_SPEC = 6;\nexport const CAPICOM_PROPID_LAST_RESERVED = 0x00007fff;\nexport const CAPICOM_PROPID_LAST_USER = 0x0000ffff;\nexport const CAPICOM_PROPID_MD5_HASH = 4;\nexport const CAPICOM_PROPID_NEXT_UPDATE_LOCATION = 10;\nexport const CAPICOM_PROPID_PUBKEY_ALG_PARA = 22;\nexport const CAPICOM_PROPID_PUBKEY_HASH_RESERVED = 8;\nexport const CAPICOM_PROPID_PVK_FILE = 12;\nexport const CAPICOM_PROPID_RENEWAL = 64;\nexport const CAPICOM_PROPID_SHA1_HASH = 3;\nexport const CAPICOM_PROPID_SIGNATURE_HASH = 15;\nexport const CAPICOM_PROPID_SMART_CARD_DATA = 16;\nexport const CAPICOM_PROPID_SUBJECT_NAME_MD5_HASH = 29;\nexport const CAPICOM_PROPID_SUBJECT_PUBLIC_KEY_MD5_HASH = 25;\nexport const CAPICOM_PROPID_UNKNOWN = 0;\nexport const CAPICOM_SMART_CARD_USER_STORE = 4;\nexport const CAPICOM_STORE_OPEN_EXISTING_ONLY = 128;\nexport const CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED = 256;\nexport const CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;\nexport const CAPICOM_STORE_OPEN_READ_ONLY = 0;\nexport const CAPICOM_STORE_OPEN_READ_WRITE = 1;\nexport const CHECK_NONE = 0;\nexport const CHECK_OFFLINE_REVOCATION_STATUS = 16;\nexport const CHECK_ONLINE_REVOCATION_STATUS = 8;\nexport const CHECK_SIGNATURE_VALIDITY = 4;\nexport const CHECK_TIME_VALIDITY = 2;\nexport const CHECK_TRUSTED_ROOT = 1;\nexport const LOG_LEVEL_DEBUG = 4;\nexport const LOG_LEVEL_ERROR = 1;\nexport const LOG_LEVEL_INFO = 2;\nexport const TRUST_CTL_IS_NOT_SIGNATURE_VALID = 262144;\nexport const TRUST_CTL_IS_NOT_TIME_VALID = 131072;\nexport const TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 524288;\nexport const TRUST_IS_CYCLIC = 128;\nexport const TRUST_IS_NOT_SIGNATURE_VALID = 8;\nexport const TRUST_IS_NOT_TIME_NESTED = 2;\nexport const TRUST_IS_NOT_TIME_VALID = 1;\nexport const TRUST_IS_NOT_VALID_FOR_USAGE = 16;\nexport const TRUST_IS_PARTIAL_CHAIN = 65536;\nexport const TRUST_IS_REVOKED = 4;\nexport const TRUST_IS_UNTRUSTED_ROOT = 32;\nexport const TRUST_REVOCATION_STATUS_UNKNOWN = 64;\nexport const XmlDsigGost3410Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411';\nexport const XmlDsigGost3410UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411';\nexport const XmlDsigGost3411Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411';\nexport const XmlDsigGost3411UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr3411';\n","import { TagsTranslations } from './tags-translations';\n\nexport const ISSUER_TAGS_TRANSLATIONS: TagsTranslations[] = [\n { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' },\n { possibleNames: ['CN'], translation: 'Удостоверяющий центр' },\n { possibleNames: ['C'], translation: 'Страна' },\n { possibleNames: ['S'], translation: 'Регион' },\n { possibleNames: ['STREET'], translation: 'Адрес' },\n { possibleNames: ['O'], translation: 'Компания' },\n { possibleNames: ['OU'], translation: 'Тип' },\n { possibleNames: ['T'], translation: 'Должность' },\n { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },\n { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },\n { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },\n { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },\n { possibleNames: ['E'], translation: 'Email' },\n { possibleNames: ['L'], translation: 'Город' },\n];\n","export const OIDS_DICTIONARY = {\n '1.2.643.2.2.34.6': 'Пользователь Центра Регистрации',\n '1.2.643.2.39.1.1': 'Использование в программных продуктах системы \"1С:Предприятие 8\"',\n '1.2.643.3.131.1.1': 'ИНН',\n '1.2.643.3.141.1.1': 'РНС ФСС',\n '1.2.643.3.141.1.2': 'КП ФСС',\n '1.2.643.3.2.100.65.13.11': 'Использование в системе АИС \"Госзакупки\" Сахалинской области.',\n '1.2.643.3.8.100.1': 'Сертификат типа \"ekey-ГОСТ\"',\n '1.2.643.3.8.100.1.1': 'Общее использование в системах ИОК без права заверения финансовых документов',\n '1.2.643.3.8.100.1.10':\n 'Для участия в электронных торгах и подписания государственного контракта в информационных системах Тендерного комитета города Москвы уполномоченными лицами участников размещения государственного заказа города Москвы',\n '1.2.643.3.8.100.1.11':\n 'Подписание электронных документов в автоматизированной информационной системе размещения государственного и муниципального заказа Саратовской области',\n '1.2.643.3.8.100.1.12': 'Использование в системе государственного заказа Иркутской области',\n '1.2.643.3.8.100.1.13':\n 'Использование в электронной торговой площадке агентства государственного заказа Красноярского края',\n '1.2.643.3.8.100.1.14': 'Использование в электронной торговой площадке \"Тендер\"',\n '1.2.643.3.8.100.1.2': 'Передача отчетности по ТКС',\n '1.2.643.3.8.100.1.3': 'Оформление взаимных обязательств, соглашений, договоров, актов и т.п.',\n '1.2.643.3.8.100.1.4': 'Внутрикорпоративный документооборот',\n '1.2.643.3.8.100.1.5': 'Использование в системах электронной торговли',\n '1.2.643.3.8.100.1.6': 'Использование в торгово-закупочной системе \"ЭЛЕКТРА\"',\n '1.2.643.3.8.100.1.7': 'Использование в системе Портал государственных закупок Ставропольского края.',\n '1.2.643.3.8.100.1.8': 'Использование в Единой системе электронной торговли B2B-Center и B2G.',\n '1.2.643.3.8.100.1.9':\n 'Для участия в электронных торгах и подписания государственного контракта в электронной площадке ОАО «ЕЭТП» уполномоченными лицами участников размещения государственного или муниципального заказа',\n '1.2.643.5.1.24.2.1.3':\n 'Формирование документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя',\n '1.2.643.5.1.24.2.1.3.1':\n 'Формирование кадастровым инженером документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя',\n '1.2.643.5.1.24.2.2.2': 'Формирование документов как результата оказания услуги со стороны органов регистрации прав',\n '1.2.643.5.1.24.2.2.3':\n 'Формирование документов для получения государственных услуг в сфере государственной регистрации прав на недвижимое имущество и сделок с ним со стороны заявителя',\n '1.2.643.6.2.1.7.1':\n 'Использование единоличным исполнительным органом юридического лица или уполномоченными представителями юридического лица в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских и иных прав и обязанностей в сфере негосударственного пенсионного обеспечения, негосударственного пенсионного страхования, в сфере деятельности паевых инвестиционных фондов, акционерных инвестиционных фондов, профессиональных участников рынка ценных бумаг, а также связанной с обслуживанием указанной деятельности услуг кредитных и иных организаций',\n '1.2.643.6.2.1.7.2':\n 'Использование физическим лицом в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских прав и обязанностей в отношении инвестиционных паев паевых инвестиционных фондов, в том числе отношения, связанные с учетом и/или фиксацией прав на инвестиционные паи паевых инвестиционных фондов',\n '1.2.643.6.3':\n 'Использование в электронных торговых системах и в программном обеспечении, связанным с обменом электронных сообщений',\n '1.2.643.6.3.1.1': 'Использование на электронных площадок отобранных для проведения аукционах в электронной форме',\n '1.2.643.6.3.1.2.1': 'Тип участника - Юридическое лицо',\n '1.2.643.6.3.1.2.2': 'Тип участника - Физическое лицо',\n '1.2.643.6.3.1.2.3': 'Тип участника - Индивидуальный предприниматель',\n '1.2.643.6.3.1.3.1': 'Участник размещения заказа',\n '1.2.643.6.3.1.4.1': 'Администратор организации',\n '1.2.643.6.3.1.4.2': 'Уполномоченный специалист',\n '1.2.643.6.3.1.4.3': 'Специалист с правом подписи контракта',\n '1.2.840.113549.1.9.2': 'Неструктурированное имя',\n '1.3.6.1.4.1.24138.1.1.8.1': 'Обеспечение юридической значимости в Системе \"Электронная Торговая Площадка\"',\n '1.3.6.1.4.1.29919.21': 'Использование в системе Портал государственных закупок Ростовской области \"Рефери\".',\n '1.3.6.1.5.5.7.3.2': 'Проверка подлинности клиента',\n '1.3.6.1.5.5.7.3.4': 'Защищенная электронная почта',\n '1.3.643.3.8.100.15': 'Использование в ЭТП \"uTender\"',\n};\n","import { TagsTranslations } from './tags-translations';\n\nexport const SUBJECT_TAGS_TRANSLATIONS: TagsTranslations[] = [\n { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' },\n { possibleNames: ['CN'], translation: 'Владелец' },\n { possibleNames: ['SN'], translation: 'Фамилия' },\n { possibleNames: ['G'], translation: 'Имя Отчество' },\n { possibleNames: ['C'], translation: 'Страна' },\n { possibleNames: ['S'], translation: 'Регион' },\n { possibleNames: ['STREET'], translation: 'Адрес' },\n { possibleNames: ['O'], translation: 'Компания' },\n { possibleNames: ['OU'], translation: 'Отдел/подразделение' },\n { possibleNames: ['T'], translation: 'Должность' },\n { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },\n { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },\n { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },\n { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },\n { possibleNames: ['E'], translation: 'Email' },\n { possibleNames: ['L'], translation: 'Город' },\n];\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Экспортирует сертификат в формате base64\n *\n * @returns сертификат в формате base64\n */\nexport const exportBase64 = _afterPluginsLoaded(function (): string {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function exportBase64(): string {\n let base64: string;\n\n try {\n base64 = __cadesAsyncToken__ + cadesCertificate.Export(0);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при экспорте сертификата');\n }\n\n return base64;\n }),\n );\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\ninterface AlgorithmInfo {\n algorithm: string;\n oid: string;\n}\n\n/**\n * Возвращает информацию об алгоритме сертификата\n *\n * @returns информацию об алгоритме и его OID'е\n */\nexport const getAlgorithm = _afterPluginsLoaded(function (): AlgorithmInfo {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function getAlgorithm(): AlgorithmInfo {\n const algorithmInfo: AlgorithmInfo = {\n algorithm: null,\n oid: null,\n };\n let cadesPublicKey;\n\n try {\n cadesPublicKey = __cadesAsyncToken__ + cadesCertificate.PublicKey();\n cadesPublicKey = __cadesAsyncToken__ + cadesPublicKey.Algorithm;\n algorithmInfo.algorithm = __cadesAsyncToken__ + cadesPublicKey.FriendlyName;\n algorithmInfo.oid = __cadesAsyncToken__ + cadesPublicKey.Value;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении алгоритма');\n }\n\n return algorithmInfo;\n }),\n );\n});\n","import { OIDS_DICTIONARY } from '../../constants';\nimport { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { Certificate } from './certificate';\n\nexport interface ExtendedKeysTranslations {\n [key: string]: string | null;\n}\n\n/**\n * Возвращает расшифрованные ОИД'ы сертификата\n *\n * @returns словарь расшифрованных ОИД'ов\n */\nexport const getDecodedExtendedKeyUsage = _afterPluginsLoaded(async function (): Promise {\n const certificateOids = await (this as Certificate).getExtendedKeyUsage();\n\n return certificateOids.reduce(\n (decodedOids, oidCode) => ({\n ...decodedOids,\n [oidCode]: OIDS_DICTIONARY[oidCode] || null,\n }),\n {},\n );\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Возвращает ОИД'ы сертификата\n *\n * @returns список ОИД'ов\n */\nexport const getExtendedKeyUsage = _afterPluginsLoaded(function (): string[] {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function getExtendedKeyUsage(): string[] {\n const OIDS: string[] = [];\n let count: any;\n\n try {\n count = __cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage();\n count = __cadesAsyncToken__ + count.EKUs;\n count = __cadesAsyncToken__ + count.Count;\n\n if (count > 0) {\n while (count > 0) {\n let cadesExtendedKeyUsage;\n\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage();\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.EKUs;\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.Item(count);\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.OID;\n\n OIDS.push(cadesExtendedKeyUsage);\n\n count--;\n }\n }\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || \"Ошибка при получении ОИД'ов\");\n }\n\n return OIDS;\n }),\n );\n});\n","import { TagsTranslations } from '../../constants/tags-translations';\nimport { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { _parseCertInfo, TagTranslation } from '../../helpers/_parseCertInfo';\nimport { getCadesProp } from './getCadesProp';\n\n/**\n * Возвращает расшифрованную информацию о сертификате из указанного свойства по тэгам\n *\n * @param tags = словарь\n * @param entitiesPath = путь к разбираемой сущности\n * @returns расшифрованная информация по отдельным тэгам\n */\nexport const getInfo = _afterPluginsLoaded(async function (\n tags: TagsTranslations[],\n entitiesPath: string,\n): Promise {\n let entities: string;\n\n try {\n entities = await getCadesProp.call(this, entitiesPath);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при извлечении информации из сертификата');\n }\n\n return _parseCertInfo(tags, entities);\n});\n","import { OIDS_DICTIONARY } from '../constants';\nimport { TagsTranslations } from '../constants/tags-translations';\n\nexport interface TagTranslation {\n description: string;\n title: string;\n isTranslated: boolean;\n}\n\n/**\n * Парсит информацию из строки с информацией о сертификате\n *\n * @param tagsTranslations - словарь с расшифровками тэгов\n * @param rawInfo - данные для парсинга\n * @returns расшифрованная информация по отдельным тэгам\n */\nexport const _parseCertInfo = (tagsTranslations: TagsTranslations[], rawInfo: string): TagTranslation[] => {\n const extractedEntities: string[] = rawInfo.match(/([а-яА-Яa-zA-Z0-9\\s.]+)=(?:(\"[^\"]+?\")|(.+?))(?:,|$)/g);\n\n if (extractedEntities) {\n return extractedEntities.map((group) => {\n const segmentsMatch = group.trim().match(/^([а-яА-Яa-zA-Z0-9\\s.]+)=(.+?),?$/);\n let title = segmentsMatch?.[1];\n // Вырезаем лишние кавычки\n const description = segmentsMatch?.[2]?.replace(/^\"(.*)\"/, '$1')?.replace(/\"{2}/g, '\"');\n const oidIdentifierMatch = title?.match(/^OID\\.(.*)/);\n const oidIdentifier = oidIdentifierMatch?.[1];\n let isTranslated = false;\n\n // Если нашли в тайтле ОИД, пытаемся его расшифровать\n if (oidIdentifier) {\n const oidTranslation = OIDS_DICTIONARY[oidIdentifier];\n\n if (oidTranslation) {\n title = oidTranslation;\n isTranslated = true;\n }\n }\n\n const tagTranslation = tagsTranslations.find((tag) => tag.possibleNames.find((name) => name === title))\n ?.translation;\n\n if (tagTranslation) {\n title = tagTranslation;\n isTranslated = true;\n }\n\n return { description, title, isTranslated };\n });\n }\n};\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { Certificate } from './certificate';\n\n/**\n * Проверяет наличие ОИД'а (ОИД'ов) у сертификата\n *\n * @param oids - ОИД'ы для проверки\n * @returns флаг наличия ОИД'ов у сертификата\n */\nexport const hasExtendedKeyUsage = _afterPluginsLoaded(async function (oids: string | string[]): Promise {\n const certOids = await (this as Certificate).getExtendedKeyUsage();\n\n let result: boolean;\n\n if (Array.isArray(oids)) {\n result = oids.every((oidToCheck) => certOids.some((certOid) => certOid === oidToCheck));\n } else {\n result = certOids.some((certOid) => certOid === oids);\n }\n\n return result;\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Проверяет действительность сертификата\n *\n * @returns флаг валидности\n */\nexport const isValid = _afterPluginsLoaded(function (): boolean {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function isValid() {\n let isValid;\n\n try {\n isValid = __cadesAsyncToken__ + cadesCertificate.IsValid();\n isValid = __cadesAsyncToken__ + isValid.Result;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при проверке сертификата');\n }\n\n return Boolean(isValid);\n }),\n );\n});\n","export const _extractCommonName = (subjectName: string): string | undefined =>\n subjectName.match(/CN=(.+?)(?:,|$)/)?.[1];\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { _isSupportedCadesVersion } from '../helpers/_isSupportedCadesVersion';\nimport { _isSupportedCSPVersion } from '../helpers/_isSupportedCSPVersion';\nimport { getSystemInfo, SystemInfo } from './getSystemInfo';\n\n/**\n * Проверяет корректность настроек ЭП на машине\n *\n * @returns флаг корректности настроек\n */\nexport const isValidSystemSetup = _afterPluginsLoaded(\n async (): Promise => {\n let systemInfo: SystemInfo;\n\n try {\n systemInfo = await getSystemInfo();\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Настройки ЭП на данной машине не верны');\n }\n\n if (!_isSupportedCadesVersion(systemInfo.cadesVersion)) {\n throw new Error('Не поддерживаемая версия плагина');\n }\n\n if (!_isSupportedCSPVersion(systemInfo.cspVersion)) {\n throw new Error('Не поддерживаемая версия CSP');\n }\n\n return true;\n },\n);\n","export const _isSupportedCadesVersion = (version: string): boolean => {\n const match = version.match(/(\\d+)\\.(\\d+)\\.(\\d+)/);\n\n if (!match) {\n return false;\n }\n\n const [, major, minor, patch] = match;\n\n if (Number(major) < 2) {\n return false;\n }\n\n if (Number(major) === 2 && Number(patch) < 12438) {\n return false;\n }\n\n return true;\n};\n","const oldestSupportedCSPVersion = 4.0;\n\nexport const _isSupportedCSPVersion = (version: string): boolean => {\n version = version.match(/\\d+?\\b(?:\\.\\d+)?/)?.[0];\n\n return Number(version) >= oldestSupportedCSPVersion;\n};\n","import { CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME } from '../constants';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\nimport { _getCadesCert } from '../helpers/_getCadesCert';\nimport { _getDateObj } from '../helpers/_getDateObj';\n\n/**\n * Создает подпись base64 строки по отпечатку сертификата\n *\n * @param thumbprint - отпечаток сертификата\n * @param messageHash - хэш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11\n * @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false)\n * @returns подпись\n */\nexport const createSignature = _afterPluginsLoaded(\n async (thumbprint: string, messageHash: string, detachedSignature: boolean = true): Promise => {\n const { cadesplugin } = window;\n const cadesCertificate = await _getCadesCert(thumbprint);\n\n return eval(\n _generateCadesFn(function createSignature(): string {\n let cadesAttrs;\n let cadesSignedData;\n let cadesSigner;\n\n try {\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\n cadesSignedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CadesSignedData');\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\n }\n\n const currentTime = _getDateObj(new Date());\n\n try {\n void (__cadesAsyncToken__ + cadesAttrs.propset_Name(CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME));\n void (__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime));\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи');\n }\n\n let cadesAuthAttrs;\n\n try {\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\n cadesAuthAttrs = __cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2;\n void (__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs));\n void (__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));\n void (__cadesAsyncToken__ + cadesSignedData.propset_Content(messageHash));\n void (\n __cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY)\n );\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи');\n }\n\n let signature: string;\n\n try {\n signature =\n __cadesAsyncToken__ +\n cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_CADES_BES, detachedSignature);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных');\n }\n\n return signature;\n }),\n );\n },\n);\n","import { CadesCertificate } from '../api/certificate';\nimport { _afterPluginsLoaded } from './_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from './_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from './_generateCadesFn';\n\n/**\n * Возвращает сертификат в формате Cades по отпечатку\n *\n * @param thumbprint - отпечаток сертификата\n * @returns сертификат в формате Cades\n */\nexport const _getCadesCert = _afterPluginsLoaded(\n (thumbprint: string): CadesCertificate => {\n const { cadesplugin } = window;\n\n return eval(\n _generateCadesFn(function _getCadesCert() {\n let cadesStore;\n\n try {\n cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');\n }\n\n if (!cadesStore) {\n throw new Error('Не удалось получить доступ к хранилищу сертификатов');\n }\n\n try {\n void (\n __cadesAsyncToken__ +\n cadesStore.Open(\n cadesplugin.CAPICOM_CURRENT_USER_STORE,\n cadesplugin.CAPICOM_MY_STORE,\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,\n )\n );\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');\n }\n\n let cadesCertificateList;\n let certificatesCount;\n\n try {\n cadesCertificateList = __cadesAsyncToken__ + cadesStore.Certificates;\n certificatesCount = __cadesAsyncToken__ + cadesCertificateList.Count;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');\n }\n\n if (!certificatesCount) {\n throw new Error('Нет доступных сертификатов');\n }\n\n let cadesCertificate: CadesCertificate;\n\n try {\n cadesCertificateList =\n __cadesAsyncToken__ + cadesCertificateList.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH, thumbprint);\n\n const count = __cadesAsyncToken__ + cadesCertificateList.Count;\n\n if (!count) {\n throw new Error(`Сертификат с отпечатком: \"${thumbprint}\" не найден`);\n }\n\n cadesCertificate = __cadesAsyncToken__ + cadesCertificateList.Item(1);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении сертификата');\n }\n\n cadesStore.Close();\n\n return cadesCertificate;\n }),\n );\n },\n);\n","/**\n * Возвращает объект даты, совместимый с Cades plugin'ом, зависящий от браузера.\n *\n * В IE необходимо использовать специфичный формат \"VT_DATE\"\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Microsoft_Extensions/Date.getVarDate\n */\nexport const _getDateObj = (dateObj): Date => (dateObj.getVarDate ? dateObj.getVarDate() : dateObj);\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\ntype Algorithm =\n | 'GOST_3411'\n | 'GOST_3411_2012_256'\n | 'GOST_3411_2012_512'\n | 'GOST_3411_HMAC'\n | 'GOST_3411_2012_256_HMAC'\n | 'GOST_3411_2012_512_HMAC';\n\n/**\n * Создает хэш сообщения по ГОСТ Р 34.11\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)\n *\n * @param unencryptedMessage - сообщение для хеширования\n * @param algorithm - один из алгоритмов хеширования:\n * GOST_3411\n * GOST_3411_2012_256\n * GOST_3411_2012_512 - по умолчанию\n * GOST_3411_HMAC\n * GOST_3411_2012_256_HMAC\n * GOST_3411_2012_512_HMAC\n *\n * @returns хэш\n */\nexport const createHash = _afterPluginsLoaded(\n async (unencryptedMessage: string | ArrayBuffer, algorithm: Algorithm = 'GOST_3411_2012_512'): Promise => {\n const { cadesplugin } = window;\n\n return eval(\n _generateCadesFn(function createHash(): string {\n const cadesHashedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.HashedData');\n let messageBase64;\n let hash;\n\n try {\n messageBase64 = Buffer.from(unencryptedMessage).toString('base64');\n } catch (error) {\n console.error(error);\n\n throw new Error('Ошибка при преобразовании сообщения в Base64');\n }\n\n try {\n void (\n __cadesAsyncToken__ +\n cadesHashedData.propset_Algorithm(cadesplugin['CADESCOM_HASH_ALGORITHM_CP_' + algorithm])\n );\n void (__cadesAsyncToken__ + cadesHashedData.propset_DataEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));\n void (__cadesAsyncToken__ + cadesHashedData.Hash(messageBase64));\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации хэширования');\n }\n\n try {\n hash = __cadesAsyncToken__ + cadesHashedData.Value;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при создании хэша');\n }\n\n return hash;\n }),\n );\n },\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","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"],"sourceRoot":""} diff --git a/lib/api/createHash.d.ts b/lib/api/createHash.d.ts new file mode 100644 index 0000000..ad4d4d5 --- /dev/null +++ b/lib/api/createHash.d.ts @@ -0,0 +1,18 @@ +declare type Algorithm = 'GOST_3411' | 'GOST_3411_2012_256' | 'GOST_3411_2012_512' | 'GOST_3411_HMAC' | 'GOST_3411_2012_256_HMAC' | 'GOST_3411_2012_512_HMAC'; +/** + * Создает хэш сообщения по ГОСТ Р 34.11 + * 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 - сообщение для хеширования + * @param algorithm - один из алгоритмов хеширования: + * GOST_3411 + * GOST_3411_2012_256 + * GOST_3411_2012_512 - по умолчанию + * GOST_3411_HMAC + * GOST_3411_2012_256_HMAC + * GOST_3411_2012_512_HMAC + * + * @returns хэш + */ +export declare const createHash: (unencryptedMessage: string | ArrayBuffer, algorithm?: Algorithm) => Promise; +export {}; diff --git a/lib/api/createSignature.d.ts b/lib/api/createSignature.d.ts index 29bc69e..d23e168 100644 --- a/lib/api/createSignature.d.ts +++ b/lib/api/createSignature.d.ts @@ -2,8 +2,8 @@ * Создает подпись base64 строки по отпечатку сертификата * * @param thumbprint - отпечаток сертификата - * @param dataBase64 - строковые данные в формате base64 + * @param messageHash - хэш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11 * @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false) * @returns подпись */ -export declare const createSignature: (thumbprint: string, dataBase64: string, detachedSignature?: boolean) => Promise; +export declare const createSignature: (thumbprint: string, messageHash: string, detachedSignature?: boolean) => Promise; diff --git a/lib/api/index.d.ts b/lib/api/index.d.ts index 2fd4070..adc6bcd 100644 --- a/lib/api/index.d.ts +++ b/lib/api/index.d.ts @@ -3,4 +3,5 @@ export * from './getUserCertificates'; export * from './getSystemInfo'; export * from './isValidSystemSetup'; export * from './createSignature'; +export * from './createHash'; export * from './certificate'; diff --git a/lib/crypto-pro.js b/lib/crypto-pro.js index dc65788..b0c86af 100644 --- a/lib/crypto-pro.js +++ b/lib/crypto-pro.js @@ -96,6 +96,2114 @@ return /******/ (function(modules) { // webpackBootstrap /************************************************************************/ /******/ ({ +/***/ "../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 ***! @@ -503,6 +2611,81 @@ exports.isValid = _afterPluginsLoaded_1._afterPluginsLoaded(function () { }); +/***/ }), + +/***/ "./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 + * 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 - сообщение для хеширования + * @param algorithm - один из алгоритмов хеширования: + * GOST_3411 + * GOST_3411_2012_256 + * GOST_3411_2012_512 - по умолчанию + * GOST_3411_HMAC + * GOST_3411_2012_256_HMAC + * GOST_3411_2012_512_HMAC + * + * @returns хэш + */ +exports.createHash = _afterPluginsLoaded_1._afterPluginsLoaded((unencryptedMessage, algorithm = 'GOST_3411_2012_512') => __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_' + algorithm])); + 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": @@ -534,11 +2717,11 @@ const _getDateObj_1 = __webpack_require__(/*! ../helpers/_getDateObj */ "./helpe * Создает подпись base64 строки по отпечатку сертификата * * @param thumbprint - отпечаток сертификата - * @param dataBase64 - строковые данные в формате base64 + * @param messageHash - хэш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11 * @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false) * @returns подпись */ -exports.createSignature = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint, dataBase64, detachedSignature = true) => __awaiter(void 0, void 0, void 0, function* () { +exports.createSignature = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint, messageHash, detachedSignature = true) => __awaiter(void 0, void 0, void 0, function* () { const { cadesplugin } = window; const cadesCertificate = yield _getCadesCert_1._getCadesCert(thumbprint); return eval(_generateCadesFn_1._generateCadesFn(function createSignature() { @@ -569,7 +2752,7 @@ exports.createSignature = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint, 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(dataBase64)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_Content(messageHash)); void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY)); } catch (error) { @@ -789,6 +2972,7 @@ __export(__webpack_require__(/*! ./getUserCertificates */ "./api/getUserCertific __export(__webpack_require__(/*! ./getSystemInfo */ "./api/getSystemInfo.ts")); __export(__webpack_require__(/*! ./isValidSystemSetup */ "./api/isValidSystemSetup.ts")); __export(__webpack_require__(/*! ./createSignature */ "./api/createSignature.ts")); +__export(__webpack_require__(/*! ./createHash */ "./api/createHash.ts")); __export(__webpack_require__(/*! ./certificate */ "./api/certificate/index.ts")); @@ -2254,4 +4438,4 @@ exports._parseCertInfo = (tagsTranslations, rawInfo) => { /******/ }); }); -//# sourceMappingURL=crypto-pro.js.map \ No newline at end of file +//# sourceMappingURL=crypto-pro.js.map diff --git a/lib/crypto-pro.js.map b/lib/crypto-pro.js.map index 505391b..1c89698 100644 --- a/lib/crypto-pro.js.map +++ b/lib/crypto-pro.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://cryptoPro/webpack/universalModuleDefinition","webpack://cryptoPro/webpack/bootstrap","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/createSignature.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;;;;;;;;;;;;;;;AClFA,uFAAsF;AAEtF,sGAA8C;AAC9C,sGAA8C;AAC9C,sGAA8C;AAC9C,gJAAoG;AACpG,2HAA4D;AAC5D,uFAAoC;AACpC,2HAA4D;AAC5D,uFAAoC;AAIpC,MAAa,WAAW;IACtB,YACS,iBAAmC,EACnC,IAAY,EACZ,UAAkB,EAClB,WAAmB,EACnB,UAAkB,EAClB,SAAiB,EACjB,OAAe;QANf,sBAAiB,GAAjB,iBAAiB,CAAkB;QACnC,SAAI,GAAJ,IAAI,CAAQ;QACZ,eAAU,GAAV,UAAU,CAAQ;QAClB,gBAAW,GAAX,WAAW,CAAQ;QACnB,eAAU,GAAV,UAAU,CAAQ;QAClB,cAAS,GAAT,SAAS,CAAQ;QACjB,YAAO,GAAP,OAAO,CAAQ;IACrB,CAAC;IAEG,YAAY;QACjB,OAAO,iBAAO,CAAC,IAAI,CAAC,IAAI,EAAE,qCAAyB,E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,IAAI,aAAa,EAAE;gBACjB,MAAM,cAAc,GAAG,2BAAe,CAAC,aAAa,CAAC,CAAC;gBAEtD,IAAI,cAAc,EAAE;oBAClB,KAAK,GAAG,cAAc,CAAC;oBACvB,YAAY,GAAG,IAAI,CAAC;iBACrB;aACF;YAED,MAAM,cAAc,SAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,0CACnG,WAAW,CAAC;YAEhB,IAAI,cAAc,EAAE;gBAClB,KAAK,GAAG,cAAc,CAAC;gBACvB,YAAY,GAAG,IAAI,CAAC;aACrB;YAED,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;QAC9C,CAAC,CAAC,CAAC;KACJ;AACH,CAAC,CAAC;;;;;;;;;;;;AClDF,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA,gBAAgB;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","import { ISSUER_TAGS_TRANSLATIONS, SUBJECT_TAGS_TRANSLATIONS } from '../../constants';\nimport { TagTranslation } from '../../helpers/_parseCertInfo';\nimport { exportBase64 } from './exportBase64';\nimport { getAlgorithm } from './getAlgorithm';\nimport { getCadesProp } from './getCadesProp';\nimport { getDecodedExtendedKeyUsage, ExtendedKeysTranslations } from './getDecodedExtendedKeyUsage';\nimport { getExtendedKeyUsage } from './getExtendedKeyUsage';\nimport { getInfo } from './getInfo';\nimport { hasExtendedKeyUsage } from './hasExtendedKeyUsage';\nimport { isValid } from './isValid';\n\nexport type CadesCertificate = any;\n\nexport class Certificate {\n constructor(\n public _cadesCertificate: CadesCertificate,\n public name: string,\n public issuerName: string,\n public subjectName: string,\n public thumbprint: string,\n public validFrom: string,\n public validTo: string,\n ) {}\n\n public getOwnerInfo(): Promise {\n return getInfo.call(this, SUBJECT_TAGS_TRANSLATIONS, 'SubjectName');\n }\n\n public getIssuerInfo(): Promise {\n return getInfo.call(this, ISSUER_TAGS_TRANSLATIONS, 'IssuerName');\n }\n\n public getExtendedKeyUsage(): Promise {\n return getExtendedKeyUsage.call(this);\n }\n\n public getDecodedExtendedKeyUsage(): Promise {\n return getDecodedExtendedKeyUsage.call(this);\n }\n\n public getAlgorithm(): Promise {\n return getAlgorithm.call(this);\n }\n\n public getCadesProp(propName): Promise {\n return getCadesProp.call(this, propName);\n }\n\n public isValid(): Promise {\n return isValid.call(this);\n }\n\n public exportBase64(): Promise {\n return exportBase64.call(this);\n }\n\n public hasExtendedKeyUsage(oids): Promise {\n return hasExtendedKeyUsage.call(this, oids);\n }\n}\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Экспортирует сертификат в формате base64\n *\n * @returns сертификат в формате base64\n */\nexport const exportBase64 = _afterPluginsLoaded(function (): string {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function exportBase64(): string {\n let base64: string;\n\n try {\n base64 = __cadesAsyncToken__ + cadesCertificate.Export(0);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при экспорте сертификата');\n }\n\n return base64;\n }),\n );\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\ninterface AlgorithmInfo {\n algorithm: string;\n oid: string;\n}\n\n/**\n * Возвращает информацию об алгоритме сертификата\n *\n * @returns информацию об алгоритме и его OID'е\n */\nexport const getAlgorithm = _afterPluginsLoaded(function (): AlgorithmInfo {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function getAlgorithm(): AlgorithmInfo {\n const algorithmInfo: AlgorithmInfo = {\n algorithm: null,\n oid: null,\n };\n let cadesPublicKey;\n\n try {\n cadesPublicKey = __cadesAsyncToken__ + cadesCertificate.PublicKey();\n cadesPublicKey = __cadesAsyncToken__ + cadesPublicKey.Algorithm;\n algorithmInfo.algorithm = __cadesAsyncToken__ + cadesPublicKey.FriendlyName;\n algorithmInfo.oid = __cadesAsyncToken__ + cadesPublicKey.Value;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении алгоритма');\n }\n\n return algorithmInfo;\n }),\n );\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Возвращает указанное внутренее свойство у сертификата в формате Cades\n *\n * @param propName = наименование свойства\n * @returns значение запрошенного свойства\n */\nexport const getCadesProp = _afterPluginsLoaded(function (propName: string): any {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function getCadesProp() {\n let propertyValue;\n\n try {\n propertyValue = __cadesAsyncToken__ + cadesCertificate[propName];\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при обращении к свойству сертификата');\n }\n\n return propertyValue;\n }),\n );\n});\n","import { OIDS_DICTIONARY } from '../../constants';\nimport { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { Certificate } from './certificate';\n\nexport interface ExtendedKeysTranslations {\n [key: string]: string | null;\n}\n\n/**\n * Возвращает расшифрованные ОИД'ы сертификата\n *\n * @returns словарь расшифрованных ОИД'ов\n */\nexport const getDecodedExtendedKeyUsage = _afterPluginsLoaded(async function (): Promise {\n const certificateOids = await (this as Certificate).getExtendedKeyUsage();\n\n return certificateOids.reduce(\n (decodedOids, oidCode) => ({\n ...decodedOids,\n [oidCode]: OIDS_DICTIONARY[oidCode] || null,\n }),\n {},\n );\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Возвращает ОИД'ы сертификата\n *\n * @returns список ОИД'ов\n */\nexport const getExtendedKeyUsage = _afterPluginsLoaded(function (): string[] {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function getExtendedKeyUsage(): string[] {\n const OIDS: string[] = [];\n let count: any;\n\n try {\n count = __cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage();\n count = __cadesAsyncToken__ + count.EKUs;\n count = __cadesAsyncToken__ + count.Count;\n\n if (count > 0) {\n while (count > 0) {\n let cadesExtendedKeyUsage;\n\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage();\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.EKUs;\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.Item(count);\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.OID;\n\n OIDS.push(cadesExtendedKeyUsage);\n\n count--;\n }\n }\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || \"Ошибка при получении ОИД'ов\");\n }\n\n return OIDS;\n }),\n );\n});\n","import { TagsTranslations } from '../../constants/tags-translations';\nimport { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { _parseCertInfo, TagTranslation } from '../../helpers/_parseCertInfo';\nimport { getCadesProp } from './getCadesProp';\n\n/**\n * Возвращает расшифрованную информацию о сертификате из указанного свойства по тэгам\n *\n * @param tags = словарь\n * @param entitiesPath = путь к разбираемой сущности\n * @returns расшифрованная информация по отдельным тэгам\n */\nexport const getInfo = _afterPluginsLoaded(async function (\n tags: TagsTranslations[],\n entitiesPath: string,\n): Promise {\n let entities: string;\n\n try {\n entities = await getCadesProp.call(this, entitiesPath);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при извлечении информации из сертификата');\n }\n\n return _parseCertInfo(tags, entities);\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { Certificate } from './certificate';\n\n/**\n * Проверяет наличие ОИД'а (ОИД'ов) у сертификата\n *\n * @param oids - ОИД'ы для проверки\n * @returns флаг наличия ОИД'ов у сертификата\n */\nexport const hasExtendedKeyUsage = _afterPluginsLoaded(async function (oids: string | string[]): Promise {\n const certOids = await (this as Certificate).getExtendedKeyUsage();\n\n let result: boolean;\n\n if (Array.isArray(oids)) {\n result = oids.every((oidToCheck) => certOids.some((certOid) => certOid === oidToCheck));\n } else {\n result = certOids.some((certOid) => certOid === oids);\n }\n\n return result;\n});\n","export * from './certificate';\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Проверяет действительность сертификата\n *\n * @returns флаг валидности\n */\nexport const isValid = _afterPluginsLoaded(function (): boolean {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function isValid() {\n let isValid;\n\n try {\n isValid = __cadesAsyncToken__ + cadesCertificate.IsValid();\n isValid = __cadesAsyncToken__ + isValid.Result;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при проверке сертификата');\n }\n\n return Boolean(isValid);\n }),\n );\n});\n","import { CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME } from '../constants';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\nimport { _getCadesCert } from '../helpers/_getCadesCert';\nimport { _getDateObj } from '../helpers/_getDateObj';\n\n/**\n * Создает подпись base64 строки по отпечатку сертификата\n *\n * @param thumbprint - отпечаток сертификата\n * @param dataBase64 - строковые данные в формате base64\n * @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false)\n * @returns подпись\n */\nexport const createSignature = _afterPluginsLoaded(\n async (thumbprint: string, dataBase64: string, detachedSignature: boolean = true): Promise => {\n const { cadesplugin } = window;\n const cadesCertificate = await _getCadesCert(thumbprint);\n\n return eval(\n _generateCadesFn(function createSignature(): string {\n let cadesAttrs;\n let cadesSignedData;\n let cadesSigner;\n\n try {\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\n cadesSignedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CadesSignedData');\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\n }\n\n const currentTime = _getDateObj(new Date());\n\n try {\n void (__cadesAsyncToken__ + cadesAttrs.propset_Name(CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME));\n void (__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime));\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи');\n }\n\n let cadesAuthAttrs;\n\n try {\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\n cadesAuthAttrs = __cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2;\n void (__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs));\n void (__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));\n void (__cadesAsyncToken__ + cadesSignedData.propset_Content(dataBase64));\n void (\n __cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY)\n );\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи');\n }\n\n let signature: string;\n\n try {\n signature =\n __cadesAsyncToken__ +\n cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_CADES_BES, detachedSignature);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных');\n }\n\n return signature;\n }),\n );\n },\n);\n","import { Certificate } from './certificate';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { getUserCertificates } from './getUserCertificates';\n\n/**\n * Возвращает сертификат по отпечатку\n *\n * @param thumbprint - отпечаток сертификата\n * @returns сертификат\n */\nexport const getCertificate = _afterPluginsLoaded(\n async (thumbprint: string): Promise => {\n if (!thumbprint) {\n throw new Error('Отпечаток не указан');\n }\n\n const availableCertificates: Certificate[] = await getUserCertificates();\n const foundCertificate: Certificate = availableCertificates.find((cert) => cert.thumbprint === thumbprint);\n\n if (!foundCertificate) {\n throw new Error(`Сертификат с отпечатком: \"${thumbprint}\" не найден`);\n }\n\n return foundCertificate;\n },\n);\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\nexport interface SystemInfo {\n cadesVersion: string;\n cspVersion: string;\n}\n\n/**\n * Предоставляет информацию о системе\n *\n * @returns информацию о CSP и плагине\n */\nexport const getSystemInfo = _afterPluginsLoaded(\n (): SystemInfo => {\n const sysInfo = {\n cadesVersion: null,\n cspVersion: null,\n };\n\n return eval(\n _generateCadesFn(function getSystemInfo(): SystemInfo {\n let cadesAbout;\n\n try {\n cadesAbout = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.About');\n\n sysInfo.cadesVersion = __cadesAsyncToken__ + cadesAbout.PluginVersion;\n sysInfo.cspVersion = __cadesAsyncToken__ + cadesAbout.CSPVersion();\n\n if (!sysInfo.cadesVersion) {\n sysInfo.cadesVersion = __cadesAsyncToken__ + cadesAbout.Version;\n }\n\n sysInfo.cadesVersion = __cadesAsyncToken__ + sysInfo.cadesVersion.toString();\n sysInfo.cspVersion = __cadesAsyncToken__ + sysInfo.cspVersion.toString();\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении информации о системе');\n }\n\n return sysInfo;\n }),\n );\n },\n);\n","import { CadesCertificate, Certificate } from './certificate';\nimport { CAPICOM_PROPID_KEY_PROV_INFO } from '../constants';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractCommonName } from '../helpers/_extractCommonName';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\nlet certificatesCache: Certificate[];\n\n/**\n * Возвращает список сертификатов, доступных пользователю в системе\n *\n * @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов\n * @returns список сертификатов\n */\nexport const getUserCertificates = _afterPluginsLoaded((resetCache: boolean = false): Certificate[] => {\n const { cadesplugin } = window;\n\n if (!resetCache && certificatesCache) {\n return certificatesCache;\n }\n\n return eval(\n _generateCadesFn(function getUserCertificates(): Certificate[] {\n let cadesStore;\n\n try {\n cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');\n }\n\n try {\n void (\n __cadesAsyncToken__ +\n cadesStore.Open(\n cadesplugin.CAPICOM_CURRENT_USER_STORE,\n cadesplugin.CAPICOM_MY_STORE,\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,\n )\n );\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');\n }\n\n let cadesCertificates;\n let cadesCertificatesCount;\n\n try {\n cadesCertificates = __cadesAsyncToken__ + cadesStore.Certificates;\n\n if (cadesCertificates) {\n cadesCertificates =\n __cadesAsyncToken__ + cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID);\n\n /**\n * Не рассматриваются сертификаты, в которых отсутствует закрытый ключ\n * или не действительны на данный момент\n */\n cadesCertificates =\n __cadesAsyncToken__ +\n cadesCertificates.Find(\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY,\n CAPICOM_PROPID_KEY_PROV_INFO,\n );\n\n cadesCertificatesCount = __cadesAsyncToken__ + cadesCertificates.Count;\n }\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');\n }\n\n if (!cadesCertificatesCount) {\n throw new Error('Нет доступных сертификатов');\n }\n\n const certificateList: Certificate[] = [];\n\n try {\n while (cadesCertificatesCount) {\n const cadesCertificate: CadesCertificate =\n __cadesAsyncToken__ + cadesCertificates.Item(cadesCertificatesCount);\n\n certificateList.push(\n new Certificate(\n cadesCertificate,\n _extractCommonName(__cadesAsyncToken__ + cadesCertificate.SubjectName),\n __cadesAsyncToken__ + cadesCertificate.IssuerName,\n __cadesAsyncToken__ + cadesCertificate.SubjectName,\n __cadesAsyncToken__ + cadesCertificate.Thumbprint,\n __cadesAsyncToken__ + cadesCertificate.ValidFromDate,\n __cadesAsyncToken__ + cadesCertificate.ValidToDate,\n ),\n );\n\n cadesCertificatesCount--;\n }\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка обработки сертификатов');\n }\n\n cadesStore.Close();\n\n certificatesCache = certificateList;\n\n return certificatesCache;\n }),\n );\n});\n","export * from './getCertificate';\nexport * from './getUserCertificates';\nexport * from './getSystemInfo';\nexport * from './isValidSystemSetup';\nexport * from './createSignature';\nexport * from './certificate';\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { _isSupportedCadesVersion } from '../helpers/_isSupportedCadesVersion';\nimport { _isSupportedCSPVersion } from '../helpers/_isSupportedCSPVersion';\nimport { getSystemInfo, SystemInfo } from './getSystemInfo';\n\n/**\n * Проверяет корректность настроек ЭП на машине\n *\n * @returns флаг корректности настроек\n */\nexport const isValidSystemSetup = _afterPluginsLoaded(\n async (): Promise => {\n let systemInfo: SystemInfo;\n\n try {\n systemInfo = await getSystemInfo();\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Настройки ЭП на данной машине не верны');\n }\n\n if (!_isSupportedCadesVersion(systemInfo.cadesVersion)) {\n throw new Error('Не поддерживаемая версия плагина');\n }\n\n if (!_isSupportedCSPVersion(systemInfo.cspVersion)) {\n throw new Error('Не поддерживаемая версия CSP');\n }\n\n return true;\n },\n);\n","export const CADESCOM_ATTRIBUTE_OTHER = -1;\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\nexport const CADESCOM_AllowNoOutstandingRequest = 1;\nexport const CADESCOM_AllowNone = 0;\nexport const CADESCOM_AllowUntrustedCertificate = 2;\nexport const CADESCOM_AllowUntrustedRoot = 4;\nexport const CADESCOM_BASE64_TO_BINARY = 0x01;\nexport const CADESCOM_CADES_BES = 1;\nexport const CADESCOM_CADES_DEFAULT = 0;\nexport const CADESCOM_CADES_T = 5;\nexport const CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;\nexport const CADESCOM_CONTAINER_STORE = 100;\nexport const CADESCOM_CURRENT_USER_STORE = 2;\nexport const CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;\nexport const CADESCOM_DISPLAY_DATA_CONTENT = 1;\nexport const CADESCOM_DISPLAY_DATA_NONE = 0;\nexport const CADESCOM_ENCODE_ANY = -1;\nexport const CADESCOM_ENCODE_BASE64 = 0;\nexport const CADESCOM_ENCODE_BINARY = 1;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110;\nexport const CADESCOM_HASH_ALGORITHM_MD2 = 1;\nexport const CADESCOM_HASH_ALGORITHM_MD4 = 2;\nexport const CADESCOM_HASH_ALGORITHM_MD5 = 3;\nexport const CADESCOM_HASH_ALGORITHM_SHA1 = 0;\nexport const CADESCOM_HASH_ALGORITHM_SHA_256 = 4;\nexport const CADESCOM_HASH_ALGORITHM_SHA_384 = 5;\nexport const CADESCOM_HASH_ALGORITHM_SHA_512 = 6;\nexport const CADESCOM_LOCAL_MACHINE_STORE = 1;\nexport const CADESCOM_PKCS7_TYPE = 65535;\nexport const CADESCOM_STRING_TO_UCS2LE = 0x00;\nexport const CADESCOM_SkipInstallToStore = 268435456;\nexport const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;\nexport const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;\nexport const CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;\nexport const CAPICOM_ACTIVE_DIRECTORY_USER_STORE = 3;\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\nexport const CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;\nexport const CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;\nexport const CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;\nexport const CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;\nexport const CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;\nexport const CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;\nexport const CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;\nexport const CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;\nexport const CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\nexport const CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;\nexport const CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;\nexport const CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;\nexport const CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;\nexport const CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;\nexport const CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;\nexport const CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;\nexport const CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;\nexport const CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;\nexport const CAPICOM_CURRENT_USER_STORE = 2;\nexport const CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;\nexport const CAPICOM_EKU_CLIENT_AUTH = 2;\nexport const CAPICOM_EKU_OTHER = 0;\nexport const CAPICOM_EKU_SMARTCARD_LOGON = 5;\nexport const CAPICOM_LOCAL_MACHINE_STORE = 1;\nexport const CAPICOM_MEMORY_STORE = 0;\nexport const CAPICOM_MY_STORE = 'My';\nexport const CAPICOM_OID_KEY_USAGE_EXTENSION = 10;\nexport const CAPICOM_OID_OTHER = 0;\nexport const CAPICOM_PROPID_ACCESS_STATE = 14;\nexport const CAPICOM_PROPID_ARCHIVED = 19;\nexport const CAPICOM_PROPID_ARCHIVED_KEY_HASH = 65;\nexport const CAPICOM_PROPID_AUTO_ENROLL = 21;\nexport const CAPICOM_PROPID_CROSS_CERT_DIST_POINTS = 23;\nexport const CAPICOM_PROPID_CTL_USAGE = 9;\nexport const CAPICOM_PROPID_DATE_STAMP = 27;\nexport const CAPICOM_PROPID_DESCRIPTION = 13;\nexport const CAPICOM_PROPID_EFS = 17;\nexport const CAPICOM_PROPID_ENHKEY_USAGE = 9;\nexport const CAPICOM_PROPID_ENROLLMENT = 26;\nexport const CAPICOM_PROPID_EXTENDED_ERROR_INFO = 30;\nexport const CAPICOM_PROPID_FIRST_RESERVED = 66;\nexport const CAPICOM_PROPID_FIRST_USER = 0x00008000;\nexport const CAPICOM_PROPID_FORTEZZA_DATA = 18;\nexport const CAPICOM_PROPID_FRIENDLY_NAME = 11;\nexport const CAPICOM_PROPID_HASH_PROP = 3;\nexport const CAPICOM_PROPID_IE30_RESERVED = 7;\nexport const CAPICOM_PROPID_ISSUER_PUBLIC_KEY_MD5_HASH = 24;\nexport const CAPICOM_PROPID_ISSUER_SERIAL_NUMBER_MD5_HASH = 28;\nexport const CAPICOM_PROPID_KEY_CONTEXT = 5;\nexport const CAPICOM_PROPID_KEY_IDENTIFIER = 20;\nexport const CAPICOM_PROPID_KEY_PROV_HANDLE = 1;\nexport const CAPICOM_PROPID_KEY_PROV_INFO = 2;\nexport const CAPICOM_PROPID_KEY_SPEC = 6;\nexport const CAPICOM_PROPID_LAST_RESERVED = 0x00007fff;\nexport const CAPICOM_PROPID_LAST_USER = 0x0000ffff;\nexport const CAPICOM_PROPID_MD5_HASH = 4;\nexport const CAPICOM_PROPID_NEXT_UPDATE_LOCATION = 10;\nexport const CAPICOM_PROPID_PUBKEY_ALG_PARA = 22;\nexport const CAPICOM_PROPID_PUBKEY_HASH_RESERVED = 8;\nexport const CAPICOM_PROPID_PVK_FILE = 12;\nexport const CAPICOM_PROPID_RENEWAL = 64;\nexport const CAPICOM_PROPID_SHA1_HASH = 3;\nexport const CAPICOM_PROPID_SIGNATURE_HASH = 15;\nexport const CAPICOM_PROPID_SMART_CARD_DATA = 16;\nexport const CAPICOM_PROPID_SUBJECT_NAME_MD5_HASH = 29;\nexport const CAPICOM_PROPID_SUBJECT_PUBLIC_KEY_MD5_HASH = 25;\nexport const CAPICOM_PROPID_UNKNOWN = 0;\nexport const CAPICOM_SMART_CARD_USER_STORE = 4;\nexport const CAPICOM_STORE_OPEN_EXISTING_ONLY = 128;\nexport const CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED = 256;\nexport const CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;\nexport const CAPICOM_STORE_OPEN_READ_ONLY = 0;\nexport const CAPICOM_STORE_OPEN_READ_WRITE = 1;\nexport const CHECK_NONE = 0;\nexport const CHECK_OFFLINE_REVOCATION_STATUS = 16;\nexport const CHECK_ONLINE_REVOCATION_STATUS = 8;\nexport const CHECK_SIGNATURE_VALIDITY = 4;\nexport const CHECK_TIME_VALIDITY = 2;\nexport const CHECK_TRUSTED_ROOT = 1;\nexport const LOG_LEVEL_DEBUG = 4;\nexport const LOG_LEVEL_ERROR = 1;\nexport const LOG_LEVEL_INFO = 2;\nexport const TRUST_CTL_IS_NOT_SIGNATURE_VALID = 262144;\nexport const TRUST_CTL_IS_NOT_TIME_VALID = 131072;\nexport const TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 524288;\nexport const TRUST_IS_CYCLIC = 128;\nexport const TRUST_IS_NOT_SIGNATURE_VALID = 8;\nexport const TRUST_IS_NOT_TIME_NESTED = 2;\nexport const TRUST_IS_NOT_TIME_VALID = 1;\nexport const TRUST_IS_NOT_VALID_FOR_USAGE = 16;\nexport const TRUST_IS_PARTIAL_CHAIN = 65536;\nexport const TRUST_IS_REVOKED = 4;\nexport const TRUST_IS_UNTRUSTED_ROOT = 32;\nexport const TRUST_REVOCATION_STATUS_UNKNOWN = 64;\nexport const XmlDsigGost3410Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411';\nexport const XmlDsigGost3410UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411';\nexport const XmlDsigGost3411Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411';\nexport const XmlDsigGost3411UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr3411';\n","export * from './cades-constants';\nexport * from './issuer-tags-translations';\nexport * from './oids-dictionary';\nexport * from './subject-tags-translations';\n","import { TagsTranslations } from './tags-translations';\n\nexport const ISSUER_TAGS_TRANSLATIONS: TagsTranslations[] = [\n { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' },\n { possibleNames: ['CN'], translation: 'Удостоверяющий центр' },\n { possibleNames: ['C'], translation: 'Страна' },\n { possibleNames: ['S'], translation: 'Регион' },\n { possibleNames: ['STREET'], translation: 'Адрес' },\n { possibleNames: ['O'], translation: 'Компания' },\n { possibleNames: ['OU'], translation: 'Тип' },\n { possibleNames: ['T'], translation: 'Должность' },\n { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },\n { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },\n { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },\n { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },\n { possibleNames: ['E'], translation: 'Email' },\n { possibleNames: ['L'], translation: 'Город' },\n];\n","export const OIDS_DICTIONARY = {\n '1.2.643.2.2.34.6': 'Пользователь Центра Регистрации',\n '1.2.643.2.39.1.1': 'Использование в программных продуктах системы \"1С:Предприятие 8\"',\n '1.2.643.3.131.1.1': 'ИНН',\n '1.2.643.3.141.1.1': 'РНС ФСС',\n '1.2.643.3.141.1.2': 'КП ФСС',\n '1.2.643.3.2.100.65.13.11': 'Использование в системе АИС \"Госзакупки\" Сахалинской области.',\n '1.2.643.3.8.100.1': 'Сертификат типа \"ekey-ГОСТ\"',\n '1.2.643.3.8.100.1.1': 'Общее использование в системах ИОК без права заверения финансовых документов',\n '1.2.643.3.8.100.1.10':\n 'Для участия в электронных торгах и подписания государственного контракта в информационных системах Тендерного комитета города Москвы уполномоченными лицами участников размещения государственного заказа города Москвы',\n '1.2.643.3.8.100.1.11':\n 'Подписание электронных документов в автоматизированной информационной системе размещения государственного и муниципального заказа Саратовской области',\n '1.2.643.3.8.100.1.12': 'Использование в системе государственного заказа Иркутской области',\n '1.2.643.3.8.100.1.13':\n 'Использование в электронной торговой площадке агентства государственного заказа Красноярского края',\n '1.2.643.3.8.100.1.14': 'Использование в электронной торговой площадке \"Тендер\"',\n '1.2.643.3.8.100.1.2': 'Передача отчетности по ТКС',\n '1.2.643.3.8.100.1.3': 'Оформление взаимных обязательств, соглашений, договоров, актов и т.п.',\n '1.2.643.3.8.100.1.4': 'Внутрикорпоративный документооборот',\n '1.2.643.3.8.100.1.5': 'Использование в системах электронной торговли',\n '1.2.643.3.8.100.1.6': 'Использование в торгово-закупочной системе \"ЭЛЕКТРА\"',\n '1.2.643.3.8.100.1.7': 'Использование в системе Портал государственных закупок Ставропольского края.',\n '1.2.643.3.8.100.1.8': 'Использование в Единой системе электронной торговли B2B-Center и B2G.',\n '1.2.643.3.8.100.1.9':\n 'Для участия в электронных торгах и подписания государственного контракта в электронной площадке ОАО «ЕЭТП» уполномоченными лицами участников размещения государственного или муниципального заказа',\n '1.2.643.5.1.24.2.1.3':\n 'Формирование документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя',\n '1.2.643.5.1.24.2.1.3.1':\n 'Формирование кадастровым инженером документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя',\n '1.2.643.5.1.24.2.2.2': 'Формирование документов как результата оказания услуги со стороны органов регистрации прав',\n '1.2.643.5.1.24.2.2.3':\n 'Формирование документов для получения государственных услуг в сфере государственной регистрации прав на недвижимое имущество и сделок с ним со стороны заявителя',\n '1.2.643.6.2.1.7.1':\n 'Использование единоличным исполнительным органом юридического лица или уполномоченными представителями юридического лица в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских и иных прав и обязанностей в сфере негосударственного пенсионного обеспечения, негосударственного пенсионного страхования, в сфере деятельности паевых инвестиционных фондов, акционерных инвестиционных фондов, профессиональных участников рынка ценных бумаг, а также связанной с обслуживанием указанной деятельности услуг кредитных и иных организаций',\n '1.2.643.6.2.1.7.2':\n 'Использование физическим лицом в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских прав и обязанностей в отношении инвестиционных паев паевых инвестиционных фондов, в том числе отношения, связанные с учетом и/или фиксацией прав на инвестиционные паи паевых инвестиционных фондов',\n '1.2.643.6.3':\n 'Использование в электронных торговых системах и в программном обеспечении, связанным с обменом электронных сообщений',\n '1.2.643.6.3.1.1': 'Использование на электронных площадок отобранных для проведения аукционах в электронной форме',\n '1.2.643.6.3.1.2.1': 'Тип участника - Юридическое лицо',\n '1.2.643.6.3.1.2.2': 'Тип участника - Физическое лицо',\n '1.2.643.6.3.1.2.3': 'Тип участника - Индивидуальный предприниматель',\n '1.2.643.6.3.1.3.1': 'Участник размещения заказа',\n '1.2.643.6.3.1.4.1': 'Администратор организации',\n '1.2.643.6.3.1.4.2': 'Уполномоченный специалист',\n '1.2.643.6.3.1.4.3': 'Специалист с правом подписи контракта',\n '1.2.840.113549.1.9.2': 'Неструктурированное имя',\n '1.3.6.1.4.1.24138.1.1.8.1': 'Обеспечение юридической значимости в Системе \"Электронная Торговая Площадка\"',\n '1.3.6.1.4.1.29919.21': 'Использование в системе Портал государственных закупок Ростовской области \"Рефери\".',\n '1.3.6.1.5.5.7.3.2': 'Проверка подлинности клиента',\n '1.3.6.1.5.5.7.3.4': 'Защищенная электронная почта',\n '1.3.643.3.8.100.15': 'Использование в ЭТП \"uTender\"',\n};\n","import { TagsTranslations } from './tags-translations';\n\nexport const SUBJECT_TAGS_TRANSLATIONS: TagsTranslations[] = [\n { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' },\n { possibleNames: ['CN'], translation: 'Владелец' },\n { possibleNames: ['SN'], translation: 'Фамилия' },\n { possibleNames: ['G'], translation: 'Имя Отчество' },\n { possibleNames: ['C'], translation: 'Страна' },\n { possibleNames: ['S'], translation: 'Регион' },\n { possibleNames: ['STREET'], translation: 'Адрес' },\n { possibleNames: ['O'], translation: 'Компания' },\n { possibleNames: ['OU'], translation: 'Отдел/подразделение' },\n { possibleNames: ['T'], translation: 'Должность' },\n { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },\n { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },\n { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },\n { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },\n { possibleNames: ['E'], translation: 'Email' },\n { possibleNames: ['L'], translation: 'Город' },\n];\n","export * from './api';\n","import { _extractMeaningfulErrorMessage } from './_extractMeaningfulErrorMessage';\n\ntype Unpromisify = T extends Promise ? R : T;\n\nlet isSetLogLevel = false;\nlet isPluginLoaded = false;\n\nexport const _afterPluginsLoaded = any>(\n fn: T,\n): ((...args: Parameters) => Promise>>) => {\n const canPromise = Boolean(window.Promise);\n\n return async function (...args: Parameters): Promise>> {\n if (!isPluginLoaded) {\n try {\n require('../vendor/cadesplugin_api');\n } catch (error) {\n console.error(error);\n\n throw new Error(\n _extractMeaningfulErrorMessage(error) || 'Ошибка при подключении модуля для работы с Cades plugin',\n );\n }\n\n isPluginLoaded = true;\n }\n\n const { cadesplugin } = window;\n\n if (!canPromise) {\n throw new Error('Необходим полифилл для Promise');\n }\n\n if (!cadesplugin) {\n throw new Error('Не подключен модуль для работы с Cades plugin');\n }\n\n if (!isSetLogLevel) {\n cadesplugin.set_log_level(cadesplugin.LOG_LEVEL_ERROR);\n\n isSetLogLevel = true;\n }\n\n try {\n await cadesplugin;\n } catch (error) {\n console.error(error);\n\n throw new Error(\n _extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации модуля для работы с Cades plugin',\n );\n }\n\n return await fn.apply(this, args);\n };\n};\n","export const _extractCommonName = (subjectName: string): string | undefined =>\n subjectName.match(/CN=(.+?)(?:,|$)/)?.[1];\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)|(?:\\.?$))/);\n\n return searchResult ? searchResult[1] : null;\n};\n","// синтетические переменные, которые подменяются в рантайме\nexport const __cadesAsyncToken__ = {};\nexport const __createCadesPluginObject__ = (...args): any => ({});\n\nfunction getGeneratorConstructor(): GeneratorFunction {\n return new Function('', 'return Object.getPrototypeOf(function*(){}).constructor')();\n}\n\nexport const _generateCadesFn = (callback: Function): string => {\n const { cadesplugin } = window;\n const cadesGeneratorsAPI = Boolean(cadesplugin.CreateObjectAsync);\n const callbackName = callback.name || 'dynamicFn';\n const callbackLiteral = String(callback);\n const callbackArguments = callbackLiteral.match(/^function[\\s\\w]*?\\((.*?)\\)/)?.[1] || '';\n const callbackBody = callbackLiteral.replace(/^.*?{([\\s\\S]*?)}$/, '$1');\n let crossEnvCallbackLiteral = String(\n new (cadesGeneratorsAPI ? getGeneratorConstructor() : Function)(callbackArguments, callbackBody),\n );\n\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(\n /\\w+?\\.__createCadesPluginObject__(\\([\\s\\S]*?\\))/gm,\n `cadesplugin.CreateObject${cadesGeneratorsAPI ? 'Async' : ''}$1`,\n );\n\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(\n /\\w+?\\.__cadesAsyncToken__\\s*?\\+\\s*?\\b/gm,\n cadesGeneratorsAPI ? 'yield ' : '',\n );\n\n if (!cadesGeneratorsAPI) {\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/propset_(.*?)\\((.*?)\\)/gm, '$1 = $2');\n }\n\n return [\n cadesGeneratorsAPI ? `cadesplugin.async_spawn(${crossEnvCallbackLiteral});` : `(${crossEnvCallbackLiteral})();`,\n `//# sourceURL=crypto-pro_${callbackName}.js`,\n ].join('');\n};\n","import { CadesCertificate } from '../api/certificate';\nimport { _afterPluginsLoaded } from './_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from './_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from './_generateCadesFn';\n\n/**\n * Возвращает сертификат в формате Cades по отпечатку\n *\n * @param thumbprint - отпечаток сертификата\n * @returns сертификат в формате Cades\n */\nexport const _getCadesCert = _afterPluginsLoaded(\n (thumbprint: string): CadesCertificate => {\n const { cadesplugin } = window;\n\n return eval(\n _generateCadesFn(function _getCadesCert() {\n let cadesStore;\n\n try {\n cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');\n }\n\n if (!cadesStore) {\n throw new Error('Не удалось получить доступ к хранилищу сертификатов');\n }\n\n try {\n void (\n __cadesAsyncToken__ +\n cadesStore.Open(\n cadesplugin.CAPICOM_CURRENT_USER_STORE,\n cadesplugin.CAPICOM_MY_STORE,\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,\n )\n );\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');\n }\n\n let cadesCertificateList;\n let certificatesCount;\n\n try {\n cadesCertificateList = __cadesAsyncToken__ + cadesStore.Certificates;\n certificatesCount = __cadesAsyncToken__ + cadesCertificateList.Count;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');\n }\n\n if (!certificatesCount) {\n throw new Error('Нет доступных сертификатов');\n }\n\n let cadesCertificate: CadesCertificate;\n\n try {\n cadesCertificateList =\n __cadesAsyncToken__ + cadesCertificateList.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH, thumbprint);\n\n const count = __cadesAsyncToken__ + cadesCertificateList.Count;\n\n if (!count) {\n throw new Error(`Сертификат с отпечатком: \"${thumbprint}\" не найден`);\n }\n\n cadesCertificate = __cadesAsyncToken__ + cadesCertificateList.Item(1);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении сертификата');\n }\n\n cadesStore.Close();\n\n return cadesCertificate;\n }),\n );\n },\n);\n","/**\n * Возвращает объект даты, совместимый с Cades plugin'ом, зависящий от браузера.\n *\n * В IE необходимо использовать специфичный формат \"VT_DATE\"\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Microsoft_Extensions/Date.getVarDate\n */\nexport const _getDateObj = (dateObj): Date => (dateObj.getVarDate ? dateObj.getVarDate() : dateObj);\n","const oldestSupportedCSPVersion = 4.0;\n\nexport const _isSupportedCSPVersion = (version: string): boolean => {\n version = version.match(/\\d+?\\b(?:\\.\\d+)?/)?.[0];\n\n return Number(version) >= oldestSupportedCSPVersion;\n};\n","export const _isSupportedCadesVersion = (version: string): boolean => {\n const match = version.match(/(\\d+)\\.(\\d+)\\.(\\d+)/);\n\n if (!match) {\n return false;\n }\n\n const [, major, minor, patch] = match;\n\n if (Number(major) < 2) {\n return false;\n }\n\n if (Number(major) === 2 && Number(patch) < 12438) {\n return false;\n }\n\n return true;\n};\n","import { OIDS_DICTIONARY } from '../constants';\nimport { TagsTranslations } from '../constants/tags-translations';\n\nexport interface TagTranslation {\n description: string;\n title: string;\n isTranslated: boolean;\n}\n\n/**\n * Парсит информацию из строки с информацией о сертификате\n *\n * @param tagsTranslations - словарь с расшифровками тэгов\n * @param rawInfo - данные для парсинга\n * @returns расшифрованная информация по отдельным тэгам\n */\nexport const _parseCertInfo = (tagsTranslations: TagsTranslations[], rawInfo: string): TagTranslation[] => {\n const extractedEntities: string[] = rawInfo.match(/([а-яА-Яa-zA-Z0-9\\s.]+)=(?:(\"[^\"]+?\")|(.+?))(?:,|$)/g);\n\n if (extractedEntities) {\n return extractedEntities.map((group) => {\n const segmentsMatch = group.trim().match(/^([а-яА-Яa-zA-Z0-9\\s.]+)=(.+?),?$/);\n let title = segmentsMatch?.[1];\n // Вырезаем лишние кавычки\n const description = segmentsMatch?.[2]?.replace(/^\"(.*)\"/, '$1')?.replace(/\"{2}/g, '\"');\n const oidIdentifierMatch = title?.match(/^OID\\.(.*)/);\n const oidIdentifier = oidIdentifierMatch?.[1];\n let isTranslated = false;\n\n // Если нашли в тайтле ОИД, пытаемся его расшифровать\n if (oidIdentifier) {\n const oidTranslation = OIDS_DICTIONARY[oidIdentifier];\n\n if (oidTranslation) {\n title = oidTranslation;\n isTranslated = true;\n }\n }\n\n const tagTranslation = tagsTranslations.find((tag) => tag.possibleNames.find((name) => name === title))\n ?.translation;\n\n if (tagTranslation) {\n title = tagTranslation;\n isTranslated = true;\n }\n\n return { description, title, isTranslated };\n });\n }\n};\n",";(function () {\n //already loaded\n if(window.cadesplugin)\n return;\n\n var pluginObject;\n var plugin_resolved = 0;\n var plugin_reject;\n var plugin_resolve;\n var isOpera = 0;\n var isFireFox = 0;\n var isEdge = 0;\n var isSafari = 0;\n var failed_extensions = 0;\n\n var canPromise = !!window.Promise;\n var cadesplugin;\n\n if(canPromise)\n {\n cadesplugin = new Promise(function(resolve, reject)\n {\n plugin_resolve = resolve;\n plugin_reject = reject;\n });\n } else\n {\n cadesplugin = {};\n }\n\n function check_browser() {\n var ua= navigator.userAgent, tem, M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\\/))\\/?\\s*(\\d+)/i) || [];\n if(/trident/i.test(M[1])){\n tem= /\\brv[ :]+(\\d+)/g.exec(ua) || [];\n return {name:'IE',version:(tem[1] || '')};\n }\n if(M[1]=== 'Chrome'){\n tem= ua.match(/\\b(OPR|Edge)\\/(\\d+)/);\n if(tem!= null) return {name:tem[1].replace('OPR', 'Opera'),version:tem[2]};\n }\n M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];\n if((tem= ua.match(/version\\/(\\d+)/i))!= null) M.splice(1, 1, tem[1]);\n return {name:M[0],version:M[1]};\n }\n var browserSpecs = check_browser();\n\n function cpcsp_console_log(level, msg){\n //IE9 не может писать в консоль если не открыта вкладка developer tools\n if(typeof(console) === 'undefined')\n return;\n if (level <= cadesplugin.current_log_level ){\n if (level === cadesplugin.LOG_LEVEL_DEBUG)\n console.log(\"DEBUG: %s\", msg);\n if (level === cadesplugin.LOG_LEVEL_INFO)\n console.info(\"INFO: %s\", msg);\n if (level === cadesplugin.LOG_LEVEL_ERROR)\n console.error(\"ERROR: %s\", msg);\n return;\n }\n }\n\n function set_log_level(level){\n if (!((level === cadesplugin.LOG_LEVEL_DEBUG) ||\n (level === cadesplugin.LOG_LEVEL_INFO) ||\n (level === cadesplugin.LOG_LEVEL_ERROR))){\n cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, \"cadesplugin_api.js: Incorrect log_level: \" + level);\n return;\n }\n cadesplugin.current_log_level = level;\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = DEBUG\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = INFO\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = ERROR\");\n if(isNativeMessageSupported())\n {\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG)\n window.postMessage(\"set_log_level=debug\", \"*\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO)\n window.postMessage(\"set_log_level=info\", \"*\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR)\n window.postMessage(\"set_log_level=error\", \"*\");\n }\n }\n\n function set_constantValues()\n {\n cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CAPICOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CADESCOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_CONTAINER_STORE = 100;\n\n cadesplugin.CAPICOM_MY_STORE = \"My\";\n\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;\n\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\n\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;\n\n cadesplugin.XmlDsigGost3410UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411\";\n cadesplugin.XmlDsigGost3411UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr3411\";\n cadesplugin.XmlDsigGost3410Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411\";\n cadesplugin.XmlDsigGost3411Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411\";\n\n cadesplugin.CADESCOM_CADES_DEFAULT = 0;\n cadesplugin.CADESCOM_CADES_BES = 1;\n cadesplugin.CADESCOM_CADES_T = 0x5;\n cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;\n cadesplugin.CADESCOM_PKCS7_TYPE = 0xffff;\n\n cadesplugin.CADESCOM_ENCODE_BASE64 = 0;\n cadesplugin.CADESCOM_ENCODE_BINARY = 1;\n cadesplugin.CADESCOM_ENCODE_ANY = -1;\n\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;\n\n cadesplugin.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;\n cadesplugin.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;\n\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;\n\n cadesplugin.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;\n\n cadesplugin.CAPICOM_PROPID_ENHKEY_USAGE = 9;\n\n cadesplugin.CAPICOM_OID_OTHER = 0;\n cadesplugin.CAPICOM_OID_KEY_USAGE_EXTENSION = 10;\n\n cadesplugin.CAPICOM_EKU_CLIENT_AUTH = 2;\n cadesplugin.CAPICOM_EKU_SMARTCARD_LOGON = 5;\n cadesplugin.CAPICOM_EKU_OTHER = 0;\n\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\n cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1;\n\n cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0;\n cadesplugin.CADESCOM_BASE64_TO_BINARY = 1;\n\n cadesplugin.CADESCOM_DISPLAY_DATA_NONE = 0;\n cadesplugin.CADESCOM_DISPLAY_DATA_CONTENT = 1;\n cadesplugin.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;\n\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;\n\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA1 = 0;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD2 = 1;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD4 = 2;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD5 = 3;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_256 = 4;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_384 = 5;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_512 = 6;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112;\n\n cadesplugin.LOG_LEVEL_DEBUG = 4;\n cadesplugin.LOG_LEVEL_INFO = 2;\n cadesplugin.LOG_LEVEL_ERROR = 1;\n\n cadesplugin.CADESCOM_AllowNone = 0;\n cadesplugin.CADESCOM_AllowNoOutstandingRequest = 0x1;\n cadesplugin.CADESCOM_AllowUntrustedCertificate = 0x2;\n cadesplugin.CADESCOM_AllowUntrustedRoot = 0x4;\n cadesplugin.CADESCOM_SkipInstallToStore = 0x10000000;\n }\n\n function async_spawn(generatorFunc) {\n function continuer(verb, arg) {\n var result;\n try {\n result = generator[verb](arg);\n } catch (err) {\n return Promise.reject(err);\n }\n if (result.done) {\n return result.value;\n } else {\n return Promise.resolve(result.value).then(onFulfilled, onRejected);\n }\n }\n var generator = generatorFunc(Array.prototype.slice.call(arguments, 1));\n var onFulfilled = continuer.bind(continuer, \"next\");\n var onRejected = continuer.bind(continuer, \"throw\");\n return onFulfilled();\n }\n\n function isIE() {\n // var retVal = ((\"Microsoft Internet Explorer\" == navigator.appName) || // IE < 11\n // navigator.userAgent.match(/Trident\\/./i)); // IE 11\n return (browserSpecs.name === 'IE' || browserSpecs.name === 'MSIE');\n }\n\n function isIOS() {\n return (navigator.userAgent.match(/ipod/i) ||\n navigator.userAgent.match(/ipad/i) ||\n navigator.userAgent.match(/iphone/i));\n }\n\n function isNativeMessageSupported()\n {\n // В IE работаем через NPAPI\n if(isIE())\n return false;\n // В Edge работаем через NativeMessage\n if(browserSpecs.name === 'Edge') {\n isEdge = true;\n return true;\n }\n // В Chrome, Firefox, Safari и Opera работаем через асинхронную версию в зависимости от версии\n if(browserSpecs.name === 'Opera') {\n isOpera = true;\n if(browserSpecs.version >= 33){\n return true;\n }\n else{\n return false;\n }\n }\n if(browserSpecs.name === 'Firefox') {\n isFireFox = true;\n if(browserSpecs.version >= 52){\n return true;\n }\n else{\n return false;\n }\n }\n if(browserSpecs.name === 'Chrome') {\n if(browserSpecs.version >= 42){\n return true;\n }\n else{\n return false;\n }\n }\n //В Сафари начиная с 12 версии нет NPAPI\n if(browserSpecs.name === 'Safari') {\n isSafari = true;\n if(browserSpecs.version >= 12) {\n return true;\n } else {\n return false;\n }\n }\n }\n\n // Функция активации объектов КриптоПро ЭЦП Browser plug-in\n function CreateObject(name) {\n if (isIOS()) {\n // На iOS для создания объектов используется функция\n // call_ru_cryptopro_npcades_10_native_bridge, определенная в IOS_npcades_supp.js\n return call_ru_cryptopro_npcades_10_native_bridge(\"CreateObject\", [name]);\n }\n if (isIE()) {\n // В Internet Explorer создаются COM-объекты\n if (name.match(/X509Enrollment/i)) {\n try {\n // Объекты CertEnroll пробуем создавать через нашу фабрику,\n // если не получилось то через CX509EnrollmentWebClassFactory\n var objCertEnrollClassFactory = document.getElementById(\"webClassFactory\");\n return objCertEnrollClassFactory.CreateObject(name);\n }\n catch (e) {\n try {\n var objWebClassFactory = document.getElementById(\"certEnrollClassFactory\");\n return objWebClassFactory.CreateObject(name);\n }\n catch (err) {\n throw (\"Для создания обьектов X509Enrollment следует настроить веб-узел на использование проверки подлинности по протоколу HTTPS\");\n }\n }\n }\n // Объекты CAPICOM и CAdESCOM создаются через CAdESCOM.WebClassFactory\n try {\n var objWebClassFactory = document.getElementById(\"webClassFactory\");\n return objWebClassFactory.CreateObject(name);\n }\n catch (e) {\n // Для версий плагина ниже 2.0.12538\n return new ActiveXObject(name);\n }\n }\n // создаются объекты NPAPI\n return pluginObject.CreateObject(name);\n }\n\n function decimalToHexString(number) {\n if (number < 0) {\n number = 0xFFFFFFFF + number + 1;\n }\n\n return number.toString(16).toUpperCase();\n }\n\n function GetMessageFromException(e) {\n var err = e.message;\n if (!err) {\n err = e;\n } else if (e.number) {\n err += \" (0x\" + decimalToHexString(e.number) + \")\";\n }\n return err;\n }\n\n function getLastError(exception) {\n if(isNativeMessageSupported() || isIE() || isIOS() ) {\n return GetMessageFromException(exception);\n }\n\n try {\n return pluginObject.getLastError();\n } catch(e) {\n return GetMessageFromException(exception);\n }\n }\n\n // Функция для удаления созданных объектов\n function ReleasePluginObjects() {\n return cpcsp_chrome_nmcades.ReleasePluginObjects();\n }\n\n // Функция активации асинхронных объектов КриптоПро ЭЦП Browser plug-in\n function CreateObjectAsync(name) {\n return pluginObject.CreateObjectAsync(name);\n }\n\n //Функции для IOS\n var ru_cryptopro_npcades_10_native_bridge = {\n callbacksCount : 1,\n callbacks : {},\n\n // Automatically called by native layer when a result is available\n resultForCallback : function resultForCallback(callbackId, resultArray) {\n var callback = ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId];\n if (!callback) return;\n callback.apply(null,resultArray);\n },\n\n // Use this in javascript to request native objective-c code\n // functionName : string (I think the name is explicit :p)\n // args : array of arguments\n // callback : function with n-arguments that is going to be called when the native code returned\n call : function call(functionName, args, callback) {\n var hasCallback = callback && typeof callback === \"function\";\n var callbackId = hasCallback ? ru_cryptopro_npcades_10_native_bridge.callbacksCount++ : 0;\n\n if (hasCallback)\n ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId] = callback;\n\n var iframe = document.createElement(\"IFRAME\");\n var arrObjs = new Array(\"_CPNP_handle\");\n try{\n iframe.setAttribute(\"src\", \"cpnp-js-call:\" + functionName + \":\" + callbackId+ \":\" + encodeURIComponent(JSON.stringify(args, arrObjs)));\n } catch(e){\n alert(e);\n }\n document.documentElement.appendChild(iframe);\n iframe.parentNode.removeChild(iframe);\n iframe = null;\n }\n };\n\n function call_ru_cryptopro_npcades_10_native_bridge(functionName, array){\n var tmpobj;\n var ex;\n ru_cryptopro_npcades_10_native_bridge.call(functionName, array, function(e, response){\n ex = e;\n var str='tmpobj='+response;\n eval(str);\n if (typeof (tmpobj) === \"string\"){\n tmpobj = tmpobj.replace(/\\\\\\n/gm, \"\\n\");\n tmpobj = tmpobj.replace(/\\\\\\r/gm, \"\\r\");\n }\n });\n if(ex)\n throw ex;\n return tmpobj;\n }\n\n function show_firefox_missing_extension_dialog()\n {\n if (!window.cadesplugin_skip_extension_install)\n {\n var ovr = document.createElement('div');\n ovr.id = \"cadesplugin_ovr\";\n ovr.style = \"visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)\";\n ovr.innerHTML = \"
\" +\n \"\" +\n \"

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

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

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

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

\" +\n \"
\";\n document.getElementsByTagName(\"Body\")[0].appendChild(ovr);\n var btn_install = document.getElementById(\"cadesplugin_install\");\n btn_install.addEventListener('click', function(event) {\n opr.addons.installExtension(\"epebfcehmdedogndhlcacafjaacknbcm\",\n function()\n {\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n location.reload();\n },\n function(){})\n });\n document.getElementById(\"cadesplugin_close_install\").addEventListener('click',function()\n {\n plugin_loaded_error(\"Плагин недоступен\");\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n });\n\n ovr.addEventListener('click',function()\n {\n plugin_loaded_error(\"Плагин недоступен\");\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n });\n ovr.style.visibility=\"visible\";\n document.getElementById(\"cadesplugin_ovr_item\").addEventListener('click',function(e){\n e.stopPropagation();\n });\n });\n }else\n {\n plugin_loaded_error(\"Плагин недоступен\");\n }\n }\n\n function firefox_or_edge_nmcades_onload() {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n\n function nmcades_api_onload () {\n window.postMessage(\"cadesplugin_echo_request\", \"*\");\n window.addEventListener(\"message\", function (event){\n if (typeof(event.data) !== \"string\" || !event.data.match(\"cadesplugin_loaded\"))\n return;\n if(isFireFox || isEdge || isSafari)\n {\n // Для Firefox, Сафари, Edge вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js\n var url = event.data.substring(event.data.indexOf(\"url:\") + 4);\n var fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", url);\n fileref.onerror = plugin_loaded_error;\n fileref.onload = firefox_or_edge_nmcades_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n // Для Firefox, Safari и Edge у нас только по одному расширению.\n failed_extensions++;\n }else {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n }, false);\n }\n\n //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari\n function load_extension()\n {\n\n if(isFireFox || isEdge || isSafari){\n // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера.\n nmcades_api_onload();\n } else {\n // в асинхронном варианте для chrome и opera подключаем оба расширения\n var fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", \"chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js\");\n fileref.onerror = plugin_loaded_error;\n fileref.onload = nmcades_api_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", \"chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js\");\n fileref.onerror = plugin_loaded_error;\n fileref.onload = nmcades_api_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n }\n }\n\n //Загружаем плагин для NPAPI\n function load_npapi_plugin()\n {\n var elem = document.createElement('object');\n elem.setAttribute(\"id\", \"cadesplugin_object\");\n elem.setAttribute(\"type\", \"application/x-cades\");\n elem.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem);\n pluginObject = document.getElementById(\"cadesplugin_object\");\n if(isIE())\n {\n var elem1 = document.createElement('object');\n elem1.setAttribute(\"id\", \"certEnrollClassFactory\");\n elem1.setAttribute(\"classid\", \"clsid:884e2049-217d-11da-b2a4-000e7bbb2b09\");\n elem1.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem1);\n var elem2 = document.createElement('object');\n elem2.setAttribute(\"id\", \"webClassFactory\");\n elem2.setAttribute(\"classid\", \"clsid:B04C8637-10BD-484E-B0DA-B8A039F60024\");\n elem2.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem2);\n }\n }\n\n //Отправляем событие что все ок.\n function plugin_loaded()\n {\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_resolve();\n }else {\n window.postMessage(\"cadesplugin_loaded\", \"*\");\n }\n }\n\n //Отправляем событие что сломались.\n function plugin_loaded_error(msg)\n {\n if(isNativeMessageSupported())\n {\n //в асинхронном варианте подключаем оба расширения, если сломались оба пробуем установить для Opera\n failed_extensions++;\n if(failed_extensions<2)\n return;\n if(isOpera && (typeof(msg) === 'undefined'|| typeof(msg) === 'object'))\n {\n install_opera_extension();\n return;\n }\n }\n if(typeof(msg) === 'undefined' || typeof(msg) === 'object')\n msg = \"Плагин недоступен\";\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_reject(msg);\n } else {\n window.postMessage(\"cadesplugin_load_error\", \"*\");\n }\n }\n\n //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку\n function check_load_timeout()\n {\n if(plugin_resolved === 1)\n return;\n if(isFireFox)\n {\n show_firefox_missing_extension_dialog();\n }\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_reject(\"Истекло время ожидания загрузки плагина\");\n } else {\n window.postMessage(\"cadesplugin_load_error\", \"*\");\n }\n\n }\n\n //Вспомогательная функция для NPAPI\n function createPromise(arg)\n {\n return new Promise(arg);\n }\n\n function check_npapi_plugin (){\n try {\n var oAbout = CreateObject(\"CAdESCOM.About\");\n plugin_loaded();\n }\n catch (err) {\n document.getElementById(\"cadesplugin_object\").style.display = 'none';\n // Объект создать не удалось, проверим, установлен ли\n // вообще плагин. Такая возможность есть не во всех браузерах\n var mimetype = navigator.mimeTypes[\"application/x-cades\"];\n if (mimetype) {\n var plugin = mimetype.enabledPlugin;\n if (plugin) {\n plugin_loaded_error(\"Плагин загружен, но не создаются обьекты\");\n }else\n {\n plugin_loaded_error(\"Ошибка при загрузке плагина\");\n }\n }else\n {\n plugin_loaded_error(\"Плагин недоступен\");\n }\n }\n }\n\n //Проверяем работает ли плагин\n function check_plugin_working()\n {\n var div = document.createElement(\"div\");\n div.innerHTML = \"\";\n var isIeLessThan9 = (div.getElementsByTagName(\"i\").length === 1);\n if (isIeLessThan9) {\n plugin_loaded_error(\"Internet Explorer версии 8 и ниже не поддерживается\");\n return;\n }\n\n if(isNativeMessageSupported())\n {\n load_extension();\n }else if(!canPromise) {\n window.addEventListener(\"message\", function (event){\n if (event.data !== \"cadesplugin_echo_request\")\n return;\n load_npapi_plugin();\n check_npapi_plugin();\n },\n false);\n }else\n {\n if(document.readyState === \"complete\"){\n load_npapi_plugin();\n check_npapi_plugin();\n } else {\n window.addEventListener(\"load\", function (event) {\n load_npapi_plugin();\n check_npapi_plugin();\n }, false);\n }\n }\n }\n\n function set_pluginObject(obj)\n {\n pluginObject = obj;\n }\n\n function is_capilite_enabled()\n {\n if ((typeof (cadesplugin.EnableInternalCSP) !== 'undefined') && cadesplugin.EnableInternalCSP)\n return true;\n return false;\n };\n\n //Export\n cadesplugin.JSModuleVersion = \"2.1.2\";\n cadesplugin.async_spawn = async_spawn;\n cadesplugin.set = set_pluginObject;\n cadesplugin.set_log_level = set_log_level;\n cadesplugin.getLastError = getLastError;\n cadesplugin.is_capilite_enabled = is_capilite_enabled;\n\n if(isNativeMessageSupported())\n {\n cadesplugin.CreateObjectAsync = CreateObjectAsync;\n cadesplugin.ReleasePluginObjects = ReleasePluginObjects;\n }\n\n if(!isNativeMessageSupported())\n {\n cadesplugin.CreateObject = CreateObject;\n }\n\n if(window.cadesplugin_load_timeout)\n {\n setTimeout(check_load_timeout, window.cadesplugin_load_timeout);\n }\n else\n {\n setTimeout(check_load_timeout, 20000);\n }\n\n set_constantValues();\n\n cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR;\n window.cadesplugin = cadesplugin;\n check_plugin_working();\n}());\n"],"sourceRoot":""} \ No newline at end of file +{"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/createHash.ts","webpack://cryptoPro/./api/createSignature.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;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,QAAQ,WAAW;;AAEnB;AACA;AACA;AACA,QAAQ,WAAW;;AAEnB;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA,QAAQ,WAAW;;AAEnB;AACA;AACA,QAAQ,UAAU;;AAElB;AACA;;;;;;;;;;;;ACnFA,iBAAiB;;AAEjB;AACA;AACA;;;;;;;;;;;;ACJA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;A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AClB,KAAK,GAAG,cAAc,CAAC;gBACvB,YAAY,GAAG,IAAI,CAAC;aACrB;YAED,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;QAC9C,CAAC,CAAC,CAAC;KACJ;AACH,CAAC,CAAC;;;;;;;;;;;;AClDF,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA,mCAAmC;AACnC;AACA;AACA;AACA,gBAAgB;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';\nimport { TagTranslation } from '../../helpers/_parseCertInfo';\nimport { exportBase64 } from './exportBase64';\nimport { getAlgorithm } from './getAlgorithm';\nimport { getCadesProp } from './getCadesProp';\nimport { getDecodedExtendedKeyUsage, ExtendedKeysTranslations } from './getDecodedExtendedKeyUsage';\nimport { getExtendedKeyUsage } from './getExtendedKeyUsage';\nimport { getInfo } from './getInfo';\nimport { hasExtendedKeyUsage } from './hasExtendedKeyUsage';\nimport { isValid } from './isValid';\n\nexport type CadesCertificate = any;\n\nexport class Certificate {\n constructor(\n public _cadesCertificate: CadesCertificate,\n public name: string,\n public issuerName: string,\n public subjectName: string,\n public thumbprint: string,\n public validFrom: string,\n public validTo: string,\n ) {}\n\n public getOwnerInfo(): Promise {\n return getInfo.call(this, SUBJECT_TAGS_TRANSLATIONS, 'SubjectName');\n }\n\n public getIssuerInfo(): Promise {\n return getInfo.call(this, ISSUER_TAGS_TRANSLATIONS, 'IssuerName');\n }\n\n public getExtendedKeyUsage(): Promise {\n return getExtendedKeyUsage.call(this);\n }\n\n public getDecodedExtendedKeyUsage(): Promise {\n return getDecodedExtendedKeyUsage.call(this);\n }\n\n public getAlgorithm(): Promise {\n return getAlgorithm.call(this);\n }\n\n public getCadesProp(propName): Promise {\n return getCadesProp.call(this, propName);\n }\n\n public isValid(): Promise {\n return isValid.call(this);\n }\n\n public exportBase64(): Promise {\n return exportBase64.call(this);\n }\n\n public hasExtendedKeyUsage(oids): Promise {\n return hasExtendedKeyUsage.call(this, oids);\n }\n}\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Экспортирует сертификат в формате base64\n *\n * @returns сертификат в формате base64\n */\nexport const exportBase64 = _afterPluginsLoaded(function (): string {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function exportBase64(): string {\n let base64: string;\n\n try {\n base64 = __cadesAsyncToken__ + cadesCertificate.Export(0);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при экспорте сертификата');\n }\n\n return base64;\n }),\n );\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\ninterface AlgorithmInfo {\n algorithm: string;\n oid: string;\n}\n\n/**\n * Возвращает информацию об алгоритме сертификата\n *\n * @returns информацию об алгоритме и его OID'е\n */\nexport const getAlgorithm = _afterPluginsLoaded(function (): AlgorithmInfo {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function getAlgorithm(): AlgorithmInfo {\n const algorithmInfo: AlgorithmInfo = {\n algorithm: null,\n oid: null,\n };\n let cadesPublicKey;\n\n try {\n cadesPublicKey = __cadesAsyncToken__ + cadesCertificate.PublicKey();\n cadesPublicKey = __cadesAsyncToken__ + cadesPublicKey.Algorithm;\n algorithmInfo.algorithm = __cadesAsyncToken__ + cadesPublicKey.FriendlyName;\n algorithmInfo.oid = __cadesAsyncToken__ + cadesPublicKey.Value;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении алгоритма');\n }\n\n return algorithmInfo;\n }),\n );\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Возвращает указанное внутренее свойство у сертификата в формате Cades\n *\n * @param propName = наименование свойства\n * @returns значение запрошенного свойства\n */\nexport const getCadesProp = _afterPluginsLoaded(function (propName: string): any {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function getCadesProp() {\n let propertyValue;\n\n try {\n propertyValue = __cadesAsyncToken__ + cadesCertificate[propName];\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при обращении к свойству сертификата');\n }\n\n return propertyValue;\n }),\n );\n});\n","import { OIDS_DICTIONARY } from '../../constants';\nimport { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { Certificate } from './certificate';\n\nexport interface ExtendedKeysTranslations {\n [key: string]: string | null;\n}\n\n/**\n * Возвращает расшифрованные ОИД'ы сертификата\n *\n * @returns словарь расшифрованных ОИД'ов\n */\nexport const getDecodedExtendedKeyUsage = _afterPluginsLoaded(async function (): Promise {\n const certificateOids = await (this as Certificate).getExtendedKeyUsage();\n\n return certificateOids.reduce(\n (decodedOids, oidCode) => ({\n ...decodedOids,\n [oidCode]: OIDS_DICTIONARY[oidCode] || null,\n }),\n {},\n );\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Возвращает ОИД'ы сертификата\n *\n * @returns список ОИД'ов\n */\nexport const getExtendedKeyUsage = _afterPluginsLoaded(function (): string[] {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function getExtendedKeyUsage(): string[] {\n const OIDS: string[] = [];\n let count: any;\n\n try {\n count = __cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage();\n count = __cadesAsyncToken__ + count.EKUs;\n count = __cadesAsyncToken__ + count.Count;\n\n if (count > 0) {\n while (count > 0) {\n let cadesExtendedKeyUsage;\n\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage();\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.EKUs;\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.Item(count);\n cadesExtendedKeyUsage = __cadesAsyncToken__ + cadesExtendedKeyUsage.OID;\n\n OIDS.push(cadesExtendedKeyUsage);\n\n count--;\n }\n }\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || \"Ошибка при получении ОИД'ов\");\n }\n\n return OIDS;\n }),\n );\n});\n","import { TagsTranslations } from '../../constants/tags-translations';\nimport { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { _parseCertInfo, TagTranslation } from '../../helpers/_parseCertInfo';\nimport { getCadesProp } from './getCadesProp';\n\n/**\n * Возвращает расшифрованную информацию о сертификате из указанного свойства по тэгам\n *\n * @param tags = словарь\n * @param entitiesPath = путь к разбираемой сущности\n * @returns расшифрованная информация по отдельным тэгам\n */\nexport const getInfo = _afterPluginsLoaded(async function (\n tags: TagsTranslations[],\n entitiesPath: string,\n): Promise {\n let entities: string;\n\n try {\n entities = await getCadesProp.call(this, entitiesPath);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при извлечении информации из сертификата');\n }\n\n return _parseCertInfo(tags, entities);\n});\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { Certificate } from './certificate';\n\n/**\n * Проверяет наличие ОИД'а (ОИД'ов) у сертификата\n *\n * @param oids - ОИД'ы для проверки\n * @returns флаг наличия ОИД'ов у сертификата\n */\nexport const hasExtendedKeyUsage = _afterPluginsLoaded(async function (oids: string | string[]): Promise {\n const certOids = await (this as Certificate).getExtendedKeyUsage();\n\n let result: boolean;\n\n if (Array.isArray(oids)) {\n result = oids.every((oidToCheck) => certOids.some((certOid) => certOid === oidToCheck));\n } else {\n result = certOids.some((certOid) => certOid === oids);\n }\n\n return result;\n});\n","export * from './certificate';\n","import { _afterPluginsLoaded } from '../../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, _generateCadesFn } from '../../helpers/_generateCadesFn';\nimport { Certificate } from './certificate';\n\n/**\n * Проверяет действительность сертификата\n *\n * @returns флаг валидности\n */\nexport const isValid = _afterPluginsLoaded(function (): boolean {\n const cadesCertificate = (this as Certificate)._cadesCertificate;\n\n return eval(\n _generateCadesFn(function isValid() {\n let isValid;\n\n try {\n isValid = __cadesAsyncToken__ + cadesCertificate.IsValid();\n isValid = __cadesAsyncToken__ + isValid.Result;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при проверке сертификата');\n }\n\n return Boolean(isValid);\n }),\n );\n});\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\ntype Algorithm =\n | 'GOST_3411'\n | 'GOST_3411_2012_256'\n | 'GOST_3411_2012_512'\n | 'GOST_3411_HMAC'\n | 'GOST_3411_2012_256_HMAC'\n | 'GOST_3411_2012_512_HMAC';\n\n/**\n * Создает хэш сообщения по ГОСТ Р 34.11\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)\n *\n * @param unencryptedMessage - сообщение для хеширования\n * @param algorithm - один из алгоритмов хеширования:\n * GOST_3411\n * GOST_3411_2012_256\n * GOST_3411_2012_512 - по умолчанию\n * GOST_3411_HMAC\n * GOST_3411_2012_256_HMAC\n * GOST_3411_2012_512_HMAC\n *\n * @returns хэш\n */\nexport const createHash = _afterPluginsLoaded(\n async (unencryptedMessage: string | ArrayBuffer, algorithm: Algorithm = 'GOST_3411_2012_512'): Promise => {\n const { cadesplugin } = window;\n\n return eval(\n _generateCadesFn(function createHash(): string {\n const cadesHashedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.HashedData');\n let messageBase64;\n let hash;\n\n try {\n messageBase64 = Buffer.from(unencryptedMessage).toString('base64');\n } catch (error) {\n console.error(error);\n\n throw new Error('Ошибка при преобразовании сообщения в Base64');\n }\n\n try {\n void (\n __cadesAsyncToken__ +\n cadesHashedData.propset_Algorithm(cadesplugin['CADESCOM_HASH_ALGORITHM_CP_' + algorithm])\n );\n void (__cadesAsyncToken__ + cadesHashedData.propset_DataEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));\n void (__cadesAsyncToken__ + cadesHashedData.Hash(messageBase64));\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации хэширования');\n }\n\n try {\n hash = __cadesAsyncToken__ + cadesHashedData.Value;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при создании хэша');\n }\n\n return hash;\n }),\n );\n },\n);\n","import { CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME } from '../constants';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\nimport { _getCadesCert } from '../helpers/_getCadesCert';\nimport { _getDateObj } from '../helpers/_getDateObj';\n\n/**\n * Создает подпись base64 строки по отпечатку сертификата\n *\n * @param thumbprint - отпечаток сертификата\n * @param messageHash - хэш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11\n * @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false)\n * @returns подпись\n */\nexport const createSignature = _afterPluginsLoaded(\n async (thumbprint: string, messageHash: string, detachedSignature: boolean = true): Promise => {\n const { cadesplugin } = window;\n const cadesCertificate = await _getCadesCert(thumbprint);\n\n return eval(\n _generateCadesFn(function createSignature(): string {\n let cadesAttrs;\n let cadesSignedData;\n let cadesSigner;\n\n try {\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\n cadesSignedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CadesSignedData');\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\n }\n\n const currentTime = _getDateObj(new Date());\n\n try {\n void (__cadesAsyncToken__ + cadesAttrs.propset_Name(CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME));\n void (__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime));\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи');\n }\n\n let cadesAuthAttrs;\n\n try {\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\n cadesAuthAttrs = __cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2;\n void (__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs));\n void (__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));\n void (__cadesAsyncToken__ + cadesSignedData.propset_Content(messageHash));\n void (\n __cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY)\n );\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи');\n }\n\n let signature: string;\n\n try {\n signature =\n __cadesAsyncToken__ +\n cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_CADES_BES, detachedSignature);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных');\n }\n\n return signature;\n }),\n );\n },\n);\n","import { Certificate } from './certificate';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { getUserCertificates } from './getUserCertificates';\n\n/**\n * Возвращает сертификат по отпечатку\n *\n * @param thumbprint - отпечаток сертификата\n * @returns сертификат\n */\nexport const getCertificate = _afterPluginsLoaded(\n async (thumbprint: string): Promise => {\n if (!thumbprint) {\n throw new Error('Отпечаток не указан');\n }\n\n const availableCertificates: Certificate[] = await getUserCertificates();\n const foundCertificate: Certificate = availableCertificates.find((cert) => cert.thumbprint === thumbprint);\n\n if (!foundCertificate) {\n throw new Error(`Сертификат с отпечатком: \"${thumbprint}\" не найден`);\n }\n\n return foundCertificate;\n },\n);\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\nexport interface SystemInfo {\n cadesVersion: string;\n cspVersion: string;\n}\n\n/**\n * Предоставляет информацию о системе\n *\n * @returns информацию о CSP и плагине\n */\nexport const getSystemInfo = _afterPluginsLoaded(\n (): SystemInfo => {\n const sysInfo = {\n cadesVersion: null,\n cspVersion: null,\n };\n\n return eval(\n _generateCadesFn(function getSystemInfo(): SystemInfo {\n let cadesAbout;\n\n try {\n cadesAbout = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.About');\n\n sysInfo.cadesVersion = __cadesAsyncToken__ + cadesAbout.PluginVersion;\n sysInfo.cspVersion = __cadesAsyncToken__ + cadesAbout.CSPVersion();\n\n if (!sysInfo.cadesVersion) {\n sysInfo.cadesVersion = __cadesAsyncToken__ + cadesAbout.Version;\n }\n\n sysInfo.cadesVersion = __cadesAsyncToken__ + sysInfo.cadesVersion.toString();\n sysInfo.cspVersion = __cadesAsyncToken__ + sysInfo.cspVersion.toString();\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении информации о системе');\n }\n\n return sysInfo;\n }),\n );\n },\n);\n","import { CadesCertificate, Certificate } from './certificate';\nimport { CAPICOM_PROPID_KEY_PROV_INFO } from '../constants';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractCommonName } from '../helpers/_extractCommonName';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\nlet certificatesCache: Certificate[];\n\n/**\n * Возвращает список сертификатов, доступных пользователю в системе\n *\n * @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов\n * @returns список сертификатов\n */\nexport const getUserCertificates = _afterPluginsLoaded((resetCache: boolean = false): Certificate[] => {\n const { cadesplugin } = window;\n\n if (!resetCache && certificatesCache) {\n return certificatesCache;\n }\n\n return eval(\n _generateCadesFn(function getUserCertificates(): Certificate[] {\n let cadesStore;\n\n try {\n cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');\n }\n\n try {\n void (\n __cadesAsyncToken__ +\n cadesStore.Open(\n cadesplugin.CAPICOM_CURRENT_USER_STORE,\n cadesplugin.CAPICOM_MY_STORE,\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,\n )\n );\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');\n }\n\n let cadesCertificates;\n let cadesCertificatesCount;\n\n try {\n cadesCertificates = __cadesAsyncToken__ + cadesStore.Certificates;\n\n if (cadesCertificates) {\n cadesCertificates =\n __cadesAsyncToken__ + cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID);\n\n /**\n * Не рассматриваются сертификаты, в которых отсутствует закрытый ключ\n * или не действительны на данный момент\n */\n cadesCertificates =\n __cadesAsyncToken__ +\n cadesCertificates.Find(\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY,\n CAPICOM_PROPID_KEY_PROV_INFO,\n );\n\n cadesCertificatesCount = __cadesAsyncToken__ + cadesCertificates.Count;\n }\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');\n }\n\n if (!cadesCertificatesCount) {\n throw new Error('Нет доступных сертификатов');\n }\n\n const certificateList: Certificate[] = [];\n\n try {\n while (cadesCertificatesCount) {\n const cadesCertificate: CadesCertificate =\n __cadesAsyncToken__ + cadesCertificates.Item(cadesCertificatesCount);\n\n certificateList.push(\n new Certificate(\n cadesCertificate,\n _extractCommonName(__cadesAsyncToken__ + cadesCertificate.SubjectName),\n __cadesAsyncToken__ + cadesCertificate.IssuerName,\n __cadesAsyncToken__ + cadesCertificate.SubjectName,\n __cadesAsyncToken__ + cadesCertificate.Thumbprint,\n __cadesAsyncToken__ + cadesCertificate.ValidFromDate,\n __cadesAsyncToken__ + cadesCertificate.ValidToDate,\n ),\n );\n\n cadesCertificatesCount--;\n }\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка обработки сертификатов');\n }\n\n cadesStore.Close();\n\n certificatesCache = certificateList;\n\n return certificatesCache;\n }),\n );\n});\n","export * from './getCertificate';\nexport * from './getUserCertificates';\nexport * from './getSystemInfo';\nexport * from './isValidSystemSetup';\nexport * from './createSignature';\nexport * from './createHash';\nexport * from './certificate';\n","import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { _isSupportedCadesVersion } from '../helpers/_isSupportedCadesVersion';\nimport { _isSupportedCSPVersion } from '../helpers/_isSupportedCSPVersion';\nimport { getSystemInfo, SystemInfo } from './getSystemInfo';\n\n/**\n * Проверяет корректность настроек ЭП на машине\n *\n * @returns флаг корректности настроек\n */\nexport const isValidSystemSetup = _afterPluginsLoaded(\n async (): Promise => {\n let systemInfo: SystemInfo;\n\n try {\n systemInfo = await getSystemInfo();\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Настройки ЭП на данной машине не верны');\n }\n\n if (!_isSupportedCadesVersion(systemInfo.cadesVersion)) {\n throw new Error('Не поддерживаемая версия плагина');\n }\n\n if (!_isSupportedCSPVersion(systemInfo.cspVersion)) {\n throw new Error('Не поддерживаемая версия CSP');\n }\n\n return true;\n },\n);\n","export const CADESCOM_ATTRIBUTE_OTHER = -1;\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\nexport const CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\nexport const CADESCOM_AllowNoOutstandingRequest = 1;\nexport const CADESCOM_AllowNone = 0;\nexport const CADESCOM_AllowUntrustedCertificate = 2;\nexport const CADESCOM_AllowUntrustedRoot = 4;\nexport const CADESCOM_BASE64_TO_BINARY = 0x01;\nexport const CADESCOM_CADES_BES = 1;\nexport const CADESCOM_CADES_DEFAULT = 0;\nexport const CADESCOM_CADES_T = 5;\nexport const CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;\nexport const CADESCOM_CONTAINER_STORE = 100;\nexport const CADESCOM_CURRENT_USER_STORE = 2;\nexport const CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;\nexport const CADESCOM_DISPLAY_DATA_CONTENT = 1;\nexport const CADESCOM_DISPLAY_DATA_NONE = 0;\nexport const CADESCOM_ENCODE_ANY = -1;\nexport const CADESCOM_ENCODE_BASE64 = 0;\nexport const CADESCOM_ENCODE_BINARY = 1;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;\nexport const CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112;\nexport const CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110;\nexport const CADESCOM_HASH_ALGORITHM_MD2 = 1;\nexport const CADESCOM_HASH_ALGORITHM_MD4 = 2;\nexport const CADESCOM_HASH_ALGORITHM_MD5 = 3;\nexport const CADESCOM_HASH_ALGORITHM_SHA1 = 0;\nexport const CADESCOM_HASH_ALGORITHM_SHA_256 = 4;\nexport const CADESCOM_HASH_ALGORITHM_SHA_384 = 5;\nexport const CADESCOM_HASH_ALGORITHM_SHA_512 = 6;\nexport const CADESCOM_LOCAL_MACHINE_STORE = 1;\nexport const CADESCOM_PKCS7_TYPE = 65535;\nexport const CADESCOM_STRING_TO_UCS2LE = 0x00;\nexport const CADESCOM_SkipInstallToStore = 268435456;\nexport const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;\nexport const CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;\nexport const CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;\nexport const CAPICOM_ACTIVE_DIRECTORY_USER_STORE = 3;\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\nexport const CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\nexport const CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;\nexport const CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;\nexport const CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;\nexport const CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;\nexport const CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;\nexport const CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;\nexport const CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;\nexport const CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;\nexport const CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\nexport const CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;\nexport const CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;\nexport const CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;\nexport const CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;\nexport const CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;\nexport const CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;\nexport const CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;\nexport const CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;\nexport const CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;\nexport const CAPICOM_CURRENT_USER_STORE = 2;\nexport const CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;\nexport const CAPICOM_EKU_CLIENT_AUTH = 2;\nexport const CAPICOM_EKU_OTHER = 0;\nexport const CAPICOM_EKU_SMARTCARD_LOGON = 5;\nexport const CAPICOM_LOCAL_MACHINE_STORE = 1;\nexport const CAPICOM_MEMORY_STORE = 0;\nexport const CAPICOM_MY_STORE = 'My';\nexport const CAPICOM_OID_KEY_USAGE_EXTENSION = 10;\nexport const CAPICOM_OID_OTHER = 0;\nexport const CAPICOM_PROPID_ACCESS_STATE = 14;\nexport const CAPICOM_PROPID_ARCHIVED = 19;\nexport const CAPICOM_PROPID_ARCHIVED_KEY_HASH = 65;\nexport const CAPICOM_PROPID_AUTO_ENROLL = 21;\nexport const CAPICOM_PROPID_CROSS_CERT_DIST_POINTS = 23;\nexport const CAPICOM_PROPID_CTL_USAGE = 9;\nexport const CAPICOM_PROPID_DATE_STAMP = 27;\nexport const CAPICOM_PROPID_DESCRIPTION = 13;\nexport const CAPICOM_PROPID_EFS = 17;\nexport const CAPICOM_PROPID_ENHKEY_USAGE = 9;\nexport const CAPICOM_PROPID_ENROLLMENT = 26;\nexport const CAPICOM_PROPID_EXTENDED_ERROR_INFO = 30;\nexport const CAPICOM_PROPID_FIRST_RESERVED = 66;\nexport const CAPICOM_PROPID_FIRST_USER = 0x00008000;\nexport const CAPICOM_PROPID_FORTEZZA_DATA = 18;\nexport const CAPICOM_PROPID_FRIENDLY_NAME = 11;\nexport const CAPICOM_PROPID_HASH_PROP = 3;\nexport const CAPICOM_PROPID_IE30_RESERVED = 7;\nexport const CAPICOM_PROPID_ISSUER_PUBLIC_KEY_MD5_HASH = 24;\nexport const CAPICOM_PROPID_ISSUER_SERIAL_NUMBER_MD5_HASH = 28;\nexport const CAPICOM_PROPID_KEY_CONTEXT = 5;\nexport const CAPICOM_PROPID_KEY_IDENTIFIER = 20;\nexport const CAPICOM_PROPID_KEY_PROV_HANDLE = 1;\nexport const CAPICOM_PROPID_KEY_PROV_INFO = 2;\nexport const CAPICOM_PROPID_KEY_SPEC = 6;\nexport const CAPICOM_PROPID_LAST_RESERVED = 0x00007fff;\nexport const CAPICOM_PROPID_LAST_USER = 0x0000ffff;\nexport const CAPICOM_PROPID_MD5_HASH = 4;\nexport const CAPICOM_PROPID_NEXT_UPDATE_LOCATION = 10;\nexport const CAPICOM_PROPID_PUBKEY_ALG_PARA = 22;\nexport const CAPICOM_PROPID_PUBKEY_HASH_RESERVED = 8;\nexport const CAPICOM_PROPID_PVK_FILE = 12;\nexport const CAPICOM_PROPID_RENEWAL = 64;\nexport const CAPICOM_PROPID_SHA1_HASH = 3;\nexport const CAPICOM_PROPID_SIGNATURE_HASH = 15;\nexport const CAPICOM_PROPID_SMART_CARD_DATA = 16;\nexport const CAPICOM_PROPID_SUBJECT_NAME_MD5_HASH = 29;\nexport const CAPICOM_PROPID_SUBJECT_PUBLIC_KEY_MD5_HASH = 25;\nexport const CAPICOM_PROPID_UNKNOWN = 0;\nexport const CAPICOM_SMART_CARD_USER_STORE = 4;\nexport const CAPICOM_STORE_OPEN_EXISTING_ONLY = 128;\nexport const CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED = 256;\nexport const CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;\nexport const CAPICOM_STORE_OPEN_READ_ONLY = 0;\nexport const CAPICOM_STORE_OPEN_READ_WRITE = 1;\nexport const CHECK_NONE = 0;\nexport const CHECK_OFFLINE_REVOCATION_STATUS = 16;\nexport const CHECK_ONLINE_REVOCATION_STATUS = 8;\nexport const CHECK_SIGNATURE_VALIDITY = 4;\nexport const CHECK_TIME_VALIDITY = 2;\nexport const CHECK_TRUSTED_ROOT = 1;\nexport const LOG_LEVEL_DEBUG = 4;\nexport const LOG_LEVEL_ERROR = 1;\nexport const LOG_LEVEL_INFO = 2;\nexport const TRUST_CTL_IS_NOT_SIGNATURE_VALID = 262144;\nexport const TRUST_CTL_IS_NOT_TIME_VALID = 131072;\nexport const TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 524288;\nexport const TRUST_IS_CYCLIC = 128;\nexport const TRUST_IS_NOT_SIGNATURE_VALID = 8;\nexport const TRUST_IS_NOT_TIME_NESTED = 2;\nexport const TRUST_IS_NOT_TIME_VALID = 1;\nexport const TRUST_IS_NOT_VALID_FOR_USAGE = 16;\nexport const TRUST_IS_PARTIAL_CHAIN = 65536;\nexport const TRUST_IS_REVOKED = 4;\nexport const TRUST_IS_UNTRUSTED_ROOT = 32;\nexport const TRUST_REVOCATION_STATUS_UNKNOWN = 64;\nexport const XmlDsigGost3410Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411';\nexport const XmlDsigGost3410UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411';\nexport const XmlDsigGost3411Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411';\nexport const XmlDsigGost3411UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr3411';\n","export * from './cades-constants';\nexport * from './issuer-tags-translations';\nexport * from './oids-dictionary';\nexport * from './subject-tags-translations';\n","import { TagsTranslations } from './tags-translations';\n\nexport const ISSUER_TAGS_TRANSLATIONS: TagsTranslations[] = [\n { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' },\n { possibleNames: ['CN'], translation: 'Удостоверяющий центр' },\n { possibleNames: ['C'], translation: 'Страна' },\n { possibleNames: ['S'], translation: 'Регион' },\n { possibleNames: ['STREET'], translation: 'Адрес' },\n { possibleNames: ['O'], translation: 'Компания' },\n { possibleNames: ['OU'], translation: 'Тип' },\n { possibleNames: ['T'], translation: 'Должность' },\n { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },\n { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },\n { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },\n { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },\n { possibleNames: ['E'], translation: 'Email' },\n { possibleNames: ['L'], translation: 'Город' },\n];\n","export const OIDS_DICTIONARY = {\n '1.2.643.2.2.34.6': 'Пользователь Центра Регистрации',\n '1.2.643.2.39.1.1': 'Использование в программных продуктах системы \"1С:Предприятие 8\"',\n '1.2.643.3.131.1.1': 'ИНН',\n '1.2.643.3.141.1.1': 'РНС ФСС',\n '1.2.643.3.141.1.2': 'КП ФСС',\n '1.2.643.3.2.100.65.13.11': 'Использование в системе АИС \"Госзакупки\" Сахалинской области.',\n '1.2.643.3.8.100.1': 'Сертификат типа \"ekey-ГОСТ\"',\n '1.2.643.3.8.100.1.1': 'Общее использование в системах ИОК без права заверения финансовых документов',\n '1.2.643.3.8.100.1.10':\n 'Для участия в электронных торгах и подписания государственного контракта в информационных системах Тендерного комитета города Москвы уполномоченными лицами участников размещения государственного заказа города Москвы',\n '1.2.643.3.8.100.1.11':\n 'Подписание электронных документов в автоматизированной информационной системе размещения государственного и муниципального заказа Саратовской области',\n '1.2.643.3.8.100.1.12': 'Использование в системе государственного заказа Иркутской области',\n '1.2.643.3.8.100.1.13':\n 'Использование в электронной торговой площадке агентства государственного заказа Красноярского края',\n '1.2.643.3.8.100.1.14': 'Использование в электронной торговой площадке \"Тендер\"',\n '1.2.643.3.8.100.1.2': 'Передача отчетности по ТКС',\n '1.2.643.3.8.100.1.3': 'Оформление взаимных обязательств, соглашений, договоров, актов и т.п.',\n '1.2.643.3.8.100.1.4': 'Внутрикорпоративный документооборот',\n '1.2.643.3.8.100.1.5': 'Использование в системах электронной торговли',\n '1.2.643.3.8.100.1.6': 'Использование в торгово-закупочной системе \"ЭЛЕКТРА\"',\n '1.2.643.3.8.100.1.7': 'Использование в системе Портал государственных закупок Ставропольского края.',\n '1.2.643.3.8.100.1.8': 'Использование в Единой системе электронной торговли B2B-Center и B2G.',\n '1.2.643.3.8.100.1.9':\n 'Для участия в электронных торгах и подписания государственного контракта в электронной площадке ОАО «ЕЭТП» уполномоченными лицами участников размещения государственного или муниципального заказа',\n '1.2.643.5.1.24.2.1.3':\n 'Формирование документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя',\n '1.2.643.5.1.24.2.1.3.1':\n 'Формирование кадастровым инженером документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя',\n '1.2.643.5.1.24.2.2.2': 'Формирование документов как результата оказания услуги со стороны органов регистрации прав',\n '1.2.643.5.1.24.2.2.3':\n 'Формирование документов для получения государственных услуг в сфере государственной регистрации прав на недвижимое имущество и сделок с ним со стороны заявителя',\n '1.2.643.6.2.1.7.1':\n 'Использование единоличным исполнительным органом юридического лица или уполномоченными представителями юридического лица в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских и иных прав и обязанностей в сфере негосударственного пенсионного обеспечения, негосударственного пенсионного страхования, в сфере деятельности паевых инвестиционных фондов, акционерных инвестиционных фондов, профессиональных участников рынка ценных бумаг, а также связанной с обслуживанием указанной деятельности услуг кредитных и иных организаций',\n '1.2.643.6.2.1.7.2':\n 'Использование физическим лицом в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских прав и обязанностей в отношении инвестиционных паев паевых инвестиционных фондов, в том числе отношения, связанные с учетом и/или фиксацией прав на инвестиционные паи паевых инвестиционных фондов',\n '1.2.643.6.3':\n 'Использование в электронных торговых системах и в программном обеспечении, связанным с обменом электронных сообщений',\n '1.2.643.6.3.1.1': 'Использование на электронных площадок отобранных для проведения аукционах в электронной форме',\n '1.2.643.6.3.1.2.1': 'Тип участника - Юридическое лицо',\n '1.2.643.6.3.1.2.2': 'Тип участника - Физическое лицо',\n '1.2.643.6.3.1.2.3': 'Тип участника - Индивидуальный предприниматель',\n '1.2.643.6.3.1.3.1': 'Участник размещения заказа',\n '1.2.643.6.3.1.4.1': 'Администратор организации',\n '1.2.643.6.3.1.4.2': 'Уполномоченный специалист',\n '1.2.643.6.3.1.4.3': 'Специалист с правом подписи контракта',\n '1.2.840.113549.1.9.2': 'Неструктурированное имя',\n '1.3.6.1.4.1.24138.1.1.8.1': 'Обеспечение юридической значимости в Системе \"Электронная Торговая Площадка\"',\n '1.3.6.1.4.1.29919.21': 'Использование в системе Портал государственных закупок Ростовской области \"Рефери\".',\n '1.3.6.1.5.5.7.3.2': 'Проверка подлинности клиента',\n '1.3.6.1.5.5.7.3.4': 'Защищенная электронная почта',\n '1.3.643.3.8.100.15': 'Использование в ЭТП \"uTender\"',\n};\n","import { TagsTranslations } from './tags-translations';\n\nexport const SUBJECT_TAGS_TRANSLATIONS: TagsTranslations[] = [\n { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' },\n { possibleNames: ['CN'], translation: 'Владелец' },\n { possibleNames: ['SN'], translation: 'Фамилия' },\n { possibleNames: ['G'], translation: 'Имя Отчество' },\n { possibleNames: ['C'], translation: 'Страна' },\n { possibleNames: ['S'], translation: 'Регион' },\n { possibleNames: ['STREET'], translation: 'Адрес' },\n { possibleNames: ['O'], translation: 'Компания' },\n { possibleNames: ['OU'], translation: 'Отдел/подразделение' },\n { possibleNames: ['T'], translation: 'Должность' },\n { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' },\n { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' },\n { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' },\n { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' },\n { possibleNames: ['E'], translation: 'Email' },\n { possibleNames: ['L'], translation: 'Город' },\n];\n","export * from './api';\n","import { _extractMeaningfulErrorMessage } from './_extractMeaningfulErrorMessage';\n\ntype Unpromisify = T extends Promise ? R : T;\n\nlet isSetLogLevel = false;\nlet isPluginLoaded = false;\n\nexport const _afterPluginsLoaded = any>(\n fn: T,\n): ((...args: Parameters) => Promise>>) => {\n const canPromise = Boolean(window.Promise);\n\n return async function (...args: Parameters): Promise>> {\n if (!isPluginLoaded) {\n try {\n require('../vendor/cadesplugin_api');\n } catch (error) {\n console.error(error);\n\n throw new Error(\n _extractMeaningfulErrorMessage(error) || 'Ошибка при подключении модуля для работы с Cades plugin',\n );\n }\n\n isPluginLoaded = true;\n }\n\n const { cadesplugin } = window;\n\n if (!canPromise) {\n throw new Error('Необходим полифилл для Promise');\n }\n\n if (!cadesplugin) {\n throw new Error('Не подключен модуль для работы с Cades plugin');\n }\n\n if (!isSetLogLevel) {\n cadesplugin.set_log_level(cadesplugin.LOG_LEVEL_ERROR);\n\n isSetLogLevel = true;\n }\n\n try {\n await cadesplugin;\n } catch (error) {\n console.error(error);\n\n throw new Error(\n _extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации модуля для работы с Cades plugin',\n );\n }\n\n return await fn.apply(this, args);\n };\n};\n","export const _extractCommonName = (subjectName: string): string | undefined =>\n subjectName.match(/CN=(.+?)(?:,|$)/)?.[1];\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)|(?:\\.?$))/);\n\n return searchResult ? searchResult[1] : null;\n};\n","// синтетические переменные, которые подменяются в рантайме\nexport const __cadesAsyncToken__ = {};\nexport const __createCadesPluginObject__ = (...args): any => ({});\n\nfunction getGeneratorConstructor(): GeneratorFunction {\n return new Function('', 'return Object.getPrototypeOf(function*(){}).constructor')();\n}\n\nexport const _generateCadesFn = (callback: Function): string => {\n const { cadesplugin } = window;\n const cadesGeneratorsAPI = Boolean(cadesplugin.CreateObjectAsync);\n const callbackName = callback.name || 'dynamicFn';\n const callbackLiteral = String(callback);\n const callbackArguments = callbackLiteral.match(/^function[\\s\\w]*?\\((.*?)\\)/)?.[1] || '';\n const callbackBody = callbackLiteral.replace(/^.*?{([\\s\\S]*?)}$/, '$1');\n let crossEnvCallbackLiteral = String(\n new (cadesGeneratorsAPI ? getGeneratorConstructor() : Function)(callbackArguments, callbackBody),\n );\n\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(\n /\\w+?\\.__createCadesPluginObject__(\\([\\s\\S]*?\\))/gm,\n `cadesplugin.CreateObject${cadesGeneratorsAPI ? 'Async' : ''}$1`,\n );\n\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(\n /\\w+?\\.__cadesAsyncToken__\\s*?\\+\\s*?\\b/gm,\n cadesGeneratorsAPI ? 'yield ' : '',\n );\n\n if (!cadesGeneratorsAPI) {\n crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/propset_(.*?)\\((.*?)\\)/gm, '$1 = $2');\n }\n\n return [\n cadesGeneratorsAPI ? `cadesplugin.async_spawn(${crossEnvCallbackLiteral});` : `(${crossEnvCallbackLiteral})();`,\n `//# sourceURL=crypto-pro_${callbackName}.js`,\n ].join('');\n};\n","import { CadesCertificate } from '../api/certificate';\nimport { _afterPluginsLoaded } from './_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from './_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from './_generateCadesFn';\n\n/**\n * Возвращает сертификат в формате Cades по отпечатку\n *\n * @param thumbprint - отпечаток сертификата\n * @returns сертификат в формате Cades\n */\nexport const _getCadesCert = _afterPluginsLoaded(\n (thumbprint: string): CadesCertificate => {\n const { cadesplugin } = window;\n\n return eval(\n _generateCadesFn(function _getCadesCert() {\n let cadesStore;\n\n try {\n cadesStore = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.Store');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу');\n }\n\n if (!cadesStore) {\n throw new Error('Не удалось получить доступ к хранилищу сертификатов');\n }\n\n try {\n void (\n __cadesAsyncToken__ +\n cadesStore.Open(\n cadesplugin.CAPICOM_CURRENT_USER_STORE,\n cadesplugin.CAPICOM_MY_STORE,\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED,\n )\n );\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища');\n }\n\n let cadesCertificateList;\n let certificatesCount;\n\n try {\n cadesCertificateList = __cadesAsyncToken__ + cadesStore.Certificates;\n certificatesCount = __cadesAsyncToken__ + cadesCertificateList.Count;\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов');\n }\n\n if (!certificatesCount) {\n throw new Error('Нет доступных сертификатов');\n }\n\n let cadesCertificate: CadesCertificate;\n\n try {\n cadesCertificateList =\n __cadesAsyncToken__ + cadesCertificateList.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH, thumbprint);\n\n const count = __cadesAsyncToken__ + cadesCertificateList.Count;\n\n if (!count) {\n throw new Error(`Сертификат с отпечатком: \"${thumbprint}\" не найден`);\n }\n\n cadesCertificate = __cadesAsyncToken__ + cadesCertificateList.Item(1);\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при получении сертификата');\n }\n\n cadesStore.Close();\n\n return cadesCertificate;\n }),\n );\n },\n);\n","/**\n * Возвращает объект даты, совместимый с Cades plugin'ом, зависящий от браузера.\n *\n * В IE необходимо использовать специфичный формат \"VT_DATE\"\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Microsoft_Extensions/Date.getVarDate\n */\nexport const _getDateObj = (dateObj): Date => (dateObj.getVarDate ? dateObj.getVarDate() : dateObj);\n","const oldestSupportedCSPVersion = 4.0;\n\nexport const _isSupportedCSPVersion = (version: string): boolean => {\n version = version.match(/\\d+?\\b(?:\\.\\d+)?/)?.[0];\n\n return Number(version) >= oldestSupportedCSPVersion;\n};\n","export const _isSupportedCadesVersion = (version: string): boolean => {\n const match = version.match(/(\\d+)\\.(\\d+)\\.(\\d+)/);\n\n if (!match) {\n return false;\n }\n\n const [, major, minor, patch] = match;\n\n if (Number(major) < 2) {\n return false;\n }\n\n if (Number(major) === 2 && Number(patch) < 12438) {\n return false;\n }\n\n return true;\n};\n","import { OIDS_DICTIONARY } from '../constants';\nimport { TagsTranslations } from '../constants/tags-translations';\n\nexport interface TagTranslation {\n description: string;\n title: string;\n isTranslated: boolean;\n}\n\n/**\n * Парсит информацию из строки с информацией о сертификате\n *\n * @param tagsTranslations - словарь с расшифровками тэгов\n * @param rawInfo - данные для парсинга\n * @returns расшифрованная информация по отдельным тэгам\n */\nexport const _parseCertInfo = (tagsTranslations: TagsTranslations[], rawInfo: string): TagTranslation[] => {\n const extractedEntities: string[] = rawInfo.match(/([а-яА-Яa-zA-Z0-9\\s.]+)=(?:(\"[^\"]+?\")|(.+?))(?:,|$)/g);\n\n if (extractedEntities) {\n return extractedEntities.map((group) => {\n const segmentsMatch = group.trim().match(/^([а-яА-Яa-zA-Z0-9\\s.]+)=(.+?),?$/);\n let title = segmentsMatch?.[1];\n // Вырезаем лишние кавычки\n const description = segmentsMatch?.[2]?.replace(/^\"(.*)\"/, '$1')?.replace(/\"{2}/g, '\"');\n const oidIdentifierMatch = title?.match(/^OID\\.(.*)/);\n const oidIdentifier = oidIdentifierMatch?.[1];\n let isTranslated = false;\n\n // Если нашли в тайтле ОИД, пытаемся его расшифровать\n if (oidIdentifier) {\n const oidTranslation = OIDS_DICTIONARY[oidIdentifier];\n\n if (oidTranslation) {\n title = oidTranslation;\n isTranslated = true;\n }\n }\n\n const tagTranslation = tagsTranslations.find((tag) => tag.possibleNames.find((name) => name === title))\n ?.translation;\n\n if (tagTranslation) {\n title = tagTranslation;\n isTranslated = true;\n }\n\n return { description, title, isTranslated };\n });\n }\n};\n",";(function () {\n //already loaded\n if(window.cadesplugin)\n return;\n\n var pluginObject;\n var plugin_resolved = 0;\n var plugin_reject;\n var plugin_resolve;\n var isOpera = 0;\n var isFireFox = 0;\n var isEdge = 0;\n var isSafari = 0;\n var failed_extensions = 0;\n\n var canPromise = !!window.Promise;\n var cadesplugin;\n\n if(canPromise)\n {\n cadesplugin = new Promise(function(resolve, reject)\n {\n plugin_resolve = resolve;\n plugin_reject = reject;\n });\n } else\n {\n cadesplugin = {};\n }\n\n function check_browser() {\n var ua= navigator.userAgent, tem, M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\\/))\\/?\\s*(\\d+)/i) || [];\n if(/trident/i.test(M[1])){\n tem= /\\brv[ :]+(\\d+)/g.exec(ua) || [];\n return {name:'IE',version:(tem[1] || '')};\n }\n if(M[1]=== 'Chrome'){\n tem= ua.match(/\\b(OPR|Edge)\\/(\\d+)/);\n if(tem!= null) return {name:tem[1].replace('OPR', 'Opera'),version:tem[2]};\n }\n M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];\n if((tem= ua.match(/version\\/(\\d+)/i))!= null) M.splice(1, 1, tem[1]);\n return {name:M[0],version:M[1]};\n }\n var browserSpecs = check_browser();\n\n function cpcsp_console_log(level, msg){\n //IE9 не может писать в консоль если не открыта вкладка developer tools\n if(typeof(console) === 'undefined')\n return;\n if (level <= cadesplugin.current_log_level ){\n if (level === cadesplugin.LOG_LEVEL_DEBUG)\n console.log(\"DEBUG: %s\", msg);\n if (level === cadesplugin.LOG_LEVEL_INFO)\n console.info(\"INFO: %s\", msg);\n if (level === cadesplugin.LOG_LEVEL_ERROR)\n console.error(\"ERROR: %s\", msg);\n return;\n }\n }\n\n function set_log_level(level){\n if (!((level === cadesplugin.LOG_LEVEL_DEBUG) ||\n (level === cadesplugin.LOG_LEVEL_INFO) ||\n (level === cadesplugin.LOG_LEVEL_ERROR))){\n cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, \"cadesplugin_api.js: Incorrect log_level: \" + level);\n return;\n }\n cadesplugin.current_log_level = level;\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = DEBUG\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = INFO\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = ERROR\");\n if(isNativeMessageSupported())\n {\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG)\n window.postMessage(\"set_log_level=debug\", \"*\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO)\n window.postMessage(\"set_log_level=info\", \"*\");\n if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR)\n window.postMessage(\"set_log_level=error\", \"*\");\n }\n }\n\n function set_constantValues()\n {\n cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CAPICOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CADESCOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_CONTAINER_STORE = 100;\n\n cadesplugin.CAPICOM_MY_STORE = \"My\";\n\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;\n\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\n\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;\n\n cadesplugin.XmlDsigGost3410UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411\";\n cadesplugin.XmlDsigGost3411UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr3411\";\n cadesplugin.XmlDsigGost3410Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411\";\n cadesplugin.XmlDsigGost3411Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411\";\n\n cadesplugin.CADESCOM_CADES_DEFAULT = 0;\n cadesplugin.CADESCOM_CADES_BES = 1;\n cadesplugin.CADESCOM_CADES_T = 0x5;\n cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;\n cadesplugin.CADESCOM_PKCS7_TYPE = 0xffff;\n\n cadesplugin.CADESCOM_ENCODE_BASE64 = 0;\n cadesplugin.CADESCOM_ENCODE_BINARY = 1;\n cadesplugin.CADESCOM_ENCODE_ANY = -1;\n\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0;\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1;\n cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2;\n\n cadesplugin.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0;\n cadesplugin.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1;\n\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENSION = 5;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11;\n cadesplugin.CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12;\n\n cadesplugin.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128;\n\n cadesplugin.CAPICOM_PROPID_ENHKEY_USAGE = 9;\n\n cadesplugin.CAPICOM_OID_OTHER = 0;\n cadesplugin.CAPICOM_OID_KEY_USAGE_EXTENSION = 10;\n\n cadesplugin.CAPICOM_EKU_CLIENT_AUTH = 2;\n cadesplugin.CAPICOM_EKU_SMARTCARD_LOGON = 5;\n cadesplugin.CAPICOM_EKU_OTHER = 0;\n\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\n cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0;\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\n cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1;\n\n cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0;\n cadesplugin.CADESCOM_BASE64_TO_BINARY = 1;\n\n cadesplugin.CADESCOM_DISPLAY_DATA_NONE = 0;\n cadesplugin.CADESCOM_DISPLAY_DATA_CONTENT = 1;\n cadesplugin.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;\n\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;\n\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA1 = 0;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD2 = 1;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD4 = 2;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD5 = 3;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_256 = 4;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_384 = 5;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_512 = 6;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112;\n\n cadesplugin.LOG_LEVEL_DEBUG = 4;\n cadesplugin.LOG_LEVEL_INFO = 2;\n cadesplugin.LOG_LEVEL_ERROR = 1;\n\n cadesplugin.CADESCOM_AllowNone = 0;\n cadesplugin.CADESCOM_AllowNoOutstandingRequest = 0x1;\n cadesplugin.CADESCOM_AllowUntrustedCertificate = 0x2;\n cadesplugin.CADESCOM_AllowUntrustedRoot = 0x4;\n cadesplugin.CADESCOM_SkipInstallToStore = 0x10000000;\n }\n\n function async_spawn(generatorFunc) {\n function continuer(verb, arg) {\n var result;\n try {\n result = generator[verb](arg);\n } catch (err) {\n return Promise.reject(err);\n }\n if (result.done) {\n return result.value;\n } else {\n return Promise.resolve(result.value).then(onFulfilled, onRejected);\n }\n }\n var generator = generatorFunc(Array.prototype.slice.call(arguments, 1));\n var onFulfilled = continuer.bind(continuer, \"next\");\n var onRejected = continuer.bind(continuer, \"throw\");\n return onFulfilled();\n }\n\n function isIE() {\n // var retVal = ((\"Microsoft Internet Explorer\" == navigator.appName) || // IE < 11\n // navigator.userAgent.match(/Trident\\/./i)); // IE 11\n return (browserSpecs.name === 'IE' || browserSpecs.name === 'MSIE');\n }\n\n function isIOS() {\n return (navigator.userAgent.match(/ipod/i) ||\n navigator.userAgent.match(/ipad/i) ||\n navigator.userAgent.match(/iphone/i));\n }\n\n function isNativeMessageSupported()\n {\n // В IE работаем через NPAPI\n if(isIE())\n return false;\n // В Edge работаем через NativeMessage\n if(browserSpecs.name === 'Edge') {\n isEdge = true;\n return true;\n }\n // В Chrome, Firefox, Safari и Opera работаем через асинхронную версию в зависимости от версии\n if(browserSpecs.name === 'Opera') {\n isOpera = true;\n if(browserSpecs.version >= 33){\n return true;\n }\n else{\n return false;\n }\n }\n if(browserSpecs.name === 'Firefox') {\n isFireFox = true;\n if(browserSpecs.version >= 52){\n return true;\n }\n else{\n return false;\n }\n }\n if(browserSpecs.name === 'Chrome') {\n if(browserSpecs.version >= 42){\n return true;\n }\n else{\n return false;\n }\n }\n //В Сафари начиная с 12 версии нет NPAPI\n if(browserSpecs.name === 'Safari') {\n isSafari = true;\n if(browserSpecs.version >= 12) {\n return true;\n } else {\n return false;\n }\n }\n }\n\n // Функция активации объектов КриптоПро ЭЦП Browser plug-in\n function CreateObject(name) {\n if (isIOS()) {\n // На iOS для создания объектов используется функция\n // call_ru_cryptopro_npcades_10_native_bridge, определенная в IOS_npcades_supp.js\n return call_ru_cryptopro_npcades_10_native_bridge(\"CreateObject\", [name]);\n }\n if (isIE()) {\n // В Internet Explorer создаются COM-объекты\n if (name.match(/X509Enrollment/i)) {\n try {\n // Объекты CertEnroll пробуем создавать через нашу фабрику,\n // если не получилось то через CX509EnrollmentWebClassFactory\n var objCertEnrollClassFactory = document.getElementById(\"webClassFactory\");\n return objCertEnrollClassFactory.CreateObject(name);\n }\n catch (e) {\n try {\n var objWebClassFactory = document.getElementById(\"certEnrollClassFactory\");\n return objWebClassFactory.CreateObject(name);\n }\n catch (err) {\n throw (\"Для создания обьектов X509Enrollment следует настроить веб-узел на использование проверки подлинности по протоколу HTTPS\");\n }\n }\n }\n // Объекты CAPICOM и CAdESCOM создаются через CAdESCOM.WebClassFactory\n try {\n var objWebClassFactory = document.getElementById(\"webClassFactory\");\n return objWebClassFactory.CreateObject(name);\n }\n catch (e) {\n // Для версий плагина ниже 2.0.12538\n return new ActiveXObject(name);\n }\n }\n // создаются объекты NPAPI\n return pluginObject.CreateObject(name);\n }\n\n function decimalToHexString(number) {\n if (number < 0) {\n number = 0xFFFFFFFF + number + 1;\n }\n\n return number.toString(16).toUpperCase();\n }\n\n function GetMessageFromException(e) {\n var err = e.message;\n if (!err) {\n err = e;\n } else if (e.number) {\n err += \" (0x\" + decimalToHexString(e.number) + \")\";\n }\n return err;\n }\n\n function getLastError(exception) {\n if(isNativeMessageSupported() || isIE() || isIOS() ) {\n return GetMessageFromException(exception);\n }\n\n try {\n return pluginObject.getLastError();\n } catch(e) {\n return GetMessageFromException(exception);\n }\n }\n\n // Функция для удаления созданных объектов\n function ReleasePluginObjects() {\n return cpcsp_chrome_nmcades.ReleasePluginObjects();\n }\n\n // Функция активации асинхронных объектов КриптоПро ЭЦП Browser plug-in\n function CreateObjectAsync(name) {\n return pluginObject.CreateObjectAsync(name);\n }\n\n //Функции для IOS\n var ru_cryptopro_npcades_10_native_bridge = {\n callbacksCount : 1,\n callbacks : {},\n\n // Automatically called by native layer when a result is available\n resultForCallback : function resultForCallback(callbackId, resultArray) {\n var callback = ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId];\n if (!callback) return;\n callback.apply(null,resultArray);\n },\n\n // Use this in javascript to request native objective-c code\n // functionName : string (I think the name is explicit :p)\n // args : array of arguments\n // callback : function with n-arguments that is going to be called when the native code returned\n call : function call(functionName, args, callback) {\n var hasCallback = callback && typeof callback === \"function\";\n var callbackId = hasCallback ? ru_cryptopro_npcades_10_native_bridge.callbacksCount++ : 0;\n\n if (hasCallback)\n ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId] = callback;\n\n var iframe = document.createElement(\"IFRAME\");\n var arrObjs = new Array(\"_CPNP_handle\");\n try{\n iframe.setAttribute(\"src\", \"cpnp-js-call:\" + functionName + \":\" + callbackId+ \":\" + encodeURIComponent(JSON.stringify(args, arrObjs)));\n } catch(e){\n alert(e);\n }\n document.documentElement.appendChild(iframe);\n iframe.parentNode.removeChild(iframe);\n iframe = null;\n }\n };\n\n function call_ru_cryptopro_npcades_10_native_bridge(functionName, array){\n var tmpobj;\n var ex;\n ru_cryptopro_npcades_10_native_bridge.call(functionName, array, function(e, response){\n ex = e;\n var str='tmpobj='+response;\n eval(str);\n if (typeof (tmpobj) === \"string\"){\n tmpobj = tmpobj.replace(/\\\\\\n/gm, \"\\n\");\n tmpobj = tmpobj.replace(/\\\\\\r/gm, \"\\r\");\n }\n });\n if(ex)\n throw ex;\n return tmpobj;\n }\n\n function show_firefox_missing_extension_dialog()\n {\n if (!window.cadesplugin_skip_extension_install)\n {\n var ovr = document.createElement('div');\n ovr.id = \"cadesplugin_ovr\";\n ovr.style = \"visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)\";\n ovr.innerHTML = \"
\" +\n \"\" +\n \"

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

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

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

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

\" +\n \"
\";\n document.getElementsByTagName(\"Body\")[0].appendChild(ovr);\n var btn_install = document.getElementById(\"cadesplugin_install\");\n btn_install.addEventListener('click', function(event) {\n opr.addons.installExtension(\"epebfcehmdedogndhlcacafjaacknbcm\",\n function()\n {\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n location.reload();\n },\n function(){})\n });\n document.getElementById(\"cadesplugin_close_install\").addEventListener('click',function()\n {\n plugin_loaded_error(\"Плагин недоступен\");\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n });\n\n ovr.addEventListener('click',function()\n {\n plugin_loaded_error(\"Плагин недоступен\");\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n });\n ovr.style.visibility=\"visible\";\n document.getElementById(\"cadesplugin_ovr_item\").addEventListener('click',function(e){\n e.stopPropagation();\n });\n });\n }else\n {\n plugin_loaded_error(\"Плагин недоступен\");\n }\n }\n\n function firefox_or_edge_nmcades_onload() {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n\n function nmcades_api_onload () {\n window.postMessage(\"cadesplugin_echo_request\", \"*\");\n window.addEventListener(\"message\", function (event){\n if (typeof(event.data) !== \"string\" || !event.data.match(\"cadesplugin_loaded\"))\n return;\n if(isFireFox || isEdge || isSafari)\n {\n // Для Firefox, Сафари, Edge вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js\n var url = event.data.substring(event.data.indexOf(\"url:\") + 4);\n var fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", url);\n fileref.onerror = plugin_loaded_error;\n fileref.onload = firefox_or_edge_nmcades_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n // Для Firefox, Safari и Edge у нас только по одному расширению.\n failed_extensions++;\n }else {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n }, false);\n }\n\n //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari\n function load_extension()\n {\n\n if(isFireFox || isEdge || isSafari){\n // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера.\n nmcades_api_onload();\n } else {\n // в асинхронном варианте для chrome и opera подключаем оба расширения\n var fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", \"chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js\");\n fileref.onerror = plugin_loaded_error;\n fileref.onload = nmcades_api_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", \"chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js\");\n fileref.onerror = plugin_loaded_error;\n fileref.onload = nmcades_api_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n }\n }\n\n //Загружаем плагин для NPAPI\n function load_npapi_plugin()\n {\n var elem = document.createElement('object');\n elem.setAttribute(\"id\", \"cadesplugin_object\");\n elem.setAttribute(\"type\", \"application/x-cades\");\n elem.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem);\n pluginObject = document.getElementById(\"cadesplugin_object\");\n if(isIE())\n {\n var elem1 = document.createElement('object');\n elem1.setAttribute(\"id\", \"certEnrollClassFactory\");\n elem1.setAttribute(\"classid\", \"clsid:884e2049-217d-11da-b2a4-000e7bbb2b09\");\n elem1.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem1);\n var elem2 = document.createElement('object');\n elem2.setAttribute(\"id\", \"webClassFactory\");\n elem2.setAttribute(\"classid\", \"clsid:B04C8637-10BD-484E-B0DA-B8A039F60024\");\n elem2.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem2);\n }\n }\n\n //Отправляем событие что все ок.\n function plugin_loaded()\n {\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_resolve();\n }else {\n window.postMessage(\"cadesplugin_loaded\", \"*\");\n }\n }\n\n //Отправляем событие что сломались.\n function plugin_loaded_error(msg)\n {\n if(isNativeMessageSupported())\n {\n //в асинхронном варианте подключаем оба расширения, если сломались оба пробуем установить для Opera\n failed_extensions++;\n if(failed_extensions<2)\n return;\n if(isOpera && (typeof(msg) === 'undefined'|| typeof(msg) === 'object'))\n {\n install_opera_extension();\n return;\n }\n }\n if(typeof(msg) === 'undefined' || typeof(msg) === 'object')\n msg = \"Плагин недоступен\";\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_reject(msg);\n } else {\n window.postMessage(\"cadesplugin_load_error\", \"*\");\n }\n }\n\n //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку\n function check_load_timeout()\n {\n if(plugin_resolved === 1)\n return;\n if(isFireFox)\n {\n show_firefox_missing_extension_dialog();\n }\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_reject(\"Истекло время ожидания загрузки плагина\");\n } else {\n window.postMessage(\"cadesplugin_load_error\", \"*\");\n }\n\n }\n\n //Вспомогательная функция для NPAPI\n function createPromise(arg)\n {\n return new Promise(arg);\n }\n\n function check_npapi_plugin (){\n try {\n var oAbout = CreateObject(\"CAdESCOM.About\");\n plugin_loaded();\n }\n catch (err) {\n document.getElementById(\"cadesplugin_object\").style.display = 'none';\n // Объект создать не удалось, проверим, установлен ли\n // вообще плагин. Такая возможность есть не во всех браузерах\n var mimetype = navigator.mimeTypes[\"application/x-cades\"];\n if (mimetype) {\n var plugin = mimetype.enabledPlugin;\n if (plugin) {\n plugin_loaded_error(\"Плагин загружен, но не создаются обьекты\");\n }else\n {\n plugin_loaded_error(\"Ошибка при загрузке плагина\");\n }\n }else\n {\n plugin_loaded_error(\"Плагин недоступен\");\n }\n }\n }\n\n //Проверяем работает ли плагин\n function check_plugin_working()\n {\n var div = document.createElement(\"div\");\n div.innerHTML = \"\";\n var isIeLessThan9 = (div.getElementsByTagName(\"i\").length === 1);\n if (isIeLessThan9) {\n plugin_loaded_error(\"Internet Explorer версии 8 и ниже не поддерживается\");\n return;\n }\n\n if(isNativeMessageSupported())\n {\n load_extension();\n }else if(!canPromise) {\n window.addEventListener(\"message\", function (event){\n if (event.data !== \"cadesplugin_echo_request\")\n return;\n load_npapi_plugin();\n check_npapi_plugin();\n },\n false);\n }else\n {\n if(document.readyState === \"complete\"){\n load_npapi_plugin();\n check_npapi_plugin();\n } else {\n window.addEventListener(\"load\", function (event) {\n load_npapi_plugin();\n check_npapi_plugin();\n }, false);\n }\n }\n }\n\n function set_pluginObject(obj)\n {\n pluginObject = obj;\n }\n\n function is_capilite_enabled()\n {\n if ((typeof (cadesplugin.EnableInternalCSP) !== 'undefined') && cadesplugin.EnableInternalCSP)\n return true;\n return false;\n };\n\n //Export\n cadesplugin.JSModuleVersion = \"2.1.2\";\n cadesplugin.async_spawn = async_spawn;\n cadesplugin.set = set_pluginObject;\n cadesplugin.set_log_level = set_log_level;\n cadesplugin.getLastError = getLastError;\n cadesplugin.is_capilite_enabled = is_capilite_enabled;\n\n if(isNativeMessageSupported())\n {\n cadesplugin.CreateObjectAsync = CreateObjectAsync;\n cadesplugin.ReleasePluginObjects = ReleasePluginObjects;\n }\n\n if(!isNativeMessageSupported())\n {\n cadesplugin.CreateObject = CreateObject;\n }\n\n if(window.cadesplugin_load_timeout)\n {\n setTimeout(check_load_timeout, window.cadesplugin_load_timeout);\n }\n else\n {\n setTimeout(check_load_timeout, 20000);\n }\n\n set_constantValues();\n\n cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR;\n window.cadesplugin = cadesplugin;\n check_plugin_working();\n}());\n"],"sourceRoot":""} diff --git a/src/api/createAttachedSignature.ts b/src/api/createAttachedSignature.ts new file mode 100644 index 0000000..2e4bf1d --- /dev/null +++ b/src/api/createAttachedSignature.ts @@ -0,0 +1,86 @@ +import { CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME } from '../constants'; +import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded'; +import { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage'; +import { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn'; +import { _getCadesCert } from '../helpers/_getCadesCert'; +import { _getDateObj } from '../helpers/_getDateObj'; + +/** + * Создает присоединенную подпись сообщения по отпечатку сертификата + * + * @param thumbprint - отпечаток сертификата + * @param message - подписываемое сообщение + * @returns подпись в формате PKCS#7 + */ +export const createAttachedSignature = _afterPluginsLoaded( + async (thumbprint: string, unencryptedMessage: string | ArrayBuffer): Promise => { + const { cadesplugin } = window; + const cadesCertificate = await _getCadesCert(thumbprint); + + return eval( + _generateCadesFn(function createAttachedSignature(): string { + let cadesAttrs; + let cadesSignedData; + let cadesSigner; + + try { + cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute'); + cadesSignedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CadesSignedData'); + cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner'); + } catch (error) { + console.error(error); + + throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); + } + + const currentTime = _getDateObj(new Date()); + + try { + void (__cadesAsyncToken__ + cadesAttrs.propset_Name(CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME)); + void (__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime)); + } catch (error) { + console.error(error); + + throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи'); + } + + let messageBase64; + + try { + messageBase64 = Buffer.from(unencryptedMessage).toString('base64'); + } catch (error) { + console.error(error); + + throw new Error('Ошибка при преобразовании сообщения в Base64'); + } + + let cadesAuthAttrs; + + try { + void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); + cadesAuthAttrs = __cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2; + void (__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs)); + void (__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY)); + void (__cadesAsyncToken__ + cadesSignedData.propset_Content(messageBase64)); + void (__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN)); + } catch (error) { + console.error(error); + + throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи'); + } + + let signature: string; + + try { + signature = __cadesAsyncToken__ + cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_PKCS7_TYPE); + } catch (error) { + console.error(error); + + throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); + } + + return signature; + }), + ); + }, +); diff --git a/src/api/createDetachedSignature.ts b/src/api/createDetachedSignature.ts new file mode 100644 index 0000000..0c3b37b --- /dev/null +++ b/src/api/createDetachedSignature.ts @@ -0,0 +1,71 @@ +import { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded'; +import { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage'; +import { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn'; +import { _getCadesCert } from '../helpers/_getCadesCert'; + +/** + * Создает отсоединенную подпись хеша по отпечатку сертификата + * + * @param thumbprint - отпечаток сертификата + * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11-2012 256 бит + * @returns подпись в формате PKCS#7 + */ +export const createDetachedSignature = _afterPluginsLoaded( + async (thumbprint: string, messageHash: string): Promise => { + const { cadesplugin } = window; + const cadesCertificate = await _getCadesCert(thumbprint); + + return eval( + _generateCadesFn(function createDetachedSignature(): string { + let cadesHashedData; + let cadesSignedData; + let cadesSigner; + + try { + cadesHashedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.HashedData'); + cadesSignedData = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CadesSignedData'); + cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner'); + } catch (error) { + console.error(error); + + throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); + } + + try { + void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); + void (__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN)); + } catch (error) { + console.error(error); + + throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке сертификата'); + } + + try { + void ( + __cadesAsyncToken__ + + cadesHashedData.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256) + ); + void (__cadesAsyncToken__ + cadesHashedData.SetHashValue(messageHash)); + } catch (error) { + console.error(error); + + throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при установке хеша'); + } + + let signature: string; + + try { + signature = + __cadesAsyncToken__ + + cadesSignedData.SignHash(cadesHashedData, cadesSigner, cadesplugin.CADESCOM_PKCS7_TYPE); + } catch (error) { + console.error(error); + + throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); + } + + return signature; + }), + ); + }, +); diff --git a/src/api/createSignature.ts b/src/api/createSignature.ts index 7bf0346..4cea04a 100644 --- a/src/api/createSignature.ts +++ b/src/api/createSignature.ts @@ -15,6 +15,13 @@ import { _getDateObj } from '../helpers/_getDateObj'; */ export const createSignature = _afterPluginsLoaded( async (thumbprint: string, messageHash: string, detachedSignature: boolean = true): Promise => { + console.warn( + [ + 'cryptoPro: Метод "createSignature" является устаревшим и будет убран из будущих версий.', + 'Используйте "createAttachedSignature" и "createDetachedSignature".', + ].join('\n'), + ); + const { cadesplugin } = window; const cadesCertificate = await _getCadesCert(thumbprint); diff --git a/src/api/index.ts b/src/api/index.ts index adc6bcd..9b0a854 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -3,5 +3,7 @@ export * from './getUserCertificates'; export * from './getSystemInfo'; export * from './isValidSystemSetup'; export * from './createSignature'; +export * from './createDetachedSignature'; +export * from './createAttachedSignature'; export * from './createHash'; export * from './certificate';