commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julius Davies <juliusdav...@gmail.com>
Subject Re: [CODEC] Migrate issue from 1.3 to 1.4
Date Wed, 28 Oct 2009 06:10:53 GMT
I bet you it's a similar bug to this:

http://code.google.com/p/oauth-signpost/issues/detail?id=18

3. The python-oauth library (the reference implementation for OAuth)
barfs because the signature is "IYALjIZeGwFri8xtv4uIaDBO3Ow%3D%0D%0A"
which decodes to 'IYALjIZeGwFri8xtv4uIaDBO3Ow=\r\n'.



Some code I wrote tonight highlights the problem:  the static
Base64.encodeBase64() vs. the instance (new Base64().encode()) methods
are behaving differently in this regard.  Since the unit-tests mostly
focus on the static methods, we missed this variation.


import org.apache.commons.codec.binary.*;

public class B64 {

  public static void main(String[] args) throws Exception {
    Base64 b64 = new Base64();

    String s1 =
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
    String s2 = "aaaaaaaaaa";
    String s3 = "a";

    byte[] b1 = s1.getBytes("UTF-8");
    byte[] b2 = s2.getBytes("UTF-8");
    byte[] b3 = s3.getBytes("UTF-8");

    byte[] result;
    result = Base64.encodeBase64(b1);
    System.out.println("[" + new String(result, "UTF-8") + "]");
    result = b64.encode(b1);
    System.out.println("[" + new String(result, "UTF-8") + "]");

    result = Base64.encodeBase64(b2);
    System.out.println("[" + new String(result, "UTF-8") + "]");
    result = b64.encode(b2);
    System.out.println("[" + new String(result, "UTF-8") + "]");

    result = Base64.encodeBase64(b3);
    System.out.println("[" + new String(result, "UTF-8") + "]");
    result = b64.encode(b3);
    System.out.println("[" + new String(result, "UTF-8") + "]");

  }
}


Here's my output:


$ java -cp commons-codec-1.3.jar:. B64
[YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ==]
[YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ==]
[YWFhYWFhYWFhYQ==]
[YWFhYWFhYWFhYQ==]
[YQ==]
[YQ==]

$ java -cp commons-codec-1.4.jar:. B64
[YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ==]
[YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFh
YWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYQ==
]
[YWFhYWFhYWFhYQ==]
[YWFhYWFhYWFhYQ==
]
[YQ==]
[YQ==
]




yours,

Julius



On Mon, Oct 26, 2009 at 1:10 PM, Gary Gregory
<GGregory@seagullsoftware.com> wrote:
>
> Can you please be more specific? Can you supply a test case?
>
> Thank you,
> Gary
>
> > -----Original Message-----
> > From: Murat YĆ¼cel [mailto:kodeperkeren@gmail.com]
> > Sent: Monday, October 26, 2009 13:09
> > To: user
> > Subject: [CODEC] Migrate issue from 1.3 to 1.4
> >
> > Hi All
> >
> > We are currently using commons-codec in our project. We have used this
> > version for about one year.
> > This means that we have a lot of users in our database with encrypted
> > password. We have used the Base64
> > class to encode the passwords.
> > The problem is that after upgrading to 1.4 none of the users can
> > login, so we have made a rollback.
> >
> > Is this a known issue? I havent find anything on your website.
> >
> > Regards
> >
> > /Murat
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> > For additional commands, e-mail: user-help@commons.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>



--
yours,

Julius Davies
250-592-2284 (Home)
250-893-4579 (Mobile)
http://juliusdavies.ca/logging.html

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message