From f160e0066f9acc40c6ebce96bd7161b6d79169de Mon Sep 17 00:00:00 2001 From: Artem Vasilev Date: Mon, 5 Jun 2023 22:12:07 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B8=D1=88=D0=B5=D0=BC=20=D0=B4=D0=BE?= =?UTF-8?q?=D0=BA=D1=83=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D1=86=D0=B8=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitattributes | 0 .github/workflows/static-analysis.yml | 0 .gitignore | 0 README.md | 60 ++++++++++++++++++- composer.json | 0 doc/ATTRIBUTES.md | 0 doc/GET-TEST-CERT.md | 0 docs/api/CryptoPro/addAttachedSignature.md | 1 + docs/api/CryptoPro/addDetachedSignature.md | 1 + docs/api/CryptoPro/createAttachedSignature.md | 1 + docs/api/CryptoPro/createDetachedSignature.md | 1 + docs/api/CryptoPro/createHash.md | 1 + .../CryptoPro/getAllContainerCertificates.md | 1 + docs/api/CryptoPro/getAllUserCertificates.md | 1 + docs/api/CryptoPro/getCertificate.md | 1 + .../api/CryptoPro/getContainerCertificates.md | 1 + docs/api/CryptoPro/getSystemInfo.md | 1 + docs/api/CryptoPro/getUserCertificates.md | 1 + docs/api/CryptoPro/isValidSystemSetup.md | 1 + examples/list_of_all_valid_certificates.php | 0 phpstan.neon | 0 src/Certificate.php | 0 src/Constants/CADESCOM_ATTRIBUTE.php | 0 src/Constants/CADESCOM_CADES_TYPE.php | 0 .../CADESCOM_CONTENT_ENCODING_TYPE.php | 0 src/Constants/CADESCOM_DISPLAY_DATA.php | 0 src/Constants/CADESCOM_ENCODING_TYPE.php | 0 .../CADESCOM_ENCRYPTION_ALGORITHM.php | 0 src/Constants/CADESCOM_HASH_ALGORITHM.php | 0 src/Constants/CADESCOM_STORE_LOCATION.php | 0 .../CAPICOM_CERTIFICATE_FIND_TYPE.php | 0 .../CAPICOM_CERTIFICATE_INCLUDE_OPTION.php | 0 src/Constants/CAPICOM_PROPID.php | 0 src/Constants/CAPICOM_STORE_LOCATION.php | 0 src/Constants/CAPICOM_STORE_OPEN_MODE.php | 0 src/CryptoPro.php | 0 src/Dictionary/AbstractDictionary.php | 0 src/Dictionary/AbstractTagsDictionary.php | 0 src/Dictionary/AdditionalTagsDictionary.php | 0 src/Dictionary/DescriptionAwareInterface.php | 0 src/Dictionary/DictionaryInterface.php | 0 src/Dictionary/DictionaryItem.php | 0 src/Dictionary/IssuerTagsDictionary.php | 0 src/Dictionary/OIDAwareInterface.php | 0 src/Dictionary/OIDAwareTrait.php | 0 src/Dictionary/OIDDictionary.php | 0 src/Dictionary/RDNAwareInterface.php | 0 src/Dictionary/RDNAwareTrait.php | 0 src/Dictionary/StandardTagsDictionary.php | 0 src/Dictionary/SubjectTagsDictionary.php | 0 src/Dictionary/TitleAwareInterface.php | 0 src/Dictionary/TitleAwareTrait.php | 0 src/Helpers/ArrayHelper.php | 0 src/Helpers/CertificateHelper.php | 0 src/Helpers/ErrorMessageHelper.php | 0 .../Messages/HumanReadebleCPErrors.php | 0 tmp/src.txt | 0 57 files changed, 71 insertions(+), 1 deletion(-) mode change 100755 => 100644 .gitattributes mode change 100755 => 100644 .github/workflows/static-analysis.yml mode change 100755 => 100644 .gitignore mode change 100755 => 100644 README.md mode change 100755 => 100644 composer.json mode change 100755 => 100644 doc/ATTRIBUTES.md mode change 100755 => 100644 doc/GET-TEST-CERT.md create mode 100644 docs/api/CryptoPro/addAttachedSignature.md create mode 100644 docs/api/CryptoPro/addDetachedSignature.md create mode 100644 docs/api/CryptoPro/createAttachedSignature.md create mode 100644 docs/api/CryptoPro/createDetachedSignature.md create mode 100644 docs/api/CryptoPro/createHash.md create mode 100644 docs/api/CryptoPro/getAllContainerCertificates.md create mode 100644 docs/api/CryptoPro/getAllUserCertificates.md create mode 100644 docs/api/CryptoPro/getCertificate.md create mode 100644 docs/api/CryptoPro/getContainerCertificates.md create mode 100644 docs/api/CryptoPro/getSystemInfo.md create mode 100644 docs/api/CryptoPro/getUserCertificates.md create mode 100644 docs/api/CryptoPro/isValidSystemSetup.md mode change 100755 => 100644 examples/list_of_all_valid_certificates.php mode change 100755 => 100644 phpstan.neon mode change 100755 => 100644 src/Certificate.php mode change 100755 => 100644 src/Constants/CADESCOM_ATTRIBUTE.php mode change 100755 => 100644 src/Constants/CADESCOM_CADES_TYPE.php mode change 100755 => 100644 src/Constants/CADESCOM_CONTENT_ENCODING_TYPE.php mode change 100755 => 100644 src/Constants/CADESCOM_DISPLAY_DATA.php mode change 100755 => 100644 src/Constants/CADESCOM_ENCODING_TYPE.php mode change 100755 => 100644 src/Constants/CADESCOM_ENCRYPTION_ALGORITHM.php mode change 100755 => 100644 src/Constants/CADESCOM_HASH_ALGORITHM.php mode change 100755 => 100644 src/Constants/CADESCOM_STORE_LOCATION.php mode change 100755 => 100644 src/Constants/CAPICOM_CERTIFICATE_FIND_TYPE.php mode change 100755 => 100644 src/Constants/CAPICOM_CERTIFICATE_INCLUDE_OPTION.php mode change 100755 => 100644 src/Constants/CAPICOM_PROPID.php mode change 100755 => 100644 src/Constants/CAPICOM_STORE_LOCATION.php mode change 100755 => 100644 src/Constants/CAPICOM_STORE_OPEN_MODE.php mode change 100755 => 100644 src/CryptoPro.php mode change 100755 => 100644 src/Dictionary/AbstractDictionary.php mode change 100755 => 100644 src/Dictionary/AbstractTagsDictionary.php mode change 100755 => 100644 src/Dictionary/AdditionalTagsDictionary.php mode change 100755 => 100644 src/Dictionary/DescriptionAwareInterface.php mode change 100755 => 100644 src/Dictionary/DictionaryInterface.php mode change 100755 => 100644 src/Dictionary/DictionaryItem.php mode change 100755 => 100644 src/Dictionary/IssuerTagsDictionary.php mode change 100755 => 100644 src/Dictionary/OIDAwareInterface.php mode change 100755 => 100644 src/Dictionary/OIDAwareTrait.php mode change 100755 => 100644 src/Dictionary/OIDDictionary.php mode change 100755 => 100644 src/Dictionary/RDNAwareInterface.php mode change 100755 => 100644 src/Dictionary/RDNAwareTrait.php mode change 100755 => 100644 src/Dictionary/StandardTagsDictionary.php mode change 100755 => 100644 src/Dictionary/SubjectTagsDictionary.php mode change 100755 => 100644 src/Dictionary/TitleAwareInterface.php mode change 100755 => 100644 src/Dictionary/TitleAwareTrait.php mode change 100755 => 100644 src/Helpers/ArrayHelper.php mode change 100755 => 100644 src/Helpers/CertificateHelper.php mode change 100755 => 100644 src/Helpers/ErrorMessageHelper.php mode change 100755 => 100644 src/Helpers/Messages/HumanReadebleCPErrors.php mode change 100755 => 100644 tmp/src.txt diff --git a/.gitattributes b/.gitattributes old mode 100755 new mode 100644 diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml old mode 100755 new mode 100644 diff --git a/.gitignore b/.gitignore old mode 100755 new mode 100644 diff --git a/README.md b/README.md old mode 100755 new mode 100644 index 1e2452e..c360f4d --- a/README.md +++ b/README.md @@ -1 +1,59 @@ -# PHP API для работы с бибилотекой КриптоПро libphpcades \ No newline at end of file + +# КриптоПРО PHP SDK +PHP SDK для работы с API расширения КриптоПро (`libphpcades`), аналогичный КриптоПро ЭЦП Browser plug-in + +- [КриптоПРО PHP SDK](#cryptopro-php) + - [Зачем нужен этот пакет?](#why) + - [Установка](#install) + - [API](#api) + - [Методы класса CryptoPro](#api-cryptopro) + - [Методы объекта сертификата](#api-certificate) + - [Поддерживаемые СКЗИ](#supported-cist) + - [Примеры](#examples) + - [Тэг script (UMD)](#example-script-tag) +- [Тем, кто хочет помочь](#developers) + - [Запуск режима разработки](#dev-mode) + - [Запуск тестов](#tests-execution) + - [Проверка пакета перед публикацией в NPM](#final-check) +- [Лицензия](#lisense) + + + +## Зачем нужен этот пакет? +Этот паект призван упроостить взаимодействие с абсолютно не документированным [расширением КриптоПро для PHP](https://docs.cryptopro.ru/cades/phpcades). +Пакет реализует упрощённый доступ к следующим операциям: +- работа с сертификатами; +- создание и проверка подписи; +- шифрование и расшифрование данных. + +Немаловажным фактором, в выборе этого пакета, является полное соответсвие набора методов, с [КриптоПРО JS SDK](https://github.com/webmasterskaya/crypto-pro-js) + + +## Установка + +Установка осуществляется через [Composer](https://getcomposer.org/). +```shell +composer require webmasterskaya/crypto-pro-php +``` + + +## API + + +### Методы класса СryptoPro +- [СryptoPro::getUserCertificates()](docs/api/CryptoPro/getUserCertificates.md) - возвращает список сертификатов, доступных пользователю в системе +- [СryptoPro::getAllUserCertificates()](docs/api/CryptoPro/getAllUserCertificates.md) - возвращает список всех сертификатов, доступных пользователю в системе, в том числе, просроченные и без закрытого ключа +- [СryptoPro::getContainerCertificates()](docs/api/CryptoPro/getContainerCertificates.md) - возвращает список сертификатов, из закрытых ключей и/или сертификаты не установленные всистеме* +- [СryptoPro::getAllContainerCertificates()](docs/api/CryptoPro/getAllContainerCertificates.md) - возвращает список всех сертификатов, из закрытых ключей и/или сертификаты не установленные всистеме*, в том числе, просроченные и без закрытого ключа +- [СryptoPro::getCertificate()](docs/api/CryptoPro/getCertificate.md) - возвращает сертификат по отпечатку +- [СryptoPro::createAttachedSignature()](docs/api/CryptoPro/createAttachedSignature.md) - создает совмещенную (присоединенную) подпись сообщения +- [СryptoPro::createDetachedSignature()](docs/api/CryptoPro/createDetachedSignature.md) - создает отсоединенную (открепленную) подпись сообщения +- [СryptoPro::addAttachedSignature()](docs/api/CryptoPro/addAttachedSignature.md) - добавляет совмещенную (присоединенную) подпись к раннее подписанному документу (реализует метод coSign) +- [СryptoPro::addDetachedSignature()](docs/api/CryptoPro/addDetachedSignature.md) - добавляет отсоединенную (открепленную) подпись к раннее подписанному документу (реализует метод coSign) +- [СryptoPro::createHash()](docs/api/CryptoPro/createHash.md) - создает хеш сообщения по ГОСТ Р 34.11-2012 256 бит +- [СryptoPro::getSystemInfo()](docs/api/CryptoPro/getSystemInfo.md) - возвращает информацию о CSP и плагине +- [СryptoPro::isValidSystemSetup()](docs/api/CryptoPro/isValidSystemSetup.md) - возвращает флаг корректности настроек ЭП на машине + + + +### Методы объекта сертификата \ No newline at end of file diff --git a/composer.json b/composer.json old mode 100755 new mode 100644 diff --git a/doc/ATTRIBUTES.md b/doc/ATTRIBUTES.md old mode 100755 new mode 100644 diff --git a/doc/GET-TEST-CERT.md b/doc/GET-TEST-CERT.md old mode 100755 new mode 100644 diff --git a/docs/api/CryptoPro/addAttachedSignature.md b/docs/api/CryptoPro/addAttachedSignature.md new file mode 100644 index 0000000..77a6fb4 --- /dev/null +++ b/docs/api/CryptoPro/addAttachedSignature.md @@ -0,0 +1 @@ +# CryptoPro::addAttachedSignature diff --git a/docs/api/CryptoPro/addDetachedSignature.md b/docs/api/CryptoPro/addDetachedSignature.md new file mode 100644 index 0000000..f566cbf --- /dev/null +++ b/docs/api/CryptoPro/addDetachedSignature.md @@ -0,0 +1 @@ +# CryptoPro::addDetachedSignature diff --git a/docs/api/CryptoPro/createAttachedSignature.md b/docs/api/CryptoPro/createAttachedSignature.md new file mode 100644 index 0000000..213c62b --- /dev/null +++ b/docs/api/CryptoPro/createAttachedSignature.md @@ -0,0 +1 @@ +# CryptoPro::createAttachedSignature \ No newline at end of file diff --git a/docs/api/CryptoPro/createDetachedSignature.md b/docs/api/CryptoPro/createDetachedSignature.md new file mode 100644 index 0000000..d13b7ac --- /dev/null +++ b/docs/api/CryptoPro/createDetachedSignature.md @@ -0,0 +1 @@ +# CryptoPro::createDetachedSignature \ No newline at end of file diff --git a/docs/api/CryptoPro/createHash.md b/docs/api/CryptoPro/createHash.md new file mode 100644 index 0000000..5375109 --- /dev/null +++ b/docs/api/CryptoPro/createHash.md @@ -0,0 +1 @@ +# CryptoPro::createHash \ No newline at end of file diff --git a/docs/api/CryptoPro/getAllContainerCertificates.md b/docs/api/CryptoPro/getAllContainerCertificates.md new file mode 100644 index 0000000..6b9bede --- /dev/null +++ b/docs/api/CryptoPro/getAllContainerCertificates.md @@ -0,0 +1 @@ +# CryptoPro::getAllContainerCertificates \ No newline at end of file diff --git a/docs/api/CryptoPro/getAllUserCertificates.md b/docs/api/CryptoPro/getAllUserCertificates.md new file mode 100644 index 0000000..cb573c4 --- /dev/null +++ b/docs/api/CryptoPro/getAllUserCertificates.md @@ -0,0 +1 @@ +# CryptoPro::getAllUserCertificates \ No newline at end of file diff --git a/docs/api/CryptoPro/getCertificate.md b/docs/api/CryptoPro/getCertificate.md new file mode 100644 index 0000000..e48d418 --- /dev/null +++ b/docs/api/CryptoPro/getCertificate.md @@ -0,0 +1 @@ +# CryptoPro::getCertificate \ No newline at end of file diff --git a/docs/api/CryptoPro/getContainerCertificates.md b/docs/api/CryptoPro/getContainerCertificates.md new file mode 100644 index 0000000..b6a2ae3 --- /dev/null +++ b/docs/api/CryptoPro/getContainerCertificates.md @@ -0,0 +1 @@ +# CryptoPro::getContainerCertificates \ No newline at end of file diff --git a/docs/api/CryptoPro/getSystemInfo.md b/docs/api/CryptoPro/getSystemInfo.md new file mode 100644 index 0000000..d1c551e --- /dev/null +++ b/docs/api/CryptoPro/getSystemInfo.md @@ -0,0 +1 @@ +# CryptoPro::getSystemInfo \ No newline at end of file diff --git a/docs/api/CryptoPro/getUserCertificates.md b/docs/api/CryptoPro/getUserCertificates.md new file mode 100644 index 0000000..bdb42ab --- /dev/null +++ b/docs/api/CryptoPro/getUserCertificates.md @@ -0,0 +1 @@ +# CryptoPro::getUserCertificates \ No newline at end of file diff --git a/docs/api/CryptoPro/isValidSystemSetup.md b/docs/api/CryptoPro/isValidSystemSetup.md new file mode 100644 index 0000000..2b0271b --- /dev/null +++ b/docs/api/CryptoPro/isValidSystemSetup.md @@ -0,0 +1 @@ +# CryptoPro::isValidSystemSetup diff --git a/examples/list_of_all_valid_certificates.php b/examples/list_of_all_valid_certificates.php old mode 100755 new mode 100644 diff --git a/phpstan.neon b/phpstan.neon old mode 100755 new mode 100644 diff --git a/src/Certificate.php b/src/Certificate.php old mode 100755 new mode 100644 diff --git a/src/Constants/CADESCOM_ATTRIBUTE.php b/src/Constants/CADESCOM_ATTRIBUTE.php old mode 100755 new mode 100644 diff --git a/src/Constants/CADESCOM_CADES_TYPE.php b/src/Constants/CADESCOM_CADES_TYPE.php old mode 100755 new mode 100644 diff --git a/src/Constants/CADESCOM_CONTENT_ENCODING_TYPE.php b/src/Constants/CADESCOM_CONTENT_ENCODING_TYPE.php old mode 100755 new mode 100644 diff --git a/src/Constants/CADESCOM_DISPLAY_DATA.php b/src/Constants/CADESCOM_DISPLAY_DATA.php old mode 100755 new mode 100644 diff --git a/src/Constants/CADESCOM_ENCODING_TYPE.php b/src/Constants/CADESCOM_ENCODING_TYPE.php old mode 100755 new mode 100644 diff --git a/src/Constants/CADESCOM_ENCRYPTION_ALGORITHM.php b/src/Constants/CADESCOM_ENCRYPTION_ALGORITHM.php old mode 100755 new mode 100644 diff --git a/src/Constants/CADESCOM_HASH_ALGORITHM.php b/src/Constants/CADESCOM_HASH_ALGORITHM.php old mode 100755 new mode 100644 diff --git a/src/Constants/CADESCOM_STORE_LOCATION.php b/src/Constants/CADESCOM_STORE_LOCATION.php old mode 100755 new mode 100644 diff --git a/src/Constants/CAPICOM_CERTIFICATE_FIND_TYPE.php b/src/Constants/CAPICOM_CERTIFICATE_FIND_TYPE.php old mode 100755 new mode 100644 diff --git a/src/Constants/CAPICOM_CERTIFICATE_INCLUDE_OPTION.php b/src/Constants/CAPICOM_CERTIFICATE_INCLUDE_OPTION.php old mode 100755 new mode 100644 diff --git a/src/Constants/CAPICOM_PROPID.php b/src/Constants/CAPICOM_PROPID.php old mode 100755 new mode 100644 diff --git a/src/Constants/CAPICOM_STORE_LOCATION.php b/src/Constants/CAPICOM_STORE_LOCATION.php old mode 100755 new mode 100644 diff --git a/src/Constants/CAPICOM_STORE_OPEN_MODE.php b/src/Constants/CAPICOM_STORE_OPEN_MODE.php old mode 100755 new mode 100644 diff --git a/src/CryptoPro.php b/src/CryptoPro.php old mode 100755 new mode 100644 diff --git a/src/Dictionary/AbstractDictionary.php b/src/Dictionary/AbstractDictionary.php old mode 100755 new mode 100644 diff --git a/src/Dictionary/AbstractTagsDictionary.php b/src/Dictionary/AbstractTagsDictionary.php old mode 100755 new mode 100644 diff --git a/src/Dictionary/AdditionalTagsDictionary.php b/src/Dictionary/AdditionalTagsDictionary.php old mode 100755 new mode 100644 diff --git a/src/Dictionary/DescriptionAwareInterface.php b/src/Dictionary/DescriptionAwareInterface.php old mode 100755 new mode 100644 diff --git a/src/Dictionary/DictionaryInterface.php b/src/Dictionary/DictionaryInterface.php old mode 100755 new mode 100644 diff --git a/src/Dictionary/DictionaryItem.php b/src/Dictionary/DictionaryItem.php old mode 100755 new mode 100644 diff --git a/src/Dictionary/IssuerTagsDictionary.php b/src/Dictionary/IssuerTagsDictionary.php old mode 100755 new mode 100644 diff --git a/src/Dictionary/OIDAwareInterface.php b/src/Dictionary/OIDAwareInterface.php old mode 100755 new mode 100644 diff --git a/src/Dictionary/OIDAwareTrait.php b/src/Dictionary/OIDAwareTrait.php old mode 100755 new mode 100644 diff --git a/src/Dictionary/OIDDictionary.php b/src/Dictionary/OIDDictionary.php old mode 100755 new mode 100644 diff --git a/src/Dictionary/RDNAwareInterface.php b/src/Dictionary/RDNAwareInterface.php old mode 100755 new mode 100644 diff --git a/src/Dictionary/RDNAwareTrait.php b/src/Dictionary/RDNAwareTrait.php old mode 100755 new mode 100644 diff --git a/src/Dictionary/StandardTagsDictionary.php b/src/Dictionary/StandardTagsDictionary.php old mode 100755 new mode 100644 diff --git a/src/Dictionary/SubjectTagsDictionary.php b/src/Dictionary/SubjectTagsDictionary.php old mode 100755 new mode 100644 diff --git a/src/Dictionary/TitleAwareInterface.php b/src/Dictionary/TitleAwareInterface.php old mode 100755 new mode 100644 diff --git a/src/Dictionary/TitleAwareTrait.php b/src/Dictionary/TitleAwareTrait.php old mode 100755 new mode 100644 diff --git a/src/Helpers/ArrayHelper.php b/src/Helpers/ArrayHelper.php old mode 100755 new mode 100644 diff --git a/src/Helpers/CertificateHelper.php b/src/Helpers/CertificateHelper.php old mode 100755 new mode 100644 diff --git a/src/Helpers/ErrorMessageHelper.php b/src/Helpers/ErrorMessageHelper.php old mode 100755 new mode 100644 diff --git a/src/Helpers/Messages/HumanReadebleCPErrors.php b/src/Helpers/Messages/HumanReadebleCPErrors.php old mode 100755 new mode 100644 diff --git a/tmp/src.txt b/tmp/src.txt old mode 100755 new mode 100644