Closed GoogleCodeExporter closed 9 years ago
I found the problem in padding function at calculating the number of bytes to
add:
var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
To correct the problem with unnecessary padding when data.sigBytes =
blockSizeBytes use this instead like in pad-zeropadding.js:
blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes);
The attached patch correct this in cipher-core.js. But the same problem exists
also in pad-ansix923.js and pad-iso10126.js.
Original comment by johannes...@gmail.com
on 27 May 2014 at 11:15
Attachments:
Most padding schemes -- including PKCS7, ANSI.X, and ISO -- require that at
least one bit or byte be added, always.
(http://en.wikipedia.org/wiki/Padding_(cryptography)#Byte_padding) This is so
that the message can later be un-padded correctly. Otherwise, it wouldn't
always be possible to distinguish between the padding and the message.
Original comment by Jeff.Mott.OR
on 27 May 2014 at 11:26
Thank you for the explanation!
Original comment by johannes...@gmail.com
on 28 May 2014 at 7:54
Original issue reported on code.google.com by
johannes...@gmail.com
on 27 May 2014 at 10:15