Parsing of digital certificates from all Bulgarian vendors (and all other vendors compatible with the common EU standard).
Via Composer
$ composer require vakata/certificate
// parse the certificate from the current request ($_SERVER['SSL_CLIENT_CERT'])
// on Apache this will work if SSLOptions +ExportCertData is set
$cert = \vakata\certificate\Certificate::fromRequest();
// you can then get various information from the certificate
echo $cert->getNaturalPerson()->getID(); // EGN or PID
if ($cert->isProfessional()) {
echo $cert->getLegalPerson()->getBulstat(); // BULSTAT
}
// you can also create an instance from a x509 string
$certStr = new \vakata\certificate\Certificate("x509 formatted string");
// or using a static method
$certStr = new \vakata\certificate\Certificate::fromString("x509 formatted string");
// or from a file
$certFile = \vakata\certificate\Certificate::fromFile("/path/to/file.crt");
Certificates can also be validated (by checking expiration dates, CRLs and validating the certificate signature). Keep in mind signature verification is implemented using the OpenSSL PHP extension.
Read more in the API docs
$ composer test
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.