aboutsummaryrefslogtreecommitdiffstats
path: root/src/cryptography/hazmat/backends/interfaces.py
diff options
context:
space:
mode:
authorAlex Stapleton <alexs@prol.etari.at>2014-08-25 10:57:42 +0100
committerAlex Stapleton <alexs@prol.etari.at>2015-04-25 18:17:24 +0100
commitb7c6029766ed066a2616343d82027472881ab0a3 (patch)
tree6bc51c6503bb6284bd65308ea1721b879a3cd947 /src/cryptography/hazmat/backends/interfaces.py
parent7921375c6a8f1d3bd32ecd4c0ba9be0682c5a57a (diff)
downloadcryptography-b7c6029766ed066a2616343d82027472881ab0a3.tar.gz
cryptography-b7c6029766ed066a2616343d82027472881ab0a3.tar.bz2
cryptography-b7c6029766ed066a2616343d82027472881ab0a3.zip
DH backend interfaces
Diffstat (limited to 'src/cryptography/hazmat/backends/interfaces.py')
-rw-r--r--src/cryptography/hazmat/backends/interfaces.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/cryptography/hazmat/backends/interfaces.py b/src/cryptography/hazmat/backends/interfaces.py
index 5224f5c7..eca7ddf4 100644
--- a/src/cryptography/hazmat/backends/interfaces.py
+++ b/src/cryptography/hazmat/backends/interfaces.py
@@ -273,3 +273,55 @@ class X509Backend(object):
"""
Load an X.509 CSR from PEM encoded data.
"""
+
+
+@six.add_metaclass(abc.ABCMeta)
+class DHBackend(object):
+ @abc.abstractmethod
+ def generate_dh_parameters(self, key_size):
+ """
+ Generate a DHParameters instance with a modulus of key_size bits.
+ """
+
+ @abc.abstractmethod
+ def generate_dh_private_key(self, parameters):
+ """
+ Generate a DHPrivateKey instance with parameters as a DHParameters
+ object.
+ """
+
+ @abc.abstractmethod
+ def generate_dh_private_key_and_parameters(self, key_size):
+ """
+ Generate a DHPrivateKey instance using key size only.
+ """
+
+ @abc.abstractmethod
+ def load_dh_private_numbers(self, numbers):
+ """
+ Returns a DHPrivateKey provider.
+ """
+
+ @abc.abstractmethod
+ def load_dh_public_numbers(self, numbers):
+ """
+ Returns a DHPublicKey provider.
+ """
+
+ @abc.abstractmethod
+ def load_dh_parameter_numbers(self, numbers):
+ """
+ Returns a DHParameters provider.
+ """
+
+ @abc.abstractmethod
+ def dh_exchange_algorithm_supported(self, exchange_algorithm):
+ """
+ Returns whether the exchange algorithm is supported by this backend.
+ """
+
+ @abc.abstractmethod
+ def dh_parameters_supported(self, p, g):
+ """
+ Returns whether the backend supports DH with these parameter values.
+ """