Cipher Output Considerations
Some of the update
and doFinal
methods
of Cipher allow the caller to specify the output buffer into which
to encrypt or decrypt the data. In these cases, it is important to
pass a buffer that is large enough to hold the result of the encryption
or decryption operation.
The following method in Cipher can be used to determine how big the output buffer should be:
public int outOutputSize(int inputLen)