Hi all,

I've been trying to test my working code for the corner case when data arrives 
which is smaller than the key size, and I am having problems. I must be making 
a simple mistake, but would like some help please.

My test code simply takes an encrypted buffer and sends it piece by piece to 
DecryptUpdate() and follows it with a DecryptFinal() which gives the error 
wrong file block length. I dump each piece and my code does seem to send every 
bit of data. So for AES 128 ECB....

Encrypt the word "Hello", which produce cipher text of 16 byte. I hex dump it 
as:
10 30 6e 74 fe ed 8e 42 54 38 84 21 d1 3d 2d 14

Next I send it piece by piece to DecryptUpdate(). (two pieces, 8 bytes each). 
For this mode no data is returned:
10 30 6e 74 fe ed 8e 42
and
54 38 84 21 d1 3d 2d 14

As you can see the hex value of the pieces matches that of the cipher text.
With no more data to set, I call DecryptFinal() and get:
error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block 
length

I know this is some stupid error, but please help me out of my misery
Thanks
LJB

Reply via email to