Name

Security

Synopsis

This class defines static methods both for managing the list of installed security providers and for reading and setting the values of various properties used by the Java security system. It is essentially an interface to the ${java.home}/lib/security/java.security properties file that is included in Sun’s implementation of Java. Use getProperty( ) and setProperty( ) to query or set the value of security properties whose default values are stored in that file.

One of the important features of the java.security properties file is that it specifies a set of security provider implementations and a preference order in which they are to be used. getProviders( ) returns an array of Provider objects, in the order they are specified in the file. In Java 1.3 and later, versions of this method exist that only return providers that implement the algorithm or algorithms specified in a String or Map object. You can also look up a single named Provider object by name with getProvider( ) . Note that a provider name is the string returned by getName( ) method of the Provider class, not the classname of the Provider.

You can alter the set of providers installed by default from the java.security file. Use addProvider( ) to add a new Provider object to the list, placing it at the end of the list, with a lower preference than all other providers. Use insertProviderAt( ) to insert a provider into the list at a specified position. Note that provider preference positions are 1-based. ...

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.