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

# Class SSLContextFactoryBean

java.lang.Object
ch.qos.logback.core.net.ssl.SSLContextFactoryBean

Direct Known Subclasses:
  `SSLConfiguration`

public class SSLContextFactoryBean extends Object
A factory bean for a JSSE `SSLContext`.

This object holds the configurable properties for an SSL context and uses them to create an `SSLContext` instance.

Author:
  Carl Harris

## Constructor Summary

Constructors
Constructor
Description
`SSLContextFactoryBean()`

## Method Summary

Modifier and Type
Method
Description
`SSLContext`
`createContext(ContextAware context)`
Creates a new `SSLContext` using the receiver's configuration.
`KeyManagerFactoryFactoryBean`
`getKeyManagerFactory()`
Gets the key manager factory configuration.
`KeyStoreFactoryBean`
`getKeyStore()`
Gets the key store configuration.
`String`
`getProtocol()`
Gets the secure transport protocol name.
`String`
`getProvider()`
Gets the JSSE provider name for the SSL context.
`SecureRandomFactoryBean`
`getSecureRandom()`
Gets the secure random generator configuration.
`TrustManagerFactoryFactoryBean`
`getTrustManagerFactory()`
Gets the trust manager factory configuration.
`KeyStoreFactoryBean`
`getTrustStore()`
Gets the trust store configuration.
`void`
`setKeyManagerFactory(KeyManagerFactoryFactoryBean keyManagerFactory)`
Sets the key manager factory configuration.
`void`
`setKeyStore(KeyStoreFactoryBean keyStore)`
Sets the key store configuration.
`void`
`setProtocol(String protocol)`
Sets the secure transport protocol name.
`void`
`setProvider(String provider)`
Sets the JSSE provider name for the SSL context.
`void`
`setSecureRandom(SecureRandomFactoryBean secureRandom)`
Sets the secure random generator configuration.
`void`
`setTrustManagerFactory(TrustManagerFactoryFactoryBean trustManagerFactory)`
Sets the trust manager factory configuration.
`void`
`setTrustStore(KeyStoreFactoryBean trustStore)`
Sets the trust store configuration.

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

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

## Constructor Details

### SSLContextFactoryBean

public SSLContextFactoryBean()

## Method Details

### createContext

public SSLContext createContext(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException, KeyManagementException, UnrecoverableKeyException, KeyStoreException, CertificateException
Creates a new `SSLContext` using the receiver's configuration.

Parameters:
  `context` - context for status messages
Returns:
  `SSLContext` object
Throws:
  `NoSuchProviderException` - if a provider specified for one of the JCA or JSSE components utilized in creating the context is not known to the platform
  `NoSuchAlgorithmException` - if a JCA or JSSE algorithm, protocol, or type name specified for one of the context's components is not known to a given provider (or platform default provider for the component)
  `KeyManagementException` - if an error occurs in creating a `KeyManager` for the context
  `UnrecoverableKeyException` - if a private key needed by a `KeyManager` cannot be obtained from a key store
  `KeyStoreException` - if an error occurs in reading the contents of a key store
  `CertificateException` - if an error occurs in reading the contents of a certificate

### getKeyStore

public KeyStoreFactoryBean getKeyStore()
Gets the key store configuration.

Returns:
  key store factory bean or `null` if no key store configuration was provided

### setKeyStore

public void setKeyStore(KeyStoreFactoryBean keyStore)
Sets the key store configuration.

Parameters:
  `keyStore` - the key store factory bean to set

### getTrustStore

public KeyStoreFactoryBean getTrustStore()
Gets the trust store configuration.

Returns:
  trust store factory bean or `null` if no trust store configuration was provided

### setTrustStore

public void setTrustStore(KeyStoreFactoryBean trustStore)
Sets the trust store configuration.

Parameters:
  `trustStore` - the trust store factory bean to set

### getSecureRandom

public SecureRandomFactoryBean getSecureRandom()
Gets the secure random generator configuration.

Returns:
  secure random factory bean; if no secure random generator configuration has been set, a default factory bean is returned

### setSecureRandom

public void setSecureRandom(SecureRandomFactoryBean secureRandom)
Sets the secure random generator configuration.

Parameters:
  `secureRandom` - the secure random factory bean to set

### getKeyManagerFactory

public KeyManagerFactoryFactoryBean getKeyManagerFactory()
Gets the key manager factory configuration.

Returns:
  factory bean; if no key manager factory configuration has been set, a default factory bean is returned

### setKeyManagerFactory

public void setKeyManagerFactory(KeyManagerFactoryFactoryBean keyManagerFactory)
Sets the key manager factory configuration.

Parameters:
  `keyManagerFactory` - the key manager factory factory bean to set

### getTrustManagerFactory

public TrustManagerFactoryFactoryBean getTrustManagerFactory()
Gets the trust manager factory configuration.

Returns:
  factory bean; if no trust manager factory configuration has been set, a default factory bean is returned

### setTrustManagerFactory

public void setTrustManagerFactory(TrustManagerFactoryFactoryBean trustManagerFactory)
Sets the trust manager factory configuration.

Parameters:
  `trustManagerFactory` - the factory bean to set

### getProtocol

public String getProtocol()
Gets the secure transport protocol name.

Returns:
  protocol name (e.g. `SSL`, `TLS`); the `SSL.DEFAULT_PROTOCOL` is returned if no protocol has been configured

### setProtocol

public void setProtocol(String protocol)
Sets the secure transport protocol name.

Parameters:
  `protocol` - a protocol name, which must be recognized by the provider specified by `setProvider(String)` or by the platform's default provider if no platform was specified.

### getProvider

public String getProvider()
Gets the JSSE provider name for the SSL context.

Returns:
  JSSE provider name

### setProvider

public void setProvider(String provider)
Sets the JSSE provider name for the SSL context.

Parameters:
  `provider` - name of the JSSE provider to use in creating the SSL context