Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 360
  • Last Modified:

File IO Permissions (Microsoft Java VM)

I have written an applet which works perfectly if I compile and sign it using Suns SDK utilities. Though, I want it to run under Microsoft Java VM as well, but if I compile and sign the code using the MS SDK for Java 4.0 utilities, I get an exception when running the applet "com.ms.security.SecurityExceptionEx".

What the applet does is, it accesses a file on the users local harddrive. So I need IO R/W permissions.

How do I go about making my applet work under MS Java VM?

Thanks in advance.
0
NeuRo
Asked:
NeuRo
1 Solution
 
objectsCommented:
How do you sign the cab?
0
 
objectsCommented:
Should be something like:


REM First, create the CAB file. The arguments here are:
REM    -r        Recurse into subdirectories
REM    -p        Preserve path names
REM    -P [arg]  Strip the argument (here "%1\") from the beginning of each path
REM    N  [arg]  Create the given named .cab file
REM    [rest]    Put these files (here "%1\*.*") into the .cab file
REM Note! this does NOT use the -s option to reserve space for the signature;
REM the latest version of signcode (from the Java SDK 2.01) doesn't need this.
ECHO *********** About to create .cab archive using cabarc ***********
cabarc -r -p -P src\ N objects.cab src\*.class

REM Next, sign the code. Arguments are:
REM    -j javasign.dll    This provides the tools to do Java permission levels
REM    -jp  [arg]         The permission level to be used
REM    -spc [arg]         Software publishing certificate file
REM    -v   [arg]         Private key file
REM    -n   [arg]         Nice name of archive (shown in digital ID dialog)
REM    [arg]              Archive file to be signed (here "%1.cab")
ECHO *********** About to sign archive using signcode ***********
signcode -j javasign.dll -jp low -spc objects.spc -v objects.pvk -n au.com.objects.MyApplet objects.cab
0
 
NeuRoAuthor Commented:
objects:

Cheers for the reply.
The way I sign my cab file is:

PATH=%PATH%;C:\Program Files\Microsoft SDK For Java 4.0\Bin
jvc /g:l myApplet.java
cabarc N myApplet.cab myApplet.class
makecert -sk myApplet -n "CN=NeuRo" myApplet.cer
cert2spc myApplet.cer myApplet.spc
signcode -j JavaSign.dll -jp High -spc myApplet.spc -k myApplet -n "myApplet" -i http://www.xxx.dk/ myApplet.cab

It is some what like  the way you do it ... Though, I don't have the same options as you in the cabarc. In signcode i use -jp High - should it be low to have the correct IO Permissions?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
NeuRoAuthor Commented:
I should not make any corrections to my Java code, right? I should be able to use the exact same code with Suns JRE and Microsofts JVM, am I right?
0
 
objectsCommented:
> I should not make any corrections to my Java code, right?

correct.

> I should be able to use the exact same code with Suns
> JRE and Microsofts JVM, am I right?

correct, but one will run a cab, the other a jar.

what does your html look like?

0
 
NeuRoAuthor Commented:
My HTML looks like this:

<APPLET MAYSCRIPT="true" ID="JRK" NAME="JRK" CODE="myApplet.class" WIDTH=100 HEIGHT=100>
<PARAM name="cabbase" VALUE="myApplet.cab">
</APPLET>
0
 
NeuRoAuthor Commented:
My HTML looks like this:

<APPLET MAYSCRIPT="true" ID="JRK" NAME="JRK" CODE="myApplet.class" WIDTH=100 HEIGHT=100>
<PARAM name="cabbase" VALUE="myApplet.cab">
</APPLET>
0
 
NeuRoAuthor Commented:
I actually got the thing working now .. Or .. Almost that is. I can run my methods to read/write the file from within my applet, but as soon as I try to access my methods from JavaScript I get this security exception: "com.ms.security.SecurityExceptionEx[Unknown]: cannot access the file c:\test.txt"

The funny thing is that when I compiled and signed it with Suns tools I could run these methods from JavaScript, which is the whole point of my applet. But how come I can't do it when it is compiled and signed with Microsofts tools???

0
 
objectsCommented:
> I can run my methods to read/write the file from within my applet

What did u change?

> as soon as I try to access my methods from JavaScript

are you saying if you call the applet from js u get an exception, but not if the applet runs the method directly.

> I compiled and signed it with Suns tools

How did you create cab using Sun tools?

0
 
CleanupPingCommented:
NeuRo:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
girionisCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Points to objects

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

girionis
EE Cleanup Volunteer
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now