From c81217024fe2dcd0ea4eba696229ec029cd533e3 Mon Sep 17 00:00:00 2001 From: Ayrx Date: Tue, 15 Apr 2014 19:02:05 +0800 Subject: Added CMAC interface documentation --- docs/hazmat/primitives/interfaces.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'docs/hazmat') diff --git a/docs/hazmat/primitives/interfaces.rst b/docs/hazmat/primitives/interfaces.rst index 9a1f3307..a0468aa3 100644 --- a/docs/hazmat/primitives/interfaces.rst +++ b/docs/hazmat/primitives/interfaces.rst @@ -446,6 +446,28 @@ Key derivation functions something like checking whether a user's password attempt matches the stored derived key. + +CMAC +~~~~ + +.. class:: CMACContext + + .. versionadded:: 0.4 + + .. method:: update(data) + + :param data bytes: The data you want to authenticate. + + .. method:: finalize() + + :return: The final message authentication code. + + .. method:: copy() + + :return: A :class:`~cryptography.hazmat.primitives.interfaces.CMACContext` + that is a copy of the current context. + + .. _`RSA`: https://en.wikipedia.org/wiki/RSA_(cryptosystem) .. _`Chinese remainder theorem`: https://en.wikipedia.org/wiki/Chinese_remainder_theorem .. _`DSA`: https://en.wikipedia.org/wiki/Digital_Signature_Algorithm -- cgit v1.2.3 From 97a72fd82819ab9d276c9a6e07c54446ebc2c591 Mon Sep 17 00:00:00 2001 From: Ayrx Date: Tue, 15 Apr 2014 19:02:51 +0800 Subject: Added CMAC backend interface documentation --- docs/hazmat/backends/interfaces.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'docs/hazmat') diff --git a/docs/hazmat/backends/interfaces.rst b/docs/hazmat/backends/interfaces.rst index 9c401d28..546aa766 100644 --- a/docs/hazmat/backends/interfaces.rst +++ b/docs/hazmat/backends/interfaces.rst @@ -319,3 +319,27 @@ A specific ``backend`` may provide one or more of these interfaces. :raises ValueError: This is raised if the key size is not (1024 or 2048 or 3072) or if the OpenSSL version is older than 1.0.0 and the key size is larger than 1024 because older OpenSSL versions don't support a key size larger than 1024. + + +.. class:: CMACBackend + + .. versionadded:: 0.4 + + A backend with methods for using CMAC + + .. method:: cmac_supported() + + :return: True if CMAC is supported by the backend. False if otherwise. + + .. 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` -- cgit v1.2.3 From 7964c173818f7f510cc148e510c02b457a9cc094 Mon Sep 17 00:00:00 2001 From: Ayrx Date: Tue, 15 Apr 2014 21:50:58 +0800 Subject: Fixed nitpicks --- docs/hazmat/primitives/interfaces.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/hazmat') diff --git a/docs/hazmat/primitives/interfaces.rst b/docs/hazmat/primitives/interfaces.rst index a0468aa3..9743278c 100644 --- a/docs/hazmat/primitives/interfaces.rst +++ b/docs/hazmat/primitives/interfaces.rst @@ -460,7 +460,7 @@ CMAC .. method:: finalize() - :return: The final message authentication code. + :return: The message authentication code. .. method:: copy() -- cgit v1.2.3 From 83cd3f894353c5f9e6393972319e7c20c0981a9c Mon Sep 17 00:00:00 2001 From: Ayrx Date: Tue, 15 Apr 2014 21:56:32 +0800 Subject: Added link to wikipedia for CMAC --- docs/hazmat/primitives/interfaces.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'docs/hazmat') diff --git a/docs/hazmat/primitives/interfaces.rst b/docs/hazmat/primitives/interfaces.rst index 9743278c..ce8b7c70 100644 --- a/docs/hazmat/primitives/interfaces.rst +++ b/docs/hazmat/primitives/interfaces.rst @@ -447,8 +447,8 @@ Key derivation functions stored derived key. -CMAC -~~~~ +`CMAC`_ +~~~~~~~ .. class:: CMACContext @@ -471,3 +471,4 @@ CMAC .. _`RSA`: https://en.wikipedia.org/wiki/RSA_(cryptosystem) .. _`Chinese remainder theorem`: https://en.wikipedia.org/wiki/Chinese_remainder_theorem .. _`DSA`: https://en.wikipedia.org/wiki/Digital_Signature_Algorithm +.. _`CMAC`: https://en.wikipedia.org/wiki/CMAC -- cgit v1.2.3