ch.qos.logback.core.net.ssl

## Class KeyStoreFactoryBean

- java.lang.Object
- - ch.qos.logback.core.net.ssl.KeyStoreFactoryBean

    public class KeyStoreFactoryBean
    extends Object

A factory bean for a JCA `KeyStore`.

This object holds the configurable properties of a key store and uses them to create and load a `KeyStore` instance.

Author:
  Carl Harris

### Constructor Summary

Constructors
Constructor and Description
`KeyStoreFactoryBean()`

### Method Summary

All Methods Instance Methods Concrete Methods
`KeyStore` `createKeyStore()` Creates a new `KeyStore` using the receiver's configuration.
`String` `getLocation()` Gets the location of the key store resource.
`String` `getPassword()` Gets the password to use to access the key store.
`String` `getProvider()` Gets the JCA key store provider name.
`String` `getType()` Gets the type of key store to load.
`void` `setLocation(String location)` Sets the location of the key store resource.
`void` `setPassword(String password)` Sets the password to use to access the keystore.
`void` `setProvider(String provider)` Sets the JCA key store provider name.
`void` `setType(String type)` Sets the type of key store to load.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### KeyStoreFactoryBean

    public KeyStoreFactoryBean()

### Method Detail

#### createKeyStore

    public KeyStore createKeyStore()
                            throws NoSuchProviderException,
                                   NoSuchAlgorithmException,
                                   KeyStoreException

Creates a new `KeyStore` using the receiver's configuration.

Returns:
  key store
Throws:
  `NoSuchProviderException` - if the provider specified by `setProvider(String)` is not known to the platform
  `NoSuchAlgorithmException` - if the key store type specified by `setType(String)` is not known to the specified provider (or the platform's default provider if the provider isn't specified)
  `KeyStoreException` - if some other error occurs in loading the key store from the resource specified by `setLocation(String)`

#### getLocation

    public String getLocation()

Gets the location of the key store resource.

Returns:
  a String containing a URL for the resource

#### setLocation

    public void setLocation(String location)

Sets the location of the key store resource.

Parameters:
  `location` - a String containing a URL for the resource; if the URL string isn't prefixed by a scheme, the path is assumed to be relative to the root of the classpath.

#### getType

    public String getType()

Gets the type of key store to load.

Returns:
  a key store type name (e.g. `JKS`); the `SSL.DEFAULT_KEYSTORE_TYPE` is returned if no type has been configured

#### setType

    public void setType(String type)

Sets the type of key store to load.

Parameters:
  `type` - a key store type name (e.g. `JKS`, `PKCS12`); the type specified must be supported by the provider specified by `setProvider(String)` or by the platform's default provider if no provider is specified

#### getProvider

    public String getProvider()

Gets the JCA key store provider name.

Returns:
  provider name or `null` if no provider has been configured

#### setProvider

    public void setProvider(String provider)

Sets the JCA key store provider name.

Parameters:
  `provider` - name of the JCA provider to utilize in creating the key store

#### getPassword

    public String getPassword()

Gets the password to use to access the key store.

Returns:
  password string; the `SSL.DEFAULT_KEYSTORE_PASSWORD` is returned if no password has been configured

#### setPassword

    public void setPassword(String password)

Sets the password to use to access the keystore.

Parameters:
  `password` - the password to set