From 404e02594e64dd6973d14bf92d98687f26794f47 Mon Sep 17 00:00:00 2001 From: Artem Vasilev Date: Wed, 9 Nov 2022 19:29:14 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B8=D0=BC=D0=B5=D1=80=20=D0=B2?= =?UTF-8?q?=D1=8B=D0=B2=D0=BE=D0=B4=D0=B0=20=D1=81=D0=BF=D0=B8=D1=81=D0=BA?= =?UTF-8?q?=D0=B0=20=D1=81=D0=B5=D1=80=D1=82=D0=B8=D1=84=D0=B8=D0=BA=D0=B0?= =?UTF-8?q?=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/list_of_all_valid_certificates.php | 56 +++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 examples/list_of_all_valid_certificates.php diff --git a/examples/list_of_all_valid_certificates.php b/examples/list_of_all_valid_certificates.php new file mode 100755 index 0000000..d896202 --- /dev/null +++ b/examples/list_of_all_valid_certificates.php @@ -0,0 +1,56 @@ +getMessage() . PHP_EOL; + exit; +} + +foreach ($certificates as $certificate) +{ + $owner = $certificate->getOwnerInfo(); + + print PHP_EOL; + print '==================================================' . PHP_EOL; + print PHP_EOL; + + print $certificate->name . PHP_EOL; + + print 'Отпечаток:' . PHP_EOL; + print "\t" . $certificate->thumbprint . PHP_EOL; + + print 'Подписант:' . PHP_EOL; + foreach ($owner as $item) + { + if ($item['RDN'] == 'CN' || $item['RDN'] == 'UN') + { + continue; + } + + print "\t" . $item['title'] . ': ' . $item['description'] . PHP_EOL; + } + + print 'Область использования ключа:' . PHP_EOL; + foreach ($certificate->getDecodedExtendedKeyUsage() as $oid => $title) + { + print "\t" . $title . ' (OID: ' . $oid . ')' . PHP_EOL; + } + + $algorithm = $certificate->getAlgorithm(); + print 'Алгоритм сертификата:' . PHP_EOL; + print "\t" . $algorithm['algorithm'] . ' (OID: ' . $algorithm['oid'] . ')' . PHP_EOL; + + print 'Срок действия сертификата:' . PHP_EOL; + print "\t" . 'c: ' . $certificate->validFrom . PHP_EOL; + print "\t" . 'до: ' . $certificate->validTo . PHP_EOL; + + print PHP_EOL; + print '==================================================' . PHP_EOL; + print PHP_EOL; +} \ No newline at end of file