AES decrypted text mismatch

Stephen A. Cochran Lists stephen.a.cochran.lists at cahir.net
Wed Oct 11 15:42:11 CEST 2006


On Oct 11, 2006, at 5:21 AM, Werner Koch wrote:

> With only the changes above you won't be able to get that output.
> Thus you changed more and introduced a bug.

I added two printf statements that highlighted the change:

printf("plaintext len: %u\n", strlen(plaintext));
printf("Decrypted text len: %u\n", strlen(decryptedtext));

I highly doubt that they are the problem. But to rule out any other  
change I had made, I even tested the original code and only modified  
the plaintext and TEXTLEN lines:

     const int TEXTLEN = 12;
     unsigned char* plaintext = "123456789012";

Again, the same output:

angus at dev:~/aes_test>./aes
Initializing... Version: 1.2.0
Generating symmetric key (128 bit)...
Key is: 25 86 9D 2F 2D F7 23 43 1A 8A 7B B2 E6 32 95 D9
Opening AES cipher...
Setting the key...
Setting the initialization vector 1234567812345678...
Encrypting plaintext: 123456789012...
Resulting ciphertext (hex): 28 B1 A8 BC D8 BF 4C 21 76 D3 37 A
Resetting initialization vector...
Decrypting...
Decrypted text: 123456789012?

Steve




More information about the Gcrypt-devel mailing list