We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › how to sign a web app (for beginners)
Page Index Toggle Pages: 1
how to sign a web app (for beginners) (Read 2998 times)
how to sign a web app (for beginners)
May 17th, 2008, 1:42am
 
If you are a beginner at Processing, Java and signing, this might help.

I was trying to have my web applet access online images (from flickr), and was puzzled by the fact the sketch was working as a standalone app, yet was giving me security errors in the Java console when run in a browser.  If you find yourself in the same situation, one of the reasons this happens is that your app needs to be 'signed'.

This worked for me, but as I'm a newbie at this, I'd gladly take advice and corrections on this workflow.

Here's how:


First, create a signing key.

Open a command prompt and use this command (substitute JRE version and path if necessary):

"C:\Program Files\Java\jre1.6.0_06\bin\keytool" -genkey -alias yourKeyName -validity 10000 -keypass yourKeyPassword -dname "cn=Your Name, ou=Your Organizational Unit, o=Your Company, c=US"

'validity' is the nr of days you want the key to remain valid

It will ask you a keystore password - say 'yourStorePassword'.

Then sign all your exported jar files using jarsigner.

I'm not sure all the .jar files need to be signed, but this worked for me.  jarsigner is included in the JDK, which can be found here for example:
https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-
/USD/ViewProductDetail-Start?ProductRef=jdk-6u6-oth-JPR@CDS-CDS_Developer

cd C:\yourPath\Processing\yourSketch\applet
"C:\Program Files\Java\jdk1.6.0_06\bin\jarsigner" -keypass yourKeyPassword -storepass yourStorePassword yourSketch.jar yourKeyName

Do this for all you .jar files in the applet dir, and your app should be able to run in a browser.


Here are some docs for keytool and jarsigner:

http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/keytool.html

http://java.sun.com/javase/6/docs/technotes/tools/windows/jarsigner.html

Re: how to sign a web app (for beginners)
Reply #1 - May 17th, 2008, 6:13pm
 
Thanks for posting, I encourage you to add this to the new "Hacks" section of the site.
Re: how to sign a web app (for beginners)
Reply #2 - Jan 28th, 2010, 7:36am
 
Hi,

First of all, thanks for the tutorial, really helpful. I'm having a weird problem, however, working with keytool in Windows 7. I try to run it, and all goes well, but as soon as it asks me to enter my keystore password, it blocks my attempts at writing anything in the command line. All I can do is hit Enter, which of course returns a "password too short" error...

Any ideas?
Re: how to sign a web app (for beginners)
Reply #3 - Feb 4th, 2010, 1:37am
 
Hi,

Thanks a lot for this post Tom K... I was looking for a solution to this problem for days now lol.

I think you have just saved me a lot more time and headaches Wink So thank again.

Mark
Re: how to sign a web app (for beginners)
Reply #4 - May 12th, 2010, 1:38am
 
I can't do this on Mac... there's another way?
Re: how to sign a web app (for beginners)
Reply #5 - May 12th, 2010, 4:49am
 
You can't do what?
Java is supposed to be portable.
Just replace the C:\Program Files\Java\jre1.6.0_06\bin\ part with the path to your JDK (might even be in Processing distribution although I haven't checked) as advised ("substitute JRE version and path if necessary").
Page Index Toggle Pages: 1