mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
Fixed a problem with the openssl-python stubs (#5038)
Fixed a problem with the openssl-python stubs. It was using `unicode`, which is not defined in Python 3. I conditionalized its use based on Python version check. Co-authored-by: Eric Traut <erictr@microsoft.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from typing import Any, Callable, Iterable, List, Optional, Set, Text, Tuple, Union
|
||||
from typing import Callable, Iterable, List, Optional, Set, Text, Tuple, Union
|
||||
|
||||
from cryptography.hazmat.primitives.asymmetric import dsa, rsa
|
||||
|
||||
@@ -29,21 +30,26 @@ class _EllipticCurve:
|
||||
def get_elliptic_curves() -> Set[_EllipticCurve]: ...
|
||||
def get_elliptic_curve(name: str) -> _EllipticCurve: ...
|
||||
|
||||
if sys.version_info >= (3, 0):
|
||||
_StrLike = str
|
||||
else:
|
||||
_StrLike = Union[str, unicode]
|
||||
|
||||
class X509Name:
|
||||
def __init__(self, name: X509Name) -> None: ...
|
||||
countryName: Union[str, unicode]
|
||||
stateOrProvinceName: Union[str, unicode]
|
||||
localityName: Union[str, unicode]
|
||||
organizationName: Union[str, unicode]
|
||||
organizationalUnitName: Union[str, unicode]
|
||||
commonName: Union[str, unicode]
|
||||
emailAddress: Union[str, unicode]
|
||||
C: Union[str, unicode]
|
||||
ST: Union[str, unicode]
|
||||
L: Union[str, unicode]
|
||||
O: Union[str, unicode]
|
||||
OU: Union[str, unicode]
|
||||
CN: Union[str, unicode]
|
||||
countryName: _StrLike
|
||||
stateOrProvinceName: _StrLike
|
||||
localityName: _StrLike
|
||||
organizationName: _StrLike
|
||||
organizationalUnitName: _StrLike
|
||||
commonName: _StrLike
|
||||
emailAddress: _StrLike
|
||||
C: _StrLike
|
||||
ST: _StrLike
|
||||
L: _StrLike
|
||||
O: _StrLike
|
||||
OU: _StrLike
|
||||
CN: _StrLike
|
||||
def hash(self) -> int: ...
|
||||
def der(self) -> bytes: ...
|
||||
def get_components(self) -> List[Tuple[str, str]]: ...
|
||||
@@ -124,7 +130,7 @@ class X509StoreContext:
|
||||
def set_store(self, store: X509Store) -> None: ...
|
||||
def verify_certificate(self) -> None: ...
|
||||
|
||||
def load_certificate(type: int, buffer: Union[str, unicode]) -> X509: ...
|
||||
def load_certificate(type: int, buffer: _StrLike) -> X509: ...
|
||||
def dump_certificate(type: int, cert: X509) -> bytes: ...
|
||||
def dump_publickey(type: int, pkey: PKey) -> bytes: ...
|
||||
def dump_privatekey(
|
||||
@@ -179,13 +185,13 @@ class NetscapeSPKI:
|
||||
def get_pubkey(self) -> PKey: ...
|
||||
def set_pubkey(self, pkey: PKey) -> None: ...
|
||||
|
||||
def load_publickey(type: int, buffer: Union[str, unicode]) -> PKey: ...
|
||||
def load_publickey(type: int, buffer: _StrLike) -> PKey: ...
|
||||
def load_privatekey(type: int, buffer: bytes, passphrase: Optional[Union[str, Callable[[int], int]]] = ...): ...
|
||||
def dump_certificate_request(type: int, req: X509Req): ...
|
||||
def load_certificate_request(type, buffer: Union[str, unicode]) -> X509Req: ...
|
||||
def sign(pkey: PKey, data: Union[str, unicode], digest: str) -> bytes: ...
|
||||
def verify(cert: X509, signature: bytes, data: Union[str, unicode], digest: str) -> None: ...
|
||||
def load_certificate_request(type, buffer: _StrLike) -> X509Req: ...
|
||||
def sign(pkey: PKey, data: _StrLike, digest: str) -> bytes: ...
|
||||
def verify(cert: X509, signature: bytes, data: _StrLike, digest: str) -> None: ...
|
||||
def dump_crl(type: int, crl: CRL) -> bytes: ...
|
||||
def load_crl(type: int, buffer: Union[str, unicode]) -> CRL: ...
|
||||
def load_pkcs7_data(type: int, buffer: Union[str, unicode]) -> PKCS7: ...
|
||||
def load_pkcs12(buffer: Union[str, unicode], passphrase: Optional[Union[str, Callable[[int], int]]] = ...) -> PKCS12: ...
|
||||
def load_crl(type: int, buffer: _StrLike) -> CRL: ...
|
||||
def load_pkcs7_data(type: int, buffer: _StrLike) -> PKCS7: ...
|
||||
def load_pkcs12(buffer: _StrLike, passphrase: Optional[Union[str, Callable[[int], int]]] = ...) -> PKCS12: ...
|
||||
|
||||
Reference in New Issue
Block a user