Pyhanko

Latest version: v0.25.3

Safety actively analyzes 702662 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 6 of 7

0.8.0

The release has been uploaded to [PyPI](https://pypi.org/project/pyHanko/0.8.0/). Documentation is available on [ReadTheDocs](https://pyhanko.readthedocs.io/en/0.8.0/).

*Note:* The public API is not completely stable yet, so future releases may still include API changes. This is particularly likely for the validation code and the `pdf_utils` package; please refer to the documentation for further details.

Change log

**Warning:** This release contains a very minor API-breaking change in the configuration API. Since the configuration API is mostly intended as a tool for pyHanko's CLI functionality, most users should be unaffected.

The release notes for the 0.8.0 release are available [here](https://pyhanko.readthedocs.io/en/latest/changelog.html#release-0-8-0).

0.7.0

The release has been uploaded to [PyPI](https://pypi.org/project/pyHanko/0.7.0/). Documentation is available on [ReadTheDocs](https://pyhanko.readthedocs.io/en/0.7.0/).

*Note:* The public API is not completely stable yet, so future releases may still include API changes. This is particularly likely for the validation code and the `pdf_utils` package; please refer to the documentation for further details.

Change log

**Warning:** This release contains a number of API-breaking changes. While the high-level APIs shouldn't be affected, please review the release notes carefully before updating.

*Note:* From this release onwards, the content of the [release history](https://pyhanko.readthedocs.io/en/latest/changelog.html) page in pyHanko's documentation will no longer be duplicated here for every release. Detailed release notes will continue to be published there.

The release notes for the 0.7.0 release are available [here](https://pyhanko.readthedocs.io/en/latest/changelog.html#release-0-7-0).

0.6.1

The release has been uploaded to [PyPI](https://pypi.org/project/pyHanko/0.6.1/). Documentation is available on [ReadTheDocs](https://pyhanko.readthedocs.io/en/0.6.1/).

*Note:* The public API is not completely stable yet, so future releases may still include API changes. This is particularly likely for the validation code and the `pdf_utils` package; please refer to the documentation for further details.

Change log

Dependency changes

- Update `pyhanko-certvalidator` to `0.15.2`
- Replace constraint on `certomancer` and `pyhanko-certvalidator` by soft minor version constraint (`~=`)
- Set version bound for `freezegun`

Bugs fixed

- Add /Q and /DA keys to the whitelist for incremental update analysis on form fields.

0.6.0

The release has been uploaded to [PyPI](https://pypi.org/project/pyHanko/0.6.0/). Documentation is available on [ReadTheDocs](https://pyhanko.readthedocs.io/en/0.6.0/).

*Note:* The public API is not completely stable yet, so future releases may still include API changes. This is particularly likely for the validation code and the `pdf_utils` package; please refer to the documentation for further details.

Change log

Dependency changes

*Warning:* pyHanko's `0.6.0` release includes quite a few changes to dependencies, some of which may
break compatibility with existing code. Review this section carefully before updating.

The `pyhanko-certvalidator` dependency was updated to `0.15.1`. This update adds support for name constraints, RSASSA-PSS and EdDSA for the purposes of X.509 path validation, OCSP checking and CRL validation.


Since `pyhanko-certvalidator` has considerably diverged from "mainline" `certvalidator`, the Python package containing its modules was also renamed from `certvalidator` to `pyhanko_certvalidator`, to avoid potential namespace conflicts down the line. You should update your code to reflect this change. Concretely, `from certvalidator import ValidationContext` turns into `from pyhanko_certvalidator import ValidationContext` in the new release.

There were several changes to dependencies with native binary components:

* The Pillow dependency has been relaxed to `>=7.2.0`, and is now optional. The same goes for `python-barcode`. Image & 1D barcode support now needs to be installed explicitly using the `[image-support]` installation parameter.

* PKCS11 support has also been made optional, and can be added using the `[pkcs11]` installation parameter.

The test suite now makes use of [Certomancer](https://github.com/MatthiasValvekens/certomancer). This also removed the dependency on `ocspbuilder`.


New features and enhancements

Signing

* Make preferred hash inference more robust.
* Populate `/AP` when creating an empty visible signature field (necessary in PDF 2.0)

Validation

* Timestamp and DSS handling tweaks:

* Preserve OCSP resps / CRLs from validation kwargs when reading the DSS.
* Gracefully process revisions that don't have a DSS.
* When creating document timestamps, the `validation_context` parameter is now optional.

* Enforce `certvalidator`'s `weak_hash_algos` when validating PDF signatures as well. Previously, this setting only applied to certificate validation. By default, MD5 and SHA-1 are considered weak (for digital signing purposes).

* Expose `DocTimeStamp`/`Sig` distinction in a more user-friendly manner.

* The `sig_object_type` property on `EmbeddedPdfSignature` now returns the signature's type as a PDF name object.
* `PdfFileReader` now has two extra convenience properties named `embedded_regular_signatures` and `embedded_timestamp_signatures`, that return a list of all regular signatures and document timestamps, respectively.


Encryption

* Refactor internal APIs in pyHanko's security handler implementation to make them easier to extend. Note that while anyone is free to register their own crypt filters for whatever purpose, pyHanko's security handler is still considered internal API, so behaviour is subject to change between minor version upgrades (even after `1.0.0`).


Miscellaneous

* Broaden the scope of `--soft-revocation-check`.
* Corrected a typo in the signature of `validate_sig_integrity`.
* Less opaque error message on missing PKCS11 key handle.
* Ad-hoc hash selection now relies on `pyca/cryptography` rather than `hashlib`.


Bugs fixed

* Correct handling of DocMDP permissions in approval signatures.
* Refactor & correct handling of SigFlags when signing prepared form fields in unsigned files.
* Fixed issue with trailing whitespace and/or `NUL` bytes in array literals.
* Corrected the export lists of various modules.

0.5.1

The release has been uploaded to [PyPI](https://pypi.org/project/pyHanko/0.5.1/). Documentation is available on [ReadTheDocs](https://pyhanko.readthedocs.io/en/0.5.1/).

*Note:* The public API is not completely stable yet, so future releases may still include API changes. This is particularly likely for the validation code and the `pdf_utils` package; please refer to the documentation for further details.

Change log

Bugs fixed

* Fixed a packaging blunder that caused an import error on fresh installs (11).

0.5.0

The release has been uploaded to [PyPI](https://pypi.org/project/pyHanko/0.5.0/). Documentation is available on [ReadTheDocs](https://pyhanko.readthedocs.io/en/0.5.0/).

*Note:* The public API is not completely stable yet, so future releases may still include API changes. This is particularly likely for the validation code and the `pdf_utils` package; please refer to the documentation for further details.

Change log

Dependency changes

Update `pyhanko-certvalidator` dependency to `0.13.0`. Dependency on `cryptography` is now mandatory, and `oscrypto` has been marked optional. This is because we now use the `cryptography` library for all signing and encryption operations, but some cryptographic algorithms listed in the PDF standard are not available in `cryptography`,
so we rely on `oscrypto` for those. This is only relevant for the *decryption* of files encrypted
with a public-key security handler that uses DES, triple DES or RC2 to encrypt the key seed.

In the public API, we exclusively work with `asn1crypto` representations of ASN.1 objects, to remain as backend-independent as possible.

*Note:* While `oscrypto` is listed as optional in pyHanko's dependency list, it is still required in practice, since `pyhanko-certvalidator` depends on it.


New features and enhancements


Encryption

* Enforce `keyEncipherment` key extension by default when using public-key encryption
* Show a warning when signing a document using public-key encryption through the CLI. We currently don't support using separate encryption credentials in the CLI, and using the same key pair for decryption and signing is bad practice.
* Several minor CLI updates.


Signing

* Allow customisation of key usage requirements in signer & validator, also in the CLI.
* Actively preserve document timestamp chain in new PAdES-LTA signatures.
* Support setups where fields and annotations are separate (i.e. unmerged).
* Set the `lock` bit in the annotation flags by default.
* Tolerate signing fields that don't have any annotation associated with them.
* Broader support for PAdES / CAdES signed attributes.


Validation

* Support validating PKCS 7 signatures that don't use `signedAttrs`. Nowadays, those are rare in the wild, but there's at least one common commercial PDF library that outputs such signatures by default (vendor name redacted to protect the guilty).
* Timestamp-related fixes:
* Improve signature vs. document timestamp handling in the validation CLI.
* Improve & test handling of malformed signature dictionaries in PDF files.
* Align document timestamp updating logic with validation logic.
* Correct key usage check for time stamp validation.
* Allow customisation of key usage requirements in signer & validator, also in the CLI.
* Allow LTA update function to be used to start the timestamp chain as well as continue it.
* Tolerate indirect references in signature reference dictionaries.
* Improve some potential ambiguities in the PAdES-LT and PAdES-LTA validation logic.
* Revocation info handling changes:
* Support "retroactive" mode for revocation info (i.e. treat revocation info as valid in the past).
* Added functionality to append current revocation information to existing signatures.
* Related CLI updates.


Miscellaneous

* Some key material loading functions were cleaned up a little to make them easier to use.
* I/O tweaks: use chunked writes with a fixed buffer when copying data for an incremental update
* Warn when revocation info is embedded with an offline validation context.
* Improve SV validation reporting.


Bugs fixed

* Fix issue with `/Certs` not being properly dereferenced in the DSS (4).
* Fix loss of precision on :class:`~pyhanko.pdf_utils.generic.FloatObject` serialisation (5).
* Add missing dunders to :class:`~pyhanko.pdf_utils.generic.BooleanObject`.
* Do not use `.dump()` with `force=True` in validation.
* Corrected digest algorithm selection in timestamp validation.
* Correct handling of writes with empty user password.
* Do not automatically add xref streams to the object cache. This avoids a class of bugs with some kinds of updates to files with broken xref streams.
* Due to a typo, the `/Annots` array of a page would not get updated correctly if it was an indirect object. This has been corrected.

Page 6 of 7

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.