Skip to content

Commit 9d01717

Browse files
committed
Issue python#20896, python#22935: The ssl.get_server_certificate() function now uses the
ssl.PROTOCOL_SSLv23 protocol by default, not ssl.PROTOCOL_SSLv3, for maximum compatibility and support platforms where ssl.PROTOCOL_SSLv3 support is disabled.
1 parent 5819cfa commit 9d01717

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

Lib/ssl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ def PEM_cert_to_DER_cert(pem_cert_string):
922922
d = pem_cert_string.strip()[len(PEM_HEADER):-len(PEM_FOOTER)]
923923
return base64.decodebytes(d.encode('ASCII', 'strict'))
924924

925-
def get_server_certificate(addr, ssl_version=PROTOCOL_SSLv3, ca_certs=None):
925+
def get_server_certificate(addr, ssl_version=PROTOCOL_SSLv23, ca_certs=None):
926926
"""Retrieve the certificate from the server at the specified address,
927927
and return it as a PEM-encoded string.
928928
If 'ca_certs' is specified, validate the server cert against it.

Misc/NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ Core and Builtins
4444
Library
4545
-------
4646

47+
- Issue #20896, #22935: The :func:`ssl.get_server_certificate` function now
48+
uses the :data:`~ssl.PROTOCOL_SSLv23` protocol by default, not
49+
:data:`~ssl.PROTOCOL_SSLv3`, for maximum compatibility and support platforms
50+
where :data:`~ssl.PROTOCOL_SSLv3` support is disabled.
51+
4752
- Issue #23111: In the ftplib, make ssl.PROTOCOL_SSLv23 the default protocol
4853
version.
4954

0 commit comments

Comments
 (0)