I am implementing a provider for AES for the Cipher
class of the JCA (Java Cryptography Architecture).
The class Cipher adopts the init()
, update()
, doFinal()
paradigm. The init()
method is called to initialize the cipher. The method update()
is used to provide input data that must be encrypted or decrypted. The method doFinal()
finalizes the encryption or decryption process by handling things such as padding.
My question is: according to the JCA specifications, does the update()
method have to return partially encrypted or decrypted data? Is it valid not to return data when the method update()
is called and process all the data when the the method doFinal()
is called? I am asking because the implementation of my provider would be much more efficient if I can process all the data at once in the doFinal()
method, instead of process them partially with the update()
method.