[Botan-devel] Using ECB mode gets bad initialization vector size
William K. Foster
wkf at alum.mit.edu
Sun Jul 11 14:59:55 EDT 2010
I have an app up using Botan successfully for cipher specs like AES-128/CTR,
however, if I try AES-128/ECB, I get an exception thrown that says:
Botan: IV length 16 is invalid for AES-128/ECB.
Here is code snippet in question:
const unsigned int keyLength(Botan::max_keylength_of(algorithm));
const unsigned int blockSize(Botan::block_size_of(algorithm)); // Value
Botan::SymmetricKey masterKey(rng, keyLength);
Botan::InitializationVector iv(rng, blockSize);
Botan::Pipe pipe(Botan::get_cipher(spec, masterKey, iv,
Apparently, the code is expecting a blockSize of zero, but if I hard wire it
to zero, it appears my data gets corrupted.
Please suggest what I might be doing wrong here.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the botan-devel