PHPackages                             juancarlo99/pdf-pades-signature-extractor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. juancarlo99/pdf-pades-signature-extractor

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

juancarlo99/pdf-pades-signature-extractor
=========================================

PHP library to extract PAdES digital signature data from signed PDF files

1.0.1(3mo ago)06MITPHPPHP &gt;=8.1CI passing

Since Dec 20Pushed 3mo agoCompare

[ Source](https://github.com/juancarlo99/pdf-pades-signature-extractor)[ Packagist](https://packagist.org/packages/juancarlo99/pdf-pades-signature-extractor)[ RSS](/packages/juancarlo99-pdf-pades-signature-extractor/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (4)Used By (0)

PDF PAdES Signature Extractor
=============================

[](#pdf-pades-signature-extractor)

[EN](#english) | [PT-BR](#portugu%C3%AAs-brasil)

---

English
-------

[](#english)

### 📄 Overview

[](#-overview)

**PDF PAdES Signature Extractor** is a PHP library designed to **extract technical data from digital signatures (PAdES)** embedded in signed PDF files.

This project was created as a **real-world, production-oriented library**, focused strictly on **data extraction**, not on legal or juridical validation.

> ⚠️ This library **does NOT validate the legal authenticity** of a digital signature.
> It only extracts technical information from the embedded X.509 certificate.

---

### ✨ Features

[](#-features)

- Detects PAdES signatures in PDF files
- Extracts PKCS#7 signature blocks
- Parses X.509 certificates
- Extracts:
    - Signer name
    - CPF or CNPJ (ICP-Brasil)
    - Certificate issuer
    - Certificate validity period
    - Basic signature metadata
    - Signing date/time (CMS SigningTime, quando disponível)
    - Cadeia de certificados X.509 (PEM)
- Built on top of OpenSSL
- Clean architecture (DTOs, Services, Exceptions)
- PSR-4 compliant

---

### ❌ What this library does NOT do

[](#-what-this-library-does-not-do)

- Certificate chain validation (ICP-Brasil)
- OCSP / CRL verification
- Timestamp Authority (TSA) validation
- Legal or juridical validation
- Signature trust evaluation

---

### 🧱 Requirements

[](#-requirements)

- PHP **8.1+**
- OpenSSL extension enabled
- PDF signed using the **PAdES** standard

---

### 📦 Installation

[](#-installation)

```
composer require juancarlo99/pdf-pades-signature-extractor
```

---

### 🚀 Basic Usage

[](#-basic-usage)

```
use Juancarlo99\PdfPadesSignatureExtractor\Extractor\PadesExtractor;

$extractor = new PadesExtractor();
$signature = $extractor->extract('signed.pdf');

echo $signature->signerName;
echo $signature->cpf;
echo $signature->issuer;
```

---

### 📄 License

[](#-license)

MIT License

### 👩‍💻 Development

[](#‍-development)

Using Docker (recommended):

```
docker compose up -d
docker compose exec app composer install
docker compose exec app vendor/bin/phpunit --no-coverage
docker compose exec app vendor/bin/phpcs --standard=phpcs.xml src tests
docker compose exec app vendor/bin/phpstan analyse -c phpstan.neon
```

Composer scripts:

```
composer test
composer lint
composer stan
```

#### Sensitive tests

[](#sensitive-tests)

Some tests depend on local sample files and are annotated with the PHPUnit group `sensitive`. These tests are excluded in GitHub CI.

- Run all tests locally: `vendor/bin/phpunit`
- Run only sensitive tests locally: `vendor/bin/phpunit --group sensitive`
- CI excludes them via `--exclude-group sensitive` in the workflow.

---

Português (Brasil)
------------------

[](#português-brasil)

### 📄 Visão Geral

[](#-visão-geral)

**PDF PAdES Signature Extractor** é uma biblioteca PHP criada para **extrair dados técnicos de assinaturas digitais PAdES** presentes em arquivos PDF assinados.

Este projeto foi desenvolvido como uma **biblioteca real e prática**, com foco exclusivo em **extração de informações**, e não em validação jurídica.

> ⚠️ Esta biblioteca **NÃO valida juridicamente** a assinatura digital.
> Ela apenas extrai dados técnicos do certificado X.509 embutido no PDF.

---

### ✨ Funcionalidades

[](#-funcionalidades)

- Detecta assinaturas PAdES em arquivos PDF
- Extrai blocos PKCS#7
- Lê certificados X.509
- Extrai:
    - Nome do assinante
    - CPF ou CNPJ (ICP-Brasil)
    - Autoridade Certificadora
    - Período de validade do certificado
- Baseada em OpenSSL
- Arquitetura limpa (DTOs, Services, Exceptions)
- Compatível com PSR-4

---

### ❌ O que esta biblioteca NÃO faz

[](#-o-que-esta-biblioteca-não-faz)

- Validação de cadeia ICP-Brasil
- Consulta OCSP ou LCR
- Validação de carimbo do tempo (TSA)
- Validação jurídica
- Verificação de confiabilidade da assinatura
- Inferir o "tipo" do certificado (A1/A3). Essa informação não existe nos padrões PDF / PAdES / CMS / X.509.

---

### 🧱 Requisitos

[](#-requisitos)

- PHP **8.1 ou superior**
- Extensão OpenSSL habilitada
- PDF assinado no padrão **PAdES**

---

### 📦 Instalação

[](#-instalação)

Via Composer:

```
composer require juancarlo99/pdf-pades-signature-extractor
```

---

### 🚀 Uso Básico

[](#-uso-básico)

```
use Juancarlo99\PdfPadesSignatureExtractor\Extractor\PadesExtractor;

$extractor = new PadesExtractor();
$assinatura = $extractor->extract('signed.pdf');

echo $assinatura->signerName;
echo $assinatura->cpf;
echo $assinatura->issuer;
// Preferencialmente usa SigningTime; caso não exista, usa notBefore do certificado
echo $assinatura->signedAt->format('c');
// Acesso opcional ao SigningTime original (DateTimeImmutable|null)
// $assinatura->signingDateTime
// Cadeia de certificados em PEM
foreach ($assinatura->certificates as $pem) {
  // ...
}

// Para múltiplas assinaturas no mesmo PDF
$todas = $extractor->extractAll('signed.pdf');
foreach ($todas as $sig) {
  // processa cada assinatura
}
```

---

### 📄 Licença

[](#-licença)

MIT License

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance78

Regular maintenance activity

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~30 days

Total

2

Last Release

119d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/711bb2aa5509723fdf8f31db89c80a5a11b48f619601022a61d7542d2ffc2ac2?d=identicon)[Juan Carlos Nunes](/maintainers/Juan%20Carlos%20Nunes)

---

Top Contributors

[![juan-nunes-gruppe](https://avatars.githubusercontent.com/u/243978465?v=4)](https://github.com/juan-nunes-gruppe "juan-nunes-gruppe (14 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/juancarlo99-pdf-pades-signature-extractor/health.svg)

```
[![Health](https://phpackages.com/badges/juancarlo99-pdf-pades-signature-extractor/health.svg)](https://phpackages.com/packages/juancarlo99-pdf-pades-signature-extractor)
```

###  Alternatives

[spatie/browsershot

Convert a webpage to an image or pdf using headless Chrome

5.2k32.1M102](/packages/spatie-browsershot)[barryvdh/laravel-snappy

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[openspout/openspout

PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way

1.2k57.6M131](/packages/openspout-openspout)[setasign/tfpdf

This class is a modified version of FPDF that adds UTF-8 support. The latest version is based on FPDF 1.85.

426.1M30](/packages/setasign-tfpdf)[aspose-cloud/aspose-words-cloud

Open, generate, edit, split, merge, compare and convert Word documents. Integrate Cloud API into your solutions to manipulate documents. Convert PDF to Word (DOC, DOCX, ODT, RTF and HTML) and in the opposite direction.

32157.4k](/packages/aspose-cloud-aspose-words-cloud)[aspera/xlsx-reader

Spreadsheet reader library for XLSX files

52742.2k5](/packages/aspera-xlsx-reader)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
