Using javascript to call a signed applet's read/write functions problem.

Hi, I wan't to use javascript to call the read/write functions of my signed java applet.
The applet can read/write fine, if its called from inside the applet, but when I make public functions to do the read/write and then call those functions from javascript, i get the old security exception.
Has anyone done this before?
Thanks

From what I understand is that for example file IO can only be done if the current method
has this privilege and the stack that called the current method had this privilege.
Javascript doesn't have any privilege and calling methods that do file IO directly from
javascript should not work, this bug was fixed in 1.4.2.
The workarround AccessController.doPrivileged(new PrivilegedAction() { might allso be
fixed in later versions since changing the privileges of currently executing code is
someting that should not be possible when the currently executing code is called from
"untrusted" (javascript) code.
http://forum.java.sun.com/thread.jsp?forum=63&thread=524815
second post

Similar Messages

  • IIS, Javascript, Signed Applet and ASP Blank Page Problem

    Hi,
    I'm having a problem using a Signed Applet in a site that runs in a IIS (Windows Server 2003).
    My aspx web page uses the applet to read my smart card and get information from it.
    This applet uses an auxiliar dll (stored in a second Signed Jar file) in order to read the information from my smart card.
    The way the solution is design:
    1) Aspx page is asked from server
    2) Internet Explorer recieve the page and asks the server for it content (images, applet, javascripts, etc)
    3) After this the JVM runs (console opens)
    4) After the Aspx page render fully a javascript register onload fires and call an applet method
    5) Applet receive the call and run the logic of the method:
         - reads the smart card;
         - calls Javascript function in order to fill aspx fields with information from smart card
         - calls Javascript function the simulates a click in a botton of aspx page (in order to call server side part sending data readed from smart card to server)
    5) The server makes some logic with the information receive and responds to client registering in aspx page a call to another Javascrit function
    6) The client received the asnwer from server and runs the Javascript function registered on step 5)
         This Javascript calls another method from applet and runs the following logic:
         - reads more information from smart card;
         - call javascript function in order to fill more fields of aspx page with the information readed
         - calls Javascript function the simulates a click in a botton of aspx page (in order to call server side part sending data readed from smart card to server)
    7) The server makes some logic and call another pages with no Applets
    8) Client asks for a second page with the same applet and we start with another logic express on steps 1);2);3),4);5) and then 7).
    This is all ok, until sometimes the server stop responding correcly for requests regarding this two pages with the Applet.
    When this happens the server just responds with a blank page.
         - with fiddler I can seer the request for the aspx page (that uses the applet)
         - but server responds with a blank html page
    The JVM doesn't fire.
    The IIS log don't show errors.
    The eventviewer doesn't show errors.
    The problem is solved with an IIS reset or a Application Pool reset.
    After a while the problem returns.
    This problem occours for other user in another machine, the server just stops responding correcly to request regarding pages with applets, the other pages still continue to work.
    If we disable Java Control Panel->Advanced->Java Plug-in->Enable the next-generation Java Plug-in the problem seend to stop, but we can't force all clients to disable this option right?
    Or there is a way to force the Applet to run with this option disabled?
    As anyone experience similar problem?
    Regards,
    OF

    This is all ok, until sometimes the server stop responding correcly for requests regarding this two pages with the Applet.
    When this happens the server just responds with a blank page.
    - with fiddler I can seer the request for the aspx page (that uses the applet)
    - but server responds with a blank html pageWell, if http requests look identical in case of success and failure (pay attention to cookies, etc) then it has to be something on the server side.
    It could be that server gets into this wrong state because of previous requests made by applet but it is hard to tell.
    I am not clear how old/new plugin can make a difference unless your applets run in the legacy mode (i.e. you are actually trying to reuse SAME instance of the applet when
    it is loaded next time).
    I'd start with
    1) carefully comparing good/bad sessions
    2) checking whether server will serve correct response to another client when it serves "bad" page for current client
    3) add debug statements to aspx - it is scripted page, may be some condition is not met and then it returns blank?
    4) record all http requests in one session until you get to "error" state and then use any http server testing tool to "replay" this set of requests.
    You should be able to get server into the same state without use of applet. Then you can try to tweak set of requests to see what makes a difference.

  • WebService call from signed applet and MS Vista

    Hi.
    I'M developing a system that needs to call web services from a signed applet.
    I have made the solution like this.
    The applet starts by checking that the 12 needed libs is present under the <java home>\lib\ext folder. if not it will download the files automatically and restart the browser.
    This works fine in Windows XP because the signed applet gives me read/write access to the whole machine, but in Vista this isn't possible anymore (as i understand it).
    My question: Is it possible to put these libs in another folder that the ext lib? I have tried to define the "archive" tag in my Object tag but i get the class not found exception thrown in my face.
    If there is a solution to this i would very much like some pointers!
    If not what can i do to get access to the <java home>\lib\ext folder under Vista?
    Regards
    Michael Pallesen

    When invokin applet methods via javascript, you are accessing privileged actions from an unsafe source.
    Depending on your needs, you could either load the system variables in applet init into class variables and return the information contained in the class variables to javascript or wrap the method calls inside AccessController.doPrivileged() calls.

  • How can i use the commapi in an signed applet

    I have a simple code of listing all system ports,
    the code works in a simple program
    but when I use it in a signed applet i have this error :
    java.lang.NoClassDefFoundError: javax/comm/CommDriver
    Thank you for your help

    Did you include the comm api jar file in the archive tag of your applet tag?
    something along the lines of:
    archive="myapplet.jar,commapi.jar"
    and make sure it is deployed in the same directory as your myapplet.jar.

  • Branch process using javascript to call popup

    I am on Windows Vista, Oracle XE and Apex 3.1.0.00.32.
    The branch works when using region based button.
    I wanted to use a "button displayed among this region's items" for a "button" list in the sidebar. I created a button and used a branch based on :REQUEST = 'button_name'. The branch fires but I get an error "Internet Explorer cannot display the webpage."
    HTML header code
    <script language="JavaScript" type="text/javascript">
    function popup(pURL, pwidth, pheight) {
    html_PopUp(pURL,"winLov",pwidth,pheight);
    </script>
    Branch Code
    javascript:popup('f?p=&APP_ID.:10012:&APP_SESSION.:&REQUEST.::10012:P10012_ISS_ID:&P10011_ISS_ID.',500,350);
    Since the code works in the URL redirect on a Button in a region position but not in a Branches redirect to a URL I assume this functionality does not work? Can anyone shed light on this? If it doesn't work I will need to find another solution....
    Thanks,
    Sam
    I did search and found a thread that intimates it should work.
    link:calling javascript on a branch is this possible
    Edited by: slavanaway on Mar 23, 2009 4:14 PM

    Luis,
    I see that I did not put more detail into the issue than the title.
    I am trying to call a popup from a button among region items. The user makes a selection then some custom DDL fires and the popup closes and the calling page is refreshed.
    A button among region items does not have a redirect to URL like a button in a region position. So I made the branch that was conditional on the button. I think I knew that a "branch" is server side. I don't understand why the jvascript URL does not work.
    A button in a region position and a list that redirects to a URL both work. I wanted the list to look like button in a vertical row.
    I now have the functionality working with a list.
    So I am coming to the mountain to get enlightenment. The Branches on a page can not use javascript is my guess and being eternally curious I was wondering why. I hope knowing will help me save time and produce better apps in the future.
    As for the actual behavior. When the Branch for the button amonth the region items fires. I would get the error message and the URL would only show apex flows. I don't have the exact URL as I dis-assembled the list and branches.
    I think the branch goes to the server but either the javascript is not passed or it does not handle the javascript.
    Tx,
    Sam

  • Use javascript to call actionscript

    Hello There,
    I have been using a really nice setup, from Phillip Hutchison
    to communticate from Captivate 3 using code swfs on a captivate
    slide that will communicate back to AS3 from AS2 (due to captivate
    3) via an as2 proxy .
    Would there be a way that I could use javascript on a
    captivate button (or object) that would call a function via the
    same process? Another way to say this, can I call an external
    callback function from javascript on a captivate button?
    Any tips will help,
    Thanks,
    eholz1

    Would there be a way that I could use javascript on a
    captivate button (or object) that would call a function via the
    same process?
    Yes.
    1. Create a function (say myJSfunction )inside the html(that
    loads the final CP swf.).
    2. Have the code to call the external interface function
    within myJSfunction.
    3. Set the action of button to execte JS and just have the
    java script as "myJSfunction();"
    4. Insert your code swfs on a captivate slide that will
    register the external callback function.
    Now when you click the button myJSfunction gets called which
    will call the external callback function inside your code swf.
    Also note that with CP4 you can publish directly to AS3 so
    you wont need to use the proxy any more.

  • Signed applet to open local file problem with IE6 / Firefox

    Hello
    I have a signed applet to open a local file, with this code :
    try{
       URL destination=null;
       File f=new File(adresse);
       destination=f.toURL();
       AppletContext ac=applet.getAppletContext();
       ac.showDocument(destination,"_blank");
    catch (MalformedURLException e)
       System.out.println(e.toString());
    ...It works perfectly with Netscape 7.01 and IE 5.5, but not with IE6.0 or Firefox 1.0...
    (using SUN JVM 1.4.2_04), and there is no trace/error message
    With a http link, it works for all browsers...
    try{
       URL destination=new URL("http://my.site/mypage.htm");
       AppletContext ac=applet.getAppletContext();
       ac.showDocument(destination,"_blank");
    catch (MalformedURLException e)
       System.out.println(e.toString());
    ...Any idea ??
    Thanks

    Hello again
    There's something I don't undestand...
    java applet code
    import java.applet.*;
    import java.net.*;
    public class test extends Applet {
         public void init() {
              try {          
                   String path = "file:/C:/Temp/";
                   URL destination = new URL(new URL(path) ,"test.jpg");
                   System.out.println("URL is now: " + destination.getPath() );          
                   AppletContext ac = this.getAppletContext();
                   ac.showDocument(destination, "_blank");
              } catch (Exception e) {
                   e.printStackTrace();
    html code
    <html>
    <head>
    <title>test</title>
    </head>
    <body>
    <applet CODE = "test.class" ARCHIVE = "sTest.jar" width=350 height=200></applet>
    </body>
    </html>
    Signature
    javac -classpath ".;D:\Program Files\Java\j2re1.4.2_04\lib\plugin.jar" test.java
    keytool -genkey -keystore mag -keyalg rsa -alias harm -validity 3600 -keypass password -storepass password
    jar cf0 test.jar *.class
    jarsigner -keystore mag -storepass password -keypass password -signedjar sTest.jar test.jar harm With a debug the signature looks good in the logs (translation by google, not sure of the correct words...)
    The checking of the certificate using the certificates CA root failed
    Piled up method
    Unstacked method
    Selected user: 0
    The user granted the rights of access to the code for this session only
    Addition of the certificate in the storage section of the certificates of session JPI
    Certificate added in the storage section of the certificates of session JPI
    Recording of the certificates in the storage section of the certificates of session JPI
    Certificates recorded in the storage section of the certificates of session JPI
    URL is now: /C:/Temp/test.jpg
    Javascript: Activated UniversalBrowserRead
    Javascript: Activated UniversalJavaPermission
    What are the 2 last line ?? (appears only in firefox, not in IE55...don't have another browser yet 'cause my graphic card and motherboard are out of order :-(
    Why in firefox, in the javascript console, there is a "message" (again translation by google...) but everything is alright in the java console ??
    Error of safety: the contents located at http://www.distantserver.com/Demo/test/test.html cannot charge of data or establish a bond towards file:///C:/Temp/test.jpg.
    Thanks in advance (and sorry if I only don't understand something from your link because of my english level...)

  • How to use Javascript NQSWENav calls between Apache/OBIEE and MS-IIS/Siebel

    Hoping someone can help me. We're upgrading systems, moving from Analytics 7.7 to OBIEE 10.1.3. Analytics Web used to sit on same IIS web server as Siebel CRM. In Analytics 7.7 I used:
    [html]"&lt;a href=\"javascript:NQSWENav('All Activity List View','Activity List Applet With Navigation','"@"'); \"&gt;"@" &lt;/a&gt; "
    to allow report links to open the CRM Activity window (where "@" was populated with the value of ROW_ID). This worked in an environment where both CRM & Analytics resided on the same Windows machine and shared the same IIS web server.
    We have now upgraded Analytics 7.7 to OBIEE 10.1.3, and have moved OBIEE to a much more robust AIX machine which runs an Apache web server. My users do not want to loose the functional ease of running a report in embedded Analytics, clicking a link, and navigating to the relevant CRM form.
    This functionality is no longer working in the new split environment. I'm not surprised by this, but would like to get it working again if possible. Does anyone know how to get this to work across hosts and web servers?

    Hi Redneck,
    the OBI web server and Siebel web server must share the same virtual IP. Excerpt from the original doc:
    [snip]Also, the host name for the Web server (or Virtual IP) serving content from the Siebel application server must match that for the Siebel Analytics Web Server, because the JavaScript Security model prevents a script on one server from affecting another.[snip]
    http://download.oracle.com/docs/cd/E12104_01/books/AnyInstAdm/AnyInstAdmnAppIntegrate12.html#wp1011778
    http://download.oracle.com/docs/cd/E12103_01/books/AnyWebAdm/AnyWebAdm_Dashboard4.html
    We had this already a couple of times and putting the two web servers under the same virtual IP will do the trick for you.
    Cheers,
    C.

  • Need signed applet to read a file in the jar?

    i have an applet and i need to read a file (just a picture .jpg) within the jar. but i got a security exception when i try to make the File object for this jpg
    thanks and sorry for my english

    Image image = Toolkit.getDefaultToolkit().getImage(getClass().getResorce("FileName.jpg"));i need to make something like this
    File file = new File("picture.jpg");
    the idea is verify that picture.jpg is really the picture that i put and not other with the same name... and if it is a file objet i can see the last modification date, to make a validation...
    another way is to read some pixels and verify that its colors dont change... but i dont know how to do this neither.
    but thanks anyway!

  • Want to know how to use Read/Write Functions

    Hi,
    I wrote a program in labview 8.5 for motion control. The program is working properly but I need to make it more advance than it currently is. What the program does is read the amount of degrees that user inputs and converts it into itinerations using a "For Loop"; when the rotation is done, the program stops. What I need to do now, is to make the program know the last data that the program read (i.e. 40 degrees,  270 degrees, etc.), and use it as an initial value ("Read" that value when the program starts); if the total amount of degrees is less than 360 degrees, then the program runs; if, is greater than 360, the program reads an error.
    I attached the program bellow.
    Thank you for all your help. If further information is needed, dont hesitate to ask. Thanks again.
    Guillermo 
    Attachments:
    Final Camera Program.vi ‏18 KB

    Lets begin with passing your references and errors through the loop with shift registers.
    We will only open the VISA reference once before entering the loop and close it when we leave the loop.
    If you use a shift register to keep track of the number of degrees rotated, you can pass the data out to an upper level VI and then back to this VI when it is called.  If you are simply using this VI to do everything, you can pass the data back and forth using a feedback node or a local variable (Please see notes within the VI I have attached.)
    Pleae look over the modified VI and verify that it will still work for your application.  You may need to add more functionality to get where you want to go; I think it is a good start.
    I am using LabVIEW 8.6 and I saved it to LabVIEW 8.5.
    CLD | CTD
    LabVIEW 2011 SP1 | TestStand 4.5
    Attachments:
    Final%20Camera%20Program (modified).vi ‏13 KB

  • Signed Applet and native code

    Hi all,
    I have an application which I deploy with webstart and includes native code. This all works perfectly with webstart. I now want to deploy it as an applet. This works accept for the native code. I have done heaps of searching and cannot determine the most appropriate way to make the native code visible to the applet.
    Ultimately I am at the point where i recieve a UnsatisfiedLinkError when calling loadLibrary(...) for the native code. Currently i have the native code (dll's for windows, so's for Solaris etc) in independent jars which are also signed (as needed for webstart).
    Could anyone give me some advise or a reference to more info on this topic.
    I am using Java 1.5 and am happy to use 1.6 if neccessary.
    Thanks,
    Dave

    Andrew - of course you were correct about the signed cert - I misspoke when the CA signed applet didn't show a warning. (You were also right that I must have checked 'always accept' the certificate on the server I had the CA signed cert on).
    I think you guys are on to something about the privileged actions. It would explain where one popup has the icon and the other doesn't. We have Javascript making calls into the applet and we do use JNI (although I don't think there are any calls back). We do wrap these calls in privileged actions but maybe we missed something. What I've seen before is a security exception is thrown if we don't wrap them - but maybe there are areas where we don't and it doesn't throw an exception or it does and we eat it somehow (and for whatever reason doesn't cause anything noticeable).
    Now that I know it could likely be the applet code and not necessarily a build issue with signing the jars, I have another place to look...
    I'll check it out and let you know what I find.

  • Signed Applet ClassNotFoundException

    I'm new to signed Applets and have ran into problems getting my Applet to load with IE Version 6. I create my jar (GUI.jar) and sign it using jarsigner and verify that the jar has a signature (see below).
    C:\mykeytools>jarsigner -keystore keys/my.keystore GUI.jar myalias
    Enter Passphrase for keystore:
    C:\mykeytools>jarsigner -verify -verbose GUI.jar
    272 Fri Jul 04 21:44:12 MDT 2008 META-INF/MANIFEST.MF
    439 Fri Jul 04 21:44:14 MDT 2008 META-INF/MYALIAS.SF
    925 Fri Jul 04 21:44:14 MDT 2008 META-INF/MYALIAS.RSA
    sm 3459 Wed Jul 02 19:48:16 MDT 2008 GUI.class
    sm 2937 Wed Jul 02 19:48:16 MDT 2008 GUI.java
    sm 232 Fri Jun 27 13:09:56 MDT 2008 .classpath
    sm 379 Fri Jun 27 13:09:56 MDT 2008 .project
    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.
    C:\mykeytools>
    I'm using the following in my HTML file:
    <APPLET CODE ="GUI.class" codebase = "." archive=&rdquo;GUI.jar" WIDTH=200 HEIGHT=253>
    </APPLET>
    I have also tried using the following HTML and get the same results:
    <APPLET CODE ="GUI.class" archive=&rdquo;GUI.jar" WIDTH=200 HEIGHT=253>
    </APPLET>
    The signed jar file and HTML file are in the same directory. When I execute the HTML file I get the following error:
    Java Console messages:_
    basic: Exception: java.lang.ClassNotFoundException: GUI.class
    java.lang.ClassNotFoundException: GUI.class
    at sun.applet.AppletClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadCode(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)
    Any guidance on this is appreciated.

    I found that the problem was something in my HTML file.
    The HTML that works is:
    <html>
    <head>
    <meta HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
    <meta HTTP-EQUIV="Expires" CONTENT="-1">
    <title> Applet Test</title>
    </head>
    <applet code="GUI"
    archive="GUI.jar"
    width=400 height=300>
    </applet>
    <p><img border="0" src="Company.jpg" width="326" height="88"></p>
    </html>

  • Read/write table rather than calling BAPI

    Hi experts,
    I need set "Deliv. compl." flag as true .
    set NOMOREGR='X' when call BAPI_GOODSMVT_CREATE
    I want to read/write table rather than calling BAPI, but I don't know what's the table,what's the field.
    who can tell me?  How to find that?
    I pressed "F1" key in the checkbox (Deliv. compl. flag), then I clicked "Technical infomation", and I got "MEPO1313-ELIKZ", but it's a struct, not a table.
    Many thanks.

    I happened to recall something about MEPO from way back when.... and the "EPO" suggested EKPO and EKKO to me...
    However, I utilize WHERE-USED function a lot.  For instance, in this case, one might go into SE11, enter ELIKZ into the data type field, and select WHERE-USED.  This takes a bit of research since field ELIKZ is used often as completion indicator, LOEKZ as deletion indicator, etc.
    Best wishes,
    Dave

  • How to programmatically read/write the range of a fieldpoint AI channel using LV

    Is there a way to programmatically read/write the range of a fieldpoint AI channel using LV ? The example on NI site only permit you to have the name of the device and channels, not the actual set of the range of measure. Anybody has a VI (LV5.1 please)to share?
    Thank you very much

    If you are using the FieldPoint VI's (Open, Create Tag, Read, Write, Advise), you do not have the ability to change the range of a channel. If you have a FP-1000 or FP-1001, you can use the Optomux commands as described in the FP-1000/1001 Programmers Reference Manual (FieldPoint Optomux VI's are available at ftp://ftp.ni.com/support/fieldpoint/LVFPOpto/ ).
    Alternatively, if you have an ethernet network module and LabVIEW 6i or later, you can use the ethernet configuration VI's that ship with FieldPoint Explorer 3.0.1.
    Regards,
    Aaron

  • Read/Write from an Applet

    hi,
    I need to read/write from/to a file from an Applet. Reading is no Problem. Actually writing is!
    I have try it but I get some problems with the getOutputStream function.
    Can everybody send me an simple example.

    You are right and I have try it.
    There are some guys with the same problem but there are no answers to the specified problem.

Maybe you are looking for

  • Not able to Book Sales Order.

    Hi, I ahve entered the order information. When i am trying to Book it, I am getting the below error:The Booking Activity has errored out, please contact your System Administrator. Can anyone help me with a solution for this. Regards, Sravan.

  • Default Sort order for Search and Advanced Search

    Does anybody know of any easy way to default search to show results by "last modified date" ? Much thanks, ~Kevin.

  • Itune showing white screen(ipad3)

    itune showing white screen after upadating my iPad3 to iOS6. does anyone have a solution for it or facing same problem. seems like iOS6 has some issues better not to update.

  • Problems working with source files

    Just downloaded the new 1343 release. Really like the product. But ... working with source files in SQL Developer is my worst nightmare. When I open a source file either from SQL Worksheet or from File/Open menu my PC freezes for an extended period o

  • MacBook Pro running slow even after RAM update.

    I upgraded from 512 to 2GB of memory because Mac was running slow such as applications would some times take forever to open especially files on quicktime. After the upgrade though i have the same problem, Slow performance. Any advice or solutions?