[Botan-devel] Computing total length for enc / dec
lloyd at randombit.net
Mon Jun 28 08:54:21 EDT 2010
On Mon, Jun 28, 2010 at 12:12:19AM -0400, Barath wrote:
> Is there a good way of having Botan calculate this total length
> value for me in advance of giving it the data? I'd rather not
> buffer all the data I'm encrypting just so I can determine how long
> it's going to be. I know I can calculate it manually (by adding the
> length of the file to the tag length), but it seems brittle to do it
> that way, especially if the underlying implementation changes or if
> I want to switch to a different mode / cipher.
There isn't. It's an interesting concept, being able to ask a filter
what it will do given a certain input length, though I'm not sure how
that would interact with things like compression filters since their
results are actually data dependent.
So I think you are stuck with manually computing the length. EAX
itself is not going to change; it's externally specified. My only
suggestion here would perhaps be to verify at the end that you
actually read out exactly as many bytes as you had previously
expected, which would catch any discrepency quickly.
More information about the botan-devel