@@ -130,6 +130,7 @@ purposes.
130
130
:meth: `SSLContext.load_verify_locations `. If all three are
131
131
:const: `None `, this function can choose to trust the system's default
132
132
CA certificates instead.
133
+ CA certificates instead.
133
134
134
135
The settings are: :data: `PROTOCOL_TLS `, :data: `OP_NO_SSLv2 `, and
135
136
:data: `OP_NO_SSLv3 ` with high encryption cipher suites without RC4 and
@@ -2226,13 +2227,16 @@ right)::
2226
2227
certificates in ``/etc/ssl/certs/ca-bundle.crt ``; if not, you'll get an
2227
2228
error and have to adjust the location)
2228
2229
2230
+ The :data: `PROTOCOL_TLS_CLIENT ` protocol configures the context for cert
2231
+ validation and hostname verification. :attr: `~SSLContext.verify_mode ` is
2232
+ set to :data: `CERT_REQUIRED ` and :attr: `~SSLContext.check_hostname ` is set
2233
+ to ``True ``. All other protocols create SSL contexts with insecure defaults.
2234
+
2229
2235
When you use the context to connect to a server, :const: `CERT_REQUIRED `
2230
- validates the server certificate and :meth: `~SSLContext.check_hostname `
2231
- matches the hostname. Both setting ensure that the server certificate
2232
- was signed with one of the CA certificates and is a valid certificate
2233
- for the given server name. The :data: `PROTOCOL_TLS_CLIENT ` protocol
2234
- configures the context for cert and hostname verification. All
2235
- remaining protocols are insecure by default::
2236
+ and :attr: `~SSLContext.check_hostname ` validate the server certificate: it
2237
+ ensures that the server certificate was signed with one of the CA
2238
+ certificates, checks the signature for correctness, and verifies other
2239
+ properties like validity and identity of the host::
2236
2240
2237
2241
>>> conn = context.wrap_socket(socket.socket(socket.AF_INET),
2238
2242
... server_hostname="www.python.org")
0 commit comments