gevent.ssl
– Secure Sockets Layer (SSL/TLS) module¶This module provides SSL/TLS operations and some related functions. The
API of the functions and classes matches the API of the corresponding
items in the standard ssl
module exactly, but the
synchronous functions in this module only block the current greenlet
and let the others run.
The exact API exposed by this module varies depending on what version of Python you are using. The documents below describe the API for Python 3, Python 2.7.9 and above, and Python 2.7.8 and below, respectively.
Tip
As an implementation note, gevent’s exact behaviour will differ somewhat depending on the underlying TLS version in use. For example, the number of data exchanges involved in the handshake process, and exactly when that process occurs, will vary. This can be indirectly observed by the number and timing of greenlet switches or trips around the event loop gevent makes.
Most applications should not notice this, but some applications (and especially tests, where it is common for a process to be both a server and its own client), may find that they have coded in assumptions about the order in which multiple greenlets run. As TLS 1.3 gets deployed, those assumptions are likely to break.
Warning
All the described APIs should be imported from
gevent.ssl
, and not from their implementation modules.
Their organization is an implementation detail that may change at
any time.
The gevent-cooperative SSL object. See the version-specific documentation for details.
CertificateError
SSLCertVerificationError
SSLEOFError
SSLError
SSLSyscallError
SSLWantReadError
SSLWantWriteError
SSLZeroReturnError
socket_error
AlertDescription
DefaultVerifyPaths
Options
Purpose
SSLContext
SSLErrorNumber
SSLObject
SSLObject.cipher()
SSLObject.compression()
SSLObject.do_handshake()
SSLObject.get_channel_binding()
SSLObject.getpeercert()
SSLObject.pending()
SSLObject.read()
SSLObject.selected_alpn_protocol()
SSLObject.selected_npn_protocol()
SSLObject.shared_ciphers()
SSLObject.unwrap()
SSLObject.version()
SSLObject.write()
SSLObject.context
SSLObject.server_hostname
SSLObject.server_side
SSLObject.session
SSLObject.session_reused
SSLSocket
SSLSocket.accept()
SSLSocket.connect()
SSLSocket.connect_ex()
SSLSocket.do_handshake()
SSLSocket.dup()
SSLSocket.get_channel_binding()
SSLSocket.getpeercert()
SSLSocket.read()
SSLSocket.recv()
SSLSocket.recv_into()
SSLSocket.recvfrom()
SSLSocket.recvfrom_into()
SSLSocket.send()
SSLSocket.sendall()
SSLSocket.sendto()
SSLSocket.shared_ciphers()
SSLSocket.shutdown()
SSLSocket.version()
SSLSocket.write()
SSLSocket.session
SSLSocket.session_reused
TLSVersion
VerifyFlags
VerifyMode
DER_cert_to_PEM_cert()
PEM_cert_to_DER_cert()
RAND_add()
RAND_bytes()
RAND_pseudo_bytes()
RAND_status()
cert_time_to_seconds()
create_connection()
create_default_context()
get_default_verify_paths()
get_server_certificate()
match_hostname()
CertificateError
SSLCertVerificationError
SSLEOFError
SSLError
SSLSyscallError
SSLWantReadError
SSLWantWriteError
SSLZeroReturnError
socket_error
AlertDescription
DefaultVerifyPaths
Options
Purpose
SSLContext
SSLErrorNumber
SSLObject
SSLObject.cipher()
SSLObject.compression()
SSLObject.do_handshake()
SSLObject.get_channel_binding()
SSLObject.getpeercert()
SSLObject.pending()
SSLObject.read()
SSLObject.selected_alpn_protocol()
SSLObject.selected_npn_protocol()
SSLObject.shared_ciphers()
SSLObject.unwrap()
SSLObject.version()
SSLObject.write()
SSLObject.context
SSLObject.server_hostname
SSLObject.server_side
SSLObject.session
SSLObject.session_reused
SSLSocket
SSLSocket.accept()
SSLSocket.connect()
SSLSocket.connect_ex()
SSLSocket.do_handshake()
SSLSocket.dup()
SSLSocket.get_channel_binding()
SSLSocket.getpeercert()
SSLSocket.makefile()
SSLSocket.read()
SSLSocket.recv()
SSLSocket.recv_into()
SSLSocket.recvfrom()
SSLSocket.recvfrom_into()
SSLSocket.send()
SSLSocket.sendall()
SSLSocket.sendto()
SSLSocket.shutdown()
SSLSocket.version()
SSLSocket.write()
TLSVersion
VerifyFlags
VerifyMode
DER_cert_to_PEM_cert()
PEM_cert_to_DER_cert()
RAND_add()
RAND_bytes()
RAND_pseudo_bytes()
RAND_status()
cert_time_to_seconds()
create_default_context()
get_default_verify_paths()
get_server_certificate()
match_hostname()
CertificateError
SSLCertVerificationError
SSLEOFError
SSLError
SSLSyscallError
SSLWantReadError
SSLWantWriteError
SSLZeroReturnError
socket_error
AlertDescription
DefaultVerifyPaths
Options
Purpose
SSLContext
SSLErrorNumber
SSLObject
SSLObject.cipher()
SSLObject.compression()
SSLObject.do_handshake()
SSLObject.get_channel_binding()
SSLObject.getpeercert()
SSLObject.pending()
SSLObject.read()
SSLObject.selected_alpn_protocol()
SSLObject.selected_npn_protocol()
SSLObject.shared_ciphers()
SSLObject.unwrap()
SSLObject.version()
SSLObject.write()
SSLObject.context
SSLObject.server_hostname
SSLObject.server_side
SSLObject.session
SSLObject.session_reused
SSLSocket
SSLSocket.accept()
SSLSocket.connect()
SSLSocket.do_handshake()
SSLSocket.getpeercert()
SSLSocket.makefile()
SSLSocket.read()
SSLSocket.recv()
SSLSocket.recv_into()
SSLSocket.recvfrom()
SSLSocket.recvfrom_into()
SSLSocket.send()
SSLSocket.sendall()
SSLSocket.sendto()
SSLSocket.shutdown()
SSLSocket.write()
TLSVersion
VerifyFlags
VerifyMode
DER_cert_to_PEM_cert()
PEM_cert_to_DER_cert()
RAND_add()
RAND_bytes()
RAND_pseudo_bytes()
RAND_status()
cert_time_to_seconds()
create_connection()
create_default_context()
get_default_verify_paths()
get_server_certificate()
match_hostname()
sslwrap_simple()
wrap_socket()
Next page: gevent._ssl3
– SSL wrapper for socket objects on Python 3