matasarei/euspe 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

matasarei/euspe

Composer 安装命令:

composer require matasarei/euspe

包简介

OOP interfaces for the EUSign PHP library

README 文档

README

CI workflow

OOP interfaces for the EUSign PHP library. The PHP extension is included in releases.

Usage

Similar to euspe_* functions, but with OOP interfaces.

Decrypt signed data:

$crypto = new Matasar\Euspe\Crypto(); // initializes the library

try {
    // EUSignTest.php \develop()
    $result = $crypto->develop('path/to/private_key', 'password', 'encrypted_data');
    var_dump($result->signInfo->data); // decrypted data
} catch (\Matasar\Euspe\Exception\DecryptionException $e) {
    //...
}

Hash data for signing:

$crypto = new Matasar\Euspe\Crypto();
try {
    $hash = $crypto->hash('path/to/file', Matasar\Euspe\Crypto::HASH_FILE);
    var_dump(base64_encode($hash));

    $hash = $crypto->hash('qwerty', Matasar\Euspe\Crypto::HASH_DATA); // hash string
    var_dump(base64_encode($hash));
} catch (\Matasar\Euspe\Exception\EncryptionException $e) {
    //...
}

Validating signature by hash:

$crypto = new Matasar\Euspe\Crypto();
try {
    /** @var \Matasar\Euspe\Dto\SignInfo $info */
    $info = $crypto->verify('signature', 'hash');
} catch (\Matasar\Euspe\Exception\DecryptionException $e) {
    //...
}

Tests and development

The tests don't do any real cryptography testing, as this is only a wrapper for the library.

  1. Install vendors
docker run --rm -v $(pwd):/app -w /app composer:lts composer install --ignore-platform-reqs

Important

The --ignore-platform-req=ext-eusphpe flag is required to avoid the extension requirement.

  1. Run tests
docker run --rm -v $(pwd):/app -w /app composer:lts vendor/bin/phpunit

Recommendations to install the EUSign extension

  1. Unpack and copy library files:
cp .../eusphpe.ini /etc/php/7.4/mods-available/eusphpe.ini
cp -R .../eusphpe_extension /usr/lib/php/eusphpe_extension
  1. Make symlinks to the configuration file:
ln -s /etc/php/7.4/mods-available/eusphpe.ini /etc/php/7.4/fpm/conf.d/20-eusphpe.ini
ln -s /etc/php/7.4/mods-available/eusphpe.ini /etc/php/7.4/cli/conf.d/20-eusphpe.ini
  1. Restart the FPM service
  2. If you have certificates install them (by default in /data/certificates, see osplm.ini):
ls -la /data/certificates/
-rw-rw-r-- 1 root root 876543 Feb 24 2022 CACertificates.p7b
-rw-rw-r-- 1 root root  12345 Feb 24 2022 CAs.json
-rw-rw-r-- 1 root root   1234 Feb 24 2022 EU-xxxxxx.cer
-rw-rw-r-- 1 root root   1234 Feb 24 2022 EU-xxxxxx.cer

Important

You will likely need the original osplm.ini file and not the one which provided with the library demo. The eusphpe extension is compiled for x86_64 architecture, so it can't run on ARM natively.

matasarei/euspe 适用场景与选型建议

matasarei/euspe 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.32k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 07 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 matasarei/euspe 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 matasarei/euspe 我们能提供哪些服务?
定制开发 / 二次开发

基于 matasarei/euspe 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-13