cheroot.ssl package#

Submodules#

Module contents#

Implementation of the SSL adapter base interface.

class cheroot.ssl.Adapter(certificate, private_key, certificate_chain=None, ciphers=None, *, private_key_password=None)#

Bases: ABC

Base class for SSL driver library adapters.

Required methods:

  • wrap(sock) -> (wrapped socket, ssl environ dict)

  • makefile(sock, mode='r', bufsize=DEFAULT_BUFFER_SIZE) -> socket file object

_abc_impl = <_abc._abc_data object>#
_prompt_for_tls_password() str#

Prompt for encrypted private key password interactively.

bind(sock)#

Return the given socket.

Deprecated: This method no longer performs any SSL-specific operations. SSL wrapping now happens in wrap(). bind() will be removed in a future version.

abstract get_environ()#

Return WSGI environ entries to be merged into each request.

abstract makefile(sock, mode='r', bufsize=-1)#

Return socket file object.

abstract wrap(sock)#

Wrap the given socket and return WSGI environ entries.

cheroot.ssl._ensure_peer_speaks_https(raw_socket, /) None#

Raise exception if the client sent plain HTTP.

This method probes the TCP stream for signs of the peer having sent us plaintext HTTP on the HTTPS port by peeking at the first bytes. If there’s no data yet, the method considers the guess inconclusive and does not error out. This allows the server to continue until the SSL handshake is attempted, at which point an error will be caught by the SSL layer if the client is not speaking TLS.

Raises:

NoSSLError – When plaintext HTTP is detected on an HTTPS socket