Security - Signed JAR/Applet

Hello,

1. I have created a keystore and certificate using keytool (JDK1.3.1_02)

2. Signed our jar using jarsigner 鈥搆eystore.

3. When I try to run this from the browser it gives

java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader)

at java.security.AccessControlContext.checkPermission(Unknown Source)

at java.security.AccessController.checkPermission(Unknown Source)

at java.lang.SecurityManager.checkPermission(Unknown Source)

at java.lang.SecurityManager.checkCreateClassLoader(Unknown Source)

at java.lang.ClassLoader.<init>(Unknown Source)

at java.security.SecureClassLoader.<init>(Unknown Source)

at com.jarsafe.x.<init>(Unknown Source)

at com.jarsafe.Main.init(Unknown Source)

at sun.applet.AppletPanel.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

FYI, One more thing, my jar is protected by JARSAFE and jarsafe loads my jar. For this, Jarsafe has to create a new classloader and using that it will run my jar in the browser. When it tries to create a new class loader it gives this exception.

When I try to run using a policy file with all security permission, at the client system, it works fine. Why is it not working with the selfsigned JAR file. Why that selfsigned jar does not have permission to create the class loader? I want to use only this selfsigned jar.

Our jar should have permission to create a classloader and since our jar is signed using the self-signed certificate, it supposed to work after signing using this keystore. I don鈥檛 know why it is not working.

Can any one help me out?

Thanks

[1716 byte] By [rsheelaa] at [2007-9-19]
# 1
Which browser do you use?1) If IE then do you have to use the OBJECT tag and not APPLET tag.2) then you should check which permisions have you allowed in your signing of JAR file. Some permision is missing;)
Lumira at 2007-7-8 > top of java,Security,Signed Applets...
# 2

Hi Lumir,

1. I have been using Object/Embed tag only.

2. Here i am having problem in finding the permissions which i have given to my jar. How do i specify what are the permissions i have to give to that jar and where i have to specify.

Please update me on this. It would be really great help.

Thanks.

rsheelaa at 2007-7-8 > top of java,Security,Signed Applets...
# 3
For Netscape You should use PrivilegeManager.I found a response in this Forum:"Have restrictions but, any way to conditionally LoadClasses?"Check it. I think it is the same problem.
Lumira at 2007-7-8 > top of java,Security,Signed Applets...
# 4

There are two sets of steps to be taken to make this work

1) Steps for signer

--> Use keytool to generate a key pair

--> Use jar signer to sign the jar withe generated key

--> export the signature from the keystore to a certificate

2) Steps for reciever

--> import the certificate to the clients keystore file

--> add the permissions for this certificate using policy tool

I believe you are missing one of the steps from set2

Please inform if this resolves your problem or if you disagree

vanangrania at 2007-7-8 > top of java,Security,Signed Applets...
# 5

There is another option for the receiver. Use the working version of JavaPlugin (say 1.3.1). With this version you will not need to use policy or import custom certificate, but will get a dialog box with a warning.

From other hand I see no points to use JarSafe for applets. It doesn't add any security.

euxxa at 2007-7-8 > top of java,Security,Signed Applets...
# 6

i dont want to do any work at the client system as my clients are in different geographical location. I know this and i worked fine by importing into client system. I want a solution which does not require any policy file modification at client location and it should work like a certificate issued by a CA.

rsheelaa at 2007-7-8 > top of java,Security,Signed Applets...
# 7

I would suggest to choose JavaPlugin based solution. At least it can be installed even from the web page, which is possible to configure in the JavaPlugin tag.

Following list is decribing existing issues with the JavaPlugin and applets signed by the jarsigner (thanks to Michel Gallant for the exellent work):

Plugin 1.21, 1.22, 1.3.0 : Fails if self signed certificate or root CA certificate is not in MS cryptoAPI database; OK otherwise

Plugin 1.3.0_01, 1.3.0_02: Fails if self signed certificate or root CA certificate is not in J2RE cacerts file; OK otherwise

Plugin 1.3.1, 1.4.0b: Warns if self signed certificate or root CA certificate is not in J2RE cacerts file; OK otherwise

So, I strongly suggest to configure JavaPlugin to use JRE 1.3.1 or 1.4 if you going to use self signed code, or you can live with JRE 1.2.1 if you've got commecial certificate from well known CA (i.e. Thawte or Verisign).

euxxa at 2007-7-8 > top of java,Security,Signed Applets...
# 8
Thanks euxx, Actually i was using JRE 1.3.0 and now i tried our jar on 1.3.1_02, its working fine.
rsheelaa at 2007-7-8 > top of java,Security,Signed Applets...