Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Self-signed applet and plug-in 1.3 step-by-step (works me !!!)

23 views
Skip to first unread message

X_Aki Nieminen_X

unread,
Jul 4, 2000, 3:00:00 AM7/4/00
to
I have struggled a self-signed applets for a long time and finally made it
work. I want to share my findings. Please, post here results you got AND
DESCRIBE client environment. I would like to know if this same method works
in WinNT/Win2000 and with Netscape 4 & Netscape 6.

NS6 has a builtin Java plug-in and I wonder if this applies to it as well.

Description:
Use self-signed certificate for java plug-in 1.3 applets to remove a sandbox
restrictions. Everyone can create own self-signed certificate for
development and/or intranet purposes. You don't need to purchase a
commercial certificate from Vesign. You can attach "mycert.crt" file as
hyperlink on your website and instruct users to run it before using intranet
applets.

client: Win98/Java plug-in 1.3/IE 4

1: Compile java sources (TestApplet.java, CharCounter.java)
c:\test\javac CharCounter.java
c:\test\javac TestApplet.java

2: Create self-signed RSA certificate:
c:\test\keytool -genkey -keystore ./mystore -alias mykey -keyalg RSA

type in the information being prompted.

3: Export certificate to a file:
c:\test\keytool -export -keystore ./mystore -alias mykey -file mycert.crt

4: Import certificate to trusted CA database of Internet Explorer:
double-click the "mycert.crt" file, view it and accept. Cerfication appears
to IE cert-db and is listed in internet settings/cerficates list.

5: Create JAR file:
c:\test\jar cvf MyApplet.jar TestApplet.class CharCounter.class

6: Sign previous jar file to create a new signed JAR file:
c:\test\jarsigner -keystore ./mystore -signedjar sMyApplet.jar MyApplet.jar
mykey

7: Create "c:\test\data.txt" text file and fill in the some data.

8: Open "testapplet.html" file. You should get a certification dialog box
when loading an applet and grand or deny access rights.

9: Applet reads the number of chars in data.txt file and display results.

Test files below:
===============
[file: TestApplet.java]
import java.awt.*;
import java.applet.*;

public class TestApplet extends Applet {
private int iCount;
private int iFileCount;
public void init() {
iCount = 123;
iFileCount = CharCounter.count("c:/test/data.txt");
}

public void paint(Graphics g) {
g.drawString("Count " + iCount, 10,10);
g.drawString("File count " + iFileCount, 10,30);
}
}

===============
[file: CharCounter.java]
import java.io.*;

class CharCounter {
public static int count(String file) {
InputStream in = null;
int count = 0;
try {
in = new FileInputStream(file);
while(in.read() != -1)

count++;
}
} catch (Exception e)

// do nothing
} finally {
try

in.close();
} catch (Exception e)

// do nothing
}
}
return count;
}
}

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

<pre>
===============
[file: TestApplet.html]
<html>
<head>
<title>Test Applet</title>
</head>
<body>
<h3>Signed applet jar (java plug-in)</h3>
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"

codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Vers
ion=1,3,0,0"
width=100 height=100>
<param name="code" value="TestApplet.class">
<param name="codebase" value=".">
<param name="archive" value="sMyApplet.jar">
<param name="type" value="application/x-java-applet;version=1.3">
<param name="scriptable" value="false">
</OBJECT>
<!--
<EMBED type="application/x-java-applet;version=1.3"

pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"
width=100 height=100
code="TestApplet.class"
codebase="."
archive="sMyApplet.jar"
scriptable="false">
</EMBED>
-->
</body>
</html>

====================
</pre>

0 new messages