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

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

17 statements  

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 

5from __future__ import annotations 

6 

7import abc 

8 

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

10# ciphers module. 

11 

12 

13class CipherAlgorithm(metaclass=abc.ABCMeta): 

14 @property 

15 @abc.abstractmethod 

16 def name(self) -> str: 

17 """ 

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

19 """ 

20 

21 @property 

22 @abc.abstractmethod 

23 def key_sizes(self) -> frozenset[int]: 

24 """ 

25 Valid key sizes for this algorithm in bits 

26 """ 

27 

28 @property 

29 @abc.abstractmethod 

30 def key_size(self) -> int: 

31 """ 

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

33 """ 

34 

35 

36class BlockCipherAlgorithm(CipherAlgorithm): 

37 key: bytes 

38 

39 @property 

40 @abc.abstractmethod 

41 def block_size(self) -> int: 

42 """ 

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

44 """