Top Description Fields Constructors Methods
ch.qos.logback.core.net.ssl

public Class SSLContextFactoryBean

extends Object
Class Inheritance
Known Direct Subclasses
ch.qos.logback.core.net.ssl.SSLConfiguration
Imports
java.security.KeyManagementException, .KeyStore, .KeyStoreException, .NoSuchAlgorithmException, .NoSuchProviderException, .SecureRandom, .UnrecoverableKeyException, java.security.cert.CertificateException, javax.net.ssl.KeyManager, .KeyManagerFactory, .SSLContext, .TrustManager, .TrustManagerFactory, ch.qos.logback.core.spi.ContextAware

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

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private KeyManagerFactoryFactoryBean
private KeyStoreFactoryBean
private String
private String
private SecureRandomFactoryBean
private TrustManagerFactoryFactoryBean
private KeyStoreFactoryBean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public SSLContext

Returns:

SSLContext object
createContext
(ContextAware
context for status messages
context
)

Creates a new SSLContext using the receiver's configuration.

private KeyManager[]

Returns:

an array of key managers or null if no key store configuration was provided
createKeyManagers
(ContextAware
context for status messages
context
)

Creates key managers using the receiver's key store configuration.

private SecureRandom
private TrustManager[]

Returns:

an array of trust managers or null if no trust store configuration was provided
createTrustManagers
(ContextAware
context for status messages
context
)

Creates trust managers using the receiver's trust store configuration.

public KeyManagerFactoryFactoryBean

Returns:

factory bean; if no key manager factory configuration has been set, a default factory bean is returned
getKeyManagerFactory
()

Gets the key manager factory configuration.

public KeyStoreFactoryBean

Returns:

key store factory bean or null if no key store configuration was provided
getKeyStore
()

Gets the key store configuration.

public String

Returns:

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

Gets the secure transport protocol name.

public String

Returns:

JSSE provider name
getProvider
()

Gets the JSSE provider name for the SSL context.

public SecureRandomFactoryBean

Returns:

secure random factory bean; if no secure random generator configuration has been set, a default factory bean is returned
getSecureRandom
()

Gets the secure random generator configuration.

public TrustManagerFactoryFactoryBean

Returns:

factory bean; if no trust manager factory configuration has been set, a default factory bean is returned
getTrustManagerFactory
()

Gets the trust manager factory configuration.

public KeyStoreFactoryBean

Returns:

trust store factory bean or null if no trust store configuration was provided
getTrustStore
()

Gets the trust store configuration.

private KeyStoreFactoryBean

Returns:

key store or null if no value is defined for the base system property name
keyStoreFromSystemProperties
(String
base property name (e.g. javax.net.ssl.keyStore)
property
)

Constructs a key store factory bean using JSSE system properties.

private String

Returns:

URL for the location specified in the property or null if no value is defined for the property
locationFromSystemProperty
(String
property name (e.g. javax.net.ssl.keyStore)
name
)

Constructs a resource location from a JSSE system property.

public void
setKeyManagerFactory(KeyManagerFactoryFactoryBean
the key manager factory bean to set
keyManagerFactory
)

Sets the key manager factory configuration.

public void
setKeyStore(KeyStoreFactoryBean
the key store factory bean to set
keyStore
)

Sets the key store configuration.

public void
setProtocol(String
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.
protocol
)

Sets the secure transport protocol name.

public void
setProvider(String
name of the JSSE provider to use in creating the SSL context
provider
)

Sets the JSSE provider name for the SSL context.

public void
setSecureRandom(SecureRandomFactoryBean
the secure random factory bean to set
secureRandom
)

Sets the secure random generator configuration.

public void
setTrustManagerFactory(TrustManagerFactoryFactoryBean
the factory bean to set
trustManagerFactory
)

Sets the trust manager factory configuration.

public void
setTrustStore(KeyStoreFactoryBean
the trust store factory bean to set
trustStore
)

Sets the trust store configuration.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

JSSE_KEY_STORE_PROPERTYback to summary
private static final String JSSE_KEY_STORE_PROPERTY
JSSE_TRUST_STORE_PROPERTYback to summary
private static final String JSSE_TRUST_STORE_PROPERTY
keyManagerFactoryback to summary
private KeyManagerFactoryFactoryBean keyManagerFactory
keyStoreback to summary
private KeyStoreFactoryBean keyStore
protocolback to summary
private String protocol
providerback to summary
private String provider
secureRandomback to summary
private SecureRandomFactoryBean secureRandom
trustManagerFactoryback to summary
private TrustManagerFactoryFactoryBean trustManagerFactory
trustStoreback to summary
private KeyStoreFactoryBean trustStore

Constructor Detail

SSLContextFactoryBeanback to summary
public SSLContextFactoryBean()

Method Detail

createContextback to summary
public SSLContext createContext(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException, KeyManagementException, UnrecoverableKeyException, KeyStoreException, CertificateException

Creates a new SSLContext using the receiver's configuration.

Parameters
context:ContextAware

context for status messages

Returns:SSLContext

SSLContext object

Exceptions
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
createKeyManagersback to summary
private KeyManager[] createKeyManagers(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException, UnrecoverableKeyException, KeyStoreException

Creates key managers using the receiver's key store configuration.

Parameters
context:ContextAware

context for status messages

Returns:KeyManager[]

an array of key managers or null if no key store configuration was provided

Exceptions
NoSuchProviderException:
if a provider specified for one of the key manager components is not known to the platform
NoSuchAlgorithmException:
if an algorithm specified for one of the key manager components is not known to the relevant provider
KeyStoreException:
if an error occurs in reading a key store
createSecureRandomback to summary
private SecureRandom createSecureRandom(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException
createTrustManagersback to summary
private TrustManager[] createTrustManagers(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException, KeyStoreException

Creates trust managers using the receiver's trust store configuration.

Parameters
context:ContextAware

context for status messages

Returns:TrustManager[]

an array of trust managers or null if no trust store configuration was provided

Exceptions
NoSuchProviderException:
if a provider specified for one of the trust manager components is not known to the platform
NoSuchAlgorithmException:
if an algorithm specified for one of the trust manager components is not known to the relevant provider
KeyStoreException:
if an error occurs in reading a key store containing trust anchors
getKeyManagerFactoryback to summary
public KeyManagerFactoryFactoryBean getKeyManagerFactory()

Gets the key manager factory configuration.

Returns:KeyManagerFactoryFactoryBean

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

getKeyStoreback to summary
public KeyStoreFactoryBean getKeyStore()

Gets the key store configuration.

Returns:KeyStoreFactoryBean

key store factory bean or null if no key store configuration was provided

getProtocolback to summary
public String getProtocol()

Gets the secure transport protocol name.

Returns:String

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

getProviderback to summary
public String getProvider()

Gets the JSSE provider name for the SSL context.

Returns:String

JSSE provider name

getSecureRandomback to summary
public SecureRandomFactoryBean getSecureRandom()

Gets the secure random generator configuration.

Returns:SecureRandomFactoryBean

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

getTrustManagerFactoryback to summary
public TrustManagerFactoryFactoryBean getTrustManagerFactory()

Gets the trust manager factory configuration.

Returns:TrustManagerFactoryFactoryBean

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

getTrustStoreback to summary
public KeyStoreFactoryBean getTrustStore()

Gets the trust store configuration.

Returns:KeyStoreFactoryBean

trust store factory bean or null if no trust store configuration was provided

keyStoreFromSystemPropertiesback to summary
private KeyStoreFactoryBean keyStoreFromSystemProperties(String property)

Constructs a key store factory bean using JSSE system properties.

Parameters
property:String

base property name (e.g. javax.net.ssl.keyStore)

Returns:KeyStoreFactoryBean

key store or null if no value is defined for the base system property name

locationFromSystemPropertyback to summary
private String locationFromSystemProperty(String name)

Constructs a resource location from a JSSE system property.

Parameters
name:String

property name (e.g. javax.net.ssl.keyStore)

Returns:String

URL for the location specified in the property or null if no value is defined for the property

setKeyManagerFactoryback to summary
public void setKeyManagerFactory(KeyManagerFactoryFactoryBean keyManagerFactory)

Sets the key manager factory configuration.

Parameters
keyManagerFactory:KeyManagerFactoryFactoryBean

the key manager factory bean to set

setKeyStoreback to summary
public void setKeyStore(KeyStoreFactoryBean keyStore)

Sets the key store configuration.

Parameters
keyStore:KeyStoreFactoryBean

the key store factory bean to set

setProtocolback to summary
public void setProtocol(String protocol)

Sets the secure transport protocol name.

Parameters
protocol:String

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.

setProviderback to summary
public void setProvider(String provider)

Sets the JSSE provider name for the SSL context.

Parameters
provider:String

name of the JSSE provider to use in creating the SSL context

setSecureRandomback to summary
public void setSecureRandom(SecureRandomFactoryBean secureRandom)

Sets the secure random generator configuration.

Parameters
secureRandom:SecureRandomFactoryBean

the secure random factory bean to set

setTrustManagerFactoryback to summary
public void setTrustManagerFactory(TrustManagerFactoryFactoryBean trustManagerFactory)

Sets the trust manager factory configuration.

Parameters
trustManagerFactory:TrustManagerFactoryFactoryBean

the factory bean to set

setTrustStoreback to summary
public void setTrustStore(KeyStoreFactoryBean trustStore)

Sets the trust store configuration.

Parameters
trustStore:KeyStoreFactoryBean

the trust store factory bean to set