PyTomCrypt
PyTomCrypt copied to clipboard
Unhelpful error messages
From @parke:
I switched from ctr mode to cbc mode, and got this error:
tomcrypt.LibError: Invalid argument provided.
I guess CBC mode needs the input to be a multiple of the block size. A more descriptive error message would have been helpful.
A quicker (interim?) fix would be to document which ciphers require block length inputs.
That is something that can be easily done.
In general, I would like to rework the error handling. Specifically, I think I would like to build a new exception tree, instead of just having Error
and LibError
.
At the most extreme, we would have an exception for each of the 2 dozen(ish) errors that the libtomcrypt gives us, and they would also inherit from the standard exceptions (usually ValueError
or RuntimeError
) as appropriate.
For reference, the modes which require a block sized input are: ecb
, cbc
, and lrw
.