Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.security

Class Security

java.lang.Object
|
+--java.security.Security


public final class Security

extends Object

Security class that loads the Providers and provides an interface to security properties.

Author:

Method Summary

static intaddProvider(java.security.Provider provider)

Adds a provider to the next position available.
static java.lang.StringgetAlgorithmProperty(java.lang.String algName, java.lang.String propName)

Gets a specific property for an algorithm.
static java.lang.StringgetProperty(java.lang.String key)

Gets the value of a security property.
static java.security.ProvidergetProvider(java.lang.String name)

Returns the provider with the specified name.
static java.security.Provider[]getProviders()

Returns array containing all the providers.
static intinsertProviderAt(java.security.Provider provider, int position)

Adds a new provider, at a specified position.
static voidremoveProvider(java.lang.String name)

Removes a provider.
static voidsetProperty(java.lang.String key, java.lang.String datnum)

Sets the value of a security property.

Method Details

addProvider

public static int addProvider(java.security.Provider provider)

Adds a provider to the next position available.

NOT IMPLEMENTED YET: [ First, if there is a security manager, its checkSecurityAccess method is called with the string "insertProvider."+provider.getName() to see if it's ok to add a new provider. If the default implementation of checkSecurityAccess is used (i.e., that method is not overriden), then this will result in a call to the security manager's checkPermission method with a SecurityPermission( "insertProvider."+provider.getName()) permission.]

Parameters:

Returns:

Throws:


getAlgorithmProperty

public static String getAlgorithmProperty(java.lang.String algName, java.lang.String propName)

Gets a specific property for an algorithm. This is used to produce specialized algorithm parsers.

Parameters:

Returns:


getProperty

public static String getProperty(java.lang.String key)

Gets the value of a security property. This method checks the security manager with the call checkSecurityAccess with "getProperty."+key to see if the user can get this property.

Parameters:

Returns:

Throws:


getProvider

public static Provider getProvider(java.lang.String name)

Returns the provider with the specified name. It will return null if the provider cannot be found.

Parameters:

Returns:


getProviders

public static Provider[] getProviders()

Returns array containing all the providers. It is in the preference order of the providers.

Returns:


insertProviderAt

public static int insertProviderAt(java.security.Provider provider, int position)

Adds a new provider, at a specified position. The position is the preference order in which providers are searched for requested algorithms. Note that it is not guaranteed that this preference will be respected. The position is 1-based, that is, 1 is most preferred, followed by 2, and so on.

If the given provider is installed at the requested position, the provider that used to be at that position, and all providers with a position greater than position, are shifted up one position (towards the end of the list of installed providers).

A provider cannot be added if it is already installed.

NOT IMPLEMENTED YET:[ First, if there is a security manager, its checkSecurityAccess method is called with the string "insertProvider."+provider.getName() to see if it's ok to add a new provider. If the default implementation of checkSecurityAccess is used (i.e., that method is not overriden), then this will result in a call to the security manager's checkPermission method with a SecurityPermission( "insertProvider."+provider.getName()) permission.]

Parameters:

Returns:

Throws:


removeProvider

public static void removeProvider(java.lang.String name)

Removes a provider. This allows dynamic unloading of providers. It will automatically shift up providers to a higher ranking. If the provider is not installed, it fails silently. This method checks the security manager with the call checkSecurityAccess with "removeProvider."+provider.getName() to see if the user can remove this provider.

Parameters:

Throws:


setProperty

public static void setProperty(java.lang.String key, java.lang.String datnum)

Sets the value of a security property. This method checks the security manager with the call checkSecurityAccess with "setProperty."+key to see if the user can get this property.

Parameters:

Throws: