EllipticCurveBackend interfaces
diff --git a/cryptography/hazmat/backends/interfaces.py b/cryptography/hazmat/backends/interfaces.py
index 55d5cd7..ba02bbd 100644
--- a/cryptography/hazmat/backends/interfaces.py
+++ b/cryptography/hazmat/backends/interfaces.py
@@ -218,3 +218,39 @@
"""
Create a CMACContext for calculating a message authentication code.
"""
+
+
+@six.add_metaclass(abc.ABCMeta)
+class EllipticCurveBackend(object):
+ @abc.abstractmethod
+ def elliptic_curve_signature_algorithm_supported(
+ self, signature_algorithm, curve
+ ):
+ """
+ Returns True if the backend supports the named elliptic curve with the
+ specified signature algorithm.
+ """
+
+ @abc.abstractmethod
+ def elliptic_curve_supported(self, curve):
+ """
+ Returns True if the backend supports the named elliptic curve.
+ """
+
+ @abc.abstractmethod
+ def generate_elliptic_curve_private_key(self, curve):
+ """
+ Return an object conforming to the EllipticCurvePrivateKey interface.
+ """
+
+ @abc.abstractmethod
+ def elliptic_curve_public_key_from_numbers(self, numbers):
+ """
+ Return an EllipticCurvePublicKey provider using the given numbers.
+ """
+
+ @abc.abstractmethod
+ def elliptic_curve_private_key_from_numbers(self, numbers):
+ """
+ Return an EllipticCurvePublicKey provider using the given numbers.
+ """
diff --git a/docs/hazmat/backends/interfaces.rst b/docs/hazmat/backends/interfaces.rst
index 6f24f90..c1ce621 100644
--- a/docs/hazmat/backends/interfaces.rst
+++ b/docs/hazmat/backends/interfaces.rst
@@ -476,3 +476,54 @@
:raises cryptography.exceptions.UnsupportedAlgorithm: If the data is
encrypted with an unsupported algorithm.
+
+
+.. class:: EllipticCurveBackend
+
+ .. versionadded:: 0.5
+
+ .. method:: elliptic_curve_supported(curve)
+
+ :param curve: An instance of a
+ :class:`~cryptography.hazmat.primitives.interfaces.EllipticCurve`
+ provider.
+
+ :returns: True if the elliptic curve is supported by this backend.
+
+ .. method:: elliptic_curve_signature_algorithm_supported(signature_algorithm, curve)
+
+ :param signature_algorithm: An instance of a
+ :class:`~cryptography.hazmat.primitives.interfaces.EllipticCurveSignatureAlgorithm`
+ provider.
+
+ :param curve: An instance of a
+ :class:`~cryptography.hazmat.primitives.interfaces.EllipticCurve`
+ provider.
+
+ :returns: True if the signature algorithm and curve are supported by this backend.
+
+ .. method:: generate_elliptic_curve_private_key(curve)
+
+ :param curve: An instance of a
+ :class:`~cryptography.hazmat.primitives.interfaces.EllipticCurve`
+ provider.
+
+ .. method:: elliptic_curve_private_key_from_numbers(numbers)
+
+ :param numbers: An instance of a
+ :class:`~cryptography.hazmat.primitives.interfaces.EllipticCurvePrivateNumbers`
+ provider.
+
+ :returns: An instance of a
+ :class:`~cryptography.hazmat.primitives.interfaces.EllipticCurvePrivateKey`
+ provider.
+
+ .. method:: elliptic_curve_public_key_from_numbers(numbers)
+
+ :param numbers: An instance of a
+ :class:`~cryptography.hazmat.primitives.interfaces.EllipticCurvePublicNumbers`
+ provider.
+
+ :returns: An instance of a
+ :class:`~cryptography.hazmat.primitives.interfaces.EllipticCurvePublicKey`
+ provider.