# Stubs for OpenSSL.SSL (Python 3)
#
# NOTE: This dynamically typed stub was automatically generated by stubgen.

from typing import Any
from typing import Optional

class _buffer: ...

OPENSSL_VERSION_NUMBER: Any
SSLEAY_VERSION: Any
SSLEAY_CFLAGS: Any
SSLEAY_PLATFORM: Any
SSLEAY_DIR: Any
SSLEAY_BUILT_ON: Any
SENT_SHUTDOWN: Any
RECEIVED_SHUTDOWN: Any
SSLv2_METHOD: int
SSLv3_METHOD: int
SSLv23_METHOD: int
TLSv1_METHOD: int
TLSv1_1_METHOD: int
TLSv1_2_METHOD: int
OP_NO_SSLv2: Any
OP_NO_SSLv3: Any
OP_NO_TLSv1: Any
OP_NO_TLSv1_1: Any
OP_NO_TLSv1_2: Any
OP_NO_TLSv1_3: Any
MODE_RELEASE_BUFFERS: Any
OP_SINGLE_DH_USE: Any
OP_SINGLE_ECDH_USE: Any
OP_EPHEMERAL_RSA: Any
OP_MICROSOFT_SESS_ID_BUG: Any
OP_NETSCAPE_CHALLENGE_BUG: Any
OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: Any
OP_SSLREF2_REUSE_CERT_TYPE_BUG: Any
OP_MICROSOFT_BIG_SSLV3_BUFFER: Any
OP_MSIE_SSLV2_RSA_PADDING: Any
OP_SSLEAY_080_CLIENT_DH_BUG: Any
OP_TLS_D5_BUG: Any
OP_TLS_BLOCK_PADDING_BUG: Any
OP_DONT_INSERT_EMPTY_FRAGMENTS: Any
OP_CIPHER_SERVER_PREFERENCE: Any
OP_TLS_ROLLBACK_BUG: Any
OP_PKCS1_CHECK_1: Any
OP_PKCS1_CHECK_2: Any
OP_NETSCAPE_CA_DN_BUG: Any
OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG: Any
OP_NO_COMPRESSION: Any
OP_NO_QUERY_MTU: Any
OP_COOKIE_EXCHANGE: Any
OP_NO_TICKET: Any
OP_ALL: Any
VERIFY_PEER: Any
VERIFY_FAIL_IF_NO_PEER_CERT: Any
VERIFY_CLIENT_ONCE: Any
VERIFY_NONE: Any
SESS_CACHE_OFF: Any
SESS_CACHE_CLIENT: Any
SESS_CACHE_SERVER: Any
SESS_CACHE_BOTH: Any
SESS_CACHE_NO_AUTO_CLEAR: Any
SESS_CACHE_NO_INTERNAL_LOOKUP: Any
SESS_CACHE_NO_INTERNAL_STORE: Any
SESS_CACHE_NO_INTERNAL: Any
SSL_ST_CONNECT: Any
SSL_ST_ACCEPT: Any
SSL_ST_MASK: Any
SSL_CB_LOOP: Any
SSL_CB_EXIT: Any
SSL_CB_READ: Any
SSL_CB_WRITE: Any
SSL_CB_ALERT: Any
SSL_CB_READ_ALERT: Any
SSL_CB_WRITE_ALERT: Any
SSL_CB_ACCEPT_LOOP: Any
SSL_CB_ACCEPT_EXIT: Any
SSL_CB_CONNECT_LOOP: Any
SSL_CB_CONNECT_EXIT: Any
SSL_CB_HANDSHAKE_START: Any
SSL_CB_HANDSHAKE_DONE: Any

class Error(Exception): ...
class WantReadError(Error): ...
class WantWriteError(Error): ...
class WantX509LookupError(Error): ...
class ZeroReturnError(Error): ...
class SysCallError(Error): ...

class _CallbackExceptionHelper:
    def __init__(self) -> None: ...
    def raise_if_problem(self) -> None: ...

class _VerifyHelper(_CallbackExceptionHelper):
    callback: Any = ...
    def __init__(self, callback: Any) -> None: ...

class _NpnAdvertiseHelper(_CallbackExceptionHelper):
    callback: Any = ...
    def __init__(self, callback: Any) -> None: ...

class _NpnSelectHelper(_CallbackExceptionHelper):
    callback: Any = ...
    def __init__(self, callback: Any) -> None: ...

class _ALPNSelectHelper(_CallbackExceptionHelper):
    callback: Any = ...
    def __init__(self, callback: Any) -> None: ...

class _OCSPServerCallbackHelper(_CallbackExceptionHelper):
    callback: Any = ...
    def __init__(self, callback: Any) -> None: ...

class _OCSPClientCallbackHelper(_CallbackExceptionHelper):
    callback: Any = ...
    def __init__(self, callback: Any) -> None: ...

def SSLeay_version(type: Any): ...

class Session: ...

class Context:
    def __init__(self, method: Any) -> None: ...
    def load_verify_locations(self, cafile: Any, capath: Optional[Any] = ...) -> None: ...
    def set_passwd_cb(self, callback: Any, userdata: Optional[Any] = ...) -> None: ...
    def set_default_verify_paths(self) -> None: ...
    def use_certificate_chain_file(self, certfile: Any) -> None: ...
    def use_certificate_file(self, certfile: Any, filetype: Any = ...) -> None: ...
    def use_certificate(self, cert: Any) -> None: ...
    def add_extra_chain_cert(self, certobj: Any) -> None: ...
    def use_privatekey_file(self, keyfile: Any, filetype: Any = ...) -> None: ...
    def use_privatekey(self, pkey: Any) -> None: ...
    def check_privatekey(self) -> None: ...
    def load_client_ca(self, cafile: Any) -> None: ...
    def set_session_id(self, buf: Any) -> None: ...
    def set_session_cache_mode(self, mode: Any): ...
    def get_session_cache_mode(self): ...
    def set_verify(self, mode: Any, callback: Any) -> None: ...
    def set_verify_depth(self, depth: Any) -> None: ...
    def get_verify_mode(self): ...
    def get_verify_depth(self): ...
    def load_tmp_dh(self, dhfile: Any) -> None: ...
    def set_tmp_ecdh(self, curve: Any) -> None: ...
    def set_cipher_list(self, cipher_list: Any) -> None: ...
    def set_client_ca_list(self, certificate_authorities: Any) -> None: ...
    def add_client_ca(self, certificate_authority: Any) -> None: ...
    def set_timeout(self, timeout: Any): ...
    def get_timeout(self): ...
    def set_info_callback(self, callback: Any) -> None: ...
    def get_app_data(self): ...
    def set_app_data(self, data: Any) -> None: ...
    def get_cert_store(self): ...
    def set_options(self, options: Any): ...
    def set_mode(self, mode: Any): ...
    def set_tlsext_servername_callback(self, callback: Any): ...
    def set_tlsext_use_srtp(self, profiles: Any) -> None: ...
    def set_npn_advertise_callback(self, callback: Any) -> None: ...
    def set_npn_select_callback(self, callback: Any) -> None: ...
    def set_alpn_protos(self, protos: Any) -> None: ...
    def set_alpn_select_callback(self, callback: Any) -> None: ...
    def set_ocsp_server_callback(self, callback: Any, data: Optional[Any] = ...) -> None: ...
    def set_ocsp_client_callback(self, callback: Any, data: Optional[Any] = ...) -> None: ...

class Connection:
    def __init__(self, context: Any, socket: Optional[Any] = ...) -> None: ...
    def __getattr__(self, name: Any): ...
    def get_context(self): ...
    def set_context(self, context: Any) -> None: ...
    def get_servername(self): ...
    def set_tlsext_host_name(self, name: Any) -> None: ...
    def pending(self): ...
    def send(self, buf: Any, flags: int = ...): ...
    write: Any = ...
    def sendall(self, buf: Any, flags: int = ...): ...
    def recv(self, bufsiz: Any, flags: Optional[Any] = ...): ...
    read: Any = ...
    def recv_into(self, buffer: Any, nbytes: Optional[Any] = ..., flags: Optional[Any] = ...): ...
    def bio_read(self, bufsiz: Any): ...
    def bio_write(self, buf: Any): ...
    def renegotiate(self): ...
    def do_handshake(self) -> None: ...
    def renegotiate_pending(self): ...
    def total_renegotiations(self): ...
    def connect(self, addr: Any): ...
    def connect_ex(self, addr: Any): ...
    def accept(self): ...
    def bio_shutdown(self) -> None: ...
    def shutdown(self): ...
    def get_cipher_list(self): ...
    def get_client_ca_list(self): ...
    def makefile(self, *args: Any, **kwargs: Any) -> None: ...
    def get_app_data(self): ...
    def set_app_data(self, data: Any) -> None: ...
    def get_shutdown(self): ...
    def set_shutdown(self, state: Any) -> None: ...
    def get_state_string(self): ...
    def server_random(self): ...
    def client_random(self): ...
    def master_key(self): ...
    def export_keying_material(self, label: Any, olen: Any, context: Optional[Any] = ...): ...
    def sock_shutdown(self, *args: Any, **kwargs: Any): ...
    def get_certificate(self): ...
    def get_peer_certificate(self): ...
    def get_peer_cert_chain(self): ...
    def want_read(self): ...
    def want_write(self): ...
    def set_accept_state(self) -> None: ...
    def set_connect_state(self) -> None: ...
    def get_session(self): ...
    def set_session(self, session: Any) -> None: ...
    def get_finished(self): ...
    def get_peer_finished(self): ...
    def get_cipher_name(self): ...
    def get_cipher_bits(self): ...
    def get_cipher_version(self): ...
    def get_protocol_version_name(self): ...
    def get_protocol_version(self): ...
    def get_next_proto_negotiated(self): ...
    def set_alpn_protos(self, protos: Any) -> None: ...
    def get_alpn_proto_negotiated(self): ...
    def request_ocsp(self) -> None: ...
