1 from abc import ABCMeta, abstractmethod
3 from cryptography.hazmat.primitives.ciphers import CipherAlgorithm
5 class Mode(metaclass=ABCMeta):
8 def name(self) -> str: ...
10 def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None: ...
12 class ModeWithAuthenticationTag(metaclass=ABCMeta):
15 def tag(self) -> bytes: ...
17 class ModeWithInitializationVector(metaclass=ABCMeta):
20 def initialization_vector(self) -> bytes: ...
22 class ModeWithNonce(metaclass=ABCMeta):
25 def nonce(self) -> bytes: ...
27 class ModeWithTweak(metaclass=ABCMeta):
30 def tweak(self) -> bytes: ...
32 class CBC(Mode, ModeWithInitializationVector):
33 def __init__(self, initialization_vector: bytes) -> None: ...
35 def initialization_vector(self) -> bytes: ...
37 def name(self) -> str: ...
38 def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None: ...
40 class CTR(Mode, ModeWithNonce):
41 def __init__(self, nonce: bytes) -> None: ...
43 def name(self) -> str: ...
45 def nonce(self) -> bytes: ...
46 def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None: ...
48 class CFB(Mode, ModeWithInitializationVector):
49 def __init__(self, initialization_vector: bytes) -> None: ...
51 def initialization_vector(self) -> bytes: ...
53 def name(self) -> str: ...
54 def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None: ...
56 class CFB8(Mode, ModeWithInitializationVector):
57 def __init__(self, initialization_vector: bytes) -> None: ...
59 def initialization_vector(self) -> bytes: ...
61 def name(self) -> str: ...
62 def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None: ...
66 def name(self) -> str: ...
67 def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None: ...
69 class GCM(Mode, ModeWithInitializationVector, ModeWithAuthenticationTag):
70 def __init__(self, initialization_vector: bytes, tag: bytes | None = ..., min_tag_length: int | None = ...) -> None: ...
72 def initialization_vector(self) -> bytes: ...
74 def name(self) -> str: ...
76 def tag(self) -> bytes: ...
77 def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None: ...
79 class OFB(Mode, ModeWithInitializationVector):
80 def __init__(self, initialization_vector: bytes) -> None: ...
82 def initialization_vector(self) -> bytes: ...
84 def name(self) -> str: ...
85 def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None: ...
87 class XTS(Mode, ModeWithTweak):
88 def __init__(self, tweak: bytes) -> None: ...
90 def name(self) -> str: ...
92 def tweak(self) -> bytes: ...
93 def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None: ...