Package org.jboss.netty.handler.ssl
Class JdkSslServerContext
- java.lang.Object
-
- org.jboss.netty.handler.ssl.SslContext
-
- org.jboss.netty.handler.ssl.JdkSslContext
-
- org.jboss.netty.handler.ssl.JdkSslServerContext
-
public final class JdkSslServerContext extends JdkSslContext
A server-sideSslContextwhich uses JDK's SSL/TLS implementation.
-
-
Field Summary
Fields Modifier and Type Field Description private javax.net.ssl.SSLContextctxprivate java.util.List<java.lang.String>nextProtocols-
Fields inherited from class org.jboss.netty.handler.ssl.JdkSslContext
DEFAULT_CIPHERS, PROTOCOL, PROTOCOLS
-
-
Constructor Summary
Constructors Constructor Description JdkSslServerContext(java.io.File certChainFile, java.io.File keyFile)Creates a new instance.JdkSslServerContext(java.io.File certChainFile, java.io.File keyFile, java.lang.String keyPassword)Creates a new instance.JdkSslServerContext(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 Static Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.net.ssl.SSLContextcontext()Returns the JDKSSLContextobject held by this context.private static java.security.spec.PKCS8EncodedKeySpecgenerateKeySpec(char[] password, byte[] key)Generates a key specification for an (encrypted) private key.booleanisClient()Returns thetrueif and only if this context is for client-side.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.-
Methods inherited from class org.jboss.netty.handler.ssl.JdkSslContext
cipherSuites, newEngine, newEngine, sessionCacheSize, sessionContext, sessionTimeout
-
Methods inherited from class org.jboss.netty.handler.ssl.SslContext
bufferPool, defaultClientProvider, defaultServerProvider, isServer, newBufferPool, newClientContext, newClientContext, newClientContext, newClientContext, newClientContext, newClientContext, newClientContext, newClientContext, newClientContext, newClientContext, newHandler, newHandler, newServerContext, newServerContext, newServerContext, newServerContext, newServerContext, newServerContext
-
-
-
-
Constructor Detail
-
JdkSslServerContext
public JdkSslServerContext(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
-
JdkSslServerContext
public JdkSslServerContext(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
-
JdkSslServerContext
public JdkSslServerContext(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
-
isClient
public boolean isClient()
Description copied from class:SslContextReturns thetrueif and only if this context is for client-side.- Specified by:
isClientin 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 javax.net.ssl.SSLContext context()
Description copied from class:JdkSslContextReturns the JDKSSLContextobject held by this context.- Specified by:
contextin classJdkSslContext
-
generateKeySpec
private static java.security.spec.PKCS8EncodedKeySpec generateKeySpec(char[] password, byte[] key) throws java.io.IOException, java.security.NoSuchAlgorithmException, javax.crypto.NoSuchPaddingException, java.security.spec.InvalidKeySpecException, java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterExceptionGenerates a key specification for an (encrypted) private key.- Parameters:
password- characters, ifnullor empty an unencrypted key is assumedkey- bytes of the DER encoded private key- Returns:
- a key specification
- Throws:
java.io.IOException- if parsingkeyfailsjava.security.NoSuchAlgorithmException- if the algorithm used to encryptkeyis unkownjavax.crypto.NoSuchPaddingException- if the padding scheme specified in the decryption algorithm is unkownjava.security.spec.InvalidKeySpecException- if the decryption key based onpasswordcannot be generatedjava.security.InvalidKeyException- if the decryption key based onpasswordcannot be used to decryptkeyjava.security.InvalidAlgorithmParameterException- if decryption algorithm parameters are somehow faulty
-
-