diff --git a/README.md b/README.md index 55154dc..63a3ae6 100644 --- a/README.md +++ b/README.md @@ -249,6 +249,9 @@ getSystemInfo(); Вам будут полезны [примеры](http://cpdn.cryptopro.ru/?url=/content/cades/plugin-samples-sign.html), предоставляемые Крипто ПРО. +Необходима NodeJS версии, указанной в [.nvmrc](.nvmrc). +На машине должен быть установлен Python 2.7.18. + ## Запуск режима разработки Устанавливаем зависимости: diff --git a/dist/crypto-pro.d.ts b/dist/crypto-pro.d.ts index 47e4335..043eec3 100644 --- a/dist/crypto-pro.d.ts +++ b/dist/crypto-pro.d.ts @@ -1,4 +1,4 @@ -// Type definitions for crypto-pro 2.5.0 +// Type definitions for crypto-pro 2.5.1 // Project: crypto-pro // Definitions by: Vitalii Goma https://github.com/vgoma diff --git a/dist/crypto-pro.js b/dist/crypto-pro.js index 2351083..707fe2e 100644 --- a/dist/crypto-pro.js +++ b/dist/crypto-pro.js @@ -2062,1047 +2062,1128 @@ function isnan (val) { /***/ }), -/***/ "../node_modules/ieee754/index.js": -/*!****************************************!*\ - !*** ../node_modules/ieee754/index.js ***! - \****************************************/ +/***/ "../node_modules/cadesplugin_api.js/dist/cadesplugin_api.js": +/*!******************************************************************!*\ + !*** ../node_modules/cadesplugin_api.js/dist/cadesplugin_api.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) -} +;(function () { + //already loaded + if(window.cadesplugin) + return; -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 + var pluginObject; + var plugin_resolved = 0; + var plugin_reject; + var plugin_resolve; + var isOpera = 0; + var isFireFox = 0; + var isSafari = 0; + var isYandex = 0; + var canPromise = !!window.Promise; + var cadesplugin_loaded_event_recieved = false; + var isFireFoxExtensionLoaded = false; + var cadesplugin; - value = Math.abs(value) + if(canPromise) + { + cadesplugin = new Promise(function(resolve, reject) + { + plugin_resolve = resolve; + plugin_reject = reject; + }); + } else + { + cadesplugin = {}; + } - 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 + function check_browser() { + var ua= navigator.userAgent, tem, M= ua.match(/(opera|yabrowser|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; + if(/trident/i.test(M[1])){ + tem = /\brv[ :]+(\d+)/g.exec(ua) || []; + return { name:'IE', version:(tem[1] || '')}; + } + if(M[1] === 'Chrome'){ + tem = ua.match(/\b(OPR|Edg|YaBrowser)\/(\d+)/); + if (tem != null) + return { name: tem[1].replace('OPR', 'Opera'), version: tem[2] }; + } + M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?']; + if ((tem = ua.match(/version\/(\d+)/i)) != null) + M.splice(1, 1, tem[1]); + return {name:M[0],version:M[1]}; } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) + var browserSpecs = check_browser(); + + function cpcsp_console_log(level, msg){ + //IE9 не может писать в консоль если не открыта вкладка developer tools + if(typeof(console) === 'undefined') + return; + if (level <= cadesplugin.current_log_level ){ + if (level === cadesplugin.LOG_LEVEL_DEBUG) + console.log("DEBUG: %s", msg); + if (level === cadesplugin.LOG_LEVEL_INFO) + console.info("INFO: %s", msg); + if (level === cadesplugin.LOG_LEVEL_ERROR) + console.error("ERROR: %s", msg); + return; + } } - if (value * c >= 2) { - e++ - c /= 2 + + function get_extension_version(callback) { + window.postMessage("cadesplugin_extension_version_request", "*"); + window.addEventListener("message", function (event) { + var resp_prefix = "cadesplugin_extension_version_response:"; + if (typeof (event.data) !== "string" || event.data.indexOf(resp_prefix) !== 0) + return; + ext_version = event.data.substring(resp_prefix.length); + callback(ext_version); + }, false); } - 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 + function set_log_level(level){ + if (!((level === cadesplugin.LOG_LEVEL_DEBUG) || + (level === cadesplugin.LOG_LEVEL_INFO) || + (level === cadesplugin.LOG_LEVEL_ERROR))){ + cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, "cadesplugin_api.js: Incorrect log_level: " + level); + return; + } + cadesplugin.current_log_level = level; + if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG) + cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = DEBUG"); + if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO) + cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = INFO"); + if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR) + cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = ERROR"); + if(isNativeMessageSupported()) + { + if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG) + window.postMessage("set_log_level=debug", "*"); + if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO) + window.postMessage("set_log_level=info", "*"); + if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR) + window.postMessage("set_log_level=error", "*"); + } } - } - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} + function set_constantValues() + { + cadesplugin.CAPICOM_MEMORY_STORE = 0; + cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1; + cadesplugin.CAPICOM_CURRENT_USER_STORE = 2; + cadesplugin.CAPICOM_SMART_CARD_USER_STORE = 4; + cadesplugin.CADESCOM_MEMORY_STORE = 0; + cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1; + cadesplugin.CADESCOM_CURRENT_USER_STORE = 2; + cadesplugin.CADESCOM_SMART_CARD_USER_STORE = 4; + cadesplugin.CADESCOM_CONTAINER_STORE = 100; - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + cadesplugin.CAPICOM_MY_STORE = "My"; - buffer[offset + i - d] |= s * 128 -} + cadesplugin.CAPICOM_STORE_OPEN_READ_WRITE = 1; + 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; -/***/ "../node_modules/isarray/index.js": -/*!****************************************!*\ - !*** ../node_modules/isarray/index.js ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { + cadesplugin.CADESCOM_XADES_DEFAULT = 0x00000010; + cadesplugin.CADESCOM_XADES_BES = 0x00000020; + cadesplugin.CADESCOM_XADES_T = 0x00000050; + cadesplugin.CADESCOM_XADES_X_LONG_TYPE_1 = 0x000005d0; + cadesplugin.CADESCOM_XMLDSIG_TYPE = 0x00000000; -var toString = {}.toString; + 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.XmlDsigGost3411Url2012256 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256"; + cadesplugin.XmlDsigGost3410Url2012256 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256"; + cadesplugin.XmlDsigGost3411Url2012512 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-512"; + cadesplugin.XmlDsigGost3410Url2012512 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-512"; -module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; -}; + cadesplugin.CADESCOM_CADES_DEFAULT = 0; + cadesplugin.CADESCOM_CADES_BES = 1; + cadesplugin.CADESCOM_CADES_T = 0x5; + cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d; + cadesplugin.CADESCOM_PKCS7_TYPE = 0xffff; + cadesplugin.CADESCOM_ENCODE_BASE64 = 0; + cadesplugin.CADESCOM_ENCODE_BINARY = 1; + cadesplugin.CADESCOM_ENCODE_ANY = -1; -/***/ }), + cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0; + cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1; + cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2; -/***/ "../node_modules/webpack/buildin/global.js": -/*!*************************************************!*\ - !*** ../node_modules/webpack/buildin/global.js ***! - \*************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { + cadesplugin.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0; + cadesplugin.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1; -var g; + 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; -// This works in non-strict mode -g = (function() { - return this; -})(); + cadesplugin.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128; -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) { ...} + cadesplugin.CAPICOM_PROPID_ENHKEY_USAGE = 9; -module.exports = g; + 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_AUTHENTICATED_ATTRIBUTE_MACHINE_INFO = 0x100; + cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1; -/***/ "./api/certificate/certificate.ts": -/*!****************************************!*\ - !*** ./api/certificate/certificate.ts ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { + cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0; + cadesplugin.CADESCOM_BASE64_TO_BINARY = 1; -"use strict"; + cadesplugin.CADESCOM_DISPLAY_DATA_NONE = 0; + cadesplugin.CADESCOM_DISPLAY_DATA_CONTENT = 1; + cadesplugin.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2; -Object.defineProperty(exports, "__esModule", { value: true }); -var constants_1 = __webpack_require__(/*! ../../constants */ "./constants/index.ts"); -var exportBase64_1 = __webpack_require__(/*! ./exportBase64 */ "./api/certificate/exportBase64.ts"); -var getAlgorithm_1 = __webpack_require__(/*! ./getAlgorithm */ "./api/certificate/getAlgorithm.ts"); -var getCadesProp_1 = __webpack_require__(/*! ./getCadesProp */ "./api/certificate/getCadesProp.ts"); -var getDecodedExtendedKeyUsage_1 = __webpack_require__(/*! ./getDecodedExtendedKeyUsage */ "./api/certificate/getDecodedExtendedKeyUsage.ts"); -var getExtendedKeyUsage_1 = __webpack_require__(/*! ./getExtendedKeyUsage */ "./api/certificate/getExtendedKeyUsage.ts"); -var getInfo_1 = __webpack_require__(/*! ./getInfo */ "./api/certificate/getInfo.ts"); -var hasExtendedKeyUsage_1 = __webpack_require__(/*! ./hasExtendedKeyUsage */ "./api/certificate/hasExtendedKeyUsage.ts"); -var isValid_1 = __webpack_require__(/*! ./isValid */ "./api/certificate/isValid.ts"); -var Certificate = /** @class */ (function () { - function Certificate(_cadesCertificate, name, issuerName, subjectName, thumbprint, validFrom, validTo) { - this._cadesCertificate = _cadesCertificate; - this.name = name; - this.issuerName = issuerName; - this.subjectName = subjectName; - this.thumbprint = thumbprint; - this.validFrom = validFrom; - this.validTo = validTo; - } - Certificate.prototype.getOwnerInfo = function () { - return getInfo_1.getInfo.call(this, constants_1.SUBJECT_TAGS_TRANSLATIONS, 'SubjectName'); - }; - Certificate.prototype.getIssuerInfo = function () { - return getInfo_1.getInfo.call(this, constants_1.ISSUER_TAGS_TRANSLATIONS, 'IssuerName'); - }; - Certificate.prototype.getExtendedKeyUsage = function () { - return getExtendedKeyUsage_1.getExtendedKeyUsage.call(this); - }; - Certificate.prototype.getDecodedExtendedKeyUsage = function () { - return getDecodedExtendedKeyUsage_1.getDecodedExtendedKeyUsage.call(this); - }; - Certificate.prototype.getAlgorithm = function () { - return getAlgorithm_1.getAlgorithm.call(this); - }; - Certificate.prototype.getCadesProp = function (propName) { - return getCadesProp_1.getCadesProp.call(this, propName); - }; - Certificate.prototype.isValid = function () { - return isValid_1.isValid.call(this); - }; - Certificate.prototype.exportBase64 = function () { - return exportBase64_1.exportBase64.call(this); - }; - Certificate.prototype.hasExtendedKeyUsage = function (oids) { - return hasExtendedKeyUsage_1.hasExtendedKeyUsage.call(this, oids); - }; - return Certificate; -}()); -exports.Certificate = Certificate; + 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; -/***/ "./api/certificate/exportBase64.ts": -/*!*****************************************!*\ - !*** ./api/certificate/exportBase64.ts ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { + cadesplugin.CADESCOM_AllowNone = 0; + cadesplugin.CADESCOM_AllowNoOutstandingRequest = 0x1; + cadesplugin.CADESCOM_AllowUntrustedCertificate = 0x2; + cadesplugin.CADESCOM_AllowUntrustedRoot = 0x4; + cadesplugin.CADESCOM_SkipInstallToStore = 0x10000000; + cadesplugin.CADESCOM_InstallCertChainToContainer = 0x20000000; + cadesplugin.CADESCOM_UseContainerStore = 0x40000000; -"use strict"; + cadesplugin.ENABLE_CARRIER_TYPE_CSP = 0x01; + cadesplugin.ENABLE_CARRIER_TYPE_FKC_NO_SM = 0x02; + cadesplugin.ENABLE_CARRIER_TYPE_FKC_SM = 0x04; + cadesplugin.ENABLE_ANY_CARRIER_TYPE = 0x07; -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Экспортирует сертификат в формате base64 - * - * @returns сертификат в формате base64 - */ -exports.exportBase64 = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - var cadesCertificate = this._cadesCertificate; - return eval(_generateCadesFn_1._generateCadesFn(function exportBase64() { - var base64; - try { - base64 = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.Export(0); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при экспорте сертификата'); - } - return base64; - })); -}); + cadesplugin.DISABLE_EVERY_CARRIER_OPERATION = 0x00; + cadesplugin.ENABLE_CARRIER_OPEN_ENUM = 0x01; + cadesplugin.ENABLE_CARRIER_CREATE = 0x02; + cadesplugin.ENABLE_ANY_OPERATION = 0x03; + cadesplugin.CADESCOM_PRODUCT_CSP = 0; + cadesplugin.CADESCOM_PRODUCT_OCSP = 1; + cadesplugin.CADESCOM_PRODUCT_TSP = 2; -/***/ }), + cadesplugin.MEDIA_TYPE_REGISTRY = 0x00000001; + cadesplugin.MEDIA_TYPE_HDIMAGE = 0x00000002; + cadesplugin.MEDIA_TYPE_CLOUD = 0x00000004; + cadesplugin.MEDIA_TYPE_SCARD = 0x00000008; -/***/ "./api/certificate/getAlgorithm.ts": -/*!*****************************************!*\ - !*** ./api/certificate/getAlgorithm.ts ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { + cadesplugin.XCN_CRYPT_STRING_BASE64HEADER = 0; + cadesplugin.AT_KEYEXCHANGE = 1; + cadesplugin.AT_SIGNATURE = 2; -"use strict"; + cadesplugin.CARRIER_FLAG_REMOVABLE = 1; + cadesplugin.CARRIER_FLAG_UNIQUE = 2; + cadesplugin.CARRIER_FLAG_PROTECTED = 4; + cadesplugin.CARRIER_FLAG_FUNCTIONAL_CARRIER = 8; + cadesplugin.CARRIER_FLAG_SECURE_MESSAGING = 16; + cadesplugin.CARRIER_FLAG_ABLE_VISUALISE_SIGNATURE = 64; + cadesplugin.CARRIER_FLAG_VIRTUAL = 128; + } -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Возвращает информацию об алгоритме сертификата - * - * @returns информацию об алгоритме и его OID'е - */ -exports.getAlgorithm = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - var cadesCertificate = this._cadesCertificate; - return eval(_generateCadesFn_1._generateCadesFn(function getAlgorithm() { - var algorithmInfo = { - algorithm: null, - oid: null, - }; - var cadesPublicKey; - try { - cadesPublicKey = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.PublicKey(); - cadesPublicKey = _generateCadesFn_1.__cadesAsyncToken__ + cadesPublicKey.Algorithm; - algorithmInfo.algorithm = _generateCadesFn_1.__cadesAsyncToken__ + cadesPublicKey.FriendlyName; - algorithmInfo.oid = _generateCadesFn_1.__cadesAsyncToken__ + cadesPublicKey.Value; - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при получении алгоритма'); + function async_spawn(generatorFunc) { + function continuer(verb, arg) { + var result; + try { + result = generator[verb](arg); + } catch (err) { + return Promise.reject(err); + } + if (result.done) { + return result.value; + } else { + return Promise.resolve(result.value).then(onFulfilled, onRejected); + } } - return algorithmInfo; - })); -}); - - -/***/ }), + var generator = generatorFunc(Array.prototype.slice.call(arguments, 1)); + var onFulfilled = continuer.bind(continuer, "next"); + var onRejected = continuer.bind(continuer, "throw"); + return onFulfilled(); + } -/***/ "./api/certificate/getCadesProp.ts": -/*!*****************************************!*\ - !*** ./api/certificate/getCadesProp.ts ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { + function isIE() { + // var retVal = (("Microsoft Internet Explorer" == navigator.appName) || // IE < 11 + // navigator.userAgent.match(/Trident\/./i)); // IE 11 + return (browserSpecs.name === 'IE' || browserSpecs.name === 'MSIE'); + } -"use strict"; + function isIOS() { + return (navigator.userAgent.match(/ipod/i) || + navigator.userAgent.match(/ipad/i) || + navigator.userAgent.match(/iphone/i)); + } -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Возвращает указанное внутренее свойство у сертификата в формате Cades - * - * @param propName = наименование свойства - * @returns значение запрошенного свойства - */ -exports.getCadesProp = _afterPluginsLoaded_1._afterPluginsLoaded(function (propName) { - var cadesCertificate = this._cadesCertificate; - return eval(_generateCadesFn_1._generateCadesFn(function getCadesProp() { - var propertyValue; - try { - propertyValue = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate[propName]; + function isNativeMessageSupported() + { + // В IE работаем через NPAPI + if(isIE()) + return false; + // В Edge работаем через NativeMessage + if (browserSpecs.name === 'Edg') { + return true; } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при обращении к свойству сертификата'); + if (browserSpecs.name === 'YaBrowser') { + isYandex = true; + return true; } - return propertyValue; - })); -}); - - -/***/ }), - -/***/ "./api/certificate/getDecodedExtendedKeyUsage.ts": -/*!*******************************************************!*\ - !*** ./api/certificate/getDecodedExtendedKeyUsage.ts ***! - \*******************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; + // В Chrome, Firefox, Safari и Opera работаем через асинхронную версию в зависимости от версии + if(browserSpecs.name === 'Opera') { + isOpera = true; + if(browserSpecs.version >= 33){ + return true; + } + else{ + return false; + } } - return t; - }; - return __assign.apply(this, arguments); -}; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; + if(browserSpecs.name === 'Firefox') { + isFireFox = true; + if(browserSpecs.version >= 52){ + return true; } - 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 }; + else{ + return false; + } + } + if(browserSpecs.name === 'Chrome') { + if(browserSpecs.version >= 42){ + return true; + } + else{ + return false; + } + } + //В Сафари начиная с 12 версии нет NPAPI + if(browserSpecs.name === 'Safari') { + isSafari = true; + if(browserSpecs.version >= 12) { + return true; + } else { + return false; + } + } } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var constants_1 = __webpack_require__(/*! ../../constants */ "./constants/index.ts"); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -/** - * Возвращает расшифрованные ОИД'ы сертификата - * - * @returns словарь расшифрованных ОИД'ов - */ -exports.getDecodedExtendedKeyUsage = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - return __awaiter(this, void 0, void 0, function () { - var certificateOids; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.getExtendedKeyUsage()]; - case 1: - certificateOids = _a.sent(); - return [2 /*return*/, certificateOids.reduce(function (decodedOids, oidCode) { - var _a; - return (__assign(__assign({}, decodedOids), (_a = {}, _a[oidCode] = constants_1.OIDS_DICTIONARY[oidCode] || null, _a))); - }, {})]; + + // Функция активации объектов КриптоПро ЭЦП Browser plug-in + function CreateObject(name) { + if (isIOS()) { + // На iOS для создания объектов используется функция + // call_ru_cryptopro_npcades_10_native_bridge, определенная в IOS_npcades_supp.js + return call_ru_cryptopro_npcades_10_native_bridge("CreateObject", [name]); + } + if (isIE()) { + // В Internet Explorer создаются COM-объекты + if (name.match(/X509Enrollment/i)) { + try { + // Объекты CertEnroll пробуем создавать через нашу фабрику, + // если не получилось то через CX509EnrollmentWebClassFactory + var objCertEnrollClassFactory = document.getElementById("webClassFactory"); + return objCertEnrollClassFactory.CreateObject(name); + } + catch (e) { + try { + var objWebClassFactory = document.getElementById("certEnrollClassFactory"); + return objWebClassFactory.CreateObject(name); + } + catch (err) { + throw ("Для создания обьектов X509Enrollment следует настроить веб-узел на использование проверки подлинности по протоколу HTTPS"); + } + } } - }); - }); -}); + // Объекты CAPICOM и CAdESCOM создаются через CAdESCOM.WebClassFactory + try { + var objWebClassFactory = document.getElementById("webClassFactory"); + return objWebClassFactory.CreateObject(name); + } + catch (e) { + // Для версий плагина ниже 2.0.12538 + return new ActiveXObject(name); + } + } + // создаются объекты NPAPI + return pluginObject.CreateObject(name); + } + function decimalToHexString(number) { + if (number < 0) { + number = 0xFFFFFFFF + number + 1; + } -/***/ }), + return number.toString(16).toUpperCase(); + } -/***/ "./api/certificate/getExtendedKeyUsage.ts": -/*!************************************************!*\ - !*** ./api/certificate/getExtendedKeyUsage.ts ***! - \************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { + function GetMessageFromException(e) { + var err = e.message; + if (!err) { + err = e; + } else if (e.number) { + err += " (0x" + decimalToHexString(e.number) + ")"; + } + return err; + } -"use strict"; + function getLastError(exception) { + if(isNativeMessageSupported() || isIE() || isIOS() ) { + return GetMessageFromException(exception); + } -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Возвращает ОИД'ы сертификата - * - * @returns список ОИД'ов - */ -exports.getExtendedKeyUsage = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - var cadesCertificate = this._cadesCertificate; - return eval(_generateCadesFn_1._generateCadesFn(function getExtendedKeyUsage() { - var OIDS = []; - var count; try { - count = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage(); - count = _generateCadesFn_1.__cadesAsyncToken__ + count.EKUs; - count = _generateCadesFn_1.__cadesAsyncToken__ + count.Count; - if (count > 0) { - while (count > 0) { - var cadesExtendedKeyUsage = void 0; - cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage(); - cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesExtendedKeyUsage.EKUs; - cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesExtendedKeyUsage.Item(count); - cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesExtendedKeyUsage.OID; - OIDS.push(cadesExtendedKeyUsage); - count--; - } - } - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || "Ошибка при получении ОИД'ов"); + return pluginObject.getLastError(); + } catch(e) { + return GetMessageFromException(exception); } - return OIDS; - })); -}); - + } -/***/ }), + // Функция для удаления созданных объектов + function ReleasePluginObjects() { + return cpcsp_chrome_nmcades.ReleasePluginObjects(); + } -/***/ "./api/certificate/getInfo.ts": -/*!************************************!*\ - !*** ./api/certificate/getInfo.ts ***! - \************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { + // Функция активации асинхронных объектов КриптоПро ЭЦП Browser plug-in + function CreateObjectAsync(name) { + return pluginObject.CreateObjectAsync(name); + } -"use strict"; + //Функции для IOS + var ru_cryptopro_npcades_10_native_bridge = { + callbacksCount : 1, + callbacks : {}, -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; + // Automatically called by native layer when a result is available + resultForCallback : function resultForCallback(callbackId, resultArray) { + var callback = ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId]; + if (!callback) return; + callback.apply(null,resultArray); + }, + + // Use this in javascript to request native objective-c code + // functionName : string (I think the name is explicit :p) + // args : array of arguments + // callback : function with n-arguments that is going to be called when the native code returned + call : function call(functionName, args, callback) { + var hasCallback = callback && typeof callback === "function"; + var callbackId = hasCallback ? ru_cryptopro_npcades_10_native_bridge.callbacksCount++ : 0; + + if (hasCallback) + ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId] = callback; + + var iframe = document.createElement("IFRAME"); + var arrObjs = new Array("_CPNP_handle"); + try{ + iframe.setAttribute("src", "cpnp-js-call:" + functionName + ":" + callbackId+ ":" + encodeURIComponent(JSON.stringify(args, arrObjs))); + } catch(e){ + alert(e); } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _parseCertInfo_1 = __webpack_require__(/*! ../../helpers/_parseCertInfo */ "./helpers/_parseCertInfo.ts"); -var getCadesProp_1 = __webpack_require__(/*! ./getCadesProp */ "./api/certificate/getCadesProp.ts"); -/** - * Возвращает расшифрованную информацию о сертификате из указанного свойства по тэгам - * - * @param tags = словарь - * @param entitiesPath = путь к разбираемой сущности - * @returns расшифрованная информация по отдельным тэгам - */ -exports.getInfo = _afterPluginsLoaded_1._afterPluginsLoaded(function (tags, entitiesPath) { - return __awaiter(this, void 0, void 0, function () { - var entities, error_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, getCadesProp_1.getCadesProp.call(this, entitiesPath)]; - case 1: - entities = _a.sent(); - return [3 /*break*/, 3]; - case 2: - error_1 = _a.sent(); - console.error(error_1); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error_1) || 'Ошибка при извлечении информации из сертификата'); - case 3: return [2 /*return*/, _parseCertInfo_1._parseCertInfo(tags, entities)]; + document.documentElement.appendChild(iframe); + iframe.parentNode.removeChild(iframe); + iframe = null; + } + }; + + function call_ru_cryptopro_npcades_10_native_bridge(functionName, array){ + var tmpobj; + var ex; + ru_cryptopro_npcades_10_native_bridge.call(functionName, array, function(e, response){ + ex = e; + var str='tmpobj='+response; + eval(str); + if (typeof (tmpobj) === "string"){ + tmpobj = tmpobj.replace(/\\\n/gm, "\n"); + tmpobj = tmpobj.replace(/\\\r/gm, "\r"); } }); - }); -}); + if(ex) + throw ex; + return tmpobj; + } + function show_firefox_missing_extension_dialog() + { + if (!window.cadesplugin_skip_extension_install) + { + var ovr = document.createElement('div'); + ovr.id = "cadesplugin_ovr"; + ovr.style = "visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)"; + ovr.innerHTML = "
" + + "" + + "

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

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

" + + "
"; + document.getElementsByTagName("Body")[0].appendChild(ovr); + document.getElementById("cadesplugin_close_install").addEventListener('click',function() + { + plugin_loaded_error("Плагин недоступен"); + document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; + }); -/***/ }), + ovr.addEventListener('click',function() + { + plugin_loaded_error("Плагин недоступен"); + document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; + }); + ovr.style.visibility="visible"; + } + } + function firefox_or_safari_nmcades_onload() { + if (window.cadesplugin_extension_loaded_callback) + window.cadesplugin_extension_loaded_callback(); + isFireFoxExtensionLoaded = true; + cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error); + } -/***/ "./api/certificate/hasExtendedKeyUsage.ts": -/*!************************************************!*\ - !*** ./api/certificate/hasExtendedKeyUsage.ts ***! - \************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { + function nmcades_api_onload() { + if (!isIE() && !isFireFox && !isSafari) { + if (window.cadesplugin_extension_loaded_callback) + window.cadesplugin_extension_loaded_callback(); + } + window.postMessage("cadesplugin_echo_request", "*"); + window.addEventListener("message", function (event){ + if (typeof(event.data) !== "string" || !event.data.match("cadesplugin_loaded")) + return; + if (cadesplugin_loaded_event_recieved) + return; + if(isFireFox || isSafari) + { + // Для Firefox, Сафари вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js + var url = event.data.substring(event.data.indexOf("url:") + 4); + if (!url.match("^(moz|safari)-extension://[a-zA-Z0-9/_-]+/nmcades_plugin_api.js$")) + { + cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, "Bad url \"" + url + "\" for load CryptoPro Extension for CAdES Browser plug-in"); + plugin_loaded_error(); + return; + } + var fileref = document.createElement('script'); + fileref.setAttribute("type", "text/javascript"); + fileref.setAttribute("src", url); + fileref.onerror = plugin_loaded_error; + fileref.onload = firefox_or_safari_nmcades_onload; + document.getElementsByTagName("head")[0].appendChild(fileref); + }else { + cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error); + } + cadesplugin_loaded_event_recieved = true; + }, false); + } -"use strict"; + //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari + function load_extension() + { + if(isFireFox || isSafari){ + // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера. + nmcades_api_onload(); + } else { + // в асинхронном варианте для Yandex и Opera подключаем расширение из Opera store. + if (isOpera || isYandex) { + var fileref = document.createElement('script'); + fileref.setAttribute("type", "text/javascript"); + fileref.setAttribute("src", "chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js"); + fileref.onerror = plugin_loaded_error; + fileref.onload = nmcades_api_onload; + document.getElementsByTagName("head")[0].appendChild(fileref); + } else { + // для Chrome, Chromium, Chromium Edge расширение из Chrome store + var fileref = document.createElement('script'); + fileref.setAttribute("type", "text/javascript"); + fileref.setAttribute("src", "chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js"); + fileref.onerror = plugin_loaded_error; + fileref.onload = nmcades_api_onload; + document.getElementsByTagName("head")[0].appendChild(fileref); + } + } + } -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; + //Загружаем плагин для NPAPI + function load_npapi_plugin() + { + var elem = document.createElement('object'); + elem.setAttribute("id", "cadesplugin_object"); + elem.setAttribute("type", "application/x-cades"); + elem.setAttribute("style", "visibility: hidden"); + document.getElementsByTagName("body")[0].appendChild(elem); + pluginObject = document.getElementById("cadesplugin_object"); + if(isIE()) + { + var elem1 = document.createElement('object'); + elem1.setAttribute("id", "certEnrollClassFactory"); + elem1.setAttribute("classid", "clsid:884e2049-217d-11da-b2a4-000e7bbb2b09"); + elem1.setAttribute("style", "visibility: hidden"); + document.getElementsByTagName("body")[0].appendChild(elem1); + var elem2 = document.createElement('object'); + elem2.setAttribute("id", "webClassFactory"); + elem2.setAttribute("classid", "clsid:B04C8637-10BD-484E-B0DA-B8A039F60024"); + elem2.setAttribute("style", "visibility: hidden"); + document.getElementsByTagName("body")[0].appendChild(elem2); + } + } + + //Отправляем событие что все ок. + function plugin_loaded() + { + plugin_resolved = 1; + if(canPromise) + { + plugin_resolve(); + }else { + window.postMessage("cadesplugin_loaded", "*"); + } + } + + //Отправляем событие что сломались. + function plugin_loaded_error(msg) + { + if(typeof(msg) === 'undefined' || typeof(msg) === 'object') + msg = "Плагин недоступен"; + plugin_resolved = 1; + if(canPromise) + { + plugin_reject(msg); + } else { + window.postMessage("cadesplugin_load_error", "*"); + } + } + + //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку + function check_load_timeout() + { + if(plugin_resolved === 1) + return; + if(isFireFox) + { + if (!isFireFoxExtensionLoaded) + show_firefox_missing_extension_dialog(); + } + plugin_resolved = 1; + if(canPromise) + { + plugin_reject("Истекло время ожидания загрузки плагина"); + } else { + window.postMessage("cadesplugin_load_error", "*"); + } + + } + + //Вспомогательная функция для NPAPI + function createPromise(arg) + { + return new Promise(arg); + } + + function check_npapi_plugin (){ + try { + var oAbout = CreateObject("CAdESCOM.About"); + plugin_loaded(); + } + catch (err) { + document.getElementById("cadesplugin_object").style.display = 'none'; + // Объект создать не удалось, проверим, установлен ли + // вообще плагин. Такая возможность есть не во всех браузерах + var mimetype = navigator.mimeTypes["application/x-cades"]; + if (mimetype) { + var plugin = mimetype.enabledPlugin; + if (plugin) { + plugin_loaded_error("Плагин загружен, но не создаются обьекты"); + }else + { + plugin_loaded_error("Ошибка при загрузке плагина"); + } + }else + { + plugin_loaded_error("Плагин недоступен"); } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -/** - * Проверяет наличие ОИД'а (ОИД'ов) у сертификата - * - * @param oids - ОИД'ы для проверки - * @returns флаг наличия ОИД'ов у сертификата - */ -exports.hasExtendedKeyUsage = _afterPluginsLoaded_1._afterPluginsLoaded(function (oids) { - return __awaiter(this, void 0, void 0, function () { - var certOids, result; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, this.getExtendedKeyUsage()]; - case 1: - certOids = _a.sent(); - if (Array.isArray(oids)) { - result = oids.every(function (oidToCheck) { return certOids.some(function (certOid) { return certOid === oidToCheck; }); }); - } - else { - result = certOids.some(function (certOid) { return certOid === oids; }); - } - return [2 /*return*/, result]; + + //Проверяем работает ли плагин + function check_plugin_working() + { + var div = document.createElement("div"); + div.innerHTML = ""; + var isIeLessThan9 = (div.getElementsByTagName("i").length === 1); + if (isIeLessThan9) { + plugin_loaded_error("Internet Explorer версии 8 и ниже не поддерживается"); + return; + } + + if(isNativeMessageSupported()) + { + load_extension(); + }else if(!canPromise) { + window.addEventListener("message", function (event){ + if (event.data !== "cadesplugin_echo_request") + return; + load_npapi_plugin(); + check_npapi_plugin(); + }, + false); + }else + { + if(document.readyState === "complete"){ + load_npapi_plugin(); + check_npapi_plugin(); + } else { + window.addEventListener("load", function (event) { + load_npapi_plugin(); + check_npapi_plugin(); + }, false); } - }); - }); -}); + } + } + function set_pluginObject(obj) + { + pluginObject = obj; + } -/***/ }), + function is_capilite_enabled() + { + if ((typeof (cadesplugin.EnableInternalCSP) !== 'undefined') && cadesplugin.EnableInternalCSP) + return true; + return false; + }; + + function set_load_timeout() + { + if (window.cadesplugin_load_timeout) { + setTimeout(check_load_timeout, window.cadesplugin_load_timeout); + } + else { + setTimeout(check_load_timeout, 20000); + } + } + + var onVisibilityChange = function (event) { + if (document.hidden === false) { + document.removeEventListener("visibilitychange", onVisibilityChange); + set_load_timeout(); + check_plugin_working(); + } + }; + + //Export + cadesplugin.JSModuleVersion = "2.3.5"; + cadesplugin.async_spawn = async_spawn; + cadesplugin.set = set_pluginObject; + cadesplugin.set_log_level = set_log_level; + cadesplugin.get_extension_version = get_extension_version; + cadesplugin.getLastError = getLastError; + cadesplugin.is_capilite_enabled = is_capilite_enabled; + + if(isNativeMessageSupported()) + { + cadesplugin.CreateObjectAsync = CreateObjectAsync; + cadesplugin.ReleasePluginObjects = ReleasePluginObjects; + } -/***/ "./api/certificate/index.ts": -/*!**********************************!*\ - !*** ./api/certificate/index.ts ***! - \**********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { + if(!isNativeMessageSupported()) + { + cadesplugin.CreateObject = CreateObject; + } -"use strict"; + set_constantValues(); -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(/*! ./certificate */ "./api/certificate/certificate.ts")); + cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR; + window.cadesplugin = cadesplugin; + if (isSafari && document.hidden) { + document.addEventListener("visibilitychange", onVisibilityChange); + return; + } + set_load_timeout(); + check_plugin_working(); +}()); /***/ }), -/***/ "./api/certificate/isValid.ts": -/*!************************************!*\ - !*** ./api/certificate/isValid.ts ***! - \************************************/ +/***/ "../node_modules/ieee754/index.js": +/*!****************************************!*\ + !*** ../node_modules/ieee754/index.js ***! + \****************************************/ /*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { +/***/ (function(module, exports) { -"use strict"; +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] -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Проверяет действительность сертификата - * - * @returns флаг валидности - */ -exports.isValid = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - var cadesCertificate = this._cadesCertificate; - return eval(_generateCadesFn_1._generateCadesFn(function isValid() { - var isValid; - try { - isValid = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.IsValid(); - isValid = _generateCadesFn_1.__cadesAsyncToken__ + isValid.Result; - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при проверке сертификата'); - } - return Boolean(isValid); - })); -}); + 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) {} -/***/ "./api/createAttachedSignature.ts": -/*!****************************************!*\ - !*** ./api/createAttachedSignature.ts ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { + 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) +} -"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 }; +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 } -}; -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; - }))]; - } - }); -}); }); + 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 +} -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/buffer/index.js */ "../node_modules/buffer/index.js").Buffer)) /***/ }), -/***/ "./api/createDetachedSignature.ts": +/***/ "../node_modules/isarray/index.js": /*!****************************************!*\ - !*** ./api/createDetachedSignature.ts ***! + !*** ../node_modules/isarray/index.js ***! + \****************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; + + +/***/ }), + +/***/ "../node_modules/webpack/buildin/global.js": +/*!*************************************************!*\ + !*** ../node_modules/webpack/buildin/global.js ***! + \*************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || new Function("return this")(); +} catch (e) { + // This works if the window reference is available + if (typeof window === "object") g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; + + +/***/ }), + +/***/ "./api/certificate/certificate.ts": +/*!****************************************!*\ + !*** ./api/certificate/certificate.ts ***! \****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -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 exportBase64_1 = __webpack_require__(/*! ./exportBase64 */ "./api/certificate/exportBase64.ts"); +var getAlgorithm_1 = __webpack_require__(/*! ./getAlgorithm */ "./api/certificate/getAlgorithm.ts"); +var getCadesProp_1 = __webpack_require__(/*! ./getCadesProp */ "./api/certificate/getCadesProp.ts"); +var getDecodedExtendedKeyUsage_1 = __webpack_require__(/*! ./getDecodedExtendedKeyUsage */ "./api/certificate/getDecodedExtendedKeyUsage.ts"); +var getExtendedKeyUsage_1 = __webpack_require__(/*! ./getExtendedKeyUsage */ "./api/certificate/getExtendedKeyUsage.ts"); +var getInfo_1 = __webpack_require__(/*! ./getInfo */ "./api/certificate/getInfo.ts"); +var hasExtendedKeyUsage_1 = __webpack_require__(/*! ./hasExtendedKeyUsage */ "./api/certificate/hasExtendedKeyUsage.ts"); +var isValid_1 = __webpack_require__(/*! ./isValid */ "./api/certificate/isValid.ts"); +var Certificate = /** @class */ (function () { + function Certificate(_cadesCertificate, name, issuerName, subjectName, thumbprint, validFrom, validTo) { + this._cadesCertificate = _cadesCertificate; + this.name = name; + this.issuerName = issuerName; + this.subjectName = subjectName; + this.thumbprint = thumbprint; + this.validFrom = validFrom; + this.validTo = validTo; } -}; + Certificate.prototype.getOwnerInfo = function () { + return getInfo_1.getInfo.call(this, constants_1.SUBJECT_TAGS_TRANSLATIONS, 'SubjectName'); + }; + Certificate.prototype.getIssuerInfo = function () { + return getInfo_1.getInfo.call(this, constants_1.ISSUER_TAGS_TRANSLATIONS, 'IssuerName'); + }; + Certificate.prototype.getExtendedKeyUsage = function () { + return getExtendedKeyUsage_1.getExtendedKeyUsage.call(this); + }; + Certificate.prototype.getDecodedExtendedKeyUsage = function () { + return getDecodedExtendedKeyUsage_1.getDecodedExtendedKeyUsage.call(this); + }; + Certificate.prototype.getAlgorithm = function () { + return getAlgorithm_1.getAlgorithm.call(this); + }; + Certificate.prototype.getCadesProp = function (propName) { + return getCadesProp_1.getCadesProp.call(this, propName); + }; + Certificate.prototype.isValid = function () { + return isValid_1.isValid.call(this); + }; + Certificate.prototype.exportBase64 = function () { + return exportBase64_1.exportBase64.call(this); + }; + Certificate.prototype.hasExtendedKeyUsage = function (oids) { + return hasExtendedKeyUsage_1.hasExtendedKeyUsage.call(this, oids); + }; + return Certificate; +}()); +exports.Certificate = Certificate; + + +/***/ }), + +/***/ "./api/certificate/exportBase64.ts": +/*!*****************************************!*\ + !*** ./api/certificate/exportBase64.ts ***! + \*****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); -var 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"); +var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +var _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); /** - * Создает отсоединенную подпись хеша по отпечатку сертификата + * Экспортирует сертификат в формате base64 * - * @param thumbprint - отпечаток сертификата - * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11-2012 256 бит - * @returns подпись в формате PKCS#7 + * @returns сертификат в формате base64 */ -exports.createDetachedSignature = _afterPluginsLoaded_1._afterPluginsLoaded(function (thumbprint, messageHash) { return __awaiter(void 0, void 0, void 0, function () { - var cadesplugin, cadesCertificate; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - cadesplugin = window.cadesplugin; - return [4 /*yield*/, _getCadesCert_1._getCadesCert(thumbprint)]; - case 1: - cadesCertificate = _a.sent(); - return [2 /*return*/, eval(_generateCadesFn_1._generateCadesFn(function createDetachedSignature() { - var cadesAttrs; - var cadesHashedData; - var cadesSignedData; - var cadesSigner; - try { - cadesAttrs = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CADESCOM.CPAttribute'); - cadesHashedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.HashedData'); - cadesSignedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CadesSignedData'); - cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); - } - var currentTime = _getDateObj_1._getDateObj(new Date()); - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Name(constants_1.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи'); - } - var cadesAuthAttrs; - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); - cadesAuthAttrs = _generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2; - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке сертификата'); - } - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + - cadesHashedData.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.SetHashValue(messageHash)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке хеша'); - } - var signature; - try { - signature = - _generateCadesFn_1.__cadesAsyncToken__ + - cadesSignedData.SignHash(cadesHashedData, cadesSigner, cadesplugin.CADESCOM_PKCS7_TYPE); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); - } - return signature; - }))]; +exports.exportBase64 = _afterPluginsLoaded_1._afterPluginsLoaded(function () { + var cadesCertificate = this._cadesCertificate; + return eval(_generateCadesFn_1._generateCadesFn(function exportBase64() { + var base64; + try { + base64 = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.Export(0); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при экспорте сертификата'); + } + return base64; + })); +}); + + +/***/ }), + +/***/ "./api/certificate/getAlgorithm.ts": +/*!*****************************************!*\ + !*** ./api/certificate/getAlgorithm.ts ***! + \*****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +var _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); +/** + * Возвращает информацию об алгоритме сертификата + * + * @returns информацию об алгоритме и его OID'е + */ +exports.getAlgorithm = _afterPluginsLoaded_1._afterPluginsLoaded(function () { + var cadesCertificate = this._cadesCertificate; + return eval(_generateCadesFn_1._generateCadesFn(function getAlgorithm() { + var algorithmInfo = { + algorithm: null, + oid: null, + }; + var cadesPublicKey; + try { + cadesPublicKey = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.PublicKey(); + cadesPublicKey = _generateCadesFn_1.__cadesAsyncToken__ + cadesPublicKey.Algorithm; + algorithmInfo.algorithm = _generateCadesFn_1.__cadesAsyncToken__ + cadesPublicKey.FriendlyName; + algorithmInfo.oid = _generateCadesFn_1.__cadesAsyncToken__ + cadesPublicKey.Value; } - }); -}); }); + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при получении алгоритма'); + } + return algorithmInfo; + })); +}); /***/ }), -/***/ "./api/createHash.ts": -/*!***************************!*\ - !*** ./api/createHash.ts ***! - \***************************/ +/***/ "./api/certificate/getCadesProp.ts": +/*!*****************************************!*\ + !*** ./api/certificate/getCadesProp.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"); +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 - сообщение для хеширования - * @hashedAlgorithm - алгоритм хеширования. По умолчанию - CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256. + * Возвращает указанное внутренее свойство у сертификата в формате Cades * - * @returns хеш + * @param propName = наименование свойства + * @returns значение запрошенного свойства */ -exports.createHash = _afterPluginsLoaded_1._afterPluginsLoaded(function (unencryptedMessage, options) { 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 _a; - var cadesHashedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.HashedData'); - var messageBase64; - var hash; - try { - if ((options === null || options === void 0 ? void 0 : options.encoding) && typeof unencryptedMessage === 'string') { - messageBase64 = Buffer.from(unencryptedMessage, options === null || options === void 0 ? void 0 : options.encoding).toString('base64'); - } - else { - messageBase64 = Buffer.from(unencryptedMessage).toString('base64'); - } - } - catch (error) { - console.error(error); - throw new Error('Ошибка при преобразовании сообщения в Base64'); - } - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + - cadesHashedData.propset_Algorithm((_a = options === null || options === void 0 ? void 0 : options.hashedAlgorithm) !== null && _a !== void 0 ? _a : 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; - }))]; - }); -}); }); +exports.getCadesProp = _afterPluginsLoaded_1._afterPluginsLoaded(function (propName) { + var cadesCertificate = this._cadesCertificate; + return eval(_generateCadesFn_1._generateCadesFn(function getCadesProp() { + var propertyValue; + try { + propertyValue = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate[propName]; + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при обращении к свойству сертификата'); + } + return propertyValue; + })); +}); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/buffer/index.js */ "../node_modules/buffer/index.js").Buffer)) /***/ }), -/***/ "./api/createSignature.ts": -/*!********************************!*\ - !*** ./api/createSignature.ts ***! - \********************************/ +/***/ "./api/certificate/getDecodedExtendedKeyUsage.ts": +/*!*******************************************************!*\ + !*** ./api/certificate/getDecodedExtendedKeyUsage.ts ***! + \*******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { @@ -3140,82 +3221,25 @@ var __generator = (this && this.__generator) || function (thisArg, body) { } }; 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"); +var constants_1 = __webpack_require__(/*! ../../constants */ "./constants/index.ts"); +var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); /** - * Создает подпись base64 строки по отпечатку сертификата + * Возвращает расшифрованные ОИД'ы сертификата * - * @param thumbprint - отпечаток сертификата - * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11 - * @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false) - * @returns подпись + * @returns словарь расшифрованных ОИД'ов */ -exports.createSignature = _afterPluginsLoaded_1._afterPluginsLoaded(function (thumbprint, messageHash, detachedSignature) { - if (detachedSignature === void 0) { detachedSignature = true; } - return __awaiter(void 0, void 0, void 0, function () { - var cadesplugin, cadesCertificate; +exports.getDecodedExtendedKeyUsage = _afterPluginsLoaded_1._afterPluginsLoaded(function () { + return __awaiter(this, void 0, void 0, function () { + var certificateOids; return __generator(this, function (_a) { switch (_a.label) { - case 0: - console.warn([ - 'cryptoPro: Метод "createSignature" является устаревшим и будет убран из будущих версий.', - 'Используйте "createAttachedSignature" и "createDetachedSignature".', - ].join('\n')); - cadesplugin = window.cadesplugin; - return [4 /*yield*/, _getCadesCert_1._getCadesCert(thumbprint)]; - case 1: - cadesCertificate = _a.sent(); - return [2 /*return*/, eval(_generateCadesFn_1._generateCadesFn(function createSignature() { - var cadesAttrs; - var cadesSignedData; - var cadesSigner; - try { - cadesAttrs = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CADESCOM.CPAttribute'); - cadesSignedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CadesSignedData'); - cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); - } - var currentTime = _getDateObj_1._getDateObj(new Date()); - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Name(constants_1.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи'); - } - var cadesAuthAttrs; - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); - cadesAuthAttrs = _generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2; - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_Content(messageHash)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи'); - } - var signature; - try { - signature = - _generateCadesFn_1.__cadesAsyncToken__ + - cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_CADES_BES, detachedSignature); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); - } - return signature; - }))]; + case 0: return [4 /*yield*/, this.getExtendedKeyUsage()]; + case 1: + certificateOids = _a.sent(); + return [2 /*return*/, certificateOids.reduce(function (decodedOids, oidCode) { + var _a; + return (__assign(__assign({}, decodedOids), (_a = {}, _a[oidCode] = constants_1.OIDS_DICTIONARY[oidCode] || null, _a))); + }, {})]; } }); }); @@ -3224,10 +3248,60 @@ exports.createSignature = _afterPluginsLoaded_1._afterPluginsLoaded(function (th /***/ }), -/***/ "./api/createXMLSignature.ts": -/*!***********************************!*\ - !*** ./api/createXMLSignature.ts ***! - \***********************************/ +/***/ "./api/certificate/getExtendedKeyUsage.ts": +/*!************************************************!*\ + !*** ./api/certificate/getExtendedKeyUsage.ts ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +var _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); +/** + * Возвращает ОИД'ы сертификата + * + * @returns список ОИД'ов + */ +exports.getExtendedKeyUsage = _afterPluginsLoaded_1._afterPluginsLoaded(function () { + var cadesCertificate = this._cadesCertificate; + return eval(_generateCadesFn_1._generateCadesFn(function getExtendedKeyUsage() { + var OIDS = []; + var count; + try { + count = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage(); + count = _generateCadesFn_1.__cadesAsyncToken__ + count.EKUs; + count = _generateCadesFn_1.__cadesAsyncToken__ + count.Count; + if (count > 0) { + while (count > 0) { + var cadesExtendedKeyUsage = void 0; + cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage(); + cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesExtendedKeyUsage.EKUs; + cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesExtendedKeyUsage.Item(count); + cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesExtendedKeyUsage.OID; + OIDS.push(cadesExtendedKeyUsage); + count--; + } + } + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || "Ошибка при получении ОИД'ов"); + } + return OIDS; + })); +}); + + +/***/ }), + +/***/ "./api/certificate/getInfo.ts": +/*!************************************!*\ + !*** ./api/certificate/getInfo.ts ***! + \************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { @@ -3270,73 +3344,45 @@ var __generator = (this && this.__generator) || function (thisArg, body) { } }; 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"); +var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +var _parseCertInfo_1 = __webpack_require__(/*! ../../helpers/_parseCertInfo */ "./helpers/_parseCertInfo.ts"); +var getCadesProp_1 = __webpack_require__(/*! ./getCadesProp */ "./api/certificate/getCadesProp.ts"); /** - * Создает XML подпись для документа в формате XML + * Возвращает расшифрованную информацию о сертификате из указанного свойства по тэгам * - * @param thumbprint - отпечаток сертификата - * @param unencryptedMessage - подписываемое сообщение в формате XML - * @returns подпись + * @param tags = словарь + * @param entitiesPath = путь к разбираемой сущности + * @returns расшифрованная информация по отдельным тэгам */ -exports.createXMLSignature = _afterPluginsLoaded_1._afterPluginsLoaded(function (thumbprint, unencryptedMessage) { return __awaiter(void 0, void 0, void 0, function () { - var cadesplugin, cadesCertificate; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - cadesplugin = window.cadesplugin; - return [4 /*yield*/, _getCadesCert_1._getCadesCert(thumbprint)]; - case 1: - cadesCertificate = _a.sent(); - return [2 /*return*/, eval(_generateCadesFn_1._generateCadesFn(function createXMLSignature() { - var cadesSigner; - var cadesSignedXML; - try { - cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); - cadesSignedXML = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.SignedXML'); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); - } - try { - var signatureMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256'; - var digestMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256'; - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_CheckCertificate(true)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.propset_Content(unencryptedMessage)); - void (_generateCadesFn_1.__cadesAsyncToken__ + - cadesSignedXML.propset_SignatureType(cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.propset_SignatureMethod(signatureMethod)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.propset_DigestMethod(digestMethod)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи'); - } - var signature; - try { - signature = _generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.Sign(cadesSigner); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); - } - return signature; - }))]; - } +exports.getInfo = _afterPluginsLoaded_1._afterPluginsLoaded(function (tags, entitiesPath) { + return __awaiter(this, void 0, void 0, function () { + var entities, error_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, getCadesProp_1.getCadesProp.call(this, entitiesPath)]; + case 1: + entities = _a.sent(); + return [3 /*break*/, 3]; + case 2: + error_1 = _a.sent(); + console.error(error_1); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error_1) || 'Ошибка при извлечении информации из сертификата'); + case 3: return [2 /*return*/, _parseCertInfo_1._parseCertInfo(tags, entities)]; + } + }); }); -}); }); +}); /***/ }), -/***/ "./api/execute.ts": -/*!************************!*\ - !*** ./api/execute.ts ***! - \************************/ +/***/ "./api/certificate/hasExtendedKeyUsage.ts": +/*!************************************************!*\ + !*** ./api/certificate/hasExtendedKeyUsage.ts ***! + \************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { @@ -3379,56 +3425,100 @@ var __generator = (this && this.__generator) || function (thisArg, body) { } }; 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 _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); /** - * Функция кастомной реализации с доступом к Cades плагину напрямую - * - * @callback executeCallback - * @param exposedAPI - API доступные для кастомной реализации - * @param exposedAPI.cadesplugin - Cades плагин, предоставляемый КриптоПРО - * @param exposedAPI._generateCadesFn - функция, компилирующая тело передаваемой javascript функции для текущей среды - * @param exposedAPI.__cadesAsyncToken__ - синтетический маркер, подменяемый в рантайме - * @param exposedAPI.__createCadesPluginObject__ - функция для создания синхронных/асинхронных Cades объектов - * @param exposedAPI._extractMeaningfulErrorMessage - хелпер для извлечения текста ошибки + * Проверяет наличие ОИД'а (ОИД'ов) у сертификата * - * @returns результат выполнения кастомной реализации + * @param oids - ОИД'ы для проверки + * @returns флаг наличия ОИД'ов у сертификата */ +exports.hasExtendedKeyUsage = _afterPluginsLoaded_1._afterPluginsLoaded(function (oids) { + return __awaiter(this, void 0, void 0, function () { + var certOids, result; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, this.getExtendedKeyUsage()]; + case 1: + certOids = _a.sent(); + if (Array.isArray(oids)) { + result = oids.every(function (oidToCheck) { return certOids.some(function (certOid) { return certOid === oidToCheck; }); }); + } + else { + result = certOids.some(function (certOid) { return certOid === oids; }); + } + return [2 /*return*/, result]; + } + }); + }); +}); + + +/***/ }), + +/***/ "./api/certificate/index.ts": +/*!**********************************!*\ + !*** ./api/certificate/index.ts ***! + \**********************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +Object.defineProperty(exports, "__esModule", { value: true }); +__export(__webpack_require__(/*! ./certificate */ "./api/certificate/certificate.ts")); + + +/***/ }), + +/***/ "./api/certificate/isValid.ts": +/*!************************************!*\ + !*** ./api/certificate/isValid.ts ***! + \************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +var _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); /** - * Компилирует и выполняет переданную функцию для доступной браузерной среды (синхронной/асинхронной) - * - * @param {executeCallback} callback - функция, использующая низкоуровневый доступ к Cades плагину + * Проверяет действительность сертификата * - * @returns асинхронный результат выполнения передаваемой функции + * @returns флаг валидности */ -exports.execute = _afterPluginsLoaded_1._afterPluginsLoaded(function (callback) { return __awaiter(void 0, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, callback({ - cadesplugin: window.cadesplugin, - _generateCadesFn: _generateCadesFn_1._generateCadesFn, - __cadesAsyncToken__: _generateCadesFn_1.__cadesAsyncToken__, - __createCadesPluginObject__: _generateCadesFn_1.__createCadesPluginObject__, - _extractMeaningfulErrorMessage: _extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage, - })]; - case 1: return [2 /*return*/, _a.sent()]; +exports.isValid = _afterPluginsLoaded_1._afterPluginsLoaded(function () { + var cadesCertificate = this._cadesCertificate; + return eval(_generateCadesFn_1._generateCadesFn(function isValid() { + var isValid; + try { + isValid = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.IsValid(); + isValid = _generateCadesFn_1.__cadesAsyncToken__ + isValid.Result; } - }); -}); }); + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при проверке сертификата'); + } + return Boolean(isValid); + })); +}); /***/ }), -/***/ "./api/getCertificate.ts": -/*!*******************************!*\ - !*** ./api/getCertificate.ts ***! - \*******************************/ +/***/ "./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) { @@ -3466,206 +3556,93 @@ var __generator = (this && this.__generator) || function (thisArg, body) { } }; 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 getUserCertificates_1 = __webpack_require__(/*! ./getUserCertificates */ "./api/getUserCertificates.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 - отпечаток сертификата - * @returns сертификат + * @param message - подписываемое сообщение + * @returns подпись в формате PKCS#7 */ -exports.getCertificate = _afterPluginsLoaded_1._afterPluginsLoaded(function (thumbprint) { return __awaiter(void 0, void 0, void 0, function () { - var availableCertificates, foundCertificate; +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: - if (!thumbprint) { - throw new Error('Отпечаток не указан'); - } - return [4 /*yield*/, getUserCertificates_1.getUserCertificates()]; + cadesplugin = window.cadesplugin; + return [4 /*yield*/, _getCadesCert_1._getCadesCert(thumbprint)]; case 1: - availableCertificates = _a.sent(); - foundCertificate = availableCertificates.find(function (cert) { return cert.thumbprint === thumbprint; }); - if (!foundCertificate) { - throw new Error("\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442 \u0441 \u043E\u0442\u043F\u0435\u0447\u0430\u0442\u043A\u043E\u043C: \"" + thumbprint + "\" \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D"); - } - return [2 /*return*/, foundCertificate]; - } - }); -}); }); - - -/***/ }), - -/***/ "./api/getSystemInfo.ts": -/*!******************************!*\ - !*** ./api/getSystemInfo.ts ***! - \******************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Предоставляет информацию о системе - * - * @returns информацию о CSP и плагине - */ -exports.getSystemInfo = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - var sysInfo = { - cadesVersion: null, - cspVersion: null, - }; - return eval(_generateCadesFn_1._generateCadesFn(function getSystemInfo() { - var cadesAbout; - try { - cadesAbout = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.About'); - sysInfo.cadesVersion = _generateCadesFn_1.__cadesAsyncToken__ + cadesAbout.PluginVersion; - sysInfo.cspVersion = _generateCadesFn_1.__cadesAsyncToken__ + cadesAbout.CSPVersion(); - if (!sysInfo.cadesVersion) { - sysInfo.cadesVersion = _generateCadesFn_1.__cadesAsyncToken__ + cadesAbout.Version; - } - sysInfo.cadesVersion = _generateCadesFn_1.__cadesAsyncToken__ + sysInfo.cadesVersion.toString(); - sysInfo.cspVersion = _generateCadesFn_1.__cadesAsyncToken__ + sysInfo.cspVersion.toString(); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при получении информации о системе'); - } - return sysInfo; - })); -}); - - -/***/ }), - -/***/ "./api/getUserCertificates.ts": -/*!************************************!*\ - !*** ./api/getUserCertificates.ts ***! - \************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var certificate_1 = __webpack_require__(/*! ./certificate */ "./api/certificate/index.ts"); -var constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractCommonName_1 = __webpack_require__(/*! ../helpers/_extractCommonName */ "./helpers/_extractCommonName.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -var certificatesCache; -/** - * Возвращает список сертификатов, доступных пользователю в системе - * - * @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов - * @returns список сертификатов - */ -exports.getUserCertificates = _afterPluginsLoaded_1._afterPluginsLoaded(function (resetCache) { - if (resetCache === void 0) { resetCache = false; } - var cadesplugin = window.cadesplugin; - if (!resetCache && certificatesCache) { - return certificatesCache; - } - return eval(_generateCadesFn_1._generateCadesFn(function getUserCertificates() { - var cadesStore; - try { - cadesStore = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.Store'); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу'); - } - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + - cadesStore.Open(cadesplugin.CAPICOM_CURRENT_USER_STORE, cadesplugin.CAPICOM_MY_STORE, cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища'); - } - var cadesCertificates; - var cadesCertificatesCount; - try { - cadesCertificates = _generateCadesFn_1.__cadesAsyncToken__ + cadesStore.Certificates; - if (cadesCertificates) { - cadesCertificates = - _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID); - /** - * Не рассматриваются сертификаты, в которых отсутствует закрытый ключ - * или не действительны на данный момент - */ - cadesCertificates = - _generateCadesFn_1.__cadesAsyncToken__ + - cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY, constants_1.CAPICOM_PROPID_KEY_PROV_INFO); - cadesCertificatesCount = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificates.Count; - } - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов'); - } - if (!cadesCertificatesCount) { - throw new Error('Нет доступных сертификатов'); - } - var certificateList = []; - try { - while (cadesCertificatesCount) { - var cadesCertificate = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificates.Item(cadesCertificatesCount); - certificateList.push(new certificate_1.Certificate(cadesCertificate, _extractCommonName_1._extractCommonName(_generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.SubjectName), _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.IssuerName, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.SubjectName, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.Thumbprint, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ValidFromDate, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ValidToDate)); - cadesCertificatesCount--; - } - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка обработки сертификатов'); - } - cadesStore.Close(); - certificatesCache = certificateList; - return certificatesCache; - })); -}); - - -/***/ }), - -/***/ "./api/index.ts": -/*!**********************!*\ - !*** ./api/index.ts ***! - \**********************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(/*! ./getCertificate */ "./api/getCertificate.ts")); -__export(__webpack_require__(/*! ./getUserCertificates */ "./api/getUserCertificates.ts")); -__export(__webpack_require__(/*! ./getSystemInfo */ "./api/getSystemInfo.ts")); -__export(__webpack_require__(/*! ./isValidSystemSetup */ "./api/isValidSystemSetup.ts")); -__export(__webpack_require__(/*! ./createSignature */ "./api/createSignature.ts")); -__export(__webpack_require__(/*! ./createXMLSignature */ "./api/createXMLSignature.ts")); -__export(__webpack_require__(/*! ./createDetachedSignature */ "./api/createDetachedSignature.ts")); -__export(__webpack_require__(/*! ./createAttachedSignature */ "./api/createAttachedSignature.ts")); -__export(__webpack_require__(/*! ./createHash */ "./api/createHash.ts")); -__export(__webpack_require__(/*! ./certificate */ "./api/certificate/index.ts")); -__export(__webpack_require__(/*! ./execute */ "./api/execute.ts")); + 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/isValidSystemSetup.ts": -/*!***********************************!*\ - !*** ./api/isValidSystemSetup.ts ***! - \***********************************/ +/***/ "./api/createDetachedSignature.ts": +/*!****************************************!*\ + !*** ./api/createDetachedSignature.ts ***! + \****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { @@ -3708,371 +3685,526 @@ var __generator = (this && this.__generator) || function (thisArg, body) { } }; 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 _isSupportedCadesVersion_1 = __webpack_require__(/*! ../helpers/_isSupportedCadesVersion */ "./helpers/_isSupportedCadesVersion.ts"); -var _isSupportedCSPVersion_1 = __webpack_require__(/*! ../helpers/_isSupportedCSPVersion */ "./helpers/_isSupportedCSPVersion.ts"); -var getSystemInfo_1 = __webpack_require__(/*! ./getSystemInfo */ "./api/getSystemInfo.ts"); +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"); /** - * Проверяет корректность настроек ЭП на машине + * Создает отсоединенную подпись хеша по отпечатку сертификата * - * @returns флаг корректности настроек + * @param thumbprint - отпечаток сертификата + * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11-2012 256 бит + * @returns подпись в формате PKCS#7 */ -exports.isValidSystemSetup = _afterPluginsLoaded_1._afterPluginsLoaded(function () { return __awaiter(void 0, void 0, void 0, function () { - var systemInfo, error_1; +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: - _a.trys.push([0, 2, , 3]); - return [4 /*yield*/, getSystemInfo_1.getSystemInfo()]; + cadesplugin = window.cadesplugin; + return [4 /*yield*/, _getCadesCert_1._getCadesCert(thumbprint)]; case 1: - systemInfo = _a.sent(); - return [3 /*break*/, 3]; - case 2: - error_1 = _a.sent(); - console.error(error_1); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error_1) || 'Настройки ЭП на данной машине не верны'); - case 3: - if (!_isSupportedCadesVersion_1._isSupportedCadesVersion(systemInfo.cadesVersion)) { - throw new Error('Не поддерживаемая версия плагина'); - } - if (!_isSupportedCSPVersion_1._isSupportedCSPVersion(systemInfo.cspVersion)) { - throw new Error('Не поддерживаемая версия CSP'); - } - return [2 /*return*/, true]; - } - }); -}); }); - - -/***/ }), - -/***/ "./constants/cades-constants.ts": -/*!**************************************!*\ - !*** ./constants/cades-constants.ts ***! - \**************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CADESCOM_ATTRIBUTE_OTHER = -1; -exports.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; -exports.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; -exports.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0; -exports.CADESCOM_AllowNoOutstandingRequest = 1; -exports.CADESCOM_AllowNone = 0; -exports.CADESCOM_AllowUntrustedCertificate = 2; -exports.CADESCOM_AllowUntrustedRoot = 4; -exports.CADESCOM_BASE64_TO_BINARY = 0x01; -exports.CADESCOM_CADES_BES = 1; -exports.CADESCOM_CADES_DEFAULT = 0; -exports.CADESCOM_CADES_T = 5; -exports.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d; -exports.CADESCOM_CONTAINER_STORE = 100; -exports.CADESCOM_CURRENT_USER_STORE = 2; -exports.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2; -exports.CADESCOM_DISPLAY_DATA_CONTENT = 1; -exports.CADESCOM_DISPLAY_DATA_NONE = 0; -exports.CADESCOM_ENCODE_ANY = -1; -exports.CADESCOM_ENCODE_BASE64 = 0; -exports.CADESCOM_ENCODE_BINARY = 1; -exports.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3; -exports.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4; -exports.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2; -exports.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25; -exports.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0; -exports.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110; -exports.CADESCOM_HASH_ALGORITHM_MD2 = 1; -exports.CADESCOM_HASH_ALGORITHM_MD4 = 2; -exports.CADESCOM_HASH_ALGORITHM_MD5 = 3; -exports.CADESCOM_HASH_ALGORITHM_SHA1 = 0; -exports.CADESCOM_HASH_ALGORITHM_SHA_256 = 4; -exports.CADESCOM_HASH_ALGORITHM_SHA_384 = 5; -exports.CADESCOM_HASH_ALGORITHM_SHA_512 = 6; -exports.CADESCOM_LOCAL_MACHINE_STORE = 1; -exports.CADESCOM_PKCS7_TYPE = 65535; -exports.CADESCOM_STRING_TO_UCS2LE = 0x00; -exports.CADESCOM_SkipInstallToStore = 268435456; -exports.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0; -exports.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1; -exports.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2; -exports.CAPICOM_ACTIVE_DIRECTORY_USER_STORE = 3; -exports.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; -exports.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; -exports.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0; -exports.CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7; -exports.CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8; -exports.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6; -exports.CAPICOM_CERTIFICATE_FIND_EXTENSION = 5; -exports.CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2; -exports.CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12; -exports.CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3; -exports.CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0; -exports.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1; -exports.CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4; -exports.CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11; -exports.CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10; -exports.CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9; -exports.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0; -exports.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2; -exports.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1; -exports.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1; -exports.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0; -exports.CAPICOM_CURRENT_USER_STORE = 2; -exports.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128; -exports.CAPICOM_EKU_CLIENT_AUTH = 2; -exports.CAPICOM_EKU_OTHER = 0; -exports.CAPICOM_EKU_SMARTCARD_LOGON = 5; -exports.CAPICOM_LOCAL_MACHINE_STORE = 1; -exports.CAPICOM_MEMORY_STORE = 0; -exports.CAPICOM_MY_STORE = 'My'; -exports.CAPICOM_OID_KEY_USAGE_EXTENSION = 10; -exports.CAPICOM_OID_OTHER = 0; -exports.CAPICOM_PROPID_ACCESS_STATE = 14; -exports.CAPICOM_PROPID_ARCHIVED = 19; -exports.CAPICOM_PROPID_ARCHIVED_KEY_HASH = 65; -exports.CAPICOM_PROPID_AUTO_ENROLL = 21; -exports.CAPICOM_PROPID_CROSS_CERT_DIST_POINTS = 23; -exports.CAPICOM_PROPID_CTL_USAGE = 9; -exports.CAPICOM_PROPID_DATE_STAMP = 27; -exports.CAPICOM_PROPID_DESCRIPTION = 13; -exports.CAPICOM_PROPID_EFS = 17; -exports.CAPICOM_PROPID_ENHKEY_USAGE = 9; -exports.CAPICOM_PROPID_ENROLLMENT = 26; -exports.CAPICOM_PROPID_EXTENDED_ERROR_INFO = 30; -exports.CAPICOM_PROPID_FIRST_RESERVED = 66; -exports.CAPICOM_PROPID_FIRST_USER = 0x00008000; -exports.CAPICOM_PROPID_FORTEZZA_DATA = 18; -exports.CAPICOM_PROPID_FRIENDLY_NAME = 11; -exports.CAPICOM_PROPID_HASH_PROP = 3; -exports.CAPICOM_PROPID_IE30_RESERVED = 7; -exports.CAPICOM_PROPID_ISSUER_PUBLIC_KEY_MD5_HASH = 24; -exports.CAPICOM_PROPID_ISSUER_SERIAL_NUMBER_MD5_HASH = 28; -exports.CAPICOM_PROPID_KEY_CONTEXT = 5; -exports.CAPICOM_PROPID_KEY_IDENTIFIER = 20; -exports.CAPICOM_PROPID_KEY_PROV_HANDLE = 1; -exports.CAPICOM_PROPID_KEY_PROV_INFO = 2; -exports.CAPICOM_PROPID_KEY_SPEC = 6; -exports.CAPICOM_PROPID_LAST_RESERVED = 0x00007fff; -exports.CAPICOM_PROPID_LAST_USER = 0x0000ffff; -exports.CAPICOM_PROPID_MD5_HASH = 4; -exports.CAPICOM_PROPID_NEXT_UPDATE_LOCATION = 10; -exports.CAPICOM_PROPID_PUBKEY_ALG_PARA = 22; -exports.CAPICOM_PROPID_PUBKEY_HASH_RESERVED = 8; -exports.CAPICOM_PROPID_PVK_FILE = 12; -exports.CAPICOM_PROPID_RENEWAL = 64; -exports.CAPICOM_PROPID_SHA1_HASH = 3; -exports.CAPICOM_PROPID_SIGNATURE_HASH = 15; -exports.CAPICOM_PROPID_SMART_CARD_DATA = 16; -exports.CAPICOM_PROPID_SUBJECT_NAME_MD5_HASH = 29; -exports.CAPICOM_PROPID_SUBJECT_PUBLIC_KEY_MD5_HASH = 25; -exports.CAPICOM_PROPID_UNKNOWN = 0; -exports.CAPICOM_SMART_CARD_USER_STORE = 4; -exports.CAPICOM_STORE_OPEN_EXISTING_ONLY = 128; -exports.CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED = 256; -exports.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2; -exports.CAPICOM_STORE_OPEN_READ_ONLY = 0; -exports.CAPICOM_STORE_OPEN_READ_WRITE = 1; -exports.CHECK_NONE = 0; -exports.CHECK_OFFLINE_REVOCATION_STATUS = 16; -exports.CHECK_ONLINE_REVOCATION_STATUS = 8; -exports.CHECK_SIGNATURE_VALIDITY = 4; -exports.CHECK_TIME_VALIDITY = 2; -exports.CHECK_TRUSTED_ROOT = 1; -exports.LOG_LEVEL_DEBUG = 4; -exports.LOG_LEVEL_ERROR = 1; -exports.LOG_LEVEL_INFO = 2; -exports.TRUST_CTL_IS_NOT_SIGNATURE_VALID = 262144; -exports.TRUST_CTL_IS_NOT_TIME_VALID = 131072; -exports.TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 524288; -exports.TRUST_IS_CYCLIC = 128; -exports.TRUST_IS_NOT_SIGNATURE_VALID = 8; -exports.TRUST_IS_NOT_TIME_NESTED = 2; -exports.TRUST_IS_NOT_TIME_VALID = 1; -exports.TRUST_IS_NOT_VALID_FOR_USAGE = 16; -exports.TRUST_IS_PARTIAL_CHAIN = 65536; -exports.TRUST_IS_REVOKED = 4; -exports.TRUST_IS_UNTRUSTED_ROOT = 32; -exports.TRUST_REVOCATION_STATUS_UNKNOWN = 64; -exports.XmlDsigGost3410Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411'; -exports.XmlDsigGost3410UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411'; -exports.XmlDsigGost3411Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411'; -exports.XmlDsigGost3411UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr3411'; + cadesCertificate = _a.sent(); + return [2 /*return*/, eval(_generateCadesFn_1._generateCadesFn(function createDetachedSignature() { + var cadesAttrs; + var cadesHashedData; + var cadesSignedData; + var cadesSigner; + try { + cadesAttrs = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CADESCOM.CPAttribute'); + cadesHashedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.HashedData'); + cadesSignedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CadesSignedData'); + cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); + } + var currentTime = _getDateObj_1._getDateObj(new Date()); + try { + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Name(constants_1.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime)); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи'); + } + var cadesAuthAttrs; + try { + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); + cadesAuthAttrs = _generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2; + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN)); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке сертификата'); + } + try { + void (_generateCadesFn_1.__cadesAsyncToken__ + + cadesHashedData.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.SetHashValue(messageHash)); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке хеша'); + } + var signature; + try { + signature = + _generateCadesFn_1.__cadesAsyncToken__ + + cadesSignedData.SignHash(cadesHashedData, cadesSigner, cadesplugin.CADESCOM_PKCS7_TYPE); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); + } + return signature; + }))]; + } + }); +}); }); /***/ }), -/***/ "./constants/index.ts": -/*!****************************!*\ - !*** ./constants/index.ts ***! - \****************************/ +/***/ "./api/createHash.ts": +/*!***************************!*\ + !*** ./api/createHash.ts ***! + \***************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} +/* 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 }); -__export(__webpack_require__(/*! ./cades-constants */ "./constants/cades-constants.ts")); -__export(__webpack_require__(/*! ./issuer-tags-translations */ "./constants/issuer-tags-translations.ts")); -__export(__webpack_require__(/*! ./oids-dictionary */ "./constants/oids-dictionary.ts")); -__export(__webpack_require__(/*! ./subject-tags-translations */ "./constants/subject-tags-translations.ts")); +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 - сообщение для хеширования + * @hashedAlgorithm - алгоритм хеширования. По умолчанию - CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256. + * + * @returns хеш + */ +exports.createHash = _afterPluginsLoaded_1._afterPluginsLoaded(function (unencryptedMessage, options) { 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 _a; + var cadesHashedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.HashedData'); + var messageBase64; + var hash; + try { + if ((options === null || options === void 0 ? void 0 : options.encoding) && typeof unencryptedMessage === 'string') { + messageBase64 = Buffer.from(unencryptedMessage, options === null || options === void 0 ? void 0 : options.encoding).toString('base64'); + } + else { + messageBase64 = Buffer.from(unencryptedMessage).toString('base64'); + } + } + catch (error) { + console.error(error); + throw new Error('Ошибка при преобразовании сообщения в Base64'); + } + try { + void (_generateCadesFn_1.__cadesAsyncToken__ + + cadesHashedData.propset_Algorithm((_a = options === null || options === void 0 ? void 0 : options.hashedAlgorithm) !== null && _a !== void 0 ? _a : 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)) /***/ }), -/***/ "./constants/issuer-tags-translations.ts": -/*!***********************************************!*\ - !*** ./constants/issuer-tags-translations.ts ***! - \***********************************************/ +/***/ "./api/createSignature.ts": +/*!********************************!*\ + !*** ./api/createSignature.ts ***! + \********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; Object.defineProperty(exports, "__esModule", { value: true }); -exports.ISSUER_TAGS_TRANSLATIONS = [ - { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' }, - { possibleNames: ['CN'], translation: 'Удостоверяющий центр' }, - { possibleNames: ['C'], translation: 'Страна' }, - { possibleNames: ['S'], translation: 'Регион' }, - { possibleNames: ['STREET'], translation: 'Адрес' }, - { possibleNames: ['O'], translation: 'Компания' }, - { possibleNames: ['OU'], translation: 'Тип' }, - { possibleNames: ['T'], translation: 'Должность' }, - { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' }, - { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' }, - { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' }, - { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' }, - { possibleNames: ['E'], translation: 'Email' }, - { possibleNames: ['L'], translation: 'Город' }, -]; +var constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); +var _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +var _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); +var _getCadesCert_1 = __webpack_require__(/*! ../helpers/_getCadesCert */ "./helpers/_getCadesCert.ts"); +var _getDateObj_1 = __webpack_require__(/*! ../helpers/_getDateObj */ "./helpers/_getDateObj.ts"); +/** + * Создает подпись base64 строки по отпечатку сертификата + * + * @param thumbprint - отпечаток сертификата + * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11 + * @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false) + * @returns подпись + */ +exports.createSignature = _afterPluginsLoaded_1._afterPluginsLoaded(function (thumbprint, messageHash, detachedSignature) { + if (detachedSignature === void 0) { detachedSignature = true; } + return __awaiter(void 0, void 0, void 0, function () { + var cadesplugin, cadesCertificate; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + console.warn([ + 'cryptoPro: Метод "createSignature" является устаревшим и будет убран из будущих версий.', + 'Используйте "createAttachedSignature" и "createDetachedSignature".', + ].join('\n')); + cadesplugin = window.cadesplugin; + return [4 /*yield*/, _getCadesCert_1._getCadesCert(thumbprint)]; + case 1: + cadesCertificate = _a.sent(); + return [2 /*return*/, eval(_generateCadesFn_1._generateCadesFn(function createSignature() { + var cadesAttrs; + var cadesSignedData; + var cadesSigner; + try { + cadesAttrs = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CADESCOM.CPAttribute'); + cadesSignedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CadesSignedData'); + cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); + } + var currentTime = _getDateObj_1._getDateObj(new Date()); + try { + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Name(constants_1.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime)); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи'); + } + var cadesAuthAttrs; + try { + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); + cadesAuthAttrs = _generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2; + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_Content(messageHash)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY)); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи'); + } + var signature; + try { + signature = + _generateCadesFn_1.__cadesAsyncToken__ + + cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_CADES_BES, detachedSignature); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); + } + return signature; + }))]; + } + }); + }); +}); /***/ }), -/***/ "./constants/oids-dictionary.ts": -/*!**************************************!*\ - !*** ./constants/oids-dictionary.ts ***! - \**************************************/ +/***/ "./api/createXMLSignature.ts": +/*!***********************************!*\ + !*** ./api/createXMLSignature.ts ***! + \***********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.OIDS_DICTIONARY = { - '1.2.643.2.2.34.6': 'Пользователь Центра Регистрации', - '1.2.643.2.39.1.1': 'Использование в программных продуктах системы "1С:Предприятие 8"', - '1.2.643.3.131.1.1': 'ИНН', - '1.2.643.3.141.1.1': 'РНС ФСС', - '1.2.643.3.141.1.2': 'КП ФСС', - '1.2.643.3.2.100.65.13.11': 'Использование в системе АИС "Госзакупки" Сахалинской области.', - '1.2.643.3.8.100.1': 'Сертификат типа "ekey-ГОСТ"', - '1.2.643.3.8.100.1.1': 'Общее использование в системах ИОК без права заверения финансовых документов', - '1.2.643.3.8.100.1.10': 'Для участия в электронных торгах и подписания государственного контракта в информационных системах Тендерного комитета города Москвы уполномоченными лицами участников размещения государственного заказа города Москвы', - '1.2.643.3.8.100.1.11': 'Подписание электронных документов в автоматизированной информационной системе размещения государственного и муниципального заказа Саратовской области', - '1.2.643.3.8.100.1.12': 'Использование в системе государственного заказа Иркутской области', - '1.2.643.3.8.100.1.13': 'Использование в электронной торговой площадке агентства государственного заказа Красноярского края', - '1.2.643.3.8.100.1.14': 'Использование в электронной торговой площадке "Тендер"', - '1.2.643.3.8.100.1.2': 'Передача отчетности по ТКС', - '1.2.643.3.8.100.1.3': 'Оформление взаимных обязательств, соглашений, договоров, актов и т.п.', - '1.2.643.3.8.100.1.4': 'Внутрикорпоративный документооборот', - '1.2.643.3.8.100.1.5': 'Использование в системах электронной торговли', - '1.2.643.3.8.100.1.6': 'Использование в торгово-закупочной системе "ЭЛЕКТРА"', - '1.2.643.3.8.100.1.7': 'Использование в системе Портал государственных закупок Ставропольского края.', - '1.2.643.3.8.100.1.8': 'Использование в Единой системе электронной торговли B2B-Center и B2G.', - '1.2.643.3.8.100.1.9': 'Для участия в электронных торгах и подписания государственного контракта в электронной площадке ОАО «ЕЭТП» уполномоченными лицами участников размещения государственного или муниципального заказа', - '1.2.643.5.1.24.2.1.3': 'Формирование документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя', - '1.2.643.5.1.24.2.1.3.1': 'Формирование кадастровым инженером документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя', - '1.2.643.5.1.24.2.2.2': 'Формирование документов как результата оказания услуги со стороны органов регистрации прав', - '1.2.643.5.1.24.2.2.3': 'Формирование документов для получения государственных услуг в сфере государственной регистрации прав на недвижимое имущество и сделок с ним со стороны заявителя', - '1.2.643.6.2.1.7.1': 'Использование единоличным исполнительным органом юридического лица или уполномоченными представителями юридического лица в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских и иных прав и обязанностей в сфере негосударственного пенсионного обеспечения, негосударственного пенсионного страхования, в сфере деятельности паевых инвестиционных фондов, акционерных инвестиционных фондов, профессиональных участников рынка ценных бумаг, а также связанной с обслуживанием указанной деятельности услуг кредитных и иных организаций', - '1.2.643.6.2.1.7.2': 'Использование физическим лицом в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских прав и обязанностей в отношении инвестиционных паев паевых инвестиционных фондов, в том числе отношения, связанные с учетом и/или фиксацией прав на инвестиционные паи паевых инвестиционных фондов', - '1.2.643.6.3': 'Использование в электронных торговых системах и в программном обеспечении, связанным с обменом электронных сообщений', - '1.2.643.6.3.1.1': 'Использование на электронных площадок отобранных для проведения аукционах в электронной форме', - '1.2.643.6.3.1.2.1': 'Тип участника - Юридическое лицо', - '1.2.643.6.3.1.2.2': 'Тип участника - Физическое лицо', - '1.2.643.6.3.1.2.3': 'Тип участника - Индивидуальный предприниматель', - '1.2.643.6.3.1.3.1': 'Участник размещения заказа', - '1.2.643.6.3.1.4.1': 'Администратор организации', - '1.2.643.6.3.1.4.2': 'Уполномоченный специалист', - '1.2.643.6.3.1.4.3': 'Специалист с правом подписи контракта', - '1.2.840.113549.1.9.2': 'Неструктурированное имя', - '1.3.6.1.4.1.24138.1.1.8.1': 'Обеспечение юридической значимости в Системе "Электронная Торговая Площадка"', - '1.3.6.1.4.1.29919.21': 'Использование в системе Портал государственных закупок Ростовской области "Рефери".', - '1.3.6.1.5.5.7.3.2': 'Проверка подлинности клиента', - '1.3.6.1.5.5.7.3.4': 'Защищенная электронная почта', - '1.3.643.3.8.100.15': 'Использование в ЭТП "uTender"', +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 }; + } }; - - -/***/ }), - -/***/ "./constants/subject-tags-translations.ts": -/*!************************************************!*\ - !*** ./constants/subject-tags-translations.ts ***! - \************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); -exports.SUBJECT_TAGS_TRANSLATIONS = [ - { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' }, - { possibleNames: ['CN'], translation: 'Владелец' }, - { possibleNames: ['SN'], translation: 'Фамилия' }, - { possibleNames: ['G'], translation: 'Имя Отчество' }, - { possibleNames: ['C'], translation: 'Страна' }, - { possibleNames: ['S'], translation: 'Регион' }, - { possibleNames: ['STREET'], translation: 'Адрес' }, - { possibleNames: ['O'], translation: 'Компания' }, - { possibleNames: ['OU'], translation: 'Отдел/подразделение' }, - { possibleNames: ['T'], translation: 'Должность' }, - { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' }, - { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' }, - { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' }, - { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' }, - { possibleNames: ['E'], translation: 'Email' }, - { possibleNames: ['L'], translation: 'Город' }, -]; +var _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +var _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); +var _getCadesCert_1 = __webpack_require__(/*! ../helpers/_getCadesCert */ "./helpers/_getCadesCert.ts"); +/** + * Создает XML подпись для документа в формате XML + * + * @param thumbprint - отпечаток сертификата + * @param unencryptedMessage - подписываемое сообщение в формате XML + * @returns подпись + */ +exports.createXMLSignature = _afterPluginsLoaded_1._afterPluginsLoaded(function (thumbprint, unencryptedMessage) { return __awaiter(void 0, void 0, void 0, function () { + var cadesplugin, cadesCertificate; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + cadesplugin = window.cadesplugin; + return [4 /*yield*/, _getCadesCert_1._getCadesCert(thumbprint)]; + case 1: + cadesCertificate = _a.sent(); + return [2 /*return*/, eval(_generateCadesFn_1._generateCadesFn(function createXMLSignature() { + var cadesSigner; + var cadesSignedXML; + try { + cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); + cadesSignedXML = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.SignedXML'); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); + } + try { + var signatureMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256'; + var digestMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256'; + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_CheckCertificate(true)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.propset_Content(unencryptedMessage)); + void (_generateCadesFn_1.__cadesAsyncToken__ + + cadesSignedXML.propset_SignatureType(cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.propset_SignatureMethod(signatureMethod)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.propset_DigestMethod(digestMethod)); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи'); + } + var signature; + try { + signature = _generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.Sign(cadesSigner); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); + } + return signature; + }))]; + } + }); +}); }); /***/ }), -/***/ "./crypto-pro.ts": -/*!***********************!*\ - !*** ./crypto-pro.ts ***! - \***********************/ +/***/ "./api/execute.ts": +/*!************************!*\ + !*** ./api/execute.ts ***! + \************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} +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 }); -__export(__webpack_require__(/*! ./api */ "./api/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"); +/** + * Функция кастомной реализации с доступом к Cades плагину напрямую + * + * @callback executeCallback + * @param exposedAPI - API доступные для кастомной реализации + * @param exposedAPI.cadesplugin - Cades плагин, предоставляемый КриптоПРО + * @param exposedAPI._generateCadesFn - функция, компилирующая тело передаваемой javascript функции для текущей среды + * @param exposedAPI.__cadesAsyncToken__ - синтетический маркер, подменяемый в рантайме + * @param exposedAPI.__createCadesPluginObject__ - функция для создания синхронных/асинхронных Cades объектов + * @param exposedAPI._extractMeaningfulErrorMessage - хелпер для извлечения текста ошибки + * + * @returns результат выполнения кастомной реализации + */ +/** + * Компилирует и выполняет переданную функцию для доступной браузерной среды (синхронной/асинхронной) + * + * @param {executeCallback} callback - функция, использующая низкоуровневый доступ к Cades плагину + * + * @returns асинхронный результат выполнения передаваемой функции + */ +exports.execute = _afterPluginsLoaded_1._afterPluginsLoaded(function (callback) { return __awaiter(void 0, void 0, void 0, function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, callback({ + cadesplugin: window.cadesplugin, + _generateCadesFn: _generateCadesFn_1._generateCadesFn, + __cadesAsyncToken__: _generateCadesFn_1.__cadesAsyncToken__, + __createCadesPluginObject__: _generateCadesFn_1.__createCadesPluginObject__, + _extractMeaningfulErrorMessage: _extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage, + })]; + case 1: return [2 /*return*/, _a.sent()]; + } + }); +}); }); /***/ }), -/***/ "./helpers/_afterPluginsLoaded.ts": -/*!****************************************!*\ - !*** ./helpers/_afterPluginsLoaded.ts ***! - \****************************************/ +/***/ "./api/getCertificate.ts": +/*!*******************************!*\ + !*** ./api/getCertificate.ts ***! + \*******************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { @@ -4115,186 +4247,120 @@ var __generator = (this && this.__generator) || function (thisArg, body) { } }; Object.defineProperty(exports, "__esModule", { value: true }); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ./_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var isSetLogLevel = false; -var isPluginLoaded = false; -exports._afterPluginsLoaded = function (fn) { - var canPromise = Boolean(window.Promise); - return function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return __awaiter(this, void 0, void 0, function () { - var cadesplugin, error_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - if (!isPluginLoaded) { - try { - __webpack_require__(/*! ../vendor/cadesplugin_api */ "./vendor/cadesplugin_api.js"); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подключении модуля для работы с Cades plugin'); - } - isPluginLoaded = true; - } - cadesplugin = window.cadesplugin; - if (!canPromise) { - throw new Error('Необходим полифилл для Promise'); - } - if (!cadesplugin) { - throw new Error('Не подключен модуль для работы с Cades plugin'); - } - if (!isSetLogLevel) { - cadesplugin.set_log_level(cadesplugin.LOG_LEVEL_ERROR); - isSetLogLevel = true; - } - _a.label = 1; - case 1: - _a.trys.push([1, 3, , 4]); - return [4 /*yield*/, cadesplugin]; - case 2: - _a.sent(); - return [3 /*break*/, 4]; - case 3: - error_1 = _a.sent(); - console.error(error_1); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error_1) || 'Ошибка при инициализации модуля для работы с Cades plugin'); - case 4: return [4 /*yield*/, fn.apply(this, args)]; - case 5: return [2 /*return*/, _a.sent()]; +var _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +var getUserCertificates_1 = __webpack_require__(/*! ./getUserCertificates */ "./api/getUserCertificates.ts"); +/** + * Возвращает сертификат по отпечатку + * + * @param thumbprint - отпечаток сертификата + * @returns сертификат + */ +exports.getCertificate = _afterPluginsLoaded_1._afterPluginsLoaded(function (thumbprint) { return __awaiter(void 0, void 0, void 0, function () { + var availableCertificates, foundCertificate; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!thumbprint) { + throw new Error('Отпечаток не указан'); } - }); - }); - }; -}; - - -/***/ }), - -/***/ "./helpers/_extractCommonName.ts": -/*!***************************************!*\ - !*** ./helpers/_extractCommonName.ts ***! - \***************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports._extractCommonName = function (subjectName) { var _a; return (_a = subjectName.match(/CN=(.+?)(?:,|$)/)) === null || _a === void 0 ? void 0 : _a[1]; }; - - -/***/ }), - -/***/ "./helpers/_extractMeaningfulErrorMessage.ts": -/*!***************************************************!*\ - !*** ./helpers/_extractMeaningfulErrorMessage.ts ***! - \***************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports._extractMeaningfulErrorMessage = function (error) { - var _a; - var errorContainer = ((_a = window.cadesplugin) === null || _a === void 0 ? void 0 : _a.getLastError) && window.cadesplugin.getLastError(error); - if (!(errorContainer === null || errorContainer === void 0 ? void 0 : errorContainer.message)) { - if (!error.message) { - return null; + return [4 /*yield*/, getUserCertificates_1.getUserCertificates()]; + case 1: + availableCertificates = _a.sent(); + foundCertificate = availableCertificates.find(function (cert) { return cert.thumbprint === thumbprint; }); + if (!foundCertificate) { + throw new Error("\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442 \u0441 \u043E\u0442\u043F\u0435\u0447\u0430\u0442\u043A\u043E\u043C: \"" + thumbprint + "\" \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D"); + } + return [2 /*return*/, foundCertificate]; } - errorContainer = error; - } - var containsRussianLetters = /[а-яА-Я]/.test(errorContainer.message); - if (!containsRussianLetters) { - return null; - } - var searchResult = errorContainer.message.match(/^(.*?)(?:(?:\.?\s?\(?0x)|(?:\.?$))/); - return searchResult ? searchResult[1] : null; -}; + }); +}); }); /***/ }), -/***/ "./helpers/_generateCadesFn.ts": -/*!*************************************!*\ - !*** ./helpers/_generateCadesFn.ts ***! - \*************************************/ +/***/ "./api/getSystemInfo.ts": +/*!******************************!*\ + !*** ./api/getSystemInfo.ts ***! + \******************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -// синтетические переменные, которые подменяются в рантайме -exports.__cadesAsyncToken__ = {}; -exports.__createCadesPluginObject__ = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return ({}); -}; -function getGeneratorConstructor() { - return new Function('', 'return Object.getPrototypeOf(function*(){}).constructor')(); -} -exports._generateCadesFn = function (callback) { - var _a; - var cadesplugin = window.cadesplugin; - var cadesGeneratorsAPI = Boolean(cadesplugin.CreateObjectAsync); - var callbackName = callback.name || 'dynamicFn'; - var callbackLiteral = String(callback); - var callbackArguments = ((_a = callbackLiteral.match(/^function[\s\w]*?\((.*?)\)/)) === null || _a === void 0 ? void 0 : _a[1]) || ''; - var callbackBody = callbackLiteral.replace(/^.*?{([\s\S]*?)}$/, '$1'); - var crossEnvCallbackLiteral = String(new (cadesGeneratorsAPI ? getGeneratorConstructor() : Function)(callbackArguments, callbackBody)); - crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/(?:\w+?\.)?__createCadesPluginObject__(\([\s\S]*?\))/gm, "cadesplugin.CreateObject" + (cadesGeneratorsAPI ? 'Async' : '') + "$1"); - crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/(?:\w+?\.)?__cadesAsyncToken__\s*?\+\s*?\b/gm, cadesGeneratorsAPI ? 'yield ' : ''); - if (!cadesGeneratorsAPI) { - crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/propset_(.*?)\((.*?)\)/gm, '$1 = $2'); - } - return [ - cadesGeneratorsAPI ? "cadesplugin.async_spawn(" + crossEnvCallbackLiteral + ");" : "(" + crossEnvCallbackLiteral + ")();", - "//# sourceURL=crypto-pro_" + callbackName + ".js", - ].join(''); -}; +var _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +var _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); +/** + * Предоставляет информацию о системе + * + * @returns информацию о CSP и плагине + */ +exports.getSystemInfo = _afterPluginsLoaded_1._afterPluginsLoaded(function () { + var sysInfo = { + cadesVersion: null, + cspVersion: null, + }; + return eval(_generateCadesFn_1._generateCadesFn(function getSystemInfo() { + var cadesAbout; + try { + cadesAbout = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.About'); + sysInfo.cadesVersion = _generateCadesFn_1.__cadesAsyncToken__ + cadesAbout.PluginVersion; + sysInfo.cspVersion = _generateCadesFn_1.__cadesAsyncToken__ + cadesAbout.CSPVersion(); + if (!sysInfo.cadesVersion) { + sysInfo.cadesVersion = _generateCadesFn_1.__cadesAsyncToken__ + cadesAbout.Version; + } + sysInfo.cadesVersion = _generateCadesFn_1.__cadesAsyncToken__ + sysInfo.cadesVersion.toString(); + sysInfo.cspVersion = _generateCadesFn_1.__cadesAsyncToken__ + sysInfo.cspVersion.toString(); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при получении информации о системе'); + } + return sysInfo; + })); +}); /***/ }), -/***/ "./helpers/_getCadesCert.ts": -/*!**********************************!*\ - !*** ./helpers/_getCadesCert.ts ***! - \**********************************/ +/***/ "./api/getUserCertificates.ts": +/*!************************************!*\ + !*** ./api/getUserCertificates.ts ***! + \************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var _afterPluginsLoaded_1 = __webpack_require__(/*! ./_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ./_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -var _generateCadesFn_1 = __webpack_require__(/*! ./_generateCadesFn */ "./helpers/_generateCadesFn.ts"); +var certificate_1 = __webpack_require__(/*! ./certificate */ "./api/certificate/index.ts"); +var constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); +var _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +var _extractCommonName_1 = __webpack_require__(/*! ../helpers/_extractCommonName */ "./helpers/_extractCommonName.ts"); +var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +var _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); +var certificatesCache; /** - * Возвращает сертификат в формате Cades по отпечатку + * Возвращает список сертификатов, доступных пользователю в системе * - * @param thumbprint - отпечаток сертификата - * @returns сертификат в формате Cades + * @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов + * @returns список сертификатов */ -exports._getCadesCert = _afterPluginsLoaded_1._afterPluginsLoaded(function (thumbprint) { +exports.getUserCertificates = _afterPluginsLoaded_1._afterPluginsLoaded(function (resetCache) { + if (resetCache === void 0) { resetCache = false; } var cadesplugin = window.cadesplugin; - return eval(_generateCadesFn_1._generateCadesFn(function _getCadesCert() { + if (!resetCache && certificatesCache) { + return certificatesCache; + } + return eval(_generateCadesFn_1._generateCadesFn(function getUserCertificates() { var cadesStore; try { cadesStore = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.Store'); } catch (error) { console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу'); - } - if (!cadesStore) { - throw new Error('Не удалось получить доступ к хранилищу сертификатов'); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу'); } try { void (_generateCadesFn_1.__cadesAsyncToken__ + @@ -4304,938 +4370,872 @@ exports._getCadesCert = _afterPluginsLoaded_1._afterPluginsLoaded(function (thum console.error(error); throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища'); } - var cadesCertificateList; - var certificatesCount; + var cadesCertificates; + var cadesCertificatesCount; try { - cadesCertificateList = _generateCadesFn_1.__cadesAsyncToken__ + cadesStore.Certificates; - certificatesCount = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Count; + cadesCertificates = _generateCadesFn_1.__cadesAsyncToken__ + cadesStore.Certificates; + if (cadesCertificates) { + cadesCertificates = + _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID); + /** + * Не рассматриваются сертификаты, в которых отсутствует закрытый ключ + * или не действительны на данный момент + */ + cadesCertificates = + _generateCadesFn_1.__cadesAsyncToken__ + + cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY, constants_1.CAPICOM_PROPID_KEY_PROV_INFO); + cadesCertificatesCount = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificates.Count; + } } catch (error) { console.error(error); throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов'); } - if (!certificatesCount) { + if (!cadesCertificatesCount) { throw new Error('Нет доступных сертификатов'); } - var cadesCertificate; + var certificateList = []; try { - cadesCertificateList = - _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH, thumbprint); - var count = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Count; - if (!count) { - throw new Error("\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442 \u0441 \u043E\u0442\u043F\u0435\u0447\u0430\u0442\u043A\u043E\u043C: \"" + thumbprint + "\" \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D"); + while (cadesCertificatesCount) { + var cadesCertificate = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificates.Item(cadesCertificatesCount); + certificateList.push(new certificate_1.Certificate(cadesCertificate, _extractCommonName_1._extractCommonName(_generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.SubjectName), _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.IssuerName, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.SubjectName, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.Thumbprint, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ValidFromDate, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ValidToDate)); + cadesCertificatesCount--; } - cadesCertificate = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Item(1); } catch (error) { console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при получении сертификата'); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка обработки сертификатов'); } cadesStore.Close(); - return cadesCertificate; + certificatesCache = certificateList; + return certificatesCache; })); }); /***/ }), -/***/ "./helpers/_getDateObj.ts": -/*!********************************!*\ - !*** ./helpers/_getDateObj.ts ***! - \********************************/ +/***/ "./api/index.ts": +/*!**********************!*\ + !*** ./api/index.ts ***! + \**********************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +Object.defineProperty(exports, "__esModule", { value: true }); +__export(__webpack_require__(/*! ./getCertificate */ "./api/getCertificate.ts")); +__export(__webpack_require__(/*! ./getUserCertificates */ "./api/getUserCertificates.ts")); +__export(__webpack_require__(/*! ./getSystemInfo */ "./api/getSystemInfo.ts")); +__export(__webpack_require__(/*! ./isValidSystemSetup */ "./api/isValidSystemSetup.ts")); +__export(__webpack_require__(/*! ./createSignature */ "./api/createSignature.ts")); +__export(__webpack_require__(/*! ./createXMLSignature */ "./api/createXMLSignature.ts")); +__export(__webpack_require__(/*! ./createDetachedSignature */ "./api/createDetachedSignature.ts")); +__export(__webpack_require__(/*! ./createAttachedSignature */ "./api/createAttachedSignature.ts")); +__export(__webpack_require__(/*! ./createHash */ "./api/createHash.ts")); +__export(__webpack_require__(/*! ./certificate */ "./api/certificate/index.ts")); +__export(__webpack_require__(/*! ./execute */ "./api/execute.ts")); + + +/***/ }), + +/***/ "./api/isValidSystemSetup.ts": +/*!***********************************!*\ + !*** ./api/isValidSystemSetup.ts ***! + \***********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; Object.defineProperty(exports, "__esModule", { value: true }); +var _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +var _isSupportedCadesVersion_1 = __webpack_require__(/*! ../helpers/_isSupportedCadesVersion */ "./helpers/_isSupportedCadesVersion.ts"); +var _isSupportedCSPVersion_1 = __webpack_require__(/*! ../helpers/_isSupportedCSPVersion */ "./helpers/_isSupportedCSPVersion.ts"); +var getSystemInfo_1 = __webpack_require__(/*! ./getSystemInfo */ "./api/getSystemInfo.ts"); /** - * Возвращает объект даты, совместимый с Cades plugin'ом, зависящий от браузера. + * Проверяет корректность настроек ЭП на машине * - * В IE необходимо использовать специфичный формат "VT_DATE" - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Microsoft_Extensions/Date.getVarDate + * @returns флаг корректности настроек */ -exports._getDateObj = function (dateObj) { return (dateObj.getVarDate ? dateObj.getVarDate() : dateObj); }; +exports.isValidSystemSetup = _afterPluginsLoaded_1._afterPluginsLoaded(function () { return __awaiter(void 0, void 0, void 0, function () { + var systemInfo, error_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4 /*yield*/, getSystemInfo_1.getSystemInfo()]; + case 1: + systemInfo = _a.sent(); + return [3 /*break*/, 3]; + case 2: + error_1 = _a.sent(); + console.error(error_1); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error_1) || 'Настройки ЭП на данной машине не верны'); + case 3: + if (!_isSupportedCadesVersion_1._isSupportedCadesVersion(systemInfo.cadesVersion)) { + throw new Error('Не поддерживаемая версия плагина'); + } + if (!_isSupportedCSPVersion_1._isSupportedCSPVersion(systemInfo.cspVersion)) { + throw new Error('Не поддерживаемая версия CSP'); + } + return [2 /*return*/, true]; + } + }); +}); }); /***/ }), -/***/ "./helpers/_isSupportedCSPVersion.ts": -/*!*******************************************!*\ - !*** ./helpers/_isSupportedCSPVersion.ts ***! - \*******************************************/ +/***/ "./constants/cades-constants.ts": +/*!**************************************!*\ + !*** ./constants/cades-constants.ts ***! + \**************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var oldestSupportedCSPVersion = 4.0; -exports._isSupportedCSPVersion = function (version) { - var _a; - version = (_a = version.match(/\d+?\b(?:\.\d+)?/)) === null || _a === void 0 ? void 0 : _a[0]; - return Number(version) >= oldestSupportedCSPVersion; -}; +exports.CADESCOM_ATTRIBUTE_OTHER = -1; +exports.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; +exports.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; +exports.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0; +exports.CADESCOM_AllowNoOutstandingRequest = 1; +exports.CADESCOM_AllowNone = 0; +exports.CADESCOM_AllowUntrustedCertificate = 2; +exports.CADESCOM_AllowUntrustedRoot = 4; +exports.CADESCOM_BASE64_TO_BINARY = 0x01; +exports.CADESCOM_CADES_BES = 1; +exports.CADESCOM_CADES_DEFAULT = 0; +exports.CADESCOM_CADES_T = 5; +exports.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d; +exports.CADESCOM_CONTAINER_STORE = 100; +exports.CADESCOM_CURRENT_USER_STORE = 2; +exports.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2; +exports.CADESCOM_DISPLAY_DATA_CONTENT = 1; +exports.CADESCOM_DISPLAY_DATA_NONE = 0; +exports.CADESCOM_ENCODE_ANY = -1; +exports.CADESCOM_ENCODE_BASE64 = 0; +exports.CADESCOM_ENCODE_BINARY = 1; +exports.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3; +exports.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4; +exports.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2; +exports.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25; +exports.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0; +exports.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1; +exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100; +exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101; +exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111; +exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102; +exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112; +exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110; +exports.CADESCOM_HASH_ALGORITHM_MD2 = 1; +exports.CADESCOM_HASH_ALGORITHM_MD4 = 2; +exports.CADESCOM_HASH_ALGORITHM_MD5 = 3; +exports.CADESCOM_HASH_ALGORITHM_SHA1 = 0; +exports.CADESCOM_HASH_ALGORITHM_SHA_256 = 4; +exports.CADESCOM_HASH_ALGORITHM_SHA_384 = 5; +exports.CADESCOM_HASH_ALGORITHM_SHA_512 = 6; +exports.CADESCOM_LOCAL_MACHINE_STORE = 1; +exports.CADESCOM_PKCS7_TYPE = 65535; +exports.CADESCOM_STRING_TO_UCS2LE = 0x00; +exports.CADESCOM_SkipInstallToStore = 268435456; +exports.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0; +exports.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1; +exports.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2; +exports.CAPICOM_ACTIVE_DIRECTORY_USER_STORE = 3; +exports.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; +exports.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; +exports.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0; +exports.CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7; +exports.CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8; +exports.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6; +exports.CAPICOM_CERTIFICATE_FIND_EXTENSION = 5; +exports.CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2; +exports.CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12; +exports.CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3; +exports.CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0; +exports.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1; +exports.CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4; +exports.CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11; +exports.CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10; +exports.CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9; +exports.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0; +exports.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2; +exports.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1; +exports.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1; +exports.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0; +exports.CAPICOM_CURRENT_USER_STORE = 2; +exports.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128; +exports.CAPICOM_EKU_CLIENT_AUTH = 2; +exports.CAPICOM_EKU_OTHER = 0; +exports.CAPICOM_EKU_SMARTCARD_LOGON = 5; +exports.CAPICOM_LOCAL_MACHINE_STORE = 1; +exports.CAPICOM_MEMORY_STORE = 0; +exports.CAPICOM_MY_STORE = 'My'; +exports.CAPICOM_OID_KEY_USAGE_EXTENSION = 10; +exports.CAPICOM_OID_OTHER = 0; +exports.CAPICOM_PROPID_ACCESS_STATE = 14; +exports.CAPICOM_PROPID_ARCHIVED = 19; +exports.CAPICOM_PROPID_ARCHIVED_KEY_HASH = 65; +exports.CAPICOM_PROPID_AUTO_ENROLL = 21; +exports.CAPICOM_PROPID_CROSS_CERT_DIST_POINTS = 23; +exports.CAPICOM_PROPID_CTL_USAGE = 9; +exports.CAPICOM_PROPID_DATE_STAMP = 27; +exports.CAPICOM_PROPID_DESCRIPTION = 13; +exports.CAPICOM_PROPID_EFS = 17; +exports.CAPICOM_PROPID_ENHKEY_USAGE = 9; +exports.CAPICOM_PROPID_ENROLLMENT = 26; +exports.CAPICOM_PROPID_EXTENDED_ERROR_INFO = 30; +exports.CAPICOM_PROPID_FIRST_RESERVED = 66; +exports.CAPICOM_PROPID_FIRST_USER = 0x00008000; +exports.CAPICOM_PROPID_FORTEZZA_DATA = 18; +exports.CAPICOM_PROPID_FRIENDLY_NAME = 11; +exports.CAPICOM_PROPID_HASH_PROP = 3; +exports.CAPICOM_PROPID_IE30_RESERVED = 7; +exports.CAPICOM_PROPID_ISSUER_PUBLIC_KEY_MD5_HASH = 24; +exports.CAPICOM_PROPID_ISSUER_SERIAL_NUMBER_MD5_HASH = 28; +exports.CAPICOM_PROPID_KEY_CONTEXT = 5; +exports.CAPICOM_PROPID_KEY_IDENTIFIER = 20; +exports.CAPICOM_PROPID_KEY_PROV_HANDLE = 1; +exports.CAPICOM_PROPID_KEY_PROV_INFO = 2; +exports.CAPICOM_PROPID_KEY_SPEC = 6; +exports.CAPICOM_PROPID_LAST_RESERVED = 0x00007fff; +exports.CAPICOM_PROPID_LAST_USER = 0x0000ffff; +exports.CAPICOM_PROPID_MD5_HASH = 4; +exports.CAPICOM_PROPID_NEXT_UPDATE_LOCATION = 10; +exports.CAPICOM_PROPID_PUBKEY_ALG_PARA = 22; +exports.CAPICOM_PROPID_PUBKEY_HASH_RESERVED = 8; +exports.CAPICOM_PROPID_PVK_FILE = 12; +exports.CAPICOM_PROPID_RENEWAL = 64; +exports.CAPICOM_PROPID_SHA1_HASH = 3; +exports.CAPICOM_PROPID_SIGNATURE_HASH = 15; +exports.CAPICOM_PROPID_SMART_CARD_DATA = 16; +exports.CAPICOM_PROPID_SUBJECT_NAME_MD5_HASH = 29; +exports.CAPICOM_PROPID_SUBJECT_PUBLIC_KEY_MD5_HASH = 25; +exports.CAPICOM_PROPID_UNKNOWN = 0; +exports.CAPICOM_SMART_CARD_USER_STORE = 4; +exports.CAPICOM_STORE_OPEN_EXISTING_ONLY = 128; +exports.CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED = 256; +exports.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2; +exports.CAPICOM_STORE_OPEN_READ_ONLY = 0; +exports.CAPICOM_STORE_OPEN_READ_WRITE = 1; +exports.CHECK_NONE = 0; +exports.CHECK_OFFLINE_REVOCATION_STATUS = 16; +exports.CHECK_ONLINE_REVOCATION_STATUS = 8; +exports.CHECK_SIGNATURE_VALIDITY = 4; +exports.CHECK_TIME_VALIDITY = 2; +exports.CHECK_TRUSTED_ROOT = 1; +exports.LOG_LEVEL_DEBUG = 4; +exports.LOG_LEVEL_ERROR = 1; +exports.LOG_LEVEL_INFO = 2; +exports.TRUST_CTL_IS_NOT_SIGNATURE_VALID = 262144; +exports.TRUST_CTL_IS_NOT_TIME_VALID = 131072; +exports.TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 524288; +exports.TRUST_IS_CYCLIC = 128; +exports.TRUST_IS_NOT_SIGNATURE_VALID = 8; +exports.TRUST_IS_NOT_TIME_NESTED = 2; +exports.TRUST_IS_NOT_TIME_VALID = 1; +exports.TRUST_IS_NOT_VALID_FOR_USAGE = 16; +exports.TRUST_IS_PARTIAL_CHAIN = 65536; +exports.TRUST_IS_REVOKED = 4; +exports.TRUST_IS_UNTRUSTED_ROOT = 32; +exports.TRUST_REVOCATION_STATUS_UNKNOWN = 64; +exports.XmlDsigGost3410Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411'; +exports.XmlDsigGost3410UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411'; +exports.XmlDsigGost3411Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411'; +exports.XmlDsigGost3411UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr3411'; /***/ }), -/***/ "./helpers/_isSupportedCadesVersion.ts": -/*!*********************************************!*\ - !*** ./helpers/_isSupportedCadesVersion.ts ***! - \*********************************************/ +/***/ "./constants/index.ts": +/*!****************************!*\ + !*** ./constants/index.ts ***! + \****************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} Object.defineProperty(exports, "__esModule", { value: true }); -exports._isSupportedCadesVersion = function (version) { - var match = version.match(/(\d+)\.(\d+)\.(\d+)/); - if (!match) { - return false; - } - var major = match[1], minor = match[2], patch = match[3]; - if (Number(major) < 2) { - return false; - } - if (Number(major) === 2 && Number(patch) < 12438) { - return false; - } - return true; -}; +__export(__webpack_require__(/*! ./cades-constants */ "./constants/cades-constants.ts")); +__export(__webpack_require__(/*! ./issuer-tags-translations */ "./constants/issuer-tags-translations.ts")); +__export(__webpack_require__(/*! ./oids-dictionary */ "./constants/oids-dictionary.ts")); +__export(__webpack_require__(/*! ./subject-tags-translations */ "./constants/subject-tags-translations.ts")); /***/ }), -/***/ "./helpers/_parseCertInfo.ts": -/*!***********************************!*\ - !*** ./helpers/_parseCertInfo.ts ***! - \***********************************/ +/***/ "./constants/issuer-tags-translations.ts": +/*!***********************************************!*\ + !*** ./constants/issuer-tags-translations.ts ***! + \***********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -var constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); -/** - * Парсит информацию из строки с информацией о сертификате - * - * @param tagsTranslations - словарь с расшифровками тэгов - * @param rawInfo - данные для парсинга - * @returns расшифрованная информация по отдельным тэгам - */ -exports._parseCertInfo = function (tagsTranslations, rawInfo) { - var extractedEntities = rawInfo.match(/([а-яА-Яa-zA-Z0-9\s.]+)=(?:("[^"]+?")|(.+?))(?:,|$)/g); - if (extractedEntities) { - return extractedEntities.map(function (group) { - var _a, _b, _c; - var segmentsMatch = group.trim().match(/^([а-яА-Яa-zA-Z0-9\s.]+)=(.+?),?$/); - var title = segmentsMatch === null || segmentsMatch === void 0 ? void 0 : segmentsMatch[1]; - // Вырезаем лишние кавычки - var description = (_b = (_a = segmentsMatch === null || segmentsMatch === void 0 ? void 0 : segmentsMatch[2]) === null || _a === void 0 ? void 0 : _a.replace(/^"(.*)"/, '$1')) === null || _b === void 0 ? void 0 : _b.replace(/"{2}/g, '"'); - var oidIdentifierMatch = title === null || title === void 0 ? void 0 : title.match(/^OID\.(.*)/); - var oidIdentifier = oidIdentifierMatch === null || oidIdentifierMatch === void 0 ? void 0 : oidIdentifierMatch[1]; - var isTranslated = false; - // Если нашли в тайтле ОИД, пытаемся его расшифровать - if (oidIdentifier) { - var oidTranslation = constants_1.OIDS_DICTIONARY[oidIdentifier]; - if (oidTranslation) { - title = oidTranslation; - isTranslated = true; - } - } - var tagTranslation = (_c = tagsTranslations.find(function (tag) { return tag.possibleNames.find(function (name) { return name === title; }); })) === null || _c === void 0 ? void 0 : _c.translation; - if (tagTranslation) { - title = tagTranslation; - isTranslated = true; - } - return { description: description, title: title, isTranslated: isTranslated }; - }); - } -}; - - -/***/ }), - -/***/ "./vendor/cadesplugin_api.js": -/*!***********************************!*\ - !*** ./vendor/cadesplugin_api.js ***! - \***********************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -;(function () { - //already loaded - if(window.cadesplugin) - return; - - var pluginObject; - var plugin_resolved = 0; - var plugin_reject; - var plugin_resolve; - var isOpera = 0; - var isFireFox = 0; - var isSafari = 0; - var isYandex = 0; - var canPromise = !!window.Promise; - var cadesplugin_loaded_event_recieved = false; - var isFireFoxExtensionLoaded = false; - var cadesplugin; - - if(canPromise) - { - cadesplugin = new Promise(function(resolve, reject) - { - plugin_resolve = resolve; - plugin_reject = reject; - }); - } else - { - cadesplugin = {}; - } - - function check_browser() { - var ua= navigator.userAgent, tem, M= ua.match(/(opera|yabrowser|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; - if(/trident/i.test(M[1])){ - tem = /\brv[ :]+(\d+)/g.exec(ua) || []; - return { name:'IE', version:(tem[1] || '')}; - } - if(M[1] === 'Chrome'){ - tem = ua.match(/\b(OPR|Edg|YaBrowser)\/(\d+)/); - if (tem != null) - return { name: tem[1].replace('OPR', 'Opera'), version: tem[2] }; - } - M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?']; - if ((tem = ua.match(/version\/(\d+)/i)) != null) - M.splice(1, 1, tem[1]); - return {name:M[0],version:M[1]}; - } - var browserSpecs = check_browser(); - - function cpcsp_console_log(level, msg){ - //IE9 не может писать в консоль если не открыта вкладка developer tools - if(typeof(console) === 'undefined') - return; - if (level <= cadesplugin.current_log_level ){ - if (level === cadesplugin.LOG_LEVEL_DEBUG) - console.log("DEBUG: %s", msg); - if (level === cadesplugin.LOG_LEVEL_INFO) - console.info("INFO: %s", msg); - if (level === cadesplugin.LOG_LEVEL_ERROR) - console.error("ERROR: %s", msg); - return; - } - } - - function get_extension_version(callback) { - window.postMessage("cadesplugin_extension_version_request", "*"); - window.addEventListener("message", function (event) { - var resp_prefix = "cadesplugin_extension_version_response:"; - if (typeof (event.data) !== "string" || event.data.indexOf(resp_prefix) !== 0) - return; - ext_version = event.data.substring(resp_prefix.length); - callback(ext_version); - }, false); - } - - function set_log_level(level){ - if (!((level === cadesplugin.LOG_LEVEL_DEBUG) || - (level === cadesplugin.LOG_LEVEL_INFO) || - (level === cadesplugin.LOG_LEVEL_ERROR))){ - cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, "cadesplugin_api.js: Incorrect log_level: " + level); - return; - } - cadesplugin.current_log_level = level; - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = DEBUG"); - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = INFO"); - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = ERROR"); - if(isNativeMessageSupported()) - { - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG) - window.postMessage("set_log_level=debug", "*"); - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO) - window.postMessage("set_log_level=info", "*"); - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR) - window.postMessage("set_log_level=error", "*"); - } - } - - function set_constantValues() - { - cadesplugin.CAPICOM_MEMORY_STORE = 0; - cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1; - cadesplugin.CAPICOM_CURRENT_USER_STORE = 2; - cadesplugin.CAPICOM_SMART_CARD_USER_STORE = 4; - cadesplugin.CADESCOM_MEMORY_STORE = 0; - cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1; - cadesplugin.CADESCOM_CURRENT_USER_STORE = 2; - cadesplugin.CADESCOM_SMART_CARD_USER_STORE = 4; - cadesplugin.CADESCOM_CONTAINER_STORE = 100; - - cadesplugin.CAPICOM_MY_STORE = "My"; - - cadesplugin.CAPICOM_STORE_OPEN_READ_WRITE = 1; - cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2; +exports.ISSUER_TAGS_TRANSLATIONS = [ + { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' }, + { possibleNames: ['CN'], translation: 'Удостоверяющий центр' }, + { possibleNames: ['C'], translation: 'Страна' }, + { possibleNames: ['S'], translation: 'Регион' }, + { possibleNames: ['STREET'], translation: 'Адрес' }, + { possibleNames: ['O'], translation: 'Компания' }, + { possibleNames: ['OU'], translation: 'Тип' }, + { possibleNames: ['T'], translation: 'Должность' }, + { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' }, + { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' }, + { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' }, + { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' }, + { possibleNames: ['E'], translation: 'Email' }, + { possibleNames: ['L'], translation: 'Город' }, +]; - 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.CADESCOM_XADES_DEFAULT = 0x00000010; - cadesplugin.CADESCOM_XADES_BES = 0x00000020; - cadesplugin.CADESCOM_XADES_T = 0x00000050; - cadesplugin.CADESCOM_XADES_X_LONG_TYPE_1 = 0x000005d0; - cadesplugin.CADESCOM_XMLDSIG_TYPE = 0x00000000; +/***/ "./constants/oids-dictionary.ts": +/*!**************************************!*\ + !*** ./constants/oids-dictionary.ts ***! + \**************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - 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.XmlDsigGost3411Url2012256 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256"; - cadesplugin.XmlDsigGost3410Url2012256 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256"; - cadesplugin.XmlDsigGost3411Url2012512 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-512"; - cadesplugin.XmlDsigGost3410Url2012512 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-512"; +"use strict"; - cadesplugin.CADESCOM_CADES_DEFAULT = 0; - cadesplugin.CADESCOM_CADES_BES = 1; - cadesplugin.CADESCOM_CADES_T = 0x5; - cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d; - cadesplugin.CADESCOM_PKCS7_TYPE = 0xffff; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.OIDS_DICTIONARY = { + '1.2.643.2.2.34.6': 'Пользователь Центра Регистрации', + '1.2.643.2.39.1.1': 'Использование в программных продуктах системы "1С:Предприятие 8"', + '1.2.643.3.131.1.1': 'ИНН', + '1.2.643.3.141.1.1': 'РНС ФСС', + '1.2.643.3.141.1.2': 'КП ФСС', + '1.2.643.3.2.100.65.13.11': 'Использование в системе АИС "Госзакупки" Сахалинской области.', + '1.2.643.3.8.100.1': 'Сертификат типа "ekey-ГОСТ"', + '1.2.643.3.8.100.1.1': 'Общее использование в системах ИОК без права заверения финансовых документов', + '1.2.643.3.8.100.1.10': 'Для участия в электронных торгах и подписания государственного контракта в информационных системах Тендерного комитета города Москвы уполномоченными лицами участников размещения государственного заказа города Москвы', + '1.2.643.3.8.100.1.11': 'Подписание электронных документов в автоматизированной информационной системе размещения государственного и муниципального заказа Саратовской области', + '1.2.643.3.8.100.1.12': 'Использование в системе государственного заказа Иркутской области', + '1.2.643.3.8.100.1.13': 'Использование в электронной торговой площадке агентства государственного заказа Красноярского края', + '1.2.643.3.8.100.1.14': 'Использование в электронной торговой площадке "Тендер"', + '1.2.643.3.8.100.1.2': 'Передача отчетности по ТКС', + '1.2.643.3.8.100.1.3': 'Оформление взаимных обязательств, соглашений, договоров, актов и т.п.', + '1.2.643.3.8.100.1.4': 'Внутрикорпоративный документооборот', + '1.2.643.3.8.100.1.5': 'Использование в системах электронной торговли', + '1.2.643.3.8.100.1.6': 'Использование в торгово-закупочной системе "ЭЛЕКТРА"', + '1.2.643.3.8.100.1.7': 'Использование в системе Портал государственных закупок Ставропольского края.', + '1.2.643.3.8.100.1.8': 'Использование в Единой системе электронной торговли B2B-Center и B2G.', + '1.2.643.3.8.100.1.9': 'Для участия в электронных торгах и подписания государственного контракта в электронной площадке ОАО «ЕЭТП» уполномоченными лицами участников размещения государственного или муниципального заказа', + '1.2.643.5.1.24.2.1.3': 'Формирование документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя', + '1.2.643.5.1.24.2.1.3.1': 'Формирование кадастровым инженером документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя', + '1.2.643.5.1.24.2.2.2': 'Формирование документов как результата оказания услуги со стороны органов регистрации прав', + '1.2.643.5.1.24.2.2.3': 'Формирование документов для получения государственных услуг в сфере государственной регистрации прав на недвижимое имущество и сделок с ним со стороны заявителя', + '1.2.643.6.2.1.7.1': 'Использование единоличным исполнительным органом юридического лица или уполномоченными представителями юридического лица в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских и иных прав и обязанностей в сфере негосударственного пенсионного обеспечения, негосударственного пенсионного страхования, в сфере деятельности паевых инвестиционных фондов, акционерных инвестиционных фондов, профессиональных участников рынка ценных бумаг, а также связанной с обслуживанием указанной деятельности услуг кредитных и иных организаций', + '1.2.643.6.2.1.7.2': 'Использование физическим лицом в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских прав и обязанностей в отношении инвестиционных паев паевых инвестиционных фондов, в том числе отношения, связанные с учетом и/или фиксацией прав на инвестиционные паи паевых инвестиционных фондов', + '1.2.643.6.3': 'Использование в электронных торговых системах и в программном обеспечении, связанным с обменом электронных сообщений', + '1.2.643.6.3.1.1': 'Использование на электронных площадок отобранных для проведения аукционах в электронной форме', + '1.2.643.6.3.1.2.1': 'Тип участника - Юридическое лицо', + '1.2.643.6.3.1.2.2': 'Тип участника - Физическое лицо', + '1.2.643.6.3.1.2.3': 'Тип участника - Индивидуальный предприниматель', + '1.2.643.6.3.1.3.1': 'Участник размещения заказа', + '1.2.643.6.3.1.4.1': 'Администратор организации', + '1.2.643.6.3.1.4.2': 'Уполномоченный специалист', + '1.2.643.6.3.1.4.3': 'Специалист с правом подписи контракта', + '1.2.840.113549.1.9.2': 'Неструктурированное имя', + '1.3.6.1.4.1.24138.1.1.8.1': 'Обеспечение юридической значимости в Системе "Электронная Торговая Площадка"', + '1.3.6.1.4.1.29919.21': 'Использование в системе Портал государственных закупок Ростовской области "Рефери".', + '1.3.6.1.5.5.7.3.2': 'Проверка подлинности клиента', + '1.3.6.1.5.5.7.3.4': 'Защищенная электронная почта', + '1.3.643.3.8.100.15': 'Использование в ЭТП "uTender"', +}; - 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; +/***/ "./constants/subject-tags-translations.ts": +/*!************************************************!*\ + !*** ./constants/subject-tags-translations.ts ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - 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; +"use strict"; - cadesplugin.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SUBJECT_TAGS_TRANSLATIONS = [ + { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' }, + { possibleNames: ['CN'], translation: 'Владелец' }, + { possibleNames: ['SN'], translation: 'Фамилия' }, + { possibleNames: ['G'], translation: 'Имя Отчество' }, + { possibleNames: ['C'], translation: 'Страна' }, + { possibleNames: ['S'], translation: 'Регион' }, + { possibleNames: ['STREET'], translation: 'Адрес' }, + { possibleNames: ['O'], translation: 'Компания' }, + { possibleNames: ['OU'], translation: 'Отдел/подразделение' }, + { possibleNames: ['T'], translation: 'Должность' }, + { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' }, + { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' }, + { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' }, + { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' }, + { possibleNames: ['E'], translation: 'Email' }, + { possibleNames: ['L'], translation: 'Город' }, +]; - 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; +/***/ "./crypto-pro.ts": +/*!***********************!*\ + !*** ./crypto-pro.ts ***! + \***********************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - 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_AUTHENTICATED_ATTRIBUTE_MACHINE_INFO = 0x100; - cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1; +"use strict"; - cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0; - cadesplugin.CADESCOM_BASE64_TO_BINARY = 1; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +Object.defineProperty(exports, "__esModule", { value: true }); +__export(__webpack_require__(/*! ./api */ "./api/index.ts")); - 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; +/***/ "./helpers/_afterPluginsLoaded.ts": +/*!****************************************!*\ + !*** ./helpers/_afterPluginsLoaded.ts ***! + \****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - cadesplugin.LOG_LEVEL_DEBUG = 4; - cadesplugin.LOG_LEVEL_INFO = 2; - cadesplugin.LOG_LEVEL_ERROR = 1; +"use strict"; - cadesplugin.CADESCOM_AllowNone = 0; - cadesplugin.CADESCOM_AllowNoOutstandingRequest = 0x1; - cadesplugin.CADESCOM_AllowUntrustedCertificate = 0x2; - cadesplugin.CADESCOM_AllowUntrustedRoot = 0x4; - cadesplugin.CADESCOM_SkipInstallToStore = 0x10000000; - cadesplugin.CADESCOM_InstallCertChainToContainer = 0x20000000; - cadesplugin.CADESCOM_UseContainerStore = 0x40000000; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ./_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +var isSetLogLevel = false; +var isPluginLoaded = false; +exports._afterPluginsLoaded = function (fn) { + var canPromise = Boolean(window.Promise); + return function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return __awaiter(this, void 0, void 0, function () { + var cadesplugin, error_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + if (!isPluginLoaded) { + try { + __webpack_require__(/*! cadesplugin_api.js */ "../node_modules/cadesplugin_api.js/dist/cadesplugin_api.js"); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подключении модуля для работы с Cades plugin'); + } + isPluginLoaded = true; + } + cadesplugin = window.cadesplugin; + if (!canPromise) { + throw new Error('Необходим полифилл для Promise'); + } + if (!cadesplugin) { + throw new Error('Не подключен модуль для работы с Cades plugin'); + } + if (!isSetLogLevel) { + cadesplugin.set_log_level(cadesplugin.LOG_LEVEL_ERROR); + isSetLogLevel = true; + } + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4 /*yield*/, cadesplugin]; + case 2: + _a.sent(); + return [3 /*break*/, 4]; + case 3: + error_1 = _a.sent(); + console.error(error_1); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error_1) || 'Ошибка при инициализации модуля для работы с Cades plugin'); + case 4: return [4 /*yield*/, fn.apply(this, args)]; + case 5: return [2 /*return*/, _a.sent()]; + } + }); + }); + }; +}; - cadesplugin.ENABLE_CARRIER_TYPE_CSP = 0x01; - cadesplugin.ENABLE_CARRIER_TYPE_FKC_NO_SM = 0x02; - cadesplugin.ENABLE_CARRIER_TYPE_FKC_SM = 0x04; - cadesplugin.ENABLE_ANY_CARRIER_TYPE = 0x07; - cadesplugin.DISABLE_EVERY_CARRIER_OPERATION = 0x00; - cadesplugin.ENABLE_CARRIER_OPEN_ENUM = 0x01; - cadesplugin.ENABLE_CARRIER_CREATE = 0x02; - cadesplugin.ENABLE_ANY_OPERATION = 0x03; +/***/ }), - cadesplugin.CADESCOM_PRODUCT_CSP = 0; - cadesplugin.CADESCOM_PRODUCT_OCSP = 1; - cadesplugin.CADESCOM_PRODUCT_TSP = 2; +/***/ "./helpers/_extractCommonName.ts": +/*!***************************************!*\ + !*** ./helpers/_extractCommonName.ts ***! + \***************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - cadesplugin.MEDIA_TYPE_REGISTRY = 0x00000001; - cadesplugin.MEDIA_TYPE_HDIMAGE = 0x00000002; - cadesplugin.MEDIA_TYPE_CLOUD = 0x00000004; - cadesplugin.MEDIA_TYPE_SCARD = 0x00000008; +"use strict"; - cadesplugin.XCN_CRYPT_STRING_BASE64HEADER = 0; - cadesplugin.AT_KEYEXCHANGE = 1; - cadesplugin.AT_SIGNATURE = 2; +Object.defineProperty(exports, "__esModule", { value: true }); +exports._extractCommonName = function (subjectName) { var _a; return (_a = subjectName.match(/CN=(.+?)(?:,|$)/)) === null || _a === void 0 ? void 0 : _a[1]; }; - cadesplugin.CARRIER_FLAG_REMOVABLE = 1; - cadesplugin.CARRIER_FLAG_UNIQUE = 2; - cadesplugin.CARRIER_FLAG_PROTECTED = 4; - cadesplugin.CARRIER_FLAG_FUNCTIONAL_CARRIER = 8; - cadesplugin.CARRIER_FLAG_SECURE_MESSAGING = 16; - cadesplugin.CARRIER_FLAG_ABLE_VISUALISE_SIGNATURE = 64; - cadesplugin.CARRIER_FLAG_VIRTUAL = 128; - } - function async_spawn(generatorFunc) { - function continuer(verb, arg) { - var result; - try { - result = generator[verb](arg); - } catch (err) { - return Promise.reject(err); - } - if (result.done) { - return result.value; - } else { - return Promise.resolve(result.value).then(onFulfilled, onRejected); - } - } - var generator = generatorFunc(Array.prototype.slice.call(arguments, 1)); - var onFulfilled = continuer.bind(continuer, "next"); - var onRejected = continuer.bind(continuer, "throw"); - return onFulfilled(); - } +/***/ }), - function isIE() { - // var retVal = (("Microsoft Internet Explorer" == navigator.appName) || // IE < 11 - // navigator.userAgent.match(/Trident\/./i)); // IE 11 - return (browserSpecs.name === 'IE' || browserSpecs.name === 'MSIE'); - } +/***/ "./helpers/_extractMeaningfulErrorMessage.ts": +/*!***************************************************!*\ + !*** ./helpers/_extractMeaningfulErrorMessage.ts ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - function isIOS() { - return (navigator.userAgent.match(/ipod/i) || - navigator.userAgent.match(/ipad/i) || - navigator.userAgent.match(/iphone/i)); - } +"use strict"; - function isNativeMessageSupported() - { - // В IE работаем через NPAPI - if(isIE()) - return false; - // В Edge работаем через NativeMessage - if (browserSpecs.name === 'Edg') { - return true; - } - if (browserSpecs.name === 'YaBrowser') { - isYandex = true; - return true; - } - // В Chrome, Firefox, Safari и Opera работаем через асинхронную версию в зависимости от версии - if(browserSpecs.name === 'Opera') { - isOpera = true; - if(browserSpecs.version >= 33){ - return true; - } - else{ - return false; - } - } - if(browserSpecs.name === 'Firefox') { - isFireFox = true; - if(browserSpecs.version >= 52){ - return true; - } - else{ - return false; - } - } - if(browserSpecs.name === 'Chrome') { - if(browserSpecs.version >= 42){ - return true; - } - else{ - return false; - } - } - //В Сафари начиная с 12 версии нет NPAPI - if(browserSpecs.name === 'Safari') { - isSafari = true; - if(browserSpecs.version >= 12) { - return true; - } else { - return false; - } +Object.defineProperty(exports, "__esModule", { value: true }); +exports._extractMeaningfulErrorMessage = function (error) { + var _a; + var errorContainer = ((_a = window.cadesplugin) === null || _a === void 0 ? void 0 : _a.getLastError) && window.cadesplugin.getLastError(error); + if (!(errorContainer === null || errorContainer === void 0 ? void 0 : errorContainer.message)) { + if (!error.message) { + return null; } + errorContainer = error; } - - // Функция активации объектов КриптоПро ЭЦП Browser plug-in - function CreateObject(name) { - if (isIOS()) { - // На iOS для создания объектов используется функция - // call_ru_cryptopro_npcades_10_native_bridge, определенная в IOS_npcades_supp.js - return call_ru_cryptopro_npcades_10_native_bridge("CreateObject", [name]); - } - if (isIE()) { - // В Internet Explorer создаются COM-объекты - if (name.match(/X509Enrollment/i)) { - try { - // Объекты CertEnroll пробуем создавать через нашу фабрику, - // если не получилось то через CX509EnrollmentWebClassFactory - var objCertEnrollClassFactory = document.getElementById("webClassFactory"); - return objCertEnrollClassFactory.CreateObject(name); - } - catch (e) { - try { - var objWebClassFactory = document.getElementById("certEnrollClassFactory"); - return objWebClassFactory.CreateObject(name); - } - catch (err) { - throw ("Для создания обьектов X509Enrollment следует настроить веб-узел на использование проверки подлинности по протоколу HTTPS"); - } - } - } - // Объекты CAPICOM и CAdESCOM создаются через CAdESCOM.WebClassFactory - try { - var objWebClassFactory = document.getElementById("webClassFactory"); - return objWebClassFactory.CreateObject(name); - } - catch (e) { - // Для версий плагина ниже 2.0.12538 - return new ActiveXObject(name); - } - } - // создаются объекты NPAPI - return pluginObject.CreateObject(name); + var containsRussianLetters = /[а-яА-Я]/.test(errorContainer.message); + if (!containsRussianLetters) { + return null; } + var searchResult = errorContainer.message.match(/^(.*?)(?:(?:\.?\s?\(?0x)|(?:\.?$))/); + return searchResult ? searchResult[1] : null; +}; - function decimalToHexString(number) { - if (number < 0) { - number = 0xFFFFFFFF + number + 1; - } - - return number.toString(16).toUpperCase(); - } - function GetMessageFromException(e) { - var err = e.message; - if (!err) { - err = e; - } else if (e.number) { - err += " (0x" + decimalToHexString(e.number) + ")"; - } - return err; - } +/***/ }), - function getLastError(exception) { - if(isNativeMessageSupported() || isIE() || isIOS() ) { - return GetMessageFromException(exception); - } +/***/ "./helpers/_generateCadesFn.ts": +/*!*************************************!*\ + !*** ./helpers/_generateCadesFn.ts ***! + \*************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - try { - return pluginObject.getLastError(); - } catch(e) { - return GetMessageFromException(exception); - } - } +"use strict"; - // Функция для удаления созданных объектов - function ReleasePluginObjects() { - return cpcsp_chrome_nmcades.ReleasePluginObjects(); +Object.defineProperty(exports, "__esModule", { value: true }); +// синтетические переменные, которые подменяются в рантайме +exports.__cadesAsyncToken__ = {}; +exports.__createCadesPluginObject__ = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; } - - // Функция активации асинхронных объектов КриптоПро ЭЦП Browser plug-in - function CreateObjectAsync(name) { - return pluginObject.CreateObjectAsync(name); + return ({}); +}; +function getGeneratorConstructor() { + return new Function('', 'return Object.getPrototypeOf(function*(){}).constructor')(); +} +exports._generateCadesFn = function (callback) { + var _a; + var cadesplugin = window.cadesplugin; + var cadesGeneratorsAPI = Boolean(cadesplugin.CreateObjectAsync); + var callbackName = callback.name || 'dynamicFn'; + var callbackLiteral = String(callback); + var callbackArguments = ((_a = callbackLiteral.match(/^function[\s\w]*?\((.*?)\)/)) === null || _a === void 0 ? void 0 : _a[1]) || ''; + var callbackBody = callbackLiteral.replace(/^.*?{([\s\S]*?)}$/, '$1'); + var crossEnvCallbackLiteral = String(new (cadesGeneratorsAPI ? getGeneratorConstructor() : Function)(callbackArguments, callbackBody)); + crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/(?:\w+?\.)?__createCadesPluginObject__(\([\s\S]*?\))/gm, "cadesplugin.CreateObject" + (cadesGeneratorsAPI ? 'Async' : '') + "$1"); + crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/(?:\w+?\.)?__cadesAsyncToken__\s*?\+\s*?\b/gm, cadesGeneratorsAPI ? 'yield ' : ''); + if (!cadesGeneratorsAPI) { + crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/propset_(.*?)\((.*?)\)/gm, '$1 = $2'); } + return [ + cadesGeneratorsAPI ? "cadesplugin.async_spawn(" + crossEnvCallbackLiteral + ");" : "(" + crossEnvCallbackLiteral + ")();", + "//# sourceURL=crypto-pro_" + callbackName + ".js", + ].join(''); +}; - //Функции для IOS - var ru_cryptopro_npcades_10_native_bridge = { - callbacksCount : 1, - callbacks : {}, - // Automatically called by native layer when a result is available - resultForCallback : function resultForCallback(callbackId, resultArray) { - var callback = ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId]; - if (!callback) return; - callback.apply(null,resultArray); - }, +/***/ }), - // Use this in javascript to request native objective-c code - // functionName : string (I think the name is explicit :p) - // args : array of arguments - // callback : function with n-arguments that is going to be called when the native code returned - call : function call(functionName, args, callback) { - var hasCallback = callback && typeof callback === "function"; - var callbackId = hasCallback ? ru_cryptopro_npcades_10_native_bridge.callbacksCount++ : 0; +/***/ "./helpers/_getCadesCert.ts": +/*!**********************************!*\ + !*** ./helpers/_getCadesCert.ts ***! + \**********************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - if (hasCallback) - ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId] = callback; +"use strict"; - var iframe = document.createElement("IFRAME"); - var arrObjs = new Array("_CPNP_handle"); - try{ - iframe.setAttribute("src", "cpnp-js-call:" + functionName + ":" + callbackId+ ":" + encodeURIComponent(JSON.stringify(args, arrObjs))); - } catch(e){ - alert(e); - } - document.documentElement.appendChild(iframe); - iframe.parentNode.removeChild(iframe); - iframe = null; +Object.defineProperty(exports, "__esModule", { value: true }); +var _afterPluginsLoaded_1 = __webpack_require__(/*! ./_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ./_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +var _generateCadesFn_1 = __webpack_require__(/*! ./_generateCadesFn */ "./helpers/_generateCadesFn.ts"); +/** + * Возвращает сертификат в формате Cades по отпечатку + * + * @param thumbprint - отпечаток сертификата + * @returns сертификат в формате Cades + */ +exports._getCadesCert = _afterPluginsLoaded_1._afterPluginsLoaded(function (thumbprint) { + var cadesplugin = window.cadesplugin; + return eval(_generateCadesFn_1._generateCadesFn(function _getCadesCert() { + var cadesStore; + try { + cadesStore = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.Store'); } - }; - - function call_ru_cryptopro_npcades_10_native_bridge(functionName, array){ - var tmpobj; - var ex; - ru_cryptopro_npcades_10_native_bridge.call(functionName, array, function(e, response){ - ex = e; - var str='tmpobj='+response; - eval(str); - if (typeof (tmpobj) === "string"){ - tmpobj = tmpobj.replace(/\\\n/gm, "\n"); - tmpobj = tmpobj.replace(/\\\r/gm, "\r"); - } - }); - if(ex) - throw ex; - return tmpobj; - } - - function show_firefox_missing_extension_dialog() - { - if (!window.cadesplugin_skip_extension_install) - { - var ovr = document.createElement('div'); - ovr.id = "cadesplugin_ovr"; - ovr.style = "visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)"; - ovr.innerHTML = "
" + - "" + - "

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

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

" + - "
"; - document.getElementsByTagName("Body")[0].appendChild(ovr); - document.getElementById("cadesplugin_close_install").addEventListener('click',function() - { - plugin_loaded_error("Плагин недоступен"); - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - }); - - ovr.addEventListener('click',function() - { - plugin_loaded_error("Плагин недоступен"); - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - }); - ovr.style.visibility="visible"; + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу'); } - } - function firefox_or_safari_nmcades_onload() { - if (window.cadesplugin_extension_loaded_callback) - window.cadesplugin_extension_loaded_callback(); - isFireFoxExtensionLoaded = true; - cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error); - } - - function nmcades_api_onload() { - if (!isIE() && !isFireFox && !isSafari) { - if (window.cadesplugin_extension_loaded_callback) - window.cadesplugin_extension_loaded_callback(); + if (!cadesStore) { + throw new Error('Не удалось получить доступ к хранилищу сертификатов'); } - window.postMessage("cadesplugin_echo_request", "*"); - window.addEventListener("message", function (event){ - if (typeof(event.data) !== "string" || !event.data.match("cadesplugin_loaded")) - return; - if (cadesplugin_loaded_event_recieved) - return; - if(isFireFox || isSafari) - { - // Для Firefox, Сафари вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js - var url = event.data.substring(event.data.indexOf("url:") + 4); - if (!url.match("^(moz|safari)-extension://[a-zA-Z0-9/_-]+/nmcades_plugin_api.js$")) - { - cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, "Bad url \"" + url + "\" for load CryptoPro Extension for CAdES Browser plug-in"); - plugin_loaded_error(); - return; - } - var fileref = document.createElement('script'); - fileref.setAttribute("type", "text/javascript"); - fileref.setAttribute("src", url); - fileref.onerror = plugin_loaded_error; - fileref.onload = firefox_or_safari_nmcades_onload; - document.getElementsByTagName("head")[0].appendChild(fileref); - }else { - cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error); - } - cadesplugin_loaded_event_recieved = true; - }, false); - } - - //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari - function load_extension() - { - if(isFireFox || isSafari){ - // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера. - nmcades_api_onload(); - } else { - // в асинхронном варианте для Yandex и Opera подключаем расширение из Opera store. - if (isOpera || isYandex) { - var fileref = document.createElement('script'); - fileref.setAttribute("type", "text/javascript"); - fileref.setAttribute("src", "chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js"); - fileref.onerror = plugin_loaded_error; - fileref.onload = nmcades_api_onload; - document.getElementsByTagName("head")[0].appendChild(fileref); - } else { - // для Chrome, Chromium, Chromium Edge расширение из Chrome store - var fileref = document.createElement('script'); - fileref.setAttribute("type", "text/javascript"); - fileref.setAttribute("src", "chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js"); - fileref.onerror = plugin_loaded_error; - fileref.onload = nmcades_api_onload; - document.getElementsByTagName("head")[0].appendChild(fileref); - } + try { + void (_generateCadesFn_1.__cadesAsyncToken__ + + cadesStore.Open(cadesplugin.CAPICOM_CURRENT_USER_STORE, cadesplugin.CAPICOM_MY_STORE, cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED)); } - } - - //Загружаем плагин для NPAPI - function load_npapi_plugin() - { - var elem = document.createElement('object'); - elem.setAttribute("id", "cadesplugin_object"); - elem.setAttribute("type", "application/x-cades"); - elem.setAttribute("style", "visibility: hidden"); - document.getElementsByTagName("body")[0].appendChild(elem); - pluginObject = document.getElementById("cadesplugin_object"); - if(isIE()) - { - var elem1 = document.createElement('object'); - elem1.setAttribute("id", "certEnrollClassFactory"); - elem1.setAttribute("classid", "clsid:884e2049-217d-11da-b2a4-000e7bbb2b09"); - elem1.setAttribute("style", "visibility: hidden"); - document.getElementsByTagName("body")[0].appendChild(elem1); - var elem2 = document.createElement('object'); - elem2.setAttribute("id", "webClassFactory"); - elem2.setAttribute("classid", "clsid:B04C8637-10BD-484E-B0DA-B8A039F60024"); - elem2.setAttribute("style", "visibility: hidden"); - document.getElementsByTagName("body")[0].appendChild(elem2); + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища'); } - } - - //Отправляем событие что все ок. - function plugin_loaded() - { - plugin_resolved = 1; - if(canPromise) - { - plugin_resolve(); - }else { - window.postMessage("cadesplugin_loaded", "*"); + var cadesCertificateList; + var certificatesCount; + try { + cadesCertificateList = _generateCadesFn_1.__cadesAsyncToken__ + cadesStore.Certificates; + certificatesCount = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Count; } - } - - //Отправляем событие что сломались. - function plugin_loaded_error(msg) - { - if(typeof(msg) === 'undefined' || typeof(msg) === 'object') - msg = "Плагин недоступен"; - plugin_resolved = 1; - if(canPromise) - { - plugin_reject(msg); - } else { - window.postMessage("cadesplugin_load_error", "*"); + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов'); } - } - - //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку - function check_load_timeout() - { - if(plugin_resolved === 1) - return; - if(isFireFox) - { - if (!isFireFoxExtensionLoaded) - show_firefox_missing_extension_dialog(); + if (!certificatesCount) { + throw new Error('Нет доступных сертификатов'); } - plugin_resolved = 1; - if(canPromise) - { - plugin_reject("Истекло время ожидания загрузки плагина"); - } else { - window.postMessage("cadesplugin_load_error", "*"); + var cadesCertificate; + try { + cadesCertificateList = + _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH, thumbprint); + var count = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Count; + if (!count) { + throw new Error("\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043A\u0430\u0442 \u0441 \u043E\u0442\u043F\u0435\u0447\u0430\u0442\u043A\u043E\u043C: \"" + thumbprint + "\" \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D"); + } + cadesCertificate = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Item(1); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при получении сертификата'); } + cadesStore.Close(); + return cadesCertificate; + })); +}); - } - //Вспомогательная функция для NPAPI - function createPromise(arg) - { - return new Promise(arg); - } +/***/ }), - function check_npapi_plugin (){ - try { - var oAbout = CreateObject("CAdESCOM.About"); - plugin_loaded(); - } - catch (err) { - document.getElementById("cadesplugin_object").style.display = 'none'; - // Объект создать не удалось, проверим, установлен ли - // вообще плагин. Такая возможность есть не во всех браузерах - var mimetype = navigator.mimeTypes["application/x-cades"]; - if (mimetype) { - var plugin = mimetype.enabledPlugin; - if (plugin) { - plugin_loaded_error("Плагин загружен, но не создаются обьекты"); - }else - { - plugin_loaded_error("Ошибка при загрузке плагина"); - } - }else - { - plugin_loaded_error("Плагин недоступен"); - } - } - } +/***/ "./helpers/_getDateObj.ts": +/*!********************************!*\ + !*** ./helpers/_getDateObj.ts ***! + \********************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - //Проверяем работает ли плагин - function check_plugin_working() - { - var div = document.createElement("div"); - div.innerHTML = ""; - var isIeLessThan9 = (div.getElementsByTagName("i").length === 1); - if (isIeLessThan9) { - plugin_loaded_error("Internet Explorer версии 8 и ниже не поддерживается"); - return; - } +"use strict"; - if(isNativeMessageSupported()) - { - load_extension(); - }else if(!canPromise) { - window.addEventListener("message", function (event){ - if (event.data !== "cadesplugin_echo_request") - return; - load_npapi_plugin(); - check_npapi_plugin(); - }, - false); - }else - { - if(document.readyState === "complete"){ - load_npapi_plugin(); - check_npapi_plugin(); - } else { - window.addEventListener("load", function (event) { - load_npapi_plugin(); - check_npapi_plugin(); - }, false); - } - } - } +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * Возвращает объект даты, совместимый с Cades plugin'ом, зависящий от браузера. + * + * В IE необходимо использовать специфичный формат "VT_DATE" + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Microsoft_Extensions/Date.getVarDate + */ +exports._getDateObj = function (dateObj) { return (dateObj.getVarDate ? dateObj.getVarDate() : dateObj); }; - function set_pluginObject(obj) - { - pluginObject = obj; - } - function is_capilite_enabled() - { - if ((typeof (cadesplugin.EnableInternalCSP) !== 'undefined') && cadesplugin.EnableInternalCSP) - return true; - return false; - }; +/***/ }), - function set_load_timeout() - { - if (window.cadesplugin_load_timeout) { - setTimeout(check_load_timeout, window.cadesplugin_load_timeout); - } - else { - setTimeout(check_load_timeout, 20000); - } - } +/***/ "./helpers/_isSupportedCSPVersion.ts": +/*!*******************************************!*\ + !*** ./helpers/_isSupportedCSPVersion.ts ***! + \*******************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - var onVisibilityChange = function (event) { - if (document.hidden === false) { - document.removeEventListener("visibilitychange", onVisibilityChange); - set_load_timeout(); - check_plugin_working(); - } - }; +"use strict"; - //Export - cadesplugin.JSModuleVersion = "2.3.5"; - cadesplugin.async_spawn = async_spawn; - cadesplugin.set = set_pluginObject; - cadesplugin.set_log_level = set_log_level; - cadesplugin.get_extension_version = get_extension_version; - cadesplugin.getLastError = getLastError; - cadesplugin.is_capilite_enabled = is_capilite_enabled; +Object.defineProperty(exports, "__esModule", { value: true }); +var oldestSupportedCSPVersion = 4.0; +exports._isSupportedCSPVersion = function (version) { + var _a; + version = (_a = version.match(/\d+?\b(?:\.\d+)?/)) === null || _a === void 0 ? void 0 : _a[0]; + return Number(version) >= oldestSupportedCSPVersion; +}; - if(isNativeMessageSupported()) - { - cadesplugin.CreateObjectAsync = CreateObjectAsync; - cadesplugin.ReleasePluginObjects = ReleasePluginObjects; - } - if(!isNativeMessageSupported()) - { - cadesplugin.CreateObject = CreateObject; +/***/ }), + +/***/ "./helpers/_isSupportedCadesVersion.ts": +/*!*********************************************!*\ + !*** ./helpers/_isSupportedCadesVersion.ts ***! + \*********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports._isSupportedCadesVersion = function (version) { + var match = version.match(/(\d+)\.(\d+)\.(\d+)/); + if (!match) { + return false; + } + var major = match[1], minor = match[2], patch = match[3]; + if (Number(major) < 2) { + return false; + } + if (Number(major) === 2 && Number(patch) < 12438) { + return false; } + return true; +}; - set_constantValues(); - cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR; - window.cadesplugin = cadesplugin; - if (isSafari && document.hidden) { - document.addEventListener("visibilitychange", onVisibilityChange); - return; +/***/ }), + +/***/ "./helpers/_parseCertInfo.ts": +/*!***********************************!*\ + !*** ./helpers/_parseCertInfo.ts ***! + \***********************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +var constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); +/** + * Парсит информацию из строки с информацией о сертификате + * + * @param tagsTranslations - словарь с расшифровками тэгов + * @param rawInfo - данные для парсинга + * @returns расшифрованная информация по отдельным тэгам + */ +exports._parseCertInfo = function (tagsTranslations, rawInfo) { + var extractedEntities = rawInfo.match(/([а-яА-Яa-zA-Z0-9\s.]+)=(?:("[^"]+?")|(.+?))(?:,|$)/g); + if (extractedEntities) { + return extractedEntities.map(function (group) { + var _a, _b, _c; + var segmentsMatch = group.trim().match(/^([а-яА-Яa-zA-Z0-9\s.]+)=(.+?),?$/); + var title = segmentsMatch === null || segmentsMatch === void 0 ? void 0 : segmentsMatch[1]; + // Вырезаем лишние кавычки + var description = (_b = (_a = segmentsMatch === null || segmentsMatch === void 0 ? void 0 : segmentsMatch[2]) === null || _a === void 0 ? void 0 : _a.replace(/^"(.*)"/, '$1')) === null || _b === void 0 ? void 0 : _b.replace(/"{2}/g, '"'); + var oidIdentifierMatch = title === null || title === void 0 ? void 0 : title.match(/^OID\.(.*)/); + var oidIdentifier = oidIdentifierMatch === null || oidIdentifierMatch === void 0 ? void 0 : oidIdentifierMatch[1]; + var isTranslated = false; + // Если нашли в тайтле ОИД, пытаемся его расшифровать + if (oidIdentifier) { + var oidTranslation = constants_1.OIDS_DICTIONARY[oidIdentifier]; + if (oidTranslation) { + title = oidTranslation; + isTranslated = true; + } + } + var tagTranslation = (_c = tagsTranslations.find(function (tag) { return tag.possibleNames.find(function (name) { return name === title; }); })) === null || _c === void 0 ? void 0 : _c.translation; + if (tagTranslation) { + title = tagTranslation; + isTranslated = true; + } + return { description: description, title: title, isTranslated: isTranslated }; + }); } - set_load_timeout(); - check_plugin_working(); -}()); +}; /***/ }) diff --git a/dist/crypto-pro.js.map b/dist/crypto-pro.js.map index 8e3e59a..25357f8 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/../node_modules/base64-js/index.js","webpack://cryptoPro/../node_modules/buffer/index.js","webpack://cryptoPro/../node_modules/ieee754/index.js","webpack://cryptoPro/../node_modules/isarray/index.js","webpack://cryptoPro/../node_modules/webpack/buildin/global.js","webpack://cryptoPro/./api/certificate/certificate.ts","webpack://cryptoPro/./api/certificate/exportBase64.ts","webpack://cryptoPro/./api/certificate/getAlgorithm.ts","webpack://cryptoPro/./api/certificate/getCadesProp.ts","webpack://cryptoPro/./api/certificate/getDecodedExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/getExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/getInfo.ts","webpack://cryptoPro/./api/certificate/hasExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/index.ts","webpack://cryptoPro/./api/certificate/isValid.ts","webpack://cryptoPro/./api/createAttachedSignature.ts","webpack://cryptoPro/./api/createDetachedSignature.ts","webpack://cryptoPro/./api/createHash.ts","webpack://cryptoPro/./api/createSignature.ts","webpack://cryptoPro/./api/createXMLSignature.ts","webpack://cryptoPro/./api/execute.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;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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;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,SAAS;AACT;;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;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;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;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;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;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;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,iBAAiB,mBAAmB,uBAAuB,uBAAuB,cAAc,mBAAmB,YAAY;AACpN,4EAA4E,iBAAiB,yBAAyB,WAAW;AACjI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA,aAAa;AACb;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;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;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,SAAS;AACT;AACA;AACA;;AAEA;AACA;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;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;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, AlgorithmInfo } 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\nexport interface 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 { 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 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 cadesAttrs;\n let cadesHashedData;\n let cadesSignedData;\n let cadesSigner;\n\n try {\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\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 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__ + 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 { TranscodeEncoding } from 'buffer';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\ntype Options = {\n hashedAlgorithm?: number;\n encoding?: TranscodeEncoding;\n};\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 * @hashedAlgorithm - алгоритм хеширования. По умолчанию - CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256.\n *\n * @returns хеш\n */\nexport const createHash = _afterPluginsLoaded(\n async (unencryptedMessage: string | ArrayBuffer, options?: Options): 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 if (options?.encoding && typeof unencryptedMessage === 'string') {\n messageBase64 = Buffer.from(unencryptedMessage, options?.encoding).toString('base64');\n } else {\n messageBase64 = Buffer.from(unencryptedMessage).toString('base64');\n }\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(\n options?.hashedAlgorithm ?? cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256,\n )\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 { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\nimport { _getCadesCert } from '../helpers/_getCadesCert';\n\n/**\n * Создает XML подпись для документа в формате XML\n *\n * @param thumbprint - отпечаток сертификата\n * @param unencryptedMessage - подписываемое сообщение в формате XML\n * @returns подпись\n */\nexport const createXMLSignature = _afterPluginsLoaded(\n async (thumbprint: string, unencryptedMessage: string): Promise => {\n const { cadesplugin } = window;\n const cadesCertificate = await _getCadesCert(thumbprint);\n\n return eval(\n _generateCadesFn(function createXMLSignature(): string {\n let cadesSigner;\n let cadesSignedXML;\n\n try {\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\n cadesSignedXML = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.SignedXML');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\n }\n\n try {\n const signatureMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256';\n const digestMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256';\n\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\n void (__cadesAsyncToken__ + cadesSigner.propset_CheckCertificate(true));\n void (__cadesAsyncToken__ + cadesSignedXML.propset_Content(unencryptedMessage));\n void (\n __cadesAsyncToken__ +\n cadesSignedXML.propset_SignatureType(cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED)\n );\n void (__cadesAsyncToken__ + cadesSignedXML.propset_SignatureMethod(signatureMethod));\n void (__cadesAsyncToken__ + cadesSignedXML.propset_DigestMethod(digestMethod));\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__ + cadesSignedXML.Sign(cadesSigner);\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 * Функция кастомной реализации с доступом к Cades плагину напрямую\n *\n * @callback executeCallback\n * @param exposedAPI - API доступные для кастомной реализации\n * @param exposedAPI.cadesplugin - Cades плагин, предоставляемый КриптоПРО\n * @param exposedAPI._generateCadesFn - функция, компилирующая тело передаваемой javascript функции для текущей среды\n * @param exposedAPI.__cadesAsyncToken__ - синтетический маркер, подменяемый в рантайме\n * @param exposedAPI.__createCadesPluginObject__ - функция для создания синхронных/асинхронных Cades объектов\n * @param exposedAPI._extractMeaningfulErrorMessage - хелпер для извлечения текста ошибки\n *\n * @returns результат выполнения кастомной реализации\n */\n\n/**\n * Компилирует и выполняет переданную функцию для доступной браузерной среды (синхронной/асинхронной)\n *\n * @param {executeCallback} callback - функция, использующая низкоуровневый доступ к Cades плагину\n *\n * @returns асинхронный результат выполнения передаваемой функции\n */\nexport const execute = _afterPluginsLoaded(\n async (\n callback: (exposedAPI: {\n cadesplugin: any;\n _generateCadesFn: (callback: Function) => string;\n __cadesAsyncToken__: object;\n __createCadesPluginObject__: (...args) => any;\n _extractMeaningfulErrorMessage: (error: Error) => string | null;\n }) => any,\n ): Promise =>\n await callback({\n cadesplugin: window.cadesplugin,\n _generateCadesFn,\n __cadesAsyncToken__,\n __createCadesPluginObject__,\n _extractMeaningfulErrorMessage,\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 './createXMLSignature';\nexport * from './createDetachedSignature';\nexport * from './createAttachedSignature';\nexport * from './createHash';\nexport * from './certificate';\nexport * from './execute';\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 isSafari = 0;\n var isYandex = 0;\n var canPromise = !!window.Promise;\n var cadesplugin_loaded_event_recieved = false;\n var isFireFoxExtensionLoaded = false;\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|yabrowser|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|Edg|YaBrowser)\\/(\\d+)/);\n if (tem != null)\n 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)\n 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 get_extension_version(callback) {\n window.postMessage(\"cadesplugin_extension_version_request\", \"*\");\n window.addEventListener(\"message\", function (event) {\n var resp_prefix = \"cadesplugin_extension_version_response:\";\n if (typeof (event.data) !== \"string\" || event.data.indexOf(resp_prefix) !== 0)\n return;\n ext_version = event.data.substring(resp_prefix.length);\n callback(ext_version);\n }, false);\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_MEMORY_STORE = 0;\n cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CAPICOM_CURRENT_USER_STORE = 2;\n cadesplugin.CAPICOM_SMART_CARD_USER_STORE = 4;\n cadesplugin.CADESCOM_MEMORY_STORE = 0;\n cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CADESCOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_SMART_CARD_USER_STORE = 4;\n cadesplugin.CADESCOM_CONTAINER_STORE = 100;\n\n cadesplugin.CAPICOM_MY_STORE = \"My\";\n\n cadesplugin.CAPICOM_STORE_OPEN_READ_WRITE = 1;\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.CADESCOM_XADES_DEFAULT = 0x00000010;\n cadesplugin.CADESCOM_XADES_BES = 0x00000020;\n cadesplugin.CADESCOM_XADES_T = 0x00000050;\n cadesplugin.CADESCOM_XADES_X_LONG_TYPE_1 = 0x000005d0;\n cadesplugin.CADESCOM_XMLDSIG_TYPE = 0x00000000;\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.XmlDsigGost3411Url2012256 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256\";\n cadesplugin.XmlDsigGost3410Url2012256 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256\";\n cadesplugin.XmlDsigGost3411Url2012512 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-512\";\n cadesplugin.XmlDsigGost3410Url2012512 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-512\";\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_AUTHENTICATED_ATTRIBUTE_MACHINE_INFO = 0x100;\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 cadesplugin.CADESCOM_InstallCertChainToContainer = 0x20000000;\n cadesplugin.CADESCOM_UseContainerStore = 0x40000000;\n\n cadesplugin.ENABLE_CARRIER_TYPE_CSP = 0x01;\n cadesplugin.ENABLE_CARRIER_TYPE_FKC_NO_SM = 0x02;\n cadesplugin.ENABLE_CARRIER_TYPE_FKC_SM = 0x04;\n cadesplugin.ENABLE_ANY_CARRIER_TYPE = 0x07;\n\n cadesplugin.DISABLE_EVERY_CARRIER_OPERATION = 0x00;\n cadesplugin.ENABLE_CARRIER_OPEN_ENUM = 0x01;\n cadesplugin.ENABLE_CARRIER_CREATE = 0x02;\n cadesplugin.ENABLE_ANY_OPERATION = 0x03;\n\n cadesplugin.CADESCOM_PRODUCT_CSP = 0;\n cadesplugin.CADESCOM_PRODUCT_OCSP = 1;\n cadesplugin.CADESCOM_PRODUCT_TSP = 2;\n\n cadesplugin.MEDIA_TYPE_REGISTRY = 0x00000001;\n cadesplugin.MEDIA_TYPE_HDIMAGE = 0x00000002;\n cadesplugin.MEDIA_TYPE_CLOUD = 0x00000004;\n cadesplugin.MEDIA_TYPE_SCARD = 0x00000008;\n\n cadesplugin.XCN_CRYPT_STRING_BASE64HEADER = 0;\n cadesplugin.AT_KEYEXCHANGE = 1;\n cadesplugin.AT_SIGNATURE = 2;\n\n cadesplugin.CARRIER_FLAG_REMOVABLE = 1;\n cadesplugin.CARRIER_FLAG_UNIQUE = 2;\n cadesplugin.CARRIER_FLAG_PROTECTED = 4;\n cadesplugin.CARRIER_FLAG_FUNCTIONAL_CARRIER = 8;\n cadesplugin.CARRIER_FLAG_SECURE_MESSAGING = 16;\n cadesplugin.CARRIER_FLAG_ABLE_VISUALISE_SIGNATURE = 64;\n cadesplugin.CARRIER_FLAG_VIRTUAL = 128;\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 === 'Edg') {\n return true;\n }\n if (browserSpecs.name === 'YaBrowser') {\n isYandex = 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 function firefox_or_safari_nmcades_onload() {\n if (window.cadesplugin_extension_loaded_callback)\n window.cadesplugin_extension_loaded_callback();\n isFireFoxExtensionLoaded = true;\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n\n function nmcades_api_onload() {\n if (!isIE() && !isFireFox && !isSafari) {\n if (window.cadesplugin_extension_loaded_callback)\n window.cadesplugin_extension_loaded_callback();\n }\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 (cadesplugin_loaded_event_recieved)\n return;\n if(isFireFox || isSafari)\n {\n // Для Firefox, Сафари вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js\n var url = event.data.substring(event.data.indexOf(\"url:\") + 4);\n if (!url.match(\"^(moz|safari)-extension://[a-zA-Z0-9/_-]+/nmcades_plugin_api.js$\"))\n {\n cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, \"Bad url \\\"\" + url + \"\\\" for load CryptoPro Extension for CAdES Browser plug-in\");\n plugin_loaded_error();\n return;\n }\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_safari_nmcades_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n }else {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n cadesplugin_loaded_event_recieved = true;\n }, false);\n }\n\n //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari\n function load_extension()\n {\n if(isFireFox || isSafari){\n // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера.\n nmcades_api_onload();\n } else {\n // в асинхронном варианте для Yandex и Opera подключаем расширение из Opera store.\n if (isOpera || isYandex) {\n var 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 } else {\n // для Chrome, Chromium, Chromium Edge расширение из Chrome store\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 }\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(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 if (!isFireFoxExtensionLoaded)\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 function set_load_timeout()\n {\n if (window.cadesplugin_load_timeout) {\n setTimeout(check_load_timeout, window.cadesplugin_load_timeout);\n }\n else {\n setTimeout(check_load_timeout, 20000);\n }\n }\n\n var onVisibilityChange = function (event) {\n if (document.hidden === false) {\n document.removeEventListener(\"visibilitychange\", onVisibilityChange);\n set_load_timeout();\n check_plugin_working();\n }\n };\n\n //Export\n cadesplugin.JSModuleVersion = \"2.3.5\";\n cadesplugin.async_spawn = async_spawn;\n cadesplugin.set = set_pluginObject;\n cadesplugin.set_log_level = set_log_level;\n cadesplugin.get_extension_version = get_extension_version;\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 set_constantValues();\n\n cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR;\n window.cadesplugin = cadesplugin;\n if (isSafari && document.hidden) {\n document.addEventListener(\"visibilitychange\", onVisibilityChange);\n return;\n }\n set_load_timeout();\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/cadesplugin_api.js/dist/cadesplugin_api.js","webpack://cryptoPro/../node_modules/ieee754/index.js","webpack://cryptoPro/../node_modules/isarray/index.js","webpack://cryptoPro/../node_modules/webpack/buildin/global.js","webpack://cryptoPro/./api/certificate/certificate.ts","webpack://cryptoPro/./api/certificate/exportBase64.ts","webpack://cryptoPro/./api/certificate/getAlgorithm.ts","webpack://cryptoPro/./api/certificate/getCadesProp.ts","webpack://cryptoPro/./api/certificate/getDecodedExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/getExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/getInfo.ts","webpack://cryptoPro/./api/certificate/hasExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/index.ts","webpack://cryptoPro/./api/certificate/isValid.ts","webpack://cryptoPro/./api/createAttachedSignature.ts","webpack://cryptoPro/./api/createDetachedSignature.ts","webpack://cryptoPro/./api/createHash.ts","webpack://cryptoPro/./api/createSignature.ts","webpack://cryptoPro/./api/createXMLSignature.ts","webpack://cryptoPro/./api/execute.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"],"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,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;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,SAAS;AACT;;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;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;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;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;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;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;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,iBAAiB,mBAAmB,uBAAuB,uBAAuB,cAAc,mBAAmB,YAAY;AACpN,4EAA4E,iBAAiB,yBAAyB,WAAW;AACjI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA,aAAa;AACb;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;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;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,SAAS;AACT;AACA;AACA;;AAEA;AACA;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;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;;;;;;;;;;;ACjwBD;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AAC,GAAG,IAAK,UAAG,CAAC,aAAa,CAAC,IAAI,CAAC,UAAC,IAAI,IAAK,WAAI,KAAK,KAAK,EAAd,CAAc,CAAC,EAAhD,CAAgD,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,SAAE,YAAY,gBAAE,CAAC;QAC9C,CAAC,CAAC,CAAC;KACJ;AACH,CAAC,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",";(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 isSafari = 0;\n var isYandex = 0;\n var canPromise = !!window.Promise;\n var cadesplugin_loaded_event_recieved = false;\n var isFireFoxExtensionLoaded = false;\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|yabrowser|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|Edg|YaBrowser)\\/(\\d+)/);\n if (tem != null)\n 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)\n 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 get_extension_version(callback) {\n window.postMessage(\"cadesplugin_extension_version_request\", \"*\");\n window.addEventListener(\"message\", function (event) {\n var resp_prefix = \"cadesplugin_extension_version_response:\";\n if (typeof (event.data) !== \"string\" || event.data.indexOf(resp_prefix) !== 0)\n return;\n ext_version = event.data.substring(resp_prefix.length);\n callback(ext_version);\n }, false);\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_MEMORY_STORE = 0;\n cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CAPICOM_CURRENT_USER_STORE = 2;\n cadesplugin.CAPICOM_SMART_CARD_USER_STORE = 4;\n cadesplugin.CADESCOM_MEMORY_STORE = 0;\n cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CADESCOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_SMART_CARD_USER_STORE = 4;\n cadesplugin.CADESCOM_CONTAINER_STORE = 100;\n\n cadesplugin.CAPICOM_MY_STORE = \"My\";\n\n cadesplugin.CAPICOM_STORE_OPEN_READ_WRITE = 1;\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.CADESCOM_XADES_DEFAULT = 0x00000010;\n cadesplugin.CADESCOM_XADES_BES = 0x00000020;\n cadesplugin.CADESCOM_XADES_T = 0x00000050;\n cadesplugin.CADESCOM_XADES_X_LONG_TYPE_1 = 0x000005d0;\n cadesplugin.CADESCOM_XMLDSIG_TYPE = 0x00000000;\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.XmlDsigGost3411Url2012256 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256\";\n cadesplugin.XmlDsigGost3410Url2012256 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256\";\n cadesplugin.XmlDsigGost3411Url2012512 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-512\";\n cadesplugin.XmlDsigGost3410Url2012512 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-512\";\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_AUTHENTICATED_ATTRIBUTE_MACHINE_INFO = 0x100;\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 cadesplugin.CADESCOM_InstallCertChainToContainer = 0x20000000;\n cadesplugin.CADESCOM_UseContainerStore = 0x40000000;\n\n cadesplugin.ENABLE_CARRIER_TYPE_CSP = 0x01;\n cadesplugin.ENABLE_CARRIER_TYPE_FKC_NO_SM = 0x02;\n cadesplugin.ENABLE_CARRIER_TYPE_FKC_SM = 0x04;\n cadesplugin.ENABLE_ANY_CARRIER_TYPE = 0x07;\n\n cadesplugin.DISABLE_EVERY_CARRIER_OPERATION = 0x00;\n cadesplugin.ENABLE_CARRIER_OPEN_ENUM = 0x01;\n cadesplugin.ENABLE_CARRIER_CREATE = 0x02;\n cadesplugin.ENABLE_ANY_OPERATION = 0x03;\n\n cadesplugin.CADESCOM_PRODUCT_CSP = 0;\n cadesplugin.CADESCOM_PRODUCT_OCSP = 1;\n cadesplugin.CADESCOM_PRODUCT_TSP = 2;\n\n cadesplugin.MEDIA_TYPE_REGISTRY = 0x00000001;\n cadesplugin.MEDIA_TYPE_HDIMAGE = 0x00000002;\n cadesplugin.MEDIA_TYPE_CLOUD = 0x00000004;\n cadesplugin.MEDIA_TYPE_SCARD = 0x00000008;\n\n cadesplugin.XCN_CRYPT_STRING_BASE64HEADER = 0;\n cadesplugin.AT_KEYEXCHANGE = 1;\n cadesplugin.AT_SIGNATURE = 2;\n\n cadesplugin.CARRIER_FLAG_REMOVABLE = 1;\n cadesplugin.CARRIER_FLAG_UNIQUE = 2;\n cadesplugin.CARRIER_FLAG_PROTECTED = 4;\n cadesplugin.CARRIER_FLAG_FUNCTIONAL_CARRIER = 8;\n cadesplugin.CARRIER_FLAG_SECURE_MESSAGING = 16;\n cadesplugin.CARRIER_FLAG_ABLE_VISUALISE_SIGNATURE = 64;\n cadesplugin.CARRIER_FLAG_VIRTUAL = 128;\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 === 'Edg') {\n return true;\n }\n if (browserSpecs.name === 'YaBrowser') {\n isYandex = 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 function firefox_or_safari_nmcades_onload() {\n if (window.cadesplugin_extension_loaded_callback)\n window.cadesplugin_extension_loaded_callback();\n isFireFoxExtensionLoaded = true;\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n\n function nmcades_api_onload() {\n if (!isIE() && !isFireFox && !isSafari) {\n if (window.cadesplugin_extension_loaded_callback)\n window.cadesplugin_extension_loaded_callback();\n }\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 (cadesplugin_loaded_event_recieved)\n return;\n if(isFireFox || isSafari)\n {\n // Для Firefox, Сафари вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js\n var url = event.data.substring(event.data.indexOf(\"url:\") + 4);\n if (!url.match(\"^(moz|safari)-extension://[a-zA-Z0-9/_-]+/nmcades_plugin_api.js$\"))\n {\n cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, \"Bad url \\\"\" + url + \"\\\" for load CryptoPro Extension for CAdES Browser plug-in\");\n plugin_loaded_error();\n return;\n }\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_safari_nmcades_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n }else {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n cadesplugin_loaded_event_recieved = true;\n }, false);\n }\n\n //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari\n function load_extension()\n {\n if(isFireFox || isSafari){\n // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера.\n nmcades_api_onload();\n } else {\n // в асинхронном варианте для Yandex и Opera подключаем расширение из Opera store.\n if (isOpera || isYandex) {\n var 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 } else {\n // для Chrome, Chromium, Chromium Edge расширение из Chrome store\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 }\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(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 if (!isFireFoxExtensionLoaded)\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 function set_load_timeout()\n {\n if (window.cadesplugin_load_timeout) {\n setTimeout(check_load_timeout, window.cadesplugin_load_timeout);\n }\n else {\n setTimeout(check_load_timeout, 20000);\n }\n }\n\n var onVisibilityChange = function (event) {\n if (document.hidden === false) {\n document.removeEventListener(\"visibilitychange\", onVisibilityChange);\n set_load_timeout();\n check_plugin_working();\n }\n };\n\n //Export\n cadesplugin.JSModuleVersion = \"2.3.5\";\n cadesplugin.async_spawn = async_spawn;\n cadesplugin.set = set_pluginObject;\n cadesplugin.set_log_level = set_log_level;\n cadesplugin.get_extension_version = get_extension_version;\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 set_constantValues();\n\n cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR;\n window.cadesplugin = cadesplugin;\n if (isSafari && document.hidden) {\n document.addEventListener(\"visibilitychange\", onVisibilityChange);\n return;\n }\n set_load_timeout();\n check_plugin_working();\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, AlgorithmInfo } 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\nexport interface 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 { 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 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 cadesAttrs;\n let cadesHashedData;\n let cadesSignedData;\n let cadesSigner;\n\n try {\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\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 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__ + 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 { TranscodeEncoding } from 'buffer';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\ntype Options = {\n hashedAlgorithm?: number;\n encoding?: TranscodeEncoding;\n};\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 * @hashedAlgorithm - алгоритм хеширования. По умолчанию - CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256.\n *\n * @returns хеш\n */\nexport const createHash = _afterPluginsLoaded(\n async (unencryptedMessage: string | ArrayBuffer, options?: Options): 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 if (options?.encoding && typeof unencryptedMessage === 'string') {\n messageBase64 = Buffer.from(unencryptedMessage, options?.encoding).toString('base64');\n } else {\n messageBase64 = Buffer.from(unencryptedMessage).toString('base64');\n }\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(\n options?.hashedAlgorithm ?? cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256,\n )\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 { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\nimport { _getCadesCert } from '../helpers/_getCadesCert';\n\n/**\n * Создает XML подпись для документа в формате XML\n *\n * @param thumbprint - отпечаток сертификата\n * @param unencryptedMessage - подписываемое сообщение в формате XML\n * @returns подпись\n */\nexport const createXMLSignature = _afterPluginsLoaded(\n async (thumbprint: string, unencryptedMessage: string): Promise => {\n const { cadesplugin } = window;\n const cadesCertificate = await _getCadesCert(thumbprint);\n\n return eval(\n _generateCadesFn(function createXMLSignature(): string {\n let cadesSigner;\n let cadesSignedXML;\n\n try {\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\n cadesSignedXML = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.SignedXML');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\n }\n\n try {\n const signatureMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256';\n const digestMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256';\n\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\n void (__cadesAsyncToken__ + cadesSigner.propset_CheckCertificate(true));\n void (__cadesAsyncToken__ + cadesSignedXML.propset_Content(unencryptedMessage));\n void (\n __cadesAsyncToken__ +\n cadesSignedXML.propset_SignatureType(cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED)\n );\n void (__cadesAsyncToken__ + cadesSignedXML.propset_SignatureMethod(signatureMethod));\n void (__cadesAsyncToken__ + cadesSignedXML.propset_DigestMethod(digestMethod));\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__ + cadesSignedXML.Sign(cadesSigner);\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 * Функция кастомной реализации с доступом к Cades плагину напрямую\n *\n * @callback executeCallback\n * @param exposedAPI - API доступные для кастомной реализации\n * @param exposedAPI.cadesplugin - Cades плагин, предоставляемый КриптоПРО\n * @param exposedAPI._generateCadesFn - функция, компилирующая тело передаваемой javascript функции для текущей среды\n * @param exposedAPI.__cadesAsyncToken__ - синтетический маркер, подменяемый в рантайме\n * @param exposedAPI.__createCadesPluginObject__ - функция для создания синхронных/асинхронных Cades объектов\n * @param exposedAPI._extractMeaningfulErrorMessage - хелпер для извлечения текста ошибки\n *\n * @returns результат выполнения кастомной реализации\n */\n\n/**\n * Компилирует и выполняет переданную функцию для доступной браузерной среды (синхронной/асинхронной)\n *\n * @param {executeCallback} callback - функция, использующая низкоуровневый доступ к Cades плагину\n *\n * @returns асинхронный результат выполнения передаваемой функции\n */\nexport const execute = _afterPluginsLoaded(\n async (\n callback: (exposedAPI: {\n cadesplugin: any;\n _generateCadesFn: (callback: Function) => string;\n __cadesAsyncToken__: object;\n __createCadesPluginObject__: (...args) => any;\n _extractMeaningfulErrorMessage: (error: Error) => string | null;\n }) => any,\n ): Promise =>\n await callback({\n cadesplugin: window.cadesplugin,\n _generateCadesFn,\n __cadesAsyncToken__,\n __createCadesPluginObject__,\n _extractMeaningfulErrorMessage,\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 './createXMLSignature';\nexport * from './createDetachedSignature';\nexport * from './createAttachedSignature';\nexport * from './createHash';\nexport * from './certificate';\nexport * from './execute';\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('cadesplugin_api.js');\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"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/crypto-pro.min.js.map b/dist/crypto-pro.min.js.map index 21dfa09..09a1895 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/./helpers/_getCadesCert.ts","webpack://cryptoPro/./helpers/_getDateObj.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/../node_modules/buffer/index.js","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/./api/createXMLSignature.ts","webpack://cryptoPro/./api/createDetachedSignature.ts","webpack://cryptoPro/./api/createAttachedSignature.ts","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","webpack://cryptoPro/./api/createHash.ts","webpack://cryptoPro/./api/execute.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","_getCadesCert","thumbprint","eval","cadesStore","cadesCertificateList","certificatesCount","cadesCertificate","Open","CAPICOM_CURRENT_USER_STORE","CAPICOM_MY_STORE","CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED","Certificates","Count","Find","CAPICOM_CERTIFICATE_FIND_SHA1_HASH","Item","Close","_getDateObj","dateObj","getVarDate","certificatesCache","getUserCertificates","resetCache","cadesCertificates","cadesCertificatesCount","CAPICOM_CERTIFICATE_FIND_TIME_VALID","CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY","CAPICOM_PROPID_KEY_PROV_INFO","certificateList","push","Certificate","_extractCommonName","SubjectName","IssuerName","Thumbprint","ValidFromDate","ValidToDate","getCadesProp","propName","_cadesCertificate","propertyValue","getSystemInfo","sysInfo","cadesVersion","cspVersion","cadesAbout","PluginVersion","CSPVersion","Version","toString","base64","ieee754","isArray","kMaxLength","Buffer","TYPED_ARRAY_SUPPORT","createBuffer","that","length","RangeError","Uint8Array","__proto__","arg","encodingOrOffset","allocUnsafe","from","TypeError","ArrayBuffer","array","byteOffset","byteLength","undefined","fromArrayLike","fromArrayBuffer","string","encoding","isEncoding","actual","write","slice","fromString","obj","isBuffer","len","checked","copy","buffer","val","type","data","fromObject","assertSize","size","isView","loweredCase","utf8ToBytes","base64ToBytes","toLowerCase","slowToString","start","end","hexSlice","utf8Slice","asciiSlice","latin1Slice","base64Slice","utf16leSlice","swap","b","bidirectionalIndexOf","dir","isNaN","arrayIndexOf","indexOf","lastIndexOf","arr","indexSize","arrLength","valLength","read","buf","readUInt16BE","foundIndex","found","j","hexWrite","offset","Number","remaining","strLen","parsed","parseInt","substr","utf8Write","blitBuffer","asciiWrite","str","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","e","typedArraySupport","poolSize","_augment","species","configurable","fill","allocUnsafeSlow","_isBuffer","compare","a","x","y","concat","list","pos","swap16","swap32","swap64","arguments","equals","inspect","max","target","thisStart","thisEnd","thisCopy","targetCopy","includes","isFinite","toJSON","Array","_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","set","code","INVALID_BASE64_RE","Infinity","leadSurrogate","toByteArray","trim","stringtrim","base64clean","src","dst","getCertificate","availableCertificates","foundCertificate","find","cert","pluginObject","plugin_resolved","plugin_reject","plugin_resolve","isOpera","isFireFox","isSafari","isYandex","cadesplugin_loaded_event_recieved","isFireFoxExtensionLoaded","resolve","reject","browserSpecs","check_browser","ru_cryptopro_npcades_10_native_bridge","callbacksCount","callbacks","resultForCallback","callbackId","resultArray","functionName","hasCallback","iframe","document","createElement","arrObjs","setAttribute","encodeURIComponent","JSON","stringify","alert","documentElement","appendChild","parentNode","removeChild","onVisibilityChange","event","hidden","removeEventListener","set_load_timeout","check_plugin_working","JSModuleVersion","async_spawn","set_pluginObject","get_extension_version","is_capilite_enabled","isNativeMessageSupported","ReleasePluginObjects","CreateObject","set_constantValues","current_log_level","addEventListener","tem","ua","navigator","userAgent","M","version","exec","appName","appVersion","splice","cpcsp_console_log","level","msg","LOG_LEVEL_DEBUG","log","LOG_LEVEL_INFO","info","postMessage","resp_prefix","ext_version","substring","CAPICOM_MEMORY_STORE","CAPICOM_LOCAL_MACHINE_STORE","CAPICOM_SMART_CARD_USER_STORE","CADESCOM_MEMORY_STORE","CADESCOM_LOCAL_MACHINE_STORE","CADESCOM_CURRENT_USER_STORE","CADESCOM_SMART_CARD_USER_STORE","CADESCOM_CONTAINER_STORE","CAPICOM_STORE_OPEN_READ_WRITE","CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME","CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED","CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING","CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE","CADESCOM_XADES_DEFAULT","CADESCOM_XADES_BES","CADESCOM_XADES_T","CADESCOM_XADES_X_LONG_TYPE_1","CADESCOM_XMLDSIG_TYPE","XmlDsigGost3410UrlObsolete","XmlDsigGost3411UrlObsolete","XmlDsigGost3410Url","XmlDsigGost3411Url","XmlDsigGost3411Url2012256","XmlDsigGost3410Url2012256","XmlDsigGost3411Url2012512","XmlDsigGost3410Url2012512","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_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_AUTHENTICATED_ATTRIBUTE_MACHINE_INFO","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","CADESCOM_InstallCertChainToContainer","CADESCOM_UseContainerStore","ENABLE_CARRIER_TYPE_CSP","ENABLE_CARRIER_TYPE_FKC_NO_SM","ENABLE_CARRIER_TYPE_FKC_SM","ENABLE_ANY_CARRIER_TYPE","DISABLE_EVERY_CARRIER_OPERATION","ENABLE_CARRIER_OPEN_ENUM","ENABLE_CARRIER_CREATE","ENABLE_ANY_OPERATION","CADESCOM_PRODUCT_CSP","CADESCOM_PRODUCT_OCSP","CADESCOM_PRODUCT_TSP","MEDIA_TYPE_REGISTRY","MEDIA_TYPE_HDIMAGE","MEDIA_TYPE_CLOUD","MEDIA_TYPE_SCARD","XCN_CRYPT_STRING_BASE64HEADER","AT_KEYEXCHANGE","AT_SIGNATURE","CARRIER_FLAG_REMOVABLE","CARRIER_FLAG_UNIQUE","CARRIER_FLAG_PROTECTED","CARRIER_FLAG_FUNCTIONAL_CARRIER","CARRIER_FLAG_SECURE_MESSAGING","CARRIER_FLAG_ABLE_VISUALISE_SIGNATURE","CARRIER_FLAG_VIRTUAL","generatorFunc","continuer","verb","result","generator","err","done","then","onFulfilled","onRejected","isIE","isIOS","call_ru_cryptopro_npcades_10_native_bridge","getElementById","ActiveXObject","decimalToHexString","number","toUpperCase","GetMessageFromException","exception","cpcsp_chrome_nmcades","tmpobj","ex","response","show_firefox_missing_extension_dialog","cadesplugin_skip_extension_install","ovr","id","style","innerHTML","getElementsByTagName","plugin_loaded_error","visibility","firefox_or_safari_nmcades_onload","cadesplugin_extension_loaded_callback","check_chrome_plugin","plugin_loaded","nmcades_api_onload","url","fileref","onerror","onload","load_extension","load_npapi_plugin","elem","elem1","elem2","check_load_timeout","createPromise","check_npapi_plugin","display","mimetype","mimeTypes","enabledPlugin","div","readyState","EnableInternalCSP","cadesplugin_load_timeout","setTimeout","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_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_STORE_OPEN_EXISTING_ONLY","CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED","CAPICOM_STORE_OPEN_READ_ONLY","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","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","title","description","oidIdentifierMatch","oidIdentifier","isTranslated","oidTranslation","tagTranslation","tag","certOids","every","oidToCheck","some","certOid","IsValid","Result","isValidSystemSetup","systemInfo","_isSupportedCadesVersion","_isSupportedCSPVersion","major","patch","createSignature","messageHash","detachedSignature","warn","cadesAttrs","cadesSignedData","cadesSigner","cadesAuthAttrs","signature","currentTime","Date","propset_Name","propset_Value","propset_Certificate","AuthenticatedAttributes2","Add","propset_ContentEncoding","propset_Content","propset_Options","SignCades","createXMLSignature","unencryptedMessage","cadesSignedXML","propset_CheckCertificate","propset_SignatureType","propset_SignatureMethod","propset_DigestMethod","Sign","createDetachedSignature","cadesHashedData","propset_Algorithm","SetHashValue","SignHash","createAttachedSignature","messageBase64","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","createHash","options","hash","hashedAlgorithm","propset_DataEncoding","Hash","execute"],"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,E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xuB,YAAgB/C,OAAM,YAEvB,CAAP,EAAO4E,KACL,mBAAAf,kBAAiB,W,MAEX0rB,EACAiC,EAFEtC,EAAkB,mBAAAvrB,oBAAsB,mBAAAC,4BAA4B,uBAI1E,IAEI2rB,GADEgC,mBAAO,EAAPA,QAASloB,WAA0C,iBAAvBqlB,mBACd1mB,OAAOW,KAAK+lB,mBAAoB6C,mBAAO,EAAPA,QAASloB,UAAU1B,SAAS,UAE5DK,OAAOW,KAAK+lB,oBAAoB/mB,SAAS,UAE3D,MAAOhF,GAGP,MAFAC,QAAQD,MAAMA,GAER,IAAIE,MAAM,gDAGlB,IAEI,mBAAAc,oBACAurB,EAAgBC,kBACU,QADO,EAC/BoC,mBAAO,EAAPA,QAASE,uBAAe,QAAI1uB,YAAYuc,+CAGtC,mBAAA3b,oBAAsBurB,EAAgBwC,qBAAqB3uB,YAAYqb,2BACvE,mBAAAza,oBAAsBurB,EAAgByC,KAAKpC,GACjD,MAAO5sB,GAGP,MAFAC,QAAQD,MAAMA,GAER,IAAIE,MAAM,iCAAAC,+BAA+BH,IAAU,wCAG3D,IACE6uB,EAAO,mBAAA7tB,oBAAsBurB,EAAgBtE,MAC7C,MAAOjoB,GAGP,MAFAC,QAAQD,MAAMA,GAER,IAAIE,MAAM,iCAAAC,+BAA+BH,IAAU,4BAG3D,OAAO6uB,kB,w/CChEf,WACA,OACA,OAuBa,EAAAI,QAAU,EAAAtvB,qBACrB,SACEwB,GAMS,0C,kDAET,SAAMA,EAAS,CACbf,YAAa/C,OAAO+C,YACpBc,iBAAgB,mBAChBF,oBAAmB,sBACnBC,4BAA2B,8BAC3Bd,+BAA8B,oC,OALhC","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 = 11);\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 } 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 { 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","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n","export * from './api';\n","export * from './getCertificate';\nexport * from './getUserCertificates';\nexport * from './getSystemInfo';\nexport * from './isValidSystemSetup';\nexport * from './createSignature';\nexport * from './createXMLSignature';\nexport * from './createDetachedSignature';\nexport * from './createAttachedSignature';\nexport * from './createHash';\nexport * from './certificate';\nexport * from './execute';\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 isSafari = 0;\n var isYandex = 0;\n var canPromise = !!window.Promise;\n var cadesplugin_loaded_event_recieved = false;\n var isFireFoxExtensionLoaded = false;\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|yabrowser|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|Edg|YaBrowser)\\/(\\d+)/);\n if (tem != null)\n 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)\n 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 get_extension_version(callback) {\n window.postMessage(\"cadesplugin_extension_version_request\", \"*\");\n window.addEventListener(\"message\", function (event) {\n var resp_prefix = \"cadesplugin_extension_version_response:\";\n if (typeof (event.data) !== \"string\" || event.data.indexOf(resp_prefix) !== 0)\n return;\n ext_version = event.data.substring(resp_prefix.length);\n callback(ext_version);\n }, false);\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_MEMORY_STORE = 0;\n cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CAPICOM_CURRENT_USER_STORE = 2;\n cadesplugin.CAPICOM_SMART_CARD_USER_STORE = 4;\n cadesplugin.CADESCOM_MEMORY_STORE = 0;\n cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CADESCOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_SMART_CARD_USER_STORE = 4;\n cadesplugin.CADESCOM_CONTAINER_STORE = 100;\n\n cadesplugin.CAPICOM_MY_STORE = \"My\";\n\n cadesplugin.CAPICOM_STORE_OPEN_READ_WRITE = 1;\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.CADESCOM_XADES_DEFAULT = 0x00000010;\n cadesplugin.CADESCOM_XADES_BES = 0x00000020;\n cadesplugin.CADESCOM_XADES_T = 0x00000050;\n cadesplugin.CADESCOM_XADES_X_LONG_TYPE_1 = 0x000005d0;\n cadesplugin.CADESCOM_XMLDSIG_TYPE = 0x00000000;\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.XmlDsigGost3411Url2012256 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256\";\n cadesplugin.XmlDsigGost3410Url2012256 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256\";\n cadesplugin.XmlDsigGost3411Url2012512 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-512\";\n cadesplugin.XmlDsigGost3410Url2012512 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-512\";\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_AUTHENTICATED_ATTRIBUTE_MACHINE_INFO = 0x100;\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 cadesplugin.CADESCOM_InstallCertChainToContainer = 0x20000000;\n cadesplugin.CADESCOM_UseContainerStore = 0x40000000;\n\n cadesplugin.ENABLE_CARRIER_TYPE_CSP = 0x01;\n cadesplugin.ENABLE_CARRIER_TYPE_FKC_NO_SM = 0x02;\n cadesplugin.ENABLE_CARRIER_TYPE_FKC_SM = 0x04;\n cadesplugin.ENABLE_ANY_CARRIER_TYPE = 0x07;\n\n cadesplugin.DISABLE_EVERY_CARRIER_OPERATION = 0x00;\n cadesplugin.ENABLE_CARRIER_OPEN_ENUM = 0x01;\n cadesplugin.ENABLE_CARRIER_CREATE = 0x02;\n cadesplugin.ENABLE_ANY_OPERATION = 0x03;\n\n cadesplugin.CADESCOM_PRODUCT_CSP = 0;\n cadesplugin.CADESCOM_PRODUCT_OCSP = 1;\n cadesplugin.CADESCOM_PRODUCT_TSP = 2;\n\n cadesplugin.MEDIA_TYPE_REGISTRY = 0x00000001;\n cadesplugin.MEDIA_TYPE_HDIMAGE = 0x00000002;\n cadesplugin.MEDIA_TYPE_CLOUD = 0x00000004;\n cadesplugin.MEDIA_TYPE_SCARD = 0x00000008;\n\n cadesplugin.XCN_CRYPT_STRING_BASE64HEADER = 0;\n cadesplugin.AT_KEYEXCHANGE = 1;\n cadesplugin.AT_SIGNATURE = 2;\n\n cadesplugin.CARRIER_FLAG_REMOVABLE = 1;\n cadesplugin.CARRIER_FLAG_UNIQUE = 2;\n cadesplugin.CARRIER_FLAG_PROTECTED = 4;\n cadesplugin.CARRIER_FLAG_FUNCTIONAL_CARRIER = 8;\n cadesplugin.CARRIER_FLAG_SECURE_MESSAGING = 16;\n cadesplugin.CARRIER_FLAG_ABLE_VISUALISE_SIGNATURE = 64;\n cadesplugin.CARRIER_FLAG_VIRTUAL = 128;\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 === 'Edg') {\n return true;\n }\n if (browserSpecs.name === 'YaBrowser') {\n isYandex = 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 function firefox_or_safari_nmcades_onload() {\n if (window.cadesplugin_extension_loaded_callback)\n window.cadesplugin_extension_loaded_callback();\n isFireFoxExtensionLoaded = true;\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n\n function nmcades_api_onload() {\n if (!isIE() && !isFireFox && !isSafari) {\n if (window.cadesplugin_extension_loaded_callback)\n window.cadesplugin_extension_loaded_callback();\n }\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 (cadesplugin_loaded_event_recieved)\n return;\n if(isFireFox || isSafari)\n {\n // Для Firefox, Сафари вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js\n var url = event.data.substring(event.data.indexOf(\"url:\") + 4);\n if (!url.match(\"^(moz|safari)-extension://[a-zA-Z0-9/_-]+/nmcades_plugin_api.js$\"))\n {\n cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, \"Bad url \\\"\" + url + \"\\\" for load CryptoPro Extension for CAdES Browser plug-in\");\n plugin_loaded_error();\n return;\n }\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_safari_nmcades_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n }else {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n cadesplugin_loaded_event_recieved = true;\n }, false);\n }\n\n //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari\n function load_extension()\n {\n if(isFireFox || isSafari){\n // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера.\n nmcades_api_onload();\n } else {\n // в асинхронном варианте для Yandex и Opera подключаем расширение из Opera store.\n if (isOpera || isYandex) {\n var 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 } else {\n // для Chrome, Chromium, Chromium Edge расширение из Chrome store\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 }\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(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 if (!isFireFoxExtensionLoaded)\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 function set_load_timeout()\n {\n if (window.cadesplugin_load_timeout) {\n setTimeout(check_load_timeout, window.cadesplugin_load_timeout);\n }\n else {\n setTimeout(check_load_timeout, 20000);\n }\n }\n\n var onVisibilityChange = function (event) {\n if (document.hidden === false) {\n document.removeEventListener(\"visibilitychange\", onVisibilityChange);\n set_load_timeout();\n check_plugin_working();\n }\n };\n\n //Export\n cadesplugin.JSModuleVersion = \"2.3.5\";\n cadesplugin.async_spawn = async_spawn;\n cadesplugin.set = set_pluginObject;\n cadesplugin.set_log_level = set_log_level;\n cadesplugin.get_extension_version = get_extension_version;\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 set_constantValues();\n\n cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR;\n window.cadesplugin = cadesplugin;\n if (isSafari && document.hidden) {\n document.addEventListener(\"visibilitychange\", onVisibilityChange);\n return;\n }\n set_load_timeout();\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, AlgorithmInfo } 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\nexport interface 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 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 { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\nimport { _getCadesCert } from '../helpers/_getCadesCert';\n\n/**\n * Создает XML подпись для документа в формате XML\n *\n * @param thumbprint - отпечаток сертификата\n * @param unencryptedMessage - подписываемое сообщение в формате XML\n * @returns подпись\n */\nexport const createXMLSignature = _afterPluginsLoaded(\n async (thumbprint: string, unencryptedMessage: string): Promise => {\n const { cadesplugin } = window;\n const cadesCertificate = await _getCadesCert(thumbprint);\n\n return eval(\n _generateCadesFn(function createXMLSignature(): string {\n let cadesSigner;\n let cadesSignedXML;\n\n try {\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\n cadesSignedXML = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.SignedXML');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\n }\n\n try {\n const signatureMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256';\n const digestMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256';\n\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\n void (__cadesAsyncToken__ + cadesSigner.propset_CheckCertificate(true));\n void (__cadesAsyncToken__ + cadesSignedXML.propset_Content(unencryptedMessage));\n void (\n __cadesAsyncToken__ +\n cadesSignedXML.propset_SignatureType(cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED)\n );\n void (__cadesAsyncToken__ + cadesSignedXML.propset_SignatureMethod(signatureMethod));\n void (__cadesAsyncToken__ + cadesSignedXML.propset_DigestMethod(digestMethod));\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__ + cadesSignedXML.Sign(cadesSigner);\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 { 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 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 cadesAttrs;\n let cadesHashedData;\n let cadesSignedData;\n let cadesSigner;\n\n try {\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\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 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__ + 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 { 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","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","import { TranscodeEncoding } from 'buffer';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\ntype Options = {\n hashedAlgorithm?: number;\n encoding?: TranscodeEncoding;\n};\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 * @hashedAlgorithm - алгоритм хеширования. По умолчанию - CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256.\n *\n * @returns хеш\n */\nexport const createHash = _afterPluginsLoaded(\n async (unencryptedMessage: string | ArrayBuffer, options?: Options): 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 if (options?.encoding && typeof unencryptedMessage === 'string') {\n messageBase64 = Buffer.from(unencryptedMessage, options?.encoding).toString('base64');\n } else {\n messageBase64 = Buffer.from(unencryptedMessage).toString('base64');\n }\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(\n options?.hashedAlgorithm ?? cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256,\n )\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 { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\n/**\n * Функция кастомной реализации с доступом к Cades плагину напрямую\n *\n * @callback executeCallback\n * @param exposedAPI - API доступные для кастомной реализации\n * @param exposedAPI.cadesplugin - Cades плагин, предоставляемый КриптоПРО\n * @param exposedAPI._generateCadesFn - функция, компилирующая тело передаваемой javascript функции для текущей среды\n * @param exposedAPI.__cadesAsyncToken__ - синтетический маркер, подменяемый в рантайме\n * @param exposedAPI.__createCadesPluginObject__ - функция для создания синхронных/асинхронных Cades объектов\n * @param exposedAPI._extractMeaningfulErrorMessage - хелпер для извлечения текста ошибки\n *\n * @returns результат выполнения кастомной реализации\n */\n\n/**\n * Компилирует и выполняет переданную функцию для доступной браузерной среды (синхронной/асинхронной)\n *\n * @param {executeCallback} callback - функция, использующая низкоуровневый доступ к Cades плагину\n *\n * @returns асинхронный результат выполнения передаваемой функции\n */\nexport const execute = _afterPluginsLoaded(\n async (\n callback: (exposedAPI: {\n cadesplugin: any;\n _generateCadesFn: (callback: Function) => string;\n __cadesAsyncToken__: object;\n __createCadesPluginObject__: (...args) => any;\n _extractMeaningfulErrorMessage: (error: Error) => string | null;\n }) => any,\n ): Promise =>\n await callback({\n cadesplugin: window.cadesplugin,\n _generateCadesFn,\n __cadesAsyncToken__,\n __createCadesPluginObject__,\n _extractMeaningfulErrorMessage,\n }),\n);\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/./helpers/_getCadesCert.ts","webpack://cryptoPro/./helpers/_getDateObj.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/../node_modules/buffer/index.js","webpack://cryptoPro/./crypto-pro.ts","webpack://cryptoPro/./api/index.ts","webpack://cryptoPro/./api/getCertificate.ts","webpack://cryptoPro/../node_modules/cadesplugin_api.js/dist/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/./api/createXMLSignature.ts","webpack://cryptoPro/./api/createDetachedSignature.ts","webpack://cryptoPro/./api/createAttachedSignature.ts","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","webpack://cryptoPro/./api/createHash.ts","webpack://cryptoPro/./api/execute.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","_getCadesCert","thumbprint","eval","cadesStore","cadesCertificateList","certificatesCount","cadesCertificate","Open","CAPICOM_CURRENT_USER_STORE","CAPICOM_MY_STORE","CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED","Certificates","Count","Find","CAPICOM_CERTIFICATE_FIND_SHA1_HASH","Item","Close","_getDateObj","dateObj","getVarDate","certificatesCache","getUserCertificates","resetCache","cadesCertificates","cadesCertificatesCount","CAPICOM_CERTIFICATE_FIND_TIME_VALID","CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY","CAPICOM_PROPID_KEY_PROV_INFO","certificateList","push","Certificate","_extractCommonName","SubjectName","IssuerName","Thumbprint","ValidFromDate","ValidToDate","getCadesProp","propName","_cadesCertificate","propertyValue","getSystemInfo","sysInfo","cadesVersion","cspVersion","cadesAbout","PluginVersion","CSPVersion","Version","toString","base64","ieee754","isArray","kMaxLength","Buffer","TYPED_ARRAY_SUPPORT","createBuffer","that","length","RangeError","Uint8Array","__proto__","arg","encodingOrOffset","allocUnsafe","from","TypeError","ArrayBuffer","array","byteOffset","byteLength","undefined","fromArrayLike","fromArrayBuffer","string","encoding","isEncoding","actual","write","slice","fromString","obj","isBuffer","len","checked","copy","buffer","val","type","data","fromObject","assertSize","size","isView","loweredCase","utf8ToBytes","base64ToBytes","toLowerCase","slowToString","start","end","hexSlice","utf8Slice","asciiSlice","latin1Slice","base64Slice","utf16leSlice","swap","b","bidirectionalIndexOf","dir","isNaN","arrayIndexOf","indexOf","lastIndexOf","arr","indexSize","arrLength","valLength","read","buf","readUInt16BE","foundIndex","found","j","hexWrite","offset","Number","remaining","strLen","parsed","parseInt","substr","utf8Write","blitBuffer","asciiWrite","str","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","e","typedArraySupport","poolSize","_augment","species","configurable","fill","allocUnsafeSlow","_isBuffer","compare","a","x","y","concat","list","pos","swap16","swap32","swap64","arguments","equals","inspect","max","target","thisStart","thisEnd","thisCopy","targetCopy","includes","isFinite","toJSON","Array","_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","set","code","INVALID_BASE64_RE","Infinity","leadSurrogate","toByteArray","trim","stringtrim","base64clean","src","dst","getCertificate","availableCertificates","foundCertificate","find","cert","pluginObject","plugin_resolved","plugin_reject","plugin_resolve","isOpera","isFireFox","isSafari","isYandex","cadesplugin_loaded_event_recieved","isFireFoxExtensionLoaded","resolve","reject","browserSpecs","check_browser","ru_cryptopro_npcades_10_native_bridge","callbacksCount","callbacks","resultForCallback","callbackId","resultArray","functionName","hasCallback","iframe","document","createElement","arrObjs","setAttribute","encodeURIComponent","JSON","stringify","alert","documentElement","appendChild","parentNode","removeChild","onVisibilityChange","event","hidden","removeEventListener","set_load_timeout","check_plugin_working","JSModuleVersion","async_spawn","set_pluginObject","get_extension_version","is_capilite_enabled","isNativeMessageSupported","ReleasePluginObjects","CreateObject","set_constantValues","current_log_level","addEventListener","tem","ua","navigator","userAgent","M","version","exec","appName","appVersion","splice","cpcsp_console_log","level","msg","LOG_LEVEL_DEBUG","log","LOG_LEVEL_INFO","info","postMessage","resp_prefix","ext_version","substring","CAPICOM_MEMORY_STORE","CAPICOM_LOCAL_MACHINE_STORE","CAPICOM_SMART_CARD_USER_STORE","CADESCOM_MEMORY_STORE","CADESCOM_LOCAL_MACHINE_STORE","CADESCOM_CURRENT_USER_STORE","CADESCOM_SMART_CARD_USER_STORE","CADESCOM_CONTAINER_STORE","CAPICOM_STORE_OPEN_READ_WRITE","CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME","CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED","CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING","CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE","CADESCOM_XADES_DEFAULT","CADESCOM_XADES_BES","CADESCOM_XADES_T","CADESCOM_XADES_X_LONG_TYPE_1","CADESCOM_XMLDSIG_TYPE","XmlDsigGost3410UrlObsolete","XmlDsigGost3411UrlObsolete","XmlDsigGost3410Url","XmlDsigGost3411Url","XmlDsigGost3411Url2012256","XmlDsigGost3410Url2012256","XmlDsigGost3411Url2012512","XmlDsigGost3410Url2012512","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_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_AUTHENTICATED_ATTRIBUTE_MACHINE_INFO","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","CADESCOM_InstallCertChainToContainer","CADESCOM_UseContainerStore","ENABLE_CARRIER_TYPE_CSP","ENABLE_CARRIER_TYPE_FKC_NO_SM","ENABLE_CARRIER_TYPE_FKC_SM","ENABLE_ANY_CARRIER_TYPE","DISABLE_EVERY_CARRIER_OPERATION","ENABLE_CARRIER_OPEN_ENUM","ENABLE_CARRIER_CREATE","ENABLE_ANY_OPERATION","CADESCOM_PRODUCT_CSP","CADESCOM_PRODUCT_OCSP","CADESCOM_PRODUCT_TSP","MEDIA_TYPE_REGISTRY","MEDIA_TYPE_HDIMAGE","MEDIA_TYPE_CLOUD","MEDIA_TYPE_SCARD","XCN_CRYPT_STRING_BASE64HEADER","AT_KEYEXCHANGE","AT_SIGNATURE","CARRIER_FLAG_REMOVABLE","CARRIER_FLAG_UNIQUE","CARRIER_FLAG_PROTECTED","CARRIER_FLAG_FUNCTIONAL_CARRIER","CARRIER_FLAG_SECURE_MESSAGING","CARRIER_FLAG_ABLE_VISUALISE_SIGNATURE","CARRIER_FLAG_VIRTUAL","generatorFunc","continuer","verb","result","generator","err","done","then","onFulfilled","onRejected","isIE","isIOS","call_ru_cryptopro_npcades_10_native_bridge","getElementById","ActiveXObject","decimalToHexString","number","toUpperCase","GetMessageFromException","exception","cpcsp_chrome_nmcades","tmpobj","ex","response","show_firefox_missing_extension_dialog","cadesplugin_skip_extension_install","ovr","id","style","innerHTML","getElementsByTagName","plugin_loaded_error","visibility","firefox_or_safari_nmcades_onload","cadesplugin_extension_loaded_callback","check_chrome_plugin","plugin_loaded","nmcades_api_onload","url","fileref","onerror","onload","load_extension","load_npapi_plugin","elem","elem1","elem2","check_load_timeout","createPromise","check_npapi_plugin","display","mimetype","mimeTypes","enabledPlugin","div","readyState","EnableInternalCSP","cadesplugin_load_timeout","setTimeout","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_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_STORE_OPEN_EXISTING_ONLY","CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED","CAPICOM_STORE_OPEN_READ_ONLY","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","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","title","description","oidIdentifierMatch","oidIdentifier","isTranslated","oidTranslation","tagTranslation","tag","certOids","every","oidToCheck","some","certOid","IsValid","Result","isValidSystemSetup","systemInfo","_isSupportedCadesVersion","_isSupportedCSPVersion","major","patch","createSignature","messageHash","detachedSignature","warn","cadesAttrs","cadesSignedData","cadesSigner","cadesAuthAttrs","signature","currentTime","Date","propset_Name","propset_Value","propset_Certificate","AuthenticatedAttributes2","Add","propset_ContentEncoding","propset_Content","propset_Options","SignCades","createXMLSignature","unencryptedMessage","cadesSignedXML","propset_CheckCertificate","propset_SignatureType","propset_SignatureMethod","propset_DigestMethod","Sign","createDetachedSignature","cadesHashedData","propset_Algorithm","SetHashValue","SignHash","createAttachedSignature","messageBase64","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","createHash","options","hash","hashedAlgorithm","propset_DataEncoding","Hash","execute"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,m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AU,wCAG3D,IACE6uB,EAAO,mBAAA7tB,oBAAsBurB,EAAgBtE,MAC7C,MAAOjoB,GAGP,MAFAC,QAAQD,MAAMA,GAER,IAAIE,MAAM,iCAAAC,+BAA+BH,IAAU,4BAG3D,OAAO6uB,kB,w/CChEf,WACA,OACA,OAuBa,EAAAI,QAAU,EAAAtvB,qBACrB,SACEwB,GAMS,0C,kDAET,SAAMA,EAAS,CACbf,YAAa/C,OAAO+C,YACpBc,iBAAgB,mBAChBF,oBAAmB,sBACnBC,4BAA2B,8BAC3Bd,+BAA8B,oC,OALhC","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 = 11);\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('cadesplugin_api.js');\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 } 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 { 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","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n","export * from './api';\n","export * from './getCertificate';\nexport * from './getUserCertificates';\nexport * from './getSystemInfo';\nexport * from './isValidSystemSetup';\nexport * from './createSignature';\nexport * from './createXMLSignature';\nexport * from './createDetachedSignature';\nexport * from './createAttachedSignature';\nexport * from './createHash';\nexport * from './certificate';\nexport * from './execute';\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 isSafari = 0;\n var isYandex = 0;\n var canPromise = !!window.Promise;\n var cadesplugin_loaded_event_recieved = false;\n var isFireFoxExtensionLoaded = false;\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|yabrowser|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|Edg|YaBrowser)\\/(\\d+)/);\n if (tem != null)\n 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)\n 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 get_extension_version(callback) {\n window.postMessage(\"cadesplugin_extension_version_request\", \"*\");\n window.addEventListener(\"message\", function (event) {\n var resp_prefix = \"cadesplugin_extension_version_response:\";\n if (typeof (event.data) !== \"string\" || event.data.indexOf(resp_prefix) !== 0)\n return;\n ext_version = event.data.substring(resp_prefix.length);\n callback(ext_version);\n }, false);\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_MEMORY_STORE = 0;\n cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CAPICOM_CURRENT_USER_STORE = 2;\n cadesplugin.CAPICOM_SMART_CARD_USER_STORE = 4;\n cadesplugin.CADESCOM_MEMORY_STORE = 0;\n cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CADESCOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_SMART_CARD_USER_STORE = 4;\n cadesplugin.CADESCOM_CONTAINER_STORE = 100;\n\n cadesplugin.CAPICOM_MY_STORE = \"My\";\n\n cadesplugin.CAPICOM_STORE_OPEN_READ_WRITE = 1;\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.CADESCOM_XADES_DEFAULT = 0x00000010;\n cadesplugin.CADESCOM_XADES_BES = 0x00000020;\n cadesplugin.CADESCOM_XADES_T = 0x00000050;\n cadesplugin.CADESCOM_XADES_X_LONG_TYPE_1 = 0x000005d0;\n cadesplugin.CADESCOM_XMLDSIG_TYPE = 0x00000000;\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.XmlDsigGost3411Url2012256 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256\";\n cadesplugin.XmlDsigGost3410Url2012256 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256\";\n cadesplugin.XmlDsigGost3411Url2012512 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-512\";\n cadesplugin.XmlDsigGost3410Url2012512 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-512\";\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_AUTHENTICATED_ATTRIBUTE_MACHINE_INFO = 0x100;\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 cadesplugin.CADESCOM_InstallCertChainToContainer = 0x20000000;\n cadesplugin.CADESCOM_UseContainerStore = 0x40000000;\n\n cadesplugin.ENABLE_CARRIER_TYPE_CSP = 0x01;\n cadesplugin.ENABLE_CARRIER_TYPE_FKC_NO_SM = 0x02;\n cadesplugin.ENABLE_CARRIER_TYPE_FKC_SM = 0x04;\n cadesplugin.ENABLE_ANY_CARRIER_TYPE = 0x07;\n\n cadesplugin.DISABLE_EVERY_CARRIER_OPERATION = 0x00;\n cadesplugin.ENABLE_CARRIER_OPEN_ENUM = 0x01;\n cadesplugin.ENABLE_CARRIER_CREATE = 0x02;\n cadesplugin.ENABLE_ANY_OPERATION = 0x03;\n\n cadesplugin.CADESCOM_PRODUCT_CSP = 0;\n cadesplugin.CADESCOM_PRODUCT_OCSP = 1;\n cadesplugin.CADESCOM_PRODUCT_TSP = 2;\n\n cadesplugin.MEDIA_TYPE_REGISTRY = 0x00000001;\n cadesplugin.MEDIA_TYPE_HDIMAGE = 0x00000002;\n cadesplugin.MEDIA_TYPE_CLOUD = 0x00000004;\n cadesplugin.MEDIA_TYPE_SCARD = 0x00000008;\n\n cadesplugin.XCN_CRYPT_STRING_BASE64HEADER = 0;\n cadesplugin.AT_KEYEXCHANGE = 1;\n cadesplugin.AT_SIGNATURE = 2;\n\n cadesplugin.CARRIER_FLAG_REMOVABLE = 1;\n cadesplugin.CARRIER_FLAG_UNIQUE = 2;\n cadesplugin.CARRIER_FLAG_PROTECTED = 4;\n cadesplugin.CARRIER_FLAG_FUNCTIONAL_CARRIER = 8;\n cadesplugin.CARRIER_FLAG_SECURE_MESSAGING = 16;\n cadesplugin.CARRIER_FLAG_ABLE_VISUALISE_SIGNATURE = 64;\n cadesplugin.CARRIER_FLAG_VIRTUAL = 128;\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 === 'Edg') {\n return true;\n }\n if (browserSpecs.name === 'YaBrowser') {\n isYandex = 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 function firefox_or_safari_nmcades_onload() {\n if (window.cadesplugin_extension_loaded_callback)\n window.cadesplugin_extension_loaded_callback();\n isFireFoxExtensionLoaded = true;\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n\n function nmcades_api_onload() {\n if (!isIE() && !isFireFox && !isSafari) {\n if (window.cadesplugin_extension_loaded_callback)\n window.cadesplugin_extension_loaded_callback();\n }\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 (cadesplugin_loaded_event_recieved)\n return;\n if(isFireFox || isSafari)\n {\n // Для Firefox, Сафари вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js\n var url = event.data.substring(event.data.indexOf(\"url:\") + 4);\n if (!url.match(\"^(moz|safari)-extension://[a-zA-Z0-9/_-]+/nmcades_plugin_api.js$\"))\n {\n cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, \"Bad url \\\"\" + url + \"\\\" for load CryptoPro Extension for CAdES Browser plug-in\");\n plugin_loaded_error();\n return;\n }\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_safari_nmcades_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n }else {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n cadesplugin_loaded_event_recieved = true;\n }, false);\n }\n\n //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari\n function load_extension()\n {\n if(isFireFox || isSafari){\n // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера.\n nmcades_api_onload();\n } else {\n // в асинхронном варианте для Yandex и Opera подключаем расширение из Opera store.\n if (isOpera || isYandex) {\n var 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 } else {\n // для Chrome, Chromium, Chromium Edge расширение из Chrome store\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 }\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(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 if (!isFireFoxExtensionLoaded)\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 function set_load_timeout()\n {\n if (window.cadesplugin_load_timeout) {\n setTimeout(check_load_timeout, window.cadesplugin_load_timeout);\n }\n else {\n setTimeout(check_load_timeout, 20000);\n }\n }\n\n var onVisibilityChange = function (event) {\n if (document.hidden === false) {\n document.removeEventListener(\"visibilitychange\", onVisibilityChange);\n set_load_timeout();\n check_plugin_working();\n }\n };\n\n //Export\n cadesplugin.JSModuleVersion = \"2.3.5\";\n cadesplugin.async_spawn = async_spawn;\n cadesplugin.set = set_pluginObject;\n cadesplugin.set_log_level = set_log_level;\n cadesplugin.get_extension_version = get_extension_version;\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 set_constantValues();\n\n cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR;\n window.cadesplugin = cadesplugin;\n if (isSafari && document.hidden) {\n document.addEventListener(\"visibilitychange\", onVisibilityChange);\n return;\n }\n set_load_timeout();\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, AlgorithmInfo } 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\nexport interface 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 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 { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\nimport { _getCadesCert } from '../helpers/_getCadesCert';\n\n/**\n * Создает XML подпись для документа в формате XML\n *\n * @param thumbprint - отпечаток сертификата\n * @param unencryptedMessage - подписываемое сообщение в формате XML\n * @returns подпись\n */\nexport const createXMLSignature = _afterPluginsLoaded(\n async (thumbprint: string, unencryptedMessage: string): Promise => {\n const { cadesplugin } = window;\n const cadesCertificate = await _getCadesCert(thumbprint);\n\n return eval(\n _generateCadesFn(function createXMLSignature(): string {\n let cadesSigner;\n let cadesSignedXML;\n\n try {\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\n cadesSignedXML = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.SignedXML');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\n }\n\n try {\n const signatureMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256';\n const digestMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256';\n\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\n void (__cadesAsyncToken__ + cadesSigner.propset_CheckCertificate(true));\n void (__cadesAsyncToken__ + cadesSignedXML.propset_Content(unencryptedMessage));\n void (\n __cadesAsyncToken__ +\n cadesSignedXML.propset_SignatureType(cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED)\n );\n void (__cadesAsyncToken__ + cadesSignedXML.propset_SignatureMethod(signatureMethod));\n void (__cadesAsyncToken__ + cadesSignedXML.propset_DigestMethod(digestMethod));\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__ + cadesSignedXML.Sign(cadesSigner);\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 { 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 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 cadesAttrs;\n let cadesHashedData;\n let cadesSignedData;\n let cadesSigner;\n\n try {\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\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 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__ + 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 { 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","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","exports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","import { TranscodeEncoding } from 'buffer';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\ntype Options = {\n hashedAlgorithm?: number;\n encoding?: TranscodeEncoding;\n};\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 * @hashedAlgorithm - алгоритм хеширования. По умолчанию - CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256.\n *\n * @returns хеш\n */\nexport const createHash = _afterPluginsLoaded(\n async (unencryptedMessage: string | ArrayBuffer, options?: Options): 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 if (options?.encoding && typeof unencryptedMessage === 'string') {\n messageBase64 = Buffer.from(unencryptedMessage, options?.encoding).toString('base64');\n } else {\n messageBase64 = Buffer.from(unencryptedMessage).toString('base64');\n }\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(\n options?.hashedAlgorithm ?? cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256,\n )\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 { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\n/**\n * Функция кастомной реализации с доступом к Cades плагину напрямую\n *\n * @callback executeCallback\n * @param exposedAPI - API доступные для кастомной реализации\n * @param exposedAPI.cadesplugin - Cades плагин, предоставляемый КриптоПРО\n * @param exposedAPI._generateCadesFn - функция, компилирующая тело передаваемой javascript функции для текущей среды\n * @param exposedAPI.__cadesAsyncToken__ - синтетический маркер, подменяемый в рантайме\n * @param exposedAPI.__createCadesPluginObject__ - функция для создания синхронных/асинхронных Cades объектов\n * @param exposedAPI._extractMeaningfulErrorMessage - хелпер для извлечения текста ошибки\n *\n * @returns результат выполнения кастомной реализации\n */\n\n/**\n * Компилирует и выполняет переданную функцию для доступной браузерной среды (синхронной/асинхронной)\n *\n * @param {executeCallback} callback - функция, использующая низкоуровневый доступ к Cades плагину\n *\n * @returns асинхронный результат выполнения передаваемой функции\n */\nexport const execute = _afterPluginsLoaded(\n async (\n callback: (exposedAPI: {\n cadesplugin: any;\n _generateCadesFn: (callback: Function) => string;\n __cadesAsyncToken__: object;\n __createCadesPluginObject__: (...args) => any;\n _extractMeaningfulErrorMessage: (error: Error) => string | null;\n }) => any,\n ): Promise =>\n await callback({\n cadesplugin: window.cadesplugin,\n _generateCadesFn,\n __cadesAsyncToken__,\n __createCadesPluginObject__,\n _extractMeaningfulErrorMessage,\n }),\n);\n"],"sourceRoot":""} \ No newline at end of file diff --git a/examples/angular/package-lock.json b/examples/angular/package-lock.json index 6013c78..92087bd 100644 --- a/examples/angular/package-lock.json +++ b/examples/angular/package-lock.json @@ -3167,9 +3167,9 @@ } }, "crypto-pro": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.5.0.tgz", - "integrity": "sha512-OSz1++q644gfE8wCwygPK4KfMypM1D0aFKuClLcKiDwcIK+S1duXstmwMIPFyoafiQt2H+2CKW0EtYQm+4b0FA==" + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.5.1.tgz", + "integrity": "sha512-UyE6QoCWqeF3/0pCEgGgQWeoIluRDiinz6LddYhw4w7kIut3Ty8GRZ1jWyh+bapwXjSl8t/O9AnXBwmWtDwWQQ==" }, "css-loader": { "version": "6.7.3", diff --git a/examples/angular/package.json b/examples/angular/package.json index badaba2..ec0fcd1 100644 --- a/examples/angular/package.json +++ b/examples/angular/package.json @@ -18,7 +18,7 @@ "@angular/platform-browser": "^15.0.0", "@angular/platform-browser-dynamic": "^15.0.0", "@angular/router": "^15.0.0", - "crypto-pro": "^2.5.0", + "crypto-pro": "^2.5.1", "rxjs": "~7.5.0", "tslib": "^2.3.0", "zone.js": "~0.12.0" diff --git a/examples/react/package-lock.json b/examples/react/package-lock.json index e79dfad..e66a3c3 100644 --- a/examples/react/package-lock.json +++ b/examples/react/package-lock.json @@ -3712,9 +3712,9 @@ } }, "crypto-pro": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.5.0.tgz", - "integrity": "sha512-OSz1++q644gfE8wCwygPK4KfMypM1D0aFKuClLcKiDwcIK+S1duXstmwMIPFyoafiQt2H+2CKW0EtYQm+4b0FA==" + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.5.1.tgz", + "integrity": "sha512-UyE6QoCWqeF3/0pCEgGgQWeoIluRDiinz6LddYhw4w7kIut3Ty8GRZ1jWyh+bapwXjSl8t/O9AnXBwmWtDwWQQ==" }, "css": { "version": "2.2.4", diff --git a/examples/react/package.json b/examples/react/package.json index 006dea3..fd23d10 100644 --- a/examples/react/package.json +++ b/examples/react/package.json @@ -7,7 +7,7 @@ "@testing-library/jest-dom": "4.2.4", "@testing-library/react": "9.5.0", "@testing-library/user-event": "7.2.1", - "crypto-pro": "^2.5.0", + "crypto-pro": "^2.5.1", "react": "^16.13.1", "react-app-polyfill": "1.0.6", "react-dom": "^16.13.1", diff --git a/examples/script-tag/package-lock.json b/examples/script-tag/package-lock.json index 2441e74..1cf93fe 100644 --- a/examples/script-tag/package-lock.json +++ b/examples/script-tag/package-lock.json @@ -42,9 +42,9 @@ "dev": true }, "crypto-pro": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.5.0.tgz", - "integrity": "sha512-OSz1++q644gfE8wCwygPK4KfMypM1D0aFKuClLcKiDwcIK+S1duXstmwMIPFyoafiQt2H+2CKW0EtYQm+4b0FA==" + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.5.1.tgz", + "integrity": "sha512-UyE6QoCWqeF3/0pCEgGgQWeoIluRDiinz6LddYhw4w7kIut3Ty8GRZ1jWyh+bapwXjSl8t/O9AnXBwmWtDwWQQ==" }, "fs.realpath": { "version": "1.0.0", diff --git a/examples/script-tag/package.json b/examples/script-tag/package.json index 796091c..69dc03c 100644 --- a/examples/script-tag/package.json +++ b/examples/script-tag/package.json @@ -13,6 +13,6 @@ "symlink-dir": "3.1.2" }, "dependencies": { - "crypto-pro": "^2.5.0" + "crypto-pro": "^2.5.1" } } diff --git a/lib/crypto-pro.d.ts b/lib/crypto-pro.d.ts index 294a5d7..744a82c 100644 --- a/lib/crypto-pro.d.ts +++ b/lib/crypto-pro.d.ts @@ -1,4 +1,4 @@ -// Type definitions for crypto-pro 2.5.0 +// Type definitions for crypto-pro 2.5.1 // Project: crypto-pro // Definitions by: Vitalii Goma https://github.com/vgoma diff --git a/lib/crypto-pro.js b/lib/crypto-pro.js index fb3af60..46b5955 100644 --- a/lib/crypto-pro.js +++ b/lib/crypto-pro.js @@ -2062,992 +2062,1111 @@ function isnan (val) { /***/ }), -/***/ "../node_modules/ieee754/index.js": -/*!****************************************!*\ - !*** ../node_modules/ieee754/index.js ***! - \****************************************/ +/***/ "../node_modules/cadesplugin_api.js/dist/cadesplugin_api.js": +/*!******************************************************************!*\ + !*** ../node_modules/cadesplugin_api.js/dist/cadesplugin_api.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) -} +;(function () { + //already loaded + if(window.cadesplugin) + return; -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 + var pluginObject; + var plugin_resolved = 0; + var plugin_reject; + var plugin_resolve; + var isOpera = 0; + var isFireFox = 0; + var isSafari = 0; + var isYandex = 0; + var canPromise = !!window.Promise; + var cadesplugin_loaded_event_recieved = false; + var isFireFoxExtensionLoaded = false; + var cadesplugin; - value = Math.abs(value) + if(canPromise) + { + cadesplugin = new Promise(function(resolve, reject) + { + plugin_resolve = resolve; + plugin_reject = reject; + }); + } else + { + cadesplugin = {}; + } - 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 + function check_browser() { + var ua= navigator.userAgent, tem, M= ua.match(/(opera|yabrowser|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; + if(/trident/i.test(M[1])){ + tem = /\brv[ :]+(\d+)/g.exec(ua) || []; + return { name:'IE', version:(tem[1] || '')}; + } + if(M[1] === 'Chrome'){ + tem = ua.match(/\b(OPR|Edg|YaBrowser)\/(\d+)/); + if (tem != null) + return { name: tem[1].replace('OPR', 'Opera'), version: tem[2] }; + } + M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?']; + if ((tem = ua.match(/version\/(\d+)/i)) != null) + M.splice(1, 1, tem[1]); + return {name:M[0],version:M[1]}; } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) + var browserSpecs = check_browser(); + + function cpcsp_console_log(level, msg){ + //IE9 не может писать в консоль если не открыта вкладка developer tools + if(typeof(console) === 'undefined') + return; + if (level <= cadesplugin.current_log_level ){ + if (level === cadesplugin.LOG_LEVEL_DEBUG) + console.log("DEBUG: %s", msg); + if (level === cadesplugin.LOG_LEVEL_INFO) + console.info("INFO: %s", msg); + if (level === cadesplugin.LOG_LEVEL_ERROR) + console.error("ERROR: %s", msg); + return; + } } - if (value * c >= 2) { - e++ - c /= 2 + + function get_extension_version(callback) { + window.postMessage("cadesplugin_extension_version_request", "*"); + window.addEventListener("message", function (event) { + var resp_prefix = "cadesplugin_extension_version_response:"; + if (typeof (event.data) !== "string" || event.data.indexOf(resp_prefix) !== 0) + return; + ext_version = event.data.substring(resp_prefix.length); + callback(ext_version); + }, false); } - 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 + function set_log_level(level){ + if (!((level === cadesplugin.LOG_LEVEL_DEBUG) || + (level === cadesplugin.LOG_LEVEL_INFO) || + (level === cadesplugin.LOG_LEVEL_ERROR))){ + cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, "cadesplugin_api.js: Incorrect log_level: " + level); + return; + } + cadesplugin.current_log_level = level; + if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG) + cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = DEBUG"); + if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO) + cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = INFO"); + if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR) + cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = ERROR"); + if(isNativeMessageSupported()) + { + if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG) + window.postMessage("set_log_level=debug", "*"); + if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO) + window.postMessage("set_log_level=info", "*"); + if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR) + window.postMessage("set_log_level=error", "*"); + } } - } - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} + function set_constantValues() + { + cadesplugin.CAPICOM_MEMORY_STORE = 0; + cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1; + cadesplugin.CAPICOM_CURRENT_USER_STORE = 2; + cadesplugin.CAPICOM_SMART_CARD_USER_STORE = 4; + cadesplugin.CADESCOM_MEMORY_STORE = 0; + cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1; + cadesplugin.CADESCOM_CURRENT_USER_STORE = 2; + cadesplugin.CADESCOM_SMART_CARD_USER_STORE = 4; + cadesplugin.CADESCOM_CONTAINER_STORE = 100; - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + cadesplugin.CAPICOM_MY_STORE = "My"; - buffer[offset + i - d] |= s * 128 -} + cadesplugin.CAPICOM_STORE_OPEN_READ_WRITE = 1; + 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; -/***/ "../node_modules/isarray/index.js": -/*!****************************************!*\ - !*** ../node_modules/isarray/index.js ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { + cadesplugin.CADESCOM_XADES_DEFAULT = 0x00000010; + cadesplugin.CADESCOM_XADES_BES = 0x00000020; + cadesplugin.CADESCOM_XADES_T = 0x00000050; + cadesplugin.CADESCOM_XADES_X_LONG_TYPE_1 = 0x000005d0; + cadesplugin.CADESCOM_XMLDSIG_TYPE = 0x00000000; -var toString = {}.toString; + 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.XmlDsigGost3411Url2012256 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256"; + cadesplugin.XmlDsigGost3410Url2012256 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256"; + cadesplugin.XmlDsigGost3411Url2012512 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-512"; + cadesplugin.XmlDsigGost3410Url2012512 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-512"; -module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; -}; + cadesplugin.CADESCOM_CADES_DEFAULT = 0; + cadesplugin.CADESCOM_CADES_BES = 1; + cadesplugin.CADESCOM_CADES_T = 0x5; + cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d; + cadesplugin.CADESCOM_PKCS7_TYPE = 0xffff; + cadesplugin.CADESCOM_ENCODE_BASE64 = 0; + cadesplugin.CADESCOM_ENCODE_BINARY = 1; + cadesplugin.CADESCOM_ENCODE_ANY = -1; -/***/ }), + cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0; + cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1; + cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2; -/***/ "../node_modules/webpack/buildin/global.js": -/*!*************************************************!*\ - !*** ../node_modules/webpack/buildin/global.js ***! - \*************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { + cadesplugin.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0; + cadesplugin.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1; -var g; + 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; -// This works in non-strict mode -g = (function() { - return this; -})(); + cadesplugin.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128; -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) { ...} + cadesplugin.CAPICOM_PROPID_ENHKEY_USAGE = 9; -module.exports = g; + 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_AUTHENTICATED_ATTRIBUTE_MACHINE_INFO = 0x100; + cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1; -/***/ "./api/certificate/certificate.ts": -/*!****************************************!*\ - !*** ./api/certificate/certificate.ts ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { + cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0; + cadesplugin.CADESCOM_BASE64_TO_BINARY = 1; -"use strict"; + cadesplugin.CADESCOM_DISPLAY_DATA_NONE = 0; + cadesplugin.CADESCOM_DISPLAY_DATA_CONTENT = 1; + cadesplugin.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2; -Object.defineProperty(exports, "__esModule", { value: true }); -const constants_1 = __webpack_require__(/*! ../../constants */ "./constants/index.ts"); -const exportBase64_1 = __webpack_require__(/*! ./exportBase64 */ "./api/certificate/exportBase64.ts"); -const getAlgorithm_1 = __webpack_require__(/*! ./getAlgorithm */ "./api/certificate/getAlgorithm.ts"); -const getCadesProp_1 = __webpack_require__(/*! ./getCadesProp */ "./api/certificate/getCadesProp.ts"); -const getDecodedExtendedKeyUsage_1 = __webpack_require__(/*! ./getDecodedExtendedKeyUsage */ "./api/certificate/getDecodedExtendedKeyUsage.ts"); -const getExtendedKeyUsage_1 = __webpack_require__(/*! ./getExtendedKeyUsage */ "./api/certificate/getExtendedKeyUsage.ts"); -const getInfo_1 = __webpack_require__(/*! ./getInfo */ "./api/certificate/getInfo.ts"); -const hasExtendedKeyUsage_1 = __webpack_require__(/*! ./hasExtendedKeyUsage */ "./api/certificate/hasExtendedKeyUsage.ts"); -const isValid_1 = __webpack_require__(/*! ./isValid */ "./api/certificate/isValid.ts"); -class Certificate { - constructor(_cadesCertificate, name, issuerName, subjectName, thumbprint, validFrom, validTo) { - this._cadesCertificate = _cadesCertificate; - this.name = name; - this.issuerName = issuerName; - this.subjectName = subjectName; - this.thumbprint = thumbprint; - this.validFrom = validFrom; - this.validTo = validTo; - } - getOwnerInfo() { - return getInfo_1.getInfo.call(this, constants_1.SUBJECT_TAGS_TRANSLATIONS, 'SubjectName'); - } - getIssuerInfo() { - return getInfo_1.getInfo.call(this, constants_1.ISSUER_TAGS_TRANSLATIONS, 'IssuerName'); - } - getExtendedKeyUsage() { - return getExtendedKeyUsage_1.getExtendedKeyUsage.call(this); - } - getDecodedExtendedKeyUsage() { - return getDecodedExtendedKeyUsage_1.getDecodedExtendedKeyUsage.call(this); - } - getAlgorithm() { - return getAlgorithm_1.getAlgorithm.call(this); - } - getCadesProp(propName) { - return getCadesProp_1.getCadesProp.call(this, propName); - } - isValid() { - return isValid_1.isValid.call(this); - } - exportBase64() { - return exportBase64_1.exportBase64.call(this); - } - hasExtendedKeyUsage(oids) { - return hasExtendedKeyUsage_1.hasExtendedKeyUsage.call(this, oids); - } -} -exports.Certificate = Certificate; + 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; -/***/ "./api/certificate/exportBase64.ts": -/*!*****************************************!*\ - !*** ./api/certificate/exportBase64.ts ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { + cadesplugin.CADESCOM_AllowNone = 0; + cadesplugin.CADESCOM_AllowNoOutstandingRequest = 0x1; + cadesplugin.CADESCOM_AllowUntrustedCertificate = 0x2; + cadesplugin.CADESCOM_AllowUntrustedRoot = 0x4; + cadesplugin.CADESCOM_SkipInstallToStore = 0x10000000; + cadesplugin.CADESCOM_InstallCertChainToContainer = 0x20000000; + cadesplugin.CADESCOM_UseContainerStore = 0x40000000; -"use strict"; + cadesplugin.ENABLE_CARRIER_TYPE_CSP = 0x01; + cadesplugin.ENABLE_CARRIER_TYPE_FKC_NO_SM = 0x02; + cadesplugin.ENABLE_CARRIER_TYPE_FKC_SM = 0x04; + cadesplugin.ENABLE_ANY_CARRIER_TYPE = 0x07; -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Экспортирует сертификат в формате base64 - * - * @returns сертификат в формате base64 - */ -exports.exportBase64 = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - const cadesCertificate = this._cadesCertificate; - return eval(_generateCadesFn_1._generateCadesFn(function exportBase64() { - let base64; - try { - base64 = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.Export(0); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при экспорте сертификата'); - } - return base64; - })); -}); + cadesplugin.DISABLE_EVERY_CARRIER_OPERATION = 0x00; + cadesplugin.ENABLE_CARRIER_OPEN_ENUM = 0x01; + cadesplugin.ENABLE_CARRIER_CREATE = 0x02; + cadesplugin.ENABLE_ANY_OPERATION = 0x03; + cadesplugin.CADESCOM_PRODUCT_CSP = 0; + cadesplugin.CADESCOM_PRODUCT_OCSP = 1; + cadesplugin.CADESCOM_PRODUCT_TSP = 2; -/***/ }), + cadesplugin.MEDIA_TYPE_REGISTRY = 0x00000001; + cadesplugin.MEDIA_TYPE_HDIMAGE = 0x00000002; + cadesplugin.MEDIA_TYPE_CLOUD = 0x00000004; + cadesplugin.MEDIA_TYPE_SCARD = 0x00000008; -/***/ "./api/certificate/getAlgorithm.ts": -/*!*****************************************!*\ - !*** ./api/certificate/getAlgorithm.ts ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { + cadesplugin.XCN_CRYPT_STRING_BASE64HEADER = 0; + cadesplugin.AT_KEYEXCHANGE = 1; + cadesplugin.AT_SIGNATURE = 2; -"use strict"; + cadesplugin.CARRIER_FLAG_REMOVABLE = 1; + cadesplugin.CARRIER_FLAG_UNIQUE = 2; + cadesplugin.CARRIER_FLAG_PROTECTED = 4; + cadesplugin.CARRIER_FLAG_FUNCTIONAL_CARRIER = 8; + cadesplugin.CARRIER_FLAG_SECURE_MESSAGING = 16; + cadesplugin.CARRIER_FLAG_ABLE_VISUALISE_SIGNATURE = 64; + cadesplugin.CARRIER_FLAG_VIRTUAL = 128; + } -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Возвращает информацию об алгоритме сертификата - * - * @returns информацию об алгоритме и его OID'е - */ -exports.getAlgorithm = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - const cadesCertificate = this._cadesCertificate; - return eval(_generateCadesFn_1._generateCadesFn(function getAlgorithm() { - const algorithmInfo = { - algorithm: null, - oid: null, - }; - let cadesPublicKey; - try { - cadesPublicKey = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.PublicKey(); - cadesPublicKey = _generateCadesFn_1.__cadesAsyncToken__ + cadesPublicKey.Algorithm; - algorithmInfo.algorithm = _generateCadesFn_1.__cadesAsyncToken__ + cadesPublicKey.FriendlyName; - algorithmInfo.oid = _generateCadesFn_1.__cadesAsyncToken__ + cadesPublicKey.Value; - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при получении алгоритма'); + function async_spawn(generatorFunc) { + function continuer(verb, arg) { + var result; + try { + result = generator[verb](arg); + } catch (err) { + return Promise.reject(err); + } + if (result.done) { + return result.value; + } else { + return Promise.resolve(result.value).then(onFulfilled, onRejected); + } } - return algorithmInfo; - })); -}); - - -/***/ }), + var generator = generatorFunc(Array.prototype.slice.call(arguments, 1)); + var onFulfilled = continuer.bind(continuer, "next"); + var onRejected = continuer.bind(continuer, "throw"); + return onFulfilled(); + } -/***/ "./api/certificate/getCadesProp.ts": -/*!*****************************************!*\ - !*** ./api/certificate/getCadesProp.ts ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { + function isIE() { + // var retVal = (("Microsoft Internet Explorer" == navigator.appName) || // IE < 11 + // navigator.userAgent.match(/Trident\/./i)); // IE 11 + return (browserSpecs.name === 'IE' || browserSpecs.name === 'MSIE'); + } -"use strict"; + function isIOS() { + return (navigator.userAgent.match(/ipod/i) || + navigator.userAgent.match(/ipad/i) || + navigator.userAgent.match(/iphone/i)); + } -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Возвращает указанное внутренее свойство у сертификата в формате Cades - * - * @param propName = наименование свойства - * @returns значение запрошенного свойства - */ -exports.getCadesProp = _afterPluginsLoaded_1._afterPluginsLoaded(function (propName) { - const cadesCertificate = this._cadesCertificate; - return eval(_generateCadesFn_1._generateCadesFn(function getCadesProp() { - let propertyValue; - try { - propertyValue = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate[propName]; + function isNativeMessageSupported() + { + // В IE работаем через NPAPI + if(isIE()) + return false; + // В Edge работаем через NativeMessage + if (browserSpecs.name === 'Edg') { + return true; } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при обращении к свойству сертификата'); + if (browserSpecs.name === 'YaBrowser') { + isYandex = true; + return true; } - return propertyValue; - })); -}); - - -/***/ }), - -/***/ "./api/certificate/getDecodedExtendedKeyUsage.ts": -/*!*******************************************************!*\ - !*** ./api/certificate/getDecodedExtendedKeyUsage.ts ***! - \*******************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const constants_1 = __webpack_require__(/*! ../../constants */ "./constants/index.ts"); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -/** - * Возвращает расшифрованные ОИД'ы сертификата - * - * @returns словарь расшифрованных ОИД'ов - */ -exports.getDecodedExtendedKeyUsage = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - return __awaiter(this, void 0, void 0, function* () { - const certificateOids = yield this.getExtendedKeyUsage(); - return certificateOids.reduce((decodedOids, oidCode) => (Object.assign(Object.assign({}, decodedOids), { [oidCode]: constants_1.OIDS_DICTIONARY[oidCode] || null })), {}); - }); -}); - - -/***/ }), - -/***/ "./api/certificate/getExtendedKeyUsage.ts": -/*!************************************************!*\ - !*** ./api/certificate/getExtendedKeyUsage.ts ***! - \************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; + // В Chrome, Firefox, Safari и Opera работаем через асинхронную версию в зависимости от версии + if(browserSpecs.name === 'Opera') { + isOpera = true; + if(browserSpecs.version >= 33){ + return true; + } + else{ + return false; + } + } + if(browserSpecs.name === 'Firefox') { + isFireFox = true; + if(browserSpecs.version >= 52){ + return true; + } + else{ + return false; + } + } + if(browserSpecs.name === 'Chrome') { + if(browserSpecs.version >= 42){ + return true; + } + else{ + return false; + } + } + //В Сафари начиная с 12 версии нет NPAPI + if(browserSpecs.name === 'Safari') { + isSafari = true; + if(browserSpecs.version >= 12) { + return true; + } else { + return false; + } + } + } -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Возвращает ОИД'ы сертификата - * - * @returns список ОИД'ов - */ -exports.getExtendedKeyUsage = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - const cadesCertificate = this._cadesCertificate; - return eval(_generateCadesFn_1._generateCadesFn(function getExtendedKeyUsage() { - const OIDS = []; - let count; - try { - count = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage(); - count = _generateCadesFn_1.__cadesAsyncToken__ + count.EKUs; - count = _generateCadesFn_1.__cadesAsyncToken__ + count.Count; - if (count > 0) { - while (count > 0) { - let cadesExtendedKeyUsage; - cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage(); - cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesExtendedKeyUsage.EKUs; - cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesExtendedKeyUsage.Item(count); - cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesExtendedKeyUsage.OID; - OIDS.push(cadesExtendedKeyUsage); - count--; + // Функция активации объектов КриптоПро ЭЦП Browser plug-in + function CreateObject(name) { + if (isIOS()) { + // На iOS для создания объектов используется функция + // call_ru_cryptopro_npcades_10_native_bridge, определенная в IOS_npcades_supp.js + return call_ru_cryptopro_npcades_10_native_bridge("CreateObject", [name]); + } + if (isIE()) { + // В Internet Explorer создаются COM-объекты + if (name.match(/X509Enrollment/i)) { + try { + // Объекты CertEnroll пробуем создавать через нашу фабрику, + // если не получилось то через CX509EnrollmentWebClassFactory + var objCertEnrollClassFactory = document.getElementById("webClassFactory"); + return objCertEnrollClassFactory.CreateObject(name); + } + catch (e) { + try { + var objWebClassFactory = document.getElementById("certEnrollClassFactory"); + return objWebClassFactory.CreateObject(name); + } + catch (err) { + throw ("Для создания обьектов X509Enrollment следует настроить веб-узел на использование проверки подлинности по протоколу HTTPS"); + } } } + // Объекты CAPICOM и CAdESCOM создаются через CAdESCOM.WebClassFactory + try { + var objWebClassFactory = document.getElementById("webClassFactory"); + return objWebClassFactory.CreateObject(name); + } + catch (e) { + // Для версий плагина ниже 2.0.12538 + return new ActiveXObject(name); + } } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || "Ошибка при получении ОИД'ов"); - } - return OIDS; - })); -}); + // создаются объекты NPAPI + return pluginObject.CreateObject(name); + } + function decimalToHexString(number) { + if (number < 0) { + number = 0xFFFFFFFF + number + 1; + } -/***/ }), + return number.toString(16).toUpperCase(); + } -/***/ "./api/certificate/getInfo.ts": -/*!************************************!*\ - !*** ./api/certificate/getInfo.ts ***! - \************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { + function GetMessageFromException(e) { + var err = e.message; + if (!err) { + err = e; + } else if (e.number) { + err += " (0x" + decimalToHexString(e.number) + ")"; + } + return err; + } -"use strict"; + function getLastError(exception) { + if(isNativeMessageSupported() || isIE() || isIOS() ) { + return GetMessageFromException(exception); + } -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _parseCertInfo_1 = __webpack_require__(/*! ../../helpers/_parseCertInfo */ "./helpers/_parseCertInfo.ts"); -const getCadesProp_1 = __webpack_require__(/*! ./getCadesProp */ "./api/certificate/getCadesProp.ts"); -/** - * Возвращает расшифрованную информацию о сертификате из указанного свойства по тэгам - * - * @param tags = словарь - * @param entitiesPath = путь к разбираемой сущности - * @returns расшифрованная информация по отдельным тэгам - */ -exports.getInfo = _afterPluginsLoaded_1._afterPluginsLoaded(function (tags, entitiesPath) { - return __awaiter(this, void 0, void 0, function* () { - let entities; try { - entities = yield getCadesProp_1.getCadesProp.call(this, entitiesPath); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при извлечении информации из сертификата'); + return pluginObject.getLastError(); + } catch(e) { + return GetMessageFromException(exception); } - return _parseCertInfo_1._parseCertInfo(tags, entities); - }); -}); + } + // Функция для удаления созданных объектов + function ReleasePluginObjects() { + return cpcsp_chrome_nmcades.ReleasePluginObjects(); + } -/***/ }), + // Функция активации асинхронных объектов КриптоПро ЭЦП Browser plug-in + function CreateObjectAsync(name) { + return pluginObject.CreateObjectAsync(name); + } -/***/ "./api/certificate/hasExtendedKeyUsage.ts": -/*!************************************************!*\ - !*** ./api/certificate/hasExtendedKeyUsage.ts ***! - \************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -/** - * Проверяет наличие ОИД'а (ОИД'ов) у сертификата - * - * @param oids - ОИД'ы для проверки - * @returns флаг наличия ОИД'ов у сертификата - */ -exports.hasExtendedKeyUsage = _afterPluginsLoaded_1._afterPluginsLoaded(function (oids) { - return __awaiter(this, void 0, void 0, function* () { - const certOids = yield this.getExtendedKeyUsage(); - let result; - if (Array.isArray(oids)) { - result = oids.every((oidToCheck) => certOids.some((certOid) => certOid === oidToCheck)); - } - else { - result = certOids.some((certOid) => certOid === oids); - } - return result; - }); -}); + //Функции для IOS + var ru_cryptopro_npcades_10_native_bridge = { + callbacksCount : 1, + callbacks : {}, + // Automatically called by native layer when a result is available + resultForCallback : function resultForCallback(callbackId, resultArray) { + var callback = ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId]; + if (!callback) return; + callback.apply(null,resultArray); + }, -/***/ }), + // Use this in javascript to request native objective-c code + // functionName : string (I think the name is explicit :p) + // args : array of arguments + // callback : function with n-arguments that is going to be called when the native code returned + call : function call(functionName, args, callback) { + var hasCallback = callback && typeof callback === "function"; + var callbackId = hasCallback ? ru_cryptopro_npcades_10_native_bridge.callbacksCount++ : 0; -/***/ "./api/certificate/index.ts": -/*!**********************************!*\ - !*** ./api/certificate/index.ts ***! - \**********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { + if (hasCallback) + ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId] = callback; -"use strict"; + var iframe = document.createElement("IFRAME"); + var arrObjs = new Array("_CPNP_handle"); + try{ + iframe.setAttribute("src", "cpnp-js-call:" + functionName + ":" + callbackId+ ":" + encodeURIComponent(JSON.stringify(args, arrObjs))); + } catch(e){ + alert(e); + } + document.documentElement.appendChild(iframe); + iframe.parentNode.removeChild(iframe); + iframe = null; + } + }; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(/*! ./certificate */ "./api/certificate/certificate.ts")); + function call_ru_cryptopro_npcades_10_native_bridge(functionName, array){ + var tmpobj; + var ex; + ru_cryptopro_npcades_10_native_bridge.call(functionName, array, function(e, response){ + ex = e; + var str='tmpobj='+response; + eval(str); + if (typeof (tmpobj) === "string"){ + tmpobj = tmpobj.replace(/\\\n/gm, "\n"); + tmpobj = tmpobj.replace(/\\\r/gm, "\r"); + } + }); + if(ex) + throw ex; + return tmpobj; + } + function show_firefox_missing_extension_dialog() + { + if (!window.cadesplugin_skip_extension_install) + { + var ovr = document.createElement('div'); + ovr.id = "cadesplugin_ovr"; + ovr.style = "visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)"; + ovr.innerHTML = "
" + + "" + + "

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

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

" + + "
"; + document.getElementsByTagName("Body")[0].appendChild(ovr); + document.getElementById("cadesplugin_close_install").addEventListener('click',function() + { + plugin_loaded_error("Плагин недоступен"); + document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; + }); -/***/ }), + ovr.addEventListener('click',function() + { + plugin_loaded_error("Плагин недоступен"); + document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; + }); + ovr.style.visibility="visible"; + } + } + function firefox_or_safari_nmcades_onload() { + if (window.cadesplugin_extension_loaded_callback) + window.cadesplugin_extension_loaded_callback(); + isFireFoxExtensionLoaded = true; + cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error); + } -/***/ "./api/certificate/isValid.ts": -/*!************************************!*\ - !*** ./api/certificate/isValid.ts ***! - \************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { + function nmcades_api_onload() { + if (!isIE() && !isFireFox && !isSafari) { + if (window.cadesplugin_extension_loaded_callback) + window.cadesplugin_extension_loaded_callback(); + } + window.postMessage("cadesplugin_echo_request", "*"); + window.addEventListener("message", function (event){ + if (typeof(event.data) !== "string" || !event.data.match("cadesplugin_loaded")) + return; + if (cadesplugin_loaded_event_recieved) + return; + if(isFireFox || isSafari) + { + // Для Firefox, Сафари вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js + var url = event.data.substring(event.data.indexOf("url:") + 4); + if (!url.match("^(moz|safari)-extension://[a-zA-Z0-9/_-]+/nmcades_plugin_api.js$")) + { + cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, "Bad url \"" + url + "\" for load CryptoPro Extension for CAdES Browser plug-in"); + plugin_loaded_error(); + return; + } + var fileref = document.createElement('script'); + fileref.setAttribute("type", "text/javascript"); + fileref.setAttribute("src", url); + fileref.onerror = plugin_loaded_error; + fileref.onload = firefox_or_safari_nmcades_onload; + document.getElementsByTagName("head")[0].appendChild(fileref); + }else { + cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error); + } + cadesplugin_loaded_event_recieved = true; + }, false); + } -"use strict"; + //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari + function load_extension() + { + if(isFireFox || isSafari){ + // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера. + nmcades_api_onload(); + } else { + // в асинхронном варианте для Yandex и Opera подключаем расширение из Opera store. + if (isOpera || isYandex) { + var fileref = document.createElement('script'); + fileref.setAttribute("type", "text/javascript"); + fileref.setAttribute("src", "chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js"); + fileref.onerror = plugin_loaded_error; + fileref.onload = nmcades_api_onload; + document.getElementsByTagName("head")[0].appendChild(fileref); + } else { + // для Chrome, Chromium, Chromium Edge расширение из Chrome store + var fileref = document.createElement('script'); + fileref.setAttribute("type", "text/javascript"); + fileref.setAttribute("src", "chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js"); + fileref.onerror = plugin_loaded_error; + fileref.onload = nmcades_api_onload; + document.getElementsByTagName("head")[0].appendChild(fileref); + } + } + } -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Проверяет действительность сертификата - * - * @returns флаг валидности - */ -exports.isValid = _afterPluginsLoaded_1._afterPluginsLoaded(function () { - const cadesCertificate = this._cadesCertificate; - return eval(_generateCadesFn_1._generateCadesFn(function isValid() { - let isValid; - try { - isValid = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.IsValid(); - isValid = _generateCadesFn_1.__cadesAsyncToken__ + isValid.Result; + //Загружаем плагин для NPAPI + function load_npapi_plugin() + { + var elem = document.createElement('object'); + elem.setAttribute("id", "cadesplugin_object"); + elem.setAttribute("type", "application/x-cades"); + elem.setAttribute("style", "visibility: hidden"); + document.getElementsByTagName("body")[0].appendChild(elem); + pluginObject = document.getElementById("cadesplugin_object"); + if(isIE()) + { + var elem1 = document.createElement('object'); + elem1.setAttribute("id", "certEnrollClassFactory"); + elem1.setAttribute("classid", "clsid:884e2049-217d-11da-b2a4-000e7bbb2b09"); + elem1.setAttribute("style", "visibility: hidden"); + document.getElementsByTagName("body")[0].appendChild(elem1); + var elem2 = document.createElement('object'); + elem2.setAttribute("id", "webClassFactory"); + elem2.setAttribute("classid", "clsid:B04C8637-10BD-484E-B0DA-B8A039F60024"); + elem2.setAttribute("style", "visibility: hidden"); + document.getElementsByTagName("body")[0].appendChild(elem2); } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при проверке сертификата'); + } + + //Отправляем событие что все ок. + function plugin_loaded() + { + plugin_resolved = 1; + if(canPromise) + { + plugin_resolve(); + }else { + window.postMessage("cadesplugin_loaded", "*"); } - return Boolean(isValid); - })); -}); + } + //Отправляем событие что сломались. + function plugin_loaded_error(msg) + { + if(typeof(msg) === 'undefined' || typeof(msg) === 'object') + msg = "Плагин недоступен"; + plugin_resolved = 1; + if(canPromise) + { + plugin_reject(msg); + } else { + window.postMessage("cadesplugin_load_error", "*"); + } + } -/***/ }), - -/***/ "./api/createAttachedSignature.ts": -/*!****************************************!*\ - !*** ./api/createAttachedSignature.ts ***! - \****************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(Buffer) { -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -const _getCadesCert_1 = __webpack_require__(/*! ../helpers/_getCadesCert */ "./helpers/_getCadesCert.ts"); -const _getDateObj_1 = __webpack_require__(/*! ../helpers/_getDateObj */ "./helpers/_getDateObj.ts"); -/** - * Создает присоединенную подпись сообщения по отпечатку сертификата - * - * @param thumbprint - отпечаток сертификата - * @param message - подписываемое сообщение - * @returns подпись в формате PKCS#7 - */ -exports.createAttachedSignature = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint, unencryptedMessage) => __awaiter(void 0, void 0, void 0, function* () { - const { cadesplugin } = window; - const cadesCertificate = yield _getCadesCert_1._getCadesCert(thumbprint); - return eval(_generateCadesFn_1._generateCadesFn(function createAttachedSignature() { - let cadesAttrs; - let cadesSignedData; - let cadesSigner; - try { - cadesAttrs = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CADESCOM.CPAttribute'); - cadesSignedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CadesSignedData'); - cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); + //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку + function check_load_timeout() + { + if(plugin_resolved === 1) + return; + if(isFireFox) + { + if (!isFireFoxExtensionLoaded) + show_firefox_missing_extension_dialog(); } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); + plugin_resolved = 1; + if(canPromise) + { + plugin_reject("Истекло время ожидания загрузки плагина"); + } else { + window.postMessage("cadesplugin_load_error", "*"); } - const currentTime = _getDateObj_1._getDateObj(new Date()); + + } + + //Вспомогательная функция для NPAPI + function createPromise(arg) + { + return new Promise(arg); + } + + function check_npapi_plugin (){ 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 oAbout = CreateObject("CAdESCOM.About"); + plugin_loaded(); } - let messageBase64; - try { - messageBase64 = Buffer.from(unencryptedMessage).toString('base64'); + catch (err) { + document.getElementById("cadesplugin_object").style.display = 'none'; + // Объект создать не удалось, проверим, установлен ли + // вообще плагин. Такая возможность есть не во всех браузерах + var mimetype = navigator.mimeTypes["application/x-cades"]; + if (mimetype) { + var plugin = mimetype.enabledPlugin; + if (plugin) { + plugin_loaded_error("Плагин загружен, но не создаются обьекты"); + }else + { + plugin_loaded_error("Ошибка при загрузке плагина"); + } + }else + { + plugin_loaded_error("Плагин недоступен"); + } } - catch (error) { - console.error(error); - throw new Error('Ошибка при преобразовании сообщения в Base64'); + } + + //Проверяем работает ли плагин + function check_plugin_working() + { + var div = document.createElement("div"); + div.innerHTML = ""; + var isIeLessThan9 = (div.getElementsByTagName("i").length === 1); + if (isIeLessThan9) { + plugin_loaded_error("Internet Explorer версии 8 и ниже не поддерживается"); + return; } - let cadesAuthAttrs; - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); - cadesAuthAttrs = _generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2; - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_Content(messageBase64)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN)); + + if(isNativeMessageSupported()) + { + load_extension(); + }else if(!canPromise) { + window.addEventListener("message", function (event){ + if (event.data !== "cadesplugin_echo_request") + return; + load_npapi_plugin(); + check_npapi_plugin(); + }, + false); + }else + { + if(document.readyState === "complete"){ + load_npapi_plugin(); + check_npapi_plugin(); + } else { + window.addEventListener("load", function (event) { + load_npapi_plugin(); + check_npapi_plugin(); + }, false); + } } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи'); + } + + function set_pluginObject(obj) + { + pluginObject = obj; + } + + function is_capilite_enabled() + { + if ((typeof (cadesplugin.EnableInternalCSP) !== 'undefined') && cadesplugin.EnableInternalCSP) + return true; + return false; + }; + + function set_load_timeout() + { + if (window.cadesplugin_load_timeout) { + setTimeout(check_load_timeout, window.cadesplugin_load_timeout); } - let signature; - try { - signature = _generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_PKCS7_TYPE); + else { + setTimeout(check_load_timeout, 20000); } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); + } + + var onVisibilityChange = function (event) { + if (document.hidden === false) { + document.removeEventListener("visibilitychange", onVisibilityChange); + set_load_timeout(); + check_plugin_working(); } - return signature; - })); -})); + }; + + //Export + cadesplugin.JSModuleVersion = "2.3.5"; + cadesplugin.async_spawn = async_spawn; + cadesplugin.set = set_pluginObject; + cadesplugin.set_log_level = set_log_level; + cadesplugin.get_extension_version = get_extension_version; + cadesplugin.getLastError = getLastError; + cadesplugin.is_capilite_enabled = is_capilite_enabled; + + if(isNativeMessageSupported()) + { + cadesplugin.CreateObjectAsync = CreateObjectAsync; + cadesplugin.ReleasePluginObjects = ReleasePluginObjects; + } + + if(!isNativeMessageSupported()) + { + cadesplugin.CreateObject = CreateObject; + } + + set_constantValues(); + + cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR; + window.cadesplugin = cadesplugin; + if (isSafari && document.hidden) { + document.addEventListener("visibilitychange", onVisibilityChange); + return; + } + set_load_timeout(); + check_plugin_working(); +}()); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/buffer/index.js */ "../node_modules/buffer/index.js").Buffer)) /***/ }), -/***/ "./api/createDetachedSignature.ts": +/***/ "../node_modules/ieee754/index.js": /*!****************************************!*\ - !*** ./api/createDetachedSignature.ts ***! + !*** ../node_modules/ieee754/index.js ***! \****************************************/ /*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { +/***/ (function(module, exports) { -"use strict"; +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] -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -const _getCadesCert_1 = __webpack_require__(/*! ../helpers/_getCadesCert */ "./helpers/_getCadesCert.ts"); -const _getDateObj_1 = __webpack_require__(/*! ../helpers/_getDateObj */ "./helpers/_getDateObj.ts"); -/** - * Создает отсоединенную подпись хеша по отпечатку сертификата - * - * @param thumbprint - отпечаток сертификата - * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11-2012 256 бит - * @returns подпись в формате PKCS#7 - */ -exports.createDetachedSignature = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint, messageHash) => __awaiter(void 0, void 0, void 0, function* () { - const { cadesplugin } = window; - const cadesCertificate = yield _getCadesCert_1._getCadesCert(thumbprint); - return eval(_generateCadesFn_1._generateCadesFn(function createDetachedSignature() { - let cadesAttrs; - let cadesHashedData; - let cadesSignedData; - let cadesSigner; - try { - cadesAttrs = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CADESCOM.CPAttribute'); - cadesHashedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.HashedData'); - cadesSignedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CadesSignedData'); - cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); - } - const currentTime = _getDateObj_1._getDateObj(new Date()); - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Name(constants_1.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи'); - } - let cadesAuthAttrs; - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); - cadesAuthAttrs = _generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2; - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке сертификата'); - } - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + - cadesHashedData.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.SetHashValue(messageHash)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке хеша'); - } - let signature; - try { - signature = - _generateCadesFn_1.__cadesAsyncToken__ + - cadesSignedData.SignHash(cadesHashedData, cadesSigner, cadesplugin.CADESCOM_PKCS7_TYPE); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); - } - return signature; - })); -})); + 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 +} /***/ }), -/***/ "./api/createHash.ts": -/*!***************************!*\ - !*** ./api/createHash.ts ***! - \***************************/ +/***/ "../node_modules/isarray/index.js": +/*!****************************************!*\ + !*** ../node_modules/isarray/index.js ***! + \****************************************/ /*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { +/***/ (function(module, exports) { -"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 toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; }; -Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -/** - * Создает хеш сообщения по ГОСТ Р 34.11-2012 (по умолчанию 256 бит) - * https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%B8%D0%B1%D0%BE%D0%B3_(%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F) - * - * @param unencryptedMessage - сообщение для хеширования - * @hashedAlgorithm - алгоритм хеширования. По умолчанию - CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256. - * - * @returns хеш - */ -exports.createHash = _afterPluginsLoaded_1._afterPluginsLoaded((unencryptedMessage, options) => __awaiter(void 0, void 0, void 0, function* () { - const { cadesplugin } = window; - return eval(_generateCadesFn_1._generateCadesFn(function createHash() { - var _a; - const cadesHashedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.HashedData'); - let messageBase64; - let hash; - try { - if ((options === null || options === void 0 ? void 0 : options.encoding) && typeof unencryptedMessage === 'string') { - messageBase64 = Buffer.from(unencryptedMessage, options === null || options === void 0 ? void 0 : options.encoding).toString('base64'); - } - else { - messageBase64 = Buffer.from(unencryptedMessage).toString('base64'); - } - } - catch (error) { - console.error(error); - throw new Error('Ошибка при преобразовании сообщения в Base64'); - } - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + - cadesHashedData.propset_Algorithm((_a = options === null || options === void 0 ? void 0 : options.hashedAlgorithm) !== null && _a !== void 0 ? _a : cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.propset_DataEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.Hash(messageBase64)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации хэширования'); - } - try { - hash = _generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.Value; - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при создании хэша'); - } - return hash; - })); -})); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/buffer/index.js */ "../node_modules/buffer/index.js").Buffer)) /***/ }), -/***/ "./api/createSignature.ts": -/*!********************************!*\ - !*** ./api/createSignature.ts ***! - \********************************/ +/***/ "../node_modules/webpack/buildin/global.js": +/*!*************************************************!*\ + !*** ../node_modules/webpack/buildin/global.js ***! + \*************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || new Function("return this")(); +} catch (e) { + // This works if the window reference is available + if (typeof window === "object") g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; + + +/***/ }), + +/***/ "./api/certificate/certificate.ts": +/*!****************************************!*\ + !*** ./api/certificate/certificate.ts ***! + \****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; Object.defineProperty(exports, "__esModule", { value: true }); -const constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -const _getCadesCert_1 = __webpack_require__(/*! ../helpers/_getCadesCert */ "./helpers/_getCadesCert.ts"); -const _getDateObj_1 = __webpack_require__(/*! ../helpers/_getDateObj */ "./helpers/_getDateObj.ts"); +const constants_1 = __webpack_require__(/*! ../../constants */ "./constants/index.ts"); +const exportBase64_1 = __webpack_require__(/*! ./exportBase64 */ "./api/certificate/exportBase64.ts"); +const getAlgorithm_1 = __webpack_require__(/*! ./getAlgorithm */ "./api/certificate/getAlgorithm.ts"); +const getCadesProp_1 = __webpack_require__(/*! ./getCadesProp */ "./api/certificate/getCadesProp.ts"); +const getDecodedExtendedKeyUsage_1 = __webpack_require__(/*! ./getDecodedExtendedKeyUsage */ "./api/certificate/getDecodedExtendedKeyUsage.ts"); +const getExtendedKeyUsage_1 = __webpack_require__(/*! ./getExtendedKeyUsage */ "./api/certificate/getExtendedKeyUsage.ts"); +const getInfo_1 = __webpack_require__(/*! ./getInfo */ "./api/certificate/getInfo.ts"); +const hasExtendedKeyUsage_1 = __webpack_require__(/*! ./hasExtendedKeyUsage */ "./api/certificate/hasExtendedKeyUsage.ts"); +const isValid_1 = __webpack_require__(/*! ./isValid */ "./api/certificate/isValid.ts"); +class Certificate { + constructor(_cadesCertificate, name, issuerName, subjectName, thumbprint, validFrom, validTo) { + this._cadesCertificate = _cadesCertificate; + this.name = name; + this.issuerName = issuerName; + this.subjectName = subjectName; + this.thumbprint = thumbprint; + this.validFrom = validFrom; + this.validTo = validTo; + } + getOwnerInfo() { + return getInfo_1.getInfo.call(this, constants_1.SUBJECT_TAGS_TRANSLATIONS, 'SubjectName'); + } + getIssuerInfo() { + return getInfo_1.getInfo.call(this, constants_1.ISSUER_TAGS_TRANSLATIONS, 'IssuerName'); + } + getExtendedKeyUsage() { + return getExtendedKeyUsage_1.getExtendedKeyUsage.call(this); + } + getDecodedExtendedKeyUsage() { + return getDecodedExtendedKeyUsage_1.getDecodedExtendedKeyUsage.call(this); + } + getAlgorithm() { + return getAlgorithm_1.getAlgorithm.call(this); + } + getCadesProp(propName) { + return getCadesProp_1.getCadesProp.call(this, propName); + } + isValid() { + return isValid_1.isValid.call(this); + } + exportBase64() { + return exportBase64_1.exportBase64.call(this); + } + hasExtendedKeyUsage(oids) { + return hasExtendedKeyUsage_1.hasExtendedKeyUsage.call(this, oids); + } +} +exports.Certificate = Certificate; + + +/***/ }), + +/***/ "./api/certificate/exportBase64.ts": +/*!*****************************************!*\ + !*** ./api/certificate/exportBase64.ts ***! + \*****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +const _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); /** - * Создает подпись base64 строки по отпечатку сертификата + * Экспортирует сертификат в формате base64 * - * @param thumbprint - отпечаток сертификата - * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11 - * @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false) - * @returns подпись + * @returns сертификат в формате base64 */ -exports.createSignature = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint, messageHash, detachedSignature = true) => __awaiter(void 0, void 0, void 0, function* () { - console.warn([ - 'cryptoPro: Метод "createSignature" является устаревшим и будет убран из будущих версий.', - 'Используйте "createAttachedSignature" и "createDetachedSignature".', - ].join('\n')); - const { cadesplugin } = window; - const cadesCertificate = yield _getCadesCert_1._getCadesCert(thumbprint); - return eval(_generateCadesFn_1._generateCadesFn(function createSignature() { - let cadesAttrs; - let cadesSignedData; - let cadesSigner; - try { - cadesAttrs = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CADESCOM.CPAttribute'); - cadesSignedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CadesSignedData'); - cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); - } - const currentTime = _getDateObj_1._getDateObj(new Date()); - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Name(constants_1.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи'); - } - let cadesAuthAttrs; - try { - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); - cadesAuthAttrs = _generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2; - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_Content(messageHash)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY)); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи'); - } - let signature; +exports.exportBase64 = _afterPluginsLoaded_1._afterPluginsLoaded(function () { + const cadesCertificate = this._cadesCertificate; + return eval(_generateCadesFn_1._generateCadesFn(function exportBase64() { + let base64; try { - signature = - _generateCadesFn_1.__cadesAsyncToken__ + - cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_CADES_BES, detachedSignature); + base64 = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.Export(0); } catch (error) { console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при экспорте сертификата'); } - return signature; + return base64; })); -})); +}); /***/ }), -/***/ "./api/createXMLSignature.ts": -/*!***********************************!*\ - !*** ./api/createXMLSignature.ts ***! - \***********************************/ +/***/ "./api/certificate/getAlgorithm.ts": +/*!*****************************************!*\ + !*** ./api/certificate/getAlgorithm.ts ***! + \*****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -const _getCadesCert_1 = __webpack_require__(/*! ../helpers/_getCadesCert */ "./helpers/_getCadesCert.ts"); +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"); /** - * Создает XML подпись для документа в формате XML + * Возвращает информацию об алгоритме сертификата * - * @param thumbprint - отпечаток сертификата - * @param unencryptedMessage - подписываемое сообщение в формате XML - * @returns подпись + * @returns информацию об алгоритме и его OID'е */ -exports.createXMLSignature = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint, unencryptedMessage) => __awaiter(void 0, void 0, void 0, function* () { - const { cadesplugin } = window; - const cadesCertificate = yield _getCadesCert_1._getCadesCert(thumbprint); - return eval(_generateCadesFn_1._generateCadesFn(function createXMLSignature() { - let cadesSigner; - let cadesSignedXML; - try { - cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); - cadesSignedXML = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.SignedXML'); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); - } +exports.getAlgorithm = _afterPluginsLoaded_1._afterPluginsLoaded(function () { + const cadesCertificate = this._cadesCertificate; + return eval(_generateCadesFn_1._generateCadesFn(function getAlgorithm() { + const algorithmInfo = { + algorithm: null, + oid: null, + }; + let cadesPublicKey; try { - const signatureMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256'; - const digestMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256'; - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_CheckCertificate(true)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.propset_Content(unencryptedMessage)); - void (_generateCadesFn_1.__cadesAsyncToken__ + - cadesSignedXML.propset_SignatureType(cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.propset_SignatureMethod(signatureMethod)); - void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.propset_DigestMethod(digestMethod)); + cadesPublicKey = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.PublicKey(); + cadesPublicKey = _generateCadesFn_1.__cadesAsyncToken__ + cadesPublicKey.Algorithm; + algorithmInfo.algorithm = _generateCadesFn_1.__cadesAsyncToken__ + cadesPublicKey.FriendlyName; + algorithmInfo.oid = _generateCadesFn_1.__cadesAsyncToken__ + cadesPublicKey.Value; } catch (error) { console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи'); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при получении алгоритма'); } - let signature; + return algorithmInfo; + })); +}); + + +/***/ }), + +/***/ "./api/certificate/getCadesProp.ts": +/*!*****************************************!*\ + !*** ./api/certificate/getCadesProp.ts ***! + \*****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +const _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); +/** + * Возвращает указанное внутренее свойство у сертификата в формате Cades + * + * @param propName = наименование свойства + * @returns значение запрошенного свойства + */ +exports.getCadesProp = _afterPluginsLoaded_1._afterPluginsLoaded(function (propName) { + const cadesCertificate = this._cadesCertificate; + return eval(_generateCadesFn_1._generateCadesFn(function getCadesProp() { + let propertyValue; try { - signature = _generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.Sign(cadesSigner); + propertyValue = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate[propName]; } catch (error) { console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при обращении к свойству сертификата'); } - return signature; + return propertyValue; })); -})); +}); /***/ }), -/***/ "./api/execute.ts": -/*!************************!*\ - !*** ./api/execute.ts ***! - \************************/ +/***/ "./api/certificate/getDecodedExtendedKeyUsage.ts": +/*!*******************************************************!*\ + !*** ./api/certificate/getDecodedExtendedKeyUsage.ts ***! + \*******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { @@ -3063,46 +3182,124 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); +const constants_1 = __webpack_require__(/*! ../../constants */ "./constants/index.ts"); +const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); /** - * Функция кастомной реализации с доступом к Cades плагину напрямую - * - * @callback executeCallback - * @param exposedAPI - API доступные для кастомной реализации - * @param exposedAPI.cadesplugin - Cades плагин, предоставляемый КриптоПРО - * @param exposedAPI._generateCadesFn - функция, компилирующая тело передаваемой javascript функции для текущей среды - * @param exposedAPI.__cadesAsyncToken__ - синтетический маркер, подменяемый в рантайме - * @param exposedAPI.__createCadesPluginObject__ - функция для создания синхронных/асинхронных Cades объектов - * @param exposedAPI._extractMeaningfulErrorMessage - хелпер для извлечения текста ошибки + * Возвращает расшифрованные ОИД'ы сертификата * - * @returns результат выполнения кастомной реализации + * @returns словарь расшифрованных ОИД'ов */ +exports.getDecodedExtendedKeyUsage = _afterPluginsLoaded_1._afterPluginsLoaded(function () { + return __awaiter(this, void 0, void 0, function* () { + const certificateOids = yield this.getExtendedKeyUsage(); + return certificateOids.reduce((decodedOids, oidCode) => (Object.assign(Object.assign({}, decodedOids), { [oidCode]: constants_1.OIDS_DICTIONARY[oidCode] || null })), {}); + }); +}); + + +/***/ }), + +/***/ "./api/certificate/getExtendedKeyUsage.ts": +/*!************************************************!*\ + !*** ./api/certificate/getExtendedKeyUsage.ts ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +const _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); /** - * Компилирует и выполняет переданную функцию для доступной браузерной среды (синхронной/асинхронной) + * Возвращает ОИД'ы сертификата * - * @param {executeCallback} callback - функция, использующая низкоуровневый доступ к Cades плагину + * @returns список ОИД'ов + */ +exports.getExtendedKeyUsage = _afterPluginsLoaded_1._afterPluginsLoaded(function () { + const cadesCertificate = this._cadesCertificate; + return eval(_generateCadesFn_1._generateCadesFn(function getExtendedKeyUsage() { + const OIDS = []; + let count; + try { + count = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage(); + count = _generateCadesFn_1.__cadesAsyncToken__ + count.EKUs; + count = _generateCadesFn_1.__cadesAsyncToken__ + count.Count; + if (count > 0) { + while (count > 0) { + let cadesExtendedKeyUsage; + cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ExtendedKeyUsage(); + cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesExtendedKeyUsage.EKUs; + cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesExtendedKeyUsage.Item(count); + cadesExtendedKeyUsage = _generateCadesFn_1.__cadesAsyncToken__ + cadesExtendedKeyUsage.OID; + OIDS.push(cadesExtendedKeyUsage); + count--; + } + } + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || "Ошибка при получении ОИД'ов"); + } + return OIDS; + })); +}); + + +/***/ }), + +/***/ "./api/certificate/getInfo.ts": +/*!************************************!*\ + !*** ./api/certificate/getInfo.ts ***! + \************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +const _parseCertInfo_1 = __webpack_require__(/*! ../../helpers/_parseCertInfo */ "./helpers/_parseCertInfo.ts"); +const getCadesProp_1 = __webpack_require__(/*! ./getCadesProp */ "./api/certificate/getCadesProp.ts"); +/** + * Возвращает расшифрованную информацию о сертификате из указанного свойства по тэгам * - * @returns асинхронный результат выполнения передаваемой функции + * @param tags = словарь + * @param entitiesPath = путь к разбираемой сущности + * @returns расшифрованная информация по отдельным тэгам */ -exports.execute = _afterPluginsLoaded_1._afterPluginsLoaded((callback) => __awaiter(void 0, void 0, void 0, function* () { - return yield callback({ - cadesplugin: window.cadesplugin, - _generateCadesFn: _generateCadesFn_1._generateCadesFn, - __cadesAsyncToken__: _generateCadesFn_1.__cadesAsyncToken__, - __createCadesPluginObject__: _generateCadesFn_1.__createCadesPluginObject__, - _extractMeaningfulErrorMessage: _extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage, +exports.getInfo = _afterPluginsLoaded_1._afterPluginsLoaded(function (tags, entitiesPath) { + return __awaiter(this, void 0, void 0, function* () { + let entities; + try { + entities = yield getCadesProp_1.getCadesProp.call(this, entitiesPath); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при извлечении информации из сертификата'); + } + return _parseCertInfo_1._parseCertInfo(tags, entities); }); -})); +}); /***/ }), -/***/ "./api/getCertificate.ts": -/*!*******************************!*\ - !*** ./api/getCertificate.ts ***! - \*******************************/ +/***/ "./api/certificate/hasExtendedKeyUsage.ts": +/*!************************************************!*\ + !*** ./api/certificate/hasExtendedKeyUsage.ts ***! + \************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { @@ -3118,197 +3315,183 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const getUserCertificates_1 = __webpack_require__(/*! ./getUserCertificates */ "./api/getUserCertificates.ts"); +const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); /** - * Возвращает сертификат по отпечатку + * Проверяет наличие ОИД'а (ОИД'ов) у сертификата * - * @param thumbprint - отпечаток сертификата - * @returns сертификат + * @param oids - ОИД'ы для проверки + * @returns флаг наличия ОИД'ов у сертификата */ -exports.getCertificate = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint) => __awaiter(void 0, void 0, void 0, function* () { - if (!thumbprint) { - throw new Error('Отпечаток не указан'); - } - const availableCertificates = yield getUserCertificates_1.getUserCertificates(); - const foundCertificate = availableCertificates.find((cert) => cert.thumbprint === thumbprint); - if (!foundCertificate) { - throw new Error(`Сертификат с отпечатком: "${thumbprint}" не найден`); - } - return foundCertificate; -})); +exports.hasExtendedKeyUsage = _afterPluginsLoaded_1._afterPluginsLoaded(function (oids) { + return __awaiter(this, void 0, void 0, function* () { + const certOids = yield this.getExtendedKeyUsage(); + let result; + if (Array.isArray(oids)) { + result = oids.every((oidToCheck) => certOids.some((certOid) => certOid === oidToCheck)); + } + else { + result = certOids.some((certOid) => certOid === oids); + } + return result; + }); +}); /***/ }), -/***/ "./api/getSystemInfo.ts": -/*!******************************!*\ - !*** ./api/getSystemInfo.ts ***! - \******************************/ +/***/ "./api/certificate/index.ts": +/*!**********************************!*\ + !*** ./api/certificate/index.ts ***! + \**********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} Object.defineProperty(exports, "__esModule", { value: true }); -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"); +__export(__webpack_require__(/*! ./certificate */ "./api/certificate/certificate.ts")); + + +/***/ }), + +/***/ "./api/certificate/isValid.ts": +/*!************************************!*\ + !*** ./api/certificate/isValid.ts ***! + \************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const _afterPluginsLoaded_1 = __webpack_require__(/*! ../../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +const _generateCadesFn_1 = __webpack_require__(/*! ../../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); /** - * Предоставляет информацию о системе + * Проверяет действительность сертификата * - * @returns информацию о CSP и плагине + * @returns флаг валидности */ -exports.getSystemInfo = _afterPluginsLoaded_1._afterPluginsLoaded(() => { - const sysInfo = { - cadesVersion: null, - cspVersion: null, - }; - return eval(_generateCadesFn_1._generateCadesFn(function getSystemInfo() { - let cadesAbout; +exports.isValid = _afterPluginsLoaded_1._afterPluginsLoaded(function () { + const cadesCertificate = this._cadesCertificate; + return eval(_generateCadesFn_1._generateCadesFn(function isValid() { + let isValid; try { - cadesAbout = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.About'); - sysInfo.cadesVersion = _generateCadesFn_1.__cadesAsyncToken__ + cadesAbout.PluginVersion; - sysInfo.cspVersion = _generateCadesFn_1.__cadesAsyncToken__ + cadesAbout.CSPVersion(); - if (!sysInfo.cadesVersion) { - sysInfo.cadesVersion = _generateCadesFn_1.__cadesAsyncToken__ + cadesAbout.Version; - } - sysInfo.cadesVersion = _generateCadesFn_1.__cadesAsyncToken__ + sysInfo.cadesVersion.toString(); - sysInfo.cspVersion = _generateCadesFn_1.__cadesAsyncToken__ + sysInfo.cspVersion.toString(); + isValid = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.IsValid(); + isValid = _generateCadesFn_1.__cadesAsyncToken__ + isValid.Result; } catch (error) { console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при получении информации о системе'); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при проверке сертификата'); } - return sysInfo; + return Boolean(isValid); })); }); /***/ }), -/***/ "./api/getUserCertificates.ts": -/*!************************************!*\ - !*** ./api/getUserCertificates.ts ***! - \************************************/ +/***/ "./api/createAttachedSignature.ts": +/*!****************************************!*\ + !*** ./api/createAttachedSignature.ts ***! + \****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - +/* WEBPACK VAR INJECTION */(function(Buffer) { +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; Object.defineProperty(exports, "__esModule", { value: true }); -const certificate_1 = __webpack_require__(/*! ./certificate */ "./api/certificate/index.ts"); const constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractCommonName_1 = __webpack_require__(/*! ../helpers/_extractCommonName */ "./helpers/_extractCommonName.ts"); const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); -let certificatesCache; +const _getCadesCert_1 = __webpack_require__(/*! ../helpers/_getCadesCert */ "./helpers/_getCadesCert.ts"); +const _getDateObj_1 = __webpack_require__(/*! ../helpers/_getDateObj */ "./helpers/_getDateObj.ts"); /** - * Возвращает список сертификатов, доступных пользователю в системе + * Создает присоединенную подпись сообщения по отпечатку сертификата * - * @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов - * @returns список сертификатов - */ -exports.getUserCertificates = _afterPluginsLoaded_1._afterPluginsLoaded((resetCache = false) => { + * @param thumbprint - отпечаток сертификата + * @param message - подписываемое сообщение + * @returns подпись в формате PKCS#7 + */ +exports.createAttachedSignature = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint, unencryptedMessage) => __awaiter(void 0, void 0, void 0, function* () { const { cadesplugin } = window; - if (!resetCache && certificatesCache) { - return certificatesCache; - } - return eval(_generateCadesFn_1._generateCadesFn(function getUserCertificates() { - let cadesStore; + const cadesCertificate = yield _getCadesCert_1._getCadesCert(thumbprint); + return eval(_generateCadesFn_1._generateCadesFn(function createAttachedSignature() { + let cadesAttrs; + let cadesSignedData; + let cadesSigner; try { - cadesStore = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.Store'); + 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) || 'Ошибка при попытке доступа к хранилищу'); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); } + const currentTime = _getDateObj_1._getDateObj(new Date()); try { - void (_generateCadesFn_1.__cadesAsyncToken__ + - cadesStore.Open(cadesplugin.CAPICOM_CURRENT_USER_STORE, cadesplugin.CAPICOM_MY_STORE, cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED)); + 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) || 'Ошибка при открытии хранилища'); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи'); } - let cadesCertificates; - let cadesCertificatesCount; + let messageBase64; try { - cadesCertificates = _generateCadesFn_1.__cadesAsyncToken__ + cadesStore.Certificates; - if (cadesCertificates) { - cadesCertificates = - _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID); - /** - * Не рассматриваются сертификаты, в которых отсутствует закрытый ключ - * или не действительны на данный момент - */ - cadesCertificates = - _generateCadesFn_1.__cadesAsyncToken__ + - cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY, constants_1.CAPICOM_PROPID_KEY_PROV_INFO); - cadesCertificatesCount = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificates.Count; - } + messageBase64 = Buffer.from(unencryptedMessage).toString('base64'); } catch (error) { console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов'); + throw new Error('Ошибка при преобразовании сообщения в Base64'); } - if (!cadesCertificatesCount) { - throw new Error('Нет доступных сертификатов'); + let cadesAuthAttrs; + try { + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); + cadesAuthAttrs = _generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2; + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_Content(messageBase64)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN)); } - const certificateList = []; + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи'); + } + let signature; try { - while (cadesCertificatesCount) { - const cadesCertificate = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificates.Item(cadesCertificatesCount); - certificateList.push(new certificate_1.Certificate(cadesCertificate, _extractCommonName_1._extractCommonName(_generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.SubjectName), _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.IssuerName, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.SubjectName, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.Thumbprint, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ValidFromDate, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ValidToDate)); - cadesCertificatesCount--; - } + signature = _generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_PKCS7_TYPE); } catch (error) { console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка обработки сертификатов'); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); } - cadesStore.Close(); - certificatesCache = certificateList; - return certificatesCache; + return signature; })); -}); - - -/***/ }), - -/***/ "./api/index.ts": -/*!**********************!*\ - !*** ./api/index.ts ***! - \**********************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(/*! ./getCertificate */ "./api/getCertificate.ts")); -__export(__webpack_require__(/*! ./getUserCertificates */ "./api/getUserCertificates.ts")); -__export(__webpack_require__(/*! ./getSystemInfo */ "./api/getSystemInfo.ts")); -__export(__webpack_require__(/*! ./isValidSystemSetup */ "./api/isValidSystemSetup.ts")); -__export(__webpack_require__(/*! ./createSignature */ "./api/createSignature.ts")); -__export(__webpack_require__(/*! ./createXMLSignature */ "./api/createXMLSignature.ts")); -__export(__webpack_require__(/*! ./createDetachedSignature */ "./api/createDetachedSignature.ts")); -__export(__webpack_require__(/*! ./createAttachedSignature */ "./api/createAttachedSignature.ts")); -__export(__webpack_require__(/*! ./createHash */ "./api/createHash.ts")); -__export(__webpack_require__(/*! ./certificate */ "./api/certificate/index.ts")); -__export(__webpack_require__(/*! ./execute */ "./api/execute.ts")); +})); +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../node_modules/buffer/index.js */ "../node_modules/buffer/index.js").Buffer)) /***/ }), -/***/ "./api/isValidSystemSetup.ts": -/*!***********************************!*\ - !*** ./api/isValidSystemSetup.ts ***! - \***********************************/ +/***/ "./api/createDetachedSignature.ts": +/*!****************************************!*\ + !*** ./api/createDetachedSignature.ts ***! + \****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { @@ -3324,363 +3507,254 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", { value: true }); +const constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _isSupportedCadesVersion_1 = __webpack_require__(/*! ../helpers/_isSupportedCadesVersion */ "./helpers/_isSupportedCadesVersion.ts"); -const _isSupportedCSPVersion_1 = __webpack_require__(/*! ../helpers/_isSupportedCSPVersion */ "./helpers/_isSupportedCSPVersion.ts"); -const getSystemInfo_1 = __webpack_require__(/*! ./getSystemInfo */ "./api/getSystemInfo.ts"); +const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); +const _getCadesCert_1 = __webpack_require__(/*! ../helpers/_getCadesCert */ "./helpers/_getCadesCert.ts"); +const _getDateObj_1 = __webpack_require__(/*! ../helpers/_getDateObj */ "./helpers/_getDateObj.ts"); /** - * Проверяет корректность настроек ЭП на машине + * Создает отсоединенную подпись хеша по отпечатку сертификата * - * @returns флаг корректности настроек + * @param thumbprint - отпечаток сертификата + * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11-2012 256 бит + * @returns подпись в формате PKCS#7 */ -exports.isValidSystemSetup = _afterPluginsLoaded_1._afterPluginsLoaded(() => __awaiter(void 0, void 0, void 0, function* () { - let systemInfo; - try { - systemInfo = yield getSystemInfo_1.getSystemInfo(); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Настройки ЭП на данной машине не верны'); - } - if (!_isSupportedCadesVersion_1._isSupportedCadesVersion(systemInfo.cadesVersion)) { - throw new Error('Не поддерживаемая версия плагина'); - } - if (!_isSupportedCSPVersion_1._isSupportedCSPVersion(systemInfo.cspVersion)) { - throw new Error('Не поддерживаемая версия CSP'); - } - return true; +exports.createDetachedSignature = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint, messageHash) => __awaiter(void 0, void 0, void 0, function* () { + const { cadesplugin } = window; + const cadesCertificate = yield _getCadesCert_1._getCadesCert(thumbprint); + return eval(_generateCadesFn_1._generateCadesFn(function createDetachedSignature() { + let cadesAttrs; + let cadesHashedData; + let cadesSignedData; + let cadesSigner; + try { + cadesAttrs = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CADESCOM.CPAttribute'); + cadesHashedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.HashedData'); + cadesSignedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CadesSignedData'); + cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); + } + const currentTime = _getDateObj_1._getDateObj(new Date()); + try { + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Name(constants_1.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime)); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи'); + } + let cadesAuthAttrs; + try { + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); + cadesAuthAttrs = _generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2; + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN)); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке сертификата'); + } + try { + void (_generateCadesFn_1.__cadesAsyncToken__ + + cadesHashedData.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.SetHashValue(messageHash)); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке хеша'); + } + let signature; + try { + signature = + _generateCadesFn_1.__cadesAsyncToken__ + + cadesSignedData.SignHash(cadesHashedData, cadesSigner, cadesplugin.CADESCOM_PKCS7_TYPE); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); + } + return signature; + })); })); /***/ }), -/***/ "./constants/cades-constants.ts": -/*!**************************************!*\ - !*** ./constants/cades-constants.ts ***! - \**************************************/ +/***/ "./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 }); -exports.CADESCOM_ATTRIBUTE_OTHER = -1; -exports.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; -exports.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; -exports.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0; -exports.CADESCOM_AllowNoOutstandingRequest = 1; -exports.CADESCOM_AllowNone = 0; -exports.CADESCOM_AllowUntrustedCertificate = 2; -exports.CADESCOM_AllowUntrustedRoot = 4; -exports.CADESCOM_BASE64_TO_BINARY = 0x01; -exports.CADESCOM_CADES_BES = 1; -exports.CADESCOM_CADES_DEFAULT = 0; -exports.CADESCOM_CADES_T = 5; -exports.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d; -exports.CADESCOM_CONTAINER_STORE = 100; -exports.CADESCOM_CURRENT_USER_STORE = 2; -exports.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2; -exports.CADESCOM_DISPLAY_DATA_CONTENT = 1; -exports.CADESCOM_DISPLAY_DATA_NONE = 0; -exports.CADESCOM_ENCODE_ANY = -1; -exports.CADESCOM_ENCODE_BASE64 = 0; -exports.CADESCOM_ENCODE_BINARY = 1; -exports.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3; -exports.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4; -exports.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2; -exports.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25; -exports.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0; -exports.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112; -exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110; -exports.CADESCOM_HASH_ALGORITHM_MD2 = 1; -exports.CADESCOM_HASH_ALGORITHM_MD4 = 2; -exports.CADESCOM_HASH_ALGORITHM_MD5 = 3; -exports.CADESCOM_HASH_ALGORITHM_SHA1 = 0; -exports.CADESCOM_HASH_ALGORITHM_SHA_256 = 4; -exports.CADESCOM_HASH_ALGORITHM_SHA_384 = 5; -exports.CADESCOM_HASH_ALGORITHM_SHA_512 = 6; -exports.CADESCOM_LOCAL_MACHINE_STORE = 1; -exports.CADESCOM_PKCS7_TYPE = 65535; -exports.CADESCOM_STRING_TO_UCS2LE = 0x00; -exports.CADESCOM_SkipInstallToStore = 268435456; -exports.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0; -exports.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1; -exports.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2; -exports.CAPICOM_ACTIVE_DIRECTORY_USER_STORE = 3; -exports.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; -exports.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; -exports.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0; -exports.CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7; -exports.CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8; -exports.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6; -exports.CAPICOM_CERTIFICATE_FIND_EXTENSION = 5; -exports.CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2; -exports.CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12; -exports.CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3; -exports.CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0; -exports.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1; -exports.CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4; -exports.CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11; -exports.CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10; -exports.CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9; -exports.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0; -exports.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2; -exports.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1; -exports.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1; -exports.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0; -exports.CAPICOM_CURRENT_USER_STORE = 2; -exports.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128; -exports.CAPICOM_EKU_CLIENT_AUTH = 2; -exports.CAPICOM_EKU_OTHER = 0; -exports.CAPICOM_EKU_SMARTCARD_LOGON = 5; -exports.CAPICOM_LOCAL_MACHINE_STORE = 1; -exports.CAPICOM_MEMORY_STORE = 0; -exports.CAPICOM_MY_STORE = 'My'; -exports.CAPICOM_OID_KEY_USAGE_EXTENSION = 10; -exports.CAPICOM_OID_OTHER = 0; -exports.CAPICOM_PROPID_ACCESS_STATE = 14; -exports.CAPICOM_PROPID_ARCHIVED = 19; -exports.CAPICOM_PROPID_ARCHIVED_KEY_HASH = 65; -exports.CAPICOM_PROPID_AUTO_ENROLL = 21; -exports.CAPICOM_PROPID_CROSS_CERT_DIST_POINTS = 23; -exports.CAPICOM_PROPID_CTL_USAGE = 9; -exports.CAPICOM_PROPID_DATE_STAMP = 27; -exports.CAPICOM_PROPID_DESCRIPTION = 13; -exports.CAPICOM_PROPID_EFS = 17; -exports.CAPICOM_PROPID_ENHKEY_USAGE = 9; -exports.CAPICOM_PROPID_ENROLLMENT = 26; -exports.CAPICOM_PROPID_EXTENDED_ERROR_INFO = 30; -exports.CAPICOM_PROPID_FIRST_RESERVED = 66; -exports.CAPICOM_PROPID_FIRST_USER = 0x00008000; -exports.CAPICOM_PROPID_FORTEZZA_DATA = 18; -exports.CAPICOM_PROPID_FRIENDLY_NAME = 11; -exports.CAPICOM_PROPID_HASH_PROP = 3; -exports.CAPICOM_PROPID_IE30_RESERVED = 7; -exports.CAPICOM_PROPID_ISSUER_PUBLIC_KEY_MD5_HASH = 24; -exports.CAPICOM_PROPID_ISSUER_SERIAL_NUMBER_MD5_HASH = 28; -exports.CAPICOM_PROPID_KEY_CONTEXT = 5; -exports.CAPICOM_PROPID_KEY_IDENTIFIER = 20; -exports.CAPICOM_PROPID_KEY_PROV_HANDLE = 1; -exports.CAPICOM_PROPID_KEY_PROV_INFO = 2; -exports.CAPICOM_PROPID_KEY_SPEC = 6; -exports.CAPICOM_PROPID_LAST_RESERVED = 0x00007fff; -exports.CAPICOM_PROPID_LAST_USER = 0x0000ffff; -exports.CAPICOM_PROPID_MD5_HASH = 4; -exports.CAPICOM_PROPID_NEXT_UPDATE_LOCATION = 10; -exports.CAPICOM_PROPID_PUBKEY_ALG_PARA = 22; -exports.CAPICOM_PROPID_PUBKEY_HASH_RESERVED = 8; -exports.CAPICOM_PROPID_PVK_FILE = 12; -exports.CAPICOM_PROPID_RENEWAL = 64; -exports.CAPICOM_PROPID_SHA1_HASH = 3; -exports.CAPICOM_PROPID_SIGNATURE_HASH = 15; -exports.CAPICOM_PROPID_SMART_CARD_DATA = 16; -exports.CAPICOM_PROPID_SUBJECT_NAME_MD5_HASH = 29; -exports.CAPICOM_PROPID_SUBJECT_PUBLIC_KEY_MD5_HASH = 25; -exports.CAPICOM_PROPID_UNKNOWN = 0; -exports.CAPICOM_SMART_CARD_USER_STORE = 4; -exports.CAPICOM_STORE_OPEN_EXISTING_ONLY = 128; -exports.CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED = 256; -exports.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2; -exports.CAPICOM_STORE_OPEN_READ_ONLY = 0; -exports.CAPICOM_STORE_OPEN_READ_WRITE = 1; -exports.CHECK_NONE = 0; -exports.CHECK_OFFLINE_REVOCATION_STATUS = 16; -exports.CHECK_ONLINE_REVOCATION_STATUS = 8; -exports.CHECK_SIGNATURE_VALIDITY = 4; -exports.CHECK_TIME_VALIDITY = 2; -exports.CHECK_TRUSTED_ROOT = 1; -exports.LOG_LEVEL_DEBUG = 4; -exports.LOG_LEVEL_ERROR = 1; -exports.LOG_LEVEL_INFO = 2; -exports.TRUST_CTL_IS_NOT_SIGNATURE_VALID = 262144; -exports.TRUST_CTL_IS_NOT_TIME_VALID = 131072; -exports.TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 524288; -exports.TRUST_IS_CYCLIC = 128; -exports.TRUST_IS_NOT_SIGNATURE_VALID = 8; -exports.TRUST_IS_NOT_TIME_NESTED = 2; -exports.TRUST_IS_NOT_TIME_VALID = 1; -exports.TRUST_IS_NOT_VALID_FOR_USAGE = 16; -exports.TRUST_IS_PARTIAL_CHAIN = 65536; -exports.TRUST_IS_REVOKED = 4; -exports.TRUST_IS_UNTRUSTED_ROOT = 32; -exports.TRUST_REVOCATION_STATUS_UNKNOWN = 64; -exports.XmlDsigGost3410Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411'; -exports.XmlDsigGost3410UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411'; -exports.XmlDsigGost3411Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411'; -exports.XmlDsigGost3411UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr3411'; - - -/***/ }), - -/***/ "./constants/index.ts": -/*!****************************!*\ - !*** ./constants/index.ts ***! - \****************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(/*! ./cades-constants */ "./constants/cades-constants.ts")); -__export(__webpack_require__(/*! ./issuer-tags-translations */ "./constants/issuer-tags-translations.ts")); -__export(__webpack_require__(/*! ./oids-dictionary */ "./constants/oids-dictionary.ts")); -__export(__webpack_require__(/*! ./subject-tags-translations */ "./constants/subject-tags-translations.ts")); - - -/***/ }), - -/***/ "./constants/issuer-tags-translations.ts": -/*!***********************************************!*\ - !*** ./constants/issuer-tags-translations.ts ***! - \***********************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ISSUER_TAGS_TRANSLATIONS = [ - { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' }, - { possibleNames: ['CN'], translation: 'Удостоверяющий центр' }, - { possibleNames: ['C'], translation: 'Страна' }, - { possibleNames: ['S'], translation: 'Регион' }, - { possibleNames: ['STREET'], translation: 'Адрес' }, - { possibleNames: ['O'], translation: 'Компания' }, - { possibleNames: ['OU'], translation: 'Тип' }, - { possibleNames: ['T'], translation: 'Должность' }, - { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' }, - { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' }, - { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' }, - { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' }, - { possibleNames: ['E'], translation: 'Email' }, - { possibleNames: ['L'], translation: 'Город' }, -]; +const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); +/** + * Создает хеш сообщения по ГОСТ Р 34.11-2012 (по умолчанию 256 бит) + * https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%B8%D0%B1%D0%BE%D0%B3_(%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F) + * + * @param unencryptedMessage - сообщение для хеширования + * @hashedAlgorithm - алгоритм хеширования. По умолчанию - CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256. + * + * @returns хеш + */ +exports.createHash = _afterPluginsLoaded_1._afterPluginsLoaded((unencryptedMessage, options) => __awaiter(void 0, void 0, void 0, function* () { + const { cadesplugin } = window; + return eval(_generateCadesFn_1._generateCadesFn(function createHash() { + var _a; + const cadesHashedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.HashedData'); + let messageBase64; + let hash; + try { + if ((options === null || options === void 0 ? void 0 : options.encoding) && typeof unencryptedMessage === 'string') { + messageBase64 = Buffer.from(unencryptedMessage, options === null || options === void 0 ? void 0 : options.encoding).toString('base64'); + } + else { + messageBase64 = Buffer.from(unencryptedMessage).toString('base64'); + } + } + catch (error) { + console.error(error); + throw new Error('Ошибка при преобразовании сообщения в Base64'); + } + try { + void (_generateCadesFn_1.__cadesAsyncToken__ + + cadesHashedData.propset_Algorithm((_a = options === null || options === void 0 ? void 0 : options.hashedAlgorithm) !== null && _a !== void 0 ? _a : 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)) /***/ }), -/***/ "./constants/oids-dictionary.ts": -/*!**************************************!*\ - !*** ./constants/oids-dictionary.ts ***! - \**************************************/ +/***/ "./api/createSignature.ts": +/*!********************************!*\ + !*** ./api/createSignature.ts ***! + \********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.OIDS_DICTIONARY = { - '1.2.643.2.2.34.6': 'Пользователь Центра Регистрации', - '1.2.643.2.39.1.1': 'Использование в программных продуктах системы "1С:Предприятие 8"', - '1.2.643.3.131.1.1': 'ИНН', - '1.2.643.3.141.1.1': 'РНС ФСС', - '1.2.643.3.141.1.2': 'КП ФСС', - '1.2.643.3.2.100.65.13.11': 'Использование в системе АИС "Госзакупки" Сахалинской области.', - '1.2.643.3.8.100.1': 'Сертификат типа "ekey-ГОСТ"', - '1.2.643.3.8.100.1.1': 'Общее использование в системах ИОК без права заверения финансовых документов', - '1.2.643.3.8.100.1.10': 'Для участия в электронных торгах и подписания государственного контракта в информационных системах Тендерного комитета города Москвы уполномоченными лицами участников размещения государственного заказа города Москвы', - '1.2.643.3.8.100.1.11': 'Подписание электронных документов в автоматизированной информационной системе размещения государственного и муниципального заказа Саратовской области', - '1.2.643.3.8.100.1.12': 'Использование в системе государственного заказа Иркутской области', - '1.2.643.3.8.100.1.13': 'Использование в электронной торговой площадке агентства государственного заказа Красноярского края', - '1.2.643.3.8.100.1.14': 'Использование в электронной торговой площадке "Тендер"', - '1.2.643.3.8.100.1.2': 'Передача отчетности по ТКС', - '1.2.643.3.8.100.1.3': 'Оформление взаимных обязательств, соглашений, договоров, актов и т.п.', - '1.2.643.3.8.100.1.4': 'Внутрикорпоративный документооборот', - '1.2.643.3.8.100.1.5': 'Использование в системах электронной торговли', - '1.2.643.3.8.100.1.6': 'Использование в торгово-закупочной системе "ЭЛЕКТРА"', - '1.2.643.3.8.100.1.7': 'Использование в системе Портал государственных закупок Ставропольского края.', - '1.2.643.3.8.100.1.8': 'Использование в Единой системе электронной торговли B2B-Center и B2G.', - '1.2.643.3.8.100.1.9': 'Для участия в электронных торгах и подписания государственного контракта в электронной площадке ОАО «ЕЭТП» уполномоченными лицами участников размещения государственного или муниципального заказа', - '1.2.643.5.1.24.2.1.3': 'Формирование документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя', - '1.2.643.5.1.24.2.1.3.1': 'Формирование кадастровым инженером документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя', - '1.2.643.5.1.24.2.2.2': 'Формирование документов как результата оказания услуги со стороны органов регистрации прав', - '1.2.643.5.1.24.2.2.3': 'Формирование документов для получения государственных услуг в сфере государственной регистрации прав на недвижимое имущество и сделок с ним со стороны заявителя', - '1.2.643.6.2.1.7.1': 'Использование единоличным исполнительным органом юридического лица или уполномоченными представителями юридического лица в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских и иных прав и обязанностей в сфере негосударственного пенсионного обеспечения, негосударственного пенсионного страхования, в сфере деятельности паевых инвестиционных фондов, акционерных инвестиционных фондов, профессиональных участников рынка ценных бумаг, а также связанной с обслуживанием указанной деятельности услуг кредитных и иных организаций', - '1.2.643.6.2.1.7.2': 'Использование физическим лицом в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских прав и обязанностей в отношении инвестиционных паев паевых инвестиционных фондов, в том числе отношения, связанные с учетом и/или фиксацией прав на инвестиционные паи паевых инвестиционных фондов', - '1.2.643.6.3': 'Использование в электронных торговых системах и в программном обеспечении, связанным с обменом электронных сообщений', - '1.2.643.6.3.1.1': 'Использование на электронных площадок отобранных для проведения аукционах в электронной форме', - '1.2.643.6.3.1.2.1': 'Тип участника - Юридическое лицо', - '1.2.643.6.3.1.2.2': 'Тип участника - Физическое лицо', - '1.2.643.6.3.1.2.3': 'Тип участника - Индивидуальный предприниматель', - '1.2.643.6.3.1.3.1': 'Участник размещения заказа', - '1.2.643.6.3.1.4.1': 'Администратор организации', - '1.2.643.6.3.1.4.2': 'Уполномоченный специалист', - '1.2.643.6.3.1.4.3': 'Специалист с правом подписи контракта', - '1.2.840.113549.1.9.2': 'Неструктурированное имя', - '1.3.6.1.4.1.24138.1.1.8.1': 'Обеспечение юридической значимости в Системе "Электронная Торговая Площадка"', - '1.3.6.1.4.1.29919.21': 'Использование в системе Портал государственных закупок Ростовской области "Рефери".', - '1.3.6.1.5.5.7.3.2': 'Проверка подлинности клиента', - '1.3.6.1.5.5.7.3.4': 'Защищенная электронная почта', - '1.3.643.3.8.100.15': 'Использование в ЭТП "uTender"', +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()); + }); }; - - -/***/ }), - -/***/ "./constants/subject-tags-translations.ts": -/*!************************************************!*\ - !*** ./constants/subject-tags-translations.ts ***! - \************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); -exports.SUBJECT_TAGS_TRANSLATIONS = [ - { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' }, - { possibleNames: ['CN'], translation: 'Владелец' }, - { possibleNames: ['SN'], translation: 'Фамилия' }, - { possibleNames: ['G'], translation: 'Имя Отчество' }, - { possibleNames: ['C'], translation: 'Страна' }, - { possibleNames: ['S'], translation: 'Регион' }, - { possibleNames: ['STREET'], translation: 'Адрес' }, - { possibleNames: ['O'], translation: 'Компания' }, - { possibleNames: ['OU'], translation: 'Отдел/подразделение' }, - { possibleNames: ['T'], translation: 'Должность' }, - { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' }, - { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' }, - { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' }, - { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' }, - { possibleNames: ['E'], translation: 'Email' }, - { possibleNames: ['L'], translation: 'Город' }, -]; - - -/***/ }), - -/***/ "./crypto-pro.ts": -/*!***********************!*\ - !*** ./crypto-pro.ts ***! - \***********************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -__export(__webpack_require__(/*! ./api */ "./api/index.ts")); +const constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); +const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); +const _getCadesCert_1 = __webpack_require__(/*! ../helpers/_getCadesCert */ "./helpers/_getCadesCert.ts"); +const _getDateObj_1 = __webpack_require__(/*! ../helpers/_getDateObj */ "./helpers/_getDateObj.ts"); +/** + * Создает подпись base64 строки по отпечатку сертификата + * + * @param thumbprint - отпечаток сертификата + * @param messageHash - хеш подписываемого сообщения, сгенерированный по ГОСТ Р 34.11 + * @param detachedSignature = true - тип подписи открепленная (true) / присоединенная (false) + * @returns подпись + */ +exports.createSignature = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint, messageHash, detachedSignature = true) => __awaiter(void 0, void 0, void 0, function* () { + console.warn([ + 'cryptoPro: Метод "createSignature" является устаревшим и будет убран из будущих версий.', + 'Используйте "createAttachedSignature" и "createDetachedSignature".', + ].join('\n')); + const { cadesplugin } = window; + const cadesCertificate = yield _getCadesCert_1._getCadesCert(thumbprint); + return eval(_generateCadesFn_1._generateCadesFn(function createSignature() { + let cadesAttrs; + let cadesSignedData; + let cadesSigner; + try { + cadesAttrs = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CADESCOM.CPAttribute'); + cadesSignedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CadesSignedData'); + cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); + } + const currentTime = _getDateObj_1._getDateObj(new Date()); + try { + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Name(constants_1.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAttrs.propset_Value(currentTime)); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при установке времени подписи'); + } + let cadesAuthAttrs; + try { + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); + cadesAuthAttrs = _generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.AuthenticatedAttributes2; + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesAuthAttrs.Add(cadesAttrs)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_ContentEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedData.propset_Content(messageHash)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Options(cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY)); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи'); + } + let signature; + try { + signature = + _generateCadesFn_1.__cadesAsyncToken__ + + cadesSignedData.SignCades(cadesSigner, cadesplugin.CADESCOM_CADES_BES, detachedSignature); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); + } + return signature; + })); +})); /***/ }), -/***/ "./helpers/_afterPluginsLoaded.ts": -/*!****************************************!*\ - !*** ./helpers/_afterPluginsLoaded.ts ***! - \****************************************/ +/***/ "./api/createXMLSignature.ts": +/*!***********************************!*\ + !*** ./api/createXMLSignature.ts ***! + \***********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { @@ -3696,155 +3770,233 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", { value: true }); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ./_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -let isSetLogLevel = false; -let isPluginLoaded = false; -exports._afterPluginsLoaded = (fn) => { - const canPromise = Boolean(window.Promise); - return function (...args) { - return __awaiter(this, void 0, void 0, function* () { - if (!isPluginLoaded) { - try { - __webpack_require__(/*! ../vendor/cadesplugin_api */ "./vendor/cadesplugin_api.js"); - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подключении модуля для работы с Cades plugin'); - } - isPluginLoaded = true; - } - const { cadesplugin } = window; - if (!canPromise) { - throw new Error('Необходим полифилл для Promise'); - } - if (!cadesplugin) { - throw new Error('Не подключен модуль для работы с Cades plugin'); - } - if (!isSetLogLevel) { - cadesplugin.set_log_level(cadesplugin.LOG_LEVEL_ERROR); - isSetLogLevel = true; - } - try { - yield cadesplugin; - } - catch (error) { - console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации модуля для работы с Cades plugin'); - } - return yield fn.apply(this, args); - }); - }; -}; +const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); +const _getCadesCert_1 = __webpack_require__(/*! ../helpers/_getCadesCert */ "./helpers/_getCadesCert.ts"); +/** + * Создает XML подпись для документа в формате XML + * + * @param thumbprint - отпечаток сертификата + * @param unencryptedMessage - подписываемое сообщение в формате XML + * @returns подпись + */ +exports.createXMLSignature = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint, unencryptedMessage) => __awaiter(void 0, void 0, void 0, function* () { + const { cadesplugin } = window; + const cadesCertificate = yield _getCadesCert_1._getCadesCert(thumbprint); + return eval(_generateCadesFn_1._generateCadesFn(function createXMLSignature() { + let cadesSigner; + let cadesSignedXML; + try { + cadesSigner = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.CPSigner'); + cadesSignedXML = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.SignedXML'); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи'); + } + try { + const signatureMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256'; + const digestMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256'; + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSigner.propset_CheckCertificate(true)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.propset_Content(unencryptedMessage)); + void (_generateCadesFn_1.__cadesAsyncToken__ + + cadesSignedXML.propset_SignatureType(cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.propset_SignatureMethod(signatureMethod)); + void (_generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.propset_DigestMethod(digestMethod)); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при указании данных для подписи'); + } + let signature; + try { + signature = _generateCadesFn_1.__cadesAsyncToken__ + cadesSignedXML.Sign(cadesSigner); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подписании данных'); + } + return signature; + })); +})); /***/ }), -/***/ "./helpers/_extractCommonName.ts": -/*!***************************************!*\ - !*** ./helpers/_extractCommonName.ts ***! - \***************************************/ +/***/ "./api/execute.ts": +/*!************************!*\ + !*** ./api/execute.ts ***! + \************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; Object.defineProperty(exports, "__esModule", { value: true }); -exports._extractCommonName = (subjectName) => { var _a; return (_a = subjectName.match(/CN=(.+?)(?:,|$)/)) === null || _a === void 0 ? void 0 : _a[1]; }; +const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); +/** + * Функция кастомной реализации с доступом к Cades плагину напрямую + * + * @callback executeCallback + * @param exposedAPI - API доступные для кастомной реализации + * @param exposedAPI.cadesplugin - Cades плагин, предоставляемый КриптоПРО + * @param exposedAPI._generateCadesFn - функция, компилирующая тело передаваемой javascript функции для текущей среды + * @param exposedAPI.__cadesAsyncToken__ - синтетический маркер, подменяемый в рантайме + * @param exposedAPI.__createCadesPluginObject__ - функция для создания синхронных/асинхронных Cades объектов + * @param exposedAPI._extractMeaningfulErrorMessage - хелпер для извлечения текста ошибки + * + * @returns результат выполнения кастомной реализации + */ +/** + * Компилирует и выполняет переданную функцию для доступной браузерной среды (синхронной/асинхронной) + * + * @param {executeCallback} callback - функция, использующая низкоуровневый доступ к Cades плагину + * + * @returns асинхронный результат выполнения передаваемой функции + */ +exports.execute = _afterPluginsLoaded_1._afterPluginsLoaded((callback) => __awaiter(void 0, void 0, void 0, function* () { + return yield callback({ + cadesplugin: window.cadesplugin, + _generateCadesFn: _generateCadesFn_1._generateCadesFn, + __cadesAsyncToken__: _generateCadesFn_1.__cadesAsyncToken__, + __createCadesPluginObject__: _generateCadesFn_1.__createCadesPluginObject__, + _extractMeaningfulErrorMessage: _extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage, + }); +})); /***/ }), -/***/ "./helpers/_extractMeaningfulErrorMessage.ts": -/*!***************************************************!*\ - !*** ./helpers/_extractMeaningfulErrorMessage.ts ***! - \***************************************************/ +/***/ "./api/getCertificate.ts": +/*!*******************************!*\ + !*** ./api/getCertificate.ts ***! + \*******************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; Object.defineProperty(exports, "__esModule", { value: true }); -exports._extractMeaningfulErrorMessage = (error) => { - var _a; - let errorContainer = ((_a = window.cadesplugin) === null || _a === void 0 ? void 0 : _a.getLastError) && window.cadesplugin.getLastError(error); - if (!(errorContainer === null || errorContainer === void 0 ? void 0 : errorContainer.message)) { - if (!error.message) { - return null; - } - errorContainer = error; +const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +const getUserCertificates_1 = __webpack_require__(/*! ./getUserCertificates */ "./api/getUserCertificates.ts"); +/** + * Возвращает сертификат по отпечатку + * + * @param thumbprint - отпечаток сертификата + * @returns сертификат + */ +exports.getCertificate = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint) => __awaiter(void 0, void 0, void 0, function* () { + if (!thumbprint) { + throw new Error('Отпечаток не указан'); } - const containsRussianLetters = /[а-яА-Я]/.test(errorContainer.message); - if (!containsRussianLetters) { - return null; + const availableCertificates = yield getUserCertificates_1.getUserCertificates(); + const foundCertificate = availableCertificates.find((cert) => cert.thumbprint === thumbprint); + if (!foundCertificate) { + throw new Error(`Сертификат с отпечатком: "${thumbprint}" не найден`); } - const searchResult = errorContainer.message.match(/^(.*?)(?:(?:\.?\s?\(?0x)|(?:\.?$))/); - return searchResult ? searchResult[1] : null; -}; + return foundCertificate; +})); /***/ }), -/***/ "./helpers/_generateCadesFn.ts": -/*!*************************************!*\ - !*** ./helpers/_generateCadesFn.ts ***! - \*************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -// синтетические переменные, которые подменяются в рантайме -exports.__cadesAsyncToken__ = {}; -exports.__createCadesPluginObject__ = (...args) => ({}); -function getGeneratorConstructor() { - return new Function('', 'return Object.getPrototypeOf(function*(){}).constructor')(); -} -exports._generateCadesFn = (callback) => { - var _a; - const { cadesplugin } = window; - const cadesGeneratorsAPI = Boolean(cadesplugin.CreateObjectAsync); - const callbackName = callback.name || 'dynamicFn'; - const callbackLiteral = String(callback); - const callbackArguments = ((_a = callbackLiteral.match(/^function[\s\w]*?\((.*?)\)/)) === null || _a === void 0 ? void 0 : _a[1]) || ''; - const callbackBody = callbackLiteral.replace(/^.*?{([\s\S]*?)}$/, '$1'); - let crossEnvCallbackLiteral = String(new (cadesGeneratorsAPI ? getGeneratorConstructor() : Function)(callbackArguments, callbackBody)); - crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/(?:\w+?\.)?__createCadesPluginObject__(\([\s\S]*?\))/gm, `cadesplugin.CreateObject${cadesGeneratorsAPI ? 'Async' : ''}$1`); - crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/(?:\w+?\.)?__cadesAsyncToken__\s*?\+\s*?\b/gm, cadesGeneratorsAPI ? 'yield ' : ''); - if (!cadesGeneratorsAPI) { - crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/propset_(.*?)\((.*?)\)/gm, '$1 = $2'); - } - return [ - cadesGeneratorsAPI ? `cadesplugin.async_spawn(${crossEnvCallbackLiteral});` : `(${crossEnvCallbackLiteral})();`, - `//# sourceURL=crypto-pro_${callbackName}.js`, - ].join(''); -}; +/***/ "./api/getSystemInfo.ts": +/*!******************************!*\ + !*** ./api/getSystemInfo.ts ***! + \******************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); +/** + * Предоставляет информацию о системе + * + * @returns информацию о CSP и плагине + */ +exports.getSystemInfo = _afterPluginsLoaded_1._afterPluginsLoaded(() => { + const sysInfo = { + cadesVersion: null, + cspVersion: null, + }; + return eval(_generateCadesFn_1._generateCadesFn(function getSystemInfo() { + let cadesAbout; + try { + cadesAbout = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.About'); + sysInfo.cadesVersion = _generateCadesFn_1.__cadesAsyncToken__ + cadesAbout.PluginVersion; + sysInfo.cspVersion = _generateCadesFn_1.__cadesAsyncToken__ + cadesAbout.CSPVersion(); + if (!sysInfo.cadesVersion) { + sysInfo.cadesVersion = _generateCadesFn_1.__cadesAsyncToken__ + cadesAbout.Version; + } + sysInfo.cadesVersion = _generateCadesFn_1.__cadesAsyncToken__ + sysInfo.cadesVersion.toString(); + sysInfo.cspVersion = _generateCadesFn_1.__cadesAsyncToken__ + sysInfo.cspVersion.toString(); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при получении информации о системе'); + } + return sysInfo; + })); +}); /***/ }), -/***/ "./helpers/_getCadesCert.ts": -/*!**********************************!*\ - !*** ./helpers/_getCadesCert.ts ***! - \**********************************/ +/***/ "./api/getUserCertificates.ts": +/*!************************************!*\ + !*** ./api/getUserCertificates.ts ***! + \************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const _afterPluginsLoaded_1 = __webpack_require__(/*! ./_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); -const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ./_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); -const _generateCadesFn_1 = __webpack_require__(/*! ./_generateCadesFn */ "./helpers/_generateCadesFn.ts"); +const certificate_1 = __webpack_require__(/*! ./certificate */ "./api/certificate/index.ts"); +const constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); +const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +const _extractCommonName_1 = __webpack_require__(/*! ../helpers/_extractCommonName */ "./helpers/_extractCommonName.ts"); +const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); +let certificatesCache; /** - * Возвращает сертификат в формате Cades по отпечатку + * Возвращает список сертификатов, доступных пользователю в системе * - * @param thumbprint - отпечаток сертификата - * @returns сертификат в формате Cades + * @param resetCache = false - позволяет сбросить кэш ранее полученных сертификатов + * @returns список сертификатов */ -exports._getCadesCert = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint) => { +exports.getUserCertificates = _afterPluginsLoaded_1._afterPluginsLoaded((resetCache = false) => { const { cadesplugin } = window; - return eval(_generateCadesFn_1._generateCadesFn(function _getCadesCert() { + if (!resetCache && certificatesCache) { + return certificatesCache; + } + return eval(_generateCadesFn_1._generateCadesFn(function getUserCertificates() { let cadesStore; try { cadesStore = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.Store'); @@ -3853,9 +4005,6 @@ exports._getCadesCert = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint) = console.error(error); throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу'); } - if (!cadesStore) { - throw new Error('Не удалось получить доступ к хранилищу сертификатов'); - } try { void (_generateCadesFn_1.__cadesAsyncToken__ + cadesStore.Open(cadesplugin.CAPICOM_CURRENT_USER_STORE, cadesplugin.CAPICOM_MY_STORE, cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED)); @@ -3864,938 +4013,789 @@ exports._getCadesCert = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint) = console.error(error); throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища'); } - let cadesCertificateList; - let certificatesCount; + let cadesCertificates; + let cadesCertificatesCount; try { - cadesCertificateList = _generateCadesFn_1.__cadesAsyncToken__ + cadesStore.Certificates; - certificatesCount = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Count; + cadesCertificates = _generateCadesFn_1.__cadesAsyncToken__ + cadesStore.Certificates; + if (cadesCertificates) { + cadesCertificates = + _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID); + /** + * Не рассматриваются сертификаты, в которых отсутствует закрытый ключ + * или не действительны на данный момент + */ + cadesCertificates = + _generateCadesFn_1.__cadesAsyncToken__ + + cadesCertificates.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY, constants_1.CAPICOM_PROPID_KEY_PROV_INFO); + cadesCertificatesCount = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificates.Count; + } } catch (error) { console.error(error); throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов'); } - if (!certificatesCount) { + if (!cadesCertificatesCount) { throw new Error('Нет доступных сертификатов'); } - let cadesCertificate; + const certificateList = []; try { - cadesCertificateList = - _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH, thumbprint); - const count = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Count; - if (!count) { - throw new Error(`Сертификат с отпечатком: "${thumbprint}" не найден`); + while (cadesCertificatesCount) { + const cadesCertificate = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificates.Item(cadesCertificatesCount); + certificateList.push(new certificate_1.Certificate(cadesCertificate, _extractCommonName_1._extractCommonName(_generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.SubjectName), _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.IssuerName, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.SubjectName, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.Thumbprint, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ValidFromDate, _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificate.ValidToDate)); + cadesCertificatesCount--; } - cadesCertificate = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Item(1); } catch (error) { console.error(error); - throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при получении сертификата'); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка обработки сертификатов'); } cadesStore.Close(); - return cadesCertificate; + certificatesCache = certificateList; + return certificatesCache; })); }); /***/ }), -/***/ "./helpers/_getDateObj.ts": -/*!********************************!*\ - !*** ./helpers/_getDateObj.ts ***! - \********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * Возвращает объект даты, совместимый с Cades plugin'ом, зависящий от браузера. - * - * В IE необходимо использовать специфичный формат "VT_DATE" - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Microsoft_Extensions/Date.getVarDate - */ -exports._getDateObj = (dateObj) => (dateObj.getVarDate ? dateObj.getVarDate() : dateObj); - - -/***/ }), - -/***/ "./helpers/_isSupportedCSPVersion.ts": -/*!*******************************************!*\ - !*** ./helpers/_isSupportedCSPVersion.ts ***! - \*******************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const oldestSupportedCSPVersion = 4.0; -exports._isSupportedCSPVersion = (version) => { - var _a; - version = (_a = version.match(/\d+?\b(?:\.\d+)?/)) === null || _a === void 0 ? void 0 : _a[0]; - return Number(version) >= oldestSupportedCSPVersion; -}; - - -/***/ }), - -/***/ "./helpers/_isSupportedCadesVersion.ts": -/*!*********************************************!*\ - !*** ./helpers/_isSupportedCadesVersion.ts ***! - \*********************************************/ +/***/ "./api/index.ts": +/*!**********************!*\ + !*** ./api/index.ts ***! + \**********************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} Object.defineProperty(exports, "__esModule", { value: true }); -exports._isSupportedCadesVersion = (version) => { - const match = version.match(/(\d+)\.(\d+)\.(\d+)/); - if (!match) { - return false; - } - const [, major, minor, patch] = match; - if (Number(major) < 2) { - return false; - } - if (Number(major) === 2 && Number(patch) < 12438) { - return false; - } - return true; -}; +__export(__webpack_require__(/*! ./getCertificate */ "./api/getCertificate.ts")); +__export(__webpack_require__(/*! ./getUserCertificates */ "./api/getUserCertificates.ts")); +__export(__webpack_require__(/*! ./getSystemInfo */ "./api/getSystemInfo.ts")); +__export(__webpack_require__(/*! ./isValidSystemSetup */ "./api/isValidSystemSetup.ts")); +__export(__webpack_require__(/*! ./createSignature */ "./api/createSignature.ts")); +__export(__webpack_require__(/*! ./createXMLSignature */ "./api/createXMLSignature.ts")); +__export(__webpack_require__(/*! ./createDetachedSignature */ "./api/createDetachedSignature.ts")); +__export(__webpack_require__(/*! ./createAttachedSignature */ "./api/createAttachedSignature.ts")); +__export(__webpack_require__(/*! ./createHash */ "./api/createHash.ts")); +__export(__webpack_require__(/*! ./certificate */ "./api/certificate/index.ts")); +__export(__webpack_require__(/*! ./execute */ "./api/execute.ts")); /***/ }), -/***/ "./helpers/_parseCertInfo.ts": +/***/ "./api/isValidSystemSetup.ts": /*!***********************************!*\ - !*** ./helpers/_parseCertInfo.ts ***! + !*** ./api/isValidSystemSetup.ts ***! \***********************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); -/** - * Парсит информацию из строки с информацией о сертификате - * - * @param tagsTranslations - словарь с расшифровками тэгов - * @param rawInfo - данные для парсинга - * @returns расшифрованная информация по отдельным тэгам - */ -exports._parseCertInfo = (tagsTranslations, rawInfo) => { - const extractedEntities = rawInfo.match(/([а-яА-Яa-zA-Z0-9\s.]+)=(?:("[^"]+?")|(.+?))(?:,|$)/g); - if (extractedEntities) { - return extractedEntities.map((group) => { - var _a, _b, _c; - const segmentsMatch = group.trim().match(/^([а-яА-Яa-zA-Z0-9\s.]+)=(.+?),?$/); - let title = segmentsMatch === null || segmentsMatch === void 0 ? void 0 : segmentsMatch[1]; - // Вырезаем лишние кавычки - const description = (_b = (_a = segmentsMatch === null || segmentsMatch === void 0 ? void 0 : segmentsMatch[2]) === null || _a === void 0 ? void 0 : _a.replace(/^"(.*)"/, '$1')) === null || _b === void 0 ? void 0 : _b.replace(/"{2}/g, '"'); - const oidIdentifierMatch = title === null || title === void 0 ? void 0 : title.match(/^OID\.(.*)/); - const oidIdentifier = oidIdentifierMatch === null || oidIdentifierMatch === void 0 ? void 0 : oidIdentifierMatch[1]; - let isTranslated = false; - // Если нашли в тайтле ОИД, пытаемся его расшифровать - if (oidIdentifier) { - const oidTranslation = constants_1.OIDS_DICTIONARY[oidIdentifier]; - if (oidTranslation) { - title = oidTranslation; - isTranslated = true; - } - } - const tagTranslation = (_c = tagsTranslations.find((tag) => tag.possibleNames.find((name) => name === title))) === null || _c === void 0 ? void 0 : _c.translation; - if (tagTranslation) { - title = tagTranslation; - isTranslated = true; - } - return { description, title, isTranslated }; - }); - } -}; - - -/***/ }), - -/***/ "./vendor/cadesplugin_api.js": -/*!***********************************!*\ - !*** ./vendor/cadesplugin_api.js ***! - \***********************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -;(function () { - //already loaded - if(window.cadesplugin) - return; - - var pluginObject; - var plugin_resolved = 0; - var plugin_reject; - var plugin_resolve; - var isOpera = 0; - var isFireFox = 0; - var isSafari = 0; - var isYandex = 0; - var canPromise = !!window.Promise; - var cadesplugin_loaded_event_recieved = false; - var isFireFoxExtensionLoaded = false; - var cadesplugin; - - if(canPromise) - { - cadesplugin = new Promise(function(resolve, reject) - { - plugin_resolve = resolve; - plugin_reject = reject; - }); - } else - { - cadesplugin = {}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +const _isSupportedCadesVersion_1 = __webpack_require__(/*! ../helpers/_isSupportedCadesVersion */ "./helpers/_isSupportedCadesVersion.ts"); +const _isSupportedCSPVersion_1 = __webpack_require__(/*! ../helpers/_isSupportedCSPVersion */ "./helpers/_isSupportedCSPVersion.ts"); +const getSystemInfo_1 = __webpack_require__(/*! ./getSystemInfo */ "./api/getSystemInfo.ts"); +/** + * Проверяет корректность настроек ЭП на машине + * + * @returns флаг корректности настроек + */ +exports.isValidSystemSetup = _afterPluginsLoaded_1._afterPluginsLoaded(() => __awaiter(void 0, void 0, void 0, function* () { + let systemInfo; + try { + systemInfo = yield getSystemInfo_1.getSystemInfo(); } - - function check_browser() { - var ua= navigator.userAgent, tem, M= ua.match(/(opera|yabrowser|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; - if(/trident/i.test(M[1])){ - tem = /\brv[ :]+(\d+)/g.exec(ua) || []; - return { name:'IE', version:(tem[1] || '')}; - } - if(M[1] === 'Chrome'){ - tem = ua.match(/\b(OPR|Edg|YaBrowser)\/(\d+)/); - if (tem != null) - return { name: tem[1].replace('OPR', 'Opera'), version: tem[2] }; - } - M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?']; - if ((tem = ua.match(/version\/(\d+)/i)) != null) - M.splice(1, 1, tem[1]); - return {name:M[0],version:M[1]}; + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Настройки ЭП на данной машине не верны'); } - var browserSpecs = check_browser(); - - function cpcsp_console_log(level, msg){ - //IE9 не может писать в консоль если не открыта вкладка developer tools - if(typeof(console) === 'undefined') - return; - if (level <= cadesplugin.current_log_level ){ - if (level === cadesplugin.LOG_LEVEL_DEBUG) - console.log("DEBUG: %s", msg); - if (level === cadesplugin.LOG_LEVEL_INFO) - console.info("INFO: %s", msg); - if (level === cadesplugin.LOG_LEVEL_ERROR) - console.error("ERROR: %s", msg); - return; - } + if (!_isSupportedCadesVersion_1._isSupportedCadesVersion(systemInfo.cadesVersion)) { + throw new Error('Не поддерживаемая версия плагина'); } - - function get_extension_version(callback) { - window.postMessage("cadesplugin_extension_version_request", "*"); - window.addEventListener("message", function (event) { - var resp_prefix = "cadesplugin_extension_version_response:"; - if (typeof (event.data) !== "string" || event.data.indexOf(resp_prefix) !== 0) - return; - ext_version = event.data.substring(resp_prefix.length); - callback(ext_version); - }, false); + if (!_isSupportedCSPVersion_1._isSupportedCSPVersion(systemInfo.cspVersion)) { + throw new Error('Не поддерживаемая версия CSP'); } + return true; +})); - function set_log_level(level){ - if (!((level === cadesplugin.LOG_LEVEL_DEBUG) || - (level === cadesplugin.LOG_LEVEL_INFO) || - (level === cadesplugin.LOG_LEVEL_ERROR))){ - cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, "cadesplugin_api.js: Incorrect log_level: " + level); - return; - } - cadesplugin.current_log_level = level; - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = DEBUG"); - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = INFO"); - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = ERROR"); - if(isNativeMessageSupported()) - { - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG) - window.postMessage("set_log_level=debug", "*"); - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO) - window.postMessage("set_log_level=info", "*"); - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR) - window.postMessage("set_log_level=error", "*"); - } - } - function set_constantValues() - { - cadesplugin.CAPICOM_MEMORY_STORE = 0; - cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1; - cadesplugin.CAPICOM_CURRENT_USER_STORE = 2; - cadesplugin.CAPICOM_SMART_CARD_USER_STORE = 4; - cadesplugin.CADESCOM_MEMORY_STORE = 0; - cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1; - cadesplugin.CADESCOM_CURRENT_USER_STORE = 2; - cadesplugin.CADESCOM_SMART_CARD_USER_STORE = 4; - cadesplugin.CADESCOM_CONTAINER_STORE = 100; +/***/ }), - cadesplugin.CAPICOM_MY_STORE = "My"; +/***/ "./constants/cades-constants.ts": +/*!**************************************!*\ + !*** ./constants/cades-constants.ts ***! + \**************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - cadesplugin.CAPICOM_STORE_OPEN_READ_WRITE = 1; - cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2; +"use strict"; - cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CADESCOM_ATTRIBUTE_OTHER = -1; +exports.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; +exports.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; +exports.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0; +exports.CADESCOM_AllowNoOutstandingRequest = 1; +exports.CADESCOM_AllowNone = 0; +exports.CADESCOM_AllowUntrustedCertificate = 2; +exports.CADESCOM_AllowUntrustedRoot = 4; +exports.CADESCOM_BASE64_TO_BINARY = 0x01; +exports.CADESCOM_CADES_BES = 1; +exports.CADESCOM_CADES_DEFAULT = 0; +exports.CADESCOM_CADES_T = 5; +exports.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d; +exports.CADESCOM_CONTAINER_STORE = 100; +exports.CADESCOM_CURRENT_USER_STORE = 2; +exports.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2; +exports.CADESCOM_DISPLAY_DATA_CONTENT = 1; +exports.CADESCOM_DISPLAY_DATA_NONE = 0; +exports.CADESCOM_ENCODE_ANY = -1; +exports.CADESCOM_ENCODE_BASE64 = 0; +exports.CADESCOM_ENCODE_BINARY = 1; +exports.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3; +exports.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4; +exports.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2; +exports.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25; +exports.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0; +exports.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1; +exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100; +exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101; +exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111; +exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102; +exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112; +exports.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110; +exports.CADESCOM_HASH_ALGORITHM_MD2 = 1; +exports.CADESCOM_HASH_ALGORITHM_MD4 = 2; +exports.CADESCOM_HASH_ALGORITHM_MD5 = 3; +exports.CADESCOM_HASH_ALGORITHM_SHA1 = 0; +exports.CADESCOM_HASH_ALGORITHM_SHA_256 = 4; +exports.CADESCOM_HASH_ALGORITHM_SHA_384 = 5; +exports.CADESCOM_HASH_ALGORITHM_SHA_512 = 6; +exports.CADESCOM_LOCAL_MACHINE_STORE = 1; +exports.CADESCOM_PKCS7_TYPE = 65535; +exports.CADESCOM_STRING_TO_UCS2LE = 0x00; +exports.CADESCOM_SkipInstallToStore = 268435456; +exports.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0; +exports.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1; +exports.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2; +exports.CAPICOM_ACTIVE_DIRECTORY_USER_STORE = 3; +exports.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; +exports.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; +exports.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0; +exports.CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7; +exports.CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8; +exports.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6; +exports.CAPICOM_CERTIFICATE_FIND_EXTENSION = 5; +exports.CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2; +exports.CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12; +exports.CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3; +exports.CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0; +exports.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1; +exports.CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4; +exports.CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11; +exports.CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10; +exports.CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9; +exports.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0; +exports.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2; +exports.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1; +exports.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1; +exports.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0; +exports.CAPICOM_CURRENT_USER_STORE = 2; +exports.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128; +exports.CAPICOM_EKU_CLIENT_AUTH = 2; +exports.CAPICOM_EKU_OTHER = 0; +exports.CAPICOM_EKU_SMARTCARD_LOGON = 5; +exports.CAPICOM_LOCAL_MACHINE_STORE = 1; +exports.CAPICOM_MEMORY_STORE = 0; +exports.CAPICOM_MY_STORE = 'My'; +exports.CAPICOM_OID_KEY_USAGE_EXTENSION = 10; +exports.CAPICOM_OID_OTHER = 0; +exports.CAPICOM_PROPID_ACCESS_STATE = 14; +exports.CAPICOM_PROPID_ARCHIVED = 19; +exports.CAPICOM_PROPID_ARCHIVED_KEY_HASH = 65; +exports.CAPICOM_PROPID_AUTO_ENROLL = 21; +exports.CAPICOM_PROPID_CROSS_CERT_DIST_POINTS = 23; +exports.CAPICOM_PROPID_CTL_USAGE = 9; +exports.CAPICOM_PROPID_DATE_STAMP = 27; +exports.CAPICOM_PROPID_DESCRIPTION = 13; +exports.CAPICOM_PROPID_EFS = 17; +exports.CAPICOM_PROPID_ENHKEY_USAGE = 9; +exports.CAPICOM_PROPID_ENROLLMENT = 26; +exports.CAPICOM_PROPID_EXTENDED_ERROR_INFO = 30; +exports.CAPICOM_PROPID_FIRST_RESERVED = 66; +exports.CAPICOM_PROPID_FIRST_USER = 0x00008000; +exports.CAPICOM_PROPID_FORTEZZA_DATA = 18; +exports.CAPICOM_PROPID_FRIENDLY_NAME = 11; +exports.CAPICOM_PROPID_HASH_PROP = 3; +exports.CAPICOM_PROPID_IE30_RESERVED = 7; +exports.CAPICOM_PROPID_ISSUER_PUBLIC_KEY_MD5_HASH = 24; +exports.CAPICOM_PROPID_ISSUER_SERIAL_NUMBER_MD5_HASH = 28; +exports.CAPICOM_PROPID_KEY_CONTEXT = 5; +exports.CAPICOM_PROPID_KEY_IDENTIFIER = 20; +exports.CAPICOM_PROPID_KEY_PROV_HANDLE = 1; +exports.CAPICOM_PROPID_KEY_PROV_INFO = 2; +exports.CAPICOM_PROPID_KEY_SPEC = 6; +exports.CAPICOM_PROPID_LAST_RESERVED = 0x00007fff; +exports.CAPICOM_PROPID_LAST_USER = 0x0000ffff; +exports.CAPICOM_PROPID_MD5_HASH = 4; +exports.CAPICOM_PROPID_NEXT_UPDATE_LOCATION = 10; +exports.CAPICOM_PROPID_PUBKEY_ALG_PARA = 22; +exports.CAPICOM_PROPID_PUBKEY_HASH_RESERVED = 8; +exports.CAPICOM_PROPID_PVK_FILE = 12; +exports.CAPICOM_PROPID_RENEWAL = 64; +exports.CAPICOM_PROPID_SHA1_HASH = 3; +exports.CAPICOM_PROPID_SIGNATURE_HASH = 15; +exports.CAPICOM_PROPID_SMART_CARD_DATA = 16; +exports.CAPICOM_PROPID_SUBJECT_NAME_MD5_HASH = 29; +exports.CAPICOM_PROPID_SUBJECT_PUBLIC_KEY_MD5_HASH = 25; +exports.CAPICOM_PROPID_UNKNOWN = 0; +exports.CAPICOM_SMART_CARD_USER_STORE = 4; +exports.CAPICOM_STORE_OPEN_EXISTING_ONLY = 128; +exports.CAPICOM_STORE_OPEN_INCLUDE_ARCHIVED = 256; +exports.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2; +exports.CAPICOM_STORE_OPEN_READ_ONLY = 0; +exports.CAPICOM_STORE_OPEN_READ_WRITE = 1; +exports.CHECK_NONE = 0; +exports.CHECK_OFFLINE_REVOCATION_STATUS = 16; +exports.CHECK_ONLINE_REVOCATION_STATUS = 8; +exports.CHECK_SIGNATURE_VALIDITY = 4; +exports.CHECK_TIME_VALIDITY = 2; +exports.CHECK_TRUSTED_ROOT = 1; +exports.LOG_LEVEL_DEBUG = 4; +exports.LOG_LEVEL_ERROR = 1; +exports.LOG_LEVEL_INFO = 2; +exports.TRUST_CTL_IS_NOT_SIGNATURE_VALID = 262144; +exports.TRUST_CTL_IS_NOT_TIME_VALID = 131072; +exports.TRUST_CTL_IS_NOT_VALID_FOR_USAGE = 524288; +exports.TRUST_IS_CYCLIC = 128; +exports.TRUST_IS_NOT_SIGNATURE_VALID = 8; +exports.TRUST_IS_NOT_TIME_NESTED = 2; +exports.TRUST_IS_NOT_TIME_VALID = 1; +exports.TRUST_IS_NOT_VALID_FOR_USAGE = 16; +exports.TRUST_IS_PARTIAL_CHAIN = 65536; +exports.TRUST_IS_REVOKED = 4; +exports.TRUST_IS_UNTRUSTED_ROOT = 32; +exports.TRUST_REVOCATION_STATUS_UNKNOWN = 64; +exports.XmlDsigGost3410Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411'; +exports.XmlDsigGost3410UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411'; +exports.XmlDsigGost3411Url = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411'; +exports.XmlDsigGost3411UrlObsolete = 'http://www.w3.org/2001/04/xmldsig-more#gostr3411'; - cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0; - cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1; - cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2; - cadesplugin.CADESCOM_XADES_DEFAULT = 0x00000010; - cadesplugin.CADESCOM_XADES_BES = 0x00000020; - cadesplugin.CADESCOM_XADES_T = 0x00000050; - cadesplugin.CADESCOM_XADES_X_LONG_TYPE_1 = 0x000005d0; - cadesplugin.CADESCOM_XMLDSIG_TYPE = 0x00000000; +/***/ }), - 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.XmlDsigGost3411Url2012256 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256"; - cadesplugin.XmlDsigGost3410Url2012256 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256"; - cadesplugin.XmlDsigGost3411Url2012512 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-512"; - cadesplugin.XmlDsigGost3410Url2012512 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-512"; +/***/ "./constants/index.ts": +/*!****************************!*\ + !*** ./constants/index.ts ***! + \****************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - cadesplugin.CADESCOM_CADES_DEFAULT = 0; - cadesplugin.CADESCOM_CADES_BES = 1; - cadesplugin.CADESCOM_CADES_T = 0x5; - cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d; - cadesplugin.CADESCOM_PKCS7_TYPE = 0xffff; +"use strict"; - cadesplugin.CADESCOM_ENCODE_BASE64 = 0; - cadesplugin.CADESCOM_ENCODE_BINARY = 1; - cadesplugin.CADESCOM_ENCODE_ANY = -1; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +Object.defineProperty(exports, "__esModule", { value: true }); +__export(__webpack_require__(/*! ./cades-constants */ "./constants/cades-constants.ts")); +__export(__webpack_require__(/*! ./issuer-tags-translations */ "./constants/issuer-tags-translations.ts")); +__export(__webpack_require__(/*! ./oids-dictionary */ "./constants/oids-dictionary.ts")); +__export(__webpack_require__(/*! ./subject-tags-translations */ "./constants/subject-tags-translations.ts")); - 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; +/***/ "./constants/issuer-tags-translations.ts": +/*!***********************************************!*\ + !*** ./constants/issuer-tags-translations.ts ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - cadesplugin.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128; +"use strict"; - cadesplugin.CAPICOM_PROPID_ENHKEY_USAGE = 9; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ISSUER_TAGS_TRANSLATIONS = [ + { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' }, + { possibleNames: ['CN'], translation: 'Удостоверяющий центр' }, + { possibleNames: ['C'], translation: 'Страна' }, + { possibleNames: ['S'], translation: 'Регион' }, + { possibleNames: ['STREET'], translation: 'Адрес' }, + { possibleNames: ['O'], translation: 'Компания' }, + { possibleNames: ['OU'], translation: 'Тип' }, + { possibleNames: ['T'], translation: 'Должность' }, + { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' }, + { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' }, + { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' }, + { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' }, + { possibleNames: ['E'], translation: 'Email' }, + { possibleNames: ['L'], translation: 'Город' }, +]; - 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_AUTHENTICATED_ATTRIBUTE_MACHINE_INFO = 0x100; - cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1; +/***/ "./constants/oids-dictionary.ts": +/*!**************************************!*\ + !*** ./constants/oids-dictionary.ts ***! + \**************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0; - cadesplugin.CADESCOM_BASE64_TO_BINARY = 1; +"use strict"; - cadesplugin.CADESCOM_DISPLAY_DATA_NONE = 0; - cadesplugin.CADESCOM_DISPLAY_DATA_CONTENT = 1; - cadesplugin.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.OIDS_DICTIONARY = { + '1.2.643.2.2.34.6': 'Пользователь Центра Регистрации', + '1.2.643.2.39.1.1': 'Использование в программных продуктах системы "1С:Предприятие 8"', + '1.2.643.3.131.1.1': 'ИНН', + '1.2.643.3.141.1.1': 'РНС ФСС', + '1.2.643.3.141.1.2': 'КП ФСС', + '1.2.643.3.2.100.65.13.11': 'Использование в системе АИС "Госзакупки" Сахалинской области.', + '1.2.643.3.8.100.1': 'Сертификат типа "ekey-ГОСТ"', + '1.2.643.3.8.100.1.1': 'Общее использование в системах ИОК без права заверения финансовых документов', + '1.2.643.3.8.100.1.10': 'Для участия в электронных торгах и подписания государственного контракта в информационных системах Тендерного комитета города Москвы уполномоченными лицами участников размещения государственного заказа города Москвы', + '1.2.643.3.8.100.1.11': 'Подписание электронных документов в автоматизированной информационной системе размещения государственного и муниципального заказа Саратовской области', + '1.2.643.3.8.100.1.12': 'Использование в системе государственного заказа Иркутской области', + '1.2.643.3.8.100.1.13': 'Использование в электронной торговой площадке агентства государственного заказа Красноярского края', + '1.2.643.3.8.100.1.14': 'Использование в электронной торговой площадке "Тендер"', + '1.2.643.3.8.100.1.2': 'Передача отчетности по ТКС', + '1.2.643.3.8.100.1.3': 'Оформление взаимных обязательств, соглашений, договоров, актов и т.п.', + '1.2.643.3.8.100.1.4': 'Внутрикорпоративный документооборот', + '1.2.643.3.8.100.1.5': 'Использование в системах электронной торговли', + '1.2.643.3.8.100.1.6': 'Использование в торгово-закупочной системе "ЭЛЕКТРА"', + '1.2.643.3.8.100.1.7': 'Использование в системе Портал государственных закупок Ставропольского края.', + '1.2.643.3.8.100.1.8': 'Использование в Единой системе электронной торговли B2B-Center и B2G.', + '1.2.643.3.8.100.1.9': 'Для участия в электронных торгах и подписания государственного контракта в электронной площадке ОАО «ЕЭТП» уполномоченными лицами участников размещения государственного или муниципального заказа', + '1.2.643.5.1.24.2.1.3': 'Формирование документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя', + '1.2.643.5.1.24.2.1.3.1': 'Формирование кадастровым инженером документов для получения государственных услуг в сфере ведения государственного кадастра недвижимости со стороны заявителя', + '1.2.643.5.1.24.2.2.2': 'Формирование документов как результата оказания услуги со стороны органов регистрации прав', + '1.2.643.5.1.24.2.2.3': 'Формирование документов для получения государственных услуг в сфере государственной регистрации прав на недвижимое имущество и сделок с ним со стороны заявителя', + '1.2.643.6.2.1.7.1': 'Использование единоличным исполнительным органом юридического лица или уполномоченными представителями юридического лица в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских и иных прав и обязанностей в сфере негосударственного пенсионного обеспечения, негосударственного пенсионного страхования, в сфере деятельности паевых инвестиционных фондов, акционерных инвестиционных фондов, профессиональных участников рынка ценных бумаг, а также связанной с обслуживанием указанной деятельности услуг кредитных и иных организаций', + '1.2.643.6.2.1.7.2': 'Использование физическим лицом в отношениях, связанных с возникновением, исполнением (осуществлением) и прекращением гражданских прав и обязанностей в отношении инвестиционных паев паевых инвестиционных фондов, в том числе отношения, связанные с учетом и/или фиксацией прав на инвестиционные паи паевых инвестиционных фондов', + '1.2.643.6.3': 'Использование в электронных торговых системах и в программном обеспечении, связанным с обменом электронных сообщений', + '1.2.643.6.3.1.1': 'Использование на электронных площадок отобранных для проведения аукционах в электронной форме', + '1.2.643.6.3.1.2.1': 'Тип участника - Юридическое лицо', + '1.2.643.6.3.1.2.2': 'Тип участника - Физическое лицо', + '1.2.643.6.3.1.2.3': 'Тип участника - Индивидуальный предприниматель', + '1.2.643.6.3.1.3.1': 'Участник размещения заказа', + '1.2.643.6.3.1.4.1': 'Администратор организации', + '1.2.643.6.3.1.4.2': 'Уполномоченный специалист', + '1.2.643.6.3.1.4.3': 'Специалист с правом подписи контракта', + '1.2.840.113549.1.9.2': 'Неструктурированное имя', + '1.3.6.1.4.1.24138.1.1.8.1': 'Обеспечение юридической значимости в Системе "Электронная Торговая Площадка"', + '1.3.6.1.4.1.29919.21': 'Использование в системе Портал государственных закупок Ростовской области "Рефери".', + '1.3.6.1.5.5.7.3.2': 'Проверка подлинности клиента', + '1.3.6.1.5.5.7.3.4': 'Защищенная электронная почта', + '1.3.643.3.8.100.15': 'Использование в ЭТП "uTender"', +}; - 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; +/***/ "./constants/subject-tags-translations.ts": +/*!************************************************!*\ + !*** ./constants/subject-tags-translations.ts ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - cadesplugin.CADESCOM_AllowNone = 0; - cadesplugin.CADESCOM_AllowNoOutstandingRequest = 0x1; - cadesplugin.CADESCOM_AllowUntrustedCertificate = 0x2; - cadesplugin.CADESCOM_AllowUntrustedRoot = 0x4; - cadesplugin.CADESCOM_SkipInstallToStore = 0x10000000; - cadesplugin.CADESCOM_InstallCertChainToContainer = 0x20000000; - cadesplugin.CADESCOM_UseContainerStore = 0x40000000; +"use strict"; - cadesplugin.ENABLE_CARRIER_TYPE_CSP = 0x01; - cadesplugin.ENABLE_CARRIER_TYPE_FKC_NO_SM = 0x02; - cadesplugin.ENABLE_CARRIER_TYPE_FKC_SM = 0x04; - cadesplugin.ENABLE_ANY_CARRIER_TYPE = 0x07; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SUBJECT_TAGS_TRANSLATIONS = [ + { possibleNames: ['UnstructuredName'], translation: 'Неструктурированное имя' }, + { possibleNames: ['CN'], translation: 'Владелец' }, + { possibleNames: ['SN'], translation: 'Фамилия' }, + { possibleNames: ['G'], translation: 'Имя Отчество' }, + { possibleNames: ['C'], translation: 'Страна' }, + { possibleNames: ['S'], translation: 'Регион' }, + { possibleNames: ['STREET'], translation: 'Адрес' }, + { possibleNames: ['O'], translation: 'Компания' }, + { possibleNames: ['OU'], translation: 'Отдел/подразделение' }, + { possibleNames: ['T'], translation: 'Должность' }, + { possibleNames: ['ОГРН', 'OGRN'], translation: 'ОГРН' }, + { possibleNames: ['ОГРНИП', 'OGRNIP'], translation: 'ОГРНИП' }, + { possibleNames: ['СНИЛС', 'SNILS'], translation: 'СНИЛС' }, + { possibleNames: ['ИНН', 'INN', 'ИНН организации'], translation: 'ИНН' }, + { possibleNames: ['E'], translation: 'Email' }, + { possibleNames: ['L'], translation: 'Город' }, +]; - cadesplugin.DISABLE_EVERY_CARRIER_OPERATION = 0x00; - cadesplugin.ENABLE_CARRIER_OPEN_ENUM = 0x01; - cadesplugin.ENABLE_CARRIER_CREATE = 0x02; - cadesplugin.ENABLE_ANY_OPERATION = 0x03; - cadesplugin.CADESCOM_PRODUCT_CSP = 0; - cadesplugin.CADESCOM_PRODUCT_OCSP = 1; - cadesplugin.CADESCOM_PRODUCT_TSP = 2; +/***/ }), - cadesplugin.MEDIA_TYPE_REGISTRY = 0x00000001; - cadesplugin.MEDIA_TYPE_HDIMAGE = 0x00000002; - cadesplugin.MEDIA_TYPE_CLOUD = 0x00000004; - cadesplugin.MEDIA_TYPE_SCARD = 0x00000008; +/***/ "./crypto-pro.ts": +/*!***********************!*\ + !*** ./crypto-pro.ts ***! + \***********************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - cadesplugin.XCN_CRYPT_STRING_BASE64HEADER = 0; - cadesplugin.AT_KEYEXCHANGE = 1; - cadesplugin.AT_SIGNATURE = 2; +"use strict"; - cadesplugin.CARRIER_FLAG_REMOVABLE = 1; - cadesplugin.CARRIER_FLAG_UNIQUE = 2; - cadesplugin.CARRIER_FLAG_PROTECTED = 4; - cadesplugin.CARRIER_FLAG_FUNCTIONAL_CARRIER = 8; - cadesplugin.CARRIER_FLAG_SECURE_MESSAGING = 16; - cadesplugin.CARRIER_FLAG_ABLE_VISUALISE_SIGNATURE = 64; - cadesplugin.CARRIER_FLAG_VIRTUAL = 128; - } +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +Object.defineProperty(exports, "__esModule", { value: true }); +__export(__webpack_require__(/*! ./api */ "./api/index.ts")); - function async_spawn(generatorFunc) { - function continuer(verb, arg) { - var result; - try { - result = generator[verb](arg); - } catch (err) { - return Promise.reject(err); - } - if (result.done) { - return result.value; - } else { - return Promise.resolve(result.value).then(onFulfilled, onRejected); - } - } - var generator = generatorFunc(Array.prototype.slice.call(arguments, 1)); - var onFulfilled = continuer.bind(continuer, "next"); - var onRejected = continuer.bind(continuer, "throw"); - return onFulfilled(); - } - function isIE() { - // var retVal = (("Microsoft Internet Explorer" == navigator.appName) || // IE < 11 - // navigator.userAgent.match(/Trident\/./i)); // IE 11 - return (browserSpecs.name === 'IE' || browserSpecs.name === 'MSIE'); - } +/***/ }), - function isIOS() { - return (navigator.userAgent.match(/ipod/i) || - navigator.userAgent.match(/ipad/i) || - navigator.userAgent.match(/iphone/i)); - } +/***/ "./helpers/_afterPluginsLoaded.ts": +/*!****************************************!*\ + !*** ./helpers/_afterPluginsLoaded.ts ***! + \****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - function isNativeMessageSupported() - { - // В IE работаем через NPAPI - if(isIE()) - return false; - // В Edge работаем через NativeMessage - if (browserSpecs.name === 'Edg') { - return true; - } - if (browserSpecs.name === 'YaBrowser') { - isYandex = true; - return true; - } - // В Chrome, Firefox, Safari и Opera работаем через асинхронную версию в зависимости от версии - if(browserSpecs.name === 'Opera') { - isOpera = true; - if(browserSpecs.version >= 33){ - return true; - } - else{ - return false; - } - } - if(browserSpecs.name === 'Firefox') { - isFireFox = true; - if(browserSpecs.version >= 52){ - return true; - } - else{ - return false; - } - } - if(browserSpecs.name === 'Chrome') { - if(browserSpecs.version >= 42){ - return true; - } - else{ - return false; - } - } - //В Сафари начиная с 12 версии нет NPAPI - if(browserSpecs.name === 'Safari') { - isSafari = true; - if(browserSpecs.version >= 12) { - return true; - } else { - return false; - } - } - } +"use strict"; - // Функция активации объектов КриптоПро ЭЦП Browser plug-in - function CreateObject(name) { - if (isIOS()) { - // На iOS для создания объектов используется функция - // call_ru_cryptopro_npcades_10_native_bridge, определенная в IOS_npcades_supp.js - return call_ru_cryptopro_npcades_10_native_bridge("CreateObject", [name]); - } - if (isIE()) { - // В Internet Explorer создаются COM-объекты - if (name.match(/X509Enrollment/i)) { +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ./_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +let isSetLogLevel = false; +let isPluginLoaded = false; +exports._afterPluginsLoaded = (fn) => { + const canPromise = Boolean(window.Promise); + return function (...args) { + return __awaiter(this, void 0, void 0, function* () { + if (!isPluginLoaded) { try { - // Объекты CertEnroll пробуем создавать через нашу фабрику, - // если не получилось то через CX509EnrollmentWebClassFactory - var objCertEnrollClassFactory = document.getElementById("webClassFactory"); - return objCertEnrollClassFactory.CreateObject(name); + __webpack_require__(/*! cadesplugin_api.js */ "../node_modules/cadesplugin_api.js/dist/cadesplugin_api.js"); } - catch (e) { - try { - var objWebClassFactory = document.getElementById("certEnrollClassFactory"); - return objWebClassFactory.CreateObject(name); - } - catch (err) { - throw ("Для создания обьектов X509Enrollment следует настроить веб-узел на использование проверки подлинности по протоколу HTTPS"); - } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при подключении модуля для работы с Cades plugin'); } + isPluginLoaded = true; + } + const { cadesplugin } = window; + if (!canPromise) { + throw new Error('Необходим полифилл для Promise'); + } + if (!cadesplugin) { + throw new Error('Не подключен модуль для работы с Cades plugin'); + } + if (!isSetLogLevel) { + cadesplugin.set_log_level(cadesplugin.LOG_LEVEL_ERROR); + isSetLogLevel = true; } - // Объекты CAPICOM и CAdESCOM создаются через CAdESCOM.WebClassFactory try { - var objWebClassFactory = document.getElementById("webClassFactory"); - return objWebClassFactory.CreateObject(name); + yield cadesplugin; } - catch (e) { - // Для версий плагина ниже 2.0.12538 - return new ActiveXObject(name); + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации модуля для работы с Cades plugin'); } - } - // создаются объекты NPAPI - return pluginObject.CreateObject(name); - } + return yield fn.apply(this, args); + }); + }; +}; - function decimalToHexString(number) { - if (number < 0) { - number = 0xFFFFFFFF + number + 1; - } - return number.toString(16).toUpperCase(); - } +/***/ }), - function GetMessageFromException(e) { - var err = e.message; - if (!err) { - err = e; - } else if (e.number) { - err += " (0x" + decimalToHexString(e.number) + ")"; - } - return err; - } +/***/ "./helpers/_extractCommonName.ts": +/*!***************************************!*\ + !*** ./helpers/_extractCommonName.ts ***! + \***************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - function getLastError(exception) { - if(isNativeMessageSupported() || isIE() || isIOS() ) { - return GetMessageFromException(exception); - } +"use strict"; - try { - return pluginObject.getLastError(); - } catch(e) { - return GetMessageFromException(exception); +Object.defineProperty(exports, "__esModule", { value: true }); +exports._extractCommonName = (subjectName) => { var _a; return (_a = subjectName.match(/CN=(.+?)(?:,|$)/)) === null || _a === void 0 ? void 0 : _a[1]; }; + + +/***/ }), + +/***/ "./helpers/_extractMeaningfulErrorMessage.ts": +/*!***************************************************!*\ + !*** ./helpers/_extractMeaningfulErrorMessage.ts ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports._extractMeaningfulErrorMessage = (error) => { + var _a; + let errorContainer = ((_a = window.cadesplugin) === null || _a === void 0 ? void 0 : _a.getLastError) && window.cadesplugin.getLastError(error); + if (!(errorContainer === null || errorContainer === void 0 ? void 0 : errorContainer.message)) { + if (!error.message) { + return null; } + errorContainer = error; } - - // Функция для удаления созданных объектов - function ReleasePluginObjects() { - return cpcsp_chrome_nmcades.ReleasePluginObjects(); + const containsRussianLetters = /[а-яА-Я]/.test(errorContainer.message); + if (!containsRussianLetters) { + return null; } + const searchResult = errorContainer.message.match(/^(.*?)(?:(?:\.?\s?\(?0x)|(?:\.?$))/); + return searchResult ? searchResult[1] : null; +}; + + +/***/ }), + +/***/ "./helpers/_generateCadesFn.ts": +/*!*************************************!*\ + !*** ./helpers/_generateCadesFn.ts ***! + \*************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; - // Функция активации асинхронных объектов КриптоПро ЭЦП Browser plug-in - function CreateObjectAsync(name) { - return pluginObject.CreateObjectAsync(name); +Object.defineProperty(exports, "__esModule", { value: true }); +// синтетические переменные, которые подменяются в рантайме +exports.__cadesAsyncToken__ = {}; +exports.__createCadesPluginObject__ = (...args) => ({}); +function getGeneratorConstructor() { + return new Function('', 'return Object.getPrototypeOf(function*(){}).constructor')(); +} +exports._generateCadesFn = (callback) => { + var _a; + const { cadesplugin } = window; + const cadesGeneratorsAPI = Boolean(cadesplugin.CreateObjectAsync); + const callbackName = callback.name || 'dynamicFn'; + const callbackLiteral = String(callback); + const callbackArguments = ((_a = callbackLiteral.match(/^function[\s\w]*?\((.*?)\)/)) === null || _a === void 0 ? void 0 : _a[1]) || ''; + const callbackBody = callbackLiteral.replace(/^.*?{([\s\S]*?)}$/, '$1'); + let crossEnvCallbackLiteral = String(new (cadesGeneratorsAPI ? getGeneratorConstructor() : Function)(callbackArguments, callbackBody)); + crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/(?:\w+?\.)?__createCadesPluginObject__(\([\s\S]*?\))/gm, `cadesplugin.CreateObject${cadesGeneratorsAPI ? 'Async' : ''}$1`); + crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/(?:\w+?\.)?__cadesAsyncToken__\s*?\+\s*?\b/gm, cadesGeneratorsAPI ? 'yield ' : ''); + if (!cadesGeneratorsAPI) { + crossEnvCallbackLiteral = crossEnvCallbackLiteral.replace(/propset_(.*?)\((.*?)\)/gm, '$1 = $2'); } + return [ + cadesGeneratorsAPI ? `cadesplugin.async_spawn(${crossEnvCallbackLiteral});` : `(${crossEnvCallbackLiteral})();`, + `//# sourceURL=crypto-pro_${callbackName}.js`, + ].join(''); +}; - //Функции для IOS - var ru_cryptopro_npcades_10_native_bridge = { - callbacksCount : 1, - callbacks : {}, - // Automatically called by native layer when a result is available - resultForCallback : function resultForCallback(callbackId, resultArray) { - var callback = ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId]; - if (!callback) return; - callback.apply(null,resultArray); - }, +/***/ }), - // Use this in javascript to request native objective-c code - // functionName : string (I think the name is explicit :p) - // args : array of arguments - // callback : function with n-arguments that is going to be called when the native code returned - call : function call(functionName, args, callback) { - var hasCallback = callback && typeof callback === "function"; - var callbackId = hasCallback ? ru_cryptopro_npcades_10_native_bridge.callbacksCount++ : 0; +/***/ "./helpers/_getCadesCert.ts": +/*!**********************************!*\ + !*** ./helpers/_getCadesCert.ts ***! + \**********************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - if (hasCallback) - ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId] = callback; +"use strict"; - var iframe = document.createElement("IFRAME"); - var arrObjs = new Array("_CPNP_handle"); - try{ - iframe.setAttribute("src", "cpnp-js-call:" + functionName + ":" + callbackId+ ":" + encodeURIComponent(JSON.stringify(args, arrObjs))); - } catch(e){ - alert(e); - } - document.documentElement.appendChild(iframe); - iframe.parentNode.removeChild(iframe); - iframe = null; +Object.defineProperty(exports, "__esModule", { value: true }); +const _afterPluginsLoaded_1 = __webpack_require__(/*! ./_afterPluginsLoaded */ "./helpers/_afterPluginsLoaded.ts"); +const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ./_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); +const _generateCadesFn_1 = __webpack_require__(/*! ./_generateCadesFn */ "./helpers/_generateCadesFn.ts"); +/** + * Возвращает сертификат в формате Cades по отпечатку + * + * @param thumbprint - отпечаток сертификата + * @returns сертификат в формате Cades + */ +exports._getCadesCert = _afterPluginsLoaded_1._afterPluginsLoaded((thumbprint) => { + const { cadesplugin } = window; + return eval(_generateCadesFn_1._generateCadesFn(function _getCadesCert() { + let cadesStore; + try { + cadesStore = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.Store'); } - }; - - function call_ru_cryptopro_npcades_10_native_bridge(functionName, array){ - var tmpobj; - var ex; - ru_cryptopro_npcades_10_native_bridge.call(functionName, array, function(e, response){ - ex = e; - var str='tmpobj='+response; - eval(str); - if (typeof (tmpobj) === "string"){ - tmpobj = tmpobj.replace(/\\\n/gm, "\n"); - tmpobj = tmpobj.replace(/\\\r/gm, "\r"); - } - }); - if(ex) - throw ex; - return tmpobj; - } - - function show_firefox_missing_extension_dialog() - { - if (!window.cadesplugin_skip_extension_install) - { - var ovr = document.createElement('div'); - ovr.id = "cadesplugin_ovr"; - ovr.style = "visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)"; - ovr.innerHTML = "
" + - "" + - "

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

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

" + - "
"; - document.getElementsByTagName("Body")[0].appendChild(ovr); - document.getElementById("cadesplugin_close_install").addEventListener('click',function() - { - plugin_loaded_error("Плагин недоступен"); - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - }); - - ovr.addEventListener('click',function() - { - plugin_loaded_error("Плагин недоступен"); - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - }); - ovr.style.visibility="visible"; + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при попытке доступа к хранилищу'); } - } - function firefox_or_safari_nmcades_onload() { - if (window.cadesplugin_extension_loaded_callback) - window.cadesplugin_extension_loaded_callback(); - isFireFoxExtensionLoaded = true; - cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error); - } - - function nmcades_api_onload() { - if (!isIE() && !isFireFox && !isSafari) { - if (window.cadesplugin_extension_loaded_callback) - window.cadesplugin_extension_loaded_callback(); + if (!cadesStore) { + throw new Error('Не удалось получить доступ к хранилищу сертификатов'); } - window.postMessage("cadesplugin_echo_request", "*"); - window.addEventListener("message", function (event){ - if (typeof(event.data) !== "string" || !event.data.match("cadesplugin_loaded")) - return; - if (cadesplugin_loaded_event_recieved) - return; - if(isFireFox || isSafari) - { - // Для Firefox, Сафари вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js - var url = event.data.substring(event.data.indexOf("url:") + 4); - if (!url.match("^(moz|safari)-extension://[a-zA-Z0-9/_-]+/nmcades_plugin_api.js$")) - { - cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, "Bad url \"" + url + "\" for load CryptoPro Extension for CAdES Browser plug-in"); - plugin_loaded_error(); - return; - } - var fileref = document.createElement('script'); - fileref.setAttribute("type", "text/javascript"); - fileref.setAttribute("src", url); - fileref.onerror = plugin_loaded_error; - fileref.onload = firefox_or_safari_nmcades_onload; - document.getElementsByTagName("head")[0].appendChild(fileref); - }else { - cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error); - } - cadesplugin_loaded_event_recieved = true; - }, false); - } - - //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari - function load_extension() - { - if(isFireFox || isSafari){ - // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера. - nmcades_api_onload(); - } else { - // в асинхронном варианте для Yandex и Opera подключаем расширение из Opera store. - if (isOpera || isYandex) { - var fileref = document.createElement('script'); - fileref.setAttribute("type", "text/javascript"); - fileref.setAttribute("src", "chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js"); - fileref.onerror = plugin_loaded_error; - fileref.onload = nmcades_api_onload; - document.getElementsByTagName("head")[0].appendChild(fileref); - } else { - // для Chrome, Chromium, Chromium Edge расширение из Chrome store - var fileref = document.createElement('script'); - fileref.setAttribute("type", "text/javascript"); - fileref.setAttribute("src", "chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js"); - fileref.onerror = plugin_loaded_error; - fileref.onload = nmcades_api_onload; - document.getElementsByTagName("head")[0].appendChild(fileref); - } + try { + void (_generateCadesFn_1.__cadesAsyncToken__ + + cadesStore.Open(cadesplugin.CAPICOM_CURRENT_USER_STORE, cadesplugin.CAPICOM_MY_STORE, cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED)); } - } - - //Загружаем плагин для NPAPI - function load_npapi_plugin() - { - var elem = document.createElement('object'); - elem.setAttribute("id", "cadesplugin_object"); - elem.setAttribute("type", "application/x-cades"); - elem.setAttribute("style", "visibility: hidden"); - document.getElementsByTagName("body")[0].appendChild(elem); - pluginObject = document.getElementById("cadesplugin_object"); - if(isIE()) - { - var elem1 = document.createElement('object'); - elem1.setAttribute("id", "certEnrollClassFactory"); - elem1.setAttribute("classid", "clsid:884e2049-217d-11da-b2a4-000e7bbb2b09"); - elem1.setAttribute("style", "visibility: hidden"); - document.getElementsByTagName("body")[0].appendChild(elem1); - var elem2 = document.createElement('object'); - elem2.setAttribute("id", "webClassFactory"); - elem2.setAttribute("classid", "clsid:B04C8637-10BD-484E-B0DA-B8A039F60024"); - elem2.setAttribute("style", "visibility: hidden"); - document.getElementsByTagName("body")[0].appendChild(elem2); + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при открытии хранилища'); } - } - - //Отправляем событие что все ок. - function plugin_loaded() - { - plugin_resolved = 1; - if(canPromise) - { - plugin_resolve(); - }else { - window.postMessage("cadesplugin_loaded", "*"); + let cadesCertificateList; + let certificatesCount; + try { + cadesCertificateList = _generateCadesFn_1.__cadesAsyncToken__ + cadesStore.Certificates; + certificatesCount = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Count; } - } - - //Отправляем событие что сломались. - function plugin_loaded_error(msg) - { - if(typeof(msg) === 'undefined' || typeof(msg) === 'object') - msg = "Плагин недоступен"; - plugin_resolved = 1; - if(canPromise) - { - plugin_reject(msg); - } else { - window.postMessage("cadesplugin_load_error", "*"); + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка получения списка сертификатов'); } - } - - //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку - function check_load_timeout() - { - if(plugin_resolved === 1) - return; - if(isFireFox) - { - if (!isFireFoxExtensionLoaded) - show_firefox_missing_extension_dialog(); + if (!certificatesCount) { + throw new Error('Нет доступных сертификатов'); } - plugin_resolved = 1; - if(canPromise) - { - plugin_reject("Истекло время ожидания загрузки плагина"); - } else { - window.postMessage("cadesplugin_load_error", "*"); + let cadesCertificate; + try { + cadesCertificateList = + _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Find(cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH, thumbprint); + const count = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Count; + if (!count) { + throw new Error(`Сертификат с отпечатком: "${thumbprint}" не найден`); + } + cadesCertificate = _generateCadesFn_1.__cadesAsyncToken__ + cadesCertificateList.Item(1); + } + catch (error) { + console.error(error); + throw new Error(_extractMeaningfulErrorMessage_1._extractMeaningfulErrorMessage(error) || 'Ошибка при получении сертификата'); } + cadesStore.Close(); + return cadesCertificate; + })); +}); - } - //Вспомогательная функция для NPAPI - function createPromise(arg) - { - return new Promise(arg); - } +/***/ }), - function check_npapi_plugin (){ - try { - var oAbout = CreateObject("CAdESCOM.About"); - plugin_loaded(); - } - catch (err) { - document.getElementById("cadesplugin_object").style.display = 'none'; - // Объект создать не удалось, проверим, установлен ли - // вообще плагин. Такая возможность есть не во всех браузерах - var mimetype = navigator.mimeTypes["application/x-cades"]; - if (mimetype) { - var plugin = mimetype.enabledPlugin; - if (plugin) { - plugin_loaded_error("Плагин загружен, но не создаются обьекты"); - }else - { - plugin_loaded_error("Ошибка при загрузке плагина"); - } - }else - { - plugin_loaded_error("Плагин недоступен"); - } - } - } +/***/ "./helpers/_getDateObj.ts": +/*!********************************!*\ + !*** ./helpers/_getDateObj.ts ***! + \********************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - //Проверяем работает ли плагин - function check_plugin_working() - { - var div = document.createElement("div"); - div.innerHTML = ""; - var isIeLessThan9 = (div.getElementsByTagName("i").length === 1); - if (isIeLessThan9) { - plugin_loaded_error("Internet Explorer версии 8 и ниже не поддерживается"); - return; - } +"use strict"; - if(isNativeMessageSupported()) - { - load_extension(); - }else if(!canPromise) { - window.addEventListener("message", function (event){ - if (event.data !== "cadesplugin_echo_request") - return; - load_npapi_plugin(); - check_npapi_plugin(); - }, - false); - }else - { - if(document.readyState === "complete"){ - load_npapi_plugin(); - check_npapi_plugin(); - } else { - window.addEventListener("load", function (event) { - load_npapi_plugin(); - check_npapi_plugin(); - }, false); - } - } - } +Object.defineProperty(exports, "__esModule", { value: true }); +/** + * Возвращает объект даты, совместимый с Cades plugin'ом, зависящий от браузера. + * + * В IE необходимо использовать специфичный формат "VT_DATE" + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Microsoft_Extensions/Date.getVarDate + */ +exports._getDateObj = (dateObj) => (dateObj.getVarDate ? dateObj.getVarDate() : dateObj); - function set_pluginObject(obj) - { - pluginObject = obj; - } - function is_capilite_enabled() - { - if ((typeof (cadesplugin.EnableInternalCSP) !== 'undefined') && cadesplugin.EnableInternalCSP) - return true; - return false; - }; +/***/ }), - function set_load_timeout() - { - if (window.cadesplugin_load_timeout) { - setTimeout(check_load_timeout, window.cadesplugin_load_timeout); - } - else { - setTimeout(check_load_timeout, 20000); - } - } +/***/ "./helpers/_isSupportedCSPVersion.ts": +/*!*******************************************!*\ + !*** ./helpers/_isSupportedCSPVersion.ts ***! + \*******************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { - var onVisibilityChange = function (event) { - if (document.hidden === false) { - document.removeEventListener("visibilitychange", onVisibilityChange); - set_load_timeout(); - check_plugin_working(); - } - }; +"use strict"; - //Export - cadesplugin.JSModuleVersion = "2.3.5"; - cadesplugin.async_spawn = async_spawn; - cadesplugin.set = set_pluginObject; - cadesplugin.set_log_level = set_log_level; - cadesplugin.get_extension_version = get_extension_version; - cadesplugin.getLastError = getLastError; - cadesplugin.is_capilite_enabled = is_capilite_enabled; +Object.defineProperty(exports, "__esModule", { value: true }); +const oldestSupportedCSPVersion = 4.0; +exports._isSupportedCSPVersion = (version) => { + var _a; + version = (_a = version.match(/\d+?\b(?:\.\d+)?/)) === null || _a === void 0 ? void 0 : _a[0]; + return Number(version) >= oldestSupportedCSPVersion; +}; - if(isNativeMessageSupported()) - { - cadesplugin.CreateObjectAsync = CreateObjectAsync; - cadesplugin.ReleasePluginObjects = ReleasePluginObjects; - } - if(!isNativeMessageSupported()) - { - cadesplugin.CreateObject = CreateObject; +/***/ }), + +/***/ "./helpers/_isSupportedCadesVersion.ts": +/*!*********************************************!*\ + !*** ./helpers/_isSupportedCadesVersion.ts ***! + \*********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports._isSupportedCadesVersion = (version) => { + const match = version.match(/(\d+)\.(\d+)\.(\d+)/); + if (!match) { + return false; + } + const [, major, minor, patch] = match; + if (Number(major) < 2) { + return false; + } + if (Number(major) === 2 && Number(patch) < 12438) { + return false; } + return true; +}; - set_constantValues(); - cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR; - window.cadesplugin = cadesplugin; - if (isSafari && document.hidden) { - document.addEventListener("visibilitychange", onVisibilityChange); - return; +/***/ }), + +/***/ "./helpers/_parseCertInfo.ts": +/*!***********************************!*\ + !*** ./helpers/_parseCertInfo.ts ***! + \***********************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const constants_1 = __webpack_require__(/*! ../constants */ "./constants/index.ts"); +/** + * Парсит информацию из строки с информацией о сертификате + * + * @param tagsTranslations - словарь с расшифровками тэгов + * @param rawInfo - данные для парсинга + * @returns расшифрованная информация по отдельным тэгам + */ +exports._parseCertInfo = (tagsTranslations, rawInfo) => { + const extractedEntities = rawInfo.match(/([а-яА-Яa-zA-Z0-9\s.]+)=(?:("[^"]+?")|(.+?))(?:,|$)/g); + if (extractedEntities) { + return extractedEntities.map((group) => { + var _a, _b, _c; + const segmentsMatch = group.trim().match(/^([а-яА-Яa-zA-Z0-9\s.]+)=(.+?),?$/); + let title = segmentsMatch === null || segmentsMatch === void 0 ? void 0 : segmentsMatch[1]; + // Вырезаем лишние кавычки + const description = (_b = (_a = segmentsMatch === null || segmentsMatch === void 0 ? void 0 : segmentsMatch[2]) === null || _a === void 0 ? void 0 : _a.replace(/^"(.*)"/, '$1')) === null || _b === void 0 ? void 0 : _b.replace(/"{2}/g, '"'); + const oidIdentifierMatch = title === null || title === void 0 ? void 0 : title.match(/^OID\.(.*)/); + const oidIdentifier = oidIdentifierMatch === null || oidIdentifierMatch === void 0 ? void 0 : oidIdentifierMatch[1]; + let isTranslated = false; + // Если нашли в тайтле ОИД, пытаемся его расшифровать + if (oidIdentifier) { + const oidTranslation = constants_1.OIDS_DICTIONARY[oidIdentifier]; + if (oidTranslation) { + title = oidTranslation; + isTranslated = true; + } + } + const tagTranslation = (_c = tagsTranslations.find((tag) => tag.possibleNames.find((name) => name === title))) === null || _c === void 0 ? void 0 : _c.translation; + if (tagTranslation) { + title = tagTranslation; + isTranslated = true; + } + return { description, title, isTranslated }; + }); } - set_load_timeout(); - check_plugin_working(); -}()); +}; /***/ }) diff --git a/lib/crypto-pro.js.map b/lib/crypto-pro.js.map index 37f8e80..2cd3f39 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/../node_modules/base64-js/index.js","webpack://cryptoPro/../node_modules/buffer/index.js","webpack://cryptoPro/../node_modules/ieee754/index.js","webpack://cryptoPro/../node_modules/isarray/index.js","webpack://cryptoPro/../node_modules/webpack/buildin/global.js","webpack://cryptoPro/./api/certificate/certificate.ts","webpack://cryptoPro/./api/certificate/exportBase64.ts","webpack://cryptoPro/./api/certificate/getAlgorithm.ts","webpack://cryptoPro/./api/certificate/getCadesProp.ts","webpack://cryptoPro/./api/certificate/getDecodedExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/getExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/getInfo.ts","webpack://cryptoPro/./api/certificate/hasExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/index.ts","webpack://cryptoPro/./api/certificate/isValid.ts","webpack://cryptoPro/./api/createAttachedSignature.ts","webpack://cryptoPro/./api/createDetachedSignature.ts","webpack://cryptoPro/./api/createHash.ts","webpack://cryptoPro/./api/createSignature.ts","webpack://cryptoPro/./api/createXMLSignature.ts","webpack://cryptoPro/./api/execute.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;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,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;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;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,SAAS;AACT;;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;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;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;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;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;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;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,iBAAiB,mBAAmB,uBAAuB,uBAAuB,cAAc,mBAAmB,YAAY;AACpN,4EAA4E,iBAAiB,yBAAyB,WAAW;AACjI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA,aAAa;AACb;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;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;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,SAAS;AACT;AACA;AACA;;AAEA;AACA;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;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;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, AlgorithmInfo } 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\nexport interface 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 { 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 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 cadesAttrs;\n let cadesHashedData;\n let cadesSignedData;\n let cadesSigner;\n\n try {\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\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 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__ + 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 { TranscodeEncoding } from 'buffer';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\ntype Options = {\n hashedAlgorithm?: number;\n encoding?: TranscodeEncoding;\n};\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 * @hashedAlgorithm - алгоритм хеширования. По умолчанию - CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256.\n *\n * @returns хеш\n */\nexport const createHash = _afterPluginsLoaded(\n async (unencryptedMessage: string | ArrayBuffer, options?: Options): 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 if (options?.encoding && typeof unencryptedMessage === 'string') {\n messageBase64 = Buffer.from(unencryptedMessage, options?.encoding).toString('base64');\n } else {\n messageBase64 = Buffer.from(unencryptedMessage).toString('base64');\n }\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(\n options?.hashedAlgorithm ?? cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256,\n )\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 { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\nimport { _getCadesCert } from '../helpers/_getCadesCert';\n\n/**\n * Создает XML подпись для документа в формате XML\n *\n * @param thumbprint - отпечаток сертификата\n * @param unencryptedMessage - подписываемое сообщение в формате XML\n * @returns подпись\n */\nexport const createXMLSignature = _afterPluginsLoaded(\n async (thumbprint: string, unencryptedMessage: string): Promise => {\n const { cadesplugin } = window;\n const cadesCertificate = await _getCadesCert(thumbprint);\n\n return eval(\n _generateCadesFn(function createXMLSignature(): string {\n let cadesSigner;\n let cadesSignedXML;\n\n try {\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\n cadesSignedXML = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.SignedXML');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\n }\n\n try {\n const signatureMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256';\n const digestMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256';\n\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\n void (__cadesAsyncToken__ + cadesSigner.propset_CheckCertificate(true));\n void (__cadesAsyncToken__ + cadesSignedXML.propset_Content(unencryptedMessage));\n void (\n __cadesAsyncToken__ +\n cadesSignedXML.propset_SignatureType(cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED)\n );\n void (__cadesAsyncToken__ + cadesSignedXML.propset_SignatureMethod(signatureMethod));\n void (__cadesAsyncToken__ + cadesSignedXML.propset_DigestMethod(digestMethod));\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__ + cadesSignedXML.Sign(cadesSigner);\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 * Функция кастомной реализации с доступом к Cades плагину напрямую\n *\n * @callback executeCallback\n * @param exposedAPI - API доступные для кастомной реализации\n * @param exposedAPI.cadesplugin - Cades плагин, предоставляемый КриптоПРО\n * @param exposedAPI._generateCadesFn - функция, компилирующая тело передаваемой javascript функции для текущей среды\n * @param exposedAPI.__cadesAsyncToken__ - синтетический маркер, подменяемый в рантайме\n * @param exposedAPI.__createCadesPluginObject__ - функция для создания синхронных/асинхронных Cades объектов\n * @param exposedAPI._extractMeaningfulErrorMessage - хелпер для извлечения текста ошибки\n *\n * @returns результат выполнения кастомной реализации\n */\n\n/**\n * Компилирует и выполняет переданную функцию для доступной браузерной среды (синхронной/асинхронной)\n *\n * @param {executeCallback} callback - функция, использующая низкоуровневый доступ к Cades плагину\n *\n * @returns асинхронный результат выполнения передаваемой функции\n */\nexport const execute = _afterPluginsLoaded(\n async (\n callback: (exposedAPI: {\n cadesplugin: any;\n _generateCadesFn: (callback: Function) => string;\n __cadesAsyncToken__: object;\n __createCadesPluginObject__: (...args) => any;\n _extractMeaningfulErrorMessage: (error: Error) => string | null;\n }) => any,\n ): Promise =>\n await callback({\n cadesplugin: window.cadesplugin,\n _generateCadesFn,\n __cadesAsyncToken__,\n __createCadesPluginObject__,\n _extractMeaningfulErrorMessage,\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 './createXMLSignature';\nexport * from './createDetachedSignature';\nexport * from './createAttachedSignature';\nexport * from './createHash';\nexport * from './certificate';\nexport * from './execute';\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 isSafari = 0;\n var isYandex = 0;\n var canPromise = !!window.Promise;\n var cadesplugin_loaded_event_recieved = false;\n var isFireFoxExtensionLoaded = false;\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|yabrowser|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|Edg|YaBrowser)\\/(\\d+)/);\n if (tem != null)\n 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)\n 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 get_extension_version(callback) {\n window.postMessage(\"cadesplugin_extension_version_request\", \"*\");\n window.addEventListener(\"message\", function (event) {\n var resp_prefix = \"cadesplugin_extension_version_response:\";\n if (typeof (event.data) !== \"string\" || event.data.indexOf(resp_prefix) !== 0)\n return;\n ext_version = event.data.substring(resp_prefix.length);\n callback(ext_version);\n }, false);\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_MEMORY_STORE = 0;\n cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CAPICOM_CURRENT_USER_STORE = 2;\n cadesplugin.CAPICOM_SMART_CARD_USER_STORE = 4;\n cadesplugin.CADESCOM_MEMORY_STORE = 0;\n cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CADESCOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_SMART_CARD_USER_STORE = 4;\n cadesplugin.CADESCOM_CONTAINER_STORE = 100;\n\n cadesplugin.CAPICOM_MY_STORE = \"My\";\n\n cadesplugin.CAPICOM_STORE_OPEN_READ_WRITE = 1;\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.CADESCOM_XADES_DEFAULT = 0x00000010;\n cadesplugin.CADESCOM_XADES_BES = 0x00000020;\n cadesplugin.CADESCOM_XADES_T = 0x00000050;\n cadesplugin.CADESCOM_XADES_X_LONG_TYPE_1 = 0x000005d0;\n cadesplugin.CADESCOM_XMLDSIG_TYPE = 0x00000000;\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.XmlDsigGost3411Url2012256 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256\";\n cadesplugin.XmlDsigGost3410Url2012256 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256\";\n cadesplugin.XmlDsigGost3411Url2012512 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-512\";\n cadesplugin.XmlDsigGost3410Url2012512 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-512\";\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_AUTHENTICATED_ATTRIBUTE_MACHINE_INFO = 0x100;\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 cadesplugin.CADESCOM_InstallCertChainToContainer = 0x20000000;\n cadesplugin.CADESCOM_UseContainerStore = 0x40000000;\n\n cadesplugin.ENABLE_CARRIER_TYPE_CSP = 0x01;\n cadesplugin.ENABLE_CARRIER_TYPE_FKC_NO_SM = 0x02;\n cadesplugin.ENABLE_CARRIER_TYPE_FKC_SM = 0x04;\n cadesplugin.ENABLE_ANY_CARRIER_TYPE = 0x07;\n\n cadesplugin.DISABLE_EVERY_CARRIER_OPERATION = 0x00;\n cadesplugin.ENABLE_CARRIER_OPEN_ENUM = 0x01;\n cadesplugin.ENABLE_CARRIER_CREATE = 0x02;\n cadesplugin.ENABLE_ANY_OPERATION = 0x03;\n\n cadesplugin.CADESCOM_PRODUCT_CSP = 0;\n cadesplugin.CADESCOM_PRODUCT_OCSP = 1;\n cadesplugin.CADESCOM_PRODUCT_TSP = 2;\n\n cadesplugin.MEDIA_TYPE_REGISTRY = 0x00000001;\n cadesplugin.MEDIA_TYPE_HDIMAGE = 0x00000002;\n cadesplugin.MEDIA_TYPE_CLOUD = 0x00000004;\n cadesplugin.MEDIA_TYPE_SCARD = 0x00000008;\n\n cadesplugin.XCN_CRYPT_STRING_BASE64HEADER = 0;\n cadesplugin.AT_KEYEXCHANGE = 1;\n cadesplugin.AT_SIGNATURE = 2;\n\n cadesplugin.CARRIER_FLAG_REMOVABLE = 1;\n cadesplugin.CARRIER_FLAG_UNIQUE = 2;\n cadesplugin.CARRIER_FLAG_PROTECTED = 4;\n cadesplugin.CARRIER_FLAG_FUNCTIONAL_CARRIER = 8;\n cadesplugin.CARRIER_FLAG_SECURE_MESSAGING = 16;\n cadesplugin.CARRIER_FLAG_ABLE_VISUALISE_SIGNATURE = 64;\n cadesplugin.CARRIER_FLAG_VIRTUAL = 128;\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 === 'Edg') {\n return true;\n }\n if (browserSpecs.name === 'YaBrowser') {\n isYandex = 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 function firefox_or_safari_nmcades_onload() {\n if (window.cadesplugin_extension_loaded_callback)\n window.cadesplugin_extension_loaded_callback();\n isFireFoxExtensionLoaded = true;\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n\n function nmcades_api_onload() {\n if (!isIE() && !isFireFox && !isSafari) {\n if (window.cadesplugin_extension_loaded_callback)\n window.cadesplugin_extension_loaded_callback();\n }\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 (cadesplugin_loaded_event_recieved)\n return;\n if(isFireFox || isSafari)\n {\n // Для Firefox, Сафари вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js\n var url = event.data.substring(event.data.indexOf(\"url:\") + 4);\n if (!url.match(\"^(moz|safari)-extension://[a-zA-Z0-9/_-]+/nmcades_plugin_api.js$\"))\n {\n cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, \"Bad url \\\"\" + url + \"\\\" for load CryptoPro Extension for CAdES Browser plug-in\");\n plugin_loaded_error();\n return;\n }\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_safari_nmcades_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n }else {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n cadesplugin_loaded_event_recieved = true;\n }, false);\n }\n\n //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari\n function load_extension()\n {\n if(isFireFox || isSafari){\n // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера.\n nmcades_api_onload();\n } else {\n // в асинхронном варианте для Yandex и Opera подключаем расширение из Opera store.\n if (isOpera || isYandex) {\n var 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 } else {\n // для Chrome, Chromium, Chromium Edge расширение из Chrome store\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 }\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(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 if (!isFireFoxExtensionLoaded)\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 function set_load_timeout()\n {\n if (window.cadesplugin_load_timeout) {\n setTimeout(check_load_timeout, window.cadesplugin_load_timeout);\n }\n else {\n setTimeout(check_load_timeout, 20000);\n }\n }\n\n var onVisibilityChange = function (event) {\n if (document.hidden === false) {\n document.removeEventListener(\"visibilitychange\", onVisibilityChange);\n set_load_timeout();\n check_plugin_working();\n }\n };\n\n //Export\n cadesplugin.JSModuleVersion = \"2.3.5\";\n cadesplugin.async_spawn = async_spawn;\n cadesplugin.set = set_pluginObject;\n cadesplugin.set_log_level = set_log_level;\n cadesplugin.get_extension_version = get_extension_version;\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 set_constantValues();\n\n cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR;\n window.cadesplugin = cadesplugin;\n if (isSafari && document.hidden) {\n document.addEventListener(\"visibilitychange\", onVisibilityChange);\n return;\n }\n set_load_timeout();\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/cadesplugin_api.js/dist/cadesplugin_api.js","webpack://cryptoPro/../node_modules/ieee754/index.js","webpack://cryptoPro/../node_modules/isarray/index.js","webpack://cryptoPro/../node_modules/webpack/buildin/global.js","webpack://cryptoPro/./api/certificate/certificate.ts","webpack://cryptoPro/./api/certificate/exportBase64.ts","webpack://cryptoPro/./api/certificate/getAlgorithm.ts","webpack://cryptoPro/./api/certificate/getCadesProp.ts","webpack://cryptoPro/./api/certificate/getDecodedExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/getExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/getInfo.ts","webpack://cryptoPro/./api/certificate/hasExtendedKeyUsage.ts","webpack://cryptoPro/./api/certificate/index.ts","webpack://cryptoPro/./api/certificate/isValid.ts","webpack://cryptoPro/./api/createAttachedSignature.ts","webpack://cryptoPro/./api/createDetachedSignature.ts","webpack://cryptoPro/./api/createHash.ts","webpack://cryptoPro/./api/createSignature.ts","webpack://cryptoPro/./api/createXMLSignature.ts","webpack://cryptoPro/./api/execute.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"],"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,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;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,SAAS;AACT;;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;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;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;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;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;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;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,iBAAiB,mBAAmB,uBAAuB,uBAAuB,cAAc,mBAAmB,YAAY;AACpN,4EAA4E,iBAAiB,yBAAyB,WAAW;AACjI;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA,aAAa;AACb;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;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;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,SAAS;AACT;AACA;AACA;;AAEA;AACA;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;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AAC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,IAAI,CAAC;aACrB;YAED,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;QAC9C,CAAC,CAAC,CAAC;KACJ;AACH,CAAC,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",";(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 isSafari = 0;\n var isYandex = 0;\n var canPromise = !!window.Promise;\n var cadesplugin_loaded_event_recieved = false;\n var isFireFoxExtensionLoaded = false;\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|yabrowser|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|Edg|YaBrowser)\\/(\\d+)/);\n if (tem != null)\n 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)\n 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 get_extension_version(callback) {\n window.postMessage(\"cadesplugin_extension_version_request\", \"*\");\n window.addEventListener(\"message\", function (event) {\n var resp_prefix = \"cadesplugin_extension_version_response:\";\n if (typeof (event.data) !== \"string\" || event.data.indexOf(resp_prefix) !== 0)\n return;\n ext_version = event.data.substring(resp_prefix.length);\n callback(ext_version);\n }, false);\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_MEMORY_STORE = 0;\n cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CAPICOM_CURRENT_USER_STORE = 2;\n cadesplugin.CAPICOM_SMART_CARD_USER_STORE = 4;\n cadesplugin.CADESCOM_MEMORY_STORE = 0;\n cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CADESCOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_SMART_CARD_USER_STORE = 4;\n cadesplugin.CADESCOM_CONTAINER_STORE = 100;\n\n cadesplugin.CAPICOM_MY_STORE = \"My\";\n\n cadesplugin.CAPICOM_STORE_OPEN_READ_WRITE = 1;\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.CADESCOM_XADES_DEFAULT = 0x00000010;\n cadesplugin.CADESCOM_XADES_BES = 0x00000020;\n cadesplugin.CADESCOM_XADES_T = 0x00000050;\n cadesplugin.CADESCOM_XADES_X_LONG_TYPE_1 = 0x000005d0;\n cadesplugin.CADESCOM_XMLDSIG_TYPE = 0x00000000;\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.XmlDsigGost3411Url2012256 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256\";\n cadesplugin.XmlDsigGost3410Url2012256 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256\";\n cadesplugin.XmlDsigGost3411Url2012512 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-512\";\n cadesplugin.XmlDsigGost3410Url2012512 = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-512\";\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_AUTHENTICATED_ATTRIBUTE_MACHINE_INFO = 0x100;\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 cadesplugin.CADESCOM_InstallCertChainToContainer = 0x20000000;\n cadesplugin.CADESCOM_UseContainerStore = 0x40000000;\n\n cadesplugin.ENABLE_CARRIER_TYPE_CSP = 0x01;\n cadesplugin.ENABLE_CARRIER_TYPE_FKC_NO_SM = 0x02;\n cadesplugin.ENABLE_CARRIER_TYPE_FKC_SM = 0x04;\n cadesplugin.ENABLE_ANY_CARRIER_TYPE = 0x07;\n\n cadesplugin.DISABLE_EVERY_CARRIER_OPERATION = 0x00;\n cadesplugin.ENABLE_CARRIER_OPEN_ENUM = 0x01;\n cadesplugin.ENABLE_CARRIER_CREATE = 0x02;\n cadesplugin.ENABLE_ANY_OPERATION = 0x03;\n\n cadesplugin.CADESCOM_PRODUCT_CSP = 0;\n cadesplugin.CADESCOM_PRODUCT_OCSP = 1;\n cadesplugin.CADESCOM_PRODUCT_TSP = 2;\n\n cadesplugin.MEDIA_TYPE_REGISTRY = 0x00000001;\n cadesplugin.MEDIA_TYPE_HDIMAGE = 0x00000002;\n cadesplugin.MEDIA_TYPE_CLOUD = 0x00000004;\n cadesplugin.MEDIA_TYPE_SCARD = 0x00000008;\n\n cadesplugin.XCN_CRYPT_STRING_BASE64HEADER = 0;\n cadesplugin.AT_KEYEXCHANGE = 1;\n cadesplugin.AT_SIGNATURE = 2;\n\n cadesplugin.CARRIER_FLAG_REMOVABLE = 1;\n cadesplugin.CARRIER_FLAG_UNIQUE = 2;\n cadesplugin.CARRIER_FLAG_PROTECTED = 4;\n cadesplugin.CARRIER_FLAG_FUNCTIONAL_CARRIER = 8;\n cadesplugin.CARRIER_FLAG_SECURE_MESSAGING = 16;\n cadesplugin.CARRIER_FLAG_ABLE_VISUALISE_SIGNATURE = 64;\n cadesplugin.CARRIER_FLAG_VIRTUAL = 128;\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 === 'Edg') {\n return true;\n }\n if (browserSpecs.name === 'YaBrowser') {\n isYandex = 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 function firefox_or_safari_nmcades_onload() {\n if (window.cadesplugin_extension_loaded_callback)\n window.cadesplugin_extension_loaded_callback();\n isFireFoxExtensionLoaded = true;\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n\n function nmcades_api_onload() {\n if (!isIE() && !isFireFox && !isSafari) {\n if (window.cadesplugin_extension_loaded_callback)\n window.cadesplugin_extension_loaded_callback();\n }\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 (cadesplugin_loaded_event_recieved)\n return;\n if(isFireFox || isSafari)\n {\n // Для Firefox, Сафари вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js\n var url = event.data.substring(event.data.indexOf(\"url:\") + 4);\n if (!url.match(\"^(moz|safari)-extension://[a-zA-Z0-9/_-]+/nmcades_plugin_api.js$\"))\n {\n cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, \"Bad url \\\"\" + url + \"\\\" for load CryptoPro Extension for CAdES Browser plug-in\");\n plugin_loaded_error();\n return;\n }\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_safari_nmcades_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n }else {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n cadesplugin_loaded_event_recieved = true;\n }, false);\n }\n\n //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari\n function load_extension()\n {\n if(isFireFox || isSafari){\n // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера.\n nmcades_api_onload();\n } else {\n // в асинхронном варианте для Yandex и Opera подключаем расширение из Opera store.\n if (isOpera || isYandex) {\n var 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 } else {\n // для Chrome, Chromium, Chromium Edge расширение из Chrome store\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 }\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(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 if (!isFireFoxExtensionLoaded)\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 function set_load_timeout()\n {\n if (window.cadesplugin_load_timeout) {\n setTimeout(check_load_timeout, window.cadesplugin_load_timeout);\n }\n else {\n setTimeout(check_load_timeout, 20000);\n }\n }\n\n var onVisibilityChange = function (event) {\n if (document.hidden === false) {\n document.removeEventListener(\"visibilitychange\", onVisibilityChange);\n set_load_timeout();\n check_plugin_working();\n }\n };\n\n //Export\n cadesplugin.JSModuleVersion = \"2.3.5\";\n cadesplugin.async_spawn = async_spawn;\n cadesplugin.set = set_pluginObject;\n cadesplugin.set_log_level = set_log_level;\n cadesplugin.get_extension_version = get_extension_version;\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 set_constantValues();\n\n cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR;\n window.cadesplugin = cadesplugin;\n if (isSafari && document.hidden) {\n document.addEventListener(\"visibilitychange\", onVisibilityChange);\n return;\n }\n set_load_timeout();\n check_plugin_working();\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, AlgorithmInfo } 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\nexport interface 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 { 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 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 cadesAttrs;\n let cadesHashedData;\n let cadesSignedData;\n let cadesSigner;\n\n try {\n cadesAttrs = __cadesAsyncToken__ + __createCadesPluginObject__('CADESCOM.CPAttribute');\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 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__ + 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 { TranscodeEncoding } from 'buffer';\nimport { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\n\ntype Options = {\n hashedAlgorithm?: number;\n encoding?: TranscodeEncoding;\n};\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 * @hashedAlgorithm - алгоритм хеширования. По умолчанию - CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256.\n *\n * @returns хеш\n */\nexport const createHash = _afterPluginsLoaded(\n async (unencryptedMessage: string | ArrayBuffer, options?: Options): 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 if (options?.encoding && typeof unencryptedMessage === 'string') {\n messageBase64 = Buffer.from(unencryptedMessage, options?.encoding).toString('base64');\n } else {\n messageBase64 = Buffer.from(unencryptedMessage).toString('base64');\n }\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(\n options?.hashedAlgorithm ?? cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256,\n )\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 { _afterPluginsLoaded } from '../helpers/_afterPluginsLoaded';\nimport { _extractMeaningfulErrorMessage } from '../helpers/_extractMeaningfulErrorMessage';\nimport { __cadesAsyncToken__, __createCadesPluginObject__, _generateCadesFn } from '../helpers/_generateCadesFn';\nimport { _getCadesCert } from '../helpers/_getCadesCert';\n\n/**\n * Создает XML подпись для документа в формате XML\n *\n * @param thumbprint - отпечаток сертификата\n * @param unencryptedMessage - подписываемое сообщение в формате XML\n * @returns подпись\n */\nexport const createXMLSignature = _afterPluginsLoaded(\n async (thumbprint: string, unencryptedMessage: string): Promise => {\n const { cadesplugin } = window;\n const cadesCertificate = await _getCadesCert(thumbprint);\n\n return eval(\n _generateCadesFn(function createXMLSignature(): string {\n let cadesSigner;\n let cadesSignedXML;\n\n try {\n cadesSigner = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.CPSigner');\n cadesSignedXML = __cadesAsyncToken__ + __createCadesPluginObject__('CAdESCOM.SignedXML');\n } catch (error) {\n console.error(error);\n\n throw new Error(_extractMeaningfulErrorMessage(error) || 'Ошибка при инициализации подписи');\n }\n\n try {\n const signatureMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256';\n const digestMethod = 'urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256';\n\n void (__cadesAsyncToken__ + cadesSigner.propset_Certificate(cadesCertificate));\n void (__cadesAsyncToken__ + cadesSigner.propset_CheckCertificate(true));\n void (__cadesAsyncToken__ + cadesSignedXML.propset_Content(unencryptedMessage));\n void (\n __cadesAsyncToken__ +\n cadesSignedXML.propset_SignatureType(cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED)\n );\n void (__cadesAsyncToken__ + cadesSignedXML.propset_SignatureMethod(signatureMethod));\n void (__cadesAsyncToken__ + cadesSignedXML.propset_DigestMethod(digestMethod));\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__ + cadesSignedXML.Sign(cadesSigner);\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 * Функция кастомной реализации с доступом к Cades плагину напрямую\n *\n * @callback executeCallback\n * @param exposedAPI - API доступные для кастомной реализации\n * @param exposedAPI.cadesplugin - Cades плагин, предоставляемый КриптоПРО\n * @param exposedAPI._generateCadesFn - функция, компилирующая тело передаваемой javascript функции для текущей среды\n * @param exposedAPI.__cadesAsyncToken__ - синтетический маркер, подменяемый в рантайме\n * @param exposedAPI.__createCadesPluginObject__ - функция для создания синхронных/асинхронных Cades объектов\n * @param exposedAPI._extractMeaningfulErrorMessage - хелпер для извлечения текста ошибки\n *\n * @returns результат выполнения кастомной реализации\n */\n\n/**\n * Компилирует и выполняет переданную функцию для доступной браузерной среды (синхронной/асинхронной)\n *\n * @param {executeCallback} callback - функция, использующая низкоуровневый доступ к Cades плагину\n *\n * @returns асинхронный результат выполнения передаваемой функции\n */\nexport const execute = _afterPluginsLoaded(\n async (\n callback: (exposedAPI: {\n cadesplugin: any;\n _generateCadesFn: (callback: Function) => string;\n __cadesAsyncToken__: object;\n __createCadesPluginObject__: (...args) => any;\n _extractMeaningfulErrorMessage: (error: Error) => string | null;\n }) => any,\n ): Promise =>\n await callback({\n cadesplugin: window.cadesplugin,\n _generateCadesFn,\n __cadesAsyncToken__,\n __createCadesPluginObject__,\n _extractMeaningfulErrorMessage,\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 './createXMLSignature';\nexport * from './createDetachedSignature';\nexport * from './createAttachedSignature';\nexport * from './createHash';\nexport * from './certificate';\nexport * from './execute';\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('cadesplugin_api.js');\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"],"sourceRoot":""} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 0faabdb..b6e5185 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "crypto-pro", - "version": "2.5.0", + "version": "2.5.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1590,6 +1590,12 @@ "unset-value": "^1.0.0" } }, + "cadesplugin_api.js": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/cadesplugin_api.js/-/cadesplugin_api.js-2.3.5.tgz", + "integrity": "sha512-p8wi329HaJdzoBQBWo5Dc90XfnkeI7oALvy9xF4VVbTrL4kQVnlP68BR2kFkmAom+QlnmxvjL4oynrz5TJQq7Q==", + "dev": true + }, "callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", diff --git a/package.json b/package.json index 3751100..f161af6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "crypto-pro", - "version": "2.5.0", + "version": "2.5.1", "description": "API для взаимодействия с КриптоПро", "main": "./lib/crypto-pro.js", "types": "./lib/crypto-pro.d.ts", @@ -58,6 +58,7 @@ "@types/node": "13.9.5", "@typescript-eslint/eslint-plugin": "2.25.0", "@typescript-eslint/parser": "2.25.0", + "cadesplugin_api.js": "2.3.5", "coveralls": "3.0.11", "cross-env": "7.0.2", "eslint": "6.8.0", diff --git a/src/helpers/_afterPluginsLoaded.ts b/src/helpers/_afterPluginsLoaded.ts index d59da42..294311a 100644 --- a/src/helpers/_afterPluginsLoaded.ts +++ b/src/helpers/_afterPluginsLoaded.ts @@ -13,7 +13,7 @@ export const _afterPluginsLoaded = any>( return async function (...args: Parameters): Promise>> { if (!isPluginLoaded) { try { - require('../vendor/cadesplugin_api'); + require('cadesplugin_api.js'); } catch (error) { console.error(error); diff --git a/src/vendor/cadesplugin_api.js b/src/vendor/cadesplugin_api.js deleted file mode 100644 index ac32da5..0000000 --- a/src/vendor/cadesplugin_api.js +++ /dev/null @@ -1,770 +0,0 @@ -;(function () { - //already loaded - if(window.cadesplugin) - return; - - var pluginObject; - var plugin_resolved = 0; - var plugin_reject; - var plugin_resolve; - var isOpera = 0; - var isFireFox = 0; - var isSafari = 0; - var isYandex = 0; - var canPromise = !!window.Promise; - var cadesplugin_loaded_event_recieved = false; - var isFireFoxExtensionLoaded = false; - var cadesplugin; - - if(canPromise) - { - cadesplugin = new Promise(function(resolve, reject) - { - plugin_resolve = resolve; - plugin_reject = reject; - }); - } else - { - cadesplugin = {}; - } - - function check_browser() { - var ua= navigator.userAgent, tem, M= ua.match(/(opera|yabrowser|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; - if(/trident/i.test(M[1])){ - tem = /\brv[ :]+(\d+)/g.exec(ua) || []; - return { name:'IE', version:(tem[1] || '')}; - } - if(M[1] === 'Chrome'){ - tem = ua.match(/\b(OPR|Edg|YaBrowser)\/(\d+)/); - if (tem != null) - return { name: tem[1].replace('OPR', 'Opera'), version: tem[2] }; - } - M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?']; - if ((tem = ua.match(/version\/(\d+)/i)) != null) - M.splice(1, 1, tem[1]); - return {name:M[0],version:M[1]}; - } - var browserSpecs = check_browser(); - - function cpcsp_console_log(level, msg){ - //IE9 не может писать в консоль если не открыта вкладка developer tools - if(typeof(console) === 'undefined') - return; - if (level <= cadesplugin.current_log_level ){ - if (level === cadesplugin.LOG_LEVEL_DEBUG) - console.log("DEBUG: %s", msg); - if (level === cadesplugin.LOG_LEVEL_INFO) - console.info("INFO: %s", msg); - if (level === cadesplugin.LOG_LEVEL_ERROR) - console.error("ERROR: %s", msg); - return; - } - } - - function get_extension_version(callback) { - window.postMessage("cadesplugin_extension_version_request", "*"); - window.addEventListener("message", function (event) { - var resp_prefix = "cadesplugin_extension_version_response:"; - if (typeof (event.data) !== "string" || event.data.indexOf(resp_prefix) !== 0) - return; - ext_version = event.data.substring(resp_prefix.length); - callback(ext_version); - }, false); - } - - function set_log_level(level){ - if (!((level === cadesplugin.LOG_LEVEL_DEBUG) || - (level === cadesplugin.LOG_LEVEL_INFO) || - (level === cadesplugin.LOG_LEVEL_ERROR))){ - cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, "cadesplugin_api.js: Incorrect log_level: " + level); - return; - } - cadesplugin.current_log_level = level; - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = DEBUG"); - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = INFO"); - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = ERROR"); - if(isNativeMessageSupported()) - { - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_DEBUG) - window.postMessage("set_log_level=debug", "*"); - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_INFO) - window.postMessage("set_log_level=info", "*"); - if (cadesplugin.current_log_level === cadesplugin.LOG_LEVEL_ERROR) - window.postMessage("set_log_level=error", "*"); - } - } - - function set_constantValues() - { - cadesplugin.CAPICOM_MEMORY_STORE = 0; - cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1; - cadesplugin.CAPICOM_CURRENT_USER_STORE = 2; - cadesplugin.CAPICOM_SMART_CARD_USER_STORE = 4; - cadesplugin.CADESCOM_MEMORY_STORE = 0; - cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1; - cadesplugin.CADESCOM_CURRENT_USER_STORE = 2; - cadesplugin.CADESCOM_SMART_CARD_USER_STORE = 4; - cadesplugin.CADESCOM_CONTAINER_STORE = 100; - - cadesplugin.CAPICOM_MY_STORE = "My"; - - cadesplugin.CAPICOM_STORE_OPEN_READ_WRITE = 1; - 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.CADESCOM_XADES_DEFAULT = 0x00000010; - cadesplugin.CADESCOM_XADES_BES = 0x00000020; - cadesplugin.CADESCOM_XADES_T = 0x00000050; - cadesplugin.CADESCOM_XADES_X_LONG_TYPE_1 = 0x000005d0; - cadesplugin.CADESCOM_XMLDSIG_TYPE = 0x00000000; - - 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.XmlDsigGost3411Url2012256 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-256"; - cadesplugin.XmlDsigGost3410Url2012256 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-256"; - cadesplugin.XmlDsigGost3411Url2012512 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34112012-512"; - cadesplugin.XmlDsigGost3410Url2012512 = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102012-gostr34112012-512"; - - cadesplugin.CADESCOM_CADES_DEFAULT = 0; - cadesplugin.CADESCOM_CADES_BES = 1; - cadesplugin.CADESCOM_CADES_T = 0x5; - cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d; - cadesplugin.CADESCOM_PKCS7_TYPE = 0xffff; - - cadesplugin.CADESCOM_ENCODE_BASE64 = 0; - cadesplugin.CADESCOM_ENCODE_BINARY = 1; - cadesplugin.CADESCOM_ENCODE_ANY = -1; - - cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_CHAIN_EXCEPT_ROOT = 0; - cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_WHOLE_CHAIN = 1; - cadesplugin.CAPICOM_CERTIFICATE_INCLUDE_END_ENTITY_ONLY = 2; - - cadesplugin.CAPICOM_CERT_INFO_SUBJECT_SIMPLE_NAME = 0; - cadesplugin.CAPICOM_CERT_INFO_ISSUER_SIMPLE_NAME = 1; - - cadesplugin.CAPICOM_CERTIFICATE_FIND_SHA1_HASH = 0; - cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1; - cadesplugin.CAPICOM_CERTIFICATE_FIND_ISSUER_NAME = 2; - cadesplugin.CAPICOM_CERTIFICATE_FIND_ROOT_NAME = 3; - cadesplugin.CAPICOM_CERTIFICATE_FIND_TEMPLATE_NAME = 4; - cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENSION = 5; - cadesplugin.CAPICOM_CERTIFICATE_FIND_EXTENDED_PROPERTY = 6; - cadesplugin.CAPICOM_CERTIFICATE_FIND_APPLICATION_POLICY = 7; - cadesplugin.CAPICOM_CERTIFICATE_FIND_CERTIFICATE_POLICY = 8; - cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_VALID = 9; - cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_NOT_YET_VALID = 10; - cadesplugin.CAPICOM_CERTIFICATE_FIND_TIME_EXPIRED = 11; - cadesplugin.CAPICOM_CERTIFICATE_FIND_KEY_USAGE = 12; - - cadesplugin.CAPICOM_DIGITAL_SIGNATURE_KEY_USAGE = 128; - - cadesplugin.CAPICOM_PROPID_ENHKEY_USAGE = 9; - - cadesplugin.CAPICOM_OID_OTHER = 0; - cadesplugin.CAPICOM_OID_KEY_USAGE_EXTENSION = 10; - - cadesplugin.CAPICOM_EKU_CLIENT_AUTH = 2; - cadesplugin.CAPICOM_EKU_SMARTCARD_LOGON = 5; - cadesplugin.CAPICOM_EKU_OTHER = 0; - - cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0; - cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; - cadesplugin.CAPICOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; - cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_SIGNING_TIME = 0; - cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; - cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; - cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_MACHINE_INFO = 0x100; - cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1; - - cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0; - cadesplugin.CADESCOM_BASE64_TO_BINARY = 1; - - cadesplugin.CADESCOM_DISPLAY_DATA_NONE = 0; - cadesplugin.CADESCOM_DISPLAY_DATA_CONTENT = 1; - cadesplugin.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2; - - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25; - - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA1 = 0; - cadesplugin.CADESCOM_HASH_ALGORITHM_MD2 = 1; - cadesplugin.CADESCOM_HASH_ALGORITHM_MD4 = 2; - cadesplugin.CADESCOM_HASH_ALGORITHM_MD5 = 3; - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_256 = 4; - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_384 = 5; - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_512 = 6; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_HMAC = 110; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256_HMAC = 111; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512_HMAC = 112; - - cadesplugin.LOG_LEVEL_DEBUG = 4; - cadesplugin.LOG_LEVEL_INFO = 2; - cadesplugin.LOG_LEVEL_ERROR = 1; - - cadesplugin.CADESCOM_AllowNone = 0; - cadesplugin.CADESCOM_AllowNoOutstandingRequest = 0x1; - cadesplugin.CADESCOM_AllowUntrustedCertificate = 0x2; - cadesplugin.CADESCOM_AllowUntrustedRoot = 0x4; - cadesplugin.CADESCOM_SkipInstallToStore = 0x10000000; - cadesplugin.CADESCOM_InstallCertChainToContainer = 0x20000000; - cadesplugin.CADESCOM_UseContainerStore = 0x40000000; - - cadesplugin.ENABLE_CARRIER_TYPE_CSP = 0x01; - cadesplugin.ENABLE_CARRIER_TYPE_FKC_NO_SM = 0x02; - cadesplugin.ENABLE_CARRIER_TYPE_FKC_SM = 0x04; - cadesplugin.ENABLE_ANY_CARRIER_TYPE = 0x07; - - cadesplugin.DISABLE_EVERY_CARRIER_OPERATION = 0x00; - cadesplugin.ENABLE_CARRIER_OPEN_ENUM = 0x01; - cadesplugin.ENABLE_CARRIER_CREATE = 0x02; - cadesplugin.ENABLE_ANY_OPERATION = 0x03; - - cadesplugin.CADESCOM_PRODUCT_CSP = 0; - cadesplugin.CADESCOM_PRODUCT_OCSP = 1; - cadesplugin.CADESCOM_PRODUCT_TSP = 2; - - cadesplugin.MEDIA_TYPE_REGISTRY = 0x00000001; - cadesplugin.MEDIA_TYPE_HDIMAGE = 0x00000002; - cadesplugin.MEDIA_TYPE_CLOUD = 0x00000004; - cadesplugin.MEDIA_TYPE_SCARD = 0x00000008; - - cadesplugin.XCN_CRYPT_STRING_BASE64HEADER = 0; - cadesplugin.AT_KEYEXCHANGE = 1; - cadesplugin.AT_SIGNATURE = 2; - - cadesplugin.CARRIER_FLAG_REMOVABLE = 1; - cadesplugin.CARRIER_FLAG_UNIQUE = 2; - cadesplugin.CARRIER_FLAG_PROTECTED = 4; - cadesplugin.CARRIER_FLAG_FUNCTIONAL_CARRIER = 8; - cadesplugin.CARRIER_FLAG_SECURE_MESSAGING = 16; - cadesplugin.CARRIER_FLAG_ABLE_VISUALISE_SIGNATURE = 64; - cadesplugin.CARRIER_FLAG_VIRTUAL = 128; - } - - function async_spawn(generatorFunc) { - function continuer(verb, arg) { - var result; - try { - result = generator[verb](arg); - } catch (err) { - return Promise.reject(err); - } - if (result.done) { - return result.value; - } else { - return Promise.resolve(result.value).then(onFulfilled, onRejected); - } - } - var generator = generatorFunc(Array.prototype.slice.call(arguments, 1)); - var onFulfilled = continuer.bind(continuer, "next"); - var onRejected = continuer.bind(continuer, "throw"); - return onFulfilled(); - } - - function isIE() { - // var retVal = (("Microsoft Internet Explorer" == navigator.appName) || // IE < 11 - // navigator.userAgent.match(/Trident\/./i)); // IE 11 - return (browserSpecs.name === 'IE' || browserSpecs.name === 'MSIE'); - } - - function isIOS() { - return (navigator.userAgent.match(/ipod/i) || - navigator.userAgent.match(/ipad/i) || - navigator.userAgent.match(/iphone/i)); - } - - function isNativeMessageSupported() - { - // В IE работаем через NPAPI - if(isIE()) - return false; - // В Edge работаем через NativeMessage - if (browserSpecs.name === 'Edg') { - return true; - } - if (browserSpecs.name === 'YaBrowser') { - isYandex = true; - return true; - } - // В Chrome, Firefox, Safari и Opera работаем через асинхронную версию в зависимости от версии - if(browserSpecs.name === 'Opera') { - isOpera = true; - if(browserSpecs.version >= 33){ - return true; - } - else{ - return false; - } - } - if(browserSpecs.name === 'Firefox') { - isFireFox = true; - if(browserSpecs.version >= 52){ - return true; - } - else{ - return false; - } - } - if(browserSpecs.name === 'Chrome') { - if(browserSpecs.version >= 42){ - return true; - } - else{ - return false; - } - } - //В Сафари начиная с 12 версии нет NPAPI - if(browserSpecs.name === 'Safari') { - isSafari = true; - if(browserSpecs.version >= 12) { - return true; - } else { - return false; - } - } - } - - // Функция активации объектов КриптоПро ЭЦП Browser plug-in - function CreateObject(name) { - if (isIOS()) { - // На iOS для создания объектов используется функция - // call_ru_cryptopro_npcades_10_native_bridge, определенная в IOS_npcades_supp.js - return call_ru_cryptopro_npcades_10_native_bridge("CreateObject", [name]); - } - if (isIE()) { - // В Internet Explorer создаются COM-объекты - if (name.match(/X509Enrollment/i)) { - try { - // Объекты CertEnroll пробуем создавать через нашу фабрику, - // если не получилось то через CX509EnrollmentWebClassFactory - var objCertEnrollClassFactory = document.getElementById("webClassFactory"); - return objCertEnrollClassFactory.CreateObject(name); - } - catch (e) { - try { - var objWebClassFactory = document.getElementById("certEnrollClassFactory"); - return objWebClassFactory.CreateObject(name); - } - catch (err) { - throw ("Для создания обьектов X509Enrollment следует настроить веб-узел на использование проверки подлинности по протоколу HTTPS"); - } - } - } - // Объекты CAPICOM и CAdESCOM создаются через CAdESCOM.WebClassFactory - try { - var objWebClassFactory = document.getElementById("webClassFactory"); - return objWebClassFactory.CreateObject(name); - } - catch (e) { - // Для версий плагина ниже 2.0.12538 - return new ActiveXObject(name); - } - } - // создаются объекты NPAPI - return pluginObject.CreateObject(name); - } - - function decimalToHexString(number) { - if (number < 0) { - number = 0xFFFFFFFF + number + 1; - } - - return number.toString(16).toUpperCase(); - } - - function GetMessageFromException(e) { - var err = e.message; - if (!err) { - err = e; - } else if (e.number) { - err += " (0x" + decimalToHexString(e.number) + ")"; - } - return err; - } - - function getLastError(exception) { - if(isNativeMessageSupported() || isIE() || isIOS() ) { - return GetMessageFromException(exception); - } - - try { - return pluginObject.getLastError(); - } catch(e) { - return GetMessageFromException(exception); - } - } - - // Функция для удаления созданных объектов - function ReleasePluginObjects() { - return cpcsp_chrome_nmcades.ReleasePluginObjects(); - } - - // Функция активации асинхронных объектов КриптоПро ЭЦП Browser plug-in - function CreateObjectAsync(name) { - return pluginObject.CreateObjectAsync(name); - } - - //Функции для IOS - var ru_cryptopro_npcades_10_native_bridge = { - callbacksCount : 1, - callbacks : {}, - - // Automatically called by native layer when a result is available - resultForCallback : function resultForCallback(callbackId, resultArray) { - var callback = ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId]; - if (!callback) return; - callback.apply(null,resultArray); - }, - - // Use this in javascript to request native objective-c code - // functionName : string (I think the name is explicit :p) - // args : array of arguments - // callback : function with n-arguments that is going to be called when the native code returned - call : function call(functionName, args, callback) { - var hasCallback = callback && typeof callback === "function"; - var callbackId = hasCallback ? ru_cryptopro_npcades_10_native_bridge.callbacksCount++ : 0; - - if (hasCallback) - ru_cryptopro_npcades_10_native_bridge.callbacks[callbackId] = callback; - - var iframe = document.createElement("IFRAME"); - var arrObjs = new Array("_CPNP_handle"); - try{ - iframe.setAttribute("src", "cpnp-js-call:" + functionName + ":" + callbackId+ ":" + encodeURIComponent(JSON.stringify(args, arrObjs))); - } catch(e){ - alert(e); - } - document.documentElement.appendChild(iframe); - iframe.parentNode.removeChild(iframe); - iframe = null; - } - }; - - function call_ru_cryptopro_npcades_10_native_bridge(functionName, array){ - var tmpobj; - var ex; - ru_cryptopro_npcades_10_native_bridge.call(functionName, array, function(e, response){ - ex = e; - var str='tmpobj='+response; - eval(str); - if (typeof (tmpobj) === "string"){ - tmpobj = tmpobj.replace(/\\\n/gm, "\n"); - tmpobj = tmpobj.replace(/\\\r/gm, "\r"); - } - }); - if(ex) - throw ex; - return tmpobj; - } - - function show_firefox_missing_extension_dialog() - { - if (!window.cadesplugin_skip_extension_install) - { - var ovr = document.createElement('div'); - ovr.id = "cadesplugin_ovr"; - ovr.style = "visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)"; - ovr.innerHTML = "
" + - "" + - "

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

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

" + - "
"; - document.getElementsByTagName("Body")[0].appendChild(ovr); - document.getElementById("cadesplugin_close_install").addEventListener('click',function() - { - plugin_loaded_error("Плагин недоступен"); - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - }); - - ovr.addEventListener('click',function() - { - plugin_loaded_error("Плагин недоступен"); - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - }); - ovr.style.visibility="visible"; - } - } - function firefox_or_safari_nmcades_onload() { - if (window.cadesplugin_extension_loaded_callback) - window.cadesplugin_extension_loaded_callback(); - isFireFoxExtensionLoaded = true; - cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error); - } - - function nmcades_api_onload() { - if (!isIE() && !isFireFox && !isSafari) { - if (window.cadesplugin_extension_loaded_callback) - window.cadesplugin_extension_loaded_callback(); - } - window.postMessage("cadesplugin_echo_request", "*"); - window.addEventListener("message", function (event){ - if (typeof(event.data) !== "string" || !event.data.match("cadesplugin_loaded")) - return; - if (cadesplugin_loaded_event_recieved) - return; - if(isFireFox || isSafari) - { - // Для Firefox, Сафари вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js - var url = event.data.substring(event.data.indexOf("url:") + 4); - if (!url.match("^(moz|safari)-extension://[a-zA-Z0-9/_-]+/nmcades_plugin_api.js$")) - { - cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, "Bad url \"" + url + "\" for load CryptoPro Extension for CAdES Browser plug-in"); - plugin_loaded_error(); - return; - } - var fileref = document.createElement('script'); - fileref.setAttribute("type", "text/javascript"); - fileref.setAttribute("src", url); - fileref.onerror = plugin_loaded_error; - fileref.onload = firefox_or_safari_nmcades_onload; - document.getElementsByTagName("head")[0].appendChild(fileref); - }else { - cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error); - } - cadesplugin_loaded_event_recieved = true; - }, false); - } - - //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge, Safari - function load_extension() - { - if(isFireFox || isSafari){ - // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера. - nmcades_api_onload(); - } else { - // в асинхронном варианте для Yandex и Opera подключаем расширение из Opera store. - if (isOpera || isYandex) { - var fileref = document.createElement('script'); - fileref.setAttribute("type", "text/javascript"); - fileref.setAttribute("src", "chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js"); - fileref.onerror = plugin_loaded_error; - fileref.onload = nmcades_api_onload; - document.getElementsByTagName("head")[0].appendChild(fileref); - } else { - // для Chrome, Chromium, Chromium Edge расширение из Chrome store - var fileref = document.createElement('script'); - fileref.setAttribute("type", "text/javascript"); - fileref.setAttribute("src", "chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js"); - fileref.onerror = plugin_loaded_error; - fileref.onload = nmcades_api_onload; - document.getElementsByTagName("head")[0].appendChild(fileref); - } - } - } - - //Загружаем плагин для NPAPI - function load_npapi_plugin() - { - var elem = document.createElement('object'); - elem.setAttribute("id", "cadesplugin_object"); - elem.setAttribute("type", "application/x-cades"); - elem.setAttribute("style", "visibility: hidden"); - document.getElementsByTagName("body")[0].appendChild(elem); - pluginObject = document.getElementById("cadesplugin_object"); - if(isIE()) - { - var elem1 = document.createElement('object'); - elem1.setAttribute("id", "certEnrollClassFactory"); - elem1.setAttribute("classid", "clsid:884e2049-217d-11da-b2a4-000e7bbb2b09"); - elem1.setAttribute("style", "visibility: hidden"); - document.getElementsByTagName("body")[0].appendChild(elem1); - var elem2 = document.createElement('object'); - elem2.setAttribute("id", "webClassFactory"); - elem2.setAttribute("classid", "clsid:B04C8637-10BD-484E-B0DA-B8A039F60024"); - elem2.setAttribute("style", "visibility: hidden"); - document.getElementsByTagName("body")[0].appendChild(elem2); - } - } - - //Отправляем событие что все ок. - function plugin_loaded() - { - plugin_resolved = 1; - if(canPromise) - { - plugin_resolve(); - }else { - window.postMessage("cadesplugin_loaded", "*"); - } - } - - //Отправляем событие что сломались. - function plugin_loaded_error(msg) - { - if(typeof(msg) === 'undefined' || typeof(msg) === 'object') - msg = "Плагин недоступен"; - plugin_resolved = 1; - if(canPromise) - { - plugin_reject(msg); - } else { - window.postMessage("cadesplugin_load_error", "*"); - } - } - - //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку - function check_load_timeout() - { - if(plugin_resolved === 1) - return; - if(isFireFox) - { - if (!isFireFoxExtensionLoaded) - show_firefox_missing_extension_dialog(); - } - plugin_resolved = 1; - if(canPromise) - { - plugin_reject("Истекло время ожидания загрузки плагина"); - } else { - window.postMessage("cadesplugin_load_error", "*"); - } - - } - - //Вспомогательная функция для NPAPI - function createPromise(arg) - { - return new Promise(arg); - } - - function check_npapi_plugin (){ - try { - var oAbout = CreateObject("CAdESCOM.About"); - plugin_loaded(); - } - catch (err) { - document.getElementById("cadesplugin_object").style.display = 'none'; - // Объект создать не удалось, проверим, установлен ли - // вообще плагин. Такая возможность есть не во всех браузерах - var mimetype = navigator.mimeTypes["application/x-cades"]; - if (mimetype) { - var plugin = mimetype.enabledPlugin; - if (plugin) { - plugin_loaded_error("Плагин загружен, но не создаются обьекты"); - }else - { - plugin_loaded_error("Ошибка при загрузке плагина"); - } - }else - { - plugin_loaded_error("Плагин недоступен"); - } - } - } - - //Проверяем работает ли плагин - function check_plugin_working() - { - var div = document.createElement("div"); - div.innerHTML = ""; - var isIeLessThan9 = (div.getElementsByTagName("i").length === 1); - if (isIeLessThan9) { - plugin_loaded_error("Internet Explorer версии 8 и ниже не поддерживается"); - return; - } - - if(isNativeMessageSupported()) - { - load_extension(); - }else if(!canPromise) { - window.addEventListener("message", function (event){ - if (event.data !== "cadesplugin_echo_request") - return; - load_npapi_plugin(); - check_npapi_plugin(); - }, - false); - }else - { - if(document.readyState === "complete"){ - load_npapi_plugin(); - check_npapi_plugin(); - } else { - window.addEventListener("load", function (event) { - load_npapi_plugin(); - check_npapi_plugin(); - }, false); - } - } - } - - function set_pluginObject(obj) - { - pluginObject = obj; - } - - function is_capilite_enabled() - { - if ((typeof (cadesplugin.EnableInternalCSP) !== 'undefined') && cadesplugin.EnableInternalCSP) - return true; - return false; - }; - - function set_load_timeout() - { - if (window.cadesplugin_load_timeout) { - setTimeout(check_load_timeout, window.cadesplugin_load_timeout); - } - else { - setTimeout(check_load_timeout, 20000); - } - } - - var onVisibilityChange = function (event) { - if (document.hidden === false) { - document.removeEventListener("visibilitychange", onVisibilityChange); - set_load_timeout(); - check_plugin_working(); - } - }; - - //Export - cadesplugin.JSModuleVersion = "2.3.5"; - cadesplugin.async_spawn = async_spawn; - cadesplugin.set = set_pluginObject; - cadesplugin.set_log_level = set_log_level; - cadesplugin.get_extension_version = get_extension_version; - cadesplugin.getLastError = getLastError; - cadesplugin.is_capilite_enabled = is_capilite_enabled; - - if(isNativeMessageSupported()) - { - cadesplugin.CreateObjectAsync = CreateObjectAsync; - cadesplugin.ReleasePluginObjects = ReleasePluginObjects; - } - - if(!isNativeMessageSupported()) - { - cadesplugin.CreateObject = CreateObject; - } - - set_constantValues(); - - cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR; - window.cadesplugin = cadesplugin; - if (isSafari && document.hidden) { - document.addEventListener("visibilitychange", onVisibilityChange); - return; - } - set_load_timeout(); - check_plugin_working(); -}());