[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bouncycastle-crypto-dev
Subject:    Re: [dev-crypto] Bug in Base64?
From:       David Hook <dgh () lockboxlabs ! com>
Date:       2008-06-20 11:00:32
Message-ID: 1213959632.3644.65.camel () echidna
[Download RAW message or body]


The initial string is not a valid base64 encoding - if you check the
length you'll see what the problem is.

Regards,

David

On Fri, 2008-06-20 at 12:30 +0200, Maria Arias de Reyna wrote:
> Hi people,
> 
> I am using the Base64 class to encode and decode a String. I am working on 
> J2ME.
> 
> Here is the code I'm using:
> 
>             String s = 
> "L2VtcHJlc2FzL25hdHVycGVrYS9kbXMva3R3ZWJkYXYva3R3ZWJkYXYucGhwL1ByaW1lciBkb2N1//2//bWVudG8ucGRmLw==";
>             byte[] b = Base64.decode(s);
>             
>             OutputStream out = new ByteArrayOutputStream();
>             Base64.encode(b, out);
> 
>             s = out.toString();
> 
> The last s is not equal as the first s because of the last characters: 
> "L2VtcHJlc2FzL25hdHVycGVrYS9kbXMva3R3ZWJkYXYva3R3ZWJkYXYucGhwL1ByaW1lciBkb2N1//2//bWVudG8ucGRmLwALw=="
> 
> Is it just me or is the Base64 acting strangely? I am using Netbeans with java 
> 1.5.
> 
> Regards,


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic