[Botan-devel] AES, CBC with ISO10126 padding handling

Daniel Tallentire daniel at parker-software.com
Sat Dec 6 06:49:24 EST 2008


I need to decrypt data coming in AES, in CBC mode with ISO10126 padding (last byte = padding size, padding = random bytes)

I have written a small class to handle this incoming padding (I don't need to generate the padding, only to handle it - the current PKCS7 would be fine if it didn't check that the remaining bytes were set to the same digit), and I can easily recompile Botan with this modification in place - however,  I was wondering if it is possible to add a padding method without compiling Botan?  The existing library for Ubuntu etc work straight away for me, and this is the only change I need to make.

I've tried separately calling the cbc constructors - but the public library ones only accept string inputs which need the algorithms in place - a call to the CBC_Decryption(BlockCipher*, BlockCipherModePaddingMethod*) constructor would seem to be the way to go, but this can't be called.

I've tried inheriting from the CBC_Decryption class, but all the padding members etc are private.  - Am I missing some way of adding this in, or of easily getting the other related filters chained together?

If it isn't possible to do it without compiling botan, what is the best place to override?  

get_bc_pad in algolist.cpp would seem to be the most sensible, just adding the line
HANDLE_TYPE_NO_ARGS("ISO10126", ISO10126_Padding);  

would do the trick?



More information about the botan-devel mailing list