teintinu / dyuproject

Automatically exported from code.google.com/p/dyuproject
Apache License 2.0
1 stars 0 forks source link

Cookie Based User Management Causes Input Block Size Exception #20

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Specified CookieBasedManager for the user manager in the properties and 
configured other cookie params.
2. Save a user who's encrypted value is not divisible by 4.
3. Try to reload that user.

What is the expected output? What do you see instead?
I would expect it to reload the user.  Instead I see an exception:

java.lang.IllegalArgumentException: Input block size is not 4
        at com.dyuproject.util.B64Code.decode(B64Code.java:243)
        at com.dyuproject.util.Cryptography.decryptDecode(Cryptography.java:269)
        at com.dyuproject.util.Cryptography.decryptDecode(Cryptography.java:260)
        at com.dyuproject.openid.manager.CookieBasedUserManager.getUserByDecryption(CookieBasedUserManager.java:231)
        at com.dyuproject.openid.manager.CookieBasedUserManager.getUser(CookieBasedUserManager.java:197)
        at com.dyuproject.openid.manager.CookieBasedUserManager.getUser(CookieBasedUserManager.java:190)
        at com.dyuproject.openid.RelyingParty.discover(RelyingParty.java:535)

What version of the product are you using? On what operating system?
Version 1.1.7 for all the modules on Windows XP (SP3) in Firefox 3.6

Please provide any additional information below.

The problem is: the padding character is an equal sign ('=').  When this cookie 
value gets loaded from the browser, the '=' signs are dropped.  I suspect 
simply URL encoding/decoding the cookie value will solve this.

Original issue reported on code.google.com by jpeter...@gmail.com on 30 Jun 2010 at 4:20

GoogleCodeExporter commented 9 years ago
See http://groups.google.com/group/dyuproject/t/8af792095a974138

Quoting the value solves this problem. (checkout the 1.1 branch to try it out)

Original comment by david.yu...@gmail.com on 30 Jun 2010 at 4:36