Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Security / March 2004

Tip: Looking for answers? Try searching our database.

help: signed applet not working anymore...

Thread view: 
FB - 29 Mar 2004 21:15 GMT
I have a signed applet that is compiled for MS and Sun VMs....

The one compiled for MS uses

PolicyEngine.assertPermission(PermissionID.NETIO);

to allow access to web sites different from the one where the applet is
based...

For Sun's VM I didn't use anything, those lines where removed and everything
worked fine... till now...

Now I'm getting this error:

java.security.AccessControlException: access denied
(java.net.SocketPermission somehost.somedomain.com resolve)

Why did it stop working?
How can I fix it?

I'm using JRE 1.4.2_03

Thanks

FB

--
Roedy Green - 30 Mar 2004 04:20 GMT
>PolicyEngine.assertPermission(PermissionID.NETIO);

You need two different executables.  One has the calls to MS
permission requests, the other does not.  One is signed with the
obsolete authenticode. The other with an RSA cert.

Is that what you have?

When you ran it, did you ok permission?

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
FB - 30 Mar 2004 19:18 GMT
: >PolicyEngine.assertPermission(PermissionID.NETIO);
:
[quoted text clipped - 10 lines]
: Coaching, problem solving, economical contract programming.
: See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Yes, that's what I have...

I found out what is not working...

This applet is multi-threaded and several threads are running and connecting
to different servers... everything works fine...

The problem happens (only on Sun's VM) when a method, called from the web
page, must connect to a server and return some data...

this is the method structure...

public String method(int data)
{
 BufferedReader in;
 URLConnection c;
 String line, aswer;
 URL u;

 try
 {
  line = "http://www.domain.com/page.asp?data=" + i;
  u = new URL(line);
  try
  {
   c = u.openConnection();
   try
   {
    in = new BufferedReader(new InputStreamReader(c.getInputStream()));
    answer = in.readLine();
    in.close();
   }
   catch(IOException ioe)
   {
    return "error";
   }
  }
  catch(IOException ioe)
  {
   return "error";
  }
 }
 catch(MalformedURLException e)
 {
  return "error";
 }

 return answer;

}

again, works fine under MS VM (with the required permissions)...

Seems that Sun's VM doesn't allow a javascript code to call a method that
connects to another server...

Is there a way to avoid this?

Thanks for any help...

FB
Roedy Green - 30 Mar 2004 22:33 GMT
>Seems that Sun's VM doesn't allow a javascript code to call a method that
>connects to another server...

I wish the Javascript people had used a different name.  Half the time
when people say JavaScript they mean Java.  

All I can tell you is that ordinary Java Applets can only talk to the
server from which they were loaded unless they are signed and have
permission to talk to "strangers".

If you screwed up your signing, you would never notice till you
started trying to talk to multiple servers.

Interaction between JavaScript and Java is a dark art, a forbidden
subject akin to interspecies sex.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.