Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/cryptography/hazmat/primitives/_cipheralgorithm.py: 100%

17 statements  

« prev     ^ index     » next       coverage.py v7.2.2, created at 2023-03-26 06:36 +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. 

4 

5import abc 

6import typing 

7 

8# This exists to break an import cycle. It is normally accessible from the 

9# ciphers module. 

10 

11 

12class CipherAlgorithm(metaclass=abc.ABCMeta): 

13 @property 

14 @abc.abstractmethod 

15 def name(self) -> str: 

16 """ 

17 A string naming this mode (e.g. "AES", "Camellia"). 

18 """ 

19 

20 @property 

21 @abc.abstractmethod 

22 def key_sizes(self) -> typing.FrozenSet[int]: 

23 """ 

24 Valid key sizes for this algorithm in bits 

25 """ 

26 

27 @property 

28 @abc.abstractmethod 

29 def key_size(self) -> int: 

30 """ 

31 The size of the key being used as an integer in bits (e.g. 128, 256). 

32 """ 

33 

34 

35class BlockCipherAlgorithm(CipherAlgorithm): 

36 key: bytes 

37 

38 @property 

39 @abc.abstractmethod 

40 def block_size(self) -> int: 

41 """ 

42 The size of a block as an integer in bits (e.g. 64, 128). 

43 """