mirror of
https://github.com/morgan9e/noiseprotocol
synced 2026-04-14 00:14:05 +09:00
* Created NoiseBackend class serving as a base for backends
* Refactored NoiseProtocol name parsing
* Refactored existing spec-defined functions into abstract classes.
Implementing classes are connecting crypto primitives to expected
interfaces.
* Refactored existing usage of Cryptography as source of crypto into
"default" backend (along with in-house implementation of X448).
* Provisioned "experimental" backend, it will contain e.g. non-default
crypto algorithms
* Backend can be chosen while creating NoiseConnection, though by
default, the Cryptography backend ("default") is used
Closes #7
19 lines
468 B
Python
19 lines
468 B
Python
import abc
|
|
|
|
|
|
class KeyPair(metaclass=abc.ABCMeta):
|
|
def __init__(self, private=None, public=None, public_bytes=None):
|
|
self.private = private
|
|
self.public = public
|
|
self.public_bytes = public_bytes
|
|
|
|
@classmethod
|
|
@abc.abstractmethod
|
|
def from_private_bytes(cls, private_bytes):
|
|
raise NotImplementedError
|
|
|
|
@classmethod
|
|
@abc.abstractmethod
|
|
def from_public_bytes(cls, public_bytes):
|
|
raise NotImplementedError
|