xjava.security
Class IJCE_SecuritySupport

java.lang.Object
  |
  +--xjava.security.IJCE_SecuritySupport

class IJCE_SecuritySupport
extends java.lang.Object

This class is used to make any security checks needed by IJCE (for example when adding and removing security providers). It is needed to work around some nasty compatibility problems that would otherwise arise from supporting Java 1.0.2, Java 1.1 and Netscape simultaneously.

Copyright © 1997 Systemics Ltd on behalf of the Cryptix Development Team.
All rights reserved.

$Revision: 1.6 $

Since:
Cryptix 2.2.2
Author:
David Hopwood, Raif S. Naffah

Method Summary
(package private) static void ()
           
(package private) static void checkPrivilegeEnabled(java.lang.String targetname, int depth)
          On VMs that support Netscape's PrivilegeManager extensions, this checks that the security privilege with name targetname has been enabled.
(package private) static void checkPrivilegeEnabled(Target target, int depth)
          On VMs that support Netscape's PrivilegeManager extensions, this checks that the privilege given by target has been enabled.
(package private) static void checkPrivilegeEnabled(Target target, java.lang.Object arg, int depth)
          On VMs that support Netscape's PrivilegeManager extensions, this checks that the privilege given by target, with parameter arg has been enabled.
(package private) static void checkSystemCaller(int depth)
          If a SecurityManager is installed, this method checks that there is no class loaded by a ClassLoader in the previous depth stack frames.
(package private) static Target findTarget(java.lang.String name)
          Returns a Target that can be passed to PrivilegeManager.enablePrivilege(...), in order to request permission for an action that requires the user's trust.
(package private) static Target findTarget(java.lang.String name, java.lang.Object arg)
          Reserved for future use, in case parameterized targets are needed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

static void ()

findTarget

static Target findTarget(java.lang.String name)
                  throws ForbiddenTargetException
Returns a Target that can be passed to PrivilegeManager.enablePrivilege(...), in order to request permission for an action that requires the user's trust.
Parameters:
name - the name of the target to be returned
Returns:
the Target object
Throws:
ForbiddenTargetException - if name is not recognized.
See Also:
java.security.IJCE#findTarget(java.lang.String)

findTarget

static Target findTarget(java.lang.String name,
                         java.lang.Object arg)
                  throws ForbiddenTargetException
Reserved for future use, in case parameterized targets are needed. Currently this always throws a ForbiddenTargetException.
Parameters:
name - the name of the target to be returned
arg - a parameter object
Returns:
the Target object
Throws:
ForbiddenTargetException - if name is not recognized.
See Also:
java.security.IJCE#findTarget(java.lang.String, java.lang.Object)

checkPrivilegeEnabled

static void checkPrivilegeEnabled(java.lang.String targetname,
                                  int depth)
On VMs that support Netscape's PrivilegeManager extensions, this checks that the security privilege with name targetname has been enabled. On other VMs, it is equivalent to IJCE_SecuritySupport.checkSystemCaller(depth).

For example,

IJCE_SecuritySupport.checkPrivilegeEnabled("AddSecurityProvider", 1)

On Netscape this will check that the "AddSecurityProvider" privilege has been enabled. On other VMs it will check that either no security manager is installed, or the immediate caller is a system class.


checkPrivilegeEnabled

static void checkPrivilegeEnabled(Target target,
                                  int depth)
On VMs that support Netscape's PrivilegeManager extensions, this checks that the privilege given by target has been enabled. On other VMs, it is equivalent to IJCE_SecuritySupport.checkSystemCaller(depth).

For example,

IJCE_SecuritySupport.checkPrivilegeEnabled(target, 1)

On Netscape this will check that the target privilege has been enabled. On other VMs it will check that either no security manager is installed, or the immediate caller is a system class.


checkPrivilegeEnabled

static void checkPrivilegeEnabled(Target target,
                                  java.lang.Object arg,
                                  int depth)
On VMs that support Netscape's PrivilegeManager extensions, this checks that the privilege given by target, with parameter arg has been enabled. On other VMs, it is equivalent to IJCE_SecuritySupport.checkSystemCaller(depth).
See Also:
checkPrivilegeEnabled(netscape.security.Target, int)

checkSystemCaller

static void checkSystemCaller(int depth)
If a SecurityManager is installed, this method checks that there is no class loaded by a ClassLoader in the previous depth stack frames. If there is no SecurityManager, it returns silently.

For example,

IJCE_SecuritySupport.checkSystemCaller(1)
will check that either no security manager is installed, or the immediate caller is a system class.