Browse files

Documentation for crypto's setAutoPadding.

  • Loading branch information...
1 parent b617ec8 commit 8b7d80954b17217054d738a807b2c8cd55251557 @KiNgMaR KiNgMaR committed with piscisaureus Dec 2, 2011
Showing with 12 additions and 0 deletions.
  1. +12 −0 doc/api/crypto.markdown
12 doc/api/crypto.markdown
@@ -120,6 +120,12 @@ Returns any remaining enciphered contents, with `output_encoding` being one of:
Note: `cipher` object can not be used after `final()` method been called.
+### cipher.setAutoPadding(auto_padding=true)
+You can disable automatic padding of the input data to block size. If `auto_padding` is false,
+the length of the entire input data must be a multiple of the cipher's block size or `final` will fail.
+Useful for non-standard padding, e.g. using `0x0` instead of PKCS padding. You must call this before ``.
### crypto.createDecipher(algorithm, password)
@@ -147,6 +153,12 @@ Defaults to `'binary'`.
Note: `decipher` object can not be used after `final()` method been called.
+### decipher.setAutoPadding(auto_padding=true)
+You can disable auto padding if the data has been encrypted without standard block padding to prevent
+`` from checking and removing it. Can only work if the input data's length is a multiple of the
+ciphers block size. You must call this before streaming data to `decipher.update`.
### crypto.createSign(algorithm)

0 comments on commit 8b7d809

Please sign in to comment.