To preserve the key, the iv, and the mode of operation and to reset all buffers and so on. doFinal() call is that correct? But doFinal () will do the extra work. And I do not need previous data.
Cipher с=Cipher.getInstance("AES/CBC/PKCS7Padding");
с.init(Cipher.DECRYPT_MODE, key, iv);
....
void Decode(Cipher c)
{
c.doFinal();//reset cipher !?
//Start a new decoding session
....
}
You call Cipher.init(), of course.
You just need to rearrange your API so that the correct parameters are provided to your methods so they can call init().
You will probably need a new initialization vector for each separate encrypt/decrypt anyway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With