Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/cryptography/hazmat/primitives/_cipheralgorithm.py: 100%
18 statements
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-08 06:05 +0000
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-08 06:05 +0000
1# This file is dual licensed under the terms of the Apache License, Version
2# 2.0, and the BSD License. See the LICENSE file in the root of this repository
3# for complete details.
5from __future__ import annotations
7import abc
8import typing
10# This exists to break an import cycle. It is normally accessible from the
11# ciphers module.
14class CipherAlgorithm(metaclass=abc.ABCMeta):
15 @property
16 @abc.abstractmethod
17 def name(self) -> str:
18 """
19 A string naming this mode (e.g. "AES", "Camellia").
20 """
22 @property
23 @abc.abstractmethod
24 def key_sizes(self) -> typing.FrozenSet[int]:
25 """
26 Valid key sizes for this algorithm in bits
27 """
29 @property
30 @abc.abstractmethod
31 def key_size(self) -> int:
32 """
33 The size of the key being used as an integer in bits (e.g. 128, 256).
34 """
37class BlockCipherAlgorithm(CipherAlgorithm):
38 key: bytes
40 @property
41 @abc.abstractmethod
42 def block_size(self) -> int:
43 """
44 The size of a block as an integer in bits (e.g. 64, 128).
45 """