[botan-devel] AES Decryption

Игорь Купрейчик genrich.rus at bk.ru
Sun Dec 14 15:57:13 EST 2014


 Hello.

I have a problem with AES-128/CBC decrypting. Here's the situation:

I need to decrypt the construction of:

(1) previously encrypted message
+
(2) neither encrypted nor decrypted message

The (1) alone decrypts perfectly as it should be. But when i add (2), program crashes. What can be the problem?

Here's the code for encrypting the first part:
Pipe pipe2(get_cipher("AES-128/CBC", botanKey, botanIV, ENCRYPTION));
pipe2.process_msg(contToEnc,lSize);
SecureVector <Botan::byte> part1 = pipe2.read_all(0);
unsigned char toResult[1000000];
long j;
for (j=0;j<part1.size();j++)
{
	toResult[j]=part1[j];
}
If i then try to
Pipe pipe3(get_cipher("AES-128/CBC", botanKey, botanIV, DECRYPTION));
pipe3.process_msg(toResult,part1.size()); everything is OK. But when i do this:
for (int i=0;i<16;i++)
{
	toResult[j+i]=part2[i];
}
Pipe pipe3(get_cipher("AES-128/CBC", botanKey, botanIV, DECRYPTION));
pipe3.process_msg(toResult,part1.size()+16);
crash happens. 

Please, tell, what could be a possible reason for this.

Thanks in advance,
Igor.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.randombit.net/pipermail/botan-devel/attachments/20141214/e2727a01/attachment.html>


More information about the botan-devel mailing list