diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-06-22 12:06:18 -0600 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-06-22 12:06:18 -0600 |
commit | 0739afcc629dafd53668babb3cda629c7143981d (patch) | |
tree | 1512a0c04cd15e2a655b4698d50d3b1f9d7eb34d | |
parent | 940cb23c601bc4f49312fa75b48e881d1af3c0c9 (diff) | |
download | cryptography-0739afcc629dafd53668babb3cda629c7143981d.tar.gz cryptography-0739afcc629dafd53668babb3cda629c7143981d.tar.bz2 cryptography-0739afcc629dafd53668babb3cda629c7143981d.zip |
add new DSABackend interface methods for loading numbers
-rw-r--r-- | cryptography/hazmat/backends/interfaces.py | 18 | ||||
-rw-r--r-- | docs/hazmat/backends/interfaces.rst | 34 |
2 files changed, 52 insertions, 0 deletions
diff --git a/cryptography/hazmat/backends/interfaces.py b/cryptography/hazmat/backends/interfaces.py index 524e0a5b..e4faf32c 100644 --- a/cryptography/hazmat/backends/interfaces.py +++ b/cryptography/hazmat/backends/interfaces.py @@ -196,6 +196,24 @@ class DSABackend(object): Return True if the parameters are supported by the backend for DSA. """ + @abc.abstractmethod + def load_dsa_private_numbers(self, numbers): + """ + Returns a DSAPrivateKey provider. + """ + + @abc.abstractmethod + def load_dsa_public_numbers(self, numbers): + """ + Returns a DSAPublicKey provider. + """ + + @abc.abstractmethod + def load_dsa_parameter_numbers(self, numbers): + """ + Returns a DSAParameters provider. + """ + @six.add_metaclass(abc.ABCMeta) class TraditionalOpenSSLSerializationBackend(object): diff --git a/docs/hazmat/backends/interfaces.rst b/docs/hazmat/backends/interfaces.rst index 9e476f72..5cbd47d1 100644 --- a/docs/hazmat/backends/interfaces.rst +++ b/docs/hazmat/backends/interfaces.rst @@ -470,6 +470,40 @@ A specific ``backend`` may provide one or more of these interfaces. :returns: ``True`` if the given values of ``p``, ``q``, and ``g`` are supported by this backend, otherwise ``False``. + .. method:: load_dsa_parameter_numbers(numbers): + + :param numbers: An instance of + :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAParameterNumbers`. + + :returns: A provider of + :class:`~cryptography.hazmat.primitives.interfaces.DSAParameters`. + + :raises cryptography.exceptions.UnsupportedAlgorithm: This raised when + any backend specific criteria are not met. + + .. method:: load_dsa_private_numbers(numbers): + + :param numbers: An instance of + :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateNumbers`. + + :returns: A provider of + :class:`~cryptography.hazmat.primitives.interfaces.DSAPrivateKey`. + + :raises cryptography.exceptions.UnsupportedAlgorithm: This raised when + any backend specific criteria are not met. + + .. method:: load_dsa_public_numbers(numbers): + + :param numbers: An instance of + :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicNumbers`. + + :returns: A provider of + :class:`~cryptography.hazmat.primitives.interfaces.DSAPublicKey`. + + :raises cryptography.exceptions.UnsupportedAlgorithm: This raised when + any backend specific criteria are not met. + + .. class:: CMACBackend |