Remove pyOpenSSL stubs (#13493)

This commit is contained in:
Shamil
2025-02-12 12:42:43 +03:00
committed by GitHub
parent 15f98a8ab8
commit a410f251ee
7 changed files with 0 additions and 417 deletions
@@ -1 +0,0 @@
OpenSSL.SSL.Context.__getattr__
-9
View File
@@ -1,9 +0,0 @@
version = "24.1.*"
upstream_repository = "https://github.com/pyca/pyopenssl"
# Requires a version of cryptography with a `py.typed` file
requires = ["cryptography>=35.0.0", "types-cffi"]
partial_stub = true
obsolete_since = "24.2.1" # Released on 2024-07-20
[tool.stubtest]
ignore_missing_stub = true
-206
View File
@@ -1,206 +0,0 @@
import socket
from _socket import _Address, _RetAddress
from _typeshed import Incomplete, ReadableBuffer
from collections.abc import Callable, MutableSequence, Sequence
from typing import Any, TypeVar
import _cffi_backend as cffi
from OpenSSL.crypto import X509, PKey, X509Name
OPENSSL_VERSION_NUMBER: int
SSLEAY_VERSION: int
SSLEAY_CFLAGS: int
SSLEAY_PLATFORM: int
SSLEAY_DIR: int
SSLEAY_BUILT_ON: int
SENT_SHUTDOWN: int
RECEIVED_SHUTDOWN: int
SSLv23_METHOD: int
TLSv1_METHOD: int
TLSv1_1_METHOD: int
TLSv1_2_METHOD: int
TLS_METHOD: int
TLS_SERVER_METHOD: int
TLS_CLIENT_METHOD: int
DTLS_METHOD: int
DTLS_SERVER_METHOD: int
DTLS_CLIENT_METHOD: int
SSL3_VERSION: int
TLS1_VERSION: int
TLS1_1_VERSION: int
TLS1_2_VERSION: int
TLS1_3_VERSION: int
OP_NO_SSLv2: int
OP_NO_SSLv3: int
OP_NO_TLSv1: int
OP_NO_TLSv1_1: int
OP_NO_TLSv1_2: int
OP_NO_TLSv1_3: int
MODE_RELEASE_BUFFERS: int
OP_SINGLE_DH_USE: int
OP_SINGLE_ECDH_USE: int
OP_EPHEMERAL_RSA: int
OP_MICROSOFT_SESS_ID_BUG: int
OP_NETSCAPE_CHALLENGE_BUG: int
OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: int
OP_SSLREF2_REUSE_CERT_TYPE_BUG: int
OP_MICROSOFT_BIG_SSLV3_BUFFER: int
OP_MSIE_SSLV2_RSA_PADDING: int
OP_SSLEAY_080_CLIENT_DH_BUG: int
OP_TLS_D5_BUG: int
OP_TLS_BLOCK_PADDING_BUG: int
OP_DONT_INSERT_EMPTY_FRAGMENTS: int
OP_CIPHER_SERVER_PREFERENCE: int
OP_TLS_ROLLBACK_BUG: int
OP_PKCS1_CHECK_1: int
OP_PKCS1_CHECK_2: int
OP_NETSCAPE_CA_DN_BUG: int
OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG: int
OP_NO_COMPRESSION: int
OP_NO_QUERY_MTU: int
OP_COOKIE_EXCHANGE: int
OP_NO_TICKET: int
OP_ALL: int
VERIFY_PEER: int
VERIFY_FAIL_IF_NO_PEER_CERT: int
VERIFY_CLIENT_ONCE: int
VERIFY_NONE: int
SESS_CACHE_OFF: int
SESS_CACHE_CLIENT: int
SESS_CACHE_SERVER: int
SESS_CACHE_BOTH: int
SESS_CACHE_NO_AUTO_CLEAR: int
SESS_CACHE_NO_INTERNAL_LOOKUP: int
SESS_CACHE_NO_INTERNAL_STORE: int
SESS_CACHE_NO_INTERNAL: int
SSL_ST_CONNECT: int
SSL_ST_ACCEPT: int
SSL_ST_MASK: int
SSL_CB_LOOP: int
SSL_CB_EXIT: int
SSL_CB_READ: int
SSL_CB_WRITE: int
SSL_CB_ALERT: int
SSL_CB_READ_ALERT: int
SSL_CB_WRITE_ALERT: int
SSL_CB_ACCEPT_LOOP: int
SSL_CB_ACCEPT_EXIT: int
SSL_CB_CONNECT_LOOP: int
SSL_CB_CONNECT_EXIT: int
SSL_CB_HANDSHAKE_START: int
SSL_CB_HANDSHAKE_DONE: int
NO_OVERLAPPING_PROTOCOLS: object
class Error(Exception): ...
class WantReadError(Error): ...
class WantWriteError(Error): ...
class WantX509LookupError(Error): ...
class ZeroReturnError(Error): ...
class SysCallError(Error): ...
def SSLeay_version(type: int) -> bytes: ...
class Session: ...
class Connection:
def __getattr__(self, name: str) -> Any: ... # takes attributes from `self._socket`
def __init__(self, context: Context, socket: socket.socket | None = None) -> None: ...
def get_context(self) -> Context: ...
def set_context(self, context: Context) -> None: ...
def get_servername(self) -> bytes | None: ...
def set_tlsext_host_name(self, name: bytes) -> None: ...
def pending(self) -> int: ...
def send(self, buf: ReadableBuffer | str, flags: int = 0) -> int: ...
write = send
def sendall(self, buf: ReadableBuffer | str, flags: int = 0) -> int: ...
def recv(self, bufsiz: int, flags: int | None = None) -> bytes: ...
read = recv
def recv_into(self, buffer: MutableSequence[int], nbytes: int | None = None, flags: int | None = None) -> int: ...
def connect(self, addr: str | bytes | Sequence[str | int]) -> None: ...
def connect_ex(self, addr: _Address | bytes) -> int: ...
def accept(self) -> tuple[Connection, _RetAddress]: ...
def DTLSv1_listen(self) -> None: ...
def DTLSv1_get_timeout(self) -> float | None: ...
def DTLSv1_handle_timeout(self) -> bool: ...
def shutdown(self) -> bool: ...
def do_handshake(self) -> None: ...
def get_certificate(self) -> X509 | None: ...
def get_peer_certificate(self) -> X509 | None: ...
def get_peer_cert_chain(self) -> list[X509] | None: ...
def get_verified_chain(self) -> list[X509] | None: ...
def bio_read(self, bufsiz: int) -> bytes: ...
def bio_write(self, buf: bytes) -> int: ...
def bio_shutdown(self) -> None: ...
def renegotiate(self) -> bool: ...
def renegotiate_pending(self) -> bool: ...
def total_renegotiations(self) -> int: ...
def set_accept_state(self) -> None: ...
def set_connect_state(self) -> None: ...
def get_client_ca_list(self) -> list[X509Name]: ...
def get_cipher_list(self) -> list[str]: ...
def get_cipher_name(self) -> str | None: ...
def get_cipher_bits(self) -> int | None: ...
def get_cipher_version(self) -> str | None: ...
def get_protocol_version_name(self) -> str: ...
def get_protocol_version(self) -> int: ...
def get_shutdown(self) -> int: ...
def set_shutdown(self, state: int) -> None: ...
def get_state_string(self) -> bytes: ...
def server_random(self) -> bytes | None: ...
def client_random(self) -> bytes | None: ...
def master_key(self) -> bytes | None: ...
def export_keying_material(self, label: bytes, olen: int, context: bytes | None = None) -> cffi.buffer: ...
def get_app_data(self) -> Any: ...
def set_app_data(self, data: Any) -> None: ...
def sock_shutdown(self, how: int, /) -> None: ... # alias to `_socket.socket.shutdown`
def want_read(self) -> bool: ...
def want_write(self) -> bool: ...
def get_session(self) -> Session | None: ...
def set_session(self, session: Session) -> None: ...
def get_finished(self) -> bytes | None: ...
def get_peer_finished(self) -> bytes | None: ...
def set_alpn_protos(self, protos: Sequence[bytes]) -> None: ...
def get_alpn_proto_negotiated(self) -> bytes: ...
def get_selected_srtp_profile(self) -> bytes: ...
def request_ocsp(self) -> None: ...
_T = TypeVar("_T")
class Context:
def __getattr__(self, name: str) -> Incomplete: ...
def __init__(self, method: int) -> None: ...
def load_verify_locations(self, cafile: str | None, capath: str | None = None) -> None: ...
def set_options(self, options: int) -> None: ...
def set_verify(self, mode: int, callback: Callable[[Connection, X509, int, int, int], bool] | None = None) -> None: ...
def set_min_proto_version(self, version: int) -> None: ...
def set_max_proto_version(self, version: int) -> None: ...
def use_certificate_chain_file(self, certfile: str | bytes) -> None: ...
def use_certificate_file(self, certfile: str | bytes, filetype: int = 1) -> None: ...
def use_certificate(self, cert: X509) -> None: ...
def use_privatekey_file(self, keyfile: str | bytes, filetype: int | None = ...) -> None: ...
def use_privatekey(self, pkey: PKey) -> None: ...
def add_extra_chain_cert(self, certobj: X509) -> None: ...
def set_cipher_list(self, cipher_list: bytes) -> None: ...
def set_keylog_callback(self, callback: Callable[[Connection, bytes], object]) -> None: ...
def set_alpn_protos(self, protos: Sequence[bytes]) -> None: ...
def set_alpn_select_callback(self, callback: Callable[[Connection, list[bytes]], bytes]) -> None: ...
def set_ocsp_server_callback(self, callback: Callable[[Connection, _T | None], bytes], data: _T | None = None) -> None: ...
def set_ocsp_client_callback(
self, callback: Callable[[Connection, bytes, _T | None], bool], data: _T | None = None
) -> None: ...
-188
View File
@@ -1,188 +0,0 @@
from _typeshed import Incomplete, StrOrBytesPath
from collections.abc import Callable, Iterable, Sequence
from datetime import datetime
from typing import Any
from typing_extensions import TypeAlias, deprecated
from cryptography.hazmat.primitives.asymmetric.dsa import DSAPrivateKey, DSAPublicKey
from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey, RSAPublicKey
from cryptography.x509 import Certificate, CertificateRevocationList, CertificateSigningRequest
_Key: TypeAlias = DSAPrivateKey | DSAPublicKey | RSAPrivateKey | RSAPublicKey
FILETYPE_PEM: int
FILETYPE_ASN1: int
FILETYPE_TEXT: int
TYPE_RSA: int
TYPE_DSA: int
TYPE_DH: int
TYPE_EC: int
class _EllipticCurve:
def __init__(self, lib: Incomplete | None, nid: int, name: str) -> None: ...
class Error(Exception): ...
class PKey:
def __init__(self) -> None: ...
def bits(self) -> int: ...
def check(self) -> bool: ...
@classmethod
def from_cryptography_key(cls, crypto_key: _Key) -> PKey: ...
def generate_key(self, type: int, bits: int) -> None: ...
def to_cryptography_key(self) -> _Key: ...
def type(self) -> int: ...
class X509Name:
countryName: str
C: str
stateOrProvinceName: str
ST: str
localityName: str
L: str
organizationName: str
O: str
organizationalUnitName: str
OU: str
commonName: str
CN: str
emailAddress: str
def __init__(self, name: X509Name) -> None: ...
def der(self) -> bytes: ...
def get_components(self) -> list[tuple[bytes, bytes]]: ...
def hash(self) -> int: ...
class X509:
def __init__(self) -> None: ...
def add_extensions(self, extensions: Iterable[X509Extension]) -> None: ...
def digest(self, digest_name: str) -> bytes: ...
@classmethod
def from_cryptography(cls, crypto_cert: Certificate) -> X509: ...
def get_extension(self, index: int) -> X509Extension: ...
def get_extension_count(self) -> int: ...
def get_issuer(self) -> X509Name: ...
def get_notAfter(self) -> bytes | None: ...
def get_notBefore(self) -> bytes | None: ...
def get_pubkey(self) -> PKey: ...
def get_serial_number(self) -> int: ...
def get_signature_algorithm(self) -> bytes: ...
def get_subject(self) -> X509Name: ...
def get_version(self) -> int: ...
def gmtime_adj_notAfter(self, amount: int) -> None: ...
def gmtime_adj_notBefore(self, amount: int) -> None: ...
def has_expired(self) -> bool: ...
def set_issuer(self, issuer: X509Name) -> None: ...
def set_notAfter(self, when: bytes) -> None: ...
def set_notBefore(self, when: bytes) -> None: ...
def set_pubkey(self, pkey: PKey) -> None: ...
def set_serial_number(self, serial: int) -> None: ...
def set_subject(self, subject: X509Name) -> None: ...
def set_version(self, version: int) -> None: ...
def sign(self, pkey: PKey, digest: str) -> None: ...
def subject_name_hash(self) -> bytes: ...
def to_cryptography(self) -> Certificate: ...
class X509Req:
def __init__(self) -> None: ...
def add_extensions(self, extensions: Iterable[X509Extension]) -> None: ...
@classmethod
def from_cryptography(cls, crypto_req: CertificateSigningRequest) -> X509Req: ...
def get_extensions(self) -> list[X509Extension]: ...
def get_pubkey(self) -> PKey: ...
def get_subject(self) -> X509Name: ...
def get_version(self) -> int: ...
def set_pubkey(self, pkey: PKey) -> None: ...
def set_version(self, version: int) -> None: ...
def sign(self, pkey: PKey, digest: str) -> None: ...
def to_cryptography(self) -> CertificateSigningRequest: ...
def verify(self, pkey: PKey) -> bool: ...
@deprecated("X509Extension support in pyOpenSSL is deprecated. You should use the APIs in cryptography.")
class X509Extension:
def __init__(
self, type_name: bytes, critical: bool, value: bytes, subject: X509 | None = None, issuer: X509 | None = None
) -> None: ...
def get_critical(self) -> bool: ...
def get_data(self) -> bytes: ...
def get_short_name(self) -> bytes: ...
@deprecated("CRL support in pyOpenSSL is deprecated. You should use the APIs in cryptography.")
class Revoked:
def __init__(self) -> None: ...
def all_reasons(self) -> list[bytes]: ...
def get_reason(self) -> bytes | None: ...
def get_rev_date(self) -> bytes: ...
def get_serial(self) -> bytes: ...
def set_reason(self, reason: bytes | None) -> None: ...
def set_rev_date(self, when: bytes) -> None: ...
def set_serial(self, hex_str: bytes) -> None: ...
@deprecated("CRL support in pyOpenSSL is deprecated. You should use the APIs in cryptography.")
class CRL:
def __init__(self) -> None: ...
def add_revoked(self, revoked: Revoked) -> None: ...
def export(self, cert: X509, key: PKey, type: int = 1, days: int = 100, digest: bytes = ...) -> bytes: ...
@classmethod
def from_cryptography(cls, crypto_crl: CertificateRevocationList) -> CRL: ...
def get_issuer(self) -> X509Name: ...
def get_revoked(self) -> tuple[Revoked, ...]: ...
def set_lastUpdate(self, when: bytes) -> None: ...
def set_nextUpdate(self, when: bytes) -> None: ...
def set_version(self, version: int) -> None: ...
def sign(self, issuer_cert: X509, issuer_key: PKey, digest: bytes) -> None: ...
def to_cryptography(self) -> CertificateRevocationList: ...
class X509Store:
def __init__(self) -> None: ...
def add_cert(self, cert: X509) -> None: ...
def add_crl(self, crl: CRL | CertificateRevocationList) -> None: ...
def load_locations(self, cafile: StrOrBytesPath, capath: StrOrBytesPath | None = None) -> None: ...
def set_flags(self, flags: int) -> None: ...
def set_time(self, vfy_time: datetime) -> None: ...
class X509StoreContext:
def __init__(self, store: X509Store, certificate: X509, chain: Sequence[X509] | None = None) -> None: ...
def get_verified_chain(self) -> list[X509]: ...
def set_store(self, store: X509Store) -> None: ...
def verify_certificate(self) -> None: ...
class X509StoreContextError(Exception):
errors: list[Any]
certificate: X509
def __init__(self, message: str, errors: list[Any], certificate: X509) -> None: ...
class X509StoreFlags:
CRL_CHECK: int
CRL_CHECK_ALL: int
IGNORE_CRITICAL: int
X509_STRICT: int
ALLOW_PROXY_CERTS: int
POLICY_CHECK: int
EXPLICIT_POLICY: int
INHIBIT_MAP: int
NOTIFY_POLICY: int
CHECK_SS_SIGNATURE: int
CB_ISSUER_CHECK: int
PARTIAL_CHAIN: int
def get_elliptic_curves() -> set[_EllipticCurve]: ...
def get_elliptic_curve(name: str) -> _EllipticCurve: ...
def dump_certificate(type: int, cert: X509) -> bytes: ...
def load_certificate(type: int, buffer: bytes) -> X509: ...
def dump_certificate_request(type: int, req: X509Req) -> bytes: ...
def load_certificate_request(type: int, buffer: bytes) -> X509Req: ...
def dump_privatekey(
type: int, pkey: PKey, cipher: str | None = None, passphrase: bytes | Callable[[], bytes] | None = None
) -> bytes: ...
def load_privatekey(type: int, buffer: str | bytes, passphrase: bytes | Callable[[], bytes] | None = None) -> PKey: ...
def dump_publickey(type: int, pkey: PKey) -> bytes: ...
def load_publickey(type: int, buffer: str | bytes) -> PKey: ...
@deprecated("sign() is deprecated. Use the equivalent APIs in cryptography.")
def sign(pkey: PKey, data: str | bytes, digest: str) -> bytes: ... # deprecated
@deprecated("verify() is deprecated. Use the equivalent APIs in cryptography.")
def verify(cert: X509, signature: bytes, data: str | bytes, digest: str) -> None: ... # deprecated
@deprecated("CRL support in pyOpenSSL is deprecated. You should use the APIs in cryptography.")
def dump_crl(type: int, crl: CRL) -> bytes: ...
@deprecated("CRL support in pyOpenSSL is deprecated. You should use the APIs in cryptography.")
def load_crl(type: int, buffer: str | bytes) -> CRL: ...
-4
View File
@@ -1,4 +0,0 @@
from typing import Literal
def add(buffer: bytes, entropy: int) -> None: ...
def status() -> Literal[0, 1]: ...
-9
View File
@@ -1,9 +0,0 @@
__version__: str
__title__: str
__uri__: str
__summary__: str
__author__: str
__email__: str
__license__: str
__copyright__: str