Skip to content

Clarify when certificate time getters return None - #1540

Open
ac1982 wants to merge 1 commit into
pyca:mainfrom
ac1982:docs/certificate-time-empty-values
Open

ac1982 wants to merge 1 commit into
pyca:mainfrom
ac1982:docs/certificate-time-empty-values

Conversation

@ac1982

@ac1982 ac1982 commented Oct 20, 2026 •

Copy link
Copy Markdown

Clarify when X509.get_notBefore() and get_notAfter() return None: the underlying ASN.1 time is empty, as on a newly created X509 before setting its validity period. This does not mean certificate validity bounds are optional, and None is not a general indication of timestamp parsing failure.

Fixes #1488. This is a docstring-only correction; runtime behavior is unchanged.

Validation: 8 existing notBefore/notAfter tests pass; Ruff check/format on the changed file and sphinx-build -W -b html pass. A public-API probe also checked unset timestamps, valid loaded timestamps, and nonempty malformed GeneralizedTime bytes (returned as bytes rather than None). Full TLS tests and the backend/version matrix were not run.

CI follow-up: the test/backend, downstream and documentation checks pass. Full-repository lint fails RUF012 on the preexisting Connection._reverse_mapping declaration in unchanged src/OpenSSL/SSL.py:1936; local ruff check . reproduces it. That file and the lint configuration are identical to the base.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Documentation is misleading about when get_notBefore and get_notAfter return None

1 participant