Security


Security java.security

Java 1.1

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. Specify a position of 1 to make the provider the most preferred one. Finally, use removeProvider( ) to remove a named provider.

In Java 1.4 and later, the getAlgorithms method returns a Set that includes the names of all supported algorithms (from any installed provider) for the specified "service". A service name specifies the category of security service you are querying. It is a case-insensitive value that has the same name as one of the key service classes from this package or security- related packagesfor example, "Signature", "MessageDigest", and "KeyStore" (from this package) or "Cipher" (from the javax.crypto package).

 public final class  Security  {  // No Constructor   // Public Class Methods  public static int  addProvider  (Provider  provider  );  1.4  public static java.util.Set<String>  getAlgorithms  (String  serviceName  );        public static String  getProperty  (String  key  );        public static Provider  getProvider  (String  name  );        public static Provider[ ]  getProviders  ( );  1.3  public static Provider[ ]  getProviders  (java.util.Map<String,String>  filter  );  1.3  public static Provider[ ]  getProviders  (String  filter  );        public static int  insertProviderAt  (Provider  provider  ,          int  position  );  synchronized  public static void  removeProvider  (String  name  );  synchronized  public static void  setProperty  (String  key  , String  datum  );  // Deprecated Public Methods   #  public static String  getAlgorithmProperty  (String  algName  , String  propName  );   } 



Java In A Nutshell
Java In A Nutshell, 5th Edition
ISBN: 0596007736
EAN: 2147483647
Year: 2004
Pages: 1220

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net