lufox11/pdf-sign-validator 问题修复 & 功能扩展

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

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

lufox11/pdf-sign-validator

Composer 安装命令:

composer require lufox11/pdf-sign-validator

包简介

A simple wrapper to validate a PDF signature against a public key.

README 文档

README

PDF Sign Validator is a simple wrapper to validate a PDF signature against a public key.
After spending an entire day looking for a similar solution I gave up and ended up building a solution by myself with the help of my best friend, John Stack Overflow.
This is nothing more than just a wrapper of real cryptographic functions from Sop\ANS1 and Sop\X509 repositories.

Installation

Just require this package in your project using Composer:

composer require lufox11/pdf-sign-validator

Usage

Methods you may'd like to use:

signCount: Returns the amount of signatures found in file.
signIsValid: Validates that the file signature corresponds to the issuer's root PEM certificate.
certIsValid: Validates that the subject certificate was issued by the issuer certificate.
signMatchSubject: Validates that the certificate (extracted from the signature) match the subject's PEM certificate.
infoFromPDF: Reads an attached signature to a PDF file and returns the info inside.
infoFromPEM: Reads a certificate in PEM format and returns the info inside.

A real use case (Argentina):

  1. Sign a PDF file through Firmar.gob.ar and download the file (signed.pdf).
  2. Download the issuer's root certificate (issuer.cer).
  3. Download your public certificate (subject.cer).
use LufoX11\PdfSignValidator\PdfSignValidator;

/**
 * signed.pdf: Path to the signed PDF file.
 * issuer.cer: Path to the public key file (RSA PUBLIC KEY) of the issuer.
 * subject.cer: Path to the public key file (RSA PUBLIC KEY) of the subject.
 */

$amountOfSignatures = PdfSignValidator::signCount('signed.pdf');
$certificateIsValid = PdfSignValidator::certIsValid('subject.cer', 'issuer.cer');
$certificateData = PdfSignValidator::infoFromPEM('certificate.cer');
$certificateData = PdfSignValidator::infoFromPDF('signed.pdf');

// Single signature in PDF file
$signatureIsValid = PdfSignValidator::signIsValid('signed.pdf', 'issuer.cer');
$certificateMatchSubject = PdfSignValidator::signMatchSubject('signed.pdf', 'subject.cer');

// Multiple signatures in PDF file
// You can specify the signature to work with in dot notation
$signatureIsValid = PdfSignValidator::signIsValid('signed.pdf', 'issuer.cer', [ 'subject.common_name' => 'Lionel Messi' ]);
$certificateMatchSubject = PdfSignValidator::signMatchSubject('signed.pdf', 'subject.cer', [ 'issuer.common_name' => 'Magnus Carlsen' ]);

License

This project is licensed under the MIT License.

lufox11/pdf-sign-validator 适用场景与选型建议

lufox11/pdf-sign-validator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 307 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 02 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 lufox11/pdf-sign-validator 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-17