I found that with invalid keys, the cbc_decrypt can panic. After some research, I think it is better to return an error gracefully than doing the panic.
So the changes are:
cbc_decrypt now returns Result<>.
An error type CipherError is added. It is minimum and includes a context list that acts like a backtrace.
A new test case is added for "invalid keys" and the new error type.
WARN: API change involved.
I found that with invalid keys, the
cbc_decrypt
can panic. After some research, I think it is better to return an error gracefully than doing the panic.So the changes are:
cbc_decrypt
now returnsResult<>
.CipherError
is added. It is minimum and includes a context list that acts like a backtrace.