participate


Signed Applets - How to sign an applet (and get it to work) [Locked]
This topic is locked
<<   Back to Forum  |   Give us Feedback
This topic has 63 replies on 5 pages.    « Previous | 1 | 2 | 3 | 4 | 5 | Next »
sujoydc
Posts:21
Registered: 11/2/99
Re: How to sign an applet (and get it to work)   
Apr 2, 2003 11:43 PM (reply 45 of 63)  (In reply to original post )

 
Hi ncoleman,
I have done exactly what you have mentioned.
But still I get a security exception in IE6.0 while
creating a directory through applet.
I have used a .jar file for my applet to work. Do I need to use
.cab file for IE?
Apart from this I have also taken permission in the init() of the
applet.
SO what went wrong?

Thanks,
Sujoy
 
asifarshad
Posts:1
Registered: 4/21/03
Re: How to sign an applet (and get it to work)   
Apr 21, 2003 12:31 AM (reply 46 of 63)  (In reply to #32 )

 
It is really a very nice effort regarding the signing of applets.But the problem I am facing is that after completing the "The 10 steps" successfully, I am unable to access a local file through IE6.0...I have even tried through an entry in Certificates option of the IE6.0....The message I get is of successful import of the certificate but it does not show up in the area.
I am on Win XP and using jdk1.4 plug-in and IE 6.0....Any help will be highly appreciated..
 
WichmanH
Posts:1
Registered: 1/11/00
Re: How to sign an applet (and get it to work)   
May 29, 2003 4:24 PM (reply 47 of 63)  (In reply to #42 )

 
I was wondering about that as well, and think I found the other thread, in which the only interesting thing was:
http://bugzilla.mozilla.org/show_bug.cgi?id=109067

The thread was http://forum.java.sun.com/thread.jsp?forum=63&thread=183585

I did what the document said and in my applet where I used to have :
executer = new Thread (AThreadedWorkerApplet.this);
executer.setPriority(Thread.NORM_PRIORITY);
executer.start();

I now have:

AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
// privileged code goes here
executer = new Thread (AThreadedWorkerApplet.this);
executer.setPriority(Thread.NORM_PRIORITY);
executer.start();
return null;
}
});

so it was a small change indeed (only it won't run without VM anymore, I will fix that in the morning ;-))

Hope this helps. By the way, we use a polling mechanism in our applets, without relying on JSOBject or whatever and the applets run practically verywhere (mac, unix, windows and on IE and netscape when at least liveconnect is supported).
 
carlwang1
Posts:1
Registered: 1/27/03
Re: How to sign an applet (and get it to work)   
Jun 1, 2003 9:28 AM (reply 48 of 63)  (In reply to original post )

 
Hi,
I learn that clealy on ur help, however, I met a problem during my work.
Can I specify my problem following:
I went throught the 9 steps but when I type the last command:
keytool -import -keystore cacerts -alias duke -file mycert.crt

I get the error:
================================================================
keytool error: java.io.FileNotFoundException: cacerts (Access is denied)================================================================

I think that's the system admins not allow me to modify it since i do a project in college to use signed applet technology, is that right?
Ishould contact them and ask for permission or I have any other solution? Can you show me some idea?

Thanks in advance
 
sanjibmail
Posts:4
Registered: 4/23/03
Re: How to sign an applet (and get it to work)   
Jul 8, 2003 12:52 AM (reply 49 of 63)  (In reply to original post )

 
Dear ncoleman1,

I have trying to handle a MSAccess Database with DSN using an applet.
I have followed you solve, but at the runtime I am getting an error stating "SQLException No suitable Driver Found".
I have tried the same code with a console based program, it does not create any problem, but when I tried it with appletviewer or browser that problem occur.

import java.sql.;
import java.awt.
;
import java.applet.;
import java.awt.event.
;

/
<applet code="test.class" width=200 height=200>
</applet>
*
/

public class test extends Applet implements ActionListener
{
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
String str=null;
TextArea ta;

public void init()
{
ta= new TextArea(10,30);
add(ta);
Button b1 = new Button(">>");
add(b1);
b1.addActionListener(this);
ta.setText("Initialization...\n");
}

public void actionPerformed(ActionEvent ae)
{
ta.appendText("Inside actionPerformed\n");
try
{
ta.appendText("Inside try block\n");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
ta.appendText("Class loaded\n");
/******** upto this point it works fine ************/
con=DriverManager.getConnection("jdbc:odbc:dbcon","","");
ta.appendText("Connection created\n");
stmt=con.createStatement();
ta.appendText("Statement created\n");
rs=stmt.executeQuery("select * from student");
ta.appendText("Resultset created\n");

while(rs.next())
{
str=str+rs.getString(1)" ";
str=str+rs.getString(2)
" "+"\n";
}
ta.appendText(str);

con.close();
stmt.close();
rs.close();

}catch(ClassNotFoundException cnfe){System.out.println("Class Not found "+cnfe.getMessage());}
catch(SQLException sqle){System.out.println("SQL Exception "+sqle.getMessage());}
catch(Exception e){ta.setText(e.getMessage());}
}
}

Please suggest me what should I do
 
sunxray
Posts:17
Registered: 6/10/03
Re: How to sign an applet (and get it to work)   
Jul 17, 2003 6:14 AM (reply 50 of 63)  (In reply to #14 )

 
Hello every one,
i write sign applet and it function in any machine where
there is installed jdk.
Now i need to know how i can run this applet in machines where
there no installed jdk

This work of applet is to execute a process on the client for
example notepad.exe.

thanks
 
forinti
Posts:20
Registered: 5/22/01
Re: How to sign an applet (and get it to work)   
Jul 17, 2003 9:37 AM (reply 51 of 63)  (In reply to original post )

 
Has anyone tried signing for IE,Netscape4.x and
Netscape 6+?

I think IE isn?t really a problem; the classes
can simply be packaged in a cab file and other
browsers will ignore them.

I?ve tried signing using Netscape?s signtool
and Sun?s jarsigner, but then neither will work.

Also, I can?t import my certificates into Netscape
4?s database and have them recognized as code
signing certificates.
 
akila_sivam
Posts:3
Registered: 1/20/06
Re: How to sign an applet (and get it to work)   
Jan 27, 2006 4:17 AM (reply 52 of 63)  (In reply to original post )

 
can anyone send me the signed Applet code so that i can have an idea of how to develop my owen signed code. if anyone can send pls send it to akilasivam@hotmail.com id.

thanks in advance.

regards,
s.akila
 
cintcinderella
Posts:1
Registered: 2/10/06
Re: How to sign an applet (and get it to work)   
Feb 10, 2006 2:03 AM (reply 53 of 63)  (In reply to original post )

 
How To Sign a Java Applet

The purpose of this document is to document the steps
required to sign and use an
applet using a self-signed cert or CA authorized in
the JDK 1.3 plugin.

The original 9 steps of this process were posted by
user irene67 on suns message forum:
http://forums.java.sun.com/thread.jsp?forum=63&thread
=132769

-----begin irene67's original message
These steps describe the creation of a self-signed
applet. This is useful for testing purposes. For use
of public reachable applets, there will be needed a
"real" certificate issued by an authority like
VeriSign or Thawte. (See step 10 - no user will
import and trust a self-signed applet from an unkown
developer).

The applet needs to run in the plugin, as only the
plugin is platform- and browser-independent. And
without this indepence, it makes no sense to use
java...

1. Create your code for the applet as usual.
It is not necessary to set any permissions or use
security managers in
the code.

2. Install JDK 1.3
Path for use of the following commands: [jdk 1.3
path]\bin\
(commands are keytool, jar, jarsigner)
Password for the keystore is any password. Only Sun
knows why...
perhaps ;-)

3. Generate key: keytool -genkey -keyalg rsa -alias
tstkey
Enter keystore password: *****
What is your first and last name?
[Unknown]: Your Name
What is the name of your organizational unit?
[Unknown]: YourUnit
What is the name of your organization?
[Unknown]: YourOrg
What is the name of your City or Locality?
[Unknown]: YourCity
What is the name of your State or Province?
[Unknown]: YS
What is the two-letter country code for this unit?
[Unknown]: US
Is CN=Your Name, OU=YourUnit, O=YourOrg, L=YourCity,
ST=YS, C=US
correct?
[no]: yes

(wait...)

Enter key password for tstkey
(RETURN if same as keystore password):

(press [enter])

4. Export key: keytool -export -alias tstkey -file
tstcert.crt

Enter keystore password: *****
Certificate stored in file tstcert.crt

5. Create JAR: jar cvf tst.jar tst.class
Add all classes used in your project by typing the
classnames in the
same line.

added manifest
adding: tst.class(in = 849) (out= 536)(deflated 36%)

6. Verify JAR: jar tvf tst.jar

Thu Jul 27 12:58:28 GMT+02:00 2000 META-INF/
68 Thu Jul 27 12:58:28 GMT+02:00 2000
META-INF/MANIFEST.MF
849 Thu Jul 27 12:49:04 GMT+02:00 2000 tst.class

7. Sign JAR: jarsigner tst.jar tstkey
Enter Passphrase for keystore: *****

8. Verifiy Signing: jarsigner -verify -verbose -certs
tst.jar

130 Thu Jul 27 13:04:12 GMT+02:00 2000
META-INF/MANIFEST.MF
183 Thu Jul 27 13:04:12 GMT+02:00 2000
META-INF/TSTKEY.SF
920 Thu Jul 27 13:04:12 GMT+02:00 2000
META-INF/TSTKEY.RSA
Thu Jul 27 12:58:28 GMT+02:00 2000 META-INF/
smk 849 Thu Jul 27 12:49:04 GMT+02:00 2000 tst.class

X.509, CN=Your Name, OU=YourUnit, O=YourOrg,
L=YourCity, ST=YS, C=US
(tstkey)

s = signature was verified
m = entry is listed in manifest
k = at least one certificate was found in keystore
i = at least one certificate was found in identity
scope

jar verified.

9. Create HTML-File for use of the Applet by the Sun
Plugin 1.3
(recommended to use HTML Converter Version 1.3)

10. (Omitted See Below)

-----end irene67's original message

To make the plug-in work for any browser you have two
options with the JDK 1.3 plugin.

1) Is to export a cert request using the key tool and
send it to a CA verification source like verisign.
When the reponse comes back, import it into the
keystore overwriting the original cert for the
generated key.

To export request:
keytool -certreg -alias tstkey -file tstcert.req

To import response:
keytool -import -trustcacerts -alias tstkey -file
careply.crt

An applet signed with a cert that has been verified
by a CA source will automatically be recognized by
the plugin.


2) For development or otherwise, you may want to just
use your self-signed certificate.
In that case, the JDK 1.3 plugin will recognize all
certs that have a root cert located in the JDK 1.3
cacerts keystore.
This means you can import your test certificate into
this keystore and have the plugin recognize your jars
when you sign them.

To import self-signed certificate into the cacerts
keystore, change directory to where the JDK plugin
key store is located.
For JDK 1.3.0_02: C:\Program
Files\JavaSoft\JRE\1.3.0_02\lib\security
For JDK 1.3.1: C:\Program
Files\JavaSoft\JRE\1.3.1\lib\security

Import your self-signed cert into the cacerts
keystore:
keytool -import -keystore cacerts -storepass changeit
-file tstcert.crt
(the password is literally 'changeit')




Now, regardless of which method you use, the applet
should be recognized as coming from a signed jar.
The user can choose to activate it if he / she
he chooses. If your applet uses classes from
multiple jars, for example Apache's Xerce's parser,
you will need to sign those jars as well to allow
them to execute in the client's brower. Otherwise,
only the classes coming from the signed jar will work
with the java.security.AllPermission setting and all
other classes from unsigned jars will run in the
sandbox.



NOTE: Unless otherwise specified by the -keystore
command in all keytool and jarsigner operations, the
keystore file used is named '.keystore' in the user's
home directory.

The first time any keystore is accessed (including
the default) it will be created and secured with the
first password given by the user. There is no way to
figure out the password if you forget it, but you can
delete the default file and recreate it if necessary.
For most operations, using the -keystore command is
s safer to keep from cluttering or messing up your
default keystore.

cint cinderella
 
shethap
Posts:1
Registered: 2/17/06
Re: How to sign an applet (and get it to work)   
Feb 17, 2006 3:43 AM (reply 54 of 63)  (In reply to original post )

 
still i have the problem with this :

i hav follow the steps as below:

keytool -genkey -keyalg rsa -alias applkey
keytool -export -alias applkey -file appl.crt
jar cvf appl.jar NervousText.class
jar tvf appl.jar
jarsigner appl.jar applkey
jarsigner -verify -verbose -certs appl.jar
keytool -import -keystore cacerts -storepass changeit -file appl.crt


still it doesnt work:

so when e put all files and certificates,please elaborate it,becoz its urgent.

thanks in advance.
 
vatos
Posts:1
Registered: 6/8/06
Re: How to sign an applet (and get it to work)   
Jun 8, 2006 1:53 AM (reply 55 of 63)  (In reply to #2 )

 
hi..
i've tried your tips..
but at the 6th step, i cannot signed it

when i entered these lines,
jarsigner MyApplet.jar tstkey
Enter Passphrase for keystore: ****
the message is-->
jarsigner: attempt to rename MyApplet.jar to MyApplet.jar.orig failed

help me..
 
fipper
Posts:11
Registered: 7/25/06
Re: How to sign an applet (and get it to work)   
Oct 28, 2006 5:03 AM (reply 56 of 63)  (In reply to #55 )

 
I having the smae problem " attempt to rename .... to .... .orig failed ?

(jdk1.3.1_01)
 
fipper
Posts:11
Registered: 7/25/06
Re: How to sign an applet (and get it to work)   
Oct 28, 2006 5:31 AM (reply 57 of 63)  (In reply to #56 )

 
Nobody is ever answering this thread any more :( :( :(

No point in posting here, better look for info on other forums or documents, java sun forum seems to have died :(
 
morgan@itgymnasiet.nu
Posts:1
Registered: 2/10/07
Re: How to sign an applet (and get it to work)   
Feb 10, 2007 2:07 PM (reply 58 of 63)  (In reply to original post )

 
I had a problem with an Corba connecting applet. But I followed the steps described in your article and signed the applet, and it solved the problem. Tanks a lot for the best tutorial on the subject that I have read.
 
OyvindM
Posts:1
Registered: 8/20/07
Re: How to sign an applet (and get it to work)   
Aug 20, 2007 4:09 AM (reply 59 of 63)  (In reply to #55 )

 
The message:
"jarsigner: attempt to rename X.jar to X.jar.orig failed"
Appears when another application is using the original jar, and jarsigner therefore cannot do with it what it wants. Please close all other applications (typically a browser, trying to run an applet in the jar, or similar) when executing the jarsigner tool.
 
This topic has 63 replies on 5 pages.    « Previous | 1 | 2 | 3 | 4 | 5 | Next »
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics

About Sun forums
  • Oracle Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Oracle Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums