File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Enabling a security manager for a single jar

 
Dave Koontz
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a signed applet that serves as a front-loader that will load code from a user provided jar. My applet is signed as it needs to interface with native libraries, but I want the user provided jar to be sandboxed. I looked at the Security Manager and it seems you can apply restrictions to a particular package although I will have no control over their naming so that doesn't work. This document (http://java.sun.com/developer/TechTips/2000/tt0926.html) indicated that it was possible, though difficult, to get information about the source of certain classes via the URLClassLoader which I assume would be used when loading my applet files. My biggest question is, can a Security Manager installed by my signed applet restrict the permissions for code loaded from an unsinged (or signed with a different certificate) jar file, and if so, where would I look for information on this?

David Koontz
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's possible to use a SecurityManager for just those classes that are loaded by a particular ClassLoader. See this article (written by, ahem, yours truly) for how that works in a desktop app.

A problem could be that the Applet JVM installs a SecurityManager already; I'm not sure if it's possible to set a different one (even though the applet is signed and should have all the permissions). But a quick test will tell you for sure.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic