@@ -125,7 +125,8 @@ Context creation
125125A convenience function helps create :class: `SSLContext ` objects for common
126126purposes.
127127
128- .. function :: create_default_context(purpose=Purpose.SERVER_AUTH, cafile=None, capath=None, cadata=None)
128+ .. function :: create_default_context(purpose=Purpose.SERVER_AUTH, *,\
129+ cafile=None, capath=None, cadata=None)
129130
130131 Return a new :class: `SSLContext ` object with default settings for
131132 the given *purpose *. The settings are chosen by the :mod: `ssl ` module,
@@ -314,7 +315,7 @@ Exceptions
314315Random generation
315316^^^^^^^^^^^^^^^^^
316317
317- .. function :: RAND_bytes(num)
318+ .. function :: RAND_bytes(num, / )
318319
319320 Return *num * cryptographically strong pseudo-random bytes. Raises an
320321 :class: `SSLError ` if the PRNG has not been seeded with enough data or if the
@@ -338,7 +339,7 @@ Random generation
338339 :func: `ssl.RAND_egd ` and :func: `ssl.RAND_add ` to increase the randomness of
339340 the pseudo-random number generator.
340341
341- .. function :: RAND_add(bytes, entropy)
342+ .. function :: RAND_add(bytes, entropy, / )
342343
343344 Mix the given *bytes * into the SSL pseudo-random number generator. The
344345 parameter *entropy * (a float) is a lower bound on the entropy contained in
@@ -406,12 +407,12 @@ Certificate handling
406407 .. versionchanged :: 3.10
407408 The *timeout * parameter was added.
408409
409- .. function :: DER_cert_to_PEM_cert(DER_cert_bytes )
410+ .. function :: DER_cert_to_PEM_cert(der_cert_bytes )
410411
411412 Given a certificate as a DER-encoded blob of bytes, returns a PEM-encoded
412413 string version of the same certificate.
413414
414- .. function :: PEM_cert_to_DER_cert(PEM_cert_string )
415+ .. function :: PEM_cert_to_DER_cert(pem_cert_string )
415416
416417 Given a certificate as an ASCII PEM string, returns a DER-encoded sequence of
417418 bytes for that same certificate.
@@ -1122,10 +1123,10 @@ SSL sockets also have the following additional methods and attributes:
11221123 .. deprecated :: 3.6
11231124 Use :meth: `~SSLSocket.recv ` instead of :meth: `~SSLSocket.read `.
11241125
1125- .. method :: SSLSocket.write(buf )
1126+ .. method :: SSLSocket.write(data )
11261127
1127- Write *buf * to the SSL socket and return the number of bytes written. The
1128- *buf * argument must be an object supporting the buffer interface.
1128+ Write *data * to the SSL socket and return the number of bytes written. The
1129+ *data * argument must be an object supporting the buffer interface.
11291130
11301131 Raise :exc: `SSLWantReadError ` or :exc: `SSLWantWriteError ` if the socket is
11311132 :ref: `non-blocking <ssl-nonblocking >` and the write would block.
@@ -1135,7 +1136,7 @@ SSL sockets also have the following additional methods and attributes:
11351136
11361137 .. versionchanged :: 3.5
11371138 The socket timeout is no longer reset each time bytes are received or sent.
1138- The socket timeout is now the maximum total duration to write *buf *.
1139+ The socket timeout is now the maximum total duration to write *data *.
11391140
11401141 .. deprecated :: 3.6
11411142 Use :meth: `~SSLSocket.send ` instead of :meth: `~SSLSocket.write `.
@@ -1152,12 +1153,15 @@ SSL sockets also have the following additional methods and attributes:
11521153 :meth: `~socket.socket.recv ` and :meth: `~socket.socket.send ` instead of these
11531154 methods.
11541155
1155- .. method :: SSLSocket.do_handshake()
1156+ .. method :: SSLSocket.do_handshake(block=False )
11561157
11571158 Perform the SSL setup handshake.
11581159
1160+ If *block * is true and the timeout obtained by :meth: `~socket.socket.gettimeout `
1161+ is zero, the socket is set in blocking mode until the handshake is performed.
1162+
11591163 .. versionchanged :: 3.4
1160- The handshake method also performs :func: `match_hostname ` when the
1164+ The handshake method also performs :func: `! match_hostname ` when the
11611165 :attr: `~SSLContext.check_hostname ` attribute of the socket's
11621166 :attr: `~SSLSocket.context ` is true.
11631167
@@ -1167,7 +1171,7 @@ SSL sockets also have the following additional methods and attributes:
11671171
11681172 .. versionchanged :: 3.7
11691173 Hostname or IP address is matched by OpenSSL during handshake. The
1170- function :func: `match_hostname ` is no longer used. In case OpenSSL
1174+ function :func: `! match_hostname ` is no longer used. In case OpenSSL
11711175 refuses a hostname or IP address, the handshake is aborted early and
11721176 a TLS alert message is sent to the peer.
11731177
@@ -1637,7 +1641,7 @@ to speed up repeated connections from the same clients.
16371641 provided as part of the operating system, though, it is likely to be
16381642 configured properly.
16391643
1640- .. method :: SSLContext.set_ciphers(ciphers)
1644+ .. method :: SSLContext.set_ciphers(ciphers, / )
16411645
16421646 Set the available ciphers for sockets created with this context.
16431647 It should be a string in the `OpenSSL cipher list format
@@ -1653,7 +1657,7 @@ to speed up repeated connections from the same clients.
16531657 TLS 1.3 cipher suites cannot be disabled with
16541658 :meth: `~SSLContext.set_ciphers `.
16551659
1656- .. method :: SSLContext.set_alpn_protocols(protocols )
1660+ .. method :: SSLContext.set_alpn_protocols(alpn_protocols )
16571661
16581662 Specify which protocols the socket should advertise during the SSL/TLS
16591663 handshake. It should be a list of ASCII strings, like ``['http/1.1',
@@ -1667,7 +1671,7 @@ to speed up repeated connections from the same clients.
16671671
16681672 .. versionadded :: 3.5
16691673
1670- .. method :: SSLContext.set_npn_protocols(protocols )
1674+ .. method :: SSLContext.set_npn_protocols(npn_protocols )
16711675
16721676 Specify which protocols the socket should advertise during the SSL/TLS
16731677 handshake. It should be a list of strings, like ``['http/1.1', 'spdy/2'] ``,
@@ -1734,7 +1738,7 @@ to speed up repeated connections from the same clients.
17341738
17351739 .. versionadded :: 3.7
17361740
1737- .. attribute :: SSLContext.set_servername_callback(server_name_callback)
1741+ .. method :: SSLContext.set_servername_callback(server_name_callback)
17381742
17391743 This is a legacy API retained for backwards compatibility. When possible,
17401744 you should use :attr: `sni_callback ` instead. The given *server_name_callback *
@@ -1748,7 +1752,7 @@ to speed up repeated connections from the same clients.
17481752
17491753 .. versionadded :: 3.4
17501754
1751- .. method :: SSLContext.load_dh_params(dhfile)
1755+ .. method :: SSLContext.load_dh_params(dhfile, / )
17521756
17531757 Load the key generation parameters for Diffie-Hellman (DH) key exchange.
17541758 Using DH key exchange improves forward secrecy at the expense of
@@ -1761,7 +1765,7 @@ to speed up repeated connections from the same clients.
17611765
17621766 .. versionadded :: 3.3
17631767
1764- .. method :: SSLContext.set_ecdh_curve(curve_name)
1768+ .. method :: SSLContext.set_ecdh_curve(curve_name, / )
17651769
17661770 Set the curve name for Elliptic Curve-based Diffie-Hellman (ECDH) key
17671771 exchange. ECDH is significantly faster than regular DH while arguably
@@ -2635,12 +2639,12 @@ purpose. It wraps an OpenSSL memory BIO (Basic IO) object:
26352639 A boolean indicating whether the memory BIO is current at the end-of-file
26362640 position.
26372641
2638- .. method :: MemoryBIO.read(n=-1)
2642+ .. method :: MemoryBIO.read(n=-1, / )
26392643
26402644 Read up to *n * bytes from the memory buffer. If *n * is not specified or
26412645 negative, all bytes are returned.
26422646
2643- .. method :: MemoryBIO.write(buf)
2647+ .. method :: MemoryBIO.write(buf, / )
26442648
26452649 Write the bytes from *buf * to the memory BIO. The *buf * argument must be an
26462650 object supporting the buffer protocol.
@@ -2723,7 +2727,7 @@ This common check is automatically performed when
27232727
27242728.. versionchanged :: 3.7
27252729 Hostname matchings is now performed by OpenSSL. Python no longer uses
2726- :func: `match_hostname `.
2730+ :func: `! match_hostname `.
27272731
27282732In server mode, if you want to authenticate your clients using the SSL layer
27292733(rather than using a higher-level authentication mechanism), you'll also have
0 commit comments