javasecuritynetscape

How can I "migrate to the Java 2 security model instead"?


I use a JAVA applet which upload files from the browser with drag and drop. I know that is a signed Applet. Yesterday I uploaded some files, but today I give an error in the console:

Netscape security model is no longer supported. 
Please migrate to the Java 2 security model instead

I never upgrade JRE an I'm almost sure that the java version was always 1.6.0_22.
Is it possible ?

I'm not a Java programmer but I must edit the code to let the applet work. This applet simply access to the filesystem to create a folder, resize some image in that folder and upload the resized images and communicate with JS to send some messages to the web page.

I've found only this code related to security:

import netscape.security.PrivilegeManager;
import java.text.DateFormat;
import java.security.AccessController;
import java.security.PrivilegedExceptionAction;
import java.security.PrivilegedActionException;

public void init() {
    try {
        netscape.security.PrivilegeManager.enablePrivilege("UniversalJavaPermissions");
        ...
    } catch (JSException e1) {
        ...
    }
}

And I found in a readme file how to sign the compiled applet:

keytool -export -alias signFiles -file myCert.crt -storepass mypass
javac -cp C:\Programmi\Java\jdk1.6.0_18\jre\lib\plugin.jar; .\MyApplet.java -Xlint:unchecked
jar -cvf MyApplet.jar test
jarsigner MyApplet.jar signFiles

Can you give some feedback to resources that can help me to understand how to migrate to "Java 2 security model" ?

Is there a simple method to avoid this error without edit and recompile the source code (for example to force the old security model) ?

Any idea that can help me to approach the problem is really appreciated


Solution

  • netscape.security.PrivilegeManager.enablePrivilege("UniversalJavaPermissions");

    Just remove that and follow the instructions for signing the applet.