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 / dh.pyi
1 from abc import ABCMeta, abstractmethod
2
3 from cryptography.hazmat.backends.interfaces import DHBackend
4 from cryptography.hazmat.primitives.serialization import (
5     Encoding,
6     KeySerializationEncryption,
7     ParameterFormat,
8     PrivateFormat,
9     PublicFormat,
10 )
11
12 class DHParameters(metaclass=ABCMeta):
13     @abstractmethod
14     def generate_private_key(self) -> DHPrivateKey: ...
15     @abstractmethod
16     def parameter_bytes(self, encoding: Encoding, format: ParameterFormat) -> bytes: ...
17     @abstractmethod
18     def parameter_numbers(self) -> DHParameterNumbers: ...
19
20 DHParametersWithSerialization = DHParameters
21
22 class DHParameterNumbers(object):
23     @property
24     def p(self) -> int: ...
25     @property
26     def g(self) -> int: ...
27     @property
28     def q(self) -> int: ...
29     def __init__(self, p: int, g: int, q: int | None) -> None: ...
30     def parameters(self, backend: DHBackend | None = ...) -> DHParameters: ...
31
32 class DHPrivateKey(metaclass=ABCMeta):
33     key_size: int
34     @abstractmethod
35     def exchange(self, peer_public_key: DHPublicKey) -> bytes: ...
36     @abstractmethod
37     def parameters(self) -> DHParameters: ...
38     @abstractmethod
39     def public_key(self) -> DHPublicKey: ...
40
41 class DHPrivateKeyWithSerialization(DHPrivateKey):
42     @abstractmethod
43     def private_bytes(
44         self, encoding: Encoding, format: PrivateFormat, encryption_algorithm: KeySerializationEncryption
45     ) -> bytes: ...
46     @abstractmethod
47     def private_numbers(self) -> DHPrivateNumbers: ...
48
49 class DHPrivateNumbers(object):
50     @property
51     def public_numbers(self) -> DHPublicNumbers: ...
52     @property
53     def x(self) -> int: ...
54     def __init__(self, x: int, public_numbers: DHPublicNumbers) -> None: ...
55     def private_key(self, backend: DHBackend | None = ...) -> DHPrivateKey: ...
56
57 class DHPublicKey(metaclass=ABCMeta):
58     @property
59     @abstractmethod
60     def key_size(self) -> int: ...
61     @abstractmethod
62     def parameters(self) -> DHParameters: ...
63     @abstractmethod
64     def public_bytes(self, encoding: Encoding, format: PublicFormat) -> bytes: ...
65     @abstractmethod
66     def public_numbers(self) -> DHPublicNumbers: ...
67
68 DHPublicKeyWithSerialization = DHPublicKey
69
70 class DHPublicNumbers(object):
71     @property
72     def parameter_numbers(self) -> DHParameterNumbers: ...
73     @property
74     def y(self) -> int: ...
75     def __init__(self, y: int, parameter_numbers: DHParameterNumbers) -> None: ...
76     def public_key(self, backend: DHBackend | None = ...) -> DHPublicKey: ...
77
78 def generate_parameters(generator: int, key_size: int, backend: DHBackend | None = ...) -> DHParameters: ...