FW: isProperlyPadded

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

FW: isProperlyPadded

Ron Teitelbaum

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:[hidden email]]
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

 

 


_______________________________________________
Cryptography mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/cryptography
Reply | Threaded
Open this post in threaded view
|

RE: FW: isProperlyPadded

Ron Teitelbaum
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:[hidden email]]
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



_______________________________________________
Cryptography mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/cryptography