java.security.Security) is responsible for
managing the set of provider classes that a Java program can use, and
forms the last link in the architecture of the security provider.
This class is
final, and all its methods are
static (except for its constructor, which is
private). Like the
Math classes, then, the
Security class can never be created or
subclassed; it exists simply to provide a placeholder for methods
that deal with the
Earlier, we explained how to add entries to the
java.security file to add new providers to the
security architecture. The same feat can be accomplished
programmatically via these methods of the
Add a new provider into the list of providers. The provider is added to the end of the internal array of providers.
Add a new provider into the internal array of providers. The provider is added at the specified position; other providers have their index changed if necessary to make room for this provider. Position counting begins at 1.
The notion that these classes are kept in an indexed array is
important; when the
Security class is asked to
provide a particular algorithm for an operation, the array is
searched sequentially for a provider that can provide the requested
algorithm for the requested operation.
As an example, let’s use a modification of the