pyca / pyca/cryptography

Expose all x509 verification policy options

Open
#14,765 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.8k
Forks
1.8k
Avg merge
7h 48m
Merged PRs (30d)
157

Description

Although the library does a pretty good job of validating X.509 certificates following the WebPKI spec, it currently does not expose everything to allow implementing policies from other specifications or implementations.

In my case, I try to verify (legacy) code signing certificates with low RSA moduli, but minimum_rsa_modulus is not exposed to the PolicyBuilder API.

It could make sense to wrap this in some sort of algorithm policy, but perhaps that is making it more complicated than really needed. It should at least be possible to disable this check, or specify a different minimum modulus.

Additionally, it appears not possible to modify the extended_key_usage it checks for in EE certificates. Perhaps this could be worked around by defining an ExtensionPolicy, but that will require some additional (duplicate) code.

There may be more policy related settings that are unmodifiably defaulted to WebPKI standards. I believe all of these should be modifiable (or entirely disableable) by a custom policy.

permitted_public_key_algorithms and permitted_signature_algorithms were already identified and tracked in #13391

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the PolicyBuilder API and trace how minimum_rsa_modulus and extended_key_usage are currently fixed during certificate verification. Review the already tracked permitted_public_key_algorithms and permitted_signature_algorithms work in #13391, then identify the complete set of WebPKI-defaulted policy settings and define how a custom policy should configure or disable them. Done means the policy surface and its expected behavior are agreed and covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, cryptography, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.