|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.security.Security
public final class Security
This class centralizes all security properties and common security methods. One of its primary uses is to manage security providers.
Method Summary | |
---|---|
static int |
addProvider(Provider provider)
Appends the designated new Provider to the current list of
installed Provider s. |
static String |
getAlgorithmProperty(String algName,
String propName)
Deprecated. Use the provider-based and algorithm-independent AlgorithmParameters and KeyFactory engine
classes instead. |
static Set<String> |
getAlgorithms(String serviceName)
For a given service (e.g. |
static String |
getProperty(String key)
Returns the value associated with a Security propery. |
static Provider |
getProvider(String name)
Returns an already installed Provider given its name. |
static Provider[] |
getProviders()
Returns the current list of installed Provider s as an array
ordered according to their installation preference order. |
static Provider[] |
getProviders(Map<String,String> filter)
Returns an array of currently installed Provider s which satisfy a
set of selection criteria. |
static Provider[] |
getProviders(String filter)
Returns an array of currently installed Provider s, ordered
according to their installation preference order, which satisfy a given
selection criterion. |
static int |
insertProviderAt(Provider provider,
int position)
Inserts a new designated Provider at a designated (1-based)
position in the current list of installed Provider s, |
static void |
removeProvider(String name)
Removes an already installed Provider , given its name, from the
current list of installed Provider s. |
static void |
setProperty(String key,
String datum)
Sets or changes a designated Security property to a designated value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static String getAlgorithmProperty(String algName, String propName)
AlgorithmParameters
and KeyFactory
engine
classes instead.
algName
- the algorithm name.propName
- the name of the property to return.
null
if none
found.public static int insertProviderAt(Provider provider, int position)
Provider
at a designated (1-based)
position in the current list of installed Provider
s,
provider
- the new Provider
to add.position
- the position (starting from 1) of where to install
provider
.
-1
if provider
was laready in the
list. The actual position may be different than the desired
position
.
SecurityException
- if a SecurityManager
is installed and it disallows this
operation.getProvider(String)
,
removeProvider(String)
,
SecurityPermission
public static int addProvider(Provider provider)
Provider
to the current list of
installed Provider
s.
provider
- the new Provider
to append.
provider
in the
current list of Provider
s, or -1
if
provider
was already there.
SecurityException
- if a SecurityManager
is installed and it disallows this
operation.getProvider(String)
,
removeProvider(String)
,
SecurityPermission
public static void removeProvider(String name)
Provider
, given its name, from the
current list of installed Provider
s.
name
- the name of an already installed Provider
to remove.
SecurityException
- if a SecurityManager
is installed and it disallows this
operation.getProvider(String)
,
addProvider(Provider)
public static Provider[] getProviders()
Provider
s as an array
ordered according to their installation preference order.
public static Provider getProvider(String name)
Provider
given its name.
name
- the name of an already installed Provider
.
Provider
known by name
. Returns
null
if the current list of Provider
s does
not include one named name
.removeProvider(String)
,
addProvider(Provider)
public static String getProperty(String key)
key
- the key of the property to fetch.
key
. Returns null
if no such property
was found.
SecurityException
- if a SecurityManager
is installed and it disallows this
operation.setProperty(String, String)
,
SecurityPermission
public static void setProperty(String key, String datum)
key
- the name of the property to set.datum
- the new value of the property.
SecurityException
- if a SecurityManager
is installed and it disallows this
operation.getProperty(String)
,
SecurityPermission
public static Set<String> getAlgorithms(String serviceName)
Set
of all available algorithm names (instances
of String
, from all currently installed Provider
s.
serviceName
- the case-insensitive name of a service (e.g. Signature,
MessageDigest, etc).
Set
of String
s containing the names of all
algorithm names provided by all of the currently installed
Provider
s.public static Provider[] getProviders(String filter)
Provider
s, ordered
according to their installation preference order, which satisfy a given
selection criterion.
This implementation recognizes a selection criterion written in one of two following forms:
getAlgorithms(String)
method, and
algorithm_or_type is a known case-insensitive name of an
Algorithm, or one of its aliases.
For example, "CertificateFactory.X.509" would return all the installed
Provider
s which provide a CertificateFactory
implementation of X.509.
getAlgorithms(String)
method,
algorithm_or_type is a case-insensitive known name of an Algorithm
or one of its aliases, attribute_name is a case-insensitive
property name with no whitespace characters, and no dots, in-between, and
value is a String
with no whitespace characters in-between.
For example, "Signature.Sha1WithDSS KeySize:1024" would return all the
installed Provider
s which declared their ability to provide
Signature services, using the Sha1WithDSS algorithm with
key sizes of 1024.
filter
- the selection criterion for selecting among the installed
Provider
s.
Provider
s which satisfy the selection
criterion. Returns null
if no installed
Provider
s were found which satisfy the selection
criterion. Returns ALL installed Provider
s if
filter
is null
or is an empty string.
InvalidParameterException
- if an exception occurs while parsing the filter
.getProviders(Map)
public static Provider[] getProviders(Map<String,String> filter)
Provider
s which satisfy a
set of selection criteria.
The selection criteria are defined in a Map
where each
element specifies a selection querry. The Keys in this
Map
must be in one of the two following forms:
getAlgorithms(String)
method, and
algorithm_or_type is a case-insensitive known name of an
Algorithm, or one of its aliases. The value of the entry in the
Map
for such a Key MUST be the empty string.
Provider
s which provide an implementation for the designated
service algorithm are included in the result.getAlgorithms(String)
method,
algorithm_or_type is a case-insensitive known name of an Algorithm
or one of its aliases, and attribute_name is a case-insensitive
property name with no whitespace characters, and no dots, in-between. The
value of the entry in this Map
for such a Key MUST
NOT be null
or an empty string. Provider
s which
declare the designated attribute_name and value for the
designated service algorithm are included in the result.
filter
- a Map
of selection querries.
Provider
s which satisfy ALL the
selection criteria defined in filter
.
Returns ALL installed Provider
s if filter
is null
or empty.
InvalidParameterException
- if an exception is encountered while parsing the syntax of the
Map
's keys.getProviders(String)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |