Skip to main content

Tools for stamping and signing PDF files

Project description

pyHanko

status Codecov Language grade: Python pypi

The lack of open-source CLI tooling to handle digitally signing and stamping PDF files was bothering me, so I went ahead and rolled my own.

Note: The working title of this project (and former name of the repository on GitHub) was pdf-stamp, which might still linger in some references.

Note: This project is currently in alpha, and not yet production-ready.

Installing

PyHanko is hosted on PyPI, and can be installed using pip:

   pip install pyHanko

Overview

The code in this repository functions both as a library and as a command-line tool. It's nowhere near complete, but here is a short overview of the features. Note that not all of these are necessarily exposed through the CLI.

  • Stamping
    • Simple text-based stamps
    • QR stamps
    • Font can be monospaced, or embedded from an OTF font (experimental)
  • Document preparation
    • Add empty signature fields to existing PDFs
    • Add seed values to signature fields, with or without constraints
  • Signing
    • Signatures can be invisible, or with an appearance based on the stamping tools
    • LTV-enabled signatures are supported
      • PAdES baseline profiles B-B, B-T, B-LT and B-LTA are all supported.
      • Adobe-style revocation info embedding is also supported.
    • RFC 3161 timestamp server support
    • Support for multiple signatures (all modifications are executed using incremental updates to preserve cryptographic integrity)
    • Supports both RSA & ECDSA
    • If cryptography is installed, pyHanko can also produce and validate RSASSA-PSS signatures (with arbitrary parameters).
    • PKCS11 support
      • Available both from the library and through the CLI
      • Extra convenience wrapper for Belgian eID cards
  • Signature validation
    • Cryptographic integrity check
    • Authentication through X.509 chain of trust validation
    • LTV validation
    • Difference analysis on files with multiple signatures and/or incremental updates made after signing (experimental)
    • Signature seed value constraint validation
  • Encryption
    • All encryption methods in ISO 32000-2 are supported in the 0.3.0 release.
  • CLI & configuration
    • YAML-based configuration (optional for most features)
    • CLI based on click
      • Available as pyhanko (when installed) or python -m pyhanko when running from the source directory
      • Built-in help: run pyhanko --help to get started

Some TODOs and known limitations

See the known issues page in the documentation.

Documentation

Documentation is built using Sphinx, and hosted here on ReadTheDocs.

Acknowledgement

This repository includes code from PyPDF2 (with both minor and major modifications); the original license has been included here.

License

MIT License, see LICENSE.

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

pyHanko-0.4.0.tar.gz (182.1 kB view details)

Uploaded Source

Built Distribution

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

pyHanko-0.4.0-py3-none-any.whl (196.5 kB view details)

Uploaded Python 3

File details

Details for the file pyHanko-0.4.0.tar.gz.

File metadata

  • Download URL: pyHanko-0.4.0.tar.gz
  • Upload date:
  • Size: 182.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

File hashes

Hashes for pyHanko-0.4.0.tar.gz
Algorithm Hash digest
SHA256 9a6119261685749733e8101d07895077c4938a32f70bde6cce6aac520fdaf135
MD5 ab43f8e318856342cee4db0bc0238245
BLAKE2b-256 4bf9c49a50190539dfa2e3c0847b46bf0bb66b2346c4bf7baa71a8718dedc6b0

See more details on using hashes here.

File details

Details for the file pyHanko-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: pyHanko-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 196.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

File hashes

Hashes for pyHanko-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1531f50a33b305c9a774b7077ced727377f4bd58696aaad44e572d2c13f875ba
MD5 34f4bb92a5f858c4a1f35369e64d9d14
BLAKE2b-256 895637fc566cd7041e6326025c78aa2c3b354946b769bc48d41810e2e2e29916

See more details on using hashes here.

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