java.lang.Object | ||||
↳ | java.util.Dictionary<K, V> | |||
↳ | java.util.Hashtable<K, V> | |||
↳ | java.util.Properties | |||
↳ | java.security.Provider |
Known Direct Subclasses |
Known Indirect Subclasses |
This class represents a "provider" for the Java Security API, where a provider implements some or all parts of Java Security. Services that a provider may implement include:
Each provider has a name and a version number, and is configured in each runtime it is installed in.
See The Provider Class in the "Java Cryptography Architecture API Specification & Reference" for information about how a particular type of provider, the cryptographic service provider, works and is installed. However, please note that a provider can be used to implement any security service in Java that uses a pluggable architecture with a choice of implementations that fit underneath.
Some provider implementations may encounter unrecoverable internal
errors during their operation, for example a failure to communicate with a
security token. A ProviderException
should be used to indicate
such errors.
The service type Provider
is reserved for use by the
security framework. Services of this type cannot be added, removed,
or modified by applications.
The following attributes are automatically placed in each Provider object:
Name | Value |
---|---|
Provider.id name |
String.valueOf(provider.getName()) |
Provider.id version |
String.valueOf(provider.getVersion()) |
Provider.id info |
String.valueOf(provider.getInfo()) |
Provider.id className |
provider.getClass().getName() |
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Provider.Service | The description of a security service. |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.util.Properties
|
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a provider with the specified name, version number,
and information.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Clears this provider so that it no longer contains the properties
used to look up facilities implemented by the provider.
| |||||||||||
Returns an enumeration of the values in this hashtable.
| |||||||||||
Returns an unmodifiable Set view of the property entries contained
in this Provider.
| |||||||||||
Returns the value to which the specified key is mapped,
or
null if this map contains no mapping for the key. | |||||||||||
Returns a human-readable description of the provider and its
services.
| |||||||||||
Returns the name of this provider.
| |||||||||||
Searches for the property with the specified key in this property list.
| |||||||||||
Get the service describing this Provider's implementation of the
specified type of this algorithm or alias.
| |||||||||||
Get an unmodifiable Set of all services supported by
this Provider.
| |||||||||||
Returns the version number for this provider.
| |||||||||||
Returns an unmodifiable Set view of the property keys contained in
this provider.
| |||||||||||
Returns an enumeration of the keys in this hashtable.
| |||||||||||
Reads a property list (key and element pairs) from the input stream.
| |||||||||||
Sets the
key property to have the specified
value . | |||||||||||
Copies all of the mappings from the specified Map to this provider.
| |||||||||||
Removes the
key property (and its corresponding
value ). | |||||||||||
Returns a string with the name and the version number
of this provider.
| |||||||||||
Returns an unmodifiable Collection view of the property values
contained in this provider.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add a service.
| |||||||||||
Remove a service previously added using
putService() . |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.util.Properties
| |||||||||||
From class
java.util.Hashtable
| |||||||||||
From class
java.util.Dictionary
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
java.util.Map
|
Constructs a provider with the specified name, version number, and information.
name | the provider name. |
---|---|
version | the provider version number. |
info | a description of the provider and its services. |
Clears this provider so that it no longer contains the properties used to look up facilities implemented by the provider.
First, if there is a security manager, its
checkSecurityAccess
method is called with the string
"clearProviderProperties."+name
(where name
is the provider name) to see if it's ok to clear this provider.
If the default implementation of checkSecurityAccess
is used (that is, that method is not overriden), then this results in
a call to the security manager's checkPermission
method
with a SecurityPermission("clearProviderProperties."+name)
permission.
SecurityException | if a security manager exists and its method
denies access to clear this provider |
---|
Returns an enumeration of the values in this hashtable. Use the Enumeration methods on the returned object to fetch the elements sequentially.
Returns an unmodifiable Set view of the property entries contained in this Provider.
Returns the value to which the specified key is mapped,
or null
if this map contains no mapping for the key.
More formally, if this map contains a mapping from a key
k
to a value v
such that (key.equals(k))
,
then this method returns v
; otherwise it returns
null
. (There can be at most one such mapping.)
key | the key whose associated value is to be returned |
---|
null
if this map contains no mapping for the keyReturns a human-readable description of the provider and its services. This may return an HTML page, with relevant links.
Searches for the property with the specified key in this property list.
If the key is not found in this property list, the default property list,
and its defaults, recursively, are then checked. The method returns
null
if the property is not found.
key | the property key. |
---|
Get the service describing this Provider's implementation of the
specified type of this algorithm or alias. If no such
implementation exists, this method returns null. If there are two
matching services, one added to this provider using
putService()
and one added via put()
,
the service added via putService()
is returned.
type | the type of service requested
(for example, MessageDigest ) |
---|---|
algorithm | the case insensitive algorithm name (or alternate
alias) of the service requested (for example, SHA-1 ) |
NullPointerException | if type or algorithm is null |
---|
Get an unmodifiable Set of all services supported by this Provider.
Returns the version number for this provider.
Returns an unmodifiable Set view of the property keys contained in this provider.
Returns an enumeration of the keys in this hashtable.
Reads a property list (key and element pairs) from the input stream.
inStream | the input stream. |
---|
IOException | if an error occurred when reading from the input stream. |
---|
Sets the key
property to have the specified
value
.
First, if there is a security manager, its
checkSecurityAccess
method is called with the string
"putProviderProperty."+name
, where name
is the
provider name, to see if it's ok to set this provider's property values.
If the default implementation of checkSecurityAccess
is used (that is, that method is not overriden), then this results in
a call to the security manager's checkPermission
method
with a SecurityPermission("putProviderProperty."+name)
permission.
key | the property key. |
---|---|
value | the property value. |
key
), or null if it did not have one.SecurityException | if a security manager exists and its method
denies access to set property values. |
---|
Copies all of the mappings from the specified Map to this provider. These mappings will replace any properties that this provider had for any of the keys currently in the specified Map.
t | mappings to be stored in this map |
---|
Removes the key
property (and its corresponding
value
).
First, if there is a security manager, its
checkSecurityAccess
method is called with the string
"removeProviderProperty."+name
, where name
is
the provider name, to see if it's ok to remove this provider's
properties. If the default implementation of
checkSecurityAccess
is used (that is, that method is not
overriden), then this results in a call to the security manager's
checkPermission
method with a
SecurityPermission("removeProviderProperty."+name)
permission.
key | the key for the property to be removed. |
---|
SecurityException | if a security manager exists and its method
denies access to remove this provider's properties. |
---|
Returns a string with the name and the version number of this provider.
Returns an unmodifiable Collection view of the property values contained in this provider.
Add a service. If a service of the same type with the same algorithm
name exists and it was added using putService()
,
it is replaced by the new service.
This method also places information about this service
in the provider's Hashtable values in the format described in the
Java Cryptography Architecture API Specification & Reference .
Also, if there is a security manager, its
checkSecurityAccess
method is called with the string
"putProviderProperty."+name
, where name
is
the provider name, to see if it's ok to set this provider's property
values. If the default implementation of checkSecurityAccess
is used (that is, that method is not overriden), then this results in
a call to the security manager's checkPermission
method with
a SecurityPermission("putProviderProperty."+name)
permission.
s | the Service to add |
---|
SecurityException | if a security manager exists and its method denies
access to set property values. |
---|---|
NullPointerException | if s is null |
Remove a service previously added using
putService()
. The specified service is removed from
this provider. It will no longer be returned by
getService()
and its information will be removed
from this provider's Hashtable.
Also, if there is a security manager, its
checkSecurityAccess
method is called with the string
"removeProviderProperty."+name
, where name
is
the provider name, to see if it's ok to remove this provider's
properties. If the default implementation of
checkSecurityAccess
is used (that is, that method is not
overriden), then this results in a call to the security manager's
checkPermission
method with a
SecurityPermission("removeProviderProperty."+name)
permission.
s | the Service to be removed |
---|
SecurityException | if a security manager exists and its method denies
access to remove this provider's properties. |
---|---|
NullPointerException | if s is null |