• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java in the sharp zaurus PDA

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I'm not sure if this is the right place to post this topic, but I'll try it anyway.
I've been developing some code in java to run my experiments with the Sharp Zaurus SL5600 PDA. Everything was working fine until the time I had to create chipers and perform encryption/decryption operations.
Currently, I'm using the Bouncy Castle and JCE APIs. The problem is that when I try to run my code in the zaurus vm, I get several errors.
This is a piece of code I think the errors are:

Socket connection = new Socket(host, port);
Security.addProvider(new com.sun.crypto.provider.SunJCE());
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
Date bg = new Date(); // Time before generating random number
SecureRandom random = new SecureRandom();
random.nextBytes(bytes);
Date ag = new Date(); // Time after generating random number
long tg = ag.getTime()-bg.getTime();
System.out.println("Time to generate rand num = " + tg + " ms");
// Imports EK
ObjectInputStream keyin = new ObjectInputStream(new FileInputStream(EK_path));
Key EK = (Key) keyin.readObject();
keyin.close();
// Encrypts random number with EK and sends it to the CA
Cipher cipher1 = Cipher.getInstance("AES", "BC");
Cipher cipher2 = Cipher.getInstance("AES", "BC");
cipher1.init(Cipher.ENCRYPT_MODE, EK);
cipher2.init(Cipher.DECRYPT_MODE, EK);
Date be = new Date(); // Time before encrypting/sending random number
byte[] result = cipher1.doFinal(bytes);
ObjectOutputStream out = new ObjectOutputStream(connection.getOutputStream());
out.write(result);
out.flush();
Date ae = new Date(); // Time after encrypting/sending random number
long te = ae.getTime()-be.getTime();
System.out.println("Time to encrypt/send rand num = " + te + " ms");

When I run this code, it does print out the part related to the random number, but it never gets to the second print, which is the time to encrypt.

The erros I get follow below:
Exception in threa "main", java.lang.NoClassDefFoundError: java/net/JarURLConnection
at javax.crypto.SunJCE_d.a (bytecode43)
at javax.crypto.SunJCE_b.i (bytecode12)
at javax.crypto.SunJCE_x.run
at java.security.AccessControler.doPrivileged
at javax.crypto.Cipher.a
at javax.crypto.Cipher.getinstance

In my executable script, class path, I have included the jce1_2_2.jar, the bcprov.jar, the sunjce.jar and some other related to security. In my opinion, I'm missing something in the script, maybe I should include something I'm not. The code works fine whem I ran it in my Mac. So, I think there is something missing in the PDA. Any ideas? Please help, I have searched in the web and had no luck.

Here's my executable script in the PDA:
. /home/QtPalmtop/bin/installdir.sh #set INSTALLDIR
$QPEDIR/bin/evm -XappName=runacp2 -cp $QPEDIR/extra_jar/local_policy.jar:$QPEDIR
/extra_jar/US_export_policy.jar:$QPEDIR/extra_jar/sunjce_provider.jar:$QPEDIR/ex
tra_jar/lcrypto-jdk13-130.zip:$QPEDIR/extra_jar/bcprov-jdk13-120.jar:$INSTALLDIR
/java rand_client

Thanks,
Alessandro.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What JVM does the Zaurus have? I know some JVM's don't have java.net.* because of memory constraints:
MIDP Network Programming using HTTP and the Connection framework
 
Alessandro Brawerman
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
it has the Jeode VM. I have executed code that connects using http and socket connections, I think the problem here is when I use the crypto files from the JCE jar (not sure).
 
Alessandro Brawerman
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It might be useful to mention also that this zaurus uses PersonalJava, not Personal Profile.
Thanks.
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It will probably help to locate the exact location of the error before we try to diagnose this further (especially since I'm unfamiliar with the packages involved). The stacktrace you posted looks incomplete since it only lists classes from the javax.crypto package but does not list any of the classes you have written yourself (unless you put them in the javax.crypto package???). Can you provide the rest of the stacktrace so we can track down where the error occurs?

Layne
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
These two lines right here:

says to me that that class is required by JCE but is not found in the JVM.
This page makes it sound like Jeode implements JDK 1.1.8, which would be a problem since JarURLConnection was introduced in JDK 1.2.
My advice is to check your documentation for that class or contact the VM vendor and check for JCE compatability.
 
Everybody's invited. Even this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic