Markdown Format | JSON API | MCP Server Tool
Help on module ssl: NAME ssl - This module provides some more Pythonic support for SSL. MODULE REFERENCE https://docs.python.org/3.10/library/ssl.html The following documentation is automatically generated from the Python source files. It may be incomplete, incorrect or include features that are considered implementation detail and may vary between Python implementations. When in doubt, consult the module reference at the location listed above. DESCRIPTION Object types: SSLSocket -- subtype of socket.socket which does SSL over the socket Exceptions: SSLError -- exception raised for I/O errors Functions: cert_time_to_seconds -- convert time string used for certificate notBefore and notAfter functions to integer seconds past the Epoch (the time values returned from time.time()) get_server_certificate (addr, ssl_version, ca_certs, timeout) -- Retrieve the certificate from the server at the specified address and return it as a PEM-encoded string Integer constants: SSL_ERROR_ZERO_RETURN SSL_ERROR_WANT_READ SSL_ERROR_WANT_WRITE SSL_ERROR_WANT_X509_LOOKUP SSL_ERROR_SYSCALL SSL_ERROR_SSL SSL_ERROR_WANT_CONNECT SSL_ERROR_EOF SSL_ERROR_INVALID_ERROR_CODE The following group define certificate requirements that one side is allowing/requiring from the other side: CERT_NONE - no certificates from the other side are required (or will be looked at if provided) CERT_OPTIONAL - certificates are not required, but if provided will be validated, and if validation fails, the connection will also fail CERT_REQUIRED - certificates are required, and will be validated, and if validation fails, the connection will also fail The following constants identify various SSL protocol variants: PROTOCOL_SSLv2 PROTOCOL_SSLv3 PROTOCOL_SSLv23 PROTOCOL_TLS PROTOCOL_TLS_CLIENT PROTOCOL_TLS_SERVER PROTOCOL_TLSv1 PROTOCOL_TLSv1_1 PROTOCOL_TLSv1_2 The following constants identify various SSL alert message descriptions as per http://www.iana.org/assignments/tls-parameters/tls-parameters.xml#tls-parameters-6 ALERT_DESCRIPTION_CLOSE_NOTIFY ALERT_DESCRIPTION_UNEXPECTED_MESSAGE ALERT_DESCRIPTION_BAD_RECORD_MAC ALERT_DESCRIPTION_RECORD_OVERFLOW ALERT_DESCRIPTION_DECOMPRESSION_FAILURE ALERT_DESCRIPTION_HANDSHAKE_FAILURE ALERT_DESCRIPTION_BAD_CERTIFICATE ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE ALERT_DESCRIPTION_CERTIFICATE_REVOKED ALERT_DESCRIPTION_CERTIFICATE_EXPIRED ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN ALERT_DESCRIPTION_ILLEGAL_PARAMETER ALERT_DESCRIPTION_UNKNOWN_CA ALERT_DESCRIPTION_ACCESS_DENIED ALERT_DESCRIPTION_DECODE_ERROR ALERT_DESCRIPTION_DECRYPT_ERROR ALERT_DESCRIPTION_PROTOCOL_VERSION ALERT_DESCRIPTION_INSUFFICIENT_SECURITY ALERT_DESCRIPTION_INTERNAL_ERROR ALERT_DESCRIPTION_USER_CANCELLED ALERT_DESCRIPTION_NO_RENEGOTIATION ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE ALERT_DESCRIPTION_UNRECOGNIZED_NAME ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY CLASSES _ssl._SSLContext(builtins.object) SSLContext builtins.OSError(builtins.Exception) SSLError SSLCertVerificationError(SSLError, builtins.ValueError) SSLEOFError SSLSyscallError SSLWantReadError SSLWantWriteError SSLZeroReturnError builtins.object SSLObject builtins.tuple(builtins.object) DefaultVerifyPaths enum.Enum(builtins.object) <unknown>.Purpose(_ASN1Object, enum.Enum) enum.IntEnum(builtins.int, enum.Enum) AlertDescription SSLErrorNumber TLSVersion VerifyMode enum.IntFlag(builtins.int, enum.Flag) Options VerifyFlags socket.socket(_socket.socket) SSLSocket _ASN1Object(_ASN1Object) <unknown>.Purpose(_ASN1Object, enum.Enum) class AlertDescription(enum.IntEnum) | AlertDescription(value, names=None, *, module=None, qualname=None, type=None, start=1) | | An enumeration. | | Method resolution order: | AlertDescription | enum.IntEnum | builtins.int | enum.Enum | builtins.object | | Data and other attributes defined here: | | ALERT_DESCRIPTION_ACCESS_DENIED = <AlertDescription.ALERT_DESCRIPTION_... | | ALERT_DESCRIPTION_BAD_CERTIFICATE = <AlertDescription.ALERT_DESCRIPTIO... | | ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE = <AlertDescription.ALERT... | | ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE = <AlertDescription.... | | ALERT_DESCRIPTION_BAD_RECORD_MAC = <AlertDescription.ALERT_DESCRIPTION... | | ALERT_DESCRIPTION_CERTIFICATE_EXPIRED = <AlertDescription.ALERT_DESCRI... | | ALERT_DESCRIPTION_CERTIFICATE_REVOKED = <AlertDescription.ALERT_DESCRI... | | ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN = <AlertDescription.ALERT_DESCRI... | | ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE = <AlertDescription.ALERT_D... | | ALERT_DESCRIPTION_CLOSE_NOTIFY = <AlertDescription.ALERT_DESCRIPTION_C... | | ALERT_DESCRIPTION_DECODE_ERROR = <AlertDescription.ALERT_DESCRIPTION_D... | | ALERT_DESCRIPTION_DECOMPRESSION_FAILURE = <AlertDescription.ALERT_DESC... | | ALERT_DESCRIPTION_DECRYPT_ERROR = <AlertDescription.ALERT_DESCRIPTION_... | | ALERT_DESCRIPTION_HANDSHAKE_FAILURE = <AlertDescription.ALERT_DESCRIPT... | | ALERT_DESCRIPTION_ILLEGAL_PARAMETER = <AlertDescription.ALERT_DESCRIPT... | | ALERT_DESCRIPTION_INSUFFICIENT_SECURITY = <AlertDescription.ALERT_DESC... | | ALERT_DESCRIPTION_INTERNAL_ERROR = <AlertDescription.ALERT_DESCRIPTION... | | ALERT_DESCRIPTION_NO_RENEGOTIATION = <AlertDescription.ALERT_DESCRIPTI... | | ALERT_DESCRIPTION_PROTOCOL_VERSION = <AlertDescription.ALERT_DESCRIPTI... | | ALERT_DESCRIPTION_RECORD_OVERFLOW = <AlertDescription.ALERT_DESCRIPTIO... | | ALERT_DESCRIPTION_UNEXPECTED_MESSAGE = <AlertDescription.ALERT_DESCRIP... | | ALERT_DESCRIPTION_UNKNOWN_CA = <AlertDescription.ALERT_DESCRIPTION_UNK... | | ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY = <AlertDescription.ALERT_DESCR... | | ALERT_DESCRIPTION_UNRECOGNIZED_NAME = <AlertDescription.ALERT_DESCRIPT... | | ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE = <AlertDescription.ALERT_DE... | | ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION = <AlertDescription.ALERT_DESC... | | ALERT_DESCRIPTION_USER_CANCELLED = <AlertDescription.ALERT_DESCRIPTION... | | ---------------------------------------------------------------------- | Data descriptors inherited from enum.Enum: | | name | The name of the Enum member. | | value | The value of the Enum member. | | ---------------------------------------------------------------------- | Readonly properties inherited from enum.EnumMeta: | | __members__ | Returns a mapping of member name->value. | | This mapping lists all enum members, including aliases. Note that this | is a read-only view of the internal mapping. CertificateError = class SSLCertVerificationError(SSLError, builtins.ValueError) | A certificate could not be verified. | | Method resolution order: | SSLCertVerificationError | SSLError | builtins.OSError | builtins.ValueError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from SSLError: | | __str__(self, /) | Return str(self). | | ---------------------------------------------------------------------- | Methods inherited from builtins.OSError: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | __reduce__(...) | Helper for pickle. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.OSError: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.OSError: | | characters_written | | errno | POSIX exception code | | filename | exception filename | | filename2 | second exception filename | | strerror | exception strerror | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class DefaultVerifyPaths(builtins.tuple) | DefaultVerifyPaths(cafile, capath, openssl_cafile_env, openssl_cafile, openssl_capath_env, openssl_capath) | | DefaultVerifyPaths(cafile, capath, openssl_cafile_env, openssl_cafile, openssl_capath_env, openssl_capath) | | Method resolution order: | DefaultVerifyPaths | builtins.tuple | builtins.object | | Methods defined here: | | __getnewargs__(self) | Return self as a plain tuple. Used by copy and pickle. | | __repr__(self) | Return a nicely formatted representation string | | _asdict(self) | Return a new dict which maps field names to their values. | | _replace(self, /, **kwds) | Return a new DefaultVerifyPaths object replacing specified fields with new values | | ---------------------------------------------------------------------- | Class methods defined here: | | _make(iterable) from builtins.type | Make a new DefaultVerifyPaths object from a sequence or iterable | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(_cls, cafile, capath, openssl_cafile_env, openssl_cafile, openssl_capath_env, openssl_capath) | Create new instance of DefaultVerifyPaths(cafile, capath, openssl_cafile_env, openssl_cafile, openssl_capath_env, openssl_capath) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | cafile | Alias for field number 0 | | capath | Alias for field number 1 | | openssl_cafile_env | Alias for field number 2 | | openssl_cafile | Alias for field number 3 | | openssl_capath_env | Alias for field number 4 | | openssl_capath | Alias for field number 5 | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __match_args__ = ('cafile', 'capath', 'openssl_cafile_env', 'openssl_c... | | _field_defaults = {} | | _fields = ('cafile', 'capath', 'openssl_cafile_env', 'openssl_cafile',... | | ---------------------------------------------------------------------- | Methods inherited from builtins.tuple: | | __add__(self, value, /) | Return self+value. | | __contains__(self, key, /) | Return key in self. | | __eq__(self, value, /) | Return self==value. | | __ge__(self, value, /) | Return self>=value. | | __getattribute__(self, name, /) | Return getattr(self, name). | | __getitem__(self, key, /) | Return self[key]. | | __gt__(self, value, /) | Return self>value. | | __hash__(self, /) | Return hash(self). | | __iter__(self, /) | Implement iter(self). | | __le__(self, value, /) | Return self<=value. | | __len__(self, /) | Return len(self). | | __lt__(self, value, /) | Return self<value. | | __mul__(self, value, /) | Return self*value. | | __ne__(self, value, /) | Return self!=value. | | __rmul__(self, value, /) | Return value*self. | | count(self, value, /) | Return number of occurrences of value. | | index(self, value, start=0, stop=9223372036854775807, /) | Return first index of value. | | Raises ValueError if the value is not present. | | ---------------------------------------------------------------------- | Class methods inherited from builtins.tuple: | | __class_getitem__(...) from builtins.type | See PEP 585 class Options(enum.IntFlag) | Options(value, names=None, *, module=None, qualname=None, type=None, start=1) | | An enumeration. | | Method resolution order: | Options | enum.IntFlag | builtins.int | enum.Flag | enum.Enum | builtins.object | | Data and other attributes defined here: | | OP_ALL = <Options.OP_ALL: 2147483728> | | OP_CIPHER_SERVER_PREFERENCE = <Options.OP_CIPHER_SERVER_PREFERENCE: 41... | | OP_ENABLE_MIDDLEBOX_COMPAT = <Options.OP_ENABLE_MIDDLEBOX_COMPAT: 1048... | | OP_IGNORE_UNEXPECTED_EOF = <Options.OP_IGNORE_UNEXPECTED_EOF: 128> | | OP_NO_COMPRESSION = <Options.OP_NO_COMPRESSION: 131072> | | OP_NO_RENEGOTIATION = <Options.OP_NO_RENEGOTIATION: 1073741824> | | OP_NO_SSLv2 = <Options.OP_NO_SSLv2: 0> | | OP_NO_SSLv3 = <Options.OP_NO_SSLv3: 33554432> | | OP_NO_TICKET = <Options.OP_NO_TICKET: 16384> | | OP_NO_TLSv1 = <Options.OP_NO_TLSv1: 67108864> | | OP_NO_TLSv1_1 = <Options.OP_NO_TLSv1_1: 268435456> | | OP_NO_TLSv1_2 = <Options.OP_NO_TLSv1_2: 134217728> | | OP_NO_TLSv1_3 = <Options.OP_NO_TLSv1_3: 536870912> | | ---------------------------------------------------------------------- | Data descriptors inherited from enum.Enum: | | name | The name of the Enum member. | | value | The value of the Enum member. | | ---------------------------------------------------------------------- | Readonly properties inherited from enum.EnumMeta: | | __members__ | Returns a mapping of member name->value. | | This mapping lists all enum members, including aliases. Note that this | is a read-only view of the internal mapping. class Purpose(ssl._ASN1Object, enum.Enum) | Purpose(value, names=None, *, module=None, qualname=None, type=None, start=1) | | SSLContext purpose flags with X509v3 Extended Key Usage objects | | Method resolution order: | Purpose | ssl._ASN1Object | ssl._ASN1Object | builtins.tuple | enum.Enum | builtins.object | | Data and other attributes defined here: | | CLIENT_AUTH = <Purpose.CLIENT_AUTH: _ASN1Object(nid=130, short...Clien... | | SERVER_AUTH = <Purpose.SERVER_AUTH: _ASN1Object(nid=129, short...Serve... | | ---------------------------------------------------------------------- | Data descriptors inherited from enum.Enum: | | name | The name of the Enum member. | | value | The value of the Enum member. | | ---------------------------------------------------------------------- | Readonly properties inherited from enum.EnumMeta: | | __members__ | Returns a mapping of member name->value. | | This mapping lists all enum members, including aliases. Note that this | is a read-only view of the internal mapping. class SSLCertVerificationError(SSLError, builtins.ValueError) | A certificate could not be verified. | | Method resolution order: | SSLCertVerificationError | SSLError | builtins.OSError | builtins.ValueError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from SSLError: | | __str__(self, /) | Return str(self). | | ---------------------------------------------------------------------- | Methods inherited from builtins.OSError: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | __reduce__(...) | Helper for pickle. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.OSError: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.OSError: | | characters_written | | errno | POSIX exception code | | filename | exception filename | | filename2 | second exception filename | | strerror | exception strerror | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class SSLContext(_ssl._SSLContext) | SSLContext(protocol=None, *args, **kwargs) | | An SSLContext holds various SSL-related configuration options and | data, such as certificates and possibly a private key. | | Method resolution order: | SSLContext | _ssl._SSLContext | builtins.object | | Methods defined here: | | load_default_certs(self, purpose=<Purpose.SERVER_AUTH: _ASN1Object(nid=129, shortname='serverAuth', longname='TLS Web Server Authentication', oid='1.3.6.1.5.5.7.3.1')>) | | set_alpn_protocols(self, alpn_protocols) | | set_npn_protocols(self, npn_protocols) | | set_servername_callback(self, server_name_callback) | | wrap_bio(self, incoming, outgoing, server_side=False, server_hostname=None, session=None) | | wrap_socket(self, sock, server_side=False, do_handshake_on_connect=True, suppress_ragged_eofs=True, server_hostname=None, session=None) | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(cls, protocol=None, *args, **kwargs) | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Readonly properties defined here: | | protocol | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | hostname_checks_common_name | | maximum_version | | minimum_version | | options | | verify_flags | | verify_mode | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | sslobject_class = <class 'ssl.SSLObject'> | 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`` and ``send``. | * The ``do_handshake_on_connect`` and ``suppress_ragged_eofs`` machinery. | | | sslsocket_class = <class 'ssl.SSLSocket'> | This class implements a subtype of socket.socket that wraps | the underlying OS socket in an SSL context when necessary, and | provides read and write methods over that channel. | | | ---------------------------------------------------------------------- | Methods inherited from _ssl._SSLContext: | | cert_store_stats(self, /) | Returns quantities of loaded X.509 certificates. | | X.509 certificates with a CA extension and certificate revocation lists | inside the context's cert store. | | NOTE: Certificates in a capath directory aren't loaded unless they have | been used at least once. | | get_ca_certs(self, /, binary_form=False) | Returns a list of dicts with information of loaded CA certs. | | If the optional argument is True, returns a DER-encoded copy of the CA | certificate. | | NOTE: Certificates in a capath directory aren't loaded unless they have | been used at least once. | | get_ciphers(self, /) | | load_cert_chain(self, /, certfile, keyfile=None, password=None) | | load_dh_params(self, path, /) | | load_verify_locations(self, /, cafile=None, capath=None, cadata=None) | | session_stats(self, /) | | set_ciphers(self, cipherlist, /) | | set_default_verify_paths(self, /) | | set_ecdh_curve(self, name, /) | | ---------------------------------------------------------------------- | Data descriptors inherited from _ssl._SSLContext: | | check_hostname | | keylog_filename | | num_tickets | Control the number of TLSv1.3 session tickets | | post_handshake_auth | | security_level | The current security level | | sni_callback | Set a callback that will be called when a server name is provided by the SSL/TLS client in the SNI extension. | | If the argument is None then the callback is disabled. The method is called | with the SSLSocket, the server name as a string, and the SSLContext object. | See RFC 6066 for details of the SNI extension. class SSLEOFError(SSLError) | SSL/TLS connection terminated abruptly. | | Method resolution order: | SSLEOFError | SSLError | builtins.OSError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from SSLError: | | __str__(self, /) | Return str(self). | | ---------------------------------------------------------------------- | Methods inherited from builtins.OSError: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | __reduce__(...) | Helper for pickle. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.OSError: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.OSError: | | characters_written | | errno | POSIX exception code | | filename | exception filename | | filename2 | second exception filename | | strerror | exception strerror | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class SSLError(builtins.OSError) | An error occurred in the SSL implementation. | | Method resolution order: | SSLError | builtins.OSError | builtins.Exception | builtins.BaseException | builtins.object | | Methods defined here: | | __str__(self, /) | Return str(self). | | ---------------------------------------------------------------------- | Methods inherited from builtins.OSError: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | __reduce__(...) | Helper for pickle. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.OSError: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.OSError: | | characters_written | | errno | POSIX exception code | | filename | exception filename | | filename2 | second exception filename | | strerror | exception strerror | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class SSLErrorNumber(enum.IntEnum) | SSLErrorNumber(value, names=None, *, module=None, qualname=None, type=None, start=1) | | An enumeration. | | Method resolution order: | SSLErrorNumber | enum.IntEnum | builtins.int | enum.Enum | builtins.object | | Data and other attributes defined here: | | SSL_ERROR_EOF = <SSLErrorNumber.SSL_ERROR_EOF: 8> | | SSL_ERROR_INVALID_ERROR_CODE = <SSLErrorNumber.SSL_ERROR_INVALID_ERROR... | | SSL_ERROR_SSL = <SSLErrorNumber.SSL_ERROR_SSL: 1> | | SSL_ERROR_SYSCALL = <SSLErrorNumber.SSL_ERROR_SYSCALL: 5> | | SSL_ERROR_WANT_CONNECT = <SSLErrorNumber.SSL_ERROR_WANT_CONNECT: 7> | | SSL_ERROR_WANT_READ = <SSLErrorNumber.SSL_ERROR_WANT_READ: 2> | | SSL_ERROR_WANT_WRITE = <SSLErrorNumber.SSL_ERROR_WANT_WRITE: 3> | | SSL_ERROR_WANT_X509_LOOKUP = <SSLErrorNumber.SSL_ERROR_WANT_X509_LOOKU... | | SSL_ERROR_ZERO_RETURN = <SSLErrorNumber.SSL_ERROR_ZERO_RETURN: 6> | | ---------------------------------------------------------------------- | Data descriptors inherited from enum.Enum: | | name | The name of the Enum member. | | value | The value of the Enum member. | | ---------------------------------------------------------------------- | Readonly properties inherited from enum.EnumMeta: | | __members__ | Returns a mapping of member name->value. | | This mapping lists all enum members, including aliases. Note that this | is a read-only view of the internal mapping. class SSLObject(builtins.object) | SSLObject(*args, **kwargs) | | 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`` and ``send``. | * The ``do_handshake_on_connect`` and ``suppress_ragged_eofs`` machinery. | | Methods defined here: | | __init__(self, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | cipher(self) | Return the currently selected cipher as a 3-tuple ``(name, | ssl_version, secret_bits)``. | | compression(self) | Return the current compression algorithm in use, or ``None`` if | compression was not negotiated or not supported by one of the peers. | | do_handshake(self) | Start the SSL/TLS handshake. | | get_channel_binding(self, cb_type='tls-unique') | 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). | | getpeercert(self, binary_form=False) | 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. | | pending(self) | Return the number of bytes that can be read immediately. | | read(self, len=1024, buffer=None) | 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. | | selected_alpn_protocol(self) | 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. | | selected_npn_protocol(self) | 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. | | shared_ciphers(self) | Return a list of ciphers shared by the client during the handshake or | None if this is not a valid server connection. | | unwrap(self) | Start the SSL shutdown handshake. | | verify_client_post_handshake(self) | | version(self) | Return a string identifying the protocol version used by the | current SSL channel. | | write(self, data) | Write 'data' to the SSL object and return the number of bytes | written. | | The 'data' argument must support the buffer interface. | | ---------------------------------------------------------------------- | Readonly properties defined here: | | server_hostname | The currently set server hostname (for SNI), or ``None`` if no | server hostname is set. | | server_side | Whether this is a server-side socket. | | session_reused | Was the client session reused during handshake | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | context | The SSLContext that is currently in use. | | session | The SSLSession for client socket. class SSLSocket(socket.socket) | SSLSocket(*args, **kwargs) | | This class implements a subtype of socket.socket that wraps | the underlying OS socket in an SSL context when necessary, and | provides read and write methods over that channel. | | Method resolution order: | SSLSocket | socket.socket | _socket.socket | builtins.object | | Methods defined here: | | __init__(self, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | accept(self) | 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. | | cipher(self) | Return the currently selected cipher as a 3-tuple ``(name, | ssl_version, secret_bits)``. | | compression(self) | Return the current compression algorithm in use, or ``None`` if | compression was not negotiated or not supported by one of the peers. | | connect(self, addr) | Connects to remote ADDR, and then wraps the connection in | an SSL channel. | | connect_ex(self, addr) | Connects to remote ADDR, and then wraps the connection in | an SSL channel. | | do_handshake(self, block=False) | Start the SSL/TLS handshake. | | dup(self) | dup() -> socket object | | Duplicate the socket. Return a new socket object connected to the same | system resource. The new socket is non-inheritable. | | get_channel_binding(self, cb_type='tls-unique') | 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). | | getpeercert(self, binary_form=False) | 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. | | pending(self) | Return the number of bytes that can be read immediately. | | read(self, len=1024, buffer=None) | Read up to LEN bytes and return them. | Return zero-length string on EOF. | | recv(self, buflen=1024, flags=0) | recv(buffersize[, flags]) -> data | | 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. | | recv_into(self, buffer, nbytes=None, flags=0) | recv_into(buffer, [nbytes[, flags]]) -> nbytes_read | | 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. | | recvfrom(self, buflen=1024, flags=0) | recvfrom(buffersize[, flags]) -> (data, address info) | | Like recv(buffersize, flags) but also return the sender's address info. | | recvfrom_into(self, buffer, nbytes=None, flags=0) | recvfrom_into(buffer[, nbytes[, flags]]) -> (nbytes, address info) | | Like recv_into(buffer[, nbytes[, flags]]) but also return the sender's address info. | | recvmsg(self, *args, **kwargs) | recvmsg(bufsize[, ancbufsize[, flags]]) -> (data, ancdata, msg_flags, address) | | Receive normal data (up to bufsize bytes) and ancillary data from the | socket. The ancbufsize argument sets the size in bytes of the | internal buffer used to receive the ancillary data; it defaults to 0, | meaning that no ancillary data will be received. Appropriate buffer | sizes for ancillary data can be calculated using CMSG_SPACE() or | CMSG_LEN(), and items which do not fit into the buffer might be | truncated or discarded. The flags argument defaults to 0 and has the | same meaning as for recv(). | | The return value is a 4-tuple: (data, ancdata, msg_flags, address). | The data item is a bytes object holding the non-ancillary data | received. The ancdata item is a list of zero or more tuples | (cmsg_level, cmsg_type, cmsg_data) representing the ancillary data | (control messages) received: cmsg_level and cmsg_type are integers | specifying the protocol level and protocol-specific type respectively, | and cmsg_data is a bytes object holding the associated data. The | msg_flags item is the bitwise OR of various flags indicating | conditions on the received message; see your system documentation for | details. If the receiving socket is unconnected, address is the | address of the sending socket, if available; otherwise, its value is | unspecified. | | If recvmsg() raises an exception after the system call returns, it | will first attempt to close any file descriptors received via the | SCM_RIGHTS mechanism. | | recvmsg_into(self, *args, **kwargs) | recvmsg_into(buffers[, ancbufsize[, flags]]) -> (nbytes, ancdata, msg_flags, address) | | Receive normal data and ancillary data from the socket, scattering the | non-ancillary data into a series of buffers. The buffers argument | must be an iterable of objects that export writable buffers | (e.g. bytearray objects); these will be filled with successive chunks | of the non-ancillary data until it has all been written or there are | no more buffers. The ancbufsize argument sets the size in bytes of | the internal buffer used to receive the ancillary data; it defaults to | 0, meaning that no ancillary data will be received. Appropriate | buffer sizes for ancillary data can be calculated using CMSG_SPACE() | or CMSG_LEN(), and items which do not fit into the buffer might be | truncated or discarded. The flags argument defaults to 0 and has the | same meaning as for recv(). | | The return value is a 4-tuple: (nbytes, ancdata, msg_flags, address). | The nbytes item is the total number of bytes of non-ancillary data | written into the buffers. The ancdata item is a list of zero or more | tuples (cmsg_level, cmsg_type, cmsg_data) representing the ancillary | data (control messages) received: cmsg_level and cmsg_type are | integers specifying the protocol level and protocol-specific type | respectively, and cmsg_data is a bytes object holding the associated | data. The msg_flags item is the bitwise OR of various flags | indicating conditions on the received message; see your system | documentation for details. If the receiving socket is unconnected, | address is the address of the sending socket, if available; otherwise, | its value is unspecified. | | If recvmsg_into() raises an exception after the system call returns, | it will first attempt to close any file descriptors received via the | SCM_RIGHTS mechanism. | | selected_alpn_protocol(self) | 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. | | selected_npn_protocol(self) | 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. | | send(self, data, flags=0) | send(data[, flags]) -> count | | 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. | | sendall(self, data, flags=0) | sendall(data[, flags]) | | 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. | | sendfile(self, file, offset=0, count=None) | Send a file, possibly by using os.sendfile() if this is a | clear-text socket. Return the total number of bytes sent. | | sendmsg(self, *args, **kwargs) | sendmsg(buffers[, ancdata[, flags[, address]]]) -> count | | Send normal and ancillary data to the socket, gathering the | non-ancillary data from a series of buffers and concatenating it into | a single message. The buffers argument specifies the non-ancillary | data as an iterable of bytes-like objects (e.g. bytes objects). | The ancdata argument specifies the ancillary data (control messages) | as an iterable of zero or more tuples (cmsg_level, cmsg_type, | cmsg_data), where cmsg_level and cmsg_type are integers specifying the | protocol level and protocol-specific type respectively, and cmsg_data | is a bytes-like object holding the associated data. The flags | argument defaults to 0 and has the same meaning as for send(). If | address is supplied and not None, it sets a destination address for | the message. The return value is the number of bytes of non-ancillary | data sent. | | sendto(self, data, flags_or_addr, addr=None) | sendto(data[, flags], address) -> count | | Like send(data, flags) but allows specifying the destination address. | For IP sockets, the address is a pair (hostaddr, port). | | shared_ciphers(self) | Return a list of ciphers shared by the client during the handshake or | None if this is not a valid server connection. | | shutdown(self, how) | shutdown(flag) | | 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). | | unwrap(self) | Start the SSL shutdown handshake. | | verify_client_post_handshake(self) | | version(self) | Return a string identifying the protocol version used by the | current SSL channel. | | write(self, data) | Write DATA to the underlying SSL channel. Returns | number of bytes of DATA actually transmitted. | | ---------------------------------------------------------------------- | Readonly properties defined here: | | session_reused | Was the client session reused during handshake | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | context | The SSLContext that is currently in use. | | session | The SSLSession for client socket. | | ---------------------------------------------------------------------- | Methods inherited from socket.socket: | | __enter__(self) | | __exit__(self, *args) | | __getstate__(self) | | __repr__(self) | Wrap __repr__() to reveal the real class name and socket | address(es). | | close(self) | close() | | Close the socket. It cannot be used after this call. | | detach(self) | detach() -> file descriptor | | Close the socket object without closing the underlying file descriptor. | The object cannot be used after this call, but the file descriptor | can be reused for other purposes. The file descriptor is returned. | | get_inheritable(self) | Get the inheritable flag of the socket | | makefile(self, mode='r', buffering=None, *, encoding=None, errors=None, newline=None) | makefile(...) -> an I/O stream connected to the socket | | The arguments are as for io.open() after the filename, except the only | supported mode values are 'r' (default), 'w' and 'b'. | | set_inheritable(self, inheritable) | Set the inheritable flag of the socket | | ---------------------------------------------------------------------- | Readonly properties inherited from socket.socket: | | family | Read-only access to the address family for this socket. | | type | Read-only access to the socket type. | | ---------------------------------------------------------------------- | Data descriptors inherited from socket.socket: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from _socket.socket: | | __del__(...) | | __getattribute__(self, name, /) | Return getattr(self, name). | | bind(...) | bind(address) | | Bind the socket to a local address. For IP sockets, the address is a | pair (host, port); the host must refer to the local host. For raw packet | sockets the address is a tuple (ifname, proto [,pkttype [,hatype [,addr]]]) | | fileno(...) | fileno() -> integer | | Return the integer file descriptor of the socket. | | getblocking(...) | getblocking() | | Returns True if socket is in blocking mode, or False if it | is in non-blocking mode. | | getpeername(...) | getpeername() -> address info | | Return the address of the remote endpoint. For IP sockets, the address | info is a pair (hostaddr, port). | | getsockname(...) | getsockname() -> address info | | Return the address of the local endpoint. The format depends on the | address family. For IPv4 sockets, the address info is a pair | (hostaddr, port). | | getsockopt(...) | getsockopt(level, option[, buffersize]) -> value | | Get a socket option. See the Unix manual for level and option. | If a nonzero buffersize argument is given, the return value is a | string of that length; otherwise it is an integer. | | gettimeout(...) | gettimeout() -> timeout | | Returns the timeout in seconds (float) associated with socket | operations. A timeout of None indicates that timeouts on socket | operations are disabled. | | listen(...) | listen([backlog]) | | Enable a server to accept connections. If backlog is specified, it must be | at least 0 (if it is lower, it is set to 0); it specifies the number of | unaccepted connections that the system will allow before refusing new | connections. If not specified, a default reasonable value is chosen. | | sendmsg_afalg(...) | sendmsg_afalg([msg], *, op[, iv[, assoclen[, flags=MSG_MORE]]]) | | Set operation mode, IV and length of associated data for an AF_ALG | operation socket. | | setblocking(...) | setblocking(flag) | | Set the socket to blocking (flag is true) or non-blocking (false). | setblocking(True) is equivalent to settimeout(None); | setblocking(False) is equivalent to settimeout(0.0). | | setsockopt(...) | setsockopt(level, option, value: int) | setsockopt(level, option, value: buffer) | setsockopt(level, option, None, optlen: int) | | Set a socket option. See the Unix manual for level and option. | The value argument can either be an integer, a string buffer, or | None, optlen. | | settimeout(...) | settimeout(timeout) | | Set a timeout on socket operations. 'timeout' can be a float, | giving in seconds, or None. Setting a timeout of None disables | the timeout feature and is equivalent to setblocking(1). | Setting a timeout of zero is the same as setblocking(0). | | ---------------------------------------------------------------------- | Static methods inherited from _socket.socket: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors inherited from _socket.socket: | | proto | the socket protocol | | timeout | the socket timeout class SSLSyscallError(SSLError) | System error when attempting SSL operation. | | Method resolution order: | SSLSyscallError | SSLError | builtins.OSError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from SSLError: | | __str__(self, /) | Return str(self). | | ---------------------------------------------------------------------- | Methods inherited from builtins.OSError: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | __reduce__(...) | Helper for pickle. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.OSError: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.OSError: | | characters_written | | errno | POSIX exception code | | filename | exception filename | | filename2 | second exception filename | | strerror | exception strerror | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class SSLWantReadError(SSLError) | Non-blocking SSL socket needs to read more data | before the requested operation can be completed. | | Method resolution order: | SSLWantReadError | SSLError | builtins.OSError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from SSLError: | | __str__(self, /) | Return str(self). | | ---------------------------------------------------------------------- | Methods inherited from builtins.OSError: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | __reduce__(...) | Helper for pickle. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.OSError: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.OSError: | | characters_written | | errno | POSIX exception code | | filename | exception filename | | filename2 | second exception filename | | strerror | exception strerror | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class SSLWantWriteError(SSLError) | Non-blocking SSL socket needs to write more data | before the requested operation can be completed. | | Method resolution order: | SSLWantWriteError | SSLError | builtins.OSError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from SSLError: | | __str__(self, /) | Return str(self). | | ---------------------------------------------------------------------- | Methods inherited from builtins.OSError: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | __reduce__(...) | Helper for pickle. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.OSError: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.OSError: | | characters_written | | errno | POSIX exception code | | filename | exception filename | | filename2 | second exception filename | | strerror | exception strerror | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class SSLZeroReturnError(SSLError) | SSL/TLS session closed cleanly. | | Method resolution order: | SSLZeroReturnError | SSLError | builtins.OSError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from SSLError: | | __str__(self, /) | Return str(self). | | ---------------------------------------------------------------------- | Methods inherited from builtins.OSError: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | __reduce__(...) | Helper for pickle. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.OSError: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.OSError: | | characters_written | | errno | POSIX exception code | | filename | exception filename | | filename2 | second exception filename | | strerror | exception strerror | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class TLSVersion(enum.IntEnum) | TLSVersion(value, names=None, *, module=None, qualname=None, type=None, start=1) | | An enumeration. | | Method resolution order: | TLSVersion | enum.IntEnum | builtins.int | enum.Enum | builtins.object | | Data and other attributes defined here: | | MAXIMUM_SUPPORTED = <TLSVersion.MAXIMUM_SUPPORTED: -1> | | MINIMUM_SUPPORTED = <TLSVersion.MINIMUM_SUPPORTED: -2> | | SSLv3 = <TLSVersion.SSLv3: 768> | | TLSv1 = <TLSVersion.TLSv1: 769> | | TLSv1_1 = <TLSVersion.TLSv1_1: 770> | | TLSv1_2 = <TLSVersion.TLSv1_2: 771> | | TLSv1_3 = <TLSVersion.TLSv1_3: 772> | | ---------------------------------------------------------------------- | Data descriptors inherited from enum.Enum: | | name | The name of the Enum member. | | value | The value of the Enum member. | | ---------------------------------------------------------------------- | Readonly properties inherited from enum.EnumMeta: | | __members__ | Returns a mapping of member name->value. | | This mapping lists all enum members, including aliases. Note that this | is a read-only view of the internal mapping. class VerifyFlags(enum.IntFlag) | VerifyFlags(value, names=None, *, module=None, qualname=None, type=None, start=1) | | An enumeration. | | Method resolution order: | VerifyFlags | enum.IntFlag | builtins.int | enum.Flag | enum.Enum | builtins.object | | Data and other attributes defined here: | | VERIFY_ALLOW_PROXY_CERTS = <VerifyFlags.VERIFY_ALLOW_PROXY_CERTS: 64> | | VERIFY_CRL_CHECK_CHAIN = <VerifyFlags.VERIFY_CRL_CHECK_CHAIN: 12> | | VERIFY_CRL_CHECK_LEAF = <VerifyFlags.VERIFY_CRL_CHECK_LEAF: 4> | | VERIFY_DEFAULT = <VerifyFlags.VERIFY_DEFAULT: 0> | | VERIFY_X509_PARTIAL_CHAIN = <VerifyFlags.VERIFY_X509_PARTIAL_CHAIN: 52... | | VERIFY_X509_STRICT = <VerifyFlags.VERIFY_X509_STRICT: 32> | | VERIFY_X509_TRUSTED_FIRST = <VerifyFlags.VERIFY_X509_TRUSTED_FIRST: 32... | | ---------------------------------------------------------------------- | Data descriptors inherited from enum.Enum: | | name | The name of the Enum member. | | value | The value of the Enum member. | | ---------------------------------------------------------------------- | Readonly properties inherited from enum.EnumMeta: | | __members__ | Returns a mapping of member name->value. | | This mapping lists all enum members, including aliases. Note that this | is a read-only view of the internal mapping. class VerifyMode(enum.IntEnum) | VerifyMode(value, names=None, *, module=None, qualname=None, type=None, start=1) | | An enumeration. | | Method resolution order: | VerifyMode | enum.IntEnum | builtins.int | enum.Enum | builtins.object | | Data and other attributes defined here: | | CERT_NONE = <VerifyMode.CERT_NONE: 0> | | CERT_OPTIONAL = <VerifyMode.CERT_OPTIONAL: 1> | | CERT_REQUIRED = <VerifyMode.CERT_REQUIRED: 2> | | ---------------------------------------------------------------------- | Data descriptors inherited from enum.Enum: | | name | The name of the Enum member. | | value | The value of the Enum member. | | ---------------------------------------------------------------------- | Readonly properties inherited from enum.EnumMeta: | | __members__ | Returns a mapping of member name->value. | | This mapping lists all enum members, including aliases. Note that this | is a read-only view of the internal mapping. FUNCTIONS DER_cert_to_PEM_cert(der_cert_bytes) Takes a certificate in binary DER format and returns the PEM version of it as a string. PEM_cert_to_DER_cert(pem_cert_string) Takes a certificate in ASCII PEM format and returns the DER-encoded version of it as a byte sequence RAND_add(string, entropy, /) Mix string into the OpenSSL PRNG state. entropy (a float) is a lower bound on the entropy contained in string. See RFC 4086. RAND_bytes(n, /) Generate n cryptographically strong pseudo-random bytes. RAND_pseudo_bytes(n, /) Generate n pseudo-random bytes. Return a pair (bytes, is_cryptographic). is_cryptographic is True if the bytes generated are cryptographically strong. RAND_status() 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. cert_time_to_seconds(cert_time) 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_default_context(purpose=<Purpose.SERVER_AUTH: _ASN1Object(nid=129, shortname='serverAuth', longname='TLS Web Server Authentication', oid='1.3.6.1.5.5.7.3.1')>, *, cafile=None, capath=None, cadata=None) Create a SSLContext object with default settings. NOTE: The protocol and settings may change anytime without prior deprecation. The values represent a fair balance between maximum compatibility and security. get_default_verify_paths() Return paths to default cafile and capath. get_protocol_name(protocol_code) get_server_certificate(addr, ssl_version=<_SSLMethod.PROTOCOL_TLS_CLIENT: 16>, ca_certs=None, timeout=<object object at 0x7f65f3b14ac0>) 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. If 'timeout' is specified, use it in the connection attempt. match_hostname(cert, hostname) 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. wrap_socket(sock, keyfile=None, certfile=None, server_side=False, cert_reqs=<VerifyMode.CERT_NONE: 0>, ssl_version=<_SSLMethod.PROTOCOL_TLS: 2>, ca_certs=None, do_handshake_on_connect=True, suppress_ragged_eofs=True, ciphers=None) DATA ALERT_DESCRIPTION_ACCESS_DENIED = <AlertDescription.ALERT_DESCRIPTION_... ALERT_DESCRIPTION_BAD_CERTIFICATE = <AlertDescription.ALERT_DESCRIPTIO... ALERT_DESCRIPTION_BAD_CERTIFICATE_HASH_VALUE = <AlertDescription.ALERT... ALERT_DESCRIPTION_BAD_CERTIFICATE_STATUS_RESPONSE = <AlertDescription.... ALERT_DESCRIPTION_BAD_RECORD_MAC = <AlertDescription.ALERT_DESCRIPTION... ALERT_DESCRIPTION_CERTIFICATE_EXPIRED = <AlertDescription.ALERT_DESCRI... ALERT_DESCRIPTION_CERTIFICATE_REVOKED = <AlertDescription.ALERT_DESCRI... ALERT_DESCRIPTION_CERTIFICATE_UNKNOWN = <AlertDescription.ALERT_DESCRI... ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE = <AlertDescription.ALERT_D... ALERT_DESCRIPTION_CLOSE_NOTIFY = <AlertDescription.ALERT_DESCRIPTION_C... ALERT_DESCRIPTION_DECODE_ERROR = <AlertDescription.ALERT_DESCRIPTION_D... ALERT_DESCRIPTION_DECOMPRESSION_FAILURE = <AlertDescription.ALERT_DESC... ALERT_DESCRIPTION_DECRYPT_ERROR = <AlertDescription.ALERT_DESCRIPTION_... ALERT_DESCRIPTION_HANDSHAKE_FAILURE = <AlertDescription.ALERT_DESCRIPT... ALERT_DESCRIPTION_ILLEGAL_PARAMETER = <AlertDescription.ALERT_DESCRIPT... ALERT_DESCRIPTION_INSUFFICIENT_SECURITY = <AlertDescription.ALERT_DESC... ALERT_DESCRIPTION_INTERNAL_ERROR = <AlertDescription.ALERT_DESCRIPTION... ALERT_DESCRIPTION_NO_RENEGOTIATION = <AlertDescription.ALERT_DESCRIPTI... ALERT_DESCRIPTION_PROTOCOL_VERSION = <AlertDescription.ALERT_DESCRIPTI... ALERT_DESCRIPTION_RECORD_OVERFLOW = <AlertDescription.ALERT_DESCRIPTIO... ALERT_DESCRIPTION_UNEXPECTED_MESSAGE = <AlertDescription.ALERT_DESCRIP... ALERT_DESCRIPTION_UNKNOWN_CA = <AlertDescription.ALERT_DESCRIPTION_UNK... ALERT_DESCRIPTION_UNKNOWN_PSK_IDENTITY = <AlertDescription.ALERT_DESCR... ALERT_DESCRIPTION_UNRECOGNIZED_NAME = <AlertDescription.ALERT_DESCRIPT... ALERT_DESCRIPTION_UNSUPPORTED_CERTIFICATE = <AlertDescription.ALERT_DE... ALERT_DESCRIPTION_UNSUPPORTED_EXTENSION = <AlertDescription.ALERT_DESC... ALERT_DESCRIPTION_USER_CANCELLED = <AlertDescription.ALERT_DESCRIPTION... CERT_NONE = <VerifyMode.CERT_NONE: 0> CERT_OPTIONAL = <VerifyMode.CERT_OPTIONAL: 1> CERT_REQUIRED = <VerifyMode.CERT_REQUIRED: 2> CHANNEL_BINDING_TYPES = ['tls-unique'] HAS_ALPN = True HAS_ECDH = True HAS_NEVER_CHECK_COMMON_NAME = True HAS_NPN = False HAS_SNI = True HAS_SSLv2 = False HAS_SSLv3 = False HAS_TLSv1 = True HAS_TLSv1_1 = True HAS_TLSv1_2 = True HAS_TLSv1_3 = True OPENSSL_VERSION = 'OpenSSL 3.0.2 15 Mar 2022' OPENSSL_VERSION_INFO = (3, 0, 0, 2, 0) OPENSSL_VERSION_NUMBER = 805306400 OP_ALL = <Options.OP_ALL: 2147483728> OP_CIPHER_SERVER_PREFERENCE = <Options.OP_CIPHER_SERVER_PREFERENCE: 41... OP_ENABLE_MIDDLEBOX_COMPAT = <Options.OP_ENABLE_MIDDLEBOX_COMPAT: 1048... OP_IGNORE_UNEXPECTED_EOF = <Options.OP_IGNORE_UNEXPECTED_EOF: 128> OP_NO_COMPRESSION = <Options.OP_NO_COMPRESSION: 131072> OP_NO_RENEGOTIATION = <Options.OP_NO_RENEGOTIATION: 1073741824> OP_NO_SSLv2 = <Options.OP_NO_SSLv2: 0> OP_NO_SSLv3 = <Options.OP_NO_SSLv3: 33554432> OP_NO_TICKET = <Options.OP_NO_TICKET: 16384> OP_NO_TLSv1 = <Options.OP_NO_TLSv1: 67108864> OP_NO_TLSv1_1 = <Options.OP_NO_TLSv1_1: 268435456> OP_NO_TLSv1_2 = <Options.OP_NO_TLSv1_2: 134217728> OP_NO_TLSv1_3 = <Options.OP_NO_TLSv1_3: 536870912> OP_SINGLE_DH_USE = <Options.OP_NO_SSLv2: 0> OP_SINGLE_ECDH_USE = <Options.OP_NO_SSLv2: 0> PEM_FOOTER = '-----END CERTIFICATE-----' PEM_HEADER = '-----BEGIN CERTIFICATE-----' PROTOCOL_SSLv23 = <_SSLMethod.PROTOCOL_TLS: 2> PROTOCOL_TLS = <_SSLMethod.PROTOCOL_TLS: 2> PROTOCOL_TLS_CLIENT = <_SSLMethod.PROTOCOL_TLS_CLIENT: 16> PROTOCOL_TLS_SERVER = <_SSLMethod.PROTOCOL_TLS_SERVER: 17> PROTOCOL_TLSv1 = <_SSLMethod.PROTOCOL_TLSv1: 3> PROTOCOL_TLSv1_1 = <_SSLMethod.PROTOCOL_TLSv1_1: 4> PROTOCOL_TLSv1_2 = <_SSLMethod.PROTOCOL_TLSv1_2: 5> SOCK_STREAM = <SocketKind.SOCK_STREAM: 1> SOL_SOCKET = 1 SO_TYPE = 3 SSL_ERROR_EOF = <SSLErrorNumber.SSL_ERROR_EOF: 8> SSL_ERROR_INVALID_ERROR_CODE = <SSLErrorNumber.SSL_ERROR_INVALID_ERROR... SSL_ERROR_SSL = <SSLErrorNumber.SSL_ERROR_SSL: 1> SSL_ERROR_SYSCALL = <SSLErrorNumber.SSL_ERROR_SYSCALL: 5> SSL_ERROR_WANT_CONNECT = <SSLErrorNumber.SSL_ERROR_WANT_CONNECT: 7> SSL_ERROR_WANT_READ = <SSLErrorNumber.SSL_ERROR_WANT_READ: 2> SSL_ERROR_WANT_WRITE = <SSLErrorNumber.SSL_ERROR_WANT_WRITE: 3> SSL_ERROR_WANT_X509_LOOKUP = <SSLErrorNumber.SSL_ERROR_WANT_X509_LOOKU... SSL_ERROR_ZERO_RETURN = <SSLErrorNumber.SSL_ERROR_ZERO_RETURN: 6> VERIFY_ALLOW_PROXY_CERTS = <VerifyFlags.VERIFY_ALLOW_PROXY_CERTS: 64> VERIFY_CRL_CHECK_CHAIN = <VerifyFlags.VERIFY_CRL_CHECK_CHAIN: 12> VERIFY_CRL_CHECK_LEAF = <VerifyFlags.VERIFY_CRL_CHECK_LEAF: 4> VERIFY_DEFAULT = <VerifyFlags.VERIFY_DEFAULT: 0> VERIFY_X509_PARTIAL_CHAIN = <VerifyFlags.VERIFY_X509_PARTIAL_CHAIN: 52... VERIFY_X509_STRICT = <VerifyFlags.VERIFY_X509_STRICT: 32> VERIFY_X509_TRUSTED_FIRST = <VerifyFlags.VERIFY_X509_TRUSTED_FIRST: 32... FILE /usr/lib/python3.10/ssl.py
Generated by phpMan Author: Che Dong Under GNU General Public License
2026-06-02 05:14 @216.73.216.198 CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)