Skip to content

gh-118658: Modify cert generation script to extract cert3.pem - #124599

Closed
felixfontein wants to merge 1 commit into
python:mainfrom
felixfontein:cert3-2
Closed

felixfontein wants to merge 1 commit into
python:mainfrom
felixfontein:cert3-2

Conversation

@felixfontein

@felixfontein felixfontein commented Sep 26, 2024 •

Copy link
Copy Markdown
Contributor

An alternative to #124598 that's simpler. The additional data in cert3.pem shouldn't affect the tests.

Edit: doesn't work since PEM_cert_to_DER_cert doesn't like PEM comments.

@felixfontein

Copy link
Copy Markdown
Contributor Author

The additional data in cert3.pem shouldn't affect the tests.

Apparently it does:

ERROR: test_certificate_chain (test.test_ssl.TestPostHandshakeAuth.test_certificate_chain)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/cpython/cpython/Lib/test/test_ssl.py", line 4707, in test_certificate_chain
    expected_ee_cert = ssl.PEM_cert_to_DER_cert(f.read())
  File "/home/runner/work/cpython/cpython/Lib/ssl.py", line 1498, in PEM_cert_to_DER_cert
    raise ValueError("Invalid PEM encoding; must start with %s"
                     % PEM_HEADER)
ValueError: Invalid PEM encoding; must start with -----BEGIN CERTIFICATE-----

So PEM_cert_to_DER_cert doesn't like PEM with comments. I guess in that case #124598 is preferable.

@felixfontein
felixfontein marked this pull request as draft September 26, 2024 13:43
@felixfontein
felixfontein deleted the cert3-2 branch September 26, 2024 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant