dbp / hcert-php
This package is abandoned and no longer maintained.
No replacement package was suggested.
Making reading and verifying EU DCC in PHP easier
v0.3.0
2021-10-05 08:46 UTC
Requires
- php: ^7.3|^8.0
- ext-json: *
- ext-openssl: *
- ext-zlib: *
- jwadhams/json-logic-php: ^1.4
- mhauri/base45: ^0.1.1
- spomky-labs/cbor-php: ^2.0
- web-auth/cose-lib: ^3.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpstan/phpstan: ^0.12.94
- phpstan/phpstan-phpunit: ^0.12.21
- phpunit/phpunit: ^9.5
- vimeo/psalm: ^4.9
README
WARNING: This project is not ready for production (can't handle all signature types, missing signature verification for the trust data, and more) and is no longer actively supported. It was an experiment to see if verification of HCERTs was feasible with a PHP based web application but was abandoned half way through in favor of a client side Javascript based solution for non-technical reasons. If you are still interested in improving/completing this library please open an issue.
Decode and verify the payload of an EU Digital Covid Certificate in PHP.
Installation
composer require dbp/hcert-php
Usage
use Dbp\Hcert\Hcert;
use Dbp\Hcert\TrustList;
TrustList::$trustListAnchor = '-----BEGIN CERTIFICATE-----
MIIBJTC...';
Hcert::$trustList = new TrustList();
$payload = 'HC1:NCFOXN%TS3D...';
try {
$hcert = Hcert::fromQrcodePayload($payload, true);
var_dump([
$hcert->firstName(),
$hcert->lastName(),
$hcert->dayOfBirth(),
]);
} catch (Exception $e) {
echo $e->getMessage() . PHP_EOL;
}
Use a local cached trust list:
use Dbp\Hcert\TrustList;
TrustList::$trustListAnchor = '-----BEGIN CERTIFICATE-----
MIIBJTC...';
$pathToTrustList = '.../trust-list.bin';
Hcert::$trustList = new TrustList($pathToTrustList);