Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 544
نمايش فراداده

Providerjava.security

Java 1.1cloneable serializable collection

This class represents a security provider. It specifies class names for implementations of one or more algorithms for message digests, digital signatures, key generation, key conversion, key management, secure random number generation, certificate conversion, and algorithm parameter management. The getName( ), getVersion( ), and getInfo( ) methods return information about the provider. Provider inherits from Properties and maintains a mapping of property names to property values. These name/value pairs specify the capabilities of the Provider implementation. Each property name has the form:

service_type.algorithm_name

The corresponding property value is the name of the class that implements the named algorithm. For example, say a Provider defines properties named "Signature.DSA", "MessageDigest.MD5", and "KeyStore.JKS". The values of these properties are the class names of SignatureSpi, MessageDigestSpi, and KeyStoreSpi implementations. Other properties defined by a Provider are used to provide aliases for algorithm names. For example, the property Alg.Alias.MessageDigest.SHA1 might have the value "SHA", meaning that the algorithm name "SHA1" is an alias for "SHA".

In Java 5.0, the individual services provided by a Provider are described by the nested Service class, and various methods for querying and setting the Service objects of a Provider are available.

Security providers are installed in an implementation-dependent way. For Sun's implementation, the

${java.home}/lib/security/java.security file specifies the class names of all installed Provider implementations. An application can also install its own custom Provider with the addProvider( ) and insertProviderAt( ) methods of the Security class. Most applications do not need to use the Provider class directly. Typically, only security-provider implementors need to use the Provider class. Some applications may explicitly specify the name of a desired Provider when calling a static getInstance( ) factory method, however. Only applications with the most demanding cryptographic needs require custom providers.

Figure 14-32. java.security.Provider

public abstract class

Provider extends java.util.Properties { // Protected Constructors protected

Provider (String

name , double

version , String

info ); // Nested Types

5.0 public static class

Service ; // Public Instance Methods public String

getInfo ( ); public String

getName ( );

5.0 public Provider.Service

getService (String

type , String

algorithm ); synchronized

5.0 public java.util.Set<Provider.Service>

getServices ( ); synchronized public double

getVersion ( ); // Public Methods Overriding Properties

1.2 public void

load (java.io.InputStream

inStream ) throws java.io.IOException; synchronized // Public Methods Overriding Hashtable

1.2 public void

clear ( ); synchronized

1.2 public java.util.Set<java.util.Map.Entry<Object, Object>>

entrySet ( ); synchronized

1.2 public java.util.Set<Object>

keySet ( );

1.2 public Object

put (Object

key , Object

value ); synchronized

1.2 public void

putAll (java.util.Map<?,?>

t ); synchronized

1.2 public Object

remove (Object

key ); synchronized public String

toString ( );

1.2 public java.util.Collection<Object>

values ( ); // Protected Instance Methods

5.0 protected void

putService (Provider.Service

s ); synchronized

5.0 protected void

removeService (Provider.Service

s ); synchronized }

Subclasses

AuthProvider

Passed To

Too many methods to list.

Returned By

Too many methods to list.