I am doing AES CBC decryption in java using javax.crypto . I am using the following Cipher class methods:
public final void init (int opmode, Key key, AlgorithmParameters params)
method for initialization,final int update(byte[] input, int inputOffset, int inputLen, byte[] output)
method for decrypting the data,- and finally I call the
final int doFinal(byte[] output, int outputOffset)
method to finish the decryption.
My query is this: Can I assume that the size of the data returned to me by the doFinal
call would always be less than or equal to the AES Block Size? The documentation describes the doFinal method as:
“Finishes a multi-part transformation (encryption or decryption). Processes any bytes that may have been buffered in previous update calls. The final transformed bytes are stored in the output buffer.”
But it nowhere says that the output buffer would contain at most one block of data. Though I understand that this is the general behaviour of AES APIs, and this is the behaviour my code has exhibited till now, but would this assumption always hold?