[Botan-devel] Botan: Decoding error: AES/CBC/PKCS7.

Joel Low joel at joelsplace.sg
Sat Jan 1 17:28:02 EST 2011


Hey William,

 

A few points to note:

.         std::istringstream may not construct the object using ios::binary,
hence "line ending" conversions may take place, resulting in corruption of
the ciphertext

.         In place of std::istringstream, you may like to use
Botan::SecureVector instead, however I can't remember offhand if there's an
overload of operator>> for (Botan::SecureVector&, Botan::pipe&) or its
parent classes.

 

Hope that helps; I've not written stuff using Botan in a while but these
things which came to mind. Let us know if we can help in any other way.

 

Regards,

Joel

 

From: botan-devel-bounces at randombit.net
[mailto:botan-devel-bounces at randombit.net] On Behalf Of William Foster
Sent: Sunday, 2 January, 2011 4:03 AM
To: Botan development list
Subject: [Botan-devel] Botan: Decoding error: AES/CBC/PKCS7.

 

Hello,

I am getting a failure occasionally with my application that uses Botan and
am not sure what is going wrong.  My code into Botan looks like this at the
point of failure:

void
myClass::decrypt(Botan::Pipe *pipe)
{
  char *data = getDataAsString();
  size_t size = getDataSz();
  std::string strData(data, size);
  std::istringstream streamData(strData);

  pipe->start_msg();
  streamData >> *pipe;
  pipe->end_msg();
}

The failue I get is with this stack:

#0  0x0076afe1 in __cxa_throw () from /usr/lib/libstdc++.so.6
#1  0x083a7d54 in Botan::CBC_Decryption::end_msg() ()
#2  0x08304821 in Botan::Filter::finish_msg() ()
#3  0x08288a80 in Botan::Pipe::end_msg() ()
#4  0x081361dd in myClass::decrypt (this=0xe268608, pipe=0x12a1d460)

The exception is thrown from these lines in end_msg():

void CBC_Decryption::end_msg()
   {
   if(position != BLOCK_SIZE)
      throw Decoding_Error(name());
    ...
  }

And position == 0.

I am using Botan v1.8.11

My application is multi-threaded and this failure occurs about one in three
runs.

Is this more likely a bug in my application or is it possibly a bug in
Botan?  It it is likely in mine, how might I go about figuring out what has
gone wrong?

Thanks.

-William

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.randombit.net/pipermail/botan-devel/attachments/20110102/fdfeda3b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4997 bytes
Desc: not available
URL: <http://lists.randombit.net/pipermail/botan-devel/attachments/20110102/fdfeda3b/attachment.bin>


More information about the botan-devel mailing list