Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1f8dfd6

Browse files
committed
bpo-18233: Rename SSLSocket.get_peer_cert_chain to SSLSocket.get_unverified_chain
1 parent 3324381 commit 1f8dfd6

File tree

6 files changed

+22
-22
lines changed

6 files changed

+22
-22
lines changed

Doc/library/ssl.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,7 @@ SSL sockets also have the following additional methods and attributes:
12591259
.. versionchanged:: 3.9
12601260
IPv6 address strings no longer have a trailing new line.
12611261

1262-
.. method:: SSLSocket.get_peer_cert_chain(binary_form=False)
1262+
.. method:: SSLSocket.get_unverified_chain(binary_form=False)
12631263

12641264
Returns an **unverified** certificate chain for the peer. If no chain is
12651265
provided, returns :const:`None`. Otherwise returns a tuple of dicts

Lib/ssl.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -905,12 +905,12 @@ def getpeercert(self, binary_form=False):
905905
"""
906906
return self._sslobj.getpeercert(binary_form)
907907

908-
def get_peer_cert_chain(self, binary_form=False):
908+
def get_unverified_chain(self, binary_form=False):
909909
""""Returns the certificate chain of the SSL connection as a tuple of
910910
dicts. It is *not* a verified chain.
911911
912912
Return ``None`` if no chain is provided."""
913-
return self._sslobj.get_peer_cert_chain(binary_form)
913+
return self._sslobj.get_unverified_chain(binary_form)
914914

915915
if hasattr(_ssl._SSLSocket, 'get_verified_chain'):
916916
def get_verified_chain(self, binary_form=False):
@@ -1139,10 +1139,10 @@ def getpeercert(self, binary_form=False):
11391139
return self._sslobj.getpeercert(binary_form)
11401140

11411141
@_sslcopydoc
1142-
def get_peer_cert_chain(self, binary_form=False):
1142+
def get_unverified_chain(self, binary_form=False):
11431143
self._checkClosed()
11441144
self._check_connected()
1145-
return self._sslobj.get_peer_cert_chain(binary_form)
1145+
return self._sslobj.get_unverified_chain(binary_form)
11461146

11471147
if hasattr(_ssl._SSLSocket, 'get_verified_chain'):
11481148
@_sslcopydoc

Lib/test/test_ssl.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2160,7 +2160,7 @@ def test_get_ca_certs_capath(self):
21602160
self.assertTrue(cert)
21612161
self.assertEqual(len(ctx.get_ca_certs()), 1)
21622162

2163-
def test_get_peer_cert_chain(self):
2163+
def test_get_unverified_chain(self):
21642164
ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
21652165
ctx.verify_mode = ssl.CERT_REQUIRED
21662166
ctx.load_verify_locations(capath=CAPATH)
@@ -2169,8 +2169,8 @@ def test_get_peer_cert_chain(self):
21692169
try:
21702170
peer_cert = s.getpeercert()
21712171
peer_cert_bin = s.getpeercert(True)
2172-
chain_no_validate = s.get_peer_cert_chain()
2173-
chain_bin_no_validate = s.get_peer_cert_chain(True)
2172+
chain_no_validate = s.get_unverified_chain()
2173+
chain_bin_no_validate = s.get_unverified_chain(True)
21742174
finally:
21752175
self.assertTrue(peer_cert)
21762176
self.assertTrue(peer_cert_bin)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Add :meth:`ssl.SSLSocket.get_peer_cert_chain` and :meth:`ssl.SSLSocket.get_verified_chain` for accessing the certificate chain of SSL connections.
1+
Add :meth:`ssl.SSLSocket.get_unverified_chain` and :meth:`ssl.SSLSocket.get_verified_chain` for accessing the certificate chain of SSL connections.

Modules/_ssl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2130,13 +2130,13 @@ chain_to_pyobject(STACK_OF(X509) *peer_chain, int binary_mode)
21302130
}
21312131

21322132
/*[clinic input]
2133-
_ssl._SSLSocket.get_peer_cert_chain
2133+
_ssl._SSLSocket.get_unverified_chain
21342134
der as binary_mode: bool = False
21352135
[clinic start generated code]*/
21362136

21372137
static PyObject *
2138-
_ssl__SSLSocket_get_peer_cert_chain_impl(PySSLSocket *self, int binary_mode)
2139-
/*[clinic end generated code: output=2fc1e5dce85798ba input=3dd8f43730febaa9]*/
2138+
_ssl__SSLSocket_get_unverified_chain_impl(PySSLSocket *self, int binary_mode)
2139+
/*[clinic end generated code: output=a84c4e7bb50f3477 input=842931a7d60f135e]*/
21402140
{
21412141
STACK_OF(X509) *peer_chain; /* reference */
21422142

@@ -3089,7 +3089,7 @@ static PyMethodDef PySSLMethods[] = {
30893089
_SSL__SSLSOCKET_GET_CHANNEL_BINDING_METHODDEF
30903090
_SSL__SSLSOCKET_CIPHER_METHODDEF
30913091
_SSL__SSLSOCKET_SHARED_CIPHERS_METHODDEF
3092-
_SSL__SSLSOCKET_GET_PEER_CERT_CHAIN_METHODDEF
3092+
_SSL__SSLSOCKET_GET_UNVERIFIED_CHAIN_METHODDEF
30933093
#ifdef OPENSSL_VERSION_1_1
30943094
_SSL__SSLSOCKET_GET_VERIFIED_CHAIN_METHODDEF
30953095
#endif

Modules/clinic/_ssl.c.h

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)