[Cryptography Team] FW: isProperlyPadded

Ron Teitelbaum Ron at USMedRec.com
Fri Jul 7 03:15:31 UTC 2006


Chris,

Ok so I'm thinking about this some more and wondering if the last byte is 1
wouldn’t this method automatically chop the last byte off?  Or if the last 2
bytes are 2 it would chop those off too.  Isn't there a better way to
determine if the byte array was padded?  Maybe a subclass with an isPadded
would make more sense?

What do you think?

Ron


From: Ron Teitelbaum
Sent: Thursday, July 06, 2006 11:11 PM

Hit send by accident before I finishing editing!

To make it more clear if a byte array is not padded then the unpaddedSize is
self size.

What do you think?

Ron Teitelbaum

________________________________________
From: Ron Teitelbaum [mailto:Ron at USMedRec.com] 
Sent: Thursday, July 06, 2006 11:08 PM
To: 'Cryptography Team Development List'
Subject: isProperlyPadded

Chris,

I ran into your padding methods which put the remainder size in each empty
space after the real data.

I have a problem with 

ByteArray>>unpaddedSize
            "If I was padded by a BlockCipher, answer the size of the
original plaintext."
            self isProperlyPadded ifFalse: [ CryptographyError signal:
'Authentication failure (improperly padded!)' ].
            ^ self size - self last

Since isProperlyPadded assumes that that was some padding the error seems
unnecessary.

Shouldn’t this say: 

ByteArray>>unpaddedSize
            "If I was padded by a BlockCipher, answer the size of the
original plaintext."
            self isProperlyPadded ifFalse: [^self size].
            ^ self size - self last





More information about the Cryptography mailing list