Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/cryptography/hazmat/primitives/kdf/__init__.py: 100%
7 statements
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-08 07:26 +0000
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-08 07:26 +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
10class KeyDerivationFunction(metaclass=abc.ABCMeta):
11 @abc.abstractmethod
12 def derive(self, key_material: bytes) -> bytes:
13 """
14 Deterministically generates and returns a new key based on the existing
15 key material.
16 """
18 @abc.abstractmethod
19 def verify(self, key_material: bytes, expected_key: bytes) -> None:
20 """
21 Checks whether the key generated by the key material matches the
22 expected derived key. Raises an exception if they do not match.
23 """