massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stubs / cryptography / cryptography / hazmat / primitives / asymmetric / rsa.pyi
1 from abc import ABCMeta, abstractmethod
2
3 from cryptography.hazmat.backends.interfaces import RSABackend
4 from cryptography.hazmat.primitives.asymmetric import AsymmetricVerificationContext
5 from cryptography.hazmat.primitives.asymmetric.padding import AsymmetricPadding
6 from cryptography.hazmat.primitives.asymmetric.utils import Prehashed
7 from cryptography.hazmat.primitives.hashes import HashAlgorithm
8 from cryptography.hazmat.primitives.serialization import Encoding, KeySerializationEncryption, PrivateFormat, PublicFormat
9
10 class RSAPrivateKey(metaclass=ABCMeta):
11     @property
12     @abstractmethod
13     def key_size(self) -> int: ...
14     @abstractmethod
15     def decrypt(self, ciphertext: bytes, padding: AsymmetricPadding) -> bytes: ...
16     @abstractmethod
17     def public_key(self) -> RSAPublicKey: ...
18     @abstractmethod
19     def sign(self, data: bytes, padding: AsymmetricPadding, algorithm: HashAlgorithm | Prehashed) -> bytes: ...
20
21 class RSAPrivateKeyWithSerialization(RSAPrivateKey):
22     @abstractmethod
23     def private_bytes(
24         self, encoding: Encoding, format: PrivateFormat, encryption_algorithm: KeySerializationEncryption
25     ) -> bytes: ...
26     @abstractmethod
27     def private_numbers(self) -> RSAPrivateNumbers: ...
28
29 class RSAPublicKey(metaclass=ABCMeta):
30     @property
31     @abstractmethod
32     def key_size(self) -> int: ...
33     @abstractmethod
34     def encrypt(self, plaintext: bytes, padding: AsymmetricPadding) -> bytes: ...
35     @abstractmethod
36     def public_bytes(self, encoding: Encoding, format: PublicFormat) -> bytes: ...
37     @abstractmethod
38     def public_numbers(self) -> RSAPublicNumbers: ...
39     @abstractmethod
40     def verifier(
41         self, signature: bytes, padding: AsymmetricPadding, algorithm: HashAlgorithm | Prehashed
42     ) -> AsymmetricVerificationContext: ...
43     @abstractmethod
44     def verify(self, signature: bytes, data: bytes, padding: AsymmetricPadding, algorithm: HashAlgorithm | Prehashed) -> None: ...
45
46 RSAPublicKeyWithSerialization = RSAPublicKey
47
48 def generate_private_key(
49     public_exponent: int, key_size: int, backend: RSABackend | None = ...
50 ) -> RSAPrivateKeyWithSerialization: ...
51 def rsa_crt_iqmp(p: int, q: int) -> int: ...
52 def rsa_crt_dmp1(private_exponent: int, p: int) -> int: ...
53 def rsa_crt_dmq1(private_exponent: int, q: int) -> int: ...
54 def rsa_recover_prime_factors(n: int, e: int, d: int) -> tuple[int, int]: ...
55
56 class RSAPrivateNumbers(object):
57     def __init__(self, p: int, q: int, d: int, dmp1: int, dmq1: int, iqmp: int, public_numbers: RSAPublicNumbers) -> None: ...
58     @property
59     def p(self) -> int: ...
60     @property
61     def q(self) -> int: ...
62     @property
63     def d(self) -> int: ...
64     @property
65     def dmp1(self) -> int: ...
66     @property
67     def dmq1(self) -> int: ...
68     @property
69     def iqmp(self) -> int: ...
70     @property
71     def public_numbers(self) -> RSAPublicNumbers: ...
72     def private_key(self, backend: RSABackend | None = ...) -> RSAPrivateKey: ...
73
74 class RSAPublicNumbers(object):
75     def __init__(self, e: int, n: int) -> None: ...
76     @property
77     def e(self) -> int: ...
78     @property
79     def n(self) -> int: ...
80     def public_key(self, backend: RSABackend | None = ...) -> RSAPublicKey: ...