diff --git a/stubs/pyOpenSSL/METADATA.toml b/stubs/pyOpenSSL/METADATA.toml index 4be158bf0ef1..8e97d6cc0e9f 100644 --- a/stubs/pyOpenSSL/METADATA.toml +++ b/stubs/pyOpenSSL/METADATA.toml @@ -1,3 +1,2 @@ -version = "21.0.*" -python2 = true +version = "22.0.*" requires = ["types-cryptography"] diff --git a/stubs/pyOpenSSL/OpenSSL/SSL.pyi b/stubs/pyOpenSSL/OpenSSL/SSL.pyi index e947c788b667..46e723918858 100644 --- a/stubs/pyOpenSSL/OpenSSL/SSL.pyi +++ b/stubs/pyOpenSSL/OpenSSL/SSL.pyi @@ -111,9 +111,9 @@ class SysCallError(Error): ... def SSLeay_version(type: int) -> str: ... -class Session(object): ... +class Session: ... -class Connection(object): +class Connection: def __getattr__(self, name: str) -> Any: ... # incomplete def __init__(self, context: Context, socket: socket.socket | None = ...) -> None: ... def connect(self, addr: str | bytes | Sequence[str | int]) -> None: ... @@ -134,7 +134,7 @@ class Connection(object): def get_app_data(self) -> Any: ... def set_app_data(self, data: Any) -> None: ... -class Context(object): +class Context: def __getattr__(self, name: str) -> Any: ... # incomplete def __init__(self, method: int) -> None: ... def load_verify_locations(self, cafile: str | None, capath: str | None = ...) -> None: ... diff --git a/stubs/pyOpenSSL/OpenSSL/crypto.pyi b/stubs/pyOpenSSL/OpenSSL/crypto.pyi index 01e5577853ce..9ffaa7412d4a 100644 --- a/stubs/pyOpenSSL/OpenSSL/crypto.pyi +++ b/stubs/pyOpenSSL/OpenSSL/crypto.pyi @@ -1,5 +1,6 @@ +from _typeshed import StrOrBytesPath from datetime import datetime -from typing import Any, Callable, Iterable, Sequence, Text, Union +from typing import Any, Callable, Iterable, Sequence, Union from cryptography.hazmat.primitives.asymmetric.dsa import DSAPrivateKey, DSAPublicKey from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey, RSAPublicKey @@ -30,19 +31,19 @@ class PKey: def type(self) -> int: ... class X509Name: - countryName: Text - C: Text - stateOrProvinceName: Text - ST: Text - localityName: Text - L: Text - organizationName: Text - O: Text - organizationalUnitName: Text - OU: Text - commonName: Text - CN: Text - emailAddress: Text + 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]]: ... @@ -51,7 +52,7 @@ class X509Name: class X509: def __init__(self) -> None: ... def add_extensions(self, extensions: Iterable[X509Extension]) -> None: ... - def digest(self, digest_name: bytes) -> bytes: ... + def digest(self, digest_name: str) -> bytes: ... @classmethod def from_cryptography(cls, crypto_cert: Certificate) -> X509: ... def get_extension(self, index: int) -> X509Extension: ... @@ -74,7 +75,7 @@ class X509: 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: Text | bytes) -> None: ... + def sign(self, pkey: PKey, digest: str) -> None: ... def subject_name_hash(self) -> bytes: ... def to_cryptography(self) -> Certificate: ... @@ -89,7 +90,7 @@ class X509Req: 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: Text | bytes) -> None: ... + def sign(self, pkey: PKey, digest: str) -> None: ... def to_cryptography(self) -> CertificateSigningRequest: ... def verify(self, pkey: PKey) -> bool: ... @@ -129,7 +130,7 @@ 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 = ...) -> None: ... + def load_locations(self, cafile: StrOrBytesPath, capath: StrOrBytesPath | None = ...) -> None: ... def set_flags(self, flags: int) -> None: ... def set_time(self, vfy_time: datetime) -> None: ... @@ -141,7 +142,7 @@ class X509StoreContext: class X509StoreContextError(Exception): certificate: X509 - def __init__(self, message: Text | bytes, certificate: X509) -> None: ... + def __init__(self, message: str | bytes, certificate: X509) -> None: ... class X509StoreFlags: CRL_CHECK: int @@ -157,7 +158,7 @@ class X509StoreFlags: CB_ISSUER_CHECK: int class PKCS7: - def get_type_name(self) -> Text: ... + def get_type_name(self) -> str: ... def type_is_data(self) -> bool: ... def type_is_enveloped(self) -> bool: ... def type_is_signed(self) -> bool: ... @@ -180,24 +181,24 @@ class NetscapeSPKI: def b64_encode(self) -> bytes: ... def get_pubkey(self) -> PKey: ... def set_pubkey(self, pkey: PKey) -> None: ... - def sign(self, pkey: PKey, digest: bytes) -> None: ... + def sign(self, pkey: PKey, digest: str) -> None: ... def verify(self, key: PKey) -> bool: ... def get_elliptic_curves() -> set[_EllipticCurve]: ... -def get_elliptic_curve(name: Text) -> _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: bytes | None = ..., passphrase: bytes | Callable[[], bytes] | None = ... + type: int, pkey: PKey, cipher: str | None = ..., passphrase: bytes | Callable[[], bytes] | None = ... ) -> bytes: ... -def load_privatekey(type: int, buffer: Text | bytes, passphrase: bytes | Callable[[], bytes] | None = ...) -> PKey: ... +def load_privatekey(type: int, buffer: str | bytes, passphrase: bytes | Callable[[], bytes] | None = ...) -> PKey: ... def dump_publickey(type: int, pkey: PKey) -> bytes: ... -def load_publickey(type: int, buffer: Text | bytes) -> PKey: ... +def load_publickey(type: int, buffer: str | bytes) -> PKey: ... def dump_crl(type: int, crl: CRL) -> bytes: ... -def load_crl(type: int, buffer: Text | bytes) -> CRL: ... -def load_pkcs7_data(type: int, buffer: Text | bytes) -> PKCS7: ... -def load_pkcs12(buffer: Text | bytes, passphrase: bytes | None = ...) -> PKCS12: ... -def sign(pkey: PKey, data: Text | bytes, digest: Text | bytes) -> bytes: ... -def verify(cert: X509, signature: bytes, data: Text | bytes, digest: Text | bytes) -> None: ... +def load_crl(type: int, buffer: str | bytes) -> CRL: ... +def load_pkcs7_data(type: int, buffer: str | bytes) -> PKCS7: ... +def load_pkcs12(buffer: str | bytes, passphrase: bytes | None = ...) -> PKCS12: ... +def sign(pkey: PKey, data: str | bytes, digest: str) -> bytes: ... +def verify(cert: X509, signature: bytes, data: str | bytes, digest: str) -> None: ...