Skip to main content

setAutoPadding

method Cipher.prototype.setAutoPadding
Jump to headingCipher.prototype.setAutoPadding(autoPadding?: boolean): this

When using block encryption algorithms, the Cipher class will automatically add padding to the input data to the appropriate block size. To disable the default padding call cipher.setAutoPadding(false).

When autoPadding is false, the length of the entire input data must be a multiple of the cipher's block size or cipher.final() will throw an error. Disabling automatic padding is useful for non-standard padding, for instance using 0x0 instead of PKCS padding.

The cipher.setAutoPadding() method must be called before cipher.final().

Parameters Jump to heading

optional
Jump to headingautoPadding: boolean = true

Return Type Jump to heading

this

for method chaining.

Back to top