gevent._sslgte279
– SSL wrapper for socket objects on Python 2.7.9 and above¶SSL wrapper for socket objects on Python 2.7.9 and above.
For the documentation, refer to ssl
module manual.
This module implements cooperative SSL socket wrappers.
alias of SSLCertVerificationError
Bases: SSLError
, ValueError
A certificate could not be verified.
Bases: SSLError
Non-blocking SSL socket needs to read more data before the requested operation can be completed.
Bases: SSLError
Non-blocking SSL socket needs to write more data before the requested operation can be completed.
Bases: IntEnum
An enumeration.
Bases: tuple
Create new instance of DefaultVerifyPaths(cafile, capath, openssl_cafile_env, openssl_cafile, openssl_capath_env, openssl_capath)
Alias for field number 0
Alias for field number 1
Alias for field number 3
Alias for field number 2
Alias for field number 5
Alias for field number 4
Bases: IntFlag
An enumeration.
Bases: _ASN1Object
, Enum
SSLContext purpose flags with X509v3 Extended Key Usage objects
Create new instance of _ASN1Object(nid, shortname, longname, oid)
Bases: SSLContext
Bases: IntEnum
An enumeration.
Bases: object
This class implements an interface on top of a low-level SSL object as implemented by OpenSSL. This object captures the state of an SSL connection but does not provide any network IO itself. IO needs to be performed through separate “BIO” objects which are OpenSSL’s IO abstraction layer.
This class does not have a public constructor. Instances are returned by
SSLContext.wrap_bio
. This class is typically used by framework authors
that want to implement asynchronous IO for SSL through memory buffers.
When compared to SSLSocket
, this object lacks the following features:
Any form of network IO, including methods such as
recv
andsend
.The
do_handshake_on_connect
andsuppress_ragged_eofs
machinery.
Return the currently selected cipher as a 3-tuple (name,
ssl_version, secret_bits)
.
Return the current compression algorithm in use, or None
if
compression was not negotiated or not supported by one of the peers.
Get channel binding data for current connection. Raise ValueError
if the requested cb_type
is not supported. Return bytes of the data
or None if the data is not available (e.g. before the handshake).
Returns a formatted version of the data in the certificate provided by the other end of the SSL channel.
Return None if no certificate was provided, {} if a certificate was provided, but not validated.
Read up to ‘len’ bytes from the SSL object and return them.
If ‘buffer’ is provided, read into this buffer and return the number of bytes read.
Return the currently selected ALPN protocol as a string, or None
if a next protocol was not negotiated or if ALPN is not supported by one
of the peers.
Return the currently selected NPN protocol as a string, or None
if a next protocol was not negotiated or if NPN is not supported by one
of the peers.
Return a list of ciphers shared by the client during the handshake or None if this is not a valid server connection.
Return a string identifying the protocol version used by the current SSL channel.
Write ‘data’ to the SSL object and return the number of bytes written.
The ‘data’ argument must support the buffer interface.
The SSLContext that is currently in use.
The currently set server hostname (for SNI), or None
if no
server hostname is set.
Whether this is a server-side socket.
The SSLSession for client socket.
Was the client session reused during handshake
Bases: socket
gevent ssl.SSLSocket for Pythons >= 2.7.9 but less than 3.
Accepts a new connection from a remote client, and returns a tuple containing that new connection wrapped with a server-side SSL channel, and the address of the remote client.
Return a new socket object connected to the same system resource. Note, that the new socket does not inherit the timeout.
Get channel binding data for current connection. Raise ValueError
if the requested cb_type
is not supported. Return bytes of the data
or None if the data is not available (e.g. before the handshake).
Returns a formatted version of the data in the certificate provided by the other end of the SSL channel. Return None if no certificate was provided, {} if a certificate was provided, but not validated.
Make and return a file-like object that works with the SSL connection. Just use the code from the socket module.
Read up to LEN bytes and return them. Return zero-length string on EOF.
Receive up to buffersize bytes from the socket. For the optional flags argument, see the Unix manual. When no data is available, block until at least one byte is available or until the remote end is closed. When the remote end is closed and all data is read, return the empty string.
A version of recv() that stores its data into a buffer rather than creating a new string. Receive up to buffersize bytes from the socket. If buffersize is not specified (or 0), receive up to the size available in the given buffer.
See recv() for documentation about the flags.
Like recv(buffersize, flags) but also return the sender’s address info.
Like recv_into(buffer[, nbytes[, flags]]) but also return the sender’s address info.
Send a data string to the socket. For the optional flags argument, see the Unix manual. Return the number of bytes sent; this may be less than len(data) if the network is busy.
Send a data string to the socket. For the optional flags argument, see the Unix manual. This calls send() repeatedly until all data is sent. If an error occurs, it’s impossible to tell how much data has been sent.
Like send(data, flags) but allows specifying the destination address. For IP sockets, the address is a pair (hostaddr, port).
Shut down the reading side of the socket (flag == SHUT_RD), the writing side of the socket (flag == SHUT_WR), or both ends (flag == SHUT_RDWR).
Bases: IntEnum
An enumeration.
Bases: IntFlag
An enumeration.
Bases: IntEnum
An enumeration.
Takes a certificate in binary DER format and returns the PEM version of it as a string.
Takes a certificate in ASCII PEM format and returns the DER-encoded version of it as a byte sequence
Mix string into the OpenSSL PRNG state.
entropy (a float) is a lower bound on the entropy contained in string. See RFC 4086.
Generate n cryptographically strong pseudo-random bytes.
Generate n pseudo-random bytes.
Return a pair (bytes, is_cryptographic). is_cryptographic is True if the bytes generated are cryptographically strong.
Returns True if the OpenSSL PRNG has been seeded with enough data and False if not.
It is necessary to seed the PRNG with RAND_add() on some platforms before using the ssl() function.
Return the time in seconds since the Epoch, given the timestring
representing the “notBefore” or “notAfter” date from a certificate
in "%b %d %H:%M:%S %Y %Z"
strptime format (C locale).
“notBefore” or “notAfter” dates must use UTC (RFC 5280).
Month is one of: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec UTC should be specified as GMT (see ASN1_TIME_print())
Create a SSLContext object with default settings.
deprecation. The values represent a fair balance between maximum compatibility and security.
Retrieve the certificate from the server at the specified address, and return it as a PEM-encoded string. If ‘ca_certs’ is specified, validate the server cert against it. If ‘ssl_version’ is specified, use it in the connection attempt.
Verify that cert (in decoded format as returned by SSLSocket.getpeercert()) matches the hostname. RFC 2818 and RFC 6125 rules are followed.
The function matches IP addresses rather than dNSNames if hostname is a valid ipaddress string. IPv4 addresses are supported on all platforms. IPv6 addresses are supported on platforms with IPv6 support (AF_INET6 and inet_pton).
CertificateError is raised on failure. On success, the function returns nothing.
Next page: gevent._ssl2
– SSL wrapper for socket objects on Python 2.7.8 and below