skillfed

pyHanko

Tools for stamping and signing PDF files

pyhanko v0.36.2 9.0M downloads/30d#1,567 on PyPI754
Permissive license MIT Active released

What it is and what it does

pyHanko is a library for working with digital signatures in PDF documents. It handles signing, stamping, and validating PDF signatures according to standards like PAdES, and supports hardware tokens via PKCS#11. The library depends on cryptography, lxml, requests, and certificate validation tools to perform its core operations.

The package is designed for developers who need to integrate PDF signing into Python applications. It requires Python 3.10 or later and offers optional features for image handling, QR codes, and OpenType font support. The CLI functionality has been separated into a standalone package (pyhanko-cli), so this distribution focuses purely on the library API.

Use it for:

  • Add digital signatures to PDF documents programmatically in a Python application
  • Validate existing PDF signatures to verify authenticity and integrity
  • Implement PAdES-compliant signing workflows for legal or compliance requirements
  • Integrate hardware security module (HSM) signing via PKCS#11 support
  • Batch process PDF documents to apply timestamps or signatures at scale

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

pyHanko is a Python library for adding, validating, and managing digital signatures in PDF documents, supporting standards like PAdES and PKCS#11.

Yes. Active maintenance, permissive MIT license, low install friction, no known vulnerabilities, and a focused scope make this a solid choice for PDF signature work. The separation of CLI into a separate package keeps the library dependency footprint lean. Verify whether optional dependencies match your use case before installing.

Install

pyhanko on PyPI

pip

pip install pyhanko

uv

uv add pyhanko

poetry

poetry add pyhanko

Installing pyHanko

Before you install

Low install friction with a pure-wheel distribution. Actively maintained with a recent release (19 days old) and steady commit activity. Supports modern Python versions (3.10 through 3.14).

License in practice

MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects.

Quickstart

pip install pyhanko

from pyhanko.pdf_utils import writer
from pyhanko.sign import signers

# Sign a PDF with a certificate
signer = signers.SimpleSigner.load(...)
w = writer.PdfFileWriter()
w.sign(signers.PdfSignatureMetadata(field_name='Signature1'), signer=signer)

Requires Python 3.10 or later. Certificate and key files needed for signing operations.

Verify before relying

  • Whether optional dependencies (pkcs11, image-support, opentype, qr) are required for typical use cases or truly optional
  • Performance characteristics when handling large PDF documents or batch signing operations
  • Whether the library handles all PDF signature standards or has known limitations

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 6 — asn1crypto, tzlocal, pyhanko-certvalidator, requests, cryptography, lxml
Maintenance actively maintained — 19 days since the last release
Last repo commit
First released
Downloads 9,006,390/month — #1,567 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pyhanko-0.36.2-py3-none-any.whl

Keywords: signature, pdf, pades, digital-signature, pkcs11

Development Status :: 4 - BetaIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Security :: CryptographyTopic :: Software Development :: Libraries :: Python Modules

Tags

pdf digital signaturesign pdf filespdf signature validationpades signingcryptographic pdf stamps
pdf-signingdigital-signaturespades

More Python Modules packages