Signing applets/jars

some people say you have to sign the applet, some people say you have to sign the jars… (the smack jars?) I keep getting this socket-permission error… I have visited page that has been mentioned in this forum, http://java.sun.com/docs/books/tutorial/jar/sign/signing.html… it says you have to do this command: jarsigner jar-file alias… it says

“alias is the alias identifying the private key that’‘s to be used to sign the JAR file, and the key’'s associated certificate.”

“the private key”??? what is the “private key”? and do I establish an alias?

it also says

“This basic form of the command assumes that the keystore to be used is in a file named .keystore in your home directory.”

there no “.keystore” file in my computer… do I create this file? how? what do I put in it? (searched for “keystore” in my C-drive… tons of “.key” files… (and nothing on “security” or “keys” in windows HELP section…)

(nothing about “.keystore” or “jarsigner” in smack documentation either…)

I have never signed an applet (or jars) and need some help here… thank you…

ok, a developer here signed jars, but applet still won’'t connect to server… get exact same error (java.net.SocketPermission…)

this is unbelievable… have no problem at all connecting to server with a jsp… (but HAVE to do an applet…)

thank you…

applets are inside a sandbox you can’'t access your computer resources which means applets are limited. But there is a workaround to it but you must sign the jar file of your applets and let the user decide whether to allow the applet or not.

Here must you do, you must add this code and anything that you don’'t have permission to can now be use inside the Object run() method;

AccessController.doPrivileged(new PrivilegedAction() {

public Object run() {

try {

System.out.print(“Start XMPP…”);

con = new XMPPConnection (“anywhere.com”);

}

catch (Exception ex) {

System.err.println(ex.toString());

}

return null;

}

});[/code]

Message was edited by:

blats002

Message was edited by:

blats002

This is ant(1.6.2) script.


build.properties

==================================

#public info

  1. jar file

module = test

JAVA_HOME = C:
j2sdk1.4.2_04

keystore = Linac.store

alias = Linac

  1. keystore

storepass = password

keypass = password

cer.file = Linac.cer

  1. dname info

  2. dname {CN=1, OU=1, O=1, L=1, ST=1, C=1}

dname.CN = name

dname.OU = organizationUnitName

dname.O = organizationName

dname.L = DL

dname.ST = LN

dname.C = CN

  1. about keytool

keytool = keytool.exe

  1. about jarsigner
    keytool.home = $/bin jarsigner = jarsigner.exe
    jarsigner.home = $/bin

build.xml

================================



















Can you use it?

Linac.Zhang@gmail.com