aboutsummaryrefslogtreecommitdiffstats
path: root/docs/hazmat/primitives/padding.rst
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-10-29 11:15:30 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2013-10-29 11:15:30 -0700
commitb2d5efdc5a6e7f6df635b4bc60882bb2e5f14a66 (patch)
tree948702df3d331208f9f553d15cb791fd74e003c2 /docs/hazmat/primitives/padding.rst
parentdb279d0e383173df65f83541daa4b8f58fc070f4 (diff)
downloadcryptography-b2d5efdc5a6e7f6df635b4bc60882bb2e5f14a66.tar.gz
cryptography-b2d5efdc5a6e7f6df635b4bc60882bb2e5f14a66.tar.bz2
cryptography-b2d5efdc5a6e7f6df635b4bc60882bb2e5f14a66.zip
More docs
Diffstat (limited to 'docs/hazmat/primitives/padding.rst')
-rw-r--r--docs/hazmat/primitives/padding.rst35
1 files changed, 34 insertions, 1 deletions
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.