Filesystem access with signed applet?

Is signing an applet enough to read-access the client filesystem?
I found webpages that said, signing the applet is sufficient while other webpages say you still need policy-files.

Hello, there is more suitable solution for webpage application then is JFileUpload. Here, watch this video on youtube: http://www.youtube.com/watch?v=wqpwyAAhKGg . Java Applet is hidden controlled by JavaScript!

Similar Messages

  • Security Problems with Signed Applet

    Hello All,
    I need help with signed applets.
    I have an applet pkged in a jar that uses other jars. I have signed the jar containing applet and all the other jars being used. However, when I try to run the applet in IE 6.0.xx, I get the following error
    java.lang.ExceptionInInitializerError
         at aaa.aaa.somemethod(xxx.java:192)
         at aaa.aaa.aaa.access$000(xxx.java:27)
         at aaa.aaa.aaa.$1.run(xxx.java:467)
    Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission user.home read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
         at java.lang.System.getProperty(Unknown Source)
         ... 3 moreMy application is using Java 1.4.2.xx.
    Any help or pointers would be greatly appreciated.
    Thanks.

    Thanks harmmeijer and mjparme for your responses.
    I made some changes to my application and it does not now require the system property information. But now I am getting another exception related to class loader.
    I made the changes to the console as suggested by harmmeijer, and here is the stack trace. Also, I am not using any JavaScript explicitly.
    Registered modality listener
    Invoking JS method: document
    Invoking JS method: URL
    Referencing classloader: sun.plugin.ClassLoaderInfo@e0a386, refcount=1
    Loading applet ...
    Initializing applet ...
    Starting applet ...
    java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.ClassLoader.getSystemClassLoader(Unknown Source)
         at xxx.xxx.a...<init>(a.java:39)
         at  xxx.xxx.b...<init>(b.java:42)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Exception: java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)
    java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.ClassLoader.getSystemClassLoader(Unknown Source)
         at xxx.xxx.a...ToolBus.<init>(a.java:39)
         at xxx.xxx.b....<init>(b.java:42)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Modality pushed
    Modality poppedmjparme as to your second point, the action is taking place in the same jar only. No other jar is involved at the stage where I am getting exception.
    Thankyou again and will appreciate your help.
    AC

  • Problem with signed applet

    HI All,
    I am writing a small applet to draw a line graph by setting the parameters from the html pages .It came up beutifully .There are two problems here .
    1)When i try to print the applet it prints only black coloroued rectangle in place of applet(graph) .I read lot of articles only to find out that the applet need to be signed for printed .I tried all ways and means but could not succedd in printing an applet .
    2)When i try to access the applet from other computer with out copying it says that applet can not be acceessed due to security failure .It throws exception.
    I need your help on how to sign applets to access from other computer and also how to print applet content .
    Can any one help me on this
    Thanks in advance .

    i am not sure of that , but having experience with drawing images ,graphs and the like and with no experience in printing, i can share u my experience.
    using setBackground(Color.white) of the applet/panel wouldnot work since i believe it is something that is got to do with the graphics class .U have to draw a full white rectangle as a background before u start drawing lines.
    like
    g.setColor(color.white);
    g.drawfullrect(0,0,width,height); /// draw a white background
    g.setColot(Color.black);
    g.drawline(0,0);
    etc.....
    Have fun dude.

  • File Access with unsigned Applet through editing the java.policy file

    I'am starting to lose my hair on this...
    I am trying to get an applet to run so that it can access the file system to move files on my local maschin. Because this applet is only running on my VM i can change the java.policy to avoid the signing of the applet.
    first of all, if i wrote in the java.policy file
    grant {
      permission java.security.AllPermission; 
    };everything is working perfekt.
    But I have not the intention to open the gates for any applet out there, so i want to limit the access to my applet. With every of the following versions I get at best an
    java.security.AccessControlException: access denied (java.io.FilePermission...
    My Setup
    My Java Version: jre1.6.0_02
    My applet is located unter the url
    http://admin.mydomain.com/applet.jar
    In Html i tryed the following different versions of loading the applet - none worked
    <applet codebase="http://admin.mydomain.com/" name="shortcut" code="start.class" archive="applet.jar" width="0" height="0"></applet>
    <applet codebase="http://admin.mydomain.com" name="shortcut" code="start.class" archive="applet.jar" width="0" height="0"></applet>
    <applet name="shortcut" code="start.class" archive="http://admin.mydomain.com/applet.jar" width="0" height="0"></applet>in java.policy i tryed following versions with every html applet load version
    grant codeBase "http://admin.x-press.de/-" {
      permission java.security.AllPermission; 
    grant codeBase "http://admin.x-press.de/+" {
      permission java.security.AllPermission; 
    grant codeBase "http://admin.x-press.de/applet.jar" {
      permission java.security.AllPermission; 
    };why is it with
    grant {
      permission java.security.AllPermission; 
    };working, and not with the other versions?
    i am almost bold now, please try to save my last hair from falling down.
    any suggestion would be nice
    thanks, feyyaz
    Message was edited by:
    feyyazdogu

    I read the mentioned documentation and your right, some of my versions were wrong, but after reading the doumentation again i came to following result which should had worked but didn't.
    java.policy
    grant codeBase "http://admin.mydomain.com/*" {
      permission java.security.AllPermission;
    HTML File
    <applet codebase="http://admin.mydomain.com/" name="shortcut" code="start.class" archive="applet.jar" height="0" width="0"></applet>if I am entering http://admin.mydomain.com/applet.jar i can download the jar, so the archive lays in the correct directory.
    what i am doing wrong? do i have to change an additional file somewhere else?

  • How to Randomfile access Non-Signed Applet?

    How to access a file with RandomFile Access with a non-signed Applet?
    Similar to this but with Random Seek,Read, Write.
    BufferedReader inData = new BufferedReader(new InputStreamReader(home.openStream()));
    Thank you

    Have you looked at
    http://java.sun.com/docs/books/tutorial/essential/io/index.html

  • Problems with signed Applet for File Download under JRE 1.4 (works with 1.3

    Dear all,
    i encountered a very strange behaviour with JRE 1.4x. A signed applet used for file download worked on all platforms (Windows NT, 2000 and XP wth/wthout SP...) until I installed JRE 1.4.x (1.4.1 or 1.4.2)
    I get an EOFException when downloading binary files (for ASCII it works fine) when trying to readByte() from a DataInputStream. But not immideately, but after x bytes in the while-loop. Security is fine (I know there have been changes to that in jre 1.4, the applet itself can be started an runs with ASCII files for transfer)
    Does anyone know, what has changed in jre1.4.
    As I said, it works fine under jre 1.3.x
    The relevant code is below: byte bt = dis.readByte(); causes the error
    try{
    // Get URL from Server
    URL uFile = new URL(sFilename);
    sThisURLFile = uFile.getFile();
    Integer inte = new Integer(i);
    //open input stream for the file on server
    DataInputStream dis = new DataInputStream(new BufferedInputStream
    (uFile.openConnection().getInputStream()));
    //open output stream for the file on local drive
    String sFilenameOnly = sThisURLFile.substring(sThisURLFile.lastIndexOf('/')+1);
    int iDotPos = sFilenameOnly.lastIndexOf(".");
    String sExt;
    if (iDotPos > 0) {
    sExt= sFilenameOnly.substring(iDotPos);
    } else {
    sExt = "";
    File fileOut = new File(sDownloadDir + sThisURLFile.substring(sThisURLFile.lastIndexOf('/')+1) );
    DataOutputStream dos = new DataOutputStream(new
    BufferedOutputStream(new FileOutputStream(fileOut)));
    //read one byte from input stream, and write that byte to output stream
    long nByte = 0;
    int iCnt = 0;
    iFilesizeDone ++;
    while (nByte < iFilesize){
    String sErrPs = new String();
    try{
    sErrPs = "00";
    byte bt = dis.readByte();
    sErrPs = "01";
    dos.writeByte(bt);
    } catch (EOFException ee)
    System.err.println("internal EOFException: " + ee.getMessage());
    System.out.println("Error Filesize is " nByte " of " iFilesize "---" + sErrPs);
    break;
    nByte++;
    iFilesizeDone ++;
    iCnt ++;
    if(iCnt >= 10240) {
    ShowProgress(nByte, iFilesize, iFilesizeDone, iFilesizeTotal); // repaint does not work during init-procedure
    iCnt = 0;
    line = "Progress: Total: " + ((iFilesizeDone*100)/iFilesizeTotal) + " perc, " + iFilesizeTotal/1024 +" kbytes" ;
    labLine.setText(line);
    //dos.flush(); // improves Client performance (Agent-Call!)
    dis.close();
    dos.close();
    }// End try
    catch (EOFException ee)
    System.err.println("EOFException: " + ee.getMessage()e);
    catch (SecurityException se)
    System.err.println("SecurityException: " + se.getMessage());
    catch (IOException ioe)
    System.err.println("IOException: " + ioe.getMessage());

    perhaps they've changed something with the file blocking.
    btw, you should try to use something like this
    DataInputStream dis = new DataInputStream(is);
    byte[] buffer=new byte[8192];
    int numBytesRead;
    while ( dis.available()>0 ) {
         numBytesRead = dis.read(buffer);
    }               

  • Write file with signed applet

    Hi!
    I have a signed applet which has to write a file to the server, but i still get permission exceptions. I guess I still have to add permissions to the applet but I realy can't find how to do that. Can anyone give me a short tutorial on how to add permissions to the applet?
    greetings

    As stated, applets are only able to write files in the machine that the applet is running on. They can't write files to other machines. They can communicate to the machine that they originate from (its host) - but not other, random machines.
    To place a file on its host, the applet sends the file contents to its host (typically using sockets for this) which receives the data with a server program. Then another program on the host writes the data to a file. If you want the file on another, random machine then it can be transferred using the same approach (sockets, etc.)
    There are alternatives, but this is the least complicated approach. This tutorial walks you through creating an applet and the host it communicates with.
    [http://java.sun.com/docs/books/tutorial/deployment/applet/server.html]
    Note that the tutorial also has a link to a more detailed tutorial, the Custom Networking Trail.

  • Display of certificate when accessing a signed applet

    HI
    I have a signed applet which obviously displays a Certificate whenever it is Accessed.Now i would like the certificate to be displayed only once ie. ONLY when the applet is accessed for the first time and the user accepts(trusts) the certificate.The next time the user access the applet i do
    not want the certificate to be displayed again as he has already accepted (trusted)the certificate.
    is there a way to do this?
    best regards
    sumesh

    Your user must import your certificate and store it as a trusted CA -- see step #9 on the link shown below:
    http://developer.java.sun.com/developer/qow/archive/167/index.jsp
    V.V.

  • IE Crashes with signed applet.

    I've been having problems in the last few days where my signed applet will crash on one server, and will not on the other.
    The server it doesn't crash on never crashes, where as the one it does crash on, will always crash. The certificate is currently my own and I have not yet purchased a Verisign cert.
    The applet uses 1.3.1_04 and I'm not sure what else to do.
    Any suggestions?

    Maybe some bug on 1.3.1_04 plugin version, uninstall it and
    try to install the version 1.3.1_01 from sun archive:
    http://java.sun.com/products/archive/index.html
    I had the same problem running that 1.3.1_04 version!
    When I get installed the 1.3.1_01 version I had not problems
    anymore.
    crt

  • Lost with signed applet permissions

    Hi all,
    We need to deploy a very simple applet which sole role is to connect to a domain other than mother to send and get some data. We have a certificate from Verisign and have signed the applet. So far so good. The applet is compiled and signed with the jdk 1.3.1_12. With the JRE 1.3.1_x, it works just fine. If the jre 1.4.2_x is installed however, the connection doesn't happen and we receive a permission denied exception instead:
    java.security.AccessControlException: access denied (java.net.SocketPermission xxxxx resolve)
    With jre 1.4.2, when the applet loads, we do see the security prompt, but we get the permission denied exception even if we specifically choose to trust the applet. I thought this step would automatically grant all priviledges?
    So I don't know what to do from here. How can the applet request for the correct permission in jre 1.4.2_x? I looked around and found some information about policy files but I'm at a loss at how to use that, we have no control as to who will see the applet so I don't think we can ask all to update their policy file first.
    What we want to have is for our users to grant priviledge at the security prompt and not worry about anything else, even with jre1.4. Can it be done?
    Any help would be much appreciated.
    Tim.

    Apologies, I think this post would have been more suited for the sigend applet forum. I have reposted there, please ignore the post in this forum.

  • Error with signed applet "class can't be instantiated"

    hi,
    I developed an applet to make a ftp connexion to upload files from the local disk and the applet is already signed. At first I compiled it with the 1.4 version and I got (from other computers) the error "class not found". Then I used the target 1.1 option and now I get the error "class can't be instantiated"
    Do I need any additional code?
    I am using all these imports
    import java.applet.Applet;
    import java.applet.AppletContext;
    import java.awt.*;
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import javax.swing.JComponent;
    import javax.swing.JProgressBar;
    import javax.swing.*;
    Thanks

    go to
    Tools->Internet Options->Advanced
    Look for "Java (Sun)" (normally near Microsoft VM). I uncheck all the Microsoft VM options but am not sure if that is really necessary.
    Also play with Control Panel, you should see "Java Plug-in" in there and be able to configure browsers a bit with that.

  • Help with signing applets

    Hi everybody. How do I sign an applet so that the applet is granted file access? I want the applet to request file access only and nothing else. From the applet signing tutorial it seems like signing an applet will grant all or nothing security! But I only want file access and I want the popup window which users receive to say file permissions only.

    I also developed an applet where I only want socket permission but not file permission. It is a chat applet which can connect to multiple servers and so I don't want it to be limited to the domain where it is hosted. I overcome that by signing it. But my customers will not run the applet because they do not trust the applet because they say it is requesting unlimited access to their files. They say they don't want the applet messing up the computer. How can I request socket permission only and nothing else?

  • Problems with Signed Applets

    Hello !
    I have an applet program that displays the content of a batch file in the Applet window.
    To sign the Applet I have converted the corresponding class file to a jar .
    Then using keytool & jarsigner... I had signed it .
    I tried to restrict the enuser form editing the contents of that batchfile's contents.
    To restrict it I had Created a Policy file with only read permission allowed .
    After following the above procedures , when i tried to run my applet, the applet is getting loaded sucessfully with that batch file's content .
    And when i try to edit it , I'm able to edit the contents . I don't how this could be possible bcoz i have set the permission only to read it !
    Any Ideas Please !
    TIA

    in the policy file, you restrict the applet to only read files. but if you have already signed it and clicked Yes on the certification screen when loading the applet, the applet gets full permission.
    the other thing is that you have a textarea field or something, you must set the textarea to readonly.
    if you read in a file's content and display it in a textarea, the user can change the content of the textarea, but if your applet does not write the changes back to the file, the file won't be changed, although the user has changed the textarea content.
    perhaps you might post some more info on the code you are using....

  • Need help with signing applets

    I'm trying to have an applet write a file on the client system, but I'm having issues signing my applet. I think I'm missing something and would appreciate any help. Here are the steps I am taking...
    1) keytool -genkey -alias blah
    2) answer all the questiosn
    3) jar -cvf Applet.jar *
    4) jarsigner Applet.jar blah
    5) applet code in the html file is:
    <applet code=Applet.class archive=Applet.jar width="900" height="600">
    6) run applet: appletviewer Applet.html
    I then get an AccessControlException. What am I missing? Also, why do I still get the AccessControlException when I run my applet through appletviewer? I was under the impression appletviewer automagically gave permissions, and the AccessControlExceptions were only when you tried to run the applet off a server.
    Some test code I'm using (AccessControlException at the System.getProperty line):
                        File out = new File(System.getProperty("user.dir") + "test.txt");
                        FileWriter writer = new FileWriter(out);
                        writer.write("blah");
                        writer.flush();
                        writer.close();

    It works now in my browser, after rebuilding jar and resigning. But it still doesn't work in Appletviewer...

  • Wanted: Help with Signed Applet Tutorial

    I'm trying to follow this tutorial and I'm confused about the file name of the policy file.
    [http://java.sun.com/developer/onlineTraining/Programming/JDCBook/signed.html|http://java.sun.com/developer/onlineTraining/Programming/JDCBook/signed.html]
    Below is the code that goes into the policy file (from the above URL). Now where do I put it on a windows machine? %HOMEDRIVE%%HOMEPATH%? What do I specify as the keystore?
    How do I edit it for a windows machine running cygwin?
    Thanks,
    Siegfried
    {keystore "/home/ray/raystore";  
    // A sample policy file that lets a program   
    // create demo.ini in user's home directory  
    // Satya N Dodda  
    grant SignedBy "company" {  
      permission java.util.PropertyPermission   
        "user.home", "read";  
      permission java.io.FilePermission   
        "${user.home}/demo.ini", "write";  
    code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    I believe that you can find the necessary details in this tutorial:
    [http://java.sun.com/docs/books/tutorial/deployment/jar/signindex.html]

Maybe you are looking for

  • How to create the folders in UCM

    Hi All, I am new to UCM,i have one issue ? i need to create 2 folders in ucm. one folder can access all the users (public) and they have read permission second folder can access only few users depending on security group. can you provide your inputs

  • CS5 won't open in 10.9.3

    help- have installed and re-installed CS5 in my 2012 laptop (updated to mavericks- latest java, latests adobe updates, latest mac updates. neither photshop nor bridge will open and can't find any online help that has worked so far!

  • Using iWeb FTP results in nested site...

    I'm sure I'm just being a dummy here... but I'm lost. I'm using iWeb v3.01 to upload a site to a non-.mac host (bluehost.com). The uploads proceed without a hitch, no problem. Let's call it "www.genericsite.com." But when I go visit the site just upl

  • Can't use databeans in other envierments

    Hi When I try to use databeans outside JD3 in a 3rd party application server I get a problem that ClassLoader.getSystemResourceAsStream(sConfigPath); CanFt find the resource file, this is used in oracle.jbo.html.jsp.JSPApplicationRegistry to load the

  • Muse not installing

    how do I install Muse after deleting beta? Muse wont install.