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.
-
addProvider(Provider)
- Adds a provider to the next position available.
-
getAlgorithmProperty(String, String)
-
Gets a specified property for an algorithm.
-
getProperty(String)
- Gets a security property.
-
getProvider(String)
- Returns the provider installed with the specified name, if
any.
-
getProviders()
- Returns all providers currently installed.
-
insertProviderAt(Provider, int)
- Adds a new provider, at a specified position.
-
removeProvider(String)
- Removes the provider with the specified name.
-
setProperty(String, String)
- Sets a security property.
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.
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
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
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
getProviders
public static Provider[] getProviders()
- Returns all providers currently installed.
- Returns:
- an array of all providers currently installed.
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
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.
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