mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 12:14:27 +08:00
Move cryptography from 2 to 2and3 (#3304)
The cryptography stubs are very rudimentary at the moment, but there is nothing that limits them to just Python 2. Closes: #3303
This commit is contained in:
committed by
Jelle Zijlstra
parent
41d23a67f6
commit
0a426d8a8e
0
third_party/2/cryptography/__init__.pyi
vendored
0
third_party/2/cryptography/__init__.pyi
vendored
@@ -1,4 +0,0 @@
|
||||
# Minimal stub expressing only the classes required by OpenSSL.crypto.
|
||||
|
||||
class DSAPrivateKey: ...
|
||||
class DSAPublicKey: ...
|
||||
@@ -1,58 +0,0 @@
|
||||
from cryptography.hazmat.primitives.serialization import Encoding, KeySerializationEncryption, PrivateFormat, PublicFormat
|
||||
from typing import Tuple
|
||||
|
||||
class RSAPrivateKey:
|
||||
def signer(self, padding, algorithm): ...
|
||||
def decrypt(self, ciphertext: bytes, padding) -> bytes: ...
|
||||
def public_key(self) -> RSAPublicKey: ...
|
||||
@property
|
||||
def key_size(self) -> int: ...
|
||||
def sign(self, data: bytes, padding, algorithm) -> bytes: ...
|
||||
|
||||
class RSAPrivateKeyWithSerialization(RSAPrivateKey):
|
||||
def private_numbers(self) -> RSAPrivateNumbers: ...
|
||||
def private_bytes(self, encoding: Encoding, format: PrivateFormat,
|
||||
encryption_algorithm: KeySerializationEncryption) -> bytes: ...
|
||||
|
||||
class RSAPublicKey:
|
||||
def verifier(self, signature: bytes, padding, algorithm): ...
|
||||
def encrypt(self, plaintext: bytes, padding) -> bytes: ...
|
||||
@property
|
||||
def key_size(self) -> int: ...
|
||||
def public_numbers(self) -> RSAPublicNumbers: ...
|
||||
def public_bytes(self, encoding: Encoding, format: PublicFormat) -> bytes: ...
|
||||
def verify(self, signature: bytes, data: bytes, padding, algorithm) -> None: ...
|
||||
|
||||
RSAPublicKeyWithSerialization = RSAPublicKey
|
||||
|
||||
def generate_private_key(public_exponent: int, key_size: int, backend) -> RSAPrivateKeyWithSerialization: ...
|
||||
def rsa_crt_iqmp(p: int, q: int) -> int: ...
|
||||
def rsa_crt_dmp1(private_exponent: int, p: int) -> int: ...
|
||||
def rsa_crt_dmq1(private_exponent: int, q: int) -> int: ...
|
||||
def rsa_recover_prime_factors(n: int, e: int, d: int) -> Tuple[int, int]: ...
|
||||
|
||||
class RSAPrivateNumbers:
|
||||
def __init__(self, p: int, q: int, d: int, dmp1: int, dmq1: int, iqmp: int, public_numbers: RSAPublicNumbers) -> None: ...
|
||||
@property
|
||||
def p(self) -> int: ...
|
||||
@property
|
||||
def q(self) -> int: ...
|
||||
@property
|
||||
def d(self) -> int: ...
|
||||
@property
|
||||
def dmp1(self) -> int: ...
|
||||
@property
|
||||
def dmq1(self) -> int: ...
|
||||
@property
|
||||
def iqmp(self) -> int: ...
|
||||
@property
|
||||
def public_numbers(self) -> RSAPublicNumbers: ...
|
||||
def private_key(self, backend) -> RSAPrivateKey: ...
|
||||
|
||||
class RSAPublicNumbers:
|
||||
def __init__(self, e: int, n: int) -> None: ...
|
||||
@property
|
||||
def p(self) -> int: ...
|
||||
@property
|
||||
def q(self) -> int: ...
|
||||
def public_key(self, backend) -> RSAPublicKey: ...
|
||||
@@ -1,33 +0,0 @@
|
||||
from typing import Any, Optional
|
||||
from enum import Enum
|
||||
|
||||
def load_pem_private_key(data: bytes, password: Optional[bytes], backend): ...
|
||||
def load_pem_public_key(data: bytes, backend): ...
|
||||
def load_der_private_key(data: bytes, password: Optional[bytes], backend): ...
|
||||
def load_der_public_key(data: bytes, backend): ...
|
||||
def load_ssh_public_key(data: bytes, backend): ...
|
||||
|
||||
class Encoding(Enum):
|
||||
PEM: str
|
||||
DER: str
|
||||
OpenSSH: str
|
||||
|
||||
class PrivateFormat(Enum):
|
||||
PKCS8: str
|
||||
TraditionalOpenSSL: str
|
||||
|
||||
class PublicFormat(Enum):
|
||||
SubjectPublicKeyInfo: str
|
||||
PKCS1: str
|
||||
OpenSSH: str
|
||||
|
||||
class ParameterFormat(Enum):
|
||||
PKCS3: str
|
||||
|
||||
class KeySerializationEncryption: ...
|
||||
|
||||
class BestAvailableEncryption(KeySerializationEncryption):
|
||||
password: Any
|
||||
def __init__(self, password) -> None: ...
|
||||
|
||||
class NoEncryption(KeySerializationEncryption): ...
|
||||
Reference in New Issue
Block a user