From b2d5efdc5a6e7f6df635b4bc60882bb2e5f14a66 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Tue, 29 Oct 2013 11:15:30 -0700 Subject: More docs --- docs/hazmat/primitives/padding.rst | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'docs/hazmat/primitives/padding.rst') diff --git a/docs/hazmat/primitives/padding.rst b/docs/hazmat/primitives/padding.rst index 995ed9f3..ebcc6104 100644 --- a/docs/hazmat/primitives/padding.rst +++ b/docs/hazmat/primitives/padding.rst @@ -8,6 +8,7 @@ Padding ======= +.. currentmodule:: cryptography.hazmat.primitives.padding Padding is a way to take data that may or may not be be a multiple of the block size for a cipher and extend it out so that it is. This is required for many @@ -15,7 +16,7 @@ block cipher modes as they require the data to be encrypted to be an exact multiple of the block size. -.. class:: cryptography.primitives.padding.PKCS7(block_size) +.. class:: PKCS7(block_size) PKCS7 padding is a generalization of PKCS5 padding (also known as standard padding). PKCS7 padding works by appending ``N`` bytes with the value of @@ -42,3 +43,35 @@ multiple of the block size. :param data: The data that should be unpadded. :rtype bytes: The unpadded data. + + .. method:: padder() + + :returns: A padding + :class:`~cryptography.hazmat.primitives.interfaces.PaddingContext` + provider. + + .. method:: unpadder() + + :returns: An unpadding + :class:`~cryptography.hazmat.primitives.interfaces.PaddingContext` + provider. + + +.. currentmodule:: cryptography.hazmat.primitives.interfaces + +.. class:: PaddingContext + + When calling ``padder()`` or ``unpadder()`` you will receive an a return + object conforming to the ``PaddingContext`` interface. You can then call + ``update(data)`` with data until you have fed everything into the context. + Once that is done call ``finalize()`` to finish the operation and obtain + the remainder of the data. + + .. method:: update(data) + + :param bytes data: The data you wish to pass into the context. + :return bytes: Returns the data that was padded or unpadded. + + .. method:: finalize() + + :return bytes: Returns the remainder of the data. -- cgit v1.2.3