diff --git a/stubs/pyOpenSSL/@tests/stubtest_allowlist.txt b/stubs/pyOpenSSL/@tests/stubtest_allowlist.txt index a156e4ee8c3e..dd84546dff4f 100644 --- a/stubs/pyOpenSSL/@tests/stubtest_allowlist.txt +++ b/stubs/pyOpenSSL/@tests/stubtest_allowlist.txt @@ -1,4 +1 @@ -OpenSSL.SSL.Connection.__init__ -OpenSSL.SSL.Context.load_verify_locations -OpenSSL.SSL.Context.set_verify OpenSSL.crypto diff --git a/stubs/pyOpenSSL/OpenSSL/SSL.pyi b/stubs/pyOpenSSL/OpenSSL/SSL.pyi index 78955f099d15..9ede0ecbecc0 100644 --- a/stubs/pyOpenSSL/OpenSSL/SSL.pyi +++ b/stubs/pyOpenSSL/OpenSSL/SSL.pyi @@ -1,4 +1,4 @@ -from socket import socket +import socket from typing import Callable, Sequence from OpenSSL.crypto import X509 @@ -13,7 +13,7 @@ OP_NO_TLSv1_3: int VERIFY_PEER: int class Connection: - def __init__(self, context: Context, _socket: socket | None) -> None: ... + def __init__(self, context: Context, socket: socket.socket | None = ...) -> None: ... def connect(self, addr: str | bytes | Sequence[str | int]) -> None: ... def do_handshake(self) -> None: ... def get_peer_certificate(self) -> X509: ... @@ -21,6 +21,6 @@ class Connection: class Context: def __init__(self, method: int) -> None: ... - def load_verify_locations(self, cafile: str | None, capath: str | None) -> None: ... + def load_verify_locations(self, cafile: str | None, capath: str | None = ...) -> None: ... def set_options(self, options: int) -> None: ... - def set_verify(self, mode: int, callback: Callable[[Connection, X509, int, int, int], bool]) -> None: ... + def set_verify(self, mode: int, callback: Callable[[Connection, X509, int, int, int], bool] | None = ...) -> None: ... diff --git a/stubs/pyOpenSSL/OpenSSL/crypto.pyi b/stubs/pyOpenSSL/OpenSSL/crypto.pyi index 3bb1adb128b7..a0822311c342 100644 --- a/stubs/pyOpenSSL/OpenSSL/crypto.pyi +++ b/stubs/pyOpenSSL/OpenSSL/crypto.pyi @@ -1,5 +1,5 @@ from datetime import datetime -from typing import Callable, Iterable, List, Sequence, Set, Text, Tuple, Union +from typing import Any, Callable, Iterable, List, Sequence, Set, Text, Tuple, Union from cryptography.hazmat.primitives.asymmetric.dsa import DSAPrivateKey, DSAPublicKey from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey, RSAPublicKey @@ -15,7 +15,7 @@ TYPE_RSA: int TYPE_DSA: int class _EllipticCurve: - name: Text + def __init__(self, lib: Any | None, nid: int, name: str) -> None: ... class Error(Exception): ... @@ -53,7 +53,7 @@ class X509: def add_extensions(self, extensions: Iterable[X509Extension]) -> None: ... def digest(self, digest_name: bytes) -> bytes: ... @classmethod - def from_cryptography(cls, crypto_key: Certificate) -> X509: ... + 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: ... @@ -129,12 +129,12 @@ class X509Store: def __init__(self) -> None: ... def add_cert(self, cert: X509) -> None: ... def add_crl(self, crl: CRL) -> None: ... - def load_locations(self, cafile: Text | bytes, capath: Text | bytes) -> None: ... + def load_locations(self, cafile: Text | bytes, capath: Text | bytes | 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: ... + def __init__(self, store: X509Store, certificate: X509, chain: Sequence[X509] | None = ...) -> None: ... def get_verified_chain(self) -> List[X509]: ... def set_store(self, store: X509Store) -> None: ... def verify_certificate(self) -> None: ... @@ -187,7 +187,7 @@ def get_elliptic_curves() -> Set[_EllipticCurve]: ... def get_elliptic_curve(name: Text) -> _EllipticCurve: ... def dump_certificate(type: int, cert: X509) -> bytes: ... def load_certificate(type: int, buffer: bytes) -> X509: ... -def dump_certificate_request(type: int, cert: X509Req) -> bytes: ... +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: bytes | None = ..., passphrase: bytes | Callable[[], bytes] | None = ...