Skip to content

Export OpenSSL.SSL.FILETYPE_ASN1 to match documented API - #1536

Open
00200200 wants to merge 1 commit into
pyca:mainfrom
00200200:export-ssl-filetype-asn1
Open

00200200 wants to merge 1 commit into
pyca:mainfrom
00200200:export-ssl-filetype-asn1

Conversation

@00200200

Copy link
Copy Markdown

Summary

Fixes #1217.

OpenSSL.SSL documentation lists FILETYPE_ASN1 for Context.use_certificate_file / use_privatekey_file, but the module only imported FILETYPE_PEM from OpenSSL.crypto. Accessing OpenSSL.SSL.FILETYPE_ASN1 raised AttributeError.

This PR re-exports FILETYPE_ASN1 (and adds both file-type constants to SSL.__all__) so the public SSL API matches the docs and the existing crypto constants.

Test plan

  • tests/test_ssl.py::TestConstants::test_filetype_asn1 fails on main (ImportError / missing attribute) and passes with this change
  • TestConstants (13 tests) pass locally
  • ruff check / ruff format --check clean on touched Python files

The SSL docs advertise FILETYPE_ASN1 for use_certificate_file and
use_privatekey_file, but only FILETYPE_PEM was imported from crypto.
Re-export both constants via SSL.__all__ and cover with a regression test.

Fixes pyca#1217
@Saulhernandezm40

Saulhernandezm40 commented Sep 30, 2026 via email

Copy link
Copy Markdown

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.

Missing export of OpenSSL.SSL.FILETYPE_ASN1

2 participants