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)

CI License: GPL v3 pure Rust

Digitally sign PDF documents with a PKCS#12 keystore and verify their signatures — implementing the PAdES baseline profiles (ETSI EN 319 142) from B-B to B-LTA.

The heavy lifting is done by the pure-Rust pdf_signer crate, wrapped with PyO3: no Java runtime, no OpenSSL, no external command-line tools — a single self-contained extension module. It is the Python sibling of the pdfsigner R package.

Installation

A Rust toolchain is required to build from source (until wheels are published). Install Rust from https://rustup.rs, then:

pip install pdfsignerpy          # once wheels are on PyPI; then `import pdfsigner`
# or, from a checkout:
pip install maturin
maturin develop --release

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.

What it does

  • PAdES B-B → B-LTA: CAdES signing-certificate-v2, RFC 3161 signature and document timestamps, a /DSS with the certificate chain, CRLs and OCSP.
  • Visible or invisible signatures, with a bordered text box, an optional embedded TrueType/OpenType font and a PNG/JPEG logo.
  • Incremental updates so multiple signatures compose and earlier ones stay valid.
  • Verification of the message digest and the signer's signature, plus optional RFC 5280 chain validation (RSA / ECDSA / Ed25519, CRL + OCSP, name constraints and a NIST PKITS-validated policy engine).

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.1.0.tar.gz (43.5 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.1.0-cp39-abi3-win_amd64.whl (2.3 MB view details)

Uploaded CPython 3.9+Windows x86-64

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

Uploaded CPython 3.9+manylinux: glibc 2.28+ ARM64

pdfsignerpy-0.1.0-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.1.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (4.6 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.1.0.tar.gz.

File metadata

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

File hashes

Hashes for pdfsignerpy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9133d283336724cd2e682e30e145086dc454205d3ffb11193b655cd4f4b47aa2
MD5 74d79ee687550265c869cd7cbd9575b9
BLAKE2b-256 95a83369176ab542d36c74162474045c7f1f1c2f8d6d2177409cbe6565057968

See more details on using hashes here.

Provenance

The following attestation bundles were made for pdfsignerpy-0.1.0.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.1.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: pdfsignerpy-0.1.0-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.1.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 6f4c0782351c7cbb5fb64a944eed6995588eb41e582413716ecc8c1e764ea375
MD5 1b725b4879b4bd58ab89d7854b4ef135
BLAKE2b-256 bc027f837759b9bbbb78ec095fbbdb1b0b0e02861b200d6996c8020d5cd35a78

See more details on using hashes here.

Provenance

The following attestation bundles were made for pdfsignerpy-0.1.0-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.1.0-cp39-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for pdfsignerpy-0.1.0-cp39-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 80637b3153f07b760e52b9837915d98f859bbf59ab6ae9042362d34335df93dc
MD5 5022014e8c7a877c43a5cb1fc3eeb725
BLAKE2b-256 e129ac6987823177cc2402afc9d8d64d7d8e8caaa4ae8b087cc350a6226579d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pdfsignerpy-0.1.0-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.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pdfsignerpy-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e223905375386efc05aed1cf476912a83447c24e5079f7a1d71574ffa0dec3e2
MD5 f8bb363af4472f126e0354cb16d3cc2a
BLAKE2b-256 cb00e73edc71e33c950cdda54578ffd67004f91a3dda464f2716abbdca1503f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pdfsignerpy-0.1.0-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.1.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for pdfsignerpy-0.1.0-cp39-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 10c8eb81c527342ec6b4c2f7ae5cb7ef614e1f3bafe2b0407104537abb32cda5
MD5 c2bef816a75524d67930cc3569ce989d
BLAKE2b-256 31163c86c656a05858f12baea312779673a5a823be996ac3a5852067eb9cc01e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pdfsignerpy-0.1.0-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