承接 ahs9/eds-checker 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ahs9/eds-checker

最新稳定版本:1.0

Composer 安装命令:

composer require ahs9/eds-checker

包简介

README 文档

README

Installation

$ composer require ahs9/eds-checker

Usage

Use this library to compare user-data (from DB or from POST) with data in certificate (electronic digital signature).

Examples

Creating template

Certificates have different structure. Template shows to parser where user-data is. If template will be deep not enough, parser will find duplicates of oid. For example, certificate has several keys 1.2.643.3.131.1.1. OID duplicates will throw exception. Template example:

$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
                ]
            ]
        ]
    ]
];

Creating parser-object

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

Debugging template

For debugging your template use ParserAsn::getSplitedAsn(). You can dump result when you fill out the template step by step. Every step of template should deepen the ASN object. You need to get a part of certificate with no duplicates of oid.

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

then

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

deeper and deeper until you get user-data

Getting parse-result

$certificateData = $parser->getComparedData();

Creating data-object for comparing from post

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

Comparing

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

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-08-25