All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.security.Security

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

public final class Security
extends Object

This class centralizes all security properties and common security methods. One of its primary uses is to manage providers.


Method Index

 o addProvider(Provider)
Adds a provider to the next position available.
 o getAlgorithmProperty(String, String)
Gets a specified property for an algorithm.
 o getProperty(String)
Gets a security property.
 o getProvider(String)
Returns the provider installed with the specified name, if any.
 o getProviders()
Returns all providers currently installed.
 o insertProviderAt(Provider, int)
Adds a new provider, at a specified position.
 o removeProvider(String)
Removes the provider with the specified name.
 o setProperty(String, String)
Sets a security property.

Methods

 o getAlgorithmProperty
 public static String getAlgorithmProperty(String algName,
                                           String propName)
Gets a specified property for an algorithm. The algorithm name should be a standard name. See Appendix A in the Java Cryptography Architecture API Specification & Reference for information about standard algorithm names. One possible use is by specialized algorithm parsers, which may map classes to algorithms which they understand (much like Key parsers do).

Parameters:
algName - the algorithm name.
propName - the name of the property to get.
Returns:
the value of the specified property.
 o insertProviderAt
 public static int insertProviderAt(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. Sometimes it will be legal to add a provider, but only in the last position, in which case the position argument will be ignored.

A provider cannot be added if it is already installed.

Parameters:
provider - the provider to be added.
position - the preference position that the caller would like for this provider.
Returns:
the actual preference position in which the provider was added, or -1 if the provider was not added because it is already installed.
See Also:
getProvider, removeProvider
 o addProvider
 public static int addProvider(Provider provider)
Adds a provider to the next position available.

Parameters:
provider - the provider to be added.
Returns:
the preference position in which the provider was added, or -1 if the provider was not added because it is already installed.
See Also:
getProvider, removeProvider
 o removeProvider
 public static void removeProvider(String name)
Removes the provider with the specified name. This method returns silently if the provider is not installed.

Parameters:
name - the name of the provider to remove.
See Also:
getProvider, addProvider
 o getProviders
 public static Provider[] getProviders()
Returns all providers currently installed.

Returns:
an array of all providers currently installed.
 o getProvider
 public static Provider getProvider(String name)
Returns the provider installed with the specified name, if any. Returns null if no provider with the speicified name is installed.

Parameters:
name - the name of the provider to get.
Returns:
the provider of the specified name.
See Also:
removeProvider, addProvider
 o getProperty
 public static String getProperty(String key)
Gets a security property.

Parameters:
key - the key of the property being retrieved.
Returns:
the valeu of the security property corresponding to key.
 o setProperty
 public static void setProperty(String key,
                                String datum)
Sets a security property.

Parameters:
key - the name of the property to be set.
datum - the value of the property to be set.

All Packages  Class Hierarchy  This Package  Previous  Next  Index

Submit a bug or feature