What is necessary to have an applet call a native method? DLL installation, code signing, specific security permissions needed, etc.

Raiser Raiser

After more tries I solved the problem. I used your posted response about such a thing for Netscape. But was dificult to use that answer because Netscape and Explorer security mechanisms differ so much.
First of all you must make your applet without native methods because your dll cannot be found when the applet is instatiated. Then you make a wrapper class with this native function in it. Then you must sign your Java code, to be trusted. This mean you must sign your ALL your java code: Applet and Wrapper (this was the major difference between Netscape and Explorer).

1. Your applet must define the correct permission to run (I used SYSTEM that means all permission - you must have powerful right to run native code). The classes from Microsoft for security (Wich exist in classpath for any - I suppose - windows system with explorer) must be imported:

import com.ms.security.*;
and some code in init() function :
try {
	if (Class.forName("com.ms.security.PolicyEngine") != null)
}catch (Throwable e) {
	// Probably this is not IE

2. Then you must copy from the server your dll (I used the copyURL example which I found here and which works very fine :), thanks for that). You must have the permission to write on client (I have already all permissions):

3.Than you load into memory the downloaded dll (you could make a test to see if the dll already was installed/copied) :

4.After that you can instantiate the native method and use it.
NativeClass n=new NativeClass();

5.To sign my code I used the tools from "MS SDK for Java 40". I made the signed cab archive with my applet and my native class in it with the following script:
jvc /d . NativeClassApplet.java NativeClass.java

cabarc -p n NativeClassApplet.cab NativeClassApplet.class NativeClass.class

setreg 1 true

makecert -sk raiser -n "CN=raiser" raiser.cer

cert2spc raiser.cer raiser.spc

signcode -j javasign.dll -jp LOWX -spc raiser.spc -k raiser NativeClassApplet.cab

6. I run this applet with this html
	My Applet With Native Methods
 	<applet code=NativeClassApplet width=100 height=50>
		<param name="cabbase" value="NativeClassApplet.cab">