aboutsummaryrefslogtreecommitdiffstats
path: root/docs/hazmat/backends
diff options
context:
space:
mode:
authorAdam Goodman <akgood@duosecurity.com>2014-07-23 15:11:46 -0400
committerAdam Goodman <akgood@duosecurity.com>2014-07-23 15:11:46 -0400
commite97ae127f9fc44098f2461a567aa6b9a61e37f5c (patch)
tree671df50035c3daadb26ddb081e36493c610828e5 /docs/hazmat/backends
parentab3093ffe7dcc058cbd1b22ecb32b715ca47d6d2 (diff)
parentad116e26d102651ab6dc2752ae21afb92b72ad6f (diff)
downloadcryptography-e97ae127f9fc44098f2461a567aa6b9a61e37f5c.tar.gz
cryptography-e97ae127f9fc44098f2461a567aa6b9a61e37f5c.tar.bz2
cryptography-e97ae127f9fc44098f2461a567aa6b9a61e37f5c.zip
Merge branch 'master' into reorder_libs
Diffstat (limited to 'docs/hazmat/backends')
-rw-r--r--docs/hazmat/backends/interfaces.rst145
-rw-r--r--docs/hazmat/backends/multibackend.rst19
2 files changed, 90 insertions, 74 deletions
diff --git a/docs/hazmat/backends/interfaces.rst b/docs/hazmat/backends/interfaces.rst
index 86229125..63f84067 100644
--- a/docs/hazmat/backends/interfaces.rst
+++ b/docs/hazmat/backends/interfaces.rst
@@ -148,6 +148,33 @@ A specific ``backend`` may provide one or more of these interfaces.
:class:`~cryptography.hazmat.primitives.interfaces.HashContext`
+.. class:: CMACBackend
+
+ .. versionadded:: 0.4
+
+ A backend with methods for using CMAC
+
+ .. method:: cmac_algorithm_supported(algorithm)
+
+ :param algorithm: An instance of a
+ :class:`~cryptography.hazmat.primitives.interfaces.BlockCipherAlgorithm`
+ provider.
+ :return: Returns True if the block cipher is supported for CMAC by this backend
+
+ .. method:: create_cmac_ctx(algorithm)
+
+ Create a
+ :class:`~cryptography.hazmat.primitives.interfaces.CMACContext` that
+ uses the specified ``algorithm`` to calculate a message authentication code.
+
+ :param algorithm: An instance of a
+ :class:`~cryptography.hazmat.primitives.interfaces.BlockCipherAlgorithm`
+ provider.
+
+ :returns:
+ :class:`~cryptography.hazmat.primitives.interfaces.CMACContext`
+
+
.. class:: PBKDF2HMACBackend
.. versionadded:: 0.2
@@ -364,29 +391,6 @@ A specific ``backend`` may provide one or more of these interfaces.
any backend specific criteria are not met.
-.. class:: TraditionalOpenSSLSerializationBackend
-
- .. versionadded:: 0.3
-
- A backend with methods for working with OpenSSL's "traditional" PKCS #1
- style key serialization.
-
- .. method:: load_openssl_pem_private_key(data, password)
-
- :param bytes data: PEM data to deserialize.
-
- :param bytes password: The password to use if this data is encrypted.
- Should be None if the data is not encrypted.
-
- :return: A new instance of the appropriate private key or public key
- that the serialized data contains.
-
- :raises ValueError: If the data could not be deserialized correctly.
-
- :raises cryptography.exceptions.UnsupportedAlgorithm: If the data is
- encrypted with an unsupported algorithm.
-
-
.. class:: DSABackend
.. versionadded:: 0.4
@@ -524,56 +528,6 @@ A specific ``backend`` may provide one or more of these interfaces.
any backend specific criteria are not met.
-
-.. class:: CMACBackend
-
- .. versionadded:: 0.4
-
- A backend with methods for using CMAC
-
- .. method:: cmac_algorithm_supported(algorithm)
-
- :param algorithm: An instance of a
- :class:`~cryptography.hazmat.primitives.interfaces.BlockCipherAlgorithm`
- provider.
- :return: Returns True if the block cipher is supported for CMAC by this backend
-
- .. method:: create_cmac_ctx(algorithm)
-
- Create a
- :class:`~cryptography.hazmat.primitives.interfaces.CMACContext` that
- uses the specified ``algorithm`` to calculate a message authentication code.
-
- :param algorithm: An instance of a
- :class:`~cryptography.hazmat.primitives.interfaces.BlockCipherAlgorithm`
- provider.
-
- :returns:
- :class:`~cryptography.hazmat.primitives.interfaces.CMACContext`
-
-
-.. class:: PKCS8SerializationBackend
-
- .. versionadded:: 0.5
-
- A backend with methods for working with PKCS #8 key serialization.
-
- .. method:: load_pkcs8_pem_private_key(data, password)
-
- :param bytes data: PEM data to deserialize.
-
- :param bytes password: The password to use if this data is encrypted.
- Should be None if the data is not encrypted.
-
- :return: A new instance of the appropriate private key or public key
- that the serialized data contains.
-
- :raises ValueError: If the data could not be deserialized correctly.
-
- :raises cryptography.exceptions.UnsupportedAlgorithm: If the data is
- encrypted with an unsupported algorithm.
-
-
.. class:: EllipticCurveBackend
.. versionadded:: 0.5
@@ -623,3 +577,48 @@ A specific ``backend`` may provide one or more of these interfaces.
:returns: An instance of a
:class:`~cryptography.hazmat.primitives.interfaces.EllipticCurvePublicKey`
provider.
+
+.. class:: TraditionalOpenSSLSerializationBackend
+
+ .. versionadded:: 0.3
+
+ A backend with methods for working with OpenSSL's "traditional" PKCS #1
+ style key serialization.
+
+ .. method:: load_openssl_pem_private_key(data, password)
+
+ :param bytes data: PEM data to deserialize.
+
+ :param bytes password: The password to use if this data is encrypted.
+ Should be None if the data is not encrypted.
+
+ :return: A new instance of the appropriate private key or public key
+ that the serialized data contains.
+
+ :raises ValueError: If the data could not be deserialized correctly.
+
+ :raises cryptography.exceptions.UnsupportedAlgorithm: If the data is
+ encrypted with an unsupported algorithm.
+
+
+.. class:: PKCS8SerializationBackend
+
+ .. versionadded:: 0.5
+
+ A backend with methods for working with PKCS #8 key serialization.
+
+ .. method:: load_pkcs8_pem_private_key(data, password)
+
+ :param bytes data: PEM data to deserialize.
+
+ :param bytes password: The password to use if this data is encrypted.
+ Should be None if the data is not encrypted.
+
+ :return: A new instance of the appropriate private key or public key
+ that the serialized data contains.
+
+ :raises ValueError: If the data could not be deserialized correctly.
+
+ :raises cryptography.exceptions.UnsupportedAlgorithm: If the data is
+ encrypted with an unsupported algorithm.
+
diff --git a/docs/hazmat/backends/multibackend.rst b/docs/hazmat/backends/multibackend.rst
index 119b13ae..0aae04a7 100644
--- a/docs/hazmat/backends/multibackend.rst
+++ b/docs/hazmat/backends/multibackend.rst
@@ -12,7 +12,24 @@ MultiBackend
This class allows you to combine multiple backends into a single backend
that offers the combined features of all of its constituents.
- .. code-block:: pycon
+ .. testsetup::
+
+ from cryptography import utils
+ from cryptography.exceptions import UnsupportedAlgorithm, _Reasons
+ from cryptography.hazmat.backends.interfaces import HashBackend
+ from cryptography.hazmat.backends.openssl.backend import backend as backend2
+
+ @utils.register_interface(HashBackend)
+ class DummyHashBackend(object):
+ def hash_supported(self, algorithm):
+ return False
+
+ def create_hash_ctx(self, algorithm):
+ raise UnsupportedAlgorithm("", _Reasons.UNSUPPORTED_HASH)
+
+ backend1 = DummyHashBackend()
+
+ .. doctest::
>>> from cryptography.hazmat.backends.multibackend import MultiBackend
>>> from cryptography.hazmat.primitives import hashes