Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.jini.config
Class KeyStores

    java.lang.Object
      com.sun.jini.config.KeyStores

public class KeyStores
extends Object

Provides static methods for manipulating instances of `KeyStore` conveniently from within the source of a `Configuration`. This class cannot be instantiated.

Since:
  2.0

Method Summary
`static KeyStore` | `getKeyStore(String location, String type)` Returns a `KeyStore` initialized with contents read from a location specified as a file or URL.
`static X500Principal` | `getX500Principal(String alias, KeyStore keystore)` Returns the `X500Principal` for the alias in a `KeyStore`; or `null` if the alias is not found, if the alias is not associated with a certificate, or if the certificate is not an `X509Certificate`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getKeyStore

    public static KeyStore getKeyStore(String location,
                                       String type)
                                throws GeneralSecurityException,
                                       IOException

  Returns a `KeyStore` initialized with contents read from a location specified as a file or URL. This method provides a convenient way to refer to keystores from within the source for a configuration, which may then be used with `getX500Principal` to refer to principals.

  For example, a deployer that was using `SslServerEndpoint` might use the following in the source for a `ConfigurationFile` to supply principals for use in security constraints:

        Client {
            private static users = KeyStores.getKeyStore("users.ks", null);
            private static client = KeyStores.getX500Principal("client", users);
            //...
        }

  Parameters:
    `location` - the file name or URL containing the `KeyStore` contents
    `type` - the type of `KeyStore` to create, or `null` for the default type
  Returns:
    the `KeyStore`, with contents read from `location`
  Throws:
    `GeneralSecurityException` - if there are problems with the contents
    `IOException` - if an I/O error occurs when reading from `location`
    `NullPointerException` - if `location` is `null`
  See Also:
    `getX500Principal`

### getX500Principal

    public static X500Principal getX500Principal(String alias,
                                                 KeyStore keystore)
                                          throws KeyStoreException

  Returns the `X500Principal` for the alias in a `KeyStore`; or `null` if the alias is not found, if the alias is not associated with a certificate, or if the certificate is not an `X509Certificate`. This method provides a convenient way to refer to principals from within the source for a configuration by specifying aliases when used with `getKeystore`.

  For example, a deployer that was using `SslServerEndpoint` might use the following in the source for a `ConfigurationFile` to supply principals for use in security constraints:

        Client {
            private static users = KeyStores.getKeyStore("users.ks", null);
            private static client = KeyStores.getX500Principal("client", users);
            //...
        }

  Parameters:
    `alias` - the alias
    `keystore` - the `KeyStore`
  Returns:
    the `X500Principal` or `null`
  Throws:
    `KeyStoreException` - if the keystore has not been initialized (loaded)
    `NullPointerException` - if either argument is `null`
  See Also:
    `getKeyStore`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 Sun Microsystems, Inc. All rights reserved