pyHanko
Tools for stamping and signing PDF files
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 pyhankouv
uv add pyhankopoetry
poetry add pyhankoInstalling 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
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
docusign-esignOfficial Python client SDK for the Docusign…
unclear · top 5,000 on PyPI
endesiveEndesive signs and verifies digital signatures…
unclear · top 15,000 on PyPI
PGPy13PGPy13 is a Python library for OpenPGP…
permissive · top 15,000 on PyPI
python-pkcs11Provides a high-level Python interface to…
permissive · top 15,000 on PyPI
securesystemslibSecuresystemslib provides a cryptography…
permissive · top 5,000 on PyPI
pyhanko-certvalidatorValidates X.509 certificate paths with support…
permissive · top 5,000 on PyPI
PyKCS11PyKCS11 provides a Python wrapper around the…
copyleft · top 15,000 on PyPI
python-gnupgProvides Python bindings to GnuPG for key…
permissive · top 5,000 on PyPI
truelayer-signingProduces and verifies cryptographic signatures…
permissive · top 15,000 on PyPI
sigstoreSigstore is a Python tool for generating and…
permissive · top 5,000 on PyPI