Skip to main content

Digitally sign and verify PDF documents (PAdES) with a pure-Rust backend — no Java, no OpenSSL. Import as `pdfsigner`.

Project description

pdfsigner (Python)

PyPI Python versions Downloads CI License: GPL v3 powered by pdf_signer

Digitally sign and verify PDF documents — full PAdES (ETSI EN 319 142) from B-B to B-LTA — with a single, dependency-free wheel. No Java, no OpenSSL, no Poppler, no system libraries.

pip install pdfsignerpy      # pre-built wheels — no compiler, no Rust needed
import pdfsigner
pdfsigner.sign_pdf("in.pdf", "out.pdf", "keystore.p12", "password")
print(pdfsigner.verify_pdf("out.pdf")[0]["valid"])   # True

Why pdfsigner?

Most Python PDF-signing libraries lean on heavy native stacks — OpenSSL via cryptography, a Java runtime, or external tools like Poppler. pdfsigner bundles the entire crypto + PDF pipeline as one self-contained Rust extension (the pure-Rust pdf_signer crate, wrapped with PyO3).

  • 🦀 Zero system dependencies — no OpenSSL, no Java, no Poppler, no cffi. One wheel, nothing to apt-get.
  • 📦 Pre-built wheels for Linux (x86_64 · aarch64), macOS (Intel · Apple Silicon, universal2) and Windows — pip install and go, no Rust toolchain.
  • 🔏 Real PAdES, B-B → B-LTA — CAdES signing-certificate-v2, RFC 3161 signature and document timestamps, and long-term validation (/DSS with the chain, CRLs and OCSP).
  • Verification you can trust — RFC 5280 path validation whose name constraints and certificate-policy engine are validated against the NIST PKITS suite (42/42 policy + 38/38 name-constraint tests).
  • 🔑 Modern keys — RSA, ECDSA (P-256/P-384) and Ed25519; CRL + OCSP revocation.
  • 🖋 Rich visible signatures — a bordered box with an embedded TrueType/OpenType font and a PNG/JPEG logo, placed anywhere on any page.
  • 🧩 Incremental updates — sign repeatedly; earlier signatures stay valid.
  • 🔁 One engine, two languages — the same backend powers the pdfsigner R package.

Installation

pip install pdfsignerpy

Wheels are published for common platforms, so installation needs no compiler and no Rust. To build from source on an unsupported platform, install a Rust toolchain from https://rustup.rs first (pip will compile it automatically).

The PyPI distribution is pdfsignerpy, but you import pdfsigner (the name pdfsigner is blocked on PyPI as too similar to pdf-signer).

Usage

import pdfsigner

# Sign (invisible). Levels above "bb" need a tsa_url.
pdfsigner.sign_pdf(
    "input.pdf", "signed.pdf", "keystore.p12", "password",
    reason="Approval",
    level="bb",                     # bb | bt | blt | blta
)

# Sign with a visible box, an embedded font and a logo.
pdfsigner.sign_pdf(
    "input.pdf", "signed.pdf", "keystore.p12", "password",
    signtext="Digitally signed",
    font="Arial.ttf",
    image="logo.png",
    level="blta",
    tsa_url="http://timestamp.digicert.com",
)

# Verify every signature.
for s in pdfsigner.verify_pdf("signed.pdf"):
    print(s["valid"], s["signer"], s["detail"])

# Verify and validate the signer chain against trusted roots (e.g. ICP-Brasil).
pdfsigner.verify_pdf("signed.pdf", roots="icp-brasil-roots.pem")

verify_pdf returns one dict per signature with keys: valid, signer, chain_trusted (bool or None when no roots given), covers_whole_document, signed_len, byte_range and detail.

Architecture

pdfsigner (Python) architecture: the Python API (sign_pdf / verify_pdf) calls a PyO3 extension module, which links the pure-Rust pdf_signer crate and its dependencies, producing PAdES-signed PDFs and a verification report.

import pdfsigner calls a thin PyO3 extension module that links the pure-Rust pdf_signer crate (a git dependency pinned to v0.1.7). The same engine powers the pdfsigner R package.

Authors

  • André Leite — Universidade Federal de Pernambuco (maintainer)
  • Hugo Vasconcelos — Universidade Federal de Pernambuco
  • Diogo Bezerra — Universidade Federal de Pernambuco
  • Marcos Wasiliew — Universidade Federal de Pernambuco
  • Carlos Amorim — Universidade Federal de Pernambuco

Citation

If you use this software, please cite it using the metadata in CITATION.cff.

License

GPL-3.0-or-later. The bundled pdf_signer crate and its Rust dependencies retain their own (permissive) licenses.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdfsignerpy-0.2.1.tar.gz (47.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pdfsignerpy-0.2.1-cp39-abi3-win_amd64.whl (2.3 MB view details)

Uploaded CPython 3.9+Windows x86-64

pdfsignerpy-0.2.1-cp39-abi3-manylinux_2_28_aarch64.whl (2.4 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARM64

pdfsignerpy-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

pdfsignerpy-0.2.1-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (4.7 MB view details)

Uploaded CPython 3.9+macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file pdfsignerpy-0.2.1.tar.gz.

File metadata

  • Download URL: pdfsignerpy-0.2.1.tar.gz
  • Upload date:
  • Size: 47.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pdfsignerpy-0.2.1.tar.gz
Algorithm Hash digest
SHA256 31c96e4460a2d089549676685df7aa0ab3ea13026a51d79a586784dcb836d572
MD5 699d8591097ce4ec6695b3530bb15cdb
BLAKE2b-256 6be02c05328205257d755bda0282e7eda7e5896ac8659af89f928fb7ea986191

See more details on using hashes here.

Provenance

The following attestation bundles were made for pdfsignerpy-0.2.1.tar.gz:

Publisher: release.yml on StrategicProjects/pdfsignerpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pdfsignerpy-0.2.1-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: pdfsignerpy-0.2.1-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 2.3 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pdfsignerpy-0.2.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 c79c959ee327b048d91f2081a217cb1d2dbf2fd764588eea8f24359f3631ea0a
MD5 978bf71bda31cd43a9d45dd87e964c7a
BLAKE2b-256 9fc0865046c1251c3f35a8d718be4035d55351051d1971c289c308d1e11d90b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pdfsignerpy-0.2.1-cp39-abi3-win_amd64.whl:

Publisher: release.yml on StrategicProjects/pdfsignerpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pdfsignerpy-0.2.1-cp39-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pdfsignerpy-0.2.1-cp39-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6364e634dffdbe437a2d4543459f7609a7baab3c1b57e0697b3e9c456a518a22
MD5 7459ea3079ad9eca1fc8ede944dcee48
BLAKE2b-256 5baa364ae8655b24af348d841a01fda6aced0abbd29b30e21f5712a87f9a3650

See more details on using hashes here.

Provenance

The following attestation bundles were made for pdfsignerpy-0.2.1-cp39-abi3-manylinux_2_28_aarch64.whl:

Publisher: release.yml on StrategicProjects/pdfsignerpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pdfsignerpy-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pdfsignerpy-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c85a7d75e8a768ee02b45bb977e661a3e61d2d736e436c2e3bdea9d794f79b39
MD5 4ee92ad6f81885cfa1d34b18e0f346da
BLAKE2b-256 1a0ffe4e5e762f1a5fd65185a5c85aa6bee6f8598d755fc24dd9d36f419e8cce

See more details on using hashes here.

Provenance

The following attestation bundles were made for pdfsignerpy-0.2.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on StrategicProjects/pdfsignerpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pdfsignerpy-0.2.1-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for pdfsignerpy-0.2.1-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 47fc9d5f08184525d80d4ad47dee30d022c7451183012a8cce2665f9825c9af1
MD5 2ff71e4309fc94a67a224b91b6b22c6a
BLAKE2b-256 28543dcd93e43750a1eeb9f3a01727502f721897be59d977b4455cd5ed0cf3d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pdfsignerpy-0.2.1-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl:

Publisher: release.yml on StrategicProjects/pdfsignerpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page