Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Documentation for crypto's setAutoPadding.

  • Loading branch information...
commit 8b7d80954b17217054d738a807b2c8cd55251557 1 parent b617ec8
@KiNgMaR KiNgMaR authored piscisaureus committed
Showing with 12 additions and 0 deletions.
  1. +12 −0 doc/api/crypto.markdown
View
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 `cipher.final`.
+
### 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
+`decipher.final` 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)
Please sign in to comment.
Something went wrong with that request. Please try again.