From 895acf2a850efd302781880156266900e1621459 Mon Sep 17 00:00:00 2001 From: Artem Vasilev Date: Thu, 20 Oct 2022 20:06:50 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D1=86=D0=B5=D1=81=D1=81=20?= =?UTF-8?q?=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=BA=D0=B8=20=D0=B1?= =?UTF-8?q?=D0=B8=D0=B1=D0=BB=D0=B8=D0=BE=D1=82=D0=B5=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Certificate.php | 87 ++++++++++++++ src/CryptoPro.php | 107 ++++++++++++++++++ src/Helpers/CertificateHelper.php | 70 ++++++++++++ .../Messages/HumanReadebleCPErrors.php | 8 ++ src/Tags/AbstractTagsCodes.php | 20 ++++ src/Tags/AbstractTagsOIDs.php | 25 ++++ src/Tags/AbstractTagsTranslations.php | 13 +++ src/Tags/IssuerTagsTranslations.php | 25 ++++ src/Tags/SubjectTagsTranslations.php | 27 +++++ src/Tags/TagsCodes.php | 27 +++++ src/Tags/TagsCodesInterface.php | 8 ++ src/Tags/TagsOIDs.php | 27 +++++ src/Tags/TagsOIDsInterface.php | 10 ++ src/Tags/TagsTranslationsInterface.php | 8 ++ src/Traits/ReversMapInterface.php | 8 ++ src/Traits/ReversMapTrait.php | 37 ++++++ 16 files changed, 507 insertions(+) create mode 100755 src/Certificate.php create mode 100755 src/Helpers/CertificateHelper.php create mode 100755 src/Helpers/Messages/HumanReadebleCPErrors.php create mode 100755 src/Tags/AbstractTagsCodes.php create mode 100755 src/Tags/AbstractTagsOIDs.php create mode 100755 src/Tags/AbstractTagsTranslations.php create mode 100755 src/Tags/IssuerTagsTranslations.php create mode 100755 src/Tags/SubjectTagsTranslations.php create mode 100755 src/Tags/TagsCodes.php create mode 100755 src/Tags/TagsCodesInterface.php create mode 100755 src/Tags/TagsOIDs.php create mode 100755 src/Tags/TagsOIDsInterface.php create mode 100755 src/Tags/TagsTranslationsInterface.php create mode 100755 src/Traits/ReversMapInterface.php create mode 100755 src/Traits/ReversMapTrait.php diff --git a/src/Certificate.php b/src/Certificate.php new file mode 100755 index 0000000..08db78b --- /dev/null +++ b/src/Certificate.php @@ -0,0 +1,87 @@ + $title, 'description' => $description, 'code' => $titleCode]; + + }, $extractedEntities); + } + + return []; + } +} \ No newline at end of file diff --git a/src/Helpers/Messages/HumanReadebleCPErrors.php b/src/Helpers/Messages/HumanReadebleCPErrors.php new file mode 100755 index 0000000..9f6e9b2 --- /dev/null +++ b/src/Helpers/Messages/HumanReadebleCPErrors.php @@ -0,0 +1,8 @@ + 'Неструктурированное имя', + 'CN' => 'Удостоверяющий центр', + 'C' => 'Страна', + 'S' => 'Регион', + 'STREET' => 'Адрес', + 'O' => 'Компания', + 'OU' => 'Тип', + 'T' => 'Должность', + 'OGRN' => 'ОГРН', + 'OGRNIP' => 'ОГРНИП', + 'SNILS' => 'СНИЛС', + 'INN' => 'ИНН', + 'INNLE' => 'ИНН рганизации', + 'E' => 'Email', + 'L' => 'Город', + ]; +} \ No newline at end of file diff --git a/src/Tags/SubjectTagsTranslations.php b/src/Tags/SubjectTagsTranslations.php new file mode 100755 index 0000000..36975ce --- /dev/null +++ b/src/Tags/SubjectTagsTranslations.php @@ -0,0 +1,27 @@ + 'Неструктурированное имя', + 'CN' => 'Владелец', + 'SN' => 'Фамилия', + 'G' => 'Имя Отчество', + 'C' => 'Страна', + 'S' => 'Регион', + 'STREET' => 'Адрес', + 'O' => 'Компания', + 'OU' => 'Отдел/подразделение', + 'T' => 'Должность', + 'OGRN' => 'ОГРН', + 'OGRNIP' => 'ОГРНИП', + 'SNILS' => 'СНИЛС', + 'INN' => 'ИНН', + 'INNLE' => 'ИНН рганизации', + 'E' => 'Email', + 'L' => 'Город', + ]; +} \ No newline at end of file diff --git a/src/Tags/TagsCodes.php b/src/Tags/TagsCodes.php new file mode 100755 index 0000000..a3d79a1 --- /dev/null +++ b/src/Tags/TagsCodes.php @@ -0,0 +1,27 @@ + ['UN', 'unstructuredName'], + 'CN' => ['CN', 'commonName'], + 'SN' => ['SN', 'surname'], + 'G' => ['G', 'givenName', 'gn'], + 'C' => ['C', 'countryName'], + 'S' => ['S', 'ST', 'stateOrProvinceName'], + 'STREET' => ['STREET', 'streetAddress'], + 'O' => ['O', 'organizationName'], + 'OU' => ['OU', 'organizationalUnitName'], + 'T' => ['T', 'TITLE'], + 'OGRN' => ['OGRN', 'ОГРН'], + 'OGRNIP' => ['OGRNIP', 'ОГРНИП'], + 'SNILS' => ['СНИЛС', 'SNILS'], + 'INN' => ['ИНН', 'ИННФЛ', 'ИНН ФЛ', 'INN'], + 'INNLE' => ['ИННЮЛ', 'ИНН ЮЛ', 'INNLE', 'INN LE', 'ИНН организации'], + 'E' => ['E', 'email', 'emailAddress', 'pkcs9email'], + 'L' => ['L', 'localityName'], + ]; +} \ No newline at end of file diff --git a/src/Tags/TagsCodesInterface.php b/src/Tags/TagsCodesInterface.php new file mode 100755 index 0000000..a674385 --- /dev/null +++ b/src/Tags/TagsCodesInterface.php @@ -0,0 +1,8 @@ + 'UN', + '2.5.4.3' => 'CN', + '2.5.4.4' => 'SN', + '2.5.4.42' => 'G', + '2.5.4.6' => 'C', + '2.5.4.8' => 'S', + '2.5.4.9' => 'STREET', + '2.5.4.10' => 'O', + '2.5.4.11' => 'OU', + '2.5.4.12' => 'T', + '1.2.643.100.1' => 'OGRN', + '1.2.643.100.5' => 'OGRNIP', + '1.2.643.100.3' => 'SNILS', + '1.2.643.3.131.1.1' => 'INN', + '1.2.643.100.4' => 'INNLE', + '1.2.840.113549.1.9.1' => 'E', + '2.5.4.7' => 'L', + ]; +} \ No newline at end of file diff --git a/src/Tags/TagsOIDsInterface.php b/src/Tags/TagsOIDsInterface.php new file mode 100755 index 0000000..bb5637f --- /dev/null +++ b/src/Tags/TagsOIDsInterface.php @@ -0,0 +1,10 @@ + $values) + { + if (is_object($values)) + { + $values = (array) $values; + } + + if (!is_array($values)) + { + $reverseMap[strtolower((string) $values)] = $key; + } + else + { + foreach ($values as $value) + { + $reverseMap[strtolower($value)] = $key; + } + } + } + } + + return $reverseMap; + } +} \ No newline at end of file