Skip to main content

Base64

7 replies [Last post]
Anonymous

I have been testing with the Base64 from Stefan Haustein, it works on the
phone but I need to match the encoding on ASP.NET to make it work. I tried
using the native decode but it didn't work. Has anyone created a ASP.Net
version that matches the J2ME version?

Thanks

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Chris Rotberg

I downloaded Bouncy Castle and thought I was using it correctly but it is
not returning a valid string it only returns [B@fc0ece7d

byte[] img = null;
img = getCameraRecord(imgName); //this is a good jpg
System.out.println(img.length); //87453
byte[] img0 = org.bouncycastle.util.encoders.UrlBase64.encode(img);
System.out.println(img0.length); //116604
sb.append(img0.toString()); //[B@fc0ece7d
img0 = null;

I copied the package for the encoders, is there something else I need to do?

Thanks

-----Original Message-----
From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Joe Bowbeer
Sent: Tuesday, March 13, 2007 1:24 AM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Base64

On 3/12/07, Chris Rotberg wrote:
> I looked at it, which jar has the Base64 encode?
>

org.bouncycastle.util.encoders.Base64
from cldc_crypto.zip
from http://bouncycastle.org/download/lcrypto-j2me-135.zip

> -----Original Message-----
>
> On 3/11/07, Chris Rotberg wrote:
> >
> > I have been testing with the Base64 from Stefan Haustein, it works
> > on the phone but I need to match the encoding on ASP.NET to make it
work.
> > I tried using the native decode but it didn't work. Has anyone
> > created a ASP.Net version that matches the J2ME version?
> >
>
> Both implementations are available from http://bouncycastle.org/
>

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Joe Bowbeer

It looks like img0.toString() generated something of the form
array-of-byte@address.

To actually decode the byte array, try something like:

new String(img0)

(Strictly speaking you should also provide a character encoding arg,
like "US-ASCII" or "UTF-8", though the default encoding whatever it is
will surely handle base64 encoding.)

On 3/13/07, Chris Rotberg wrote:
> I downloaded Bouncy Castle and thought I was using it correctly but it is
> not returning a valid string it only returns [B@fc0ece7d
>
>
> byte[] img = null;
> img = getCameraRecord(imgName); //this is a good jpg
> System.out.println(img.length); //87453
> byte[] img0 = org.bouncycastle.util.encoders.UrlBase64.encode(img);
> System.out.println(img0.length); //116604
> sb.append(img0.toString()); //[B@fc0ece7d
> img0 = null;
>
> I copied the package for the encoders, is there something else I need to do?
>
> Thanks
>
> -----Original Message-----
> From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
> On Behalf Of Joe Bowbeer
> Sent: Tuesday, March 13, 2007 1:24 AM
> To: KVM-INTEREST@JAVA.SUN.COM
> Subject: Re: Base64
>
> On 3/12/07, Chris Rotberg wrote:
> > I looked at it, which jar has the Base64 encode?
> >
>
> org.bouncycastle.util.encoders.Base64
> from cldc_crypto.zip
> from http://bouncycastle.org/download/lcrypto-j2me-135.zip
>
>
> > -----Original Message-----
> >
> > On 3/11/07, Chris Rotberg wrote:
> > >
> > > I have been testing with the Base64 from Stefan Haustein, it works
> > > on the phone but I need to match the encoding on ASP.NET to make it
> work.
> > > I tried using the native decode but it didn't work. Has anyone
> > > created a ASP.Net version that matches the J2ME version?
> > >
> >
> > Both implementations are available from http://bouncycastle.org/
> >
>

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Chris Rotberg

That seemed to work, now I have to decode it on the server, they don't have
a UrlBase64 C# class so I am going to have to test the regular decode

Thanks

-----Original Message-----
From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Joe Bowbeer
Sent: Tuesday, March 13, 2007 11:26 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Bouncy Castle Error

It looks like img0.toString() generated something of the form
array-of-byte@address.

To actually decode the byte array, try something like:

new String(img0)

(Strictly speaking you should also provide a character encoding arg, like
"US-ASCII" or "UTF-8", though the default encoding whatever it is will
surely handle base64 encoding.)

On 3/13/07, Chris Rotberg wrote:
> I downloaded Bouncy Castle and thought I was using it correctly but it
> is not returning a valid string it only returns [B@fc0ece7d
>
>
> byte[] img = null;
> img = getCameraRecord(imgName); //this is a good jpg
> System.out.println(img.length); //87453 byte[] img0 =
> org.bouncycastle.util.encoders.UrlBase64.encode(img);
> System.out.println(img0.length); //116604
> sb.append(img0.toString()); //[B@fc0ece7d
> img0 = null;
>
> I copied the package for the encoders, is there something else I need to
do?
>
> Thanks
>
> -----Original Message-----
> From: A mailing list for KVM discussion
> [mailto:KVM-INTEREST@JAVA.SUN.COM]
> On Behalf Of Joe Bowbeer
> Sent: Tuesday, March 13, 2007 1:24 AM
> To: KVM-INTEREST@JAVA.SUN.COM
> Subject: Re: Base64
>
> On 3/12/07, Chris Rotberg wrote:
> > I looked at it, which jar has the Base64 encode?
> >
>
> org.bouncycastle.util.encoders.Base64
> from cldc_crypto.zip
> from http://bouncycastle.org/download/lcrypto-j2me-135.zip
>
>
> > -----Original Message-----
> >
> > On 3/11/07, Chris Rotberg wrote:
> > >
> > > I have been testing with the Base64 from Stefan Haustein, it works
> > > on the phone but I need to match the encoding on ASP.NET to make
> > > it
> work.
> > > I tried using the native decode but it didn't work. Has anyone
> > > created a ASP.Net version that matches the J2ME version?
> > >
> >
> > Both implementations are available from http://bouncycastle.org/
> >
>

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Joe Bowbeer

On 3/11/07, Chris Rotberg wrote:
>
> I have been testing with the Base64 from Stefan Haustein, it works on the
> phone but I need to match the encoding on ASP.NET to make it work. I tried
> using the native decode but it didn't work. Has anyone created a ASP.Net
> version that matches the J2ME version?
>

Both implementations are available from http://bouncycastle.org/

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Chris Rotberg

I looked at it, which jar has the Base64 encode?

-----Original Message-----
From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Joe Bowbeer
Sent: Sunday, March 11, 2007 11:58 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Base64

On 3/11/07, Chris Rotberg wrote:
>
> I have been testing with the Base64 from Stefan Haustein, it works on
> the phone but I need to match the encoding on ASP.NET to make it work.
> I tried using the native decode but it didn't work. Has anyone created
> a ASP.Net version that matches the J2ME version?
>

Both implementations are available from http://bouncycastle.org/

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Joe Bowbeer

On 3/12/07, Chris Rotberg wrote:
> I looked at it, which jar has the Base64 encode?
>

org.bouncycastle.util.encoders.Base64
from cldc_crypto.zip
from http://bouncycastle.org/download/lcrypto-j2me-135.zip

> -----Original Message-----
>
> On 3/11/07, Chris Rotberg wrote:
> >
> > I have been testing with the Base64 from Stefan Haustein, it works on
> > the phone but I need to match the encoding on ASP.NET to make it work.
> > I tried using the native decode but it didn't work. Has anyone created
> > a ASP.Net version that matches the J2ME version?
> >
>
> Both implementations are available from http://bouncycastle.org/
>

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Chris Rotberg

Thanks I assume that I convert the OutputStream to a StringBuffer or String
for Posting to ASP.Net and then use the C# class to decode? Has anyone
created a VB.Net version of the class?

Thanks

-----Original Message-----
From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM]
On Behalf Of Joe Bowbeer
Sent: Tuesday, March 13, 2007 1:24 AM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Re: Base64

On 3/12/07, Chris Rotberg wrote:
> I looked at it, which jar has the Base64 encode?
>

org.bouncycastle.util.encoders.Base64
from cldc_crypto.zip
from http://bouncycastle.org/download/lcrypto-j2me-135.zip

> -----Original Message-----
>
> On 3/11/07, Chris Rotberg wrote:
> >
> > I have been testing with the Base64 from Stefan Haustein, it works
> > on the phone but I need to match the encoding on ASP.NET to make it
work.
> > I tried using the native decode but it didn't work. Has anyone
> > created a ASP.Net version that matches the J2ME version?
> >
>
> Both implementations are available from http://bouncycastle.org/
>

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".