mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
[3.13] gh-118658: Return consistent types from get_un/verified_chain
in SSLObject
and SSLSocket
(GH-118669) (#123082)
gh-118658: Return consistent types from `get_un/verified_chain` in `SSLObject` and `SSLSocket` (GH-118669)
(cherry picked from commit 8ef358dae1
)
Co-authored-by: Mateusz Nowak <nowak.mateusz@hotmail.com>
Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
This commit is contained in:
parent
0a02026a08
commit
21399a0963
4 changed files with 86 additions and 2 deletions
14
Lib/ssl.py
14
Lib/ssl.py
|
@ -1165,11 +1165,21 @@ class SSLSocket(socket):
|
|||
|
||||
@_sslcopydoc
|
||||
def get_verified_chain(self):
|
||||
return self._sslobj.get_verified_chain()
|
||||
chain = self._sslobj.get_verified_chain()
|
||||
|
||||
if chain is None:
|
||||
return []
|
||||
|
||||
return [cert.public_bytes(_ssl.ENCODING_DER) for cert in chain]
|
||||
|
||||
@_sslcopydoc
|
||||
def get_unverified_chain(self):
|
||||
return self._sslobj.get_unverified_chain()
|
||||
chain = self._sslobj.get_unverified_chain()
|
||||
|
||||
if chain is None:
|
||||
return []
|
||||
|
||||
return [cert.public_bytes(_ssl.ENCODING_DER) for cert in chain]
|
||||
|
||||
@_sslcopydoc
|
||||
def selected_npn_protocol(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue