@@ -543,20 +543,28 @@ Constants
543543.. data :: CERT_NONE
544544
545545 Possible value for :attr: `SSLContext.verify_mode `, or the ``cert_reqs ``
546- parameter to :func: `wrap_socket `. In this mode (the default), no
547- certificates will be required from the other side of the socket connection.
548- If a certificate is received from the other end, no attempt to validate it
549- is made.
546+ parameter to :func: `wrap_socket `. Except for :const: `PROTOCOL_TLS_CLIENT `,
547+ it is the default mode. With client-side sockets, just about any
548+ cert is accepted. Validation errors, such as untrusted or expired cert,
549+ are ignored and do not abort the TLS/SSL handshake.
550+
551+ In server mode, no certificate is requested from the client, so the client
552+ does not send any for client cert authentication.
550553
551554 See the discussion of :ref: `ssl-security ` below.
552555
553556.. data :: CERT_OPTIONAL
554557
555558 Possible value for :attr: `SSLContext.verify_mode `, or the ``cert_reqs ``
556- parameter to :func: `wrap_socket `. In this mode no certificates will be
557- required from the other side of the socket connection; but if they
558- are provided, validation will be attempted and an :class: `SSLError `
559- will be raised on failure.
559+ parameter to :func: `wrap_socket `. In client mode, :const: `CERT_OPTIONAL `
560+ has the same meaning as :const: `CERT_REQUIRED `. It is recommended to
561+ use :const: `CERT_REQUIRED ` for client-side sockets instead.
562+
563+ In server mode, a client certificate request is sent to the client. The
564+ client may either ignore the request or send a certificate in order
565+ perform TLS client cert authentication. If the client chooses to send
566+ a certificate, it is verified. Any verification error immediately aborts
567+ the TLS handshake.
560568
561569 Use of this setting requires a valid set of CA certificates to
562570 be passed, either to :meth: `SSLContext.load_verify_locations ` or as a
@@ -568,6 +576,15 @@ Constants
568576 parameter to :func: `wrap_socket `. In this mode, certificates are
569577 required from the other side of the socket connection; an :class: `SSLError `
570578 will be raised if no certificate is provided, or if its validation fails.
579+ This mode is **not ** sufficient to verify a certificate in client mode as
580+ it does not match hostnames. :attr: `~SSLContext.check_hostname ` must be
581+ enabled as well to verify the authenticity of a cert.
582+ :const: `PROTOCOL_TLS_CLIENT ` uses :const: `CERT_REQUIRED ` and
583+ enables :attr: `~SSLContext.check_hostname ` by default.
584+
585+ With server socket, this mode provides mandatory TLS client cert
586+ authentication. A client certificate request is sent to the client and
587+ the client must provide a valid and trusted certificate.
571588
572589 Use of this setting requires a valid set of CA certificates to
573590 be passed, either to :meth: `SSLContext.load_verify_locations ` or as a
0 commit comments