Package ch.qos.logback.core.net.ssl

## Class KeyStoreFactoryBean

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

    public class KeyStoreFactoryBean
    extends java.lang.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
`KeyStoreFactoryBean()`

### Method Summary

All Methods Instance Methods Concrete Methods
`java.security.KeyStore` `createKeyStore()` Creates a new `KeyStore` using the receiver's configuration.
`java.lang.String` `getLocation()` Gets the location of the key store resource.
`java.lang.String` `getPassword()` Gets the password to use to access the key store.
`java.lang.String` `getProvider()` Gets the JCA key store provider name.
`java.lang.String` `getType()` Gets the type of key store to load.
`void` `setLocation​(java.lang.String location)` Sets the location of the key store resource.
`void` `setPassword​(java.lang.String password)` Sets the password to use to access the keystore.
`void` `setProvider​(java.lang.String provider)` Sets the JCA key store provider name.
`void` `setType​(java.lang.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 java.security.KeyStore createKeyStore()
                                          throws java.security.NoSuchProviderException,
                                                 java.security.NoSuchAlgorithmException,
                                                 java.security.KeyStoreException

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

Returns:
  key store
Throws:
  `java.security.NoSuchProviderException` - if the provider specified by `setProvider(String)` is not known to the platform
  `java.security.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)
  `java.security.KeyStoreException` - if some other error occurs in loading the key store from the resource specified by `setLocation(String)`

#### getLocation

    public java.lang.String getLocation()

Gets the location of the key store resource.

Returns:
  a String containing a URL for the resource

#### setLocation

    public void setLocation​(java.lang.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 java.lang.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​(java.lang.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 java.lang.String getProvider()

Gets the JCA key store provider name.

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

#### setProvider

    public void setProvider​(java.lang.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 java.lang.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​(java.lang.String password)

Sets the password to use to access the keystore.

Parameters:
  `password` - the password to set