Android 2.3 Gingerbread

java.security
Class Provider

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable<Object,Object>
          extended by java.util.Properties
              extended by java.security.Provider
All Implemented Interfaces:
Serializable, Cloneable, Map<Object,Object>
Direct Known Subclasses:
AuthProvider

public abstract class Provider
extends Properties

Provider is the abstract superclass for all security providers in the Java security infrastructure.

See Also:
Serialized Form

Nested Class Summary
static class Provider.Service
          Service represents a service in the Java Security infrastructure.
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Constructor Summary
protected Provider(String name, double version, String info)
          Constructs a new instance of Provider with its name, version and description.
 
Method Summary
 void clear()
          Clears all properties used to look up services implemented by this Provider.
 Set<Map.Entry<Object,Object>> entrySet()
          Returns a set of the mappings contained in this Hashtable.
 String getInfo()
          Returns a description of the services being provided.
 String getName()
          Returns the name of this provider.
(package private)  int getProviderNumber()
          Get the provider preference order number.
(package private)  Provider.Service getService(String type)
          Get the service of the specified type
 Provider.Service getService(String type, String algorithm)
          Returns the service with the specified type implementing the specified algorithm, or null if no such implementation exists.
 Set<Provider.Service> getServices()
          Returns an unmodifiable Set of all services registered by this provider.
 double getVersion()
          Returns the version number for the services being provided.
(package private)  boolean implementsAlg(String serv, String alg, String attribute, String val)
          Returns true if this provider implements the given algorithm.
 Set<Object> keySet()
          Returns a set of the keys contained in this Hashtable.
 void load(InputStream inStream)
          Loads properties from the specified InputStream.
 Object put(Object key, Object value)
          Maps the specified key property name to the specified value.
 void putAll(Map<?,?> t)
          Copies all from the provided map to this Provider.
protected  void putService(Provider.Service s)
          Adds a Service to this Provider.
 Object remove(Object key)
          Removes the specified key and its associated value from this Provider.
protected  void removeService(Provider.Service s)
          Removes a previously registered Service from this Provider.
(package private)  void setProviderNumber(int n)
          Set the provider preference order number.
 String toString()
          Returns a string containing a concise, human-readable description of this Provider including its name and its version.
 Collection<Object> values()
          Returns a collection of the values contained in this Hashtable.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
 
Methods inherited from class java.util.Hashtable
clone, contains, containsKey, containsValue, elements, equals, get, hashCode, isEmpty, keys, rehash, size
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Provider

protected Provider(String name,
                   double version,
                   String info)
Constructs a new instance of Provider with its name, version and description.

Parameters:
name - the name of the provider.
version - the version of the provider.
info - a description of the provider.
Method Detail

getName

public String getName()
Returns the name of this provider.

Returns:
the name of this provider.

getVersion

public double getVersion()
Returns the version number for the services being provided.

Returns:
the version number for the services being provided.

getInfo

public String getInfo()
Returns a description of the services being provided.

Returns:
a description of the services being provided.

toString

public String toString()
Returns a string containing a concise, human-readable description of this Provider including its name and its version.

Overrides:
toString in class Hashtable<Object,Object>
Returns:
a printable representation for this Provider.

clear

public void clear()
Clears all properties used to look up services implemented by this Provider.

If a SecurityManager is installed, code calling this method needs the SecurityPermission clearProviderProperties.NAME (where NAME is the provider name) to be granted, otherwise a SecurityException will be thrown.

Specified by:
clear in interface Map<Object,Object>
Overrides:
clear in class Hashtable<Object,Object>
Throws:
SecurityException - if a SecurityManager is installed and the caller does not have permission to invoke this method.
See Also:
Hashtable.isEmpty(), Hashtable.size

load

public void load(InputStream inStream)
          throws IOException
Description copied from class: Properties
Loads properties from the specified InputStream. The encoding is ISO-8859-1.

Overrides:
load in class Properties
Parameters:
inStream - the InputStream
Throws:
IOException

putAll

public void putAll(Map<?,?> t)
Copies all from the provided map to this Provider.

If a SecurityManager is installed, code calling this method needs the SecurityPermission putProviderProperty.NAME (where NAME is the provider name) to be granted, otherwise a SecurityException will be thrown.

Specified by:
putAll in interface Map<Object,Object>
Overrides:
putAll in class Hashtable<Object,Object>
Parameters:
t - the mappings to copy to this provider.
Throws:
SecurityException - if a SecurityManager is installed and the caller does not have permission to invoke this method.

entrySet

public Set<Map.Entry<Object,Object>> entrySet()
Description copied from class: Hashtable
Returns a set of the mappings contained in this Hashtable. Each element in the set is a Map.Entry. The set is backed by this Hashtable so changes to one are reflected by the other. The set does not support adding.

Specified by:
entrySet in interface Map<Object,Object>
Overrides:
entrySet in class Hashtable<Object,Object>
Returns:
a set of the mappings.

keySet

public Set<Object> keySet()
Description copied from class: Hashtable
Returns a set of the keys contained in this Hashtable. The set is backed by this Hashtable so changes to one are reflected by the other. The set does not support adding.

Specified by:
keySet in interface Map<Object,Object>
Overrides:
keySet in class Hashtable<Object,Object>
Returns:
a set of the keys.

values

public Collection<Object> values()
Description copied from class: Hashtable
Returns a collection of the values contained in this Hashtable. The collection is backed by this Hashtable so changes to one are reflected by the other. The collection does not support adding.

Specified by:
values in interface Map<Object,Object>
Overrides:
values in class Hashtable<Object,Object>
Returns:
a collection of the values.

put

public Object put(Object key,
                  Object value)
Maps the specified key property name to the specified value.

If a SecurityManager is installed, code calling this method needs the SecurityPermission putProviderProperty.NAME (where NAME is the provider name) to be granted, otherwise a SecurityException will be thrown.

Specified by:
put in interface Map<Object,Object>
Overrides:
put in class Hashtable<Object,Object>
Parameters:
key - the name of the property.
value - the value of the property.
Returns:
the value that was previously mapped to the specified key ,or null if it did not have one.
Throws:
SecurityException - if a SecurityManager is installed and the caller does not have permission to invoke this method.
See Also:
Hashtable.elements(), Hashtable.get(java.lang.Object), Hashtable.keys(), Object.equals(java.lang.Object)

remove

public Object remove(Object key)
Removes the specified key and its associated value from this Provider.

If a SecurityManager is installed, code calling this method needs the SecurityPermission removeProviderProperty.NAME (where NAME is the provider name) to be granted, otherwise a SecurityException will be thrown.

Specified by:
remove in interface Map<Object,Object>
Overrides:
remove in class Hashtable<Object,Object>
Parameters:
key - the name of the property
Returns:
the value that was mapped to the specified key ,or null if no mapping was present
Throws:
SecurityException - if a SecurityManager is installed and the caller does not have the permission to invoke this method.
See Also:
Hashtable.get(java.lang.Object), Hashtable.put(K, V)

implementsAlg

boolean implementsAlg(String serv,
                      String alg,
                      String attribute,
                      String val)
Returns true if this provider implements the given algorithm. Caller must specify the cryptographic service and specify constraints via the attribute name and value.

Parameters:
serv - Crypto service.
alg - Algorithm or type.
attribute - The attribute name or null.
val - The attribute value.
Returns:

setProviderNumber

void setProviderNumber(int n)
Set the provider preference order number.

Parameters:
n -

getProviderNumber

int getProviderNumber()
Get the provider preference order number.

Returns:

getService

Provider.Service getService(String type)
Get the service of the specified type


getService

public Provider.Service getService(String type,
                                   String algorithm)
Returns the service with the specified type implementing the specified algorithm, or null if no such implementation exists.

If two services match the requested type and algorithm, the one added with the putService(Service) is returned (as opposed to the one added via put(Object, Object).

Parameters:
type - the type of the service (for example KeyPairGenerator)
algorithm - the algorithm name (case insensitive)
Returns:
the requested service, or null if no such implementation exists

getServices

public Set<Provider.Service> getServices()
Returns an unmodifiable Set of all services registered by this provider.

Returns:
an unmodifiable Set of all services registered by this provider

putService

protected void putService(Provider.Service s)
Adds a Service to this Provider. If a service with the same name was registered via this method, it is replace.

If a SecurityManager is installed, code calling this method needs the SecurityPermission putProviderProperty.NAME (where NAME is the provider name) to be granted, otherwise a SecurityException will be thrown.

Parameters:
s - the Service to register
Throws:
SecurityException - if a SecurityManager is installed and the caller does not have permission to invoke this method

removeService

protected void removeService(Provider.Service s)
Removes a previously registered Service from this Provider.

If a SecurityManager is installed, code calling this method needs the SecurityPermission removeProviderProperty.NAME (where NAME is the provider name) to be granted, otherwise a SecurityException will be thrown.

Parameters:
s - the Service to remove
Throws:
SecurityException - if a SecurityManager is installed and the caller does not have permission to invoke this method
NullPointerException - if s is null

Android 2.3 Gingerbread