From 05bf49a03c7768788c508d4c79022e524ebd0536 Mon Sep 17 00:00:00 2001 From: Vitalii Goma Date: Fri, 21 Apr 2017 10:47:03 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D1=80=D0=B8=D0=B3=D0=B8=D0=BD=D0=B0?= =?UTF-8?q?=D0=BB=D1=8C=D0=BD=D1=8B=D0=B9=20=D1=84=D0=B0=D0=B9=D0=BB=20cad?= =?UTF-8?q?esplugin=5Fapi.js=20=D0=B2=D1=8B=D0=BD=D0=B5=D1=81=D0=B5=D0=BD?= =?UTF-8?q?=20=D0=BE=D1=82=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD=D0=BE=20=D0=B8=20?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=20=D0=BD=D0=B5?= =?UTF-8?q?=D1=82=D1=80=D0=BE=D0=BD=D1=83=D1=82=D1=8B=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/crypto-pro.js | 1199 +++++++++++---------- dist/crypto-pro.js.map | 2 +- src/index.js | 2 +- src/original_src/cadesplugin_api_2.0.2.js | 556 ---------- src/original_src/cadesplugin_api_2.0.3.js | 593 ---------- src/original_src/cadesplugin_api_2.1.0.js | 620 ----------- src/cades.js => vendor/cadesplugin_api.js | 0 7 files changed, 604 insertions(+), 2368 deletions(-) delete mode 100644 src/original_src/cadesplugin_api_2.0.2.js delete mode 100644 src/original_src/cadesplugin_api_2.0.3.js delete mode 100644 src/original_src/cadesplugin_api_2.1.0.js rename src/cades.js => vendor/cadesplugin_api.js (100%) diff --git a/dist/crypto-pro.js b/dist/crypto-pro.js index f780fd2..7a1e3c4 100644 --- a/dist/crypto-pro.js +++ b/dist/crypto-pro.js @@ -110,7 +110,7 @@ var CryptoPro = global.allow_firefox_cadesplugin_async = browserInfo.firefox && browserInfo.version >= 52; - __webpack_require__(1); + __webpack_require__(10); cadesplugin = global.cadesplugin; @@ -207,7 +207,607 @@ var CryptoPro = }; /***/ }, -/* 1 */ +/* 1 */, +/* 2 */, +/* 3 */, +/* 4 */ +/***/ function(module, exports, __webpack_require__) { + + /*! + * Bowser - a browser detector + * https://github.com/ded/bowser + * MIT License | (c) Dustin Diaz 2015 + */ + + !function (name, definition) { + if (typeof module != 'undefined' && module.exports) module.exports = definition() + else if (true) __webpack_require__(5)(name, definition) + else this[name] = definition() + }('bowser', function () { + /** + * See useragents.js for examples of navigator.userAgent + */ + + var t = true + + function detect(ua) { + + function getFirstMatch(regex) { + var match = ua.match(regex); + return (match && match.length > 1 && match[1]) || ''; + } + + function getSecondMatch(regex) { + var match = ua.match(regex); + return (match && match.length > 1 && match[2]) || ''; + } + + var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase() + , likeAndroid = /like android/i.test(ua) + , android = !likeAndroid && /android/i.test(ua) + , nexusMobile = /nexus\s*[0-6]\s*/i.test(ua) + , nexusTablet = !nexusMobile && /nexus\s*[0-9]+/i.test(ua) + , chromeos = /CrOS/.test(ua) + , silk = /silk/i.test(ua) + , sailfish = /sailfish/i.test(ua) + , tizen = /tizen/i.test(ua) + , webos = /(web|hpw)os/i.test(ua) + , windowsphone = /windows phone/i.test(ua) + , samsungBrowser = /SamsungBrowser/i.test(ua) + , windows = !windowsphone && /windows/i.test(ua) + , mac = !iosdevice && !silk && /macintosh/i.test(ua) + , linux = !android && !sailfish && !tizen && !webos && /linux/i.test(ua) + , edgeVersion = getFirstMatch(/edge\/(\d+(\.\d+)?)/i) + , versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i) + , tablet = /tablet/i.test(ua) + , mobile = !tablet && /[^-]mobi/i.test(ua) + , xbox = /xbox/i.test(ua) + , result + + if (/opera/i.test(ua)) { + // an old Opera + result = { + name: 'Opera' + , opera: t + , version: versionIdentifier || getFirstMatch(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i) + } + } else if (/opr|opios/i.test(ua)) { + // a new Opera + result = { + name: 'Opera' + , opera: t + , version: getFirstMatch(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i) || versionIdentifier + } + } + else if (/SamsungBrowser/i.test(ua)) { + result = { + name: 'Samsung Internet for Android' + , samsungBrowser: t + , version: versionIdentifier || getFirstMatch(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i) + } + } + else if (/coast/i.test(ua)) { + result = { + name: 'Opera Coast' + , coast: t + , version: versionIdentifier || getFirstMatch(/(?:coast)[\s\/](\d+(\.\d+)?)/i) + } + } + else if (/yabrowser/i.test(ua)) { + result = { + name: 'Yandex Browser' + , yandexbrowser: t + , version: versionIdentifier || getFirstMatch(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i) + } + } + else if (/ucbrowser/i.test(ua)) { + result = { + name: 'UC Browser' + , ucbrowser: t + , version: getFirstMatch(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i) + } + } + else if (/mxios/i.test(ua)) { + result = { + name: 'Maxthon' + , maxthon: t + , version: getFirstMatch(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i) + } + } + else if (/epiphany/i.test(ua)) { + result = { + name: 'Epiphany' + , epiphany: t + , version: getFirstMatch(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i) + } + } + else if (/puffin/i.test(ua)) { + result = { + name: 'Puffin' + , puffin: t + , version: getFirstMatch(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i) + } + } + else if (/sleipnir/i.test(ua)) { + result = { + name: 'Sleipnir' + , sleipnir: t + , version: getFirstMatch(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i) + } + } + else if (/k-meleon/i.test(ua)) { + result = { + name: 'K-Meleon' + , kMeleon: t + , version: getFirstMatch(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i) + } + } + else if (windowsphone) { + result = { + name: 'Windows Phone' + , windowsphone: t + } + if (edgeVersion) { + result.msedge = t + result.version = edgeVersion + } + else { + result.msie = t + result.version = getFirstMatch(/iemobile\/(\d+(\.\d+)?)/i) + } + } + else if (/msie|trident/i.test(ua)) { + result = { + name: 'Internet Explorer' + , msie: t + , version: getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i) + } + } else if (chromeos) { + result = { + name: 'Chrome' + , chromeos: t + , chromeBook: t + , chrome: t + , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i) + } + } else if (/chrome.+? edge/i.test(ua)) { + result = { + name: 'Microsoft Edge' + , msedge: t + , version: edgeVersion + } + } + else if (/vivaldi/i.test(ua)) { + result = { + name: 'Vivaldi' + , vivaldi: t + , version: getFirstMatch(/vivaldi\/(\d+(\.\d+)?)/i) || versionIdentifier + } + } + else if (sailfish) { + result = { + name: 'Sailfish' + , sailfish: t + , version: getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i) + } + } + else if (/seamonkey\//i.test(ua)) { + result = { + name: 'SeaMonkey' + , seamonkey: t + , version: getFirstMatch(/seamonkey\/(\d+(\.\d+)?)/i) + } + } + else if (/firefox|iceweasel|fxios/i.test(ua)) { + result = { + name: 'Firefox' + , firefox: t + , version: getFirstMatch(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i) + } + if (/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) { + result.firefoxos = t + } + } + else if (silk) { + result = { + name: 'Amazon Silk' + , silk: t + , version : getFirstMatch(/silk\/(\d+(\.\d+)?)/i) + } + } + else if (/phantom/i.test(ua)) { + result = { + name: 'PhantomJS' + , phantom: t + , version: getFirstMatch(/phantomjs\/(\d+(\.\d+)?)/i) + } + } + else if (/slimerjs/i.test(ua)) { + result = { + name: 'SlimerJS' + , slimer: t + , version: getFirstMatch(/slimerjs\/(\d+(\.\d+)?)/i) + } + } + else if (/blackberry|\bbb\d+/i.test(ua) || /rim\stablet/i.test(ua)) { + result = { + name: 'BlackBerry' + , blackberry: t + , version: versionIdentifier || getFirstMatch(/blackberry[\d]+\/(\d+(\.\d+)?)/i) + } + } + else if (webos) { + result = { + name: 'WebOS' + , webos: t + , version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i) + }; + /touchpad\//i.test(ua) && (result.touchpad = t) + } + else if (/bada/i.test(ua)) { + result = { + name: 'Bada' + , bada: t + , version: getFirstMatch(/dolfin\/(\d+(\.\d+)?)/i) + }; + } + else if (tizen) { + result = { + name: 'Tizen' + , tizen: t + , version: getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i) || versionIdentifier + }; + } + else if (/qupzilla/i.test(ua)) { + result = { + name: 'QupZilla' + , qupzilla: t + , version: getFirstMatch(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i) || versionIdentifier + } + } + else if (/chromium/i.test(ua)) { + result = { + name: 'Chromium' + , chromium: t + , version: getFirstMatch(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i) || versionIdentifier + } + } + else if (/chrome|crios|crmo/i.test(ua)) { + result = { + name: 'Chrome' + , chrome: t + , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i) + } + } + else if (android) { + result = { + name: 'Android' + , version: versionIdentifier + } + } + else if (/safari|applewebkit/i.test(ua)) { + result = { + name: 'Safari' + , safari: t + } + if (versionIdentifier) { + result.version = versionIdentifier + } + } + else if (iosdevice) { + result = { + name : iosdevice == 'iphone' ? 'iPhone' : iosdevice == 'ipad' ? 'iPad' : 'iPod' + } + // WTF: version is not part of user agent in web apps + if (versionIdentifier) { + result.version = versionIdentifier + } + } + else if(/googlebot/i.test(ua)) { + result = { + name: 'Googlebot' + , googlebot: t + , version: getFirstMatch(/googlebot\/(\d+(\.\d+))/i) || versionIdentifier + } + } + else { + result = { + name: getFirstMatch(/^(.*)\/(.*) /), + version: getSecondMatch(/^(.*)\/(.*) /) + }; + } + + // set webkit or gecko flag for browsers based on these engines + if (!result.msedge && /(apple)?webkit/i.test(ua)) { + if (/(apple)?webkit\/537\.36/i.test(ua)) { + result.name = result.name || "Blink" + result.blink = t + } else { + result.name = result.name || "Webkit" + result.webkit = t + } + if (!result.version && versionIdentifier) { + result.version = versionIdentifier + } + } else if (!result.opera && /gecko\//i.test(ua)) { + result.name = result.name || "Gecko" + result.gecko = t + result.version = result.version || getFirstMatch(/gecko\/(\d+(\.\d+)?)/i) + } + + // set OS flags for platforms that have multiple browsers + if (!result.windowsphone && !result.msedge && (android || result.silk)) { + result.android = t + } else if (!result.windowsphone && !result.msedge && iosdevice) { + result[iosdevice] = t + result.ios = t + } else if (mac) { + result.mac = t + } else if (xbox) { + result.xbox = t + } else if (windows) { + result.windows = t + } else if (linux) { + result.linux = t + } + + // OS version extraction + var osVersion = ''; + if (result.windowsphone) { + osVersion = getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i); + } else if (iosdevice) { + osVersion = getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i); + osVersion = osVersion.replace(/[_\s]/g, '.'); + } else if (android) { + osVersion = getFirstMatch(/android[ \/-](\d+(\.\d+)*)/i); + } else if (result.webos) { + osVersion = getFirstMatch(/(?:web|hpw)os\/(\d+(\.\d+)*)/i); + } else if (result.blackberry) { + osVersion = getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i); + } else if (result.bada) { + osVersion = getFirstMatch(/bada\/(\d+(\.\d+)*)/i); + } else if (result.tizen) { + osVersion = getFirstMatch(/tizen[\/\s](\d+(\.\d+)*)/i); + } + if (osVersion) { + result.osversion = osVersion; + } + + // device type extraction + var osMajorVersion = osVersion.split('.')[0]; + if ( + tablet + || nexusTablet + || iosdevice == 'ipad' + || (android && (osMajorVersion == 3 || (osMajorVersion >= 4 && !mobile))) + || result.silk + ) { + result.tablet = t + } else if ( + mobile + || iosdevice == 'iphone' + || iosdevice == 'ipod' + || android + || nexusMobile + || result.blackberry + || result.webos + || result.bada + ) { + result.mobile = t + } + + // Graded Browser Support + // http://developer.yahoo.com/yui/articles/gbs + if (result.msedge || + (result.msie && result.version >= 10) || + (result.yandexbrowser && result.version >= 15) || + (result.vivaldi && result.version >= 1.0) || + (result.chrome && result.version >= 20) || + (result.samsungBrowser && result.version >= 4) || + (result.firefox && result.version >= 20.0) || + (result.safari && result.version >= 6) || + (result.opera && result.version >= 10.0) || + (result.ios && result.osversion && result.osversion.split(".")[0] >= 6) || + (result.blackberry && result.version >= 10.1) + || (result.chromium && result.version >= 20) + ) { + result.a = t; + } + else if ((result.msie && result.version < 10) || + (result.chrome && result.version < 20) || + (result.firefox && result.version < 20.0) || + (result.safari && result.version < 6) || + (result.opera && result.version < 10.0) || + (result.ios && result.osversion && result.osversion.split(".")[0] < 6) + || (result.chromium && result.version < 20) + ) { + result.c = t + } else result.x = t + + return result + } + + var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent || '' : '') + + bowser.test = function (browserList) { + for (var i = 0; i < browserList.length; ++i) { + var browserItem = browserList[i]; + if (typeof browserItem=== 'string') { + if (browserItem in bowser) { + return true; + } + } + } + return false; + } + + /** + * Get version precisions count + * + * @example + * getVersionPrecision("1.10.3") // 3 + * + * @param {string} version + * @return {number} + */ + function getVersionPrecision(version) { + return version.split(".").length; + } + + /** + * Array::map polyfill + * + * @param {Array} arr + * @param {Function} iterator + * @return {Array} + */ + function map(arr, iterator) { + var result = [], i; + if (Array.prototype.map) { + return Array.prototype.map.call(arr, iterator); + } + for (i = 0; i < arr.length; i++) { + result.push(iterator(arr[i])); + } + return result; + } + + /** + * Calculate browser version weight + * + * @example + * compareVersions(['1.10.2.1', '1.8.2.1.90']) // 1 + * compareVersions(['1.010.2.1', '1.09.2.1.90']); // 1 + * compareVersions(['1.10.2.1', '1.10.2.1']); // 0 + * compareVersions(['1.10.2.1', '1.0800.2']); // -1 + * + * @param {Array} versions versions to compare + * @return {Number} comparison result + */ + function compareVersions(versions) { + // 1) get common precision for both versions, for example for "10.0" and "9" it should be 2 + var precision = Math.max(getVersionPrecision(versions[0]), getVersionPrecision(versions[1])); + var chunks = map(versions, function (version) { + var delta = precision - getVersionPrecision(version); + + // 2) "9" -> "9.0" (for precision = 2) + version = version + new Array(delta + 1).join(".0"); + + // 3) "9.0" -> ["000000000"", "000000009"] + return map(version.split("."), function (chunk) { + return new Array(20 - chunk.length).join("0") + chunk; + }).reverse(); + }); + + // iterate in reverse order by reversed chunks array + while (--precision >= 0) { + // 4) compare: "000000009" > "000000010" = false (but "9" > "10" = true) + if (chunks[0][precision] > chunks[1][precision]) { + return 1; + } + else if (chunks[0][precision] === chunks[1][precision]) { + if (precision === 0) { + // all version chunks are same + return 0; + } + } + else { + return -1; + } + } + } + + /** + * Check if browser is unsupported + * + * @example + * bowser.isUnsupportedBrowser({ + * msie: "10", + * firefox: "23", + * chrome: "29", + * safari: "5.1", + * opera: "16", + * phantom: "534" + * }); + * + * @param {Object} minVersions map of minimal version to browser + * @param {Boolean} [strictMode = false] flag to return false if browser wasn't found in map + * @param {String} [ua] user agent string + * @return {Boolean} + */ + function isUnsupportedBrowser(minVersions, strictMode, ua) { + var _bowser = bowser; + + // make strictMode param optional with ua param usage + if (typeof strictMode === 'string') { + ua = strictMode; + strictMode = void(0); + } + + if (strictMode === void(0)) { + strictMode = false; + } + if (ua) { + _bowser = detect(ua); + } + + var version = "" + _bowser.version; + for (var browser in minVersions) { + if (minVersions.hasOwnProperty(browser)) { + if (_bowser[browser]) { + if (typeof minVersions[browser] !== 'string') { + throw new Error('Browser version in the minVersion map should be a string: ' + browser + ': ' + String(minVersions)); + } + + // browser version and min supported version. + return compareVersions([version, minVersions[browser]]) < 0; + } + } + } + + return strictMode; // not found + } + + /** + * Check if browser is supported + * + * @param {Object} minVersions map of minimal version to browser + * @param {Boolean} [strictMode = false] flag to return false if browser wasn't found in map + * @param {String} [ua] user agent string + * @return {Boolean} + */ + function check(minVersions, strictMode, ua) { + return !isUnsupportedBrowser(minVersions, strictMode, ua); + } + + bowser.isUnsupportedBrowser = isUnsupportedBrowser; + bowser.compareVersions = compareVersions; + bowser.check = check; + + /* + * Set our detect method to the main bowser object so we can + * reuse it to test other user agents. + * This is needed to implement future tests. + */ + bowser._detect = detect; + + return bowser + }); + + +/***/ }, +/* 5 */ +/***/ function(module, exports) { + + module.exports = function() { throw new Error("define cannot be used indirect"); }; + + +/***/ }, +/* 6 */, +/* 7 */, +/* 8 */, +/* 9 */, +/* 10 */ /***/ function(module, exports) { ;(function () { @@ -832,601 +1432,6 @@ var CryptoPro = }()); -/***/ }, -/* 2 */, -/* 3 */, -/* 4 */ -/***/ function(module, exports, __webpack_require__) { - - /*! - * Bowser - a browser detector - * https://github.com/ded/bowser - * MIT License | (c) Dustin Diaz 2015 - */ - - !function (name, definition) { - if (typeof module != 'undefined' && module.exports) module.exports = definition() - else if (true) __webpack_require__(5)(name, definition) - else this[name] = definition() - }('bowser', function () { - /** - * See useragents.js for examples of navigator.userAgent - */ - - var t = true - - function detect(ua) { - - function getFirstMatch(regex) { - var match = ua.match(regex); - return (match && match.length > 1 && match[1]) || ''; - } - - function getSecondMatch(regex) { - var match = ua.match(regex); - return (match && match.length > 1 && match[2]) || ''; - } - - var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase() - , likeAndroid = /like android/i.test(ua) - , android = !likeAndroid && /android/i.test(ua) - , nexusMobile = /nexus\s*[0-6]\s*/i.test(ua) - , nexusTablet = !nexusMobile && /nexus\s*[0-9]+/i.test(ua) - , chromeos = /CrOS/.test(ua) - , silk = /silk/i.test(ua) - , sailfish = /sailfish/i.test(ua) - , tizen = /tizen/i.test(ua) - , webos = /(web|hpw)os/i.test(ua) - , windowsphone = /windows phone/i.test(ua) - , samsungBrowser = /SamsungBrowser/i.test(ua) - , windows = !windowsphone && /windows/i.test(ua) - , mac = !iosdevice && !silk && /macintosh/i.test(ua) - , linux = !android && !sailfish && !tizen && !webos && /linux/i.test(ua) - , edgeVersion = getFirstMatch(/edge\/(\d+(\.\d+)?)/i) - , versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i) - , tablet = /tablet/i.test(ua) - , mobile = !tablet && /[^-]mobi/i.test(ua) - , xbox = /xbox/i.test(ua) - , result - - if (/opera/i.test(ua)) { - // an old Opera - result = { - name: 'Opera' - , opera: t - , version: versionIdentifier || getFirstMatch(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i) - } - } else if (/opr|opios/i.test(ua)) { - // a new Opera - result = { - name: 'Opera' - , opera: t - , version: getFirstMatch(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i) || versionIdentifier - } - } - else if (/SamsungBrowser/i.test(ua)) { - result = { - name: 'Samsung Internet for Android' - , samsungBrowser: t - , version: versionIdentifier || getFirstMatch(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i) - } - } - else if (/coast/i.test(ua)) { - result = { - name: 'Opera Coast' - , coast: t - , version: versionIdentifier || getFirstMatch(/(?:coast)[\s\/](\d+(\.\d+)?)/i) - } - } - else if (/yabrowser/i.test(ua)) { - result = { - name: 'Yandex Browser' - , yandexbrowser: t - , version: versionIdentifier || getFirstMatch(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i) - } - } - else if (/ucbrowser/i.test(ua)) { - result = { - name: 'UC Browser' - , ucbrowser: t - , version: getFirstMatch(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i) - } - } - else if (/mxios/i.test(ua)) { - result = { - name: 'Maxthon' - , maxthon: t - , version: getFirstMatch(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i) - } - } - else if (/epiphany/i.test(ua)) { - result = { - name: 'Epiphany' - , epiphany: t - , version: getFirstMatch(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i) - } - } - else if (/puffin/i.test(ua)) { - result = { - name: 'Puffin' - , puffin: t - , version: getFirstMatch(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i) - } - } - else if (/sleipnir/i.test(ua)) { - result = { - name: 'Sleipnir' - , sleipnir: t - , version: getFirstMatch(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i) - } - } - else if (/k-meleon/i.test(ua)) { - result = { - name: 'K-Meleon' - , kMeleon: t - , version: getFirstMatch(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i) - } - } - else if (windowsphone) { - result = { - name: 'Windows Phone' - , windowsphone: t - } - if (edgeVersion) { - result.msedge = t - result.version = edgeVersion - } - else { - result.msie = t - result.version = getFirstMatch(/iemobile\/(\d+(\.\d+)?)/i) - } - } - else if (/msie|trident/i.test(ua)) { - result = { - name: 'Internet Explorer' - , msie: t - , version: getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i) - } - } else if (chromeos) { - result = { - name: 'Chrome' - , chromeos: t - , chromeBook: t - , chrome: t - , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i) - } - } else if (/chrome.+? edge/i.test(ua)) { - result = { - name: 'Microsoft Edge' - , msedge: t - , version: edgeVersion - } - } - else if (/vivaldi/i.test(ua)) { - result = { - name: 'Vivaldi' - , vivaldi: t - , version: getFirstMatch(/vivaldi\/(\d+(\.\d+)?)/i) || versionIdentifier - } - } - else if (sailfish) { - result = { - name: 'Sailfish' - , sailfish: t - , version: getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i) - } - } - else if (/seamonkey\//i.test(ua)) { - result = { - name: 'SeaMonkey' - , seamonkey: t - , version: getFirstMatch(/seamonkey\/(\d+(\.\d+)?)/i) - } - } - else if (/firefox|iceweasel|fxios/i.test(ua)) { - result = { - name: 'Firefox' - , firefox: t - , version: getFirstMatch(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i) - } - if (/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) { - result.firefoxos = t - } - } - else if (silk) { - result = { - name: 'Amazon Silk' - , silk: t - , version : getFirstMatch(/silk\/(\d+(\.\d+)?)/i) - } - } - else if (/phantom/i.test(ua)) { - result = { - name: 'PhantomJS' - , phantom: t - , version: getFirstMatch(/phantomjs\/(\d+(\.\d+)?)/i) - } - } - else if (/slimerjs/i.test(ua)) { - result = { - name: 'SlimerJS' - , slimer: t - , version: getFirstMatch(/slimerjs\/(\d+(\.\d+)?)/i) - } - } - else if (/blackberry|\bbb\d+/i.test(ua) || /rim\stablet/i.test(ua)) { - result = { - name: 'BlackBerry' - , blackberry: t - , version: versionIdentifier || getFirstMatch(/blackberry[\d]+\/(\d+(\.\d+)?)/i) - } - } - else if (webos) { - result = { - name: 'WebOS' - , webos: t - , version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i) - }; - /touchpad\//i.test(ua) && (result.touchpad = t) - } - else if (/bada/i.test(ua)) { - result = { - name: 'Bada' - , bada: t - , version: getFirstMatch(/dolfin\/(\d+(\.\d+)?)/i) - }; - } - else if (tizen) { - result = { - name: 'Tizen' - , tizen: t - , version: getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i) || versionIdentifier - }; - } - else if (/qupzilla/i.test(ua)) { - result = { - name: 'QupZilla' - , qupzilla: t - , version: getFirstMatch(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i) || versionIdentifier - } - } - else if (/chromium/i.test(ua)) { - result = { - name: 'Chromium' - , chromium: t - , version: getFirstMatch(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i) || versionIdentifier - } - } - else if (/chrome|crios|crmo/i.test(ua)) { - result = { - name: 'Chrome' - , chrome: t - , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i) - } - } - else if (android) { - result = { - name: 'Android' - , version: versionIdentifier - } - } - else if (/safari|applewebkit/i.test(ua)) { - result = { - name: 'Safari' - , safari: t - } - if (versionIdentifier) { - result.version = versionIdentifier - } - } - else if (iosdevice) { - result = { - name : iosdevice == 'iphone' ? 'iPhone' : iosdevice == 'ipad' ? 'iPad' : 'iPod' - } - // WTF: version is not part of user agent in web apps - if (versionIdentifier) { - result.version = versionIdentifier - } - } - else if(/googlebot/i.test(ua)) { - result = { - name: 'Googlebot' - , googlebot: t - , version: getFirstMatch(/googlebot\/(\d+(\.\d+))/i) || versionIdentifier - } - } - else { - result = { - name: getFirstMatch(/^(.*)\/(.*) /), - version: getSecondMatch(/^(.*)\/(.*) /) - }; - } - - // set webkit or gecko flag for browsers based on these engines - if (!result.msedge && /(apple)?webkit/i.test(ua)) { - if (/(apple)?webkit\/537\.36/i.test(ua)) { - result.name = result.name || "Blink" - result.blink = t - } else { - result.name = result.name || "Webkit" - result.webkit = t - } - if (!result.version && versionIdentifier) { - result.version = versionIdentifier - } - } else if (!result.opera && /gecko\//i.test(ua)) { - result.name = result.name || "Gecko" - result.gecko = t - result.version = result.version || getFirstMatch(/gecko\/(\d+(\.\d+)?)/i) - } - - // set OS flags for platforms that have multiple browsers - if (!result.windowsphone && !result.msedge && (android || result.silk)) { - result.android = t - } else if (!result.windowsphone && !result.msedge && iosdevice) { - result[iosdevice] = t - result.ios = t - } else if (mac) { - result.mac = t - } else if (xbox) { - result.xbox = t - } else if (windows) { - result.windows = t - } else if (linux) { - result.linux = t - } - - // OS version extraction - var osVersion = ''; - if (result.windowsphone) { - osVersion = getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i); - } else if (iosdevice) { - osVersion = getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i); - osVersion = osVersion.replace(/[_\s]/g, '.'); - } else if (android) { - osVersion = getFirstMatch(/android[ \/-](\d+(\.\d+)*)/i); - } else if (result.webos) { - osVersion = getFirstMatch(/(?:web|hpw)os\/(\d+(\.\d+)*)/i); - } else if (result.blackberry) { - osVersion = getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i); - } else if (result.bada) { - osVersion = getFirstMatch(/bada\/(\d+(\.\d+)*)/i); - } else if (result.tizen) { - osVersion = getFirstMatch(/tizen[\/\s](\d+(\.\d+)*)/i); - } - if (osVersion) { - result.osversion = osVersion; - } - - // device type extraction - var osMajorVersion = osVersion.split('.')[0]; - if ( - tablet - || nexusTablet - || iosdevice == 'ipad' - || (android && (osMajorVersion == 3 || (osMajorVersion >= 4 && !mobile))) - || result.silk - ) { - result.tablet = t - } else if ( - mobile - || iosdevice == 'iphone' - || iosdevice == 'ipod' - || android - || nexusMobile - || result.blackberry - || result.webos - || result.bada - ) { - result.mobile = t - } - - // Graded Browser Support - // http://developer.yahoo.com/yui/articles/gbs - if (result.msedge || - (result.msie && result.version >= 10) || - (result.yandexbrowser && result.version >= 15) || - (result.vivaldi && result.version >= 1.0) || - (result.chrome && result.version >= 20) || - (result.samsungBrowser && result.version >= 4) || - (result.firefox && result.version >= 20.0) || - (result.safari && result.version >= 6) || - (result.opera && result.version >= 10.0) || - (result.ios && result.osversion && result.osversion.split(".")[0] >= 6) || - (result.blackberry && result.version >= 10.1) - || (result.chromium && result.version >= 20) - ) { - result.a = t; - } - else if ((result.msie && result.version < 10) || - (result.chrome && result.version < 20) || - (result.firefox && result.version < 20.0) || - (result.safari && result.version < 6) || - (result.opera && result.version < 10.0) || - (result.ios && result.osversion && result.osversion.split(".")[0] < 6) - || (result.chromium && result.version < 20) - ) { - result.c = t - } else result.x = t - - return result - } - - var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent || '' : '') - - bowser.test = function (browserList) { - for (var i = 0; i < browserList.length; ++i) { - var browserItem = browserList[i]; - if (typeof browserItem=== 'string') { - if (browserItem in bowser) { - return true; - } - } - } - return false; - } - - /** - * Get version precisions count - * - * @example - * getVersionPrecision("1.10.3") // 3 - * - * @param {string} version - * @return {number} - */ - function getVersionPrecision(version) { - return version.split(".").length; - } - - /** - * Array::map polyfill - * - * @param {Array} arr - * @param {Function} iterator - * @return {Array} - */ - function map(arr, iterator) { - var result = [], i; - if (Array.prototype.map) { - return Array.prototype.map.call(arr, iterator); - } - for (i = 0; i < arr.length; i++) { - result.push(iterator(arr[i])); - } - return result; - } - - /** - * Calculate browser version weight - * - * @example - * compareVersions(['1.10.2.1', '1.8.2.1.90']) // 1 - * compareVersions(['1.010.2.1', '1.09.2.1.90']); // 1 - * compareVersions(['1.10.2.1', '1.10.2.1']); // 0 - * compareVersions(['1.10.2.1', '1.0800.2']); // -1 - * - * @param {Array} versions versions to compare - * @return {Number} comparison result - */ - function compareVersions(versions) { - // 1) get common precision for both versions, for example for "10.0" and "9" it should be 2 - var precision = Math.max(getVersionPrecision(versions[0]), getVersionPrecision(versions[1])); - var chunks = map(versions, function (version) { - var delta = precision - getVersionPrecision(version); - - // 2) "9" -> "9.0" (for precision = 2) - version = version + new Array(delta + 1).join(".0"); - - // 3) "9.0" -> ["000000000"", "000000009"] - return map(version.split("."), function (chunk) { - return new Array(20 - chunk.length).join("0") + chunk; - }).reverse(); - }); - - // iterate in reverse order by reversed chunks array - while (--precision >= 0) { - // 4) compare: "000000009" > "000000010" = false (but "9" > "10" = true) - if (chunks[0][precision] > chunks[1][precision]) { - return 1; - } - else if (chunks[0][precision] === chunks[1][precision]) { - if (precision === 0) { - // all version chunks are same - return 0; - } - } - else { - return -1; - } - } - } - - /** - * Check if browser is unsupported - * - * @example - * bowser.isUnsupportedBrowser({ - * msie: "10", - * firefox: "23", - * chrome: "29", - * safari: "5.1", - * opera: "16", - * phantom: "534" - * }); - * - * @param {Object} minVersions map of minimal version to browser - * @param {Boolean} [strictMode = false] flag to return false if browser wasn't found in map - * @param {String} [ua] user agent string - * @return {Boolean} - */ - function isUnsupportedBrowser(minVersions, strictMode, ua) { - var _bowser = bowser; - - // make strictMode param optional with ua param usage - if (typeof strictMode === 'string') { - ua = strictMode; - strictMode = void(0); - } - - if (strictMode === void(0)) { - strictMode = false; - } - if (ua) { - _bowser = detect(ua); - } - - var version = "" + _bowser.version; - for (var browser in minVersions) { - if (minVersions.hasOwnProperty(browser)) { - if (_bowser[browser]) { - if (typeof minVersions[browser] !== 'string') { - throw new Error('Browser version in the minVersion map should be a string: ' + browser + ': ' + String(minVersions)); - } - - // browser version and min supported version. - return compareVersions([version, minVersions[browser]]) < 0; - } - } - } - - return strictMode; // not found - } - - /** - * Check if browser is supported - * - * @param {Object} minVersions map of minimal version to browser - * @param {Boolean} [strictMode = false] flag to return false if browser wasn't found in map - * @param {String} [ua] user agent string - * @return {Boolean} - */ - function check(minVersions, strictMode, ua) { - return !isUnsupportedBrowser(minVersions, strictMode, ua); - } - - bowser.isUnsupportedBrowser = isUnsupportedBrowser; - bowser.compareVersions = compareVersions; - bowser.check = check; - - /* - * Set our detect method to the main bowser object so we can - * reuse it to test other user agents. - * This is needed to implement future tests. - */ - bowser._detect = detect; - - return bowser - }); - - -/***/ }, -/* 5 */ -/***/ function(module, exports) { - - module.exports = function() { throw new Error("define cannot be used indirect"); }; - - /***/ } /******/ ]); //# sourceMappingURL=crypto-pro.js.map \ No newline at end of file diff --git a/dist/crypto-pro.js.map b/dist/crypto-pro.js.map index 0ab350e..f161b6a 100644 --- a/dist/crypto-pro.js.map +++ b/dist/crypto-pro.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap 44fa2509bb0f4283768d","webpack:///./index.js","webpack:///./cades.js","webpack:///../~/bowser/bowser.js","webpack:///../~/webpack/buildin/amd-define.js"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAQ,oBAAoB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;ACzFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,UAAS;AACT,MAAK;AACL;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAqB;AACrB,kBAAiB;AACjB;AACA;AACA;AACA,sBAAqB;AACrB;AACA,cAAa;;AAEb;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,EAAC;AACD;AACA;;AAEA;AACA;AACA,G;;;;;;AC5GA,EAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,MAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;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;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uDAAsD;AACtD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAoB;;AAEpB;AACA;AACA;AACA;AACA;AACA,QAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA2C;AAC3C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAgD,iBAAiB,WAAW,UAAU,YAAY,aAAa;AAC/G,0FAAyF,aAAa,mBAAmB,uBAAuB,uBAAuB,cAAc,mBAAmB,YAAY;AACpN,6FAA4F,iBAAiB,yBAAyB,WAAW;AACjJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAAyB;AACzB,qCAAoC;AACpC,kBAAiB;AACjB;AACA;AACA;AACA;AACA,0BAAyB;;AAEzB;AACA;AACA;AACA;AACA,0BAAyB;AACzB;AACA;AACA;AACA,kBAAiB;AACjB,cAAa;AACb,UAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAa;AACb;AACA;AACA,UAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAiB;AACjB;AACA;AACA;AACA,cAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA,sBAAqB;AACrB;AACA,UAAS;AACT;AACA;AACA;AACA;AACA,cAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,EAAC;;;;;;;;;AC3mBD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAC;AACD;AACA;AACA;;AAEA;;AAEA;;AAEA;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;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,QAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;;AAEA;;AAEA;AACA,oBAAmB,wBAAwB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAc,OAAO;AACrB,eAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAc,MAAM;AACpB,eAAc,SAAS;AACvB,eAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,gBAAgB;AAC/B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,sDAAqD;AACrD,mDAAkD;AAClD,mDAAkD;AAClD;AACA,eAAc,cAAc;AAC5B,eAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,QAAO;AACP,MAAK;;AAEL;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;AACA,SAAQ;AACR;AACA,eAAc,OAAO;AACrB,eAAc,QAAQ;AACtB,eAAc,OAAO;AACrB,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,uBAAsB;AACtB;;AAEA;AACA;AACA;AACA,eAAc,OAAO;AACrB,eAAc,QAAQ;AACtB,eAAc,OAAO;AACrB,eAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAC;;;;;;;ACnkBD,8BAA6B,mDAAmD","file":"crypto-pro.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonpCryptoPro\"];\n \twindow[\"webpackJsonpCryptoPro\"] = function webpackJsonpCallback(chunkIds, moreModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, callbacks = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId])\n \t\t\t\tcallbacks.push.apply(callbacks, installedChunks[chunkId]);\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);\n \t\twhile(callbacks.length)\n \t\t\tcallbacks.shift().call(null, __webpack_require__);\n\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// \"0\" means \"already loaded\"\n \t// Array means \"loading\", array contains callbacks\n \tvar installedChunks = {\n \t\t0:0\n \t};\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\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\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.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId, callback) {\n \t\t// \"0\" is the signal for \"already loaded\"\n \t\tif(installedChunks[chunkId] === 0)\n \t\t\treturn callback.call(null, __webpack_require__);\n\n \t\t// an array means \"currently loading\".\n \t\tif(installedChunks[chunkId] !== undefined) {\n \t\t\tinstalledChunks[chunkId].push(callback);\n \t\t} else {\n \t\t\t// start chunk loading\n \t\t\tinstalledChunks[chunkId] = [callback];\n \t\t\tvar head = document.getElementsByTagName('head')[0];\n \t\t\tvar script = document.createElement('script');\n \t\t\tscript.type = 'text/javascript';\n \t\t\tscript.charset = 'utf-8';\n \t\t\tscript.async = true;\n\n \t\t\tscript.src = __webpack_require__.p + \"\" + chunkId + \".crypto-pro.js\";\n \t\t\thead.appendChild(script);\n \t\t}\n \t};\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// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 44fa2509bb0f4283768d\n **/","var bowser = require('bowser/bowser'),\n browserInfo = bowser._detect(navigator.userAgent),\n global = Function('return this')(),\n canPromise = Boolean(global.Promise),\n CryptoProConfig = global.CryptoProConfig,\n canAsync,\n cadesplugin,\n cryptoService,\n _errorMsg = '',\n _isLoaded = false,\n _onLoadCbQueue = [];\n\nglobal.allow_firefox_cadesplugin_async = browserInfo.firefox && browserInfo.version >= 52;\n\nrequire('./cades');\n\ncadesplugin = global.cadesplugin;\n\ncanAsync = Boolean(cadesplugin.CreateObjectAsync);\n\nfunction execOnloadQueue() {\n _onLoadCbQueue.forEach(function (callback) {\n callback();\n });\n}\n\nfunction passToWaitOnLoad(callback) {\n if (Object.prototype.toString.call(callback) === '[object Function]') {\n _onLoadCbQueue.push(callback);\n }\n}\n\nfunction callOnLoad(method) {\n _isLoaded ? method() : passToWaitOnLoad(method);\n}\n\nfunction finishLoading() {\n _isLoaded = true;\n\n execOnloadQueue();\n}\n\nfunction call() {\n var args = Array.prototype.slice.call(arguments),\n methodName = args.shift();\n\n return new Promise(function (resolve, reject) {\n callOnLoad(function () {\n var method;\n\n if (_errorMsg) {\n reject(_errorMsg);\n return;\n }\n\n method = cryptoService[methodName];\n\n if (!method) {\n reject('Метод \"' + methodName + '\" не доступен');\n return;\n }\n\n method.apply(null, args).then(resolve, reject);\n });\n });\n}\n\nif (cadesplugin) {\n canAsync = Boolean(cadesplugin.CreateObjectAsync);\n\n // Уровень отладки (LOG_LEVEL_DEBUG, LOG_LEVEL_INFO, LOG_LEVEL_ERROR)\n cadesplugin.set_log_level(cadesplugin.LOG_LEVEL_ERROR);\n\n // Получаем указанные конфиги\n if (CryptoProConfig && CryptoProConfig.publicPath) {\n __webpack_public_path__ = CryptoProConfig.publicPath;\n }\n\n if (canPromise) {\n cadesplugin.then(\n function () {\n if (canAsync) {\n require.ensure([], function () {\n cryptoService = require('./apiAsync');\n finishLoading();\n });\n } else {\n require.ensure([], function () {\n cryptoService = require('./apiSync');\n finishLoading();\n });\n }\n },\n\n function () {\n _errorMsg = 'КриптоПРО ЭЦП Browser Plug-In не доступен';\n finishLoading();\n }\n );\n } else {\n throw new Error('Не поддерживаются промисы. Необходим полифилл.');\n }\n} else {\n throw new Error('Не подключен модуль для работы с cades plugin');\n}\n\nmodule.exports = {\n call: call\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./index.js\n ** module id = 0\n ** module chunks = 0\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 isYaBrowser = 0;\n var isFireFox = 0;\n var failed_extensions = 0;\n\n var canPromise = !!window.Promise;\n var cadesplugin;\n\n if(canPromise)\n {\n cadesplugin = new Promise(function(resolve, reject)\n {\n plugin_resolve = resolve;\n plugin_reject = reject;\n });\n } else\n {\n cadesplugin = {};\n }\n\n function cpcsp_console_log(level, msg){\n //IE9 не может писать в консоль если не открыта вкладка developer tools\n if(typeof(console) == 'undefined')\n return;\n if (level <= cadesplugin.current_log_level ){\n if (level == cadesplugin.LOG_LEVEL_DEBUG)\n console.log(\"DEBUG: %s\", msg);\n if (level == cadesplugin.LOG_LEVEL_INFO)\n console.info(\"INFO: %s\", msg);\n if (level == cadesplugin.LOG_LEVEL_ERROR)\n console.error(\"ERROR: %s\", msg);\n return;\n }\n }\n\n function set_log_level(level){\n if (!((level == cadesplugin.LOG_LEVEL_DEBUG) ||\n (level == cadesplugin.LOG_LEVEL_INFO) ||\n (level == cadesplugin.LOG_LEVEL_ERROR))){\n cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, \"cadesplugin_api.js: Incorrect log_level: \" + level);\n return;\n }\n cadesplugin.current_log_level = level;\n if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_DEBUG)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = DEBUG\");\n if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_INFO)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = INFO\");\n if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_ERROR)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = ERROR\");\n if(isNativeMessageSupported())\n {\n if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_DEBUG)\n window.postMessage(\"set_log_level=debug\", \"*\");\n if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_INFO)\n window.postMessage(\"set_log_level=info\", \"*\");\n if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_ERROR)\n window.postMessage(\"set_log_level=error\", \"*\");\n }\n }\n\n function set_constantValues()\n {\n cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CAPICOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CADESCOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_CONTAINER_STORE = 100;\n \n cadesplugin.CAPICOM_MY_STORE = \"My\";\n\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;\n\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\n\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;\n\n cadesplugin.XmlDsigGost3410UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411\";\n cadesplugin.XmlDsigGost3411UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr3411\";\n cadesplugin.XmlDsigGost3410Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411\";\n cadesplugin.XmlDsigGost3411Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411\";\n\n cadesplugin.CADESCOM_CADES_DEFAULT = 0;\n cadesplugin.CADESCOM_CADES_BES = 1;\n cadesplugin.CADESCOM_CADES_T = 0x5;\n cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;\n\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.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\n cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1;\n\n cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0;\n cadesplugin.CADESCOM_BASE64_TO_BINARY = 1;\n\n cadesplugin.CADESCOM_DISPLAY_DATA_NONE = 0;\n cadesplugin.CADESCOM_DISPLAY_DATA_CONTENT = 1;\n cadesplugin.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;\n\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;\n\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA1 = 0;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD2 = 1;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD4 = 2;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD5 = 3;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_256 = 4;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_384 = 5;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_512 = 6;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;\n\n cadesplugin.LOG_LEVEL_DEBUG = 4;\n cadesplugin.LOG_LEVEL_INFO = 2;\n cadesplugin.LOG_LEVEL_ERROR = 1;\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 retVal;\n }\n\n function isIOS() {\n var retVal = (navigator.userAgent.match(/ipod/i) ||\n navigator.userAgent.match(/ipad/i) ||\n navigator.userAgent.match(/iphone/i));\n return retVal;\n }\n\n function isNativeMessageSupported()\n {\n var retVal_chrome = navigator.userAgent.match(/chrome/i);\n isOpera = navigator.userAgent.match(/opr/i);\n isYaBrowser = navigator.userAgent.match(/YaBrowser/i);\n isFireFox = navigator.userAgent.match(/Firefox/i);\n\n if(isFireFox && window.allow_firefox_cadesplugin_async)\n return true;\n\n if(retVal_chrome == null) // В IE работаем через NPAPI\n return false;\n else\n {\n // В Chrome и Opera работаем через асинхронную версию\n if(retVal_chrome.length > 0 || isOpera != null )\n {\n return true;\n }\n }\n return false;\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 создаются через CX509EnrollmentWebClassFactory\n var objCertEnrollClassFactory = document.getElementById(\"certEnrollClassFactory\");\n return objCertEnrollClassFactory.CreateObject(name);\n }\n catch (e) {\n throw(\"Для создания обьектов X509Enrollment следует настроить веб-узел на использование проверки подлинности по протоколу HTTPS\");\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 // В Firefox, Safari создаются объекты 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 // Функция активации асинхронных объектов КриптоПро ЭЦП 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 //Выводим окно поверх других с предложением установить расширение для Opera.\n //Если установленна переменная cadesplugin_skip_extension_install - не предлагаем установить расширение\n function install_opera_extension()\n {\n if (!window.cadesplugin_skip_extension_install)\n {\n document.addEventListener('DOMContentLoaded', function() {\n var ovr = document.createElement('div');\n ovr.id = \"cadesplugin_ovr\";\n ovr.style = \"visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)\";\n ovr.innerHTML = \"
\" +\n \"\" +\n \"

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

\" +\n \"
\";\n document.getElementsByTagName(\"Body\")[0].appendChild(ovr);\n var btn_install = document.getElementById(\"cadesplugin_install\");\n btn_install.addEventListener('click', function(event) {\n opr.addons.installExtension(\"epebfcehmdedogndhlcacafjaacknbcm\",\n function()\n {\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n location.reload();\n },\n function(){})\n });\n document.getElementById(\"cadesplugin_close_install\").addEventListener('click',function()\n {\n plugin_loaded_error(\"Плагин недоступен\");\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n });\n\n ovr.addEventListener('click',function()\n {\n plugin_loaded_error(\"Плагин недоступен\");\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n });\n ovr.style.visibility=\"visible\";\n document.getElementById(\"cadesplugin_ovr_item\").addEventListener('click',function(e){\n e.stopPropagation();\n });\n });\n }else\n {\n plugin_loaded_error(\"Плагин недоступен\");\n }\n }\n\n function firefox_nmcades_onload() {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n\n function nmcades_api_onload () {\n window.postMessage(\"cadesplugin_echo_request\", \"*\");\n window.addEventListener(\"message\", function (event){\n if (typeof(event.data) != \"string\" || !event.data.match(\"cadesplugin_loaded\"))\n return;\n if(isFireFox)\n {\n // Для Firefox вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js\n var url = event.data.substring(event.data.indexOf(\"url:\") + 4);\n var fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", url);\n fileref.onerror = plugin_loaded_error;\n fileref.onload = firefox_nmcades_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n\n }else {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n }, false);\n }\n\n //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge\n function load_extension()\n {\n\n if(isFireFox){\n // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера.\n nmcades_api_onload();\n return;\n } else {\n // в асинхронном варианте для chrome и opera подключаем оба расширения\n var fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", \"chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js\");\n fileref.onerror = plugin_loaded_error;\n fileref.onload = nmcades_api_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", \"chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js\");\n fileref.onerror = plugin_loaded_error;\n fileref.onload = nmcades_api_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n }\n }\n\n //Загружаем плагин для NPAPI\n function load_npapi_plugin()\n {\n var elem = document.createElement('object');\n elem.setAttribute(\"id\", \"cadesplugin_object\");\n elem.setAttribute(\"type\", \"application/x-cades\");\n elem.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem);\n pluginObject = document.getElementById(\"cadesplugin_object\");\n if(isIE())\n {\n var elem1 = document.createElement('object');\n elem1.setAttribute(\"id\", \"certEnrollClassFactory\");\n elem1.setAttribute(\"classid\", \"clsid:884e2049-217d-11da-b2a4-000e7bbb2b09\");\n elem1.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem1);\n var elem2 = document.createElement('object');\n elem2.setAttribute(\"id\", \"webClassFactory\");\n elem2.setAttribute(\"classid\", \"clsid:B04C8637-10BD-484E-B0DA-B8A039F60024\");\n elem2.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem2);\n }\n }\n\n //Отправляем событие что все ок.\n function plugin_loaded()\n {\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_resolve();\n }else {\n window.postMessage(\"cadesplugin_loaded\", \"*\");\n }\n }\n\n //Отправляем событие что сломались.\n function plugin_loaded_error(msg)\n {\n if(isNativeMessageSupported())\n {\n //в асинхронном варианте подключаем оба расширения, если сломались оба пробуем установить для Opera\n failed_extensions++;\n if(failed_extensions<2)\n return;\n if(isOpera && (typeof(msg) == 'undefined'|| typeof(msg) == 'object'))\n {\n install_opera_extension();\n return;\n }\n }\n if(typeof(msg) == 'undefined' || typeof(msg) == 'object')\n msg = \"Плагин недоступен\";\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_reject(msg);\n } else {\n window.postMessage(\"cadesplugin_load_error\", \"*\");\n }\n }\n\n //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку\n function check_load_timeout()\n {\n if(plugin_resolved == 1)\n return;\n 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(\"iecheck\").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 window.addEventListener(\"load\", function (event) {\n load_npapi_plugin();\n check_npapi_plugin();\n }, false);\n }\n }\n\n function set_pluginObject(obj)\n {\n pluginObject = obj;\n }\n\n //Export\n cadesplugin.JSModuleVersion = \"2.1.0\";\n cadesplugin.async_spawn = async_spawn;\n cadesplugin.set = set_pluginObject;\n cadesplugin.set_log_level = set_log_level;\n cadesplugin.getLastError = getLastError;\n\n if(isNativeMessageSupported())\n {\n cadesplugin.CreateObjectAsync = CreateObjectAsync;\n }\n\n if(!isNativeMessageSupported())\n {\n cadesplugin.CreateObject = CreateObject;\n }\n\n if(window.cadesplugin_load_timeout)\n {\n setTimeout(check_load_timeout, window.cadesplugin_load_timeout);\n }\n else\n {\n setTimeout(check_load_timeout, 20000);\n }\n\n set_constantValues();\n\n cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR;\n window.cadesplugin = cadesplugin;\n check_plugin_working();\n}());\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./cades.js\n ** module id = 1\n ** module chunks = 0\n **/","/*!\n * Bowser - a browser detector\n * https://github.com/ded/bowser\n * MIT License | (c) Dustin Diaz 2015\n */\n\n!function (name, definition) {\n if (typeof module != 'undefined' && module.exports) module.exports = definition()\n else if (typeof define == 'function' && define.amd) define(name, definition)\n else this[name] = definition()\n}('bowser', function () {\n /**\n * See useragents.js for examples of navigator.userAgent\n */\n\n var t = true\n\n function detect(ua) {\n\n function getFirstMatch(regex) {\n var match = ua.match(regex);\n return (match && match.length > 1 && match[1]) || '';\n }\n\n function getSecondMatch(regex) {\n var match = ua.match(regex);\n return (match && match.length > 1 && match[2]) || '';\n }\n\n var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase()\n , likeAndroid = /like android/i.test(ua)\n , android = !likeAndroid && /android/i.test(ua)\n , nexusMobile = /nexus\\s*[0-6]\\s*/i.test(ua)\n , nexusTablet = !nexusMobile && /nexus\\s*[0-9]+/i.test(ua)\n , chromeos = /CrOS/.test(ua)\n , silk = /silk/i.test(ua)\n , sailfish = /sailfish/i.test(ua)\n , tizen = /tizen/i.test(ua)\n , webos = /(web|hpw)os/i.test(ua)\n , windowsphone = /windows phone/i.test(ua)\n , samsungBrowser = /SamsungBrowser/i.test(ua)\n , windows = !windowsphone && /windows/i.test(ua)\n , mac = !iosdevice && !silk && /macintosh/i.test(ua)\n , linux = !android && !sailfish && !tizen && !webos && /linux/i.test(ua)\n , edgeVersion = getFirstMatch(/edge\\/(\\d+(\\.\\d+)?)/i)\n , versionIdentifier = getFirstMatch(/version\\/(\\d+(\\.\\d+)?)/i)\n , tablet = /tablet/i.test(ua)\n , mobile = !tablet && /[^-]mobi/i.test(ua)\n , xbox = /xbox/i.test(ua)\n , result\n\n if (/opera/i.test(ua)) {\n // an old Opera\n result = {\n name: 'Opera'\n , opera: t\n , version: versionIdentifier || getFirstMatch(/(?:opera|opr|opios)[\\s\\/](\\d+(\\.\\d+)?)/i)\n }\n } else if (/opr|opios/i.test(ua)) {\n // a new Opera\n result = {\n name: 'Opera'\n , opera: t\n , version: getFirstMatch(/(?:opr|opios)[\\s\\/](\\d+(\\.\\d+)?)/i) || versionIdentifier\n }\n }\n else if (/SamsungBrowser/i.test(ua)) {\n result = {\n name: 'Samsung Internet for Android'\n , samsungBrowser: t\n , version: versionIdentifier || getFirstMatch(/(?:SamsungBrowser)[\\s\\/](\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/coast/i.test(ua)) {\n result = {\n name: 'Opera Coast'\n , coast: t\n , version: versionIdentifier || getFirstMatch(/(?:coast)[\\s\\/](\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/yabrowser/i.test(ua)) {\n result = {\n name: 'Yandex Browser'\n , yandexbrowser: t\n , version: versionIdentifier || getFirstMatch(/(?:yabrowser)[\\s\\/](\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/ucbrowser/i.test(ua)) {\n result = {\n name: 'UC Browser'\n , ucbrowser: t\n , version: getFirstMatch(/(?:ucbrowser)[\\s\\/](\\d+(?:\\.\\d+)+)/i)\n }\n }\n else if (/mxios/i.test(ua)) {\n result = {\n name: 'Maxthon'\n , maxthon: t\n , version: getFirstMatch(/(?:mxios)[\\s\\/](\\d+(?:\\.\\d+)+)/i)\n }\n }\n else if (/epiphany/i.test(ua)) {\n result = {\n name: 'Epiphany'\n , epiphany: t\n , version: getFirstMatch(/(?:epiphany)[\\s\\/](\\d+(?:\\.\\d+)+)/i)\n }\n }\n else if (/puffin/i.test(ua)) {\n result = {\n name: 'Puffin'\n , puffin: t\n , version: getFirstMatch(/(?:puffin)[\\s\\/](\\d+(?:\\.\\d+)?)/i)\n }\n }\n else if (/sleipnir/i.test(ua)) {\n result = {\n name: 'Sleipnir'\n , sleipnir: t\n , version: getFirstMatch(/(?:sleipnir)[\\s\\/](\\d+(?:\\.\\d+)+)/i)\n }\n }\n else if (/k-meleon/i.test(ua)) {\n result = {\n name: 'K-Meleon'\n , kMeleon: t\n , version: getFirstMatch(/(?:k-meleon)[\\s\\/](\\d+(?:\\.\\d+)+)/i)\n }\n }\n else if (windowsphone) {\n result = {\n name: 'Windows Phone'\n , windowsphone: t\n }\n if (edgeVersion) {\n result.msedge = t\n result.version = edgeVersion\n }\n else {\n result.msie = t\n result.version = getFirstMatch(/iemobile\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/msie|trident/i.test(ua)) {\n result = {\n name: 'Internet Explorer'\n , msie: t\n , version: getFirstMatch(/(?:msie |rv:)(\\d+(\\.\\d+)?)/i)\n }\n } else if (chromeos) {\n result = {\n name: 'Chrome'\n , chromeos: t\n , chromeBook: t\n , chrome: t\n , version: getFirstMatch(/(?:chrome|crios|crmo)\\/(\\d+(\\.\\d+)?)/i)\n }\n } else if (/chrome.+? edge/i.test(ua)) {\n result = {\n name: 'Microsoft Edge'\n , msedge: t\n , version: edgeVersion\n }\n }\n else if (/vivaldi/i.test(ua)) {\n result = {\n name: 'Vivaldi'\n , vivaldi: t\n , version: getFirstMatch(/vivaldi\\/(\\d+(\\.\\d+)?)/i) || versionIdentifier\n }\n }\n else if (sailfish) {\n result = {\n name: 'Sailfish'\n , sailfish: t\n , version: getFirstMatch(/sailfish\\s?browser\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/seamonkey\\//i.test(ua)) {\n result = {\n name: 'SeaMonkey'\n , seamonkey: t\n , version: getFirstMatch(/seamonkey\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/firefox|iceweasel|fxios/i.test(ua)) {\n result = {\n name: 'Firefox'\n , firefox: t\n , version: getFirstMatch(/(?:firefox|iceweasel|fxios)[ \\/](\\d+(\\.\\d+)?)/i)\n }\n if (/\\((mobile|tablet);[^\\)]*rv:[\\d\\.]+\\)/i.test(ua)) {\n result.firefoxos = t\n }\n }\n else if (silk) {\n result = {\n name: 'Amazon Silk'\n , silk: t\n , version : getFirstMatch(/silk\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/phantom/i.test(ua)) {\n result = {\n name: 'PhantomJS'\n , phantom: t\n , version: getFirstMatch(/phantomjs\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/slimerjs/i.test(ua)) {\n result = {\n name: 'SlimerJS'\n , slimer: t\n , version: getFirstMatch(/slimerjs\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/blackberry|\\bbb\\d+/i.test(ua) || /rim\\stablet/i.test(ua)) {\n result = {\n name: 'BlackBerry'\n , blackberry: t\n , version: versionIdentifier || getFirstMatch(/blackberry[\\d]+\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (webos) {\n result = {\n name: 'WebOS'\n , webos: t\n , version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\\/(\\d+(\\.\\d+)?)/i)\n };\n /touchpad\\//i.test(ua) && (result.touchpad = t)\n }\n else if (/bada/i.test(ua)) {\n result = {\n name: 'Bada'\n , bada: t\n , version: getFirstMatch(/dolfin\\/(\\d+(\\.\\d+)?)/i)\n };\n }\n else if (tizen) {\n result = {\n name: 'Tizen'\n , tizen: t\n , version: getFirstMatch(/(?:tizen\\s?)?browser\\/(\\d+(\\.\\d+)?)/i) || versionIdentifier\n };\n }\n else if (/qupzilla/i.test(ua)) {\n result = {\n name: 'QupZilla'\n , qupzilla: t\n , version: getFirstMatch(/(?:qupzilla)[\\s\\/](\\d+(?:\\.\\d+)+)/i) || versionIdentifier\n }\n }\n else if (/chromium/i.test(ua)) {\n result = {\n name: 'Chromium'\n , chromium: t\n , version: getFirstMatch(/(?:chromium)[\\s\\/](\\d+(?:\\.\\d+)?)/i) || versionIdentifier\n }\n }\n else if (/chrome|crios|crmo/i.test(ua)) {\n result = {\n name: 'Chrome'\n , chrome: t\n , version: getFirstMatch(/(?:chrome|crios|crmo)\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (android) {\n result = {\n name: 'Android'\n , version: versionIdentifier\n }\n }\n else if (/safari|applewebkit/i.test(ua)) {\n result = {\n name: 'Safari'\n , safari: t\n }\n if (versionIdentifier) {\n result.version = versionIdentifier\n }\n }\n else if (iosdevice) {\n result = {\n name : iosdevice == 'iphone' ? 'iPhone' : iosdevice == 'ipad' ? 'iPad' : 'iPod'\n }\n // WTF: version is not part of user agent in web apps\n if (versionIdentifier) {\n result.version = versionIdentifier\n }\n }\n else if(/googlebot/i.test(ua)) {\n result = {\n name: 'Googlebot'\n , googlebot: t\n , version: getFirstMatch(/googlebot\\/(\\d+(\\.\\d+))/i) || versionIdentifier\n }\n }\n else {\n result = {\n name: getFirstMatch(/^(.*)\\/(.*) /),\n version: getSecondMatch(/^(.*)\\/(.*) /)\n };\n }\n\n // set webkit or gecko flag for browsers based on these engines\n if (!result.msedge && /(apple)?webkit/i.test(ua)) {\n if (/(apple)?webkit\\/537\\.36/i.test(ua)) {\n result.name = result.name || \"Blink\"\n result.blink = t\n } else {\n result.name = result.name || \"Webkit\"\n result.webkit = t\n }\n if (!result.version && versionIdentifier) {\n result.version = versionIdentifier\n }\n } else if (!result.opera && /gecko\\//i.test(ua)) {\n result.name = result.name || \"Gecko\"\n result.gecko = t\n result.version = result.version || getFirstMatch(/gecko\\/(\\d+(\\.\\d+)?)/i)\n }\n\n // set OS flags for platforms that have multiple browsers\n if (!result.windowsphone && !result.msedge && (android || result.silk)) {\n result.android = t\n } else if (!result.windowsphone && !result.msedge && iosdevice) {\n result[iosdevice] = t\n result.ios = t\n } else if (mac) {\n result.mac = t\n } else if (xbox) {\n result.xbox = t\n } else if (windows) {\n result.windows = t\n } else if (linux) {\n result.linux = t\n }\n\n // OS version extraction\n var osVersion = '';\n if (result.windowsphone) {\n osVersion = getFirstMatch(/windows phone (?:os)?\\s?(\\d+(\\.\\d+)*)/i);\n } else if (iosdevice) {\n osVersion = getFirstMatch(/os (\\d+([_\\s]\\d+)*) like mac os x/i);\n osVersion = osVersion.replace(/[_\\s]/g, '.');\n } else if (android) {\n osVersion = getFirstMatch(/android[ \\/-](\\d+(\\.\\d+)*)/i);\n } else if (result.webos) {\n osVersion = getFirstMatch(/(?:web|hpw)os\\/(\\d+(\\.\\d+)*)/i);\n } else if (result.blackberry) {\n osVersion = getFirstMatch(/rim\\stablet\\sos\\s(\\d+(\\.\\d+)*)/i);\n } else if (result.bada) {\n osVersion = getFirstMatch(/bada\\/(\\d+(\\.\\d+)*)/i);\n } else if (result.tizen) {\n osVersion = getFirstMatch(/tizen[\\/\\s](\\d+(\\.\\d+)*)/i);\n }\n if (osVersion) {\n result.osversion = osVersion;\n }\n\n // device type extraction\n var osMajorVersion = osVersion.split('.')[0];\n if (\n tablet\n || nexusTablet\n || iosdevice == 'ipad'\n || (android && (osMajorVersion == 3 || (osMajorVersion >= 4 && !mobile)))\n || result.silk\n ) {\n result.tablet = t\n } else if (\n mobile\n || iosdevice == 'iphone'\n || iosdevice == 'ipod'\n || android\n || nexusMobile\n || result.blackberry\n || result.webos\n || result.bada\n ) {\n result.mobile = t\n }\n\n // Graded Browser Support\n // http://developer.yahoo.com/yui/articles/gbs\n if (result.msedge ||\n (result.msie && result.version >= 10) ||\n (result.yandexbrowser && result.version >= 15) ||\n\t\t (result.vivaldi && result.version >= 1.0) ||\n (result.chrome && result.version >= 20) ||\n (result.samsungBrowser && result.version >= 4) ||\n (result.firefox && result.version >= 20.0) ||\n (result.safari && result.version >= 6) ||\n (result.opera && result.version >= 10.0) ||\n (result.ios && result.osversion && result.osversion.split(\".\")[0] >= 6) ||\n (result.blackberry && result.version >= 10.1)\n || (result.chromium && result.version >= 20)\n ) {\n result.a = t;\n }\n else if ((result.msie && result.version < 10) ||\n (result.chrome && result.version < 20) ||\n (result.firefox && result.version < 20.0) ||\n (result.safari && result.version < 6) ||\n (result.opera && result.version < 10.0) ||\n (result.ios && result.osversion && result.osversion.split(\".\")[0] < 6)\n || (result.chromium && result.version < 20)\n ) {\n result.c = t\n } else result.x = t\n\n return result\n }\n\n var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent || '' : '')\n\n bowser.test = function (browserList) {\n for (var i = 0; i < browserList.length; ++i) {\n var browserItem = browserList[i];\n if (typeof browserItem=== 'string') {\n if (browserItem in bowser) {\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * Get version precisions count\n *\n * @example\n * getVersionPrecision(\"1.10.3\") // 3\n *\n * @param {string} version\n * @return {number}\n */\n function getVersionPrecision(version) {\n return version.split(\".\").length;\n }\n\n /**\n * Array::map polyfill\n *\n * @param {Array} arr\n * @param {Function} iterator\n * @return {Array}\n */\n function map(arr, iterator) {\n var result = [], i;\n if (Array.prototype.map) {\n return Array.prototype.map.call(arr, iterator);\n }\n for (i = 0; i < arr.length; i++) {\n result.push(iterator(arr[i]));\n }\n return result;\n }\n\n /**\n * Calculate browser version weight\n *\n * @example\n * compareVersions(['1.10.2.1', '1.8.2.1.90']) // 1\n * compareVersions(['1.010.2.1', '1.09.2.1.90']); // 1\n * compareVersions(['1.10.2.1', '1.10.2.1']); // 0\n * compareVersions(['1.10.2.1', '1.0800.2']); // -1\n *\n * @param {Array} versions versions to compare\n * @return {Number} comparison result\n */\n function compareVersions(versions) {\n // 1) get common precision for both versions, for example for \"10.0\" and \"9\" it should be 2\n var precision = Math.max(getVersionPrecision(versions[0]), getVersionPrecision(versions[1]));\n var chunks = map(versions, function (version) {\n var delta = precision - getVersionPrecision(version);\n\n // 2) \"9\" -> \"9.0\" (for precision = 2)\n version = version + new Array(delta + 1).join(\".0\");\n\n // 3) \"9.0\" -> [\"000000000\"\", \"000000009\"]\n return map(version.split(\".\"), function (chunk) {\n return new Array(20 - chunk.length).join(\"0\") + chunk;\n }).reverse();\n });\n\n // iterate in reverse order by reversed chunks array\n while (--precision >= 0) {\n // 4) compare: \"000000009\" > \"000000010\" = false (but \"9\" > \"10\" = true)\n if (chunks[0][precision] > chunks[1][precision]) {\n return 1;\n }\n else if (chunks[0][precision] === chunks[1][precision]) {\n if (precision === 0) {\n // all version chunks are same\n return 0;\n }\n }\n else {\n return -1;\n }\n }\n }\n\n /**\n * Check if browser is unsupported\n *\n * @example\n * bowser.isUnsupportedBrowser({\n * msie: \"10\",\n * firefox: \"23\",\n * chrome: \"29\",\n * safari: \"5.1\",\n * opera: \"16\",\n * phantom: \"534\"\n * });\n *\n * @param {Object} minVersions map of minimal version to browser\n * @param {Boolean} [strictMode = false] flag to return false if browser wasn't found in map\n * @param {String} [ua] user agent string\n * @return {Boolean}\n */\n function isUnsupportedBrowser(minVersions, strictMode, ua) {\n var _bowser = bowser;\n\n // make strictMode param optional with ua param usage\n if (typeof strictMode === 'string') {\n ua = strictMode;\n strictMode = void(0);\n }\n\n if (strictMode === void(0)) {\n strictMode = false;\n }\n if (ua) {\n _bowser = detect(ua);\n }\n\n var version = \"\" + _bowser.version;\n for (var browser in minVersions) {\n if (minVersions.hasOwnProperty(browser)) {\n if (_bowser[browser]) {\n if (typeof minVersions[browser] !== 'string') {\n throw new Error('Browser version in the minVersion map should be a string: ' + browser + ': ' + String(minVersions));\n }\n\n // browser version and min supported version.\n return compareVersions([version, minVersions[browser]]) < 0;\n }\n }\n }\n\n return strictMode; // not found\n }\n\n /**\n * Check if browser is supported\n *\n * @param {Object} minVersions map of minimal version to browser\n * @param {Boolean} [strictMode = false] flag to return false if browser wasn't found in map\n * @param {String} [ua] user agent string\n * @return {Boolean}\n */\n function check(minVersions, strictMode, ua) {\n return !isUnsupportedBrowser(minVersions, strictMode, ua);\n }\n\n bowser.isUnsupportedBrowser = isUnsupportedBrowser;\n bowser.compareVersions = compareVersions;\n bowser.check = check;\n\n /*\n * Set our detect method to the main bowser object so we can\n * reuse it to test other user agents.\n * This is needed to implement future tests.\n */\n bowser._detect = detect;\n\n return bowser\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ../~/bowser/bowser.js\n ** module id = 4\n ** module chunks = 0\n **/","module.exports = function() { throw new Error(\"define cannot be used indirect\"); };\r\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ../~/webpack/buildin/amd-define.js\n ** module id = 5\n ** module chunks = 0\n **/"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap ca692146f91365fbccca","webpack:///./index.js","webpack:///../~/bowser/bowser.js","webpack:///../~/webpack/buildin/amd-define.js","webpack:///../vendor/cadesplugin_api.js"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAQ,oBAAoB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;ACzFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,UAAS;AACT,MAAK;AACL;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAqB;AACrB,kBAAiB;AACjB;AACA;AACA;AACA,sBAAqB;AACrB;AACA,cAAa;;AAEb;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,EAAC;AACD;AACA;;AAEA;AACA;AACA,G;;;;;;;;;AC5GA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,EAAC;AACD;AACA;AACA;;AAEA;;AAEA;;AAEA;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;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,QAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;;AAEA;;AAEA;AACA,oBAAmB,wBAAwB;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAc,OAAO;AACrB,eAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAc,MAAM;AACpB,eAAc,SAAS;AACvB,eAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,gBAAgB;AAC/B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,sDAAqD;AACrD,mDAAkD;AAClD,mDAAkD;AAClD;AACA,eAAc,cAAc;AAC5B,eAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,QAAO;AACP,MAAK;;AAEL;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;AACA,SAAQ;AACR;AACA,eAAc,OAAO;AACrB,eAAc,QAAQ;AACtB,eAAc,OAAO;AACrB,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA,uBAAsB;AACtB;;AAEA;AACA;AACA;AACA,eAAc,OAAO;AACrB,eAAc,QAAQ;AACtB,eAAc,OAAO;AACrB,eAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,EAAC;;;;;;;ACnkBD,8BAA6B,mDAAmD;;;;;;;;;;;ACAhF,EAAC;AACD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,MAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;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;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,uDAAsD;AACtD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,qBAAoB;;AAEpB;AACA;AACA;AACA;AACA;AACA,QAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA2C;AAC3C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAgD,iBAAiB,WAAW,UAAU,YAAY,aAAa;AAC/G,0FAAyF,aAAa,mBAAmB,uBAAuB,uBAAuB,cAAc,mBAAmB,YAAY;AACpN,6FAA4F,iBAAiB,yBAAyB,WAAW;AACjJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAAyB;AACzB,qCAAoC;AACpC,kBAAiB;AACjB;AACA;AACA;AACA;AACA,0BAAyB;;AAEzB;AACA;AACA;AACA;AACA,0BAAyB;AACzB;AACA;AACA;AACA,kBAAiB;AACjB,cAAa;AACb,UAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,cAAa;AACb;AACA;AACA,UAAS;AACT;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAiB;AACjB;AACA;AACA;AACA,cAAa;AACb;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA,sBAAqB;AACrB;AACA,UAAS;AACT;AACA;AACA;AACA;AACA,cAAa;AACb;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,EAAC","file":"crypto-pro.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonpCryptoPro\"];\n \twindow[\"webpackJsonpCryptoPro\"] = function webpackJsonpCallback(chunkIds, moreModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, callbacks = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId])\n \t\t\t\tcallbacks.push.apply(callbacks, installedChunks[chunkId]);\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);\n \t\twhile(callbacks.length)\n \t\t\tcallbacks.shift().call(null, __webpack_require__);\n\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// \"0\" means \"already loaded\"\n \t// Array means \"loading\", array contains callbacks\n \tvar installedChunks = {\n \t\t0:0\n \t};\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\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\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.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId, callback) {\n \t\t// \"0\" is the signal for \"already loaded\"\n \t\tif(installedChunks[chunkId] === 0)\n \t\t\treturn callback.call(null, __webpack_require__);\n\n \t\t// an array means \"currently loading\".\n \t\tif(installedChunks[chunkId] !== undefined) {\n \t\t\tinstalledChunks[chunkId].push(callback);\n \t\t} else {\n \t\t\t// start chunk loading\n \t\t\tinstalledChunks[chunkId] = [callback];\n \t\t\tvar head = document.getElementsByTagName('head')[0];\n \t\t\tvar script = document.createElement('script');\n \t\t\tscript.type = 'text/javascript';\n \t\t\tscript.charset = 'utf-8';\n \t\t\tscript.async = true;\n\n \t\t\tscript.src = __webpack_require__.p + \"\" + chunkId + \".crypto-pro.js\";\n \t\t\thead.appendChild(script);\n \t\t}\n \t};\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// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap ca692146f91365fbccca\n **/","var bowser = require('bowser/bowser'),\n browserInfo = bowser._detect(navigator.userAgent),\n global = Function('return this')(),\n canPromise = Boolean(global.Promise),\n CryptoProConfig = global.CryptoProConfig,\n canAsync,\n cadesplugin,\n cryptoService,\n _errorMsg = '',\n _isLoaded = false,\n _onLoadCbQueue = [];\n\nglobal.allow_firefox_cadesplugin_async = browserInfo.firefox && browserInfo.version >= 52;\n\nrequire('../vendor/cadesplugin_api');\n\ncadesplugin = global.cadesplugin;\n\ncanAsync = Boolean(cadesplugin.CreateObjectAsync);\n\nfunction execOnloadQueue() {\n _onLoadCbQueue.forEach(function (callback) {\n callback();\n });\n}\n\nfunction passToWaitOnLoad(callback) {\n if (Object.prototype.toString.call(callback) === '[object Function]') {\n _onLoadCbQueue.push(callback);\n }\n}\n\nfunction callOnLoad(method) {\n _isLoaded ? method() : passToWaitOnLoad(method);\n}\n\nfunction finishLoading() {\n _isLoaded = true;\n\n execOnloadQueue();\n}\n\nfunction call() {\n var args = Array.prototype.slice.call(arguments),\n methodName = args.shift();\n\n return new Promise(function (resolve, reject) {\n callOnLoad(function () {\n var method;\n\n if (_errorMsg) {\n reject(_errorMsg);\n return;\n }\n\n method = cryptoService[methodName];\n\n if (!method) {\n reject('Метод \"' + methodName + '\" не доступен');\n return;\n }\n\n method.apply(null, args).then(resolve, reject);\n });\n });\n}\n\nif (cadesplugin) {\n canAsync = Boolean(cadesplugin.CreateObjectAsync);\n\n // Уровень отладки (LOG_LEVEL_DEBUG, LOG_LEVEL_INFO, LOG_LEVEL_ERROR)\n cadesplugin.set_log_level(cadesplugin.LOG_LEVEL_ERROR);\n\n // Получаем указанные конфиги\n if (CryptoProConfig && CryptoProConfig.publicPath) {\n __webpack_public_path__ = CryptoProConfig.publicPath;\n }\n\n if (canPromise) {\n cadesplugin.then(\n function () {\n if (canAsync) {\n require.ensure([], function () {\n cryptoService = require('./apiAsync');\n finishLoading();\n });\n } else {\n require.ensure([], function () {\n cryptoService = require('./apiSync');\n finishLoading();\n });\n }\n },\n\n function () {\n _errorMsg = 'КриптоПРО ЭЦП Browser Plug-In не доступен';\n finishLoading();\n }\n );\n } else {\n throw new Error('Не поддерживаются промисы. Необходим полифилл.');\n }\n} else {\n throw new Error('Не подключен модуль для работы с cades plugin');\n}\n\nmodule.exports = {\n call: call\n};\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./index.js\n ** module id = 0\n ** module chunks = 0\n **/","/*!\n * Bowser - a browser detector\n * https://github.com/ded/bowser\n * MIT License | (c) Dustin Diaz 2015\n */\n\n!function (name, definition) {\n if (typeof module != 'undefined' && module.exports) module.exports = definition()\n else if (typeof define == 'function' && define.amd) define(name, definition)\n else this[name] = definition()\n}('bowser', function () {\n /**\n * See useragents.js for examples of navigator.userAgent\n */\n\n var t = true\n\n function detect(ua) {\n\n function getFirstMatch(regex) {\n var match = ua.match(regex);\n return (match && match.length > 1 && match[1]) || '';\n }\n\n function getSecondMatch(regex) {\n var match = ua.match(regex);\n return (match && match.length > 1 && match[2]) || '';\n }\n\n var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase()\n , likeAndroid = /like android/i.test(ua)\n , android = !likeAndroid && /android/i.test(ua)\n , nexusMobile = /nexus\\s*[0-6]\\s*/i.test(ua)\n , nexusTablet = !nexusMobile && /nexus\\s*[0-9]+/i.test(ua)\n , chromeos = /CrOS/.test(ua)\n , silk = /silk/i.test(ua)\n , sailfish = /sailfish/i.test(ua)\n , tizen = /tizen/i.test(ua)\n , webos = /(web|hpw)os/i.test(ua)\n , windowsphone = /windows phone/i.test(ua)\n , samsungBrowser = /SamsungBrowser/i.test(ua)\n , windows = !windowsphone && /windows/i.test(ua)\n , mac = !iosdevice && !silk && /macintosh/i.test(ua)\n , linux = !android && !sailfish && !tizen && !webos && /linux/i.test(ua)\n , edgeVersion = getFirstMatch(/edge\\/(\\d+(\\.\\d+)?)/i)\n , versionIdentifier = getFirstMatch(/version\\/(\\d+(\\.\\d+)?)/i)\n , tablet = /tablet/i.test(ua)\n , mobile = !tablet && /[^-]mobi/i.test(ua)\n , xbox = /xbox/i.test(ua)\n , result\n\n if (/opera/i.test(ua)) {\n // an old Opera\n result = {\n name: 'Opera'\n , opera: t\n , version: versionIdentifier || getFirstMatch(/(?:opera|opr|opios)[\\s\\/](\\d+(\\.\\d+)?)/i)\n }\n } else if (/opr|opios/i.test(ua)) {\n // a new Opera\n result = {\n name: 'Opera'\n , opera: t\n , version: getFirstMatch(/(?:opr|opios)[\\s\\/](\\d+(\\.\\d+)?)/i) || versionIdentifier\n }\n }\n else if (/SamsungBrowser/i.test(ua)) {\n result = {\n name: 'Samsung Internet for Android'\n , samsungBrowser: t\n , version: versionIdentifier || getFirstMatch(/(?:SamsungBrowser)[\\s\\/](\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/coast/i.test(ua)) {\n result = {\n name: 'Opera Coast'\n , coast: t\n , version: versionIdentifier || getFirstMatch(/(?:coast)[\\s\\/](\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/yabrowser/i.test(ua)) {\n result = {\n name: 'Yandex Browser'\n , yandexbrowser: t\n , version: versionIdentifier || getFirstMatch(/(?:yabrowser)[\\s\\/](\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/ucbrowser/i.test(ua)) {\n result = {\n name: 'UC Browser'\n , ucbrowser: t\n , version: getFirstMatch(/(?:ucbrowser)[\\s\\/](\\d+(?:\\.\\d+)+)/i)\n }\n }\n else if (/mxios/i.test(ua)) {\n result = {\n name: 'Maxthon'\n , maxthon: t\n , version: getFirstMatch(/(?:mxios)[\\s\\/](\\d+(?:\\.\\d+)+)/i)\n }\n }\n else if (/epiphany/i.test(ua)) {\n result = {\n name: 'Epiphany'\n , epiphany: t\n , version: getFirstMatch(/(?:epiphany)[\\s\\/](\\d+(?:\\.\\d+)+)/i)\n }\n }\n else if (/puffin/i.test(ua)) {\n result = {\n name: 'Puffin'\n , puffin: t\n , version: getFirstMatch(/(?:puffin)[\\s\\/](\\d+(?:\\.\\d+)?)/i)\n }\n }\n else if (/sleipnir/i.test(ua)) {\n result = {\n name: 'Sleipnir'\n , sleipnir: t\n , version: getFirstMatch(/(?:sleipnir)[\\s\\/](\\d+(?:\\.\\d+)+)/i)\n }\n }\n else if (/k-meleon/i.test(ua)) {\n result = {\n name: 'K-Meleon'\n , kMeleon: t\n , version: getFirstMatch(/(?:k-meleon)[\\s\\/](\\d+(?:\\.\\d+)+)/i)\n }\n }\n else if (windowsphone) {\n result = {\n name: 'Windows Phone'\n , windowsphone: t\n }\n if (edgeVersion) {\n result.msedge = t\n result.version = edgeVersion\n }\n else {\n result.msie = t\n result.version = getFirstMatch(/iemobile\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/msie|trident/i.test(ua)) {\n result = {\n name: 'Internet Explorer'\n , msie: t\n , version: getFirstMatch(/(?:msie |rv:)(\\d+(\\.\\d+)?)/i)\n }\n } else if (chromeos) {\n result = {\n name: 'Chrome'\n , chromeos: t\n , chromeBook: t\n , chrome: t\n , version: getFirstMatch(/(?:chrome|crios|crmo)\\/(\\d+(\\.\\d+)?)/i)\n }\n } else if (/chrome.+? edge/i.test(ua)) {\n result = {\n name: 'Microsoft Edge'\n , msedge: t\n , version: edgeVersion\n }\n }\n else if (/vivaldi/i.test(ua)) {\n result = {\n name: 'Vivaldi'\n , vivaldi: t\n , version: getFirstMatch(/vivaldi\\/(\\d+(\\.\\d+)?)/i) || versionIdentifier\n }\n }\n else if (sailfish) {\n result = {\n name: 'Sailfish'\n , sailfish: t\n , version: getFirstMatch(/sailfish\\s?browser\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/seamonkey\\//i.test(ua)) {\n result = {\n name: 'SeaMonkey'\n , seamonkey: t\n , version: getFirstMatch(/seamonkey\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/firefox|iceweasel|fxios/i.test(ua)) {\n result = {\n name: 'Firefox'\n , firefox: t\n , version: getFirstMatch(/(?:firefox|iceweasel|fxios)[ \\/](\\d+(\\.\\d+)?)/i)\n }\n if (/\\((mobile|tablet);[^\\)]*rv:[\\d\\.]+\\)/i.test(ua)) {\n result.firefoxos = t\n }\n }\n else if (silk) {\n result = {\n name: 'Amazon Silk'\n , silk: t\n , version : getFirstMatch(/silk\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/phantom/i.test(ua)) {\n result = {\n name: 'PhantomJS'\n , phantom: t\n , version: getFirstMatch(/phantomjs\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/slimerjs/i.test(ua)) {\n result = {\n name: 'SlimerJS'\n , slimer: t\n , version: getFirstMatch(/slimerjs\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (/blackberry|\\bbb\\d+/i.test(ua) || /rim\\stablet/i.test(ua)) {\n result = {\n name: 'BlackBerry'\n , blackberry: t\n , version: versionIdentifier || getFirstMatch(/blackberry[\\d]+\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (webos) {\n result = {\n name: 'WebOS'\n , webos: t\n , version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\\/(\\d+(\\.\\d+)?)/i)\n };\n /touchpad\\//i.test(ua) && (result.touchpad = t)\n }\n else if (/bada/i.test(ua)) {\n result = {\n name: 'Bada'\n , bada: t\n , version: getFirstMatch(/dolfin\\/(\\d+(\\.\\d+)?)/i)\n };\n }\n else if (tizen) {\n result = {\n name: 'Tizen'\n , tizen: t\n , version: getFirstMatch(/(?:tizen\\s?)?browser\\/(\\d+(\\.\\d+)?)/i) || versionIdentifier\n };\n }\n else if (/qupzilla/i.test(ua)) {\n result = {\n name: 'QupZilla'\n , qupzilla: t\n , version: getFirstMatch(/(?:qupzilla)[\\s\\/](\\d+(?:\\.\\d+)+)/i) || versionIdentifier\n }\n }\n else if (/chromium/i.test(ua)) {\n result = {\n name: 'Chromium'\n , chromium: t\n , version: getFirstMatch(/(?:chromium)[\\s\\/](\\d+(?:\\.\\d+)?)/i) || versionIdentifier\n }\n }\n else if (/chrome|crios|crmo/i.test(ua)) {\n result = {\n name: 'Chrome'\n , chrome: t\n , version: getFirstMatch(/(?:chrome|crios|crmo)\\/(\\d+(\\.\\d+)?)/i)\n }\n }\n else if (android) {\n result = {\n name: 'Android'\n , version: versionIdentifier\n }\n }\n else if (/safari|applewebkit/i.test(ua)) {\n result = {\n name: 'Safari'\n , safari: t\n }\n if (versionIdentifier) {\n result.version = versionIdentifier\n }\n }\n else if (iosdevice) {\n result = {\n name : iosdevice == 'iphone' ? 'iPhone' : iosdevice == 'ipad' ? 'iPad' : 'iPod'\n }\n // WTF: version is not part of user agent in web apps\n if (versionIdentifier) {\n result.version = versionIdentifier\n }\n }\n else if(/googlebot/i.test(ua)) {\n result = {\n name: 'Googlebot'\n , googlebot: t\n , version: getFirstMatch(/googlebot\\/(\\d+(\\.\\d+))/i) || versionIdentifier\n }\n }\n else {\n result = {\n name: getFirstMatch(/^(.*)\\/(.*) /),\n version: getSecondMatch(/^(.*)\\/(.*) /)\n };\n }\n\n // set webkit or gecko flag for browsers based on these engines\n if (!result.msedge && /(apple)?webkit/i.test(ua)) {\n if (/(apple)?webkit\\/537\\.36/i.test(ua)) {\n result.name = result.name || \"Blink\"\n result.blink = t\n } else {\n result.name = result.name || \"Webkit\"\n result.webkit = t\n }\n if (!result.version && versionIdentifier) {\n result.version = versionIdentifier\n }\n } else if (!result.opera && /gecko\\//i.test(ua)) {\n result.name = result.name || \"Gecko\"\n result.gecko = t\n result.version = result.version || getFirstMatch(/gecko\\/(\\d+(\\.\\d+)?)/i)\n }\n\n // set OS flags for platforms that have multiple browsers\n if (!result.windowsphone && !result.msedge && (android || result.silk)) {\n result.android = t\n } else if (!result.windowsphone && !result.msedge && iosdevice) {\n result[iosdevice] = t\n result.ios = t\n } else if (mac) {\n result.mac = t\n } else if (xbox) {\n result.xbox = t\n } else if (windows) {\n result.windows = t\n } else if (linux) {\n result.linux = t\n }\n\n // OS version extraction\n var osVersion = '';\n if (result.windowsphone) {\n osVersion = getFirstMatch(/windows phone (?:os)?\\s?(\\d+(\\.\\d+)*)/i);\n } else if (iosdevice) {\n osVersion = getFirstMatch(/os (\\d+([_\\s]\\d+)*) like mac os x/i);\n osVersion = osVersion.replace(/[_\\s]/g, '.');\n } else if (android) {\n osVersion = getFirstMatch(/android[ \\/-](\\d+(\\.\\d+)*)/i);\n } else if (result.webos) {\n osVersion = getFirstMatch(/(?:web|hpw)os\\/(\\d+(\\.\\d+)*)/i);\n } else if (result.blackberry) {\n osVersion = getFirstMatch(/rim\\stablet\\sos\\s(\\d+(\\.\\d+)*)/i);\n } else if (result.bada) {\n osVersion = getFirstMatch(/bada\\/(\\d+(\\.\\d+)*)/i);\n } else if (result.tizen) {\n osVersion = getFirstMatch(/tizen[\\/\\s](\\d+(\\.\\d+)*)/i);\n }\n if (osVersion) {\n result.osversion = osVersion;\n }\n\n // device type extraction\n var osMajorVersion = osVersion.split('.')[0];\n if (\n tablet\n || nexusTablet\n || iosdevice == 'ipad'\n || (android && (osMajorVersion == 3 || (osMajorVersion >= 4 && !mobile)))\n || result.silk\n ) {\n result.tablet = t\n } else if (\n mobile\n || iosdevice == 'iphone'\n || iosdevice == 'ipod'\n || android\n || nexusMobile\n || result.blackberry\n || result.webos\n || result.bada\n ) {\n result.mobile = t\n }\n\n // Graded Browser Support\n // http://developer.yahoo.com/yui/articles/gbs\n if (result.msedge ||\n (result.msie && result.version >= 10) ||\n (result.yandexbrowser && result.version >= 15) ||\n\t\t (result.vivaldi && result.version >= 1.0) ||\n (result.chrome && result.version >= 20) ||\n (result.samsungBrowser && result.version >= 4) ||\n (result.firefox && result.version >= 20.0) ||\n (result.safari && result.version >= 6) ||\n (result.opera && result.version >= 10.0) ||\n (result.ios && result.osversion && result.osversion.split(\".\")[0] >= 6) ||\n (result.blackberry && result.version >= 10.1)\n || (result.chromium && result.version >= 20)\n ) {\n result.a = t;\n }\n else if ((result.msie && result.version < 10) ||\n (result.chrome && result.version < 20) ||\n (result.firefox && result.version < 20.0) ||\n (result.safari && result.version < 6) ||\n (result.opera && result.version < 10.0) ||\n (result.ios && result.osversion && result.osversion.split(\".\")[0] < 6)\n || (result.chromium && result.version < 20)\n ) {\n result.c = t\n } else result.x = t\n\n return result\n }\n\n var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent || '' : '')\n\n bowser.test = function (browserList) {\n for (var i = 0; i < browserList.length; ++i) {\n var browserItem = browserList[i];\n if (typeof browserItem=== 'string') {\n if (browserItem in bowser) {\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * Get version precisions count\n *\n * @example\n * getVersionPrecision(\"1.10.3\") // 3\n *\n * @param {string} version\n * @return {number}\n */\n function getVersionPrecision(version) {\n return version.split(\".\").length;\n }\n\n /**\n * Array::map polyfill\n *\n * @param {Array} arr\n * @param {Function} iterator\n * @return {Array}\n */\n function map(arr, iterator) {\n var result = [], i;\n if (Array.prototype.map) {\n return Array.prototype.map.call(arr, iterator);\n }\n for (i = 0; i < arr.length; i++) {\n result.push(iterator(arr[i]));\n }\n return result;\n }\n\n /**\n * Calculate browser version weight\n *\n * @example\n * compareVersions(['1.10.2.1', '1.8.2.1.90']) // 1\n * compareVersions(['1.010.2.1', '1.09.2.1.90']); // 1\n * compareVersions(['1.10.2.1', '1.10.2.1']); // 0\n * compareVersions(['1.10.2.1', '1.0800.2']); // -1\n *\n * @param {Array} versions versions to compare\n * @return {Number} comparison result\n */\n function compareVersions(versions) {\n // 1) get common precision for both versions, for example for \"10.0\" and \"9\" it should be 2\n var precision = Math.max(getVersionPrecision(versions[0]), getVersionPrecision(versions[1]));\n var chunks = map(versions, function (version) {\n var delta = precision - getVersionPrecision(version);\n\n // 2) \"9\" -> \"9.0\" (for precision = 2)\n version = version + new Array(delta + 1).join(\".0\");\n\n // 3) \"9.0\" -> [\"000000000\"\", \"000000009\"]\n return map(version.split(\".\"), function (chunk) {\n return new Array(20 - chunk.length).join(\"0\") + chunk;\n }).reverse();\n });\n\n // iterate in reverse order by reversed chunks array\n while (--precision >= 0) {\n // 4) compare: \"000000009\" > \"000000010\" = false (but \"9\" > \"10\" = true)\n if (chunks[0][precision] > chunks[1][precision]) {\n return 1;\n }\n else if (chunks[0][precision] === chunks[1][precision]) {\n if (precision === 0) {\n // all version chunks are same\n return 0;\n }\n }\n else {\n return -1;\n }\n }\n }\n\n /**\n * Check if browser is unsupported\n *\n * @example\n * bowser.isUnsupportedBrowser({\n * msie: \"10\",\n * firefox: \"23\",\n * chrome: \"29\",\n * safari: \"5.1\",\n * opera: \"16\",\n * phantom: \"534\"\n * });\n *\n * @param {Object} minVersions map of minimal version to browser\n * @param {Boolean} [strictMode = false] flag to return false if browser wasn't found in map\n * @param {String} [ua] user agent string\n * @return {Boolean}\n */\n function isUnsupportedBrowser(minVersions, strictMode, ua) {\n var _bowser = bowser;\n\n // make strictMode param optional with ua param usage\n if (typeof strictMode === 'string') {\n ua = strictMode;\n strictMode = void(0);\n }\n\n if (strictMode === void(0)) {\n strictMode = false;\n }\n if (ua) {\n _bowser = detect(ua);\n }\n\n var version = \"\" + _bowser.version;\n for (var browser in minVersions) {\n if (minVersions.hasOwnProperty(browser)) {\n if (_bowser[browser]) {\n if (typeof minVersions[browser] !== 'string') {\n throw new Error('Browser version in the minVersion map should be a string: ' + browser + ': ' + String(minVersions));\n }\n\n // browser version and min supported version.\n return compareVersions([version, minVersions[browser]]) < 0;\n }\n }\n }\n\n return strictMode; // not found\n }\n\n /**\n * Check if browser is supported\n *\n * @param {Object} minVersions map of minimal version to browser\n * @param {Boolean} [strictMode = false] flag to return false if browser wasn't found in map\n * @param {String} [ua] user agent string\n * @return {Boolean}\n */\n function check(minVersions, strictMode, ua) {\n return !isUnsupportedBrowser(minVersions, strictMode, ua);\n }\n\n bowser.isUnsupportedBrowser = isUnsupportedBrowser;\n bowser.compareVersions = compareVersions;\n bowser.check = check;\n\n /*\n * Set our detect method to the main bowser object so we can\n * reuse it to test other user agents.\n * This is needed to implement future tests.\n */\n bowser._detect = detect;\n\n return bowser\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ../~/bowser/bowser.js\n ** module id = 4\n ** module chunks = 0\n **/","module.exports = function() { throw new Error(\"define cannot be used indirect\"); };\r\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ../~/webpack/buildin/amd-define.js\n ** module id = 5\n ** module chunks = 0\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 isYaBrowser = 0;\n var isFireFox = 0;\n var failed_extensions = 0;\n\n var canPromise = !!window.Promise;\n var cadesplugin;\n\n if(canPromise)\n {\n cadesplugin = new Promise(function(resolve, reject)\n {\n plugin_resolve = resolve;\n plugin_reject = reject;\n });\n } else\n {\n cadesplugin = {};\n }\n\n function cpcsp_console_log(level, msg){\n //IE9 не может писать в консоль если не открыта вкладка developer tools\n if(typeof(console) == 'undefined')\n return;\n if (level <= cadesplugin.current_log_level ){\n if (level == cadesplugin.LOG_LEVEL_DEBUG)\n console.log(\"DEBUG: %s\", msg);\n if (level == cadesplugin.LOG_LEVEL_INFO)\n console.info(\"INFO: %s\", msg);\n if (level == cadesplugin.LOG_LEVEL_ERROR)\n console.error(\"ERROR: %s\", msg);\n return;\n }\n }\n\n function set_log_level(level){\n if (!((level == cadesplugin.LOG_LEVEL_DEBUG) ||\n (level == cadesplugin.LOG_LEVEL_INFO) ||\n (level == cadesplugin.LOG_LEVEL_ERROR))){\n cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, \"cadesplugin_api.js: Incorrect log_level: \" + level);\n return;\n }\n cadesplugin.current_log_level = level;\n if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_DEBUG)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = DEBUG\");\n if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_INFO)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = INFO\");\n if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_ERROR)\n cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, \"cadesplugin_api.js: log_level = ERROR\");\n if(isNativeMessageSupported())\n {\n if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_DEBUG)\n window.postMessage(\"set_log_level=debug\", \"*\");\n if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_INFO)\n window.postMessage(\"set_log_level=info\", \"*\");\n if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_ERROR)\n window.postMessage(\"set_log_level=error\", \"*\");\n }\n }\n\n function set_constantValues()\n {\n cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CAPICOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1;\n cadesplugin.CADESCOM_CURRENT_USER_STORE = 2;\n cadesplugin.CADESCOM_CONTAINER_STORE = 100;\n \n cadesplugin.CAPICOM_MY_STORE = \"My\";\n\n cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2;\n\n cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1;\n\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0;\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1;\n cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2;\n\n cadesplugin.XmlDsigGost3410UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411\";\n cadesplugin.XmlDsigGost3411UrlObsolete = \"http://www.w3.org/2001/04/xmldsig-more#gostr3411\";\n cadesplugin.XmlDsigGost3410Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411\";\n cadesplugin.XmlDsigGost3411Url = \"urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411\";\n\n cadesplugin.CADESCOM_CADES_DEFAULT = 0;\n cadesplugin.CADESCOM_CADES_BES = 1;\n cadesplugin.CADESCOM_CADES_T = 0x5;\n cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d;\n\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.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1;\n cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2;\n cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1;\n\n cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0;\n cadesplugin.CADESCOM_BASE64_TO_BINARY = 1;\n\n cadesplugin.CADESCOM_DISPLAY_DATA_NONE = 0;\n cadesplugin.CADESCOM_DISPLAY_DATA_CONTENT = 1;\n cadesplugin.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2;\n\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4;\n cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25;\n\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA1 = 0;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD2 = 1;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD4 = 2;\n cadesplugin.CADESCOM_HASH_ALGORITHM_MD5 = 3;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_256 = 4;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_384 = 5;\n cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_512 = 6;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101;\n cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102;\n\n cadesplugin.LOG_LEVEL_DEBUG = 4;\n cadesplugin.LOG_LEVEL_INFO = 2;\n cadesplugin.LOG_LEVEL_ERROR = 1;\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 retVal;\n }\n\n function isIOS() {\n var retVal = (navigator.userAgent.match(/ipod/i) ||\n navigator.userAgent.match(/ipad/i) ||\n navigator.userAgent.match(/iphone/i));\n return retVal;\n }\n\n function isNativeMessageSupported()\n {\n var retVal_chrome = navigator.userAgent.match(/chrome/i);\n isOpera = navigator.userAgent.match(/opr/i);\n isYaBrowser = navigator.userAgent.match(/YaBrowser/i);\n isFireFox = navigator.userAgent.match(/Firefox/i);\n\n if(isFireFox && window.allow_firefox_cadesplugin_async)\n return true;\n\n if(retVal_chrome == null) // В IE работаем через NPAPI\n return false;\n else\n {\n // В Chrome и Opera работаем через асинхронную версию\n if(retVal_chrome.length > 0 || isOpera != null )\n {\n return true;\n }\n }\n return false;\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 создаются через CX509EnrollmentWebClassFactory\n var objCertEnrollClassFactory = document.getElementById(\"certEnrollClassFactory\");\n return objCertEnrollClassFactory.CreateObject(name);\n }\n catch (e) {\n throw(\"Для создания обьектов X509Enrollment следует настроить веб-узел на использование проверки подлинности по протоколу HTTPS\");\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 // В Firefox, Safari создаются объекты 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 // Функция активации асинхронных объектов КриптоПро ЭЦП 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 //Выводим окно поверх других с предложением установить расширение для Opera.\n //Если установленна переменная cadesplugin_skip_extension_install - не предлагаем установить расширение\n function install_opera_extension()\n {\n if (!window.cadesplugin_skip_extension_install)\n {\n document.addEventListener('DOMContentLoaded', function() {\n var ovr = document.createElement('div');\n ovr.id = \"cadesplugin_ovr\";\n ovr.style = \"visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)\";\n ovr.innerHTML = \"
\" +\n \"\" +\n \"

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

\" +\n \"
\";\n document.getElementsByTagName(\"Body\")[0].appendChild(ovr);\n var btn_install = document.getElementById(\"cadesplugin_install\");\n btn_install.addEventListener('click', function(event) {\n opr.addons.installExtension(\"epebfcehmdedogndhlcacafjaacknbcm\",\n function()\n {\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n location.reload();\n },\n function(){})\n });\n document.getElementById(\"cadesplugin_close_install\").addEventListener('click',function()\n {\n plugin_loaded_error(\"Плагин недоступен\");\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n });\n\n ovr.addEventListener('click',function()\n {\n plugin_loaded_error(\"Плагин недоступен\");\n document.getElementById(\"cadesplugin_ovr\").style.visibility = 'hidden';\n });\n ovr.style.visibility=\"visible\";\n document.getElementById(\"cadesplugin_ovr_item\").addEventListener('click',function(e){\n e.stopPropagation();\n });\n });\n }else\n {\n plugin_loaded_error(\"Плагин недоступен\");\n }\n }\n\n function firefox_nmcades_onload() {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n\n function nmcades_api_onload () {\n window.postMessage(\"cadesplugin_echo_request\", \"*\");\n window.addEventListener(\"message\", function (event){\n if (typeof(event.data) != \"string\" || !event.data.match(\"cadesplugin_loaded\"))\n return;\n if(isFireFox)\n {\n // Для Firefox вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js\n var url = event.data.substring(event.data.indexOf(\"url:\") + 4);\n var fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", url);\n fileref.onerror = plugin_loaded_error;\n fileref.onload = firefox_nmcades_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n\n }else {\n cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error);\n }\n }, false);\n }\n\n //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge\n function load_extension()\n {\n\n if(isFireFox){\n // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера.\n nmcades_api_onload();\n return;\n } else {\n // в асинхронном варианте для chrome и opera подключаем оба расширения\n var fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", \"chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js\");\n fileref.onerror = plugin_loaded_error;\n fileref.onload = nmcades_api_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n fileref = document.createElement('script');\n fileref.setAttribute(\"type\", \"text/javascript\");\n fileref.setAttribute(\"src\", \"chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js\");\n fileref.onerror = plugin_loaded_error;\n fileref.onload = nmcades_api_onload;\n document.getElementsByTagName(\"head\")[0].appendChild(fileref);\n }\n }\n\n //Загружаем плагин для NPAPI\n function load_npapi_plugin()\n {\n var elem = document.createElement('object');\n elem.setAttribute(\"id\", \"cadesplugin_object\");\n elem.setAttribute(\"type\", \"application/x-cades\");\n elem.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem);\n pluginObject = document.getElementById(\"cadesplugin_object\");\n if(isIE())\n {\n var elem1 = document.createElement('object');\n elem1.setAttribute(\"id\", \"certEnrollClassFactory\");\n elem1.setAttribute(\"classid\", \"clsid:884e2049-217d-11da-b2a4-000e7bbb2b09\");\n elem1.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem1);\n var elem2 = document.createElement('object');\n elem2.setAttribute(\"id\", \"webClassFactory\");\n elem2.setAttribute(\"classid\", \"clsid:B04C8637-10BD-484E-B0DA-B8A039F60024\");\n elem2.setAttribute(\"style\", \"visibility: hidden\");\n document.getElementsByTagName(\"body\")[0].appendChild(elem2);\n }\n }\n\n //Отправляем событие что все ок.\n function plugin_loaded()\n {\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_resolve();\n }else {\n window.postMessage(\"cadesplugin_loaded\", \"*\");\n }\n }\n\n //Отправляем событие что сломались.\n function plugin_loaded_error(msg)\n {\n if(isNativeMessageSupported())\n {\n //в асинхронном варианте подключаем оба расширения, если сломались оба пробуем установить для Opera\n failed_extensions++;\n if(failed_extensions<2)\n return;\n if(isOpera && (typeof(msg) == 'undefined'|| typeof(msg) == 'object'))\n {\n install_opera_extension();\n return;\n }\n }\n if(typeof(msg) == 'undefined' || typeof(msg) == 'object')\n msg = \"Плагин недоступен\";\n plugin_resolved = 1;\n if(canPromise)\n {\n plugin_reject(msg);\n } else {\n window.postMessage(\"cadesplugin_load_error\", \"*\");\n }\n }\n\n //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку\n function check_load_timeout()\n {\n if(plugin_resolved == 1)\n return;\n 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(\"iecheck\").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 window.addEventListener(\"load\", function (event) {\n load_npapi_plugin();\n check_npapi_plugin();\n }, false);\n }\n }\n\n function set_pluginObject(obj)\n {\n pluginObject = obj;\n }\n\n //Export\n cadesplugin.JSModuleVersion = \"2.1.0\";\n cadesplugin.async_spawn = async_spawn;\n cadesplugin.set = set_pluginObject;\n cadesplugin.set_log_level = set_log_level;\n cadesplugin.getLastError = getLastError;\n\n if(isNativeMessageSupported())\n {\n cadesplugin.CreateObjectAsync = CreateObjectAsync;\n }\n\n if(!isNativeMessageSupported())\n {\n cadesplugin.CreateObject = CreateObject;\n }\n\n if(window.cadesplugin_load_timeout)\n {\n setTimeout(check_load_timeout, window.cadesplugin_load_timeout);\n }\n else\n {\n setTimeout(check_load_timeout, 20000);\n }\n\n set_constantValues();\n\n cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR;\n window.cadesplugin = cadesplugin;\n check_plugin_working();\n}());\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ../vendor/cadesplugin_api.js\n ** module id = 10\n ** module chunks = 0\n **/"],"sourceRoot":""} \ No newline at end of file diff --git a/src/index.js b/src/index.js index 1839075..bb6e79d 100755 --- a/src/index.js +++ b/src/index.js @@ -12,7 +12,7 @@ var bowser = require('bowser/bowser'), global.allow_firefox_cadesplugin_async = browserInfo.firefox && browserInfo.version >= 52; -require('./cades'); +require('../vendor/cadesplugin_api'); cadesplugin = global.cadesplugin; diff --git a/src/original_src/cadesplugin_api_2.0.2.js b/src/original_src/cadesplugin_api_2.0.2.js deleted file mode 100644 index 4d5ac41..0000000 --- a/src/original_src/cadesplugin_api_2.0.2.js +++ /dev/null @@ -1,556 +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 isYaBrowser = 0; - var failed_extensions = 0; - - var canPromise = !!window.Promise; - var cadesplugin; - - if(canPromise) - { - cadesplugin = new Promise(function(resolve, reject) - { - plugin_resolve = resolve; - plugin_reject = reject; - }); - } else - { - cadesplugin = {}; - } - - function cpcsp_console_log(level, msg){ - if (level <= cadesplugin.current_log_level ){ - if (level == cadesplugin.LOG_LEVEL_DEBUG) - console.log("DEBUG: %s", msg); - if (level == cadesplugin.LOG_LEVEL_INFO) - console.info("INFO: %s", msg); - if (level == cadesplugin.LOG_LEVEL_ERROR) - console.error("ERROR: %s", msg); - return; - } - } - - function set_log_level(level){ - if (!((level == cadesplugin.LOG_LEVEL_DEBUG) || - (level == cadesplugin.LOG_LEVEL_INFO) || - (level == cadesplugin.LOG_LEVEL_ERROR))){ - cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, "cadesplugin_api.js: Incorrect log_level: " + level); - return; - } - cadesplugin.current_log_level = level; - if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_DEBUG) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = DEBUG"); - if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_INFO) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = INFO"); - if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_ERROR) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = ERROR"); - if(isChromiumBased()) - { - if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_DEBUG) - window.postMessage("set_log_level=debug", "*"); - if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_INFO) - window.postMessage("set_log_level=info", "*"); - if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_ERROR) - window.postMessage("set_log_level=error", "*"); - } - } - - function set_constantValues() - { - cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1; - cadesplugin.CAPICOM_CURRENT_USER_STORE = 2; - - cadesplugin.CAPICOM_MY_STORE = "My"; - - cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2; - - cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1; - - cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0; - cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1; - cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2; - - cadesplugin.XmlDsigGost3410UrlObsolete = "http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411"; - cadesplugin.XmlDsigGost3411UrlObsolete = "http://www.w3.org/2001/04/xmldsig-more#gostr3411"; - cadesplugin.XmlDsigGost3410Url = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411"; - cadesplugin.XmlDsigGost3411Url = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411"; - - cadesplugin.CADESCOM_CADES_DEFAULT = 0; - cadesplugin.CADESCOM_CADES_BES = 1; - cadesplugin.CADESCOM_CADES_T = 0x5; - cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d; - - cadesplugin.CADESCOM_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.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; - cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; - cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1; - - cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0; - cadesplugin.CADESCOM_BASE64_TO_BINARY = 1; - - cadesplugin.CADESCOM_DISPLAY_DATA_NONE = 0; - cadesplugin.CADESCOM_DISPLAY_DATA_CONTENT = 1; - cadesplugin.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2; - - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25; - - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA1 = 0; - cadesplugin.CADESCOM_HASH_ALGORITHM_MD2 = 1; - cadesplugin.CADESCOM_HASH_ALGORITHM_MD4 = 2; - cadesplugin.CADESCOM_HASH_ALGORITHM_MD5 = 3; - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_256 = 4; - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_384 = 5; - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_512 = 6; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102; - - cadesplugin.LOG_LEVEL_DEBUG = 4; - cadesplugin.LOG_LEVEL_INFO = 2; - cadesplugin.LOG_LEVEL_ERROR = 1; - } - - 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 retVal; - } - - function isIOS() { - var retVal = (navigator.userAgent.match(/ipod/i) || - navigator.userAgent.match(/ipad/i) || - navigator.userAgent.match(/iphone/i)); - return retVal; - } - - function isChromiumBased() - { - var retVal_chrome = navigator.userAgent.match(/chrome/i); - //некоторых версиях IE8 с подключенным плагином chromeframe он определяется как - //Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; chromeframe/29.0.1547.67; - // и может попадать в ветку Chrome - var retVal_chromeframe = navigator.userAgent.match(/chromeframe/i); - isOpera = navigator.userAgent.match(/opr/i); - isYaBrowser = navigator.userAgent.match(/YaBrowser/i); - - if(retVal_chrome == null) // В Firefox и IE работаем через NPAPI - return false; - else - { - // В Chrome и Opera работаем через асинхронную версию - if(retVal_chrome.length > 0 || isOpera != null ) - { - return true; - } - } - 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("certEnrollClassFactory"); - return objCertEnrollClassFactory.CreateObject(name); - } - catch (e) { - 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); - } - } - // В Firefox, Safari создаются объекты NPAPI - return pluginObject.CreateObject(name); - } - - // Функция активации асинхронных объектов КриптоПро ЭЦП 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; - } - - //Выводим окно поверх других с предложением установить расширение для Opera. - //Если установленна переменная cadesplugin_skip_extension_install - не предлагаем установить расширение - function install_opera_extension() - { - if (!window.cadesplugin_skip_extension_install) - { - document.addEventListener('DOMContentLoaded', function() { - var ovr = document.createElement('div'); - ovr.id = "cadesplugin_ovr"; - ovr.style = "visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)"; - ovr.innerHTML = "
" + - "" + - "

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

" + - "
"; - document.getElementsByTagName("Body")[0].appendChild(ovr); - var btn_install = document.getElementById("cadesplugin_install"); - btn_install.addEventListener('click', function(event) { - opr.addons.installExtension("epebfcehmdedogndhlcacafjaacknbcm", - function() - { - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - location.reload(); - }, - function(){}) - }); - document.getElementById("cadesplugin_close_install").addEventListener('click',function() - { - plugin_loaded_error("Плагин недоступен"); - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - }); - - ovr.addEventListener('click',function() - { - plugin_loaded_error("Плагин недоступен"); - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - }); - ovr.style.visibility="visible"; - document.getElementById("cadesplugin_ovr_item").addEventListener('click',function(e){ - e.stopPropagation(); - }); - }); - }else - { - plugin_loaded_error("Плагин недоступен"); - } - } - - function extension_onload () { - window.postMessage("cadesplugin_echo_request", "*"); - window.addEventListener("message", function (event){ - if (event.data != "cadesplugin_loaded") - return; - cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error); - }, - false); - } - //Загружаем расширения для Chrome, Opera, YaBrowser - function load_extension() - { - 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 = extension_onload; - document.getElementsByTagName("head")[0].appendChild(fileref); - fileref = document.createElement('script'); - fileref.setAttribute("type", "text/javascript"); - fileref.setAttribute("src", "chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js"); - fileref.onerror = plugin_loaded_error; - fileref.onload = extension_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(isChromiumBased()) - { - //в асинхронном варианте подключаем оба расширения, если сломались оба пробуем установить для Opera - failed_extensions++; - if(failed_extensions<2) - return; - if(isOpera && (typeof(msg) == 'undefined'|| typeof(msg) == 'object')) - { - install_opera_extension(); - return; - } - } - if(typeof(msg) == 'undefined' || typeof(msg) == 'object') - msg = "Плагин недоступен"; - plugin_resolved = 1; - if(canPromise) - { - plugin_reject(msg); - } else { - window.postMessage("cadesplugin_load_error", "*"); - } - } - - //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку - function check_load_timeout() - { - if(plugin_resolved == 1) - return; - 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("iecheck").length == 1); - if (isIeLessThan9) { - plugin_loaded_error("Internet Explorer версии 8 и ниже не поддерживается"); - return; - } - - if(isChromiumBased()) - { - 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 - { - window.addEventListener("load", function (event) { - load_npapi_plugin(); - check_npapi_plugin(); - }, false); - } - } - - function set_pluginObject(obj) - { - pluginObject = obj; - } - - //Export - cadesplugin.JSModuleVersion = "2.0.2"; - cadesplugin.async_spawn = async_spawn; - cadesplugin.set = set_pluginObject; - cadesplugin.set_log_level = set_log_level; - - if(isChromiumBased()) - { - cadesplugin.CreateObjectAsync = CreateObjectAsync; - } - if(!isChromiumBased()) - { - cadesplugin.CreateObject = CreateObject; - } - - if(window.cadesplugin_load_timeout) - { - setTimeout(check_load_timeout, window.cadesplugin_load_timeout); - } - else - { - setTimeout(check_load_timeout, 20000); - } - - set_constantValues(); - - cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR; - window.cadesplugin = cadesplugin; - check_plugin_working(); -}()); diff --git a/src/original_src/cadesplugin_api_2.0.3.js b/src/original_src/cadesplugin_api_2.0.3.js deleted file mode 100644 index 3b82eba..0000000 --- a/src/original_src/cadesplugin_api_2.0.3.js +++ /dev/null @@ -1,593 +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 isYaBrowser = 0; - var failed_extensions = 0; - - var canPromise = !!window.Promise; - var cadesplugin; - - if(canPromise) - { - cadesplugin = new Promise(function(resolve, reject) - { - plugin_resolve = resolve; - plugin_reject = reject; - }); - } else - { - cadesplugin = {}; - } - - function cpcsp_console_log(level, msg){ - if(typeof(console) == 'undefined') - return; - if (level <= cadesplugin.current_log_level ){ - if (level == cadesplugin.LOG_LEVEL_DEBUG) - console.log("DEBUG: %s", msg); - if (level == cadesplugin.LOG_LEVEL_INFO) - console.info("INFO: %s", msg); - if (level == cadesplugin.LOG_LEVEL_ERROR) - console.error("ERROR: %s", msg); - return; - } - } - - function set_log_level(level){ - if (!((level == cadesplugin.LOG_LEVEL_DEBUG) || - (level == cadesplugin.LOG_LEVEL_INFO) || - (level == cadesplugin.LOG_LEVEL_ERROR))){ - cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, "cadesplugin_api.js: Incorrect log_level: " + level); - return; - } - cadesplugin.current_log_level = level; - if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_DEBUG) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = DEBUG"); - if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_INFO) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = INFO"); - if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_ERROR) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = ERROR"); - if(isChromiumBased()) - { - if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_DEBUG) - window.postMessage("set_log_level=debug", "*"); - if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_INFO) - window.postMessage("set_log_level=info", "*"); - if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_ERROR) - window.postMessage("set_log_level=error", "*"); - } - } - - function set_constantValues() - { - cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1; - cadesplugin.CAPICOM_CURRENT_USER_STORE = 2; - cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1; - cadesplugin.CADESCOM_CURRENT_USER_STORE = 2; - cadesplugin.CADESCOM_CONTAINER_STORE = 100; - - cadesplugin.CAPICOM_MY_STORE = "My"; - - cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2; - - cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1; - - cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0; - cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1; - cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2; - - cadesplugin.XmlDsigGost3410UrlObsolete = "http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411"; - cadesplugin.XmlDsigGost3411UrlObsolete = "http://www.w3.org/2001/04/xmldsig-more#gostr3411"; - cadesplugin.XmlDsigGost3410Url = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411"; - cadesplugin.XmlDsigGost3411Url = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411"; - - cadesplugin.CADESCOM_CADES_DEFAULT = 0; - cadesplugin.CADESCOM_CADES_BES = 1; - cadesplugin.CADESCOM_CADES_T = 0x5; - cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d; - - cadesplugin.CADESCOM_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.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; - cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; - cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1; - - cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0; - cadesplugin.CADESCOM_BASE64_TO_BINARY = 1; - - cadesplugin.CADESCOM_DISPLAY_DATA_NONE = 0; - cadesplugin.CADESCOM_DISPLAY_DATA_CONTENT = 1; - cadesplugin.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2; - - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25; - - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA1 = 0; - cadesplugin.CADESCOM_HASH_ALGORITHM_MD2 = 1; - cadesplugin.CADESCOM_HASH_ALGORITHM_MD4 = 2; - cadesplugin.CADESCOM_HASH_ALGORITHM_MD5 = 3; - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_256 = 4; - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_384 = 5; - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_512 = 6; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102; - - cadesplugin.LOG_LEVEL_DEBUG = 4; - cadesplugin.LOG_LEVEL_INFO = 2; - cadesplugin.LOG_LEVEL_ERROR = 1; - } - - 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 retVal; - } - - function isIOS() { - var retVal = (navigator.userAgent.match(/ipod/i) || - navigator.userAgent.match(/ipad/i) || - navigator.userAgent.match(/iphone/i)); - return retVal; - } - - function isChromiumBased() - { - var retVal_chrome = navigator.userAgent.match(/chrome/i); - //некоторых версиях IE8 с подключенным плагином chromeframe он определяется как - //Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; chromeframe/29.0.1547.67; - // и может попадать в ветку Chrome - var retVal_chromeframe = navigator.userAgent.match(/chromeframe/i); - isOpera = navigator.userAgent.match(/opr/i); - isYaBrowser = navigator.userAgent.match(/YaBrowser/i); - - if(retVal_chrome == null) // В Firefox и IE работаем через NPAPI - return false; - else - { - // В Chrome и Opera работаем через асинхронную версию - if(retVal_chrome.length > 0 || isOpera != null ) - { - return true; - } - } - 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("certEnrollClassFactory"); - return objCertEnrollClassFactory.CreateObject(name); - } - catch (e) { - 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); - } - } - // В Firefox, Safari создаются объекты 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(isChromiumBased() || isIE() || isIOS() ) { - return GetMessageFromException(exception); - } - - try { - return pluginObject.getLastError(); - } catch(e) { - return GetMessageFromException(exception); - } - } - - // Функция активации асинхронных объектов КриптоПро ЭЦП 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; - } - - //Выводим окно поверх других с предложением установить расширение для Opera. - //Если установленна переменная cadesplugin_skip_extension_install - не предлагаем установить расширение - function install_opera_extension() - { - if (!window.cadesplugin_skip_extension_install) - { - document.addEventListener('DOMContentLoaded', function() { - var ovr = document.createElement('div'); - ovr.id = "cadesplugin_ovr"; - ovr.style = "visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)"; - ovr.innerHTML = "
" + - "" + - "

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

" + - "
"; - document.getElementsByTagName("Body")[0].appendChild(ovr); - var btn_install = document.getElementById("cadesplugin_install"); - btn_install.addEventListener('click', function(event) { - opr.addons.installExtension("epebfcehmdedogndhlcacafjaacknbcm", - function() - { - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - location.reload(); - }, - function(){}) - }); - document.getElementById("cadesplugin_close_install").addEventListener('click',function() - { - plugin_loaded_error("Плагин недоступен"); - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - }); - - ovr.addEventListener('click',function() - { - plugin_loaded_error("Плагин недоступен"); - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - }); - ovr.style.visibility="visible"; - document.getElementById("cadesplugin_ovr_item").addEventListener('click',function(e){ - e.stopPropagation(); - }); - }); - }else - { - plugin_loaded_error("Плагин недоступен"); - } - } - - function extension_onload () { - window.postMessage("cadesplugin_echo_request", "*"); - window.addEventListener("message", function (event){ - if (event.data != "cadesplugin_loaded") - return; - cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error); - }, - false); - } - //Загружаем расширения для Chrome, Opera, YaBrowser - function load_extension() - { - 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 = extension_onload; - document.getElementsByTagName("head")[0].appendChild(fileref); - fileref = document.createElement('script'); - fileref.setAttribute("type", "text/javascript"); - fileref.setAttribute("src", "chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js"); - fileref.onerror = plugin_loaded_error; - fileref.onload = extension_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(isChromiumBased()) - { - //в асинхронном варианте подключаем оба расширения, если сломались оба пробуем установить для Opera - failed_extensions++; - if(failed_extensions<2) - return; - if(isOpera && (typeof(msg) == 'undefined'|| typeof(msg) == 'object')) - { - install_opera_extension(); - return; - } - } - if(typeof(msg) == 'undefined' || typeof(msg) == 'object') - msg = "Плагин недоступен"; - plugin_resolved = 1; - if(canPromise) - { - plugin_reject(msg); - } else { - window.postMessage("cadesplugin_load_error", "*"); - } - } - - //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку - function check_load_timeout() - { - if(plugin_resolved == 1) - return; - 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("iecheck").length == 1); - if (isIeLessThan9) { - plugin_loaded_error("Internet Explorer версии 8 и ниже не поддерживается"); - return; - } - - if(isChromiumBased()) - { - 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 - { - window.addEventListener("load", function (event) { - load_npapi_plugin(); - check_npapi_plugin(); - }, false); - } - } - - function set_pluginObject(obj) - { - pluginObject = obj; - } - - //Export - cadesplugin.JSModuleVersion = "2.0.3"; - cadesplugin.async_spawn = async_spawn; - cadesplugin.set = set_pluginObject; - cadesplugin.set_log_level = set_log_level; - cadesplugin.getLastError = getLastError; - - if(isChromiumBased()) - { - cadesplugin.CreateObjectAsync = CreateObjectAsync; - } - - if(!isChromiumBased()) - { - cadesplugin.CreateObject = CreateObject; - } - - if(window.cadesplugin_load_timeout) - { - setTimeout(check_load_timeout, window.cadesplugin_load_timeout); - } - else - { - setTimeout(check_load_timeout, 20000); - } - - set_constantValues(); - - cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR; - window.cadesplugin = cadesplugin; - check_plugin_working(); -}()); diff --git a/src/original_src/cadesplugin_api_2.1.0.js b/src/original_src/cadesplugin_api_2.1.0.js deleted file mode 100644 index 7564459..0000000 --- a/src/original_src/cadesplugin_api_2.1.0.js +++ /dev/null @@ -1,620 +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 isYaBrowser = 0; - var isFireFox = 0; - var failed_extensions = 0; - - var canPromise = !!window.Promise; - var cadesplugin; - - if(canPromise) - { - cadesplugin = new Promise(function(resolve, reject) - { - plugin_resolve = resolve; - plugin_reject = reject; - }); - } else - { - cadesplugin = {}; - } - - function cpcsp_console_log(level, msg){ - //IE9 не может писать в консоль если не открыта вкладка developer tools - if(typeof(console) == 'undefined') - return; - if (level <= cadesplugin.current_log_level ){ - if (level == cadesplugin.LOG_LEVEL_DEBUG) - console.log("DEBUG: %s", msg); - if (level == cadesplugin.LOG_LEVEL_INFO) - console.info("INFO: %s", msg); - if (level == cadesplugin.LOG_LEVEL_ERROR) - console.error("ERROR: %s", msg); - return; - } - } - - function set_log_level(level){ - if (!((level == cadesplugin.LOG_LEVEL_DEBUG) || - (level == cadesplugin.LOG_LEVEL_INFO) || - (level == cadesplugin.LOG_LEVEL_ERROR))){ - cpcsp_console_log(cadesplugin.LOG_LEVEL_ERROR, "cadesplugin_api.js: Incorrect log_level: " + level); - return; - } - cadesplugin.current_log_level = level; - if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_DEBUG) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = DEBUG"); - if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_INFO) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = INFO"); - if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_ERROR) - cpcsp_console_log(cadesplugin.LOG_LEVEL_INFO, "cadesplugin_api.js: log_level = ERROR"); - if(isNativeMessageSupported()) - { - if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_DEBUG) - window.postMessage("set_log_level=debug", "*"); - if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_INFO) - window.postMessage("set_log_level=info", "*"); - if (cadesplugin.current_log_level == cadesplugin.LOG_LEVEL_ERROR) - window.postMessage("set_log_level=error", "*"); - } - } - - function set_constantValues() - { - cadesplugin.CAPICOM_LOCAL_MACHINE_STORE = 1; - cadesplugin.CAPICOM_CURRENT_USER_STORE = 2; - cadesplugin.CADESCOM_LOCAL_MACHINE_STORE = 1; - cadesplugin.CADESCOM_CURRENT_USER_STORE = 2; - cadesplugin.CADESCOM_CONTAINER_STORE = 100; - - cadesplugin.CAPICOM_MY_STORE = "My"; - - cadesplugin.CAPICOM_STORE_OPEN_MAXIMUM_ALLOWED = 2; - - cadesplugin.CAPICOM_CERTIFICATE_FIND_SUBJECT_NAME = 1; - - cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPED = 0; - cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_ENVELOPING = 1; - cadesplugin.CADESCOM_XML_SIGNATURE_TYPE_TEMPLATE = 2; - - cadesplugin.XmlDsigGost3410UrlObsolete = "http://www.w3.org/2001/04/xmldsig-more#gostr34102001-gostr3411"; - cadesplugin.XmlDsigGost3411UrlObsolete = "http://www.w3.org/2001/04/xmldsig-more#gostr3411"; - cadesplugin.XmlDsigGost3410Url = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr34102001-gostr3411"; - cadesplugin.XmlDsigGost3411Url = "urn:ietf:params:xml:ns:cpxmlsec:algorithms:gostr3411"; - - cadesplugin.CADESCOM_CADES_DEFAULT = 0; - cadesplugin.CADESCOM_CADES_BES = 1; - cadesplugin.CADESCOM_CADES_T = 0x5; - cadesplugin.CADESCOM_CADES_X_LONG_TYPE_1 = 0x5d; - - cadesplugin.CADESCOM_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.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_NAME = 1; - cadesplugin.CADESCOM_AUTHENTICATED_ATTRIBUTE_DOCUMENT_DESCRIPTION = 2; - cadesplugin.CADESCOM_ATTRIBUTE_OTHER = -1; - - cadesplugin.CADESCOM_STRING_TO_UCS2LE = 0; - cadesplugin.CADESCOM_BASE64_TO_BINARY = 1; - - cadesplugin.CADESCOM_DISPLAY_DATA_NONE = 0; - cadesplugin.CADESCOM_DISPLAY_DATA_CONTENT = 1; - cadesplugin.CADESCOM_DISPLAY_DATA_ATTRIBUTE = 2; - - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC2 = 0; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_RC4 = 1; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_DES = 2; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_3DES = 3; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_AES = 4; - cadesplugin.CADESCOM_ENCRYPTION_ALGORITHM_GOST_28147_89 = 25; - - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA1 = 0; - cadesplugin.CADESCOM_HASH_ALGORITHM_MD2 = 1; - cadesplugin.CADESCOM_HASH_ALGORITHM_MD4 = 2; - cadesplugin.CADESCOM_HASH_ALGORITHM_MD5 = 3; - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_256 = 4; - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_384 = 5; - cadesplugin.CADESCOM_HASH_ALGORITHM_SHA_512 = 6; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411 = 100; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256 = 101; - cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_512 = 102; - - cadesplugin.LOG_LEVEL_DEBUG = 4; - cadesplugin.LOG_LEVEL_INFO = 2; - cadesplugin.LOG_LEVEL_ERROR = 1; - } - - 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 retVal; - } - - function isIOS() { - var retVal = (navigator.userAgent.match(/ipod/i) || - navigator.userAgent.match(/ipad/i) || - navigator.userAgent.match(/iphone/i)); - return retVal; - } - - function isNativeMessageSupported() - { - var retVal_chrome = navigator.userAgent.match(/chrome/i); - isOpera = navigator.userAgent.match(/opr/i); - isYaBrowser = navigator.userAgent.match(/YaBrowser/i); - isFireFox = navigator.userAgent.match(/Firefox/i); - - if(isFireFox && window.allow_firefox_cadesplugin_async) - return true; - - if(retVal_chrome == null) // В IE работаем через NPAPI - return false; - else - { - // В Chrome и Opera работаем через асинхронную версию - if(retVal_chrome.length > 0 || isOpera != null ) - { - return true; - } - } - 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("certEnrollClassFactory"); - return objCertEnrollClassFactory.CreateObject(name); - } - catch (e) { - 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); - } - } - // В Firefox, Safari создаются объекты 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); - } - } - - // Функция активации асинхронных объектов КриптоПро ЭЦП 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; - } - - //Выводим окно поверх других с предложением установить расширение для Opera. - //Если установленна переменная cadesplugin_skip_extension_install - не предлагаем установить расширение - function install_opera_extension() - { - if (!window.cadesplugin_skip_extension_install) - { - document.addEventListener('DOMContentLoaded', function() { - var ovr = document.createElement('div'); - ovr.id = "cadesplugin_ovr"; - ovr.style = "visibility: hidden; position: fixed; left: 0px; top: 0px; width:100%; height:100%; background-color: rgba(0,0,0,0.7)"; - ovr.innerHTML = "
" + - "" + - "

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

" + - "
"; - document.getElementsByTagName("Body")[0].appendChild(ovr); - var btn_install = document.getElementById("cadesplugin_install"); - btn_install.addEventListener('click', function(event) { - opr.addons.installExtension("epebfcehmdedogndhlcacafjaacknbcm", - function() - { - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - location.reload(); - }, - function(){}) - }); - document.getElementById("cadesplugin_close_install").addEventListener('click',function() - { - plugin_loaded_error("Плагин недоступен"); - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - }); - - ovr.addEventListener('click',function() - { - plugin_loaded_error("Плагин недоступен"); - document.getElementById("cadesplugin_ovr").style.visibility = 'hidden'; - }); - ovr.style.visibility="visible"; - document.getElementById("cadesplugin_ovr_item").addEventListener('click',function(e){ - e.stopPropagation(); - }); - }); - }else - { - plugin_loaded_error("Плагин недоступен"); - } - } - - function firefox_nmcades_onload() { - cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error); - } - - function nmcades_api_onload () { - window.postMessage("cadesplugin_echo_request", "*"); - window.addEventListener("message", function (event){ - if (typeof(event.data) != "string" || !event.data.match("cadesplugin_loaded")) - return; - if(isFireFox) - { - // Для Firefox вместе с сообщением cadesplugin_loaded прилетает url для загрузки nmcades_plugin_api.js - var url = event.data.substring(event.data.indexOf("url:") + 4); - var fileref = document.createElement('script'); - fileref.setAttribute("type", "text/javascript"); - fileref.setAttribute("src", url); - fileref.onerror = plugin_loaded_error; - fileref.onload = firefox_nmcades_onload; - document.getElementsByTagName("head")[0].appendChild(fileref); - - }else { - cpcsp_chrome_nmcades.check_chrome_plugin(plugin_loaded, plugin_loaded_error); - } - }, false); - } - - //Загружаем расширения для Chrome, Opera, YaBrowser, FireFox, Edge - function load_extension() - { - - if(isFireFox){ - // вызываем callback руками т.к. нам нужно узнать ID расширения. Он уникальный для браузера. - nmcades_api_onload(); - return; - } else { - // в асинхронном варианте для chrome и opera подключаем оба расширения - var fileref = document.createElement('script'); - fileref.setAttribute("type", "text/javascript"); - fileref.setAttribute("src", "chrome-extension://iifchhfnnmpdbibifmljnfjhpififfog/nmcades_plugin_api.js"); - fileref.onerror = plugin_loaded_error; - fileref.onload = nmcades_api_onload; - document.getElementsByTagName("head")[0].appendChild(fileref); - fileref = document.createElement('script'); - fileref.setAttribute("type", "text/javascript"); - fileref.setAttribute("src", "chrome-extension://epebfcehmdedogndhlcacafjaacknbcm/nmcades_plugin_api.js"); - fileref.onerror = plugin_loaded_error; - fileref.onload = nmcades_api_onload; - document.getElementsByTagName("head")[0].appendChild(fileref); - } - } - - //Загружаем плагин для NPAPI - function load_npapi_plugin() - { - var elem = document.createElement('object'); - elem.setAttribute("id", "cadesplugin_object"); - elem.setAttribute("type", "application/x-cades"); - elem.setAttribute("style", "visibility: hidden"); - document.getElementsByTagName("body")[0].appendChild(elem); - pluginObject = document.getElementById("cadesplugin_object"); - if(isIE()) - { - var elem1 = document.createElement('object'); - elem1.setAttribute("id", "certEnrollClassFactory"); - elem1.setAttribute("classid", "clsid:884e2049-217d-11da-b2a4-000e7bbb2b09"); - elem1.setAttribute("style", "visibility: hidden"); - document.getElementsByTagName("body")[0].appendChild(elem1); - var elem2 = document.createElement('object'); - elem2.setAttribute("id", "webClassFactory"); - elem2.setAttribute("classid", "clsid:B04C8637-10BD-484E-B0DA-B8A039F60024"); - elem2.setAttribute("style", "visibility: hidden"); - document.getElementsByTagName("body")[0].appendChild(elem2); - } - } - - //Отправляем событие что все ок. - function plugin_loaded() - { - plugin_resolved = 1; - if(canPromise) - { - plugin_resolve(); - }else { - window.postMessage("cadesplugin_loaded", "*"); - } - } - - //Отправляем событие что сломались. - function plugin_loaded_error(msg) - { - if(isNativeMessageSupported()) - { - //в асинхронном варианте подключаем оба расширения, если сломались оба пробуем установить для Opera - failed_extensions++; - if(failed_extensions<2) - return; - if(isOpera && (typeof(msg) == 'undefined'|| typeof(msg) == 'object')) - { - install_opera_extension(); - return; - } - } - if(typeof(msg) == 'undefined' || typeof(msg) == 'object') - msg = "Плагин недоступен"; - plugin_resolved = 1; - if(canPromise) - { - plugin_reject(msg); - } else { - window.postMessage("cadesplugin_load_error", "*"); - } - } - - //проверяем что у нас хоть какое то событие ушло, и если не уходило кидаем еще раз ошибку - function check_load_timeout() - { - if(plugin_resolved == 1) - return; - 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("iecheck").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 - { - window.addEventListener("load", function (event) { - load_npapi_plugin(); - check_npapi_plugin(); - }, false); - } - } - - function set_pluginObject(obj) - { - pluginObject = obj; - } - - //Export - cadesplugin.JSModuleVersion = "2.1.0"; - cadesplugin.async_spawn = async_spawn; - cadesplugin.set = set_pluginObject; - cadesplugin.set_log_level = set_log_level; - cadesplugin.getLastError = getLastError; - - if(isNativeMessageSupported()) - { - cadesplugin.CreateObjectAsync = CreateObjectAsync; - } - - if(!isNativeMessageSupported()) - { - cadesplugin.CreateObject = CreateObject; - } - - if(window.cadesplugin_load_timeout) - { - setTimeout(check_load_timeout, window.cadesplugin_load_timeout); - } - else - { - setTimeout(check_load_timeout, 20000); - } - - set_constantValues(); - - cadesplugin.current_log_level = cadesplugin.LOG_LEVEL_ERROR; - window.cadesplugin = cadesplugin; - check_plugin_working(); -}()); diff --git a/src/cades.js b/vendor/cadesplugin_api.js similarity index 100% rename from src/cades.js rename to vendor/cadesplugin_api.js