From 653cfe872052b641bbfdf84a97b330a479a7b4fc Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sat, 24 Jun 2017 10:12:18 -1000 Subject: add missing methods to DH interfaces (#3719) --- src/cryptography/hazmat/primitives/asymmetric/dh.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/cryptography/hazmat/primitives/asymmetric/dh.py b/src/cryptography/hazmat/primitives/asymmetric/dh.py index d5e82606..fc1317f0 100644 --- a/src/cryptography/hazmat/primitives/asymmetric/dh.py +++ b/src/cryptography/hazmat/primitives/asymmetric/dh.py @@ -123,6 +123,12 @@ class DHParameters(object): Generates and returns a DHPrivateKey. """ + @abc.abstractmethod + def parameter_bytes(self, encoding, format): + """ + Returns the parameters serialized as bytes. + """ + @six.add_metaclass(abc.ABCMeta) class DHParametersWithSerialization(DHParameters): @@ -169,6 +175,12 @@ class DHPrivateKeyWithSerialization(DHPrivateKey): Returns a DHPrivateNumbers. """ + @abc.abstractmethod + def private_bytes(self, encoding, format, encryption_algorithm): + """ + Returns the key serialized as bytes. + """ + @six.add_metaclass(abc.ABCMeta) class DHPublicKey(object): @@ -192,3 +204,9 @@ class DHPublicKeyWithSerialization(DHPublicKey): """ Returns a DHPublicNumbers. """ + + @abc.abstractmethod + def public_bytes(self, encoding, format): + """ + Returns the key serialized as bytes. + """ -- cgit v1.2.3