Skip to content

bpo-18233: Add internal methods to access peer chain (GH-25467) - #25467

Merged
tiran merged 1 commit into
python:masterfrom
tiran:bpo-18233-internal-chain
Apr 26, 2021
Merged

tiran merged 1 commit into
python:masterfrom
tiran:bpo-18233-internal-chain

Conversation

@tiran

@tiran tiran commented Apr 18, 2021 •

Copy link
Copy Markdown
Member

The internal _ssl._SSLSocket object now provides methods to retrieve
the peer cert chain and verified cert chain as a list of Certificate
objects. Certificate objects have methods to convert the cert to a dict,
PEM, or DER (ASN.1).

These are private APIs for now. There is a slim chance to stabilize the
approach and provide a public API for 3.10. Otherwise I'll provide a
stable API in 3.11.

Signed-off-by: Christian Heimes christian@python.org

  • write tests for server side socket
  • fix unverified cert getter to return full chain.

https://bugs.python.org/issue18233

@tiran
tiran force-pushed the bpo-18233-internal-chain branch 2 times, most recently from 3e7e4ba to 7a6c053 Compare April 24, 2021 05:53
The internal `_ssl._SSLSocket` object now provides methods to retrieve
the peer cert chain and verified cert chain as a list of Certificate
objects. Certificate objects have methods to convert the cert to a dict,
PEM, or DER (ASN.1).

These are private APIs for now. There is a slim chance to stabilize the
approach and provide a public API for 3.10. Otherwise I'll provide a
stable API in 3.11.

Signed-off-by: Christian Heimes <christian@python.org>
@tiran
tiran force-pushed the bpo-18233-internal-chain branch from 7a6c053 to b687814 Compare April 24, 2021 05:54
@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @tiran for commit b687814 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@tiran tiran added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 24, 2021
@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 24, 2021
@tiran
tiran marked this pull request as ready for review April 24, 2021 05:59
@tiran

tiran commented Apr 26, 2021

Copy link
Copy Markdown
Member Author

refleak failures are cause by test_asyncio timeouts.

@tiran tiran changed the title bpo-18233: Add internal methods to access peer chain Apr 26, 2021
@tiran
tiran merged commit 666991f into python:master Apr 26, 2021
@tiran
tiran deleted the bpo-18233-internal-chain branch April 26, 2021 13:01
sethmlarson added a commit to elastic/elastic-transport-python that referenced this pull request Oct 1, 2021
`SSLObject.get_verified_chain()` and `Certificate.public_bytes()` are private APIs in CPython 3.10.
They're not documented anywhere yet but seem to work and we need them for Security on by Default.
See: python/cpython#25467
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants