cipher.setAutoPadding([autoPadding])
-
autoPadding
<boolean> 默认值:true
¥
autoPadding
<boolean> Default:true
-
返回:<Cipher> 用于方法链。
¥Returns: <Cipher> for method chaining.
当使用块加密算法时,Cipher
类会自动向输入数据添加填充到适当的块大小。要禁用默认填充调用 cipher.setAutoPadding(false)
。
¥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)
.
当 autoPadding
为 false
时,整个输入数据的长度必须是密码块大小的倍数,否则 cipher.final()
将抛出错误。禁用自动填充对于非标准填充很有用,例如使用 0x0
而不是 PKCS 填充。
¥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.
cipher.setAutoPadding()
方法必须在 cipher.final()
之前调用。
¥The cipher.setAutoPadding()
method must be called before
cipher.final()
.