mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-118658: Return consistent types from get_un/verified_chain
in SSLObject
and SSLSocket
(#118669)
Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
This commit is contained in:
parent
c13e7d98fb
commit
8ef358dae1
4 changed files with 86 additions and 2 deletions
14
Lib/ssl.py
14
Lib/ssl.py
|
@ -1164,11 +1164,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