Results 1 to 12 of 12
Thread: applet signing
- 10-05-2008, 05:14 PM #1
Member
- Join Date
- Oct 2008
- Posts
- 6
- Rep Power
- 0
applet signing
Java Plug-in 1.6.0_05
Using JRE version 1.6.0_05 Java HotSpot(TM) Client VM
User home directory = D:\Documents and Settings\dave
----------------------------------------------------
----------------------------------------------------
OPEN CLICKED
reading file E:\Music\arsise\\001.jpg
Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.io.FilePermission E:\Music\arsise\001.jpg read)
at java.security.AccessControlContext.checkPermission (Unknown Source)
at java.security.AccessController.checkPermission(Unk nown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkRead(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at localfile.action(localfile.java:47)
at java.awt.Component.handleEvent(Unknown Source)
at java.awt.Component.postEvent(Unknown Source)
at java.awt.Component.postEvent(Unknown Source)
at java.awt.Component.postEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilter s(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(U nknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
This is my first time creating a signed applet or running a signed applet i didn't create much with respect to the source here: oh i cant post links so search google "java applet open file" should be the first one.
Anyway I am pretty certain from the console output that it is a permission error and when i run it no allow or deny dialog pops up so the problem is with the signing.
I have created a jar file as the site suggests. The contents of the jar are the manifest.mf, yourkey.sf, yourkey.rsa, and localfile.java. I have signed that jar file.
I have a certificate (dont understand how it is accessed at runtime though) and my html is as follows:
<HTML>
<BODY>
<body bgcolor="#dddddd">
<APPLET CODE="localfile.class" archive="localfile.jar" WIDTH="600" HEIGHT="500">
</APPLET>
</BODY>
</HTML>
Is my manifest alright do I need to add something to it?
Manifest:
Manifest-Version: 1.0
Created-By: 1.6.0_07 (Sun Microsystems Inc.)
Name: C:/Sun/LocalFile.java
SHA1-Digest:(numbers-letters=)
I am new to this whole signing thing so any help is appreciated.
- 10-05-2008, 05:24 PM #2
New to this?... trying to do Secure Hash Algorithm?....
Uh, where are you studying? Can we get derivative mineral rights?Introduction to Programming Using Java.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
- 10-05-2008, 05:27 PM #3
There have been posts here on how to sign an applet. Use Search to find them.
Here's one that has the batch files I used for the following test:
http://www.java-forums.org/enterpris...gned-jars.html
I refered to a jar file I'd signed for testing: Applet ReaderLast edited by Norm; 10-05-2008 at 05:30 PM.
- 10-05-2008, 06:53 PM #4
Member
- Join Date
- Oct 2008
- Posts
- 6
- Rep Power
- 0
Does the manifest that is automatically created need to be manipulated manually?
- 10-05-2008, 08:34 PM #5
Not sure what you mean an automatically created manifest.
What program are you using to do that?
If its the jar program, then no manual changes are needed to sign the jar file.
- 10-05-2008, 09:35 PM #6
Member
- Join Date
- Oct 2008
- Posts
- 6
- Rep Power
- 0
I was talking about using jar to auto create manifest, thanks for the input. I was reading around online and thought i had to do something with the manifest manually thats why i asked.
Here is the code. I am trying to open a file from my machine and upload it to a webserver. Tried it in applet viewer and a local html received the error from above. Not sure how to fix it at this point. I have ran jar, jarsigner, and used jar signer verify all looks like its in place. Any suggestions?
import java.applet.*;
import java.awt.*;
import java.util.*;
import java.lang.*;
import java.text.*;
import java.awt.event.*;
import java.io.*;
public class localfile extends Applet {
public localfile() {
Panel p = new Panel();
Font f;
String osname = System.getProperty("os.name","");
if (!osname.startsWith("Windows")) {
f = new Font("Arial",Font.BOLD,10);
} else {
f = new Font("Verdana",Font.BOLD,12);
}
p.setFont(f);
p.add(new Button("Open"));
p.setBackground(new Color(255, 255, 255));
add("North",p);
}
public boolean action(Event evt, Object arg) {
if (arg.equals("Open")) {
System.out.println("OPEN CLICKED");
int arrlen = 10000;
byte[] infile = new byte[arrlen];
Frame parent = new Frame();
FileDialog fd = new FileDialog(parent, "Please choose a file:",
FileDialog.LOAD);
fd.show();
String selectedItem = fd.getFile();
if (selectedItem == null) {
// no file selected
} else {
File ffile = new File( fd.getDirectory() + File.separator +
fd.getFile());
// read the file
System.out.println("reading file " + fd.getDirectory() +
File.separator + fd.getFile() );
try {
FileInputStream fis = new FileInputStream(ffile);
BufferedInputStream bis = new BufferedInputStream(fis);
DataInputStream dis = new DataInputStream(bis);
try {
int filelength = dis.read(infile);
String filestring = new String(infile, 0,
filelength);
System.out.println("FILE CONTENT=" + filestring);
} catch(IOException iox) {
System.out.println("File read error...");
iox.printStackTrace();
}
} catch (FileNotFoundException fnf) {
System.out.println("File not found...");
fnf.printStackTrace();
}
}
} else return false;
return true;
}
}
- 10-05-2008, 09:55 PM #7
my apologies
Go to a simpler learning format. None of this has to do with codesigning and
and SHA-1Java Code:Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access violation
My joking remark was unfounded. An area, which is rich in various gas/oil and ore deposits, including rare earth elements, and platinoids, has been the source of speculative remarks. My rebuttal belongs there, not here. Similarly, your work belongs in an arena not related to disentangling SHA-1 and code signing. Short of it is you are trying to do a file open from an applet, you have work to do before you attempt that.Introduction to Programming Using Java.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
- 10-05-2008, 11:47 PM #8
Did you look at my post on the other thread? In that test I wrote an applet to read a file from my PC. I created a jar and signed it using the statements that I posted. I uploaded the HTML and jar file and posted its URL.
When I load the HTML/Applet, I get a prompt from the browser re security, I click OK and the applet reads the file.
What are you doing differently from what I did? Mine works.
The answer is not in your source, unless you want to change the design to do NOTHING that requires permission.Last edited by Norm; 10-05-2008 at 11:50 PM.
- 10-06-2008, 12:18 AM #9
Signing Java Applet
Scroll down and watch also my explanation
- 10-06-2008, 04:21 AM #10
Member
- Join Date
- Oct 2008
- Posts
- 6
- Rep Power
- 0
yes i ran your applet and received a file IO error so maybe its a browser thing?
I'll augment the source to negate file IO operations.
I did not get the permission request to pop up in mine like it did for yours. I thought I did the jar signing exactly the same I'll look at it closer.
- 10-06-2008, 04:24 AM #11
Member
- Join Date
- Oct 2008
- Posts
- 6
- Rep Power
- 0
Also thanks Jordan and serjant I appreciate your input.
- 10-06-2008, 02:05 PM #12
Similar Threads
-
Signing Java Applet
By Agri in forum New To JavaReplies: 8Last Post: 09-29-2008, 06:26 PM -
applet and signing
By Preethi in forum New To JavaReplies: 0Last Post: 06-05-2008, 03:17 PM -
signing applets for a period of time
By sandeepk84@gmail.com in forum Java AppletsReplies: 0Last Post: 12-04-2007, 01:34 PM -
Signing An Applet!!!!! Me Need Help!!!!! Plz!
By marco in forum Java AppletsReplies: 3Last Post: 07-29-2007, 05:45 PM -
Unknown publisher / Signing standalone tomcat.exe
By millross in forum New To JavaReplies: 1Last Post: 06-14-2007, 02:25 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks