This commit is contained in:
vgoma 2023-06-22 06:15:02 +03:00
parent 36ed5a3481
commit fb28c06cb1
18 changed files with 54 additions and 11289 deletions

View File

@ -1,9 +1,10 @@
/** /**
* Создает хеш сообщения по ГОСТ Р 34.11-2012 256 бит * Создает хеш сообщения по ГОСТ Р 34.11-2012 (по умолчанию 256 бит)
* https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%B8%D0%B1%D0%BE%D0%B3_(%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F) * https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%B8%D0%B1%D0%BE%D0%B3_(%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F)
* *
* @param unencryptedMessage - сообщение для хеширования * @param unencryptedMessage - сообщение для хеширования
* @hashedAlgorithm - алгоритм хеширования. По умолчанию - CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256.
* *
* @returns хеш * @returns хеш
*/ */
export declare const createHash: (unencryptedMessage: string | ArrayBuffer) => Promise<string>; export declare const createHash: (unencryptedMessage: string | ArrayBuffer, hashedAlgorithm?: number) => Promise<string>;

View File

@ -1,4 +1,4 @@
// Type definitions for crypto-pro 2.3.2 // Type definitions for crypto-pro 2.4.0
// Project: crypto-pro // Project: crypto-pro
// Definitions by: Vitalii Goma https://github.com/vgoma // Definitions by: Vitalii Goma https://github.com/vgoma

7
dist/crypto-pro.js vendored
View File

@ -3039,14 +3039,15 @@ var _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLoad
var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); var _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts");
var _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); var _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts");
/** /**
* Создает хеш сообщения по ГОСТ Р 34.11-2012 256 бит * Создает хеш сообщения по ГОСТ Р 34.11-2012 (по умолчанию 256 бит)
* https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%B8%D0%B1%D0%BE%D0%B3_(%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F) * https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%B8%D0%B1%D0%BE%D0%B3_(%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F)
* *
* @param unencryptedMessage - сообщение для хеширования * @param unencryptedMessage - сообщение для хеширования
* @hashedAlgorithm - алгоритм хеширования. По умолчанию - CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256.
* *
* @returns хеш * @returns хеш
*/ */
exports.createHash = _afterPluginsLoaded_1._afterPluginsLoaded(function (unencryptedMessage) { return __awaiter(void 0, void 0, void 0, function () { exports.createHash = _afterPluginsLoaded_1._afterPluginsLoaded(function (unencryptedMessage, hashedAlgorithm) { return __awaiter(void 0, void 0, void 0, function () {
var cadesplugin; var cadesplugin;
return __generator(this, function (_a) { return __generator(this, function (_a) {
cadesplugin = window.cadesplugin; cadesplugin = window.cadesplugin;
@ -3063,7 +3064,7 @@ exports.createHash = _afterPluginsLoaded_1._afterPluginsLoaded(function (unencry
} }
try { try {
void (_generateCadesFn_1.__cadesAsyncToken__ + void (_generateCadesFn_1.__cadesAsyncToken__ +
cadesHashedData.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256)); cadesHashedData.propset_Algorithm(hashedAlgorithm !== null && hashedAlgorithm !== void 0 ? hashedAlgorithm : cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256));
void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.propset_DataEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY)); void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.propset_DataEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));
void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.Hash(messageBase64)); void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.Hash(messageBase64));
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,7 @@
"@angular/platform-browser": "^15.0.0", "@angular/platform-browser": "^15.0.0",
"@angular/platform-browser-dynamic": "^15.0.0", "@angular/platform-browser-dynamic": "^15.0.0",
"@angular/router": "^15.0.0", "@angular/router": "^15.0.0",
"crypto-pro": "^2.3.2", "crypto-pro": "^2.4.0",
"rxjs": "~7.5.0", "rxjs": "~7.5.0",
"tslib": "^2.3.0", "tslib": "^2.3.0",
"zone.js": "~0.12.0" "zone.js": "~0.12.0"

View File

@ -3712,9 +3712,9 @@
} }
}, },
"crypto-pro": { "crypto-pro": {
"version": "2.3.2", "version": "2.4.0",
"resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.3.2.tgz", "resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.4.0.tgz",
"integrity": "sha512-KniSHNSsM1726pcxhc22QR0iBR0InSehxvTlTXXd+TAQkqIqLUalt87/3lzxZW/yfrMJGFijETK3ksmhe9sCfg==" "integrity": "sha512-zrUkrr5YwXv7yu5Tte7b2vvRPeHG9HvRYCViD6JRh1YQBKu6K/+1+aRsy7iXNwHePPZWIi4vXepun4X/G+ykwQ=="
}, },
"css": { "css": {
"version": "2.2.4", "version": "2.2.4",

View File

@ -7,7 +7,7 @@
"@testing-library/jest-dom": "4.2.4", "@testing-library/jest-dom": "4.2.4",
"@testing-library/react": "9.5.0", "@testing-library/react": "9.5.0",
"@testing-library/user-event": "7.2.1", "@testing-library/user-event": "7.2.1",
"crypto-pro": "^2.3.2", "crypto-pro": "^2.4.0",
"react": "^16.13.1", "react": "^16.13.1",
"react-app-polyfill": "1.0.6", "react-app-polyfill": "1.0.6",
"react-dom": "^16.13.1", "react-dom": "^16.13.1",

View File

@ -42,9 +42,9 @@
"dev": true "dev": true
}, },
"crypto-pro": { "crypto-pro": {
"version": "2.3.2", "version": "2.4.0",
"resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.3.2.tgz", "resolved": "https://registry.npmjs.org/crypto-pro/-/crypto-pro-2.4.0.tgz",
"integrity": "sha512-KniSHNSsM1726pcxhc22QR0iBR0InSehxvTlTXXd+TAQkqIqLUalt87/3lzxZW/yfrMJGFijETK3ksmhe9sCfg==" "integrity": "sha512-zrUkrr5YwXv7yu5Tte7b2vvRPeHG9HvRYCViD6JRh1YQBKu6K/+1+aRsy7iXNwHePPZWIi4vXepun4X/G+ykwQ=="
}, },
"fs.realpath": { "fs.realpath": {
"version": "1.0.0", "version": "1.0.0",

View File

@ -13,6 +13,6 @@
"symlink-dir": "3.1.2" "symlink-dir": "3.1.2"
}, },
"dependencies": { "dependencies": {
"crypto-pro": "^2.3.2" "crypto-pro": "^2.4.0"
} }
} }

View File

@ -1,9 +1,10 @@
/** /**
* Создает хеш сообщения по ГОСТ Р 34.11-2012 256 бит * Создает хеш сообщения по ГОСТ Р 34.11-2012 (по умолчанию 256 бит)
* https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%B8%D0%B1%D0%BE%D0%B3_(%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F) * https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%B8%D0%B1%D0%BE%D0%B3_(%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F)
* *
* @param unencryptedMessage - сообщение для хеширования * @param unencryptedMessage - сообщение для хеширования
* @hashedAlgorithm - алгоритм хеширования. По умолчанию - CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256.
* *
* @returns хеш * @returns хеш
*/ */
export declare const createHash: (unencryptedMessage: string | ArrayBuffer) => Promise<string>; export declare const createHash: (unencryptedMessage: string | ArrayBuffer, hashedAlgorithm?: number) => Promise<string>;

2
lib/crypto-pro.d.ts vendored
View File

@ -1,4 +1,4 @@
// Type definitions for crypto-pro 2.3.2 // Type definitions for crypto-pro 2.4.0
// Project: crypto-pro // Project: crypto-pro
// Definitions by: Vitalii Goma https://github.com/vgoma // Definitions by: Vitalii Goma https://github.com/vgoma

View File

@ -2826,14 +2826,15 @@ const _afterPluginsLoaded_1 = __webpack_require__(/*! ../helpers/_afterPluginsLo
const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts"); const _extractMeaningfulErrorMessage_1 = __webpack_require__(/*! ../helpers/_extractMeaningfulErrorMessage */ "./helpers/_extractMeaningfulErrorMessage.ts");
const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts"); const _generateCadesFn_1 = __webpack_require__(/*! ../helpers/_generateCadesFn */ "./helpers/_generateCadesFn.ts");
/** /**
* Создает хеш сообщения по ГОСТ Р 34.11-2012 256 бит * Создает хеш сообщения по ГОСТ Р 34.11-2012 (по умолчанию 256 бит)
* https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%B8%D0%B1%D0%BE%D0%B3_(%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F) * https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%B8%D0%B1%D0%BE%D0%B3_(%D1%85%D0%B5%D1%88-%D1%84%D1%83%D0%BD%D0%BA%D1%86%D0%B8%D1%8F)
* *
* @param unencryptedMessage - сообщение для хеширования * @param unencryptedMessage - сообщение для хеширования
* @hashedAlgorithm - алгоритм хеширования. По умолчанию - CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256.
* *
* @returns хеш * @returns хеш
*/ */
exports.createHash = _afterPluginsLoaded_1._afterPluginsLoaded((unencryptedMessage) => __awaiter(void 0, void 0, void 0, function* () { exports.createHash = _afterPluginsLoaded_1._afterPluginsLoaded((unencryptedMessage, hashedAlgorithm) => __awaiter(void 0, void 0, void 0, function* () {
const { cadesplugin } = window; const { cadesplugin } = window;
return eval(_generateCadesFn_1._generateCadesFn(function createHash() { return eval(_generateCadesFn_1._generateCadesFn(function createHash() {
const cadesHashedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.HashedData'); const cadesHashedData = _generateCadesFn_1.__cadesAsyncToken__ + _generateCadesFn_1.__createCadesPluginObject__('CAdESCOM.HashedData');
@ -2848,7 +2849,7 @@ exports.createHash = _afterPluginsLoaded_1._afterPluginsLoaded((unencryptedMessa
} }
try { try {
void (_generateCadesFn_1.__cadesAsyncToken__ + void (_generateCadesFn_1.__cadesAsyncToken__ +
cadesHashedData.propset_Algorithm(cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256)); cadesHashedData.propset_Algorithm(hashedAlgorithm !== null && hashedAlgorithm !== void 0 ? hashedAlgorithm : cadesplugin.CADESCOM_HASH_ALGORITHM_CP_GOST_3411_2012_256));
void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.propset_DataEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY)); void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.propset_DataEncoding(cadesplugin.CADESCOM_BASE64_TO_BINARY));
void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.Hash(messageBase64)); void (_generateCadesFn_1.__cadesAsyncToken__ + cadesHashedData.Hash(messageBase64));
} }

File diff suppressed because one or more lines are too long

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "crypto-pro", "name": "crypto-pro",
"version": "2.3.2", "version": "2.4.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "crypto-pro", "name": "crypto-pro",
"version": "2.3.2", "version": "2.4.0",
"description": "API для взаимодействия с КриптоПро", "description": "API для взаимодействия с КриптоПро",
"main": "./lib/crypto-pro.js", "main": "./lib/crypto-pro.js",
"types": "./lib/crypto-pro.d.ts", "types": "./lib/crypto-pro.d.ts",
@ -30,6 +30,7 @@
"examples-update:angular": "npm --prefix ./examples/angular r crypto-pro && npm --prefix ./examples/angular i crypto-pro", "examples-update:angular": "npm --prefix ./examples/angular r crypto-pro && npm --prefix ./examples/angular i crypto-pro",
"examples-update:react": "npm --prefix ./examples/react r crypto-pro && npm --prefix ./examples/react i crypto-pro", "examples-update:react": "npm --prefix ./examples/react r crypto-pro && npm --prefix ./examples/react i crypto-pro",
"prepack": "npm run build", "prepack": "npm run build",
"postpack": "npm run pack:uncompress && npm run pack:clean",
"prepublishOnly": "npm run lint && jest && npm run build", "prepublishOnly": "npm run lint && jest && npm run build",
"postpublish": "npm run examples-update" "postpublish": "npm run examples-update"
}, },