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

13 statements  

« prev     ^ index     » next       coverage.py v7.0.1, created at 2022-12-25 06:11 +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 

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 @abc.abstractproperty 

15 def name(self) -> str: 

16 """ 

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

18 """ 

19 

20 @abc.abstractproperty 

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

22 """ 

23 Valid key sizes for this algorithm in bits 

24 """ 

25 

26 @abc.abstractproperty 

27 def key_size(self) -> int: 

28 """ 

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

30 """ 

31 

32 

33class BlockCipherAlgorithm(metaclass=abc.ABCMeta): 

34 key: bytes 

35 

36 @abc.abstractproperty 

37 def block_size(self) -> int: 

38 """ 

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

40 """