SlowAES cannot decrypt properly without original size?

That is because apparently SlowAES doesn't implement the commonly used padding schemes, like PKCS: Issue 4: Implement PKCS7 padding Even if the library doesn't implement it, it's really trivial for you do implement it: once you get the decrypted (padded) text, just analyze the last block and deduct the original length from the padding info. The PKCS7 padding is described in RFC2315 if I'm not mistaken.

That is because apparently SlowAES doesn't implement the commonly used padding schemes, like PKCS: Issue 4: Implement PKCS7 padding. Even if the library doesn't implement it, it's really trivial for you do implement it: once you get the decrypted (padded) text, just analyze the last block and deduct the original length from the padding info. The PKCS7 padding is described in RFC2315 if I'm not mistaken.

Updated If text is padded with PKCS7 the very last byte in the decrypted text will contain the length of the padding. So you decrypt and then remove as many characters from the end of the decrypted text as the value on the last byte. Eg.

The original text is 'This is the original text'. It has length 25. The encryption will padd the length to 32 (next block of 16 size), so it will encrypt the block 'This is the original text\07\07\07\07\07\07\07'.

The padded block gets encrypted into 32 length crypt text you decrypt the 32 length crypt and get back the padded text from 2) last byte of the decrypted block is '\07', so you substract 7 bytes from the decrypted block. The result is the original text, of length 25: 'This is the original text' PS: I would add the JavaScript code, but my JavaScript coding skill is rather rusty.

RFC2315 section 10.3, note #2 for the padding. – GregS Feb 19 '10 at 23:07 Thanks for the quick response Remus and Greg. The problem is some of this is definitely over my head.

I don't know how to analyze the last block. Any tips or help on how to figure this out would be great. And thanks again!

– user277397 Feb 19 '10 at 23:20.

One thing you can do is pad your data to round out to a complete 128-bit block size. That way you don't have to worry about PKCS#7 padding, because you just did it yourself. Hardly optimal, but at least you're up and running :).

Thanks Michael for the input. I'm not sure how to always make sure my original, unencrypted text, always rounds out to be a complete 128-bit block. Like I said I'm new to this cryptology stuff and a lot of it is over my head.

Thanks again for your advice. – user277397 Feb 22 '10 at 16:29.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions