@@ -125,7 +125,8 @@ Context creation
125
125
A convenience function helps create :class: `SSLContext ` objects for common
126
126
purposes.
127
127
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)
129
130
130
131
Return a new :class: `SSLContext ` object with default settings for
131
132
the given *purpose *. The settings are chosen by the :mod: `ssl ` module,
@@ -314,7 +315,7 @@ Exceptions
314
315
Random generation
315
316
^^^^^^^^^^^^^^^^^
316
317
317
- .. function :: RAND_bytes(num)
318
+ .. function :: RAND_bytes(num, / )
318
319
319
320
Return *num * cryptographically strong pseudo-random bytes. Raises an
320
321
:class: `SSLError ` if the PRNG has not been seeded with enough data or if the
@@ -338,7 +339,7 @@ Random generation
338
339
:func: `ssl.RAND_egd ` and :func: `ssl.RAND_add ` to increase the randomness of
339
340
the pseudo-random number generator.
340
341
341
- .. function :: RAND_add(bytes, entropy)
342
+ .. function :: RAND_add(bytes, entropy, / )
342
343
343
344
Mix the given *bytes * into the SSL pseudo-random number generator. The
344
345
parameter *entropy * (a float) is a lower bound on the entropy contained in
@@ -406,12 +407,12 @@ Certificate handling
406
407
.. versionchanged :: 3.10
407
408
The *timeout * parameter was added.
408
409
409
- .. function :: DER_cert_to_PEM_cert(DER_cert_bytes )
410
+ .. function :: DER_cert_to_PEM_cert(der_cert_bytes )
410
411
411
412
Given a certificate as a DER-encoded blob of bytes, returns a PEM-encoded
412
413
string version of the same certificate.
413
414
414
- .. function :: PEM_cert_to_DER_cert(PEM_cert_string )
415
+ .. function :: PEM_cert_to_DER_cert(pem_cert_string )
415
416
416
417
Given a certificate as an ASCII PEM string, returns a DER-encoded sequence of
417
418
bytes for that same certificate.
@@ -1122,10 +1123,10 @@ SSL sockets also have the following additional methods and attributes:
1122
1123
.. deprecated :: 3.6
1123
1124
Use :meth: `~SSLSocket.recv ` instead of :meth: `~SSLSocket.read `.
1124
1125
1125
- .. method :: SSLSocket.write(buf )
1126
+ .. method :: SSLSocket.write(data )
1126
1127
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.
1129
1130
1130
1131
Raise :exc: `SSLWantReadError ` or :exc: `SSLWantWriteError ` if the socket is
1131
1132
:ref: `non-blocking <ssl-nonblocking >` and the write would block.
@@ -1135,7 +1136,7 @@ SSL sockets also have the following additional methods and attributes:
1135
1136
1136
1137
.. versionchanged :: 3.5
1137
1138
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 *.
1139
1140
1140
1141
.. deprecated :: 3.6
1141
1142
Use :meth: `~SSLSocket.send ` instead of :meth: `~SSLSocket.write `.
@@ -1152,10 +1153,13 @@ SSL sockets also have the following additional methods and attributes:
1152
1153
:meth: `~socket.socket.recv ` and :meth: `~socket.socket.send ` instead of these
1153
1154
methods.
1154
1155
1155
- .. method :: SSLSocket.do_handshake()
1156
+ .. method :: SSLSocket.do_handshake(block=False )
1156
1157
1157
1158
Perform the SSL setup handshake.
1158
1159
1160
+ If *block * is true and the timeout obtained by :meth: `~socket.gettimeout `
1161
+ is zero, the socket is set in blocking mode until the handshake is performed.
1162
+
1159
1163
.. versionchanged :: 3.4
1160
1164
The handshake method also performs :func: `match_hostname ` when the
1161
1165
:attr: `~SSLContext.check_hostname ` attribute of the socket's
@@ -1637,7 +1641,7 @@ to speed up repeated connections from the same clients.
1637
1641
provided as part of the operating system, though, it is likely to be
1638
1642
configured properly.
1639
1643
1640
- .. method :: SSLContext.set_ciphers(ciphers)
1644
+ .. method :: SSLContext.set_ciphers(ciphers, / )
1641
1645
1642
1646
Set the available ciphers for sockets created with this context.
1643
1647
It should be a string in the `OpenSSL cipher list format
@@ -1653,7 +1657,7 @@ to speed up repeated connections from the same clients.
1653
1657
TLS 1.3 cipher suites cannot be disabled with
1654
1658
:meth: `~SSLContext.set_ciphers `.
1655
1659
1656
- .. method :: SSLContext.set_alpn_protocols(protocols )
1660
+ .. method :: SSLContext.set_alpn_protocols(alpn_protocols )
1657
1661
1658
1662
Specify which protocols the socket should advertise during the SSL/TLS
1659
1663
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.
1667
1671
1668
1672
.. versionadded :: 3.5
1669
1673
1670
- .. method :: SSLContext.set_npn_protocols(protocols )
1674
+ .. method :: SSLContext.set_npn_protocols(npn_protocols )
1671
1675
1672
1676
Specify which protocols the socket should advertise during the SSL/TLS
1673
1677
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.
1734
1738
1735
1739
.. versionadded :: 3.7
1736
1740
1737
- .. attribute :: SSLContext.set_servername_callback(server_name_callback)
1741
+ .. method :: SSLContext.set_servername_callback(server_name_callback)
1738
1742
1739
1743
This is a legacy API retained for backwards compatibility. When possible,
1740
1744
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.
1748
1752
1749
1753
.. versionadded :: 3.4
1750
1754
1751
- .. method :: SSLContext.load_dh_params(dhfile)
1755
+ .. method :: SSLContext.load_dh_params(dhfile, / )
1752
1756
1753
1757
Load the key generation parameters for Diffie-Hellman (DH) key exchange.
1754
1758
Using DH key exchange improves forward secrecy at the expense of
@@ -1761,7 +1765,7 @@ to speed up repeated connections from the same clients.
1761
1765
1762
1766
.. versionadded :: 3.3
1763
1767
1764
- .. method :: SSLContext.set_ecdh_curve(curve_name)
1768
+ .. method :: SSLContext.set_ecdh_curve(curve_name, / )
1765
1769
1766
1770
Set the curve name for Elliptic Curve-based Diffie-Hellman (ECDH) key
1767
1771
exchange. ECDH is significantly faster than regular DH while arguably
@@ -2635,12 +2639,12 @@ purpose. It wraps an OpenSSL memory BIO (Basic IO) object:
2635
2639
A boolean indicating whether the memory BIO is current at the end-of-file
2636
2640
position.
2637
2641
2638
- .. method :: MemoryBIO.read(n=-1)
2642
+ .. method :: MemoryBIO.read(n=-1, / )
2639
2643
2640
2644
Read up to *n * bytes from the memory buffer. If *n * is not specified or
2641
2645
negative, all bytes are returned.
2642
2646
2643
- .. method :: MemoryBIO.write(buf)
2647
+ .. method :: MemoryBIO.write(buf, / )
2644
2648
2645
2649
Write the bytes from *buf * to the memory BIO. The *buf * argument must be an
2646
2650
object supporting the buffer protocol.
0 commit comments