java.lang.Object
ch.qos.logback.core.net.ssl.SSLContextFactoryBean
- Direct Known Subclasses:
SSLConfiguration
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
-
Method Summary
Modifier and TypeMethodDescriptioncreateContext
(ContextAware context) Creates a newSSLContext
using the receiver's configuration.Gets the key manager factory configuration.Gets the key store configuration.Gets the secure transport protocol name.Gets the JSSE provider name for the SSL context.Gets the secure random generator configuration.Gets the trust manager factory configuration.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.
-
Constructor Details
-
SSLContextFactoryBean
public SSLContextFactoryBean()
-
-
Method Details
-
createContext
public SSLContext createContext(ContextAware context) throws NoSuchProviderException, NoSuchAlgorithmException, KeyManagementException, UnrecoverableKeyException, KeyStoreException, CertificateException Creates a newSSLContext
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 platformNoSuchAlgorithmException
- 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 aKeyManager
for the contextUnrecoverableKeyException
- if a private key needed by aKeyManager
cannot be obtained from a key storeKeyStoreException
- if an error occurs in reading the contents of a key storeCertificateException
- if an error occurs in reading the contents of a certificate
-
getKeyStore
Gets the key store configuration.- Returns:
- key store factory bean or
null
if no key store configuration was provided
-
setKeyStore
Sets the key store configuration.- Parameters:
keyStore
- the key store factory bean to set
-
getTrustStore
Gets the trust store configuration.- Returns:
- trust store factory bean or
null
if no trust store configuration was provided
-
setTrustStore
Sets the trust store configuration.- Parameters:
trustStore
- the trust store factory bean to set
-
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
Sets the secure random generator configuration.- Parameters:
secureRandom
- the secure random factory bean to set
-
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
Sets the key manager factory configuration.- Parameters:
keyManagerFactory
- the key manager factory bean to set
-
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
Sets the trust manager factory configuration.- Parameters:
trustManagerFactory
- the factory bean to set
-
getProtocol
Gets the secure transport protocol name.- Returns:
- protocol name (e.g.
SSL
,TLS
); theSSL.DEFAULT_PROTOCOL
is returned if no protocol has been configured
-
setProtocol
Sets the secure transport protocol name.- Parameters:
protocol
- a protocol name, which must be recognized by the provider specified bysetProvider(String)
or by the platform's default provider if no platform was specified.
-
getProvider
Gets the JSSE provider name for the SSL context.- Returns:
- JSSE provider name
-
setProvider
Sets the JSSE provider name for the SSL context.- Parameters:
provider
- name of the JSSE provider to use in creating the SSL context
-