From 55305a1b7863a28ae7d0b0d7f5436b25dcea92f7 Mon Sep 17 00:00:00 2001 From: Sultanov Shamil Date: Thu, 26 May 2022 20:10:05 +0500 Subject: [PATCH 1/3] =?UTF-8?q?bug(cryptopro-cades):=20=D0=98=D1=81=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=B8=D1=82=D1=8C=20=D0=BF=D0=B0=D1=80=D1=81?= =?UTF-8?q?=D0=B8=D0=BD=D0=B3=20=D1=80=D0=B5=D0=B3=D0=B8=D0=BE=D0=BD=D0=B0?= =?UTF-8?q?=20=D0=B8=D0=B7=20=D1=81=D0=B5=D1=80=D1=82=D0=B8=D1=84=D0=B8?= =?UTF-8?q?=D0=BA=D0=B0=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #23 --- packages/cryptopro-cades/src/Certificate.ts | 2 ++ packages/cryptopro-cades/src/constants/oids-dictionary.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/cryptopro-cades/src/Certificate.ts b/packages/cryptopro-cades/src/Certificate.ts index 32e4d08..5fa3279 100644 --- a/packages/cryptopro-cades/src/Certificate.ts +++ b/packages/cryptopro-cades/src/Certificate.ts @@ -18,6 +18,7 @@ export class Certificate { surname: string | null; name: string | null; country: string | null; + region: string | null; locality: string | null; street: string | null; organization: string | null; @@ -34,6 +35,7 @@ export class Certificate { surname: null, name: null, country: null, + region: null, locality: null, street: null, organization: null, diff --git a/packages/cryptopro-cades/src/constants/oids-dictionary.ts b/packages/cryptopro-cades/src/constants/oids-dictionary.ts index 46f1150..86806da 100644 --- a/packages/cryptopro-cades/src/constants/oids-dictionary.ts +++ b/packages/cryptopro-cades/src/constants/oids-dictionary.ts @@ -34,7 +34,8 @@ export const attributeOids = { surname: '2.5.4.4', name: '2.5.4.42', country: '2.5.4.6', - locality: '2.5.4.8', + locality: '2.5.4.7', + region: '2.5.4.8', street: '2.5.4.9', organisation: '2.5.4.10', department: '2.5.4.11', From 632d3506feab8815387fdf230f18563eac475d0d Mon Sep 17 00:00:00 2001 From: Sultanov Shamil Date: Thu, 26 May 2022 21:42:53 +0500 Subject: [PATCH 2/3] =?UTF-8?q?feat(cryptopro-cades):=20=D0=A3=D0=BB=D1=83?= =?UTF-8?q?=D1=87=D1=88=D0=B8=D1=82=D1=8C=20=D1=81=D0=B8=D1=81=D1=82=D0=B5?= =?UTF-8?q?=D0=BC=D1=83=20=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=B8=20=D0=BB=D0=BE=D0=B3=D0=B8=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA?= =?UTF-8?q?,=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B=20?= =?UTF-8?q?=D1=82=D0=BE=D1=87=D0=BA=D0=B8=20=D1=80=D0=B0=D1=81=D1=88=D0=B8?= =?UTF-8?q?=D1=80=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=20=D0=B1=D0=B8=D0=B1?= =?UTF-8?q?=D0=BB=D0=B8=D0=BE=D1=82=D0=B5=D0=BA=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Теперь можно настроить список криптопровайдеров с которым плагин будет работать (нужно указать тип и название). * Добавлена функция для переопределения проверки требуемой версии CSP. --- examples/cryptopro-cades/src/App.tsx | 15 ++++ packages/cryptopro-cades/src/Certificate.ts | 1 + packages/cryptopro-cades/src/PluginConfig.ts | 22 +++++- ...temSetup.ts => checkIsValidSystemSetup.ts} | 22 +++--- .../cryptopro-cades/src/api/createObject.ts | 8 +- packages/cryptopro-cades/src/api/decrypt.ts | 1 + packages/cryptopro-cades/src/api/encrypt.ts | 1 + .../src/api/findCertificateBySkid.ts | 1 + .../src/api/findCertificateByThumbprint.ts | 1 + .../cryptopro-cades/src/api/getCertInfo.ts | 6 +- .../src/api/getCertificates.ts | 7 +- .../src/api/getCryptoProviders.ts | 11 ++- .../cryptopro-cades/src/api/getLastError.ts | 2 +- .../cryptopro-cades/src/api/getSystemInfo.ts | 2 +- packages/cryptopro-cades/src/api/index.ts | 2 +- .../src/api/internal/afterPluginLoaded.ts | 4 +- .../src/api/internal/canAsync.ts | 2 +- .../internal/checkIsSupportedCSPVersion.ts | 78 +++++++++++++++++++ .../src/api/internal/getCryptoProperty.ts | 18 ----- .../src/api/internal/isSupportedCSPVersion.ts | 55 ------------- packages/cryptopro-cades/src/api/openStore.ts | 1 + packages/cryptopro-cades/src/api/sign.ts | 1 + packages/cryptopro-cades/src/api/signXml.ts | 3 + .../src/api/validateCertificate.ts | 1 + .../src/constants/cryptoProviders.ts | 9 ++- .../cryptopro-cades/src/errors/CryptoError.ts | 4 +- .../cryptopro-cades/src/errors/errorCodes.ts | 8 +- packages/cryptopro-cades/src/errors/index.ts | 1 + .../src/types/ICryptoProvider.ts | 6 +- .../src/utils/certificateParser.ts | 63 ++++++++------- packages/cryptopro-cades/src/utils/index.ts | 3 +- packages/cryptopro-cades/src/utils/output.ts | 36 +++++++++ .../cryptopro-cades/src/utils/outputDebug.ts | 11 --- .../cryptopro-cades/src/utils/outputError.ts | 7 -- 34 files changed, 253 insertions(+), 160 deletions(-) rename packages/cryptopro-cades/src/api/{isValidSystemSetup.ts => checkIsValidSystemSetup.ts} (68%) create mode 100644 packages/cryptopro-cades/src/api/internal/checkIsSupportedCSPVersion.ts delete mode 100644 packages/cryptopro-cades/src/api/internal/getCryptoProperty.ts delete mode 100644 packages/cryptopro-cades/src/api/internal/isSupportedCSPVersion.ts create mode 100644 packages/cryptopro-cades/src/utils/output.ts delete mode 100644 packages/cryptopro-cades/src/utils/outputDebug.ts delete mode 100644 packages/cryptopro-cades/src/utils/outputError.ts diff --git a/examples/cryptopro-cades/src/App.tsx b/examples/cryptopro-cades/src/App.tsx index 973e130..d148d34 100644 --- a/examples/cryptopro-cades/src/App.tsx +++ b/examples/cryptopro-cades/src/App.tsx @@ -20,6 +20,7 @@ import { ICertificate, ICryptoProvider, ISystemInfo, + checkIsValidSystemSetup, } from '@astral/cryptopro-cades'; import { CertificateInfo } from './components/CertificateInfo'; @@ -319,10 +320,24 @@ const CryptoApp = () => { } }; + /** + * Проверить систему. + */ + async function checkSystem() { + try { + await checkIsValidSystemSetup(); + window.alert('checkSystem: ok'); + } catch (error) { + outputError(error); + window.alert(error.toString()); + } + } + return ( <>

Версия плагина {versionInfo?.cadesVersion}

Версия криптопровайдера {versionInfo?.cspVersion}

+