mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 20:24:30 +08:00
FixpyOpenSSL stubs to pass stubtest (#5657)
* Fix missing default arguments. * Fix wrong argument names. * Add constructor to `_EllipticCurve` and remove `name`.
This commit is contained in:
@@ -1,4 +1 @@
|
||||
OpenSSL.SSL.Connection.__init__
|
||||
OpenSSL.SSL.Context.load_verify_locations
|
||||
OpenSSL.SSL.Context.set_verify
|
||||
OpenSSL.crypto
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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 = ...
|
||||
|
||||
Reference in New Issue
Block a user