PHP code example of ahs9 / eds-checker

1. Go to this page and download the library: Download ahs9/eds-checker library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ahs9 / eds-checker example snippets


$template = [
    ParserAsn::TEMPLATE_SEQUENCE => [
        ParserAsn::TEMPLATE_ARRAY => [
            0 => [
                ParserAsn::TEMPLATE_ARRAY => [
                    0 => null,
                    1 => null,
                    2 => null,
                    3 => null,
                    4 => null,
                    5 => ParserAsn::TEMPLATE_RESULT
                ]
            ]
        ]
    ]
];

$parser = new ParserAsn(
    $signature, // base64 encoded binary certificate 
    [
        CertificateItem::OID_INN,
        CertificateItem::OID_SURNAME,
        CertificateItem::OID_GIVEN_NAME,
    ],
     $template
 );

$template = [
    ParserAsn::TEMPLATE_SEQUENCE => []
];
var_dump($parser->getSplitedAsn());

$template = [
    ParserAsn::TEMPLATE_SEQUENCE => [
        ParserAsn::TEMPLATE_ARRAY => [
            0 => []
        ]
    ]
];
var_dump($parser->getSplitedAsn());

$certificateData = $parser->getComparedData();

$userData = new ComparedData(
    [
        CertificateItem::OID_INN => $post['inn'],
        CertificateItem::OID_SURNAME => $post['surname']
        CertificateItem::OID_GIVEN_NAME => $post['secondName'] . ' ' . $post['lastName']
    ]
);

$checker = new Checker($userData, $certificateData);
if (!$checker->compare()) {
    var_dump($checker->getErrors());
}
// do staff