from typing import Optional, Tuple
from .consts import KEMId
from .kem_key import KEMKeyPair
from .kem_key_interface import KEMKeyInterface
[docs]
class KEMInterface(object):
"""
The KEM (Key Encapsulation Mechanism) interface.
"""
@property
def id(self) -> KEMId:
"""
The KEM identifier.
"""
raise NotImplementedError()
[docs]
def deserialize_private_key(self, key: bytes) -> KEMKeyInterface:
raise NotImplementedError()
[docs]
def deserialize_public_key(self, key: bytes) -> KEMKeyInterface:
raise NotImplementedError()
[docs]
def encap(
self, pkr: KEMKeyInterface, sks: Optional[KEMKeyInterface] = None, eks: Optional[KEMKeyPair] = None
) -> Tuple[bytes, bytes]:
raise NotImplementedError()
[docs]
def decap(self, enc: bytes, skr: KEMKeyInterface, pks: Optional[KEMKeyInterface] = None) -> bytes:
raise NotImplementedError()
[docs]
def derive_key_pair(self, ikm: bytes) -> KEMKeyPair:
raise NotImplementedError()