Class SslConfiguration
- java.lang.Object
-
- org.apache.logging.log4j.core.net.ssl.SslConfiguration
-
@Plugin(name="Ssl", category="Core", printObject=true) public class SslConfiguration extends java.lang.Object
SSL Configuration
-
-
Field Summary
Fields Modifier and Type Field Description private KeyStoreConfigurationkeyStoreConfigprivate static StatusLoggerLOGGERprivate java.lang.Stringprotocolprivate javax.net.ssl.SSLContextsslContextprivate TrustStoreConfigurationtrustStoreConfigprivate booleanverifyHostName
-
Constructor Summary
Constructors Modifier Constructor Description privateSslConfiguration(java.lang.String protocol, KeyStoreConfiguration keyStoreConfig, TrustStoreConfiguration trustStoreConfig, boolean verifyHostName)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearSecrets()Clears the secret fields in this object but still allow it to operate normally.private javax.net.ssl.SSLContextcreateDefaultSslContext()static SslConfigurationcreateSSLConfiguration(java.lang.String protocol, KeyStoreConfiguration keyStoreConfig, TrustStoreConfiguration trustStoreConfig)Creates an SslConfiguration from a KeyStoreConfiguration and a TrustStoreConfiguration.static SslConfigurationcreateSSLConfiguration(java.lang.String protocol, KeyStoreConfiguration keyStoreConfig, TrustStoreConfiguration trustStoreConfig, boolean verifyHostName)Creates an SslConfiguration from a KeyStoreConfiguration and a TrustStoreConfiguration.private javax.net.ssl.SSLContextcreateSslContext()private javax.net.ssl.SSLContextcreateSslContext(boolean loadDefaultKeyManagerFactory, boolean loadDefaultTrustManagerFactory)private javax.net.ssl.SSLContextcreateSslContextBasedOnConfiguration()private javax.net.ssl.SSLContextcreateSslContextWithDefaultKeyManagerFactory()private javax.net.ssl.SSLContextcreateSslContextWithDefaultTrustManagerFactory()private javax.net.ssl.SSLContextcreateSslContextWithKeyStoreFailure()private javax.net.ssl.SSLContextcreateSslContextWithTrustStoreFailure()booleanequals(java.lang.Object obj)KeyStoreConfigurationgetKeyStoreConfig()java.lang.StringgetProtocol()javax.net.ssl.SSLContextgetSslContext()javax.net.ssl.SSLServerSocketFactorygetSslServerSocketFactory()javax.net.ssl.SSLSocketFactorygetSslSocketFactory()TrustStoreConfigurationgetTrustStoreConfig()inthashCode()booleanisVerifyHostName()private javax.net.ssl.KeyManagerFactoryloadKeyManagerFactory()private javax.net.ssl.TrustManagerFactoryloadTrustManagerFactory()
-
-
-
Field Detail
-
LOGGER
private static final StatusLogger LOGGER
-
keyStoreConfig
private final KeyStoreConfiguration keyStoreConfig
-
trustStoreConfig
private final TrustStoreConfiguration trustStoreConfig
-
sslContext
private final javax.net.ssl.SSLContext sslContext
-
protocol
private final java.lang.String protocol
-
verifyHostName
private final boolean verifyHostName
-
-
Constructor Detail
-
SslConfiguration
private SslConfiguration(java.lang.String protocol, KeyStoreConfiguration keyStoreConfig, TrustStoreConfiguration trustStoreConfig, boolean verifyHostName)
-
-
Method Detail
-
clearSecrets
public void clearSecrets()
Clears the secret fields in this object but still allow it to operate normally.
-
getSslSocketFactory
public javax.net.ssl.SSLSocketFactory getSslSocketFactory()
-
getSslServerSocketFactory
public javax.net.ssl.SSLServerSocketFactory getSslServerSocketFactory()
-
createSslContext
private javax.net.ssl.SSLContext createSslContext()
-
createSslContextWithTrustStoreFailure
private javax.net.ssl.SSLContext createSslContextWithTrustStoreFailure()
-
createSslContextWithKeyStoreFailure
private javax.net.ssl.SSLContext createSslContextWithKeyStoreFailure()
-
createSslContextBasedOnConfiguration
private javax.net.ssl.SSLContext createSslContextBasedOnConfiguration() throws KeyStoreConfigurationException, TrustStoreConfigurationException
-
createSslContextWithDefaultKeyManagerFactory
private javax.net.ssl.SSLContext createSslContextWithDefaultKeyManagerFactory() throws TrustStoreConfigurationException- Throws:
TrustStoreConfigurationException
-
createSslContextWithDefaultTrustManagerFactory
private javax.net.ssl.SSLContext createSslContextWithDefaultTrustManagerFactory() throws KeyStoreConfigurationException- Throws:
KeyStoreConfigurationException
-
createDefaultSslContext
private javax.net.ssl.SSLContext createDefaultSslContext()
-
createSslContext
private javax.net.ssl.SSLContext createSslContext(boolean loadDefaultKeyManagerFactory, boolean loadDefaultTrustManagerFactory) throws KeyStoreConfigurationException, TrustStoreConfigurationException
-
loadTrustManagerFactory
private javax.net.ssl.TrustManagerFactory loadTrustManagerFactory() throws TrustStoreConfigurationException- Throws:
TrustStoreConfigurationException
-
loadKeyManagerFactory
private javax.net.ssl.KeyManagerFactory loadKeyManagerFactory() throws KeyStoreConfigurationException- Throws:
KeyStoreConfigurationException
-
createSSLConfiguration
@PluginFactory public static SslConfiguration createSSLConfiguration(@PluginAttribute("protocol") java.lang.String protocol, @PluginElement("KeyStore") KeyStoreConfiguration keyStoreConfig, @PluginElement("TrustStore") TrustStoreConfiguration trustStoreConfig)
Creates an SslConfiguration from a KeyStoreConfiguration and a TrustStoreConfiguration.- Parameters:
protocol- The protocol, see http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#SSLContextkeyStoreConfig- The KeyStoreConfiguration.trustStoreConfig- The TrustStoreConfiguration.- Returns:
- a new SslConfiguration
-
createSSLConfiguration
public static SslConfiguration createSSLConfiguration(@PluginAttribute("protocol") java.lang.String protocol, @PluginElement("KeyStore") KeyStoreConfiguration keyStoreConfig, @PluginElement("TrustStore") TrustStoreConfiguration trustStoreConfig, @PluginAttribute("verifyHostName") boolean verifyHostName)
Creates an SslConfiguration from a KeyStoreConfiguration and a TrustStoreConfiguration.- Parameters:
protocol- The protocol, see http://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#SSLContextkeyStoreConfig- The KeyStoreConfiguration.trustStoreConfig- The TrustStoreConfiguration.verifyHostName- whether or not to perform host name verification- Returns:
- a new SslConfiguration
- Since:
- 2.12
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
getKeyStoreConfig
public KeyStoreConfiguration getKeyStoreConfig()
-
getTrustStoreConfig
public TrustStoreConfiguration getTrustStoreConfig()
-
getSslContext
public javax.net.ssl.SSLContext getSslContext()
-
getProtocol
public java.lang.String getProtocol()
-
isVerifyHostName
public boolean isVerifyHostName()
-
-