Granting SocketPermission using signed applet

I have had a dream of locally caching a jar file for an applet so that all the code will be on the client machine after the first time the applet was loaded. Basically, I have a very thin applet composed of a jar class loader and a tiny applet which will check for a jar file on the client and download it from the server if it does not exist. These simple classes are in a signed jar file. Basically, this thin applet does the following:
1) Check for the big, app jar file in c:\Temp
2) If it does not exist, open a URL input stream and get the big jar
3) instantiate a jar class loader object on the now local, big jar file
4) load the "main" class
5) use reflection to run its initialization method
6) the application then attempts to open a socket to the server
I get all the way to step 6 and this is where things go bad. As far as I can tell, the "thin" app loader class has permission to do anything it wants since it was downloaded from a signed jar - I haven't tried to do anything I was not able to do with this class. I think the problem arises because the app class came from a non-signed jar file and it appears to have all the typical applet restrictions. I can make URL connections to the local client (since that's where the code was loaded from), but not anywhere else.
I was hoping all classes the "thin", privileged class loaded would inherit these privileges, but obviously the class permissions come from where the class was loaded from. This is a bummer and my guesses for solving this problem are:
1) grant permission to the entry class for the app somehow (I tried something like this by executing the entry method for the app in a AccessController.doPrivieleged block - no luck)
2) sign the app jar and somehow read and accept its certificate so that all classes loaded from this jar are privileged (I am not sure of how to do this)
I am hoping someone might have an elegant solution to this problem as this is really the last step in my caching solution. By the way, the entry app class is not an applet itself if this is useful information to anyone. The "thin" applet is the only applet and just hands control off to the entry method of the main app class in the jar.
TIA!

Signing an applet provides it with the ability to run outside the sandbox. This does not automatically give the applet permission to do anything it wants. The applet must still request the desired permission before actually attempting an operation that requires that permission. Depending on the browser or whether you are relying on the Java plugin, you need to call the necesary security method first. I wrote a signed applet back in May 2000 which also needed socket permission. I don't have access to the code anymore so I cannot recall exactly the classes and methods you need to invoke. If you search the Signed Applets forum for my name, there are several messages that should help you.
For example:
http://forums.java.sun.com/thread.jsp?forum=63&thread=132336

Similar Messages

  • Problem in Granting permissions for Signed Applet

    Hi,
    I have signed my applet with my self generated certificate. The client browser has imported this certificate in his cacerts keystore as trustcacerts. When I grant permission for my client(manually,in the client machine), I have peculiar errors.
    Case 1 : grant codeBase "http://***.XXX.***.XX/-" { permission java.security.AllPermission; };
    This permission works fine. But the client is able to download all applets from the granted machine, including unsigned applets.
    Case 2: grant SignedBy "dcard" codeBase "http://***.XXX.***.XX/-" { permission java.security.AllPermission; };
    If I add the signedBy tag, this particular grant section is completely omitted by the system. That is, the browsers does not recognize the signedBy tag( & its entire grant block) and throws SecurityExceptions for accessing the local machine.
    Please help me to grant permission for the applet coming from a particular source AND signed by a particulr person.
    Thanks in advance,
    Rajesh
    Note : Plug-in is java1.3.0_02. The public certificate is imported as trustcacerts in all cacerts files in system.

    This is the complete Error :
    WARNING: Attempting to use HTTP Firewall Proxy Server
    due to security restrictions: org.omg.CORBA.INTERNAL: Can not find GateKeeper: java.security.AccessControlException: access denied (java.net.SocketPermission localhost:15000 connect,resolve) minor code: 0 completed: No
    org.omg.CORBA.INTERNAL: Can not find GateKeeper: java.security.AccessControlException: access denied (java.net.SocketPermission localhost:15000 connect,resolve) minor code: 0 completed: No
         at com.visigenic.vbroker.gatekeeper.BridgeEx.login(BridgeEx.java:102)
         at com.visigenic.vbroker.gatekeeper.BridgeEx.loginHelper(BridgeEx.java:71)
         at com.visigenic.vbroker.gatekeeper.BridgeEx.bind(BridgeEx.java:200)
         at com.visigenic.vbroker.interceptor.ChainBindInterceptorImpl.bind(ChainBindInterceptorImpl.java:42)
         at com.visigenic.vbroker.orb.ORB.bind(ORB.java:1196)
         at com.visigenic.vbroker.orb.ORB.bind(ORB.java:1361)
         at com.visigenic.vbroker.orb.ORB.bind(ORB.java:1171)
         at com.platform7.persona.acceptor.GacHelper.bind(GacHelper.java:299)
         at com.platform7.persona.acceptor.GacHelper.bind(GacHelper.java:295)
         at GenericApplet.init(GenericApplet.java:40)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    org.omg.CORBA.INTERNAL: Can not find GateKeeper: java.security.AccessControlException: access denied (java.net.SocketPermission localhost:15000 connect,resolve) minor code: 0 completed: No

  • Change language on the security warning popup when using signed applets

    Hi
    Today when we use a signed applet the user get a security warning popup box where the langauge is English.
    Is it possible to change the language to other that English and if possible how can this be done ?
    Thanks in Advance,
    Henrik Rasmussen
    Denmark

    The Microsoft one is especially annoying because they should know better than to submit from secure to insecure.
    Let's say you are currently logged in to a Microsoft account and you click Sign in on MSDN. The site redirects to login.live.com, which recognizes that you are logged in, and generates a page with a hidden form and submits it back to MSDN using a script. This is where the problem is, because the hidden form action URL is not secure, yet it is on a secure page. (See Screen shots)
    The workaround (hack, whatever) is to modify the form to a secure address before it is submitted. How can you do that? Since it is impractical to do by hand, you can use an add-on.
    In an earlier thread, user thx1200 posted a link to a userscript that fixes this issue on login.live.com. The userscripts''.''org site has seemingly died, but there is a copy on a mirror of that site.
    * Earlier thread (long): [https://support.mozilla.org/questions/964250 How do disable this Warning? Although this page is encrypted, the information you have entered is to be sent over an unencrypted connection]
    * You need Greasemonkey to run user scripts: https://addons.mozilla.org/firefox/addon/greasemonkey/
    * User script install page: [http://userscripts-mirror.org/scripts/show/173384.html Fix security warning for Microsoft Live login]

  • How to read client's home directory files using  signed applets

    hi
    i want to konw the exact procedure for the creation of signed applets . using that i want to read my client files....
    Thanks
    Dileep

    google: http://www.google.com/search?q=how+to+sign+an+applet

  • Copy a .swf file from server side to client using signed applet

    Hello All,
    I already have my applet signed and its working pretty well. However I want to know how can I import a .swf file into clients machine. The .swf file initially is on server side, my applet checks whether this .swf file exists already on client machine. If not it copies it to his machine.
    I know how to chk if the file already exits on client machine but I am not sure how to copy this .swf file to his machine if its missing.
    May be I need to set some input buffers from server side and then copy them to his machine.
    Can some one throw some light on this issue ??

    Hello to all Java Code Masters out thr,
    I am trying to copy a .swf file from server side to client side, however I am unsuccessful in writing the correct data. By correct data I mean that , the data does gets saved on the client side in the .swf file, and the size of the .swf file on client side is as expected, but some how I don't know why the data is not the same as expected.
    I tried opening up both the swf file, one which is on server side and the other which is on client side. And both looked different in the notepad.
    When I opens up the client side .swf file on browser it shows nothing while the .swf file on server side worked fine.
    Here is a snap shot of the two .swf files when opened in notepad:
    clientside.swf
    坃ࡓ죃鱸뷤瀉�ᡚ穸s歒斷뛉쭬ⶲ뉯緤░뉋쭬틲��毳띵뺤畮祮୹釯烉쉍‼➀Ƿℵ㼤ꦅ㼌⡉⁈ș㖩䈼ꦓɊጵꨘ妆ၸ쇠鳳ﯯ龜괯䪅�쿾칿칷컹緶履殖㋿罣쯻杬�懨�E�翂䶙幷鿠︡拡ﬦ댨꾖政ᯋὣꯤ糥䧩缿䨗捫嶺깼瘶羋⯞勹쪾癞ঞ頁韧୘롻ⱖ撯貊攗閩㫙↳萰Ⳁ⼈쳂荡᧰ﻶ顠꓈鸎싔㿄㰧柂䪄러䂀좹㏠ꕊ㌏힟䘜㦴⌙⍈㽾ꙴ㿯렑㽔serverside.swf
    CWS�� x���     p��ZxzS�Rk�e��l��-o��}�%K�l�������]��ku���nu��nyy���pM�< �'�5!$����I
    (H �
    5<B
    ��J5��Yx��������/����J������w����}���
    k�2c��lg���a��\�%��serverside.swf is what I expect to be saved, but clientside.swf is what i get.
    Below is a code snippet which I am trying :
      public void writeswftoclient(String swfcontent) {
        String userHome = System.getProperty("user.home" );
        String ImoracleDirectory = userHome + "\\MyFolder";
        File fdirectory = new File(ImoracleDirectory);
        if(!fdirectory.isDirectory()) {
          fdirectory.mkdir();
        String playlist = ImoracleDirectory + "\\clientside.swf";
        File fplaylist = new File(playlist);
        try {
          Writer output = null;
          output = new BufferedWriter(new FileWriter(fplaylist,true));
          *System.out.println(swfcontent);*
          *output.write(swfcontent);*
          output.close();
        catch (Exception e) {
          System.out.println("Cannot create or write to the playlist");
      }In above code I am trying to write the string swfcontent, which contains the data shown above in serverside.swf, to clientside.swf.
    Interesting thing is that I am doing System.out.println(swfcontent); just before writing the data to clientside.swf using output.write(swfcontent);. And System.out.println does print the write data on the java console. However I dont know out of what reason the data doesnt get written correctly on the client's computer.
    Kindly help me in this plzzzzzzzzzz.

  • AccessControlException - in signed applet

    hi all,
    I am using signed applet, i given all permission and all socket permission , still i am getting following error.
    java.security.AccessControlException: access denied (java.net.SocketPermission 192.168.0.222:6060 connect,resolve)
         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.checkConnect(Unknown Source)
         at java.net.DatagramSocket.send(Unknown Source)
         at gov.nist.javax.sip.stack.UDPMessageChannel.sendMessage(UDPMessageChannel.java:727)
         at gov.nist.javax.sip.stack.UDPMessageChannel.sendMessage(UDPMessageChannel.java:572)
         at gov.nist.javax.sip.stack.SIPClientTransaction.sendMessage(SIPClientTransaction.java:355)
         at gov.nist.javax.sip.stack.SIPClientTransaction.sendRequest(SIPClientTransaction.java:759)
         at gov.nist.applet.phone.ua.MessengerManager.deRegister(MessengerManager.java:565)
         at gov.nist.applet.phone.ua.MessengerManager.unRegisterAndReRegister(MessengerManager.java:523)
         at gov.nist.applet.phone.ua.gui.NISTMessengerApplet.jMenuItemRegisterActionPerformed(NISTMessengerApplet.java:517)
         at gov.nist.applet.phone.ua.gui.NISTMessengerApplet.access$7(NISTMessengerApplet.java:503)
         at gov.nist.applet.phone.ua.gui.NISTMessengerApplet$5.actionPerformed(NISTMessengerApplet.java:424)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.AbstractButton.doClick(Unknown Source)
         at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
         at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)
         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.checkExit(Unknown Source)
         at java.lang.Runtime.exit(Unknown Source)
         at java.lang.System.exit(Unknown Source)
         at gov.nist.core.InternalErrorHandler.handleException(InternalErrorHandler.java:27)
         at gov.nist.javax.sip.stack.UDPMessageChannel.sendMessage(UDPMessageChannel.java:733)
         at gov.nist.javax.sip.stack.UDPMessageChannel.sendMessage(UDPMessageChannel.java:572)
         at gov.nist.javax.sip.stack.SIPClientTransaction.sendMessage(SIPClientTransaction.java:355)
         at gov.nist.javax.sip.stack.SIPClientTransaction.sendRequest(SIPClientTransaction.java:759)
         at gov.nist.applet.phone.ua.MessengerManager.deRegister(MessengerManager.java:565)
         at gov.nist.applet.phone.ua.MessengerManager.unRegisterAndReRegister(MessengerManager.java:523)
         at gov.nist.applet.phone.ua.gui.NISTMessengerApplet.jMenuItemRegisterActionPerformed(NISTMessengerApplet.java:517)
         at gov.nist.applet.phone.ua.gui.NISTMessengerApplet.access$7(NISTMessengerApplet.java:503)
         at gov.nist.applet.phone.ua.gui.NISTMessengerApplet$5.actionPerformed(NISTMessengerApplet.java:424)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.AbstractButton.doClick(Unknown Source)
         at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
         at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)

    Do you trust java exception handling mechanism ??? If so, check all yours given permission one more time, try to find work examples how to do it.
    Try to find the solution here: http://java.sun.com/developer/technicalArticles/Security/applets/index.html

  • Not Signed Applets can connect to another machine?

    hi, guys,
    I developed a java applet, which will connect to different machine.so the local machine will grant the applet some permissions.
    I did not use signed applet and want to make thing easier.
    In the policy file: I add
    grand {permission java.security.AllPermission };
    It works.
    but when I want to change to:
    grand codebase "http://www.xxx.com" {permission java.security.AllPermission};
    It does not work.
    Can anybody help me to solve this problme?
    Great thanks

    grant,not grand
    Also include the ipaddress, like 234.56.78.89 of www.xx.com

  • Jms signed applet with SP3

    Hi,
              I am using a thin client version of weblogic client & jms jars for my signed applet.I am getting an exception when I try to initialize the applet without closing the browser window. This was an issue in SP2 and was reportedly fixed in SP3 but for some reason I dont see it working.
              I am using 1.4.2_05 as the jre for my java plugin and 8.1 SP3 for my weblogic. I see the messages these messages being printed in the logs
              +++ <Warining> Don't have permissions to access ThreadGroup. We strongly recommend to use signed applet.
              +++ <Warining> Proceed further without creating ThreadGroup.
              +++ <Warining> Don't have permissions to access ThreadGroup. We strongly recommend to use signed applet.
              +++ <Warining> Proceed further without creating ThreadGroup
              This is the exception that gets thrown when you try to start the applet again without closing the browser window.
              javax.naming.NamingException: Unhandled exception in lookup [Root exception is org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 208 completed: Maybe]
                   at weblogic.corba.j2ee.naming.Utils.wrapNamingException(Utils.java:81)
                   at weblogic.corba.j2ee.naming.ContextImpl.lookup(ContextImpl.java:237)
                   at weblogic.corba.j2ee.naming.ContextImpl.lookup(ContextImpl.java:171)
                   at javax.naming.InitialContext.lookup(Unknown Source)
                   at com.vz.inms.client.applet.MyApplet.init(MyApplet.java:84)
                   at sun.applet.AppletPanel.run(Unknown Source)
                   at java.lang.Thread.run(Unknown Source)
              Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 208 completed: Maybe
                   at com.sun.corba.se.internal.iiop.IIOPConnection.purge_calls(Unknown Source)
                   at com.sun.corba.se.internal.iiop.ReaderThread.run(Unknown Source)
              But in my case, the applet is signed and I can see it in the trace as well as I get a prompt whether I want to accept the signed applet when the applet is about to be invoked. I have signed the applet using my own certificate instead of one from verisign or other CA's. I dont think it should matter.
              Does anyone know if this was really fixed in SP3?
              This is what documentation for resolved issues for 8.1 SP3 says :
              CR120811
              When using the WebLogic thin client with an applet, concurrentModificationExceptions and JMSExceptions were thrown. Investigation showed that there were two problems:
              There was a problem with the Sun ORB implementation. An applet's virtual machine released AppletContext upon a browser refresh and stopped all threads in the applet context's thread group. When an ORB was initialized as part of an applet context, the reader threads were created in the applet context's thread group. When the browser was refreshed, the ORB reader threads were also stopped.
              The WebLogic thin client created two threads in the applet context group: a HeartbeatMonitor thread and a RequestTimer thread. When the browser was refreshed, these threads were stopped with others in the applet context group.
              The problems were solved with the following changes:
              The Sun ORB implementation changed in JDK 1.4.2_04 so that it creates the reader threads on a child thread group of the system thread group but not to the applet's context thread group. This change ensures the reader thread stays alive as long as the orb is alive or applet's JVM is alive.
              The WebLogic thin client TunnelResponse and HeartbeatMonitor threads are now created on a child thread group of the system thread group but not to the applet's context thread group. This change ensures these threads stay alive as long as applet's JVM is alive. The fix is provided only for signed applets.
              I would really appreciate if someone could give any insight to this problem.
              Thanks,
              Jatinder

    I am also getting this error.
              BEA...is it possible to use an applet with JMS without signing it?

  • Signed Applet: NoClassDefFoundError

    I'm using a signed applet with a jar file. I have five class file in the jar file but when I try to run the applet in appletviewer it shows this error message:
    java.lang.NoClassDefFoundError: Project1$5
         at Project1.showFieldCombo(Project1.java:328)
         at Project1.ComboBoxShow(Project1.java:472)
         at Project1.init(Project1.java:489)
         at sun.applet.AppletPanel.run(AppletPanel.java:344)
         at java.lang.Thread.run(Thread.java:484)
    The jar file is in my classpath and all of the class files are listed in manifest file.
    (when I change the code to a JFrame and run it as an application it works but I want to connect a local database in a JApplet code and I have to use signed applet but it dosn't work)
    How can I solve this problem?
    Thanks a lot
    Payam

    The source code of showFieldCombo is (line num:328):
         public void showFieldCombo ()
              db.getTable("SELECT Fields FROM Fields ");
              Vector items = new Vector();
              for (int i=0; i<db.rows.size(); i++)
                   items.addElement( db.rows.elementAt( (i)));
              //--- Field Combo Box
              mycom.initFieldCombo(items);
              mycom.fieldCombo.addActionListener(new ActionListener()
                   public void actionPerformed ( ActionEvent e2)
                             if (reservoirTag == 1)
                                  c.remove(mycom.reservoirCombo);
                                  reservoirTag = 0;
                             if (wailTag == 1)
                                  c.remove(mycom.wailCombo);
                                  wailTag = 0;
                             showReservoirCombo();
              mycom.addFieldCombo(c);
              //show();
              validate();
              goToReport();
         }

  • Uploaded content modification detecting(from Signed Applet)

    Hello,
    I have a question about signed applets and content verification on client machine. Let's consider the following scenario:
    I have uploaded an image to client machine(using signed applet)
    Client have modified the image
    I want to detect that image was modified... And change it to default, stored in web host.
    Is there any way to identify modification? Or maybe there are some other tecniques of storing content to client's machine, not using raw resources?
    Thanks in advance.

    >
    Setting the proxy in the java control panel has no
    effect on the available system properties.
    Rather it has no impact on the VM that the applet runs in. Which is different than saying it has no impact at all.
    I suspect there is a file somewhere that controls the actual system values for applets.
    Given that an app should be able to detect the proxy
    settings of the person running it, how is this
    possible if the properties are not available from
    within the app?What exactly are you trying to do?
    An applet, which is not an app, normally has certain restrictions which would be sufficient for most apps.
    And the proxy setting impacts the VM, nothing else. So if the applet returns null then it means the VM has no setting. That doesn't mean that one or more proxies are not in the chain of communication. But you are not going to get those from the VM.

  • Is it necessary to have java installed on each system to run sign applet?

    I have successfully signed an applet, and I am using it from my website. I havesigned the applet digitally. But the problem is that it's run successfully on the system in which java is installed but it do not not run on the system on which java is not installed. There is warning java plug-ins missing. I have tried to run many banking website which is using signed applet from Trusted parties they run successfully. I have searched many tutorials and forums but not able to find any help.
    Thanks in advance.

    jsrpanky wrote:
    Thanks sabre,
    I think you are right, I know I'm right!
    because I was going through a article and found that it is possible to auto-download the Java Runtime Environment (JRE) onto the users machine.But I don't have any idea of how to auto-download JRE.
    Could you give me some hints so that I could some idea about this.Not really. I just put a link to the Sun site and ask the user to follow the directions. Google is your friend.

  • Signed Applet--please tell me something about the basics of it

    Hi guys .
    I am in the process of developing a GUI using an applet.The GUI involves reading a file given as input and parsing it for punctuaion errors.
    This applet has to write to a file called "errors.txt" to report about errors.I came to know from a friend that applets do not have access permissions to write files to disk .This feature can be achieved using Signed Applets .If there is anyone who can tell me about the basics of Signed Applets then please help me as to how I can make changes in my program and elsewhere so that my program is able to do that.
    My program is as follows(if youm need it):
    import java.io.*;
    import java.awt.*;
    import java.applet.*;
    public class textcopy extends Applet
    public void init()
    Choice ch=new Choice();
    ch.addItem("Click Next to continue.");
    ch.addItem("Framework Properties");
    Label l1=new Label(" ");
    Label nm=new Label("Please specify the errors that you want to be checked for in the file:");
    Label a1=new Label("Write the pathname here:");
    ta=new TextArea(1,20);
    B=new Button("OK");
    Checkbox b1=new Checkbox("Punctuation errors");
    Checkbox b2=new Checkbox("Finding whether a key string is misspelt");
    Label l2=new Label("Please select the key string from one of these:");
    add(a1);
    add(ta);
    add(B);
    add(l1);
    add(nm);
    add(b1);
    add(b2);
    add(l2);
    add(ch);
    TextArea ta;
    Button B;String str="";
    public boolean action(Event e,Object obj)
    if(e.target instanceof Button)
    repaint();
    return true;
    return false;
    public void paint(Graphics g)
    String s=ta.getText();
    try{
    FileReader fin=new FileReader(s);
    PrintWriter fout=new PrintWriter(new BufferedWriter(new FileWriter("c:\\avichal\\java\\errors.txt")));
    parse(fin,fout);
    fin.close();
    fout.close();
    catch(IOException e)
    Label avi=new Label("arsehole!!!");
    add(avi);
    //g.drawString("SOme Error",500,300);
    //e.printStackTrace();
    public static void parse(FileReader fin,PrintWriter fout)throws IOException
    String str="Punctuation Errors:\n"; /*Heading*/
    fout.println(str);
    fout.println("========================================================");
    int i=0,j=0,k=0,l=0;
    j=fin.read();
    do{
    do{
    i=j;
    j=fin.read();
    }while((!((char)i=='('&&(char)j=='R'))&&(j!=-1));
    if(j==-1)break;
    j=fin.read();
    j=fin.read();
    j=fin.read();
    j=fin.read();
    j=fin.read();
    j=fin.read();
    j=fin.read();
    char refnum[]=new char[5];
    l=0;
    while((char)j!=')')
    j=fin.read();
    if((char)j!=')')
    refnum[l++]=(char)j;
    fout.write("REF. NUM: ");
    for(int a=0;a<l;a++)fout.write(refnum[a]);fout.write(": ");
    j=fin.read();
    l=0;
    do{
    i=j;
    j=fin.read();
    if((char)i=='\n')
    k++;
    //'k' gives the line no. and finally the no. of lines and neglects the lines before first occurence of "Ref Num
    if(((char)i==',')&&((char)j!=' '))
    l++;
    String st=l+". error at line number "+ (k+1) + ": There should be "+
    "a space after comma(,) \n";
    fout.println(st);
    if(((char)i=='.')&&((char)j!=' '))
    l++;
    String st=l+". error at line number "+ (k+1) + ": There should be "+
    "a space after period(.) \n";
    fout.println(st);
    if(((char)i=='.')&&((char)j=='.'))
    l++;
    String st=l+". error at line number "+ (k+1) + ": There should not be "+
    "two periods(.) together \n";
    fout.println(st);
    if(((char)i==' ')&&((char)j=='.'))
    l++;
    String st=l+". error at line number "+ (k+1) + ": There should not be "+
    "a space before a period(.) \n ";
    fout.println(st);
    }while((!((char)i=='-' && (char)j=='T')) && j!=-1);
    fout.println(" ");
    /*if(l==0)
    fout.println("No errors!!!!");*/
    if(j==-1)break;
    }while(j!=-1);

    You need to understand many concepts before you start work on .
    Here is some useful links for you
    1. http://mindprod.com/jgloss/signedapplets.html
    2. http://java.sun.com/products/plugin/reference/codesamples/index.html examples of 1.4 plugin
    3. http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/contents.html
    4. http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/faq/basics.html
    5. http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/rsa_signing.html

  • Signed applet does not grant AudioPermission "record"

    From what I gather, if I have a trusted signed applet sitting on a webpage and
    the visitor accepts (runs) the applet, then they should not need to have:
    grant {
    permission javax.sound.sampled.AudioPermission "record";
    in their java policy file. Well I have done all this (with a certificate from
    Thawte) and posted a thorough example at:
    http://www.livesite.net/JavaSoundTest
    At the bottom of that page there is a "Check permissions" link which will alert
    true/false if we have record permission. Clicking any "Record" link will
    attempt to open a TargetDataLine.
    My experience (and problem) is: record permission must be granted even though
    the applet is signed by a trusted CA.
    I would very much appreciate any help.
    Are you able to record/playback (without granting record permission in your
    java policy files) with the JavaSoundTest applet webpage?
    Is there something I am missing?
    ------ More information ------
    Java Control Panel -> Advance -> Security
    'allow user to grant permissions to signed content' is checked
    Reproducable on:
    MS NT4 w/ IE6
    MS Windows 2000 w/ Firefox 1.5
    MS Windows XP w/ Firefox 1.5
    MS Windows XP w/ IE6
    Fedora FC6 w/ Firefox 2.0
    Also, this happens with a commented-out record permission in the user
    .java.policy file, or when the policy file does not exist.
    ------ Source code: opening the target data line ------
    Using the JavaSoundTest applet page without granted permission, clicking a
    record link will yield this exception in the java console:
    java.security.AccessControlException: access denied (javax.sound.sampled.AudioPermission record)
    at java.security.AccessControlContext.checkPermission
    at java.security.AccessController.checkPermission
    at java.lang.SecurityManager.checkPermission
    at com.sun.media.sound.JSSecurityManager.checkRecordPermission
    at com.sun.media.sound.DirectAudioDevice$DirectDL.implOpen
    at com.sun.media.sound.AbstractDataLine.open
    at net.livesite.jsound.Recorder.run(Recorder.java:161)
    while opening a TargetDataLine as:
    23 private static TargetDataLine line;
    157 line = (TargetDataLine) AudioSystem.getLine( lineInfo );
    158
    159 try
    160 {
    161 line.open( format, (int) format.getSampleRate() );
    162 }
    ------ Source code: Using the security manager ------
    The "Check permissions" link on the TestJavaSound applet page calls this method:
    191 public boolean hasSoundRecPriv()
    192 {
    193 boolean ret = false;
    194
    195 try
    196 {
    197 SecurityManager sm = System.getSecurityManager();
    198 if (sm != null)
    199 {
    200 sm.checkPermission(new AudioPermission("record"));
    201 }
    202 ret = true;
    203 }
    204 catch(SecurityException e)
    205 {
    206 ret = false;
    207 }
    208
    209 return ret;
    210 }
    (This is a continued post from JAVASOUND-INTEREST at SUN.COM)

    Is there something I am missing?1) Applets are not well supported by Sun,
    and are inherently problematic as a reult
    of that.
    2) My experience suggests that the diagnotics
    applet is not reliable for detecting JMF.
    3) I guess the JMF applet is doing checks of
    policy files, despite the signed code.
    You might circumvent most of these problems,
    by using web-start to launch an application.
    Here are some of my tests at launching
    JMF using web-start.
    http://www.javasaver.com/testjs/jmf/

  • Signed applet - NO Grant access dialog

    I've develped a signed applet which works with the java plugin 1.3.1 and a self signed certificate. while developing i followed the description from irene67 in this forum. every thing works perfektly apart from the grant access dialog. after installing my certificate and starting my applet nothing happens appart from an file.io.exceptino (access denied)! i've tried out everything i could find in about 200 articels in several forums. but in the meantime i have no idea what i can do! may be anybody can help me!

    At some point the Plug-in switched from using the Windows Certificate Manager to using the cacerts file. If you're using Plug-in 1.3.1, then it's using the cacerts file to determine whether the jar is signed with a certificate chain that ends with a trusted ca. Use keytool to import your certificate into cacerts. If you've already tried that, then maybe list the commands that you've issued in your attempt so we can have a look.

  • Signed Applet not loading on Mac OS X if using HTTPS protocol

    Hi All,
    I need to open a trusted applet on Mac OS 10.2. The applet works fine if using HTTP protocol. But if the protocol used is HTTPS the the applet does not loads and "javax.net.ssl.SSLException - untrusted server cert chain" exception comes on the console.
    The error comes for both - Verisign and javakey - signed applet.
    On seaching for possible solution on the net, i came across following link: http://www.macosxhints.com/article.php?story=20020525101202503&query=Workaround+for+secure+Java+applet+problems
    It says that this is Mac's known bug and gives the workaround as:
    1. Access the problematic site with Internet Explorer on Windows. Click on the padlock item and export the certificate to a file.
    2. Copy the certificate to your Mac.
    3. Use the command
    sudo keytool -import -trustcacerts -keystore /Library/Java/Home/lib/security/cacerts -file mycert.cer
    to import the certificate file to your keystore (substitute mycert.cer with the name of the file containing the certificate). The keystore is password protected - the default password is "changeit".
    4. Restart your browser
    But the client cannot be asked to do all this to run the applet.
    Is this problem being solved by Mac in their java implementation or is there any other possible solution?
    Thanx in advance.
    Regards,
    Charu

    I am experiencing the same problem - I notice it does not happen on OS9.2 using IE but appears a problem on all browsers on OSX
    Apple gave me the following reply.....
    Re: Bug ID# 3268633: cannot load applet class under https connection
    Hello Andrew,
    Thank you for bringing this problem to our attention. We have received feedback
    from engineering on your
    reported issue.
    Please know that to get Java to recognize the certificate you will need to do
    one of two things, depending
    on which VM you are using. Since you want it to work with Internet Explorer, we
    will assume Java 1.3.1.
    In Java 1.3.1 you'll need to add the certificate to
    /Library/Java/Home/lib/security/cacerts using
    /usr/bin/keytool to import the certificate into the certificate database.
    In Java 1.4.1 you should be able to just add the certificate to the keychain
    using certtool. For more
    details on how to do this, please refer to the information found at
    <http://java.sun.com/j2se/1.4.1/docs/tooldocs/solaris/keytool.html>. After
    doing so, if you should require
    further help from Apple in resolving this issue, we recommend that you request
    assistance from Developer
    Technical Support. This must be done by filing a Technical Support Incident.
    So I am supposed to tell every Mac user to do the above am I?!!!

Maybe you are looking for

  • Can I pass Chinese characters in a queue (Do queues support Unicode)?

    I am aware that there are a number of tools to allow the use of Chinese characters within LabVIEW. I have successfully built an application where I am able to switch between English and Chinese so that all screen text, buttons, multi-column list boxe

  • BW Interview questions very urgent

    Hai, Any body having faq about bw please send me,this is ver urgent,i'm waiting for ur reply plese send to this id [email protected] thanku naveen

  • Macbook pro running,lion will not boot

    My mac book,pro running lion will not complete the start up/boot have tried single user boot, and command v any ideas

  • 9iDS forms 9i gif icons won't display

    I have been on metalink and have yet to get a ggod answer on how to make my gif icons appear on my forms in 9iDS Forms 9i. I am on adevelopment machine and have modified my %ORACLE_HOME%\forms90\j2ee\orion-web.xml by addidng the folling lines: <virtu

  • Type, create outlines and merging questions

    Hi, I have type which I then I created outlines. Then I have this shape (a rectangle frame), I want to merge the two so I can bring an image into the combined shape. I cannot figure out how to merge the outlines text with this frame - is this even po