Rework X509 extension code
@cpu is already working on this.
Since Aug 11, 2026.
- Dominant language
- Rust
- Stars
- 505
- Forks
- 157
- Avg merge
- 39m
- Merged PRs (30d)
- 1
Description
The extension-writing code currently duplicates each extension's presence condition away from the code that encodes it (e.g. the should_write_exts gate vs. write_extensions), which has already produced bugs where requested extensions were silently dropped.
I think we should rework this to represent extensions with an internal Extension trait implemented once per extension type, with per-type from_params constructors so presence logic lives beside encoding, plus an Extensions collection that rejects duplicate OIDs (fixing https://github.com/rustls/rcgen/issues/155) and only emits the outer extensions wrapper when the built collection is non-empty. This would make emptiness observed rather than predicted, and eliminating the gate-drift bug class.
I had started on some of this in a very stale WIP branch and we should revive that before a next major release.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.