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

6 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 

5 

6import abc 

7 

8 

9class KeyDerivationFunction(metaclass=abc.ABCMeta): 

10 @abc.abstractmethod 

11 def derive(self, key_material: bytes) -> bytes: 

12 """ 

13 Deterministically generates and returns a new key based on the existing 

14 key material. 

15 """ 

16 

17 @abc.abstractmethod 

18 def verify(self, key_material: bytes, expected_key: bytes) -> None: 

19 """ 

20 Checks whether the key generated by the key material matches the 

21 expected derived key. Raises an exception if they do not match. 

22 """