add mgf1_hash_supported to the RSABackend interface
diff --git a/cryptography/hazmat/backends/interfaces.py b/cryptography/hazmat/backends/interfaces.py
index da41532..27b609e 100644
--- a/cryptography/hazmat/backends/interfaces.py
+++ b/cryptography/hazmat/backends/interfaces.py
@@ -106,6 +106,12 @@
interface.
"""
+ @abc.abstractmethod
+ def mgf1_hash_supported(self, algorithm):
+ """
+ Return True if the hash algorithm is supported for MGF1 in PSS.
+ """
+
class OpenSSLSerializationBackend(six.with_metaclass(abc.ABCMeta)):
@abc.abstractmethod
diff --git a/docs/hazmat/backends/interfaces.rst b/docs/hazmat/backends/interfaces.rst
index a7a9661..c3ea164 100644
--- a/docs/hazmat/backends/interfaces.rst
+++ b/docs/hazmat/backends/interfaces.rst
@@ -249,6 +249,20 @@
:returns:
:class:`~cryptography.hazmat.primitives.interfaces.AsymmetricVerificationContext`
+ .. method:: mgf1_hash_supported(algorithm)
+
+ Check if the specified ``algorithm`` is supported for use with
+ :class:`~cryptography.hazmat.primitives.asymmetric.padding.MGF1`
+ inside :class:`~cryptography.hazmat.primitives.asymmetric.padding.PSS`
+ padding.
+
+ :param algorithm: An instance of a
+ :class:`~cryptography.hazmat.primitives.interfaces.HashAlgorithm`
+ provider.
+
+ :returns: ``True`` if the specified ``algorithm`` is supported by this
+ backend, otherwise ``False``.
+
.. class:: OpenSSLSerializationBackend