Package org.jboss.netty.handler.ssl
Class OpenSslServerContext
- java.lang.Object
-
- org.jboss.netty.handler.ssl.SslContext
-
- org.jboss.netty.handler.ssl.OpenSslServerContext
-
public final class OpenSslServerContext extends SslContext
A server-sideSslContextwhich uses OpenSSL's SSL/TLS implementation.
-
-
Field Summary
Fields Modifier and Type Field Description private longaprPoolprivate java.util.List<java.lang.String>ciphersprivate longctxThe OpenSSL SSL_CTX objectprivate static java.util.List<java.lang.String>DEFAULT_CIPHERSprivate static InternalLoggerloggerprivate java.util.List<java.lang.String>nextProtocolsprivate longsessionCacheSizeprivate longsessionTimeoutprivate OpenSslSessionStatsstatsprivate java.util.List<java.lang.String>unmodifiableCiphers
-
Constructor Summary
Constructors Constructor Description OpenSslServerContext(java.io.File certChainFile, java.io.File keyFile)Creates a new instance.OpenSslServerContext(java.io.File certChainFile, java.io.File keyFile, java.lang.String keyPassword)Creates a new instance.OpenSslServerContext(SslBufferPool bufPool, java.io.File certChainFile, java.io.File keyFile, java.lang.String keyPassword, java.lang.Iterable<java.lang.String> ciphers, java.lang.Iterable<java.lang.String> nextProtocols, long sessionCacheSize, long sessionTimeout)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.lang.String>cipherSuites()Returns the list of enabled cipher suites, in the order of preference.longcontext()Returns theSSL_CTXobject of this context.private voiddestroyPools()protected voidfinalize()booleanisClient()Returns thetrueif and only if this context is for client-side.(package private) SslBufferPoolnewBufferPool()javax.net.ssl.SSLEnginenewEngine()Returns a new server-sideSSLEnginewith the current configuration.javax.net.ssl.SSLEnginenewEngine(java.lang.String peerHost, int peerPort)Creates a newSSLEngineusing advisory peer information.java.util.List<java.lang.String>nextProtocols()Returns the list of application layer protocols for the TLS NPN/ALPN extension, in the order of preference.longsessionCacheSize()Returns the size of the cache used for storing SSL session objects.longsessionTimeout()Returns the timeout for the cached SSL session objects, in seconds.voidsetTicketKeys(byte[] keys)Sets the SSL session ticket keys of this context.OpenSslSessionStatsstats()Returns the stats of this context.-
Methods inherited from class org.jboss.netty.handler.ssl.SslContext
bufferPool, defaultClientProvider, defaultServerProvider, isServer, newClientContext, newClientContext, newClientContext, newClientContext, newClientContext, newClientContext, newClientContext, newClientContext, newClientContext, newClientContext, newHandler, newHandler, newServerContext, newServerContext, newServerContext, newServerContext, newServerContext, newServerContext
-
-
-
-
Field Detail
-
logger
private static final InternalLogger logger
-
DEFAULT_CIPHERS
private static final java.util.List<java.lang.String> DEFAULT_CIPHERS
-
aprPool
private final long aprPool
-
ciphers
private final java.util.List<java.lang.String> ciphers
-
unmodifiableCiphers
private final java.util.List<java.lang.String> unmodifiableCiphers
-
sessionCacheSize
private final long sessionCacheSize
-
sessionTimeout
private final long sessionTimeout
-
nextProtocols
private final java.util.List<java.lang.String> nextProtocols
-
ctx
private final long ctx
The OpenSSL SSL_CTX object
-
stats
private final OpenSslSessionStats stats
-
-
Constructor Detail
-
OpenSslServerContext
public OpenSslServerContext(java.io.File certChainFile, java.io.File keyFile) throws javax.net.ssl.SSLExceptionCreates a new instance.- Parameters:
certChainFile- an X.509 certificate chain file in PEM formatkeyFile- a PKCS#8 private key file in PEM format- Throws:
javax.net.ssl.SSLException
-
OpenSslServerContext
public OpenSslServerContext(java.io.File certChainFile, java.io.File keyFile, java.lang.String keyPassword) throws javax.net.ssl.SSLExceptionCreates a new instance.- Parameters:
certChainFile- an X.509 certificate chain file in PEM formatkeyFile- a PKCS#8 private key file in PEM formatkeyPassword- the password of thekeyFile.nullif it's not password-protected.- Throws:
javax.net.ssl.SSLException
-
OpenSslServerContext
public OpenSslServerContext(SslBufferPool bufPool, java.io.File certChainFile, java.io.File keyFile, java.lang.String keyPassword, java.lang.Iterable<java.lang.String> ciphers, java.lang.Iterable<java.lang.String> nextProtocols, long sessionCacheSize, long sessionTimeout) throws javax.net.ssl.SSLException
Creates a new instance.- Parameters:
bufPool- the buffer pool which will be used by this context.nullto use the default buffer pool.certChainFile- an X.509 certificate chain file in PEM formatkeyFile- a PKCS#8 private key file in PEM formatkeyPassword- the password of thekeyFile.nullif it's not password-protected.ciphers- the cipher suites to enable, in the order of preference.nullto use the default cipher suites.nextProtocols- the application layer protocols to accept, in the order of preference.nullto disable TLS NPN/ALPN extension.sessionCacheSize- the size of the cache used for storing SSL session objects.0to use the default value.sessionTimeout- the timeout for the cached SSL session objects, in seconds.0to use the default value.- Throws:
javax.net.ssl.SSLException
-
-
Method Detail
-
newBufferPool
SslBufferPool newBufferPool()
- Overrides:
newBufferPoolin classSslContext
-
isClient
public boolean isClient()
Description copied from class:SslContextReturns thetrueif and only if this context is for client-side.- Specified by:
isClientin classSslContext
-
cipherSuites
public java.util.List<java.lang.String> cipherSuites()
Description copied from class:SslContextReturns the list of enabled cipher suites, in the order of preference.- Specified by:
cipherSuitesin classSslContext
-
sessionCacheSize
public long sessionCacheSize()
Description copied from class:SslContextReturns the size of the cache used for storing SSL session objects.- Specified by:
sessionCacheSizein classSslContext
-
sessionTimeout
public long sessionTimeout()
Description copied from class:SslContextReturns the timeout for the cached SSL session objects, in seconds.- Specified by:
sessionTimeoutin classSslContext
-
nextProtocols
public java.util.List<java.lang.String> nextProtocols()
Description copied from class:SslContextReturns the list of application layer protocols for the TLS NPN/ALPN extension, in the order of preference.- Specified by:
nextProtocolsin classSslContext- Returns:
- the list of application layer protocols.
nullif NPN/ALPN extension has been disabled.
-
context
public long context()
Returns theSSL_CTXobject of this context.
-
stats
public OpenSslSessionStats stats()
Returns the stats of this context.
-
newEngine
public javax.net.ssl.SSLEngine newEngine()
Returns a new server-sideSSLEnginewith the current configuration.- Specified by:
newEnginein classSslContext- Returns:
- a new
SSLEngine
-
newEngine
public javax.net.ssl.SSLEngine newEngine(java.lang.String peerHost, int peerPort)Description copied from class:SslContextCreates a newSSLEngineusing advisory peer information.- Specified by:
newEnginein classSslContext- Parameters:
peerHost- the non-authoritative name of the hostpeerPort- the non-authoritative port- Returns:
- a new
SSLEngine
-
setTicketKeys
public void setTicketKeys(byte[] keys)
Sets the SSL session ticket keys of this context.
-
finalize
protected void finalize() throws java.lang.Throwable- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
destroyPools
private void destroyPools()
-
-